diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2000-09-18 15:18:56 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2000-09-18 15:18:56 +0000 |
commit | c25ec0608a167bcf1d891043f02273761c351701 (patch) | |
tree | 32c3e19f0b663e37ad1910e8fddeac200ad3856d |
initial import
493 files changed, 152257 insertions, 0 deletions
diff --git a/basic/inc/basrid.hxx b/basic/inc/basrid.hxx new file mode 100644 index 000000000000..ef7a886441d2 --- /dev/null +++ b/basic/inc/basrid.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * $RCSfile: basrid.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:07 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _BASRID_HXX +#define _BASRID_HXX + +#ifndef _TOOLS_RESID_HXX //autogen +#include <tools/resid.hxx> +#endif + +class BasicResId: public ResId +{ +public: + BasicResId( USHORT nId ); +}; + +#endif //_BASRID_HXX diff --git a/basic/inc/sb.hrc b/basic/inc/sb.hrc new file mode 100644 index 000000000000..c7d7c2bc6697 --- /dev/null +++ b/basic/inc/sb.hrc @@ -0,0 +1,81 @@ +/************************************************************************* + * + * $RCSfile: sb.hrc,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:07 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SB_HRC +#define _SB_HRC + +#include <svtools/solar.hrc> + +#ifndef IDS_SBERR_START + #define IDS_SBERR_START RID_BASIC_START +#endif + +#define IDS_SBERR_TERMINATED IDS_SBERR_START+2000 +#define IDS_SBERR_STOREREF IDS_SBERR_START+2001 + +// #define IDS_SBERR_LIBLOAD IDS_SBERR_START+2002 +// #define IDS_SBERR_LIBSAVE IDS_SBERR_START+2003 +// #define IDS_SBERR_MGROPEN IDS_SBERR_START+2004 +// #define IDS_SBERR_MGRSAVE IDS_SBERR_START+2005 +// #define IDS_SBERR_REMOVELIB IDS_SBERR_START+2006 +// #define IDS_SBERR_UNLOADLIB IDS_SBERR_START+2007 + +#endif diff --git a/basic/inc/sb.hxx b/basic/inc/sb.hxx new file mode 100644 index 000000000000..5cae2d1ebefe --- /dev/null +++ b/basic/inc/sb.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * $RCSfile: sb.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:07 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SB_HXX +#define _SB_HXX + +#ifndef _SBERRORS_HXX + #include "sberrors.hxx" +#endif + + +#include <sbdef.hxx> +#include <sbmeth.hxx> +#include <sbmod.hxx> +#include <sbprop.hxx> +#include <sbstar.hxx> + +#endif diff --git a/basic/inc/testtool.hrc b/basic/inc/testtool.hrc new file mode 100644 index 000000000000..28f82508fa0e --- /dev/null +++ b/basic/inc/testtool.hrc @@ -0,0 +1,70 @@ +/************************************************************************* + * + * $RCSfile: testtool.hrc,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:07 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#define S_INVALID_KEYCODE 257 +#define S_MANDATORY_FILE 258 +#define S_READING_LONGNAMES 259 +#define S_READING_SLOT_IDS 260 +#define S_READING_CONTROLS 261 +#define S_READING_BASIC_MODULE 262 +#define S_STARTING_APPLICATION 263 + + + diff --git a/basic/inc/ttmsg.hrc b/basic/inc/ttmsg.hrc new file mode 100644 index 000000000000..3e7074566708 --- /dev/null +++ b/basic/inc/ttmsg.hrc @@ -0,0 +1,147 @@ +/************************************************************************* + * + * $RCSfile: ttmsg.hrc,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:07 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#include <svtools/ttglobal.hrc> + + +// Hier sind die Messages aus dem Verzeichnis /basic/source/testtool enhalten + + +/////////////////////////////// +// Fehlermeldungen, die in das Resultfile gelangen. +// ********************* +// *** !!ACHTUNG!! *** +// ********************* +// Die Nummern dürfen sich NIE! ändern, +// da sie in den Resultfiles gespeichert sind, und bei erneutem Anzeigen +// statdessen die entsprechenden neuen oder garkeine Strings angzeigt werden. +/////////////////////////////// + +#define S_NAME_NOT_THERE ( TT_START + 0 ) +#define S_DOUBLE_NAME ( TT_START + 1 ) +#define S_READING_FILE ( TT_START + 2 ) +#define S_CANNOT_OPEN_FILE ( TT_START + 3 ) +#define S_INVALID_LINE ( TT_START + 4 ) +#define S_SHORTNAME_UNKNOWN ( TT_START + 5 ) +#define S_LONGNAME_UNKNOWN ( TT_START + 6 ) +#define S_FIRST_SHORTNAME_REQ_ASTRX ( TT_START + 7 ) +#define S_TIMOUT_WAITING ( TT_START + 8 ) +#define S_APPLICATION_RESTARTED ( TT_START + 9 ) +#define S_APPLICATION_START_FAILED ( TT_START + 10 ) +#define S_TIMOUT_SENDING ( TT_START + 11 ) +#define S_NO_CONNECTION ( TT_START + 12 ) +#define S_NO_FILES_FOUND ( TT_START + 13 ) +#define S_ERRORS_DETECTED ( TT_START + 14 ) +#define S_NO_ERRORS_DETECTED ( TT_START + 15 ) +#define S_WARNINGS_DETECTED ( TT_START + 16 ) +#define S_NO_WARNINGS_DETECTED ( TT_START + 17 ) +#define S_UNKNOWN_SLOT_CONTROL ( TT_START + 18 ) +#define S_RETURN_SEQUENCE_MISSMATCH ( TT_START + 19 ) +#define S_RETURNED_VALUE_ID_MISSMATCH ( TT_START + 20 ) +#define S_RETURNED_VALUE_NO_RECEIVER ( TT_START + 21 ) +#define S_UNKNOWN_METHOD ( TT_START + 22 ) +#define S_INCLUDE_FILE_WARNINGS_DETECTED ( TT_START + 23 ) +#define S_NO_INCLUDE_FILE_WARNINGS_DETECTED ( TT_START + 24 ) + + +// Stings + + +/* +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +#define S_ ( TT_START + 0 ) +*/ diff --git a/basic/prj/d.lst b/basic/prj/d.lst new file mode 100644 index 000000000000..bde728a2833c --- /dev/null +++ b/basic/prj/d.lst @@ -0,0 +1,44 @@ +touch: ..\%__SRC%\misc\basic.hid %_DEST%\bin%_EXT%\basic.hid +..\%__SRC%\lib\basic.lib %_DEST%\lib%_EXT%\basic.lib +..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\*.so +..\%__SRC%\lib\*.a %_DEST%\lib%_EXT%\*.a +..\%__SRC%\slb\sb.lib %_DEST%\lib%_EXT%\xsb.lib +..\%__SRC%\srs\classes.srs %_DEST%\res%_EXT%\basic.srs +..\%__SRC%\res\*.srs %_DEST%\res%_EXT%\*.srs +..\%__SRC%\bin\sb?????.dll %_DEST%\bin%_EXT%\sb?????.dll +..\%__SRC%\bin\sb?????.sym %_DEST%\bin%_EXT%\sb?????.sym +..\%__SRC%\misc\sb?????.map %_DEST%\bin%_EXT%\sb?????.map +..\%__SRC%\bin\testtool.exe %_DEST%\bin%_EXT%\testtool.exe +..\%__SRC%\bin\testtool %_DEST%\bin%_EXT%\testtool.bin +..\%__SRC%\bin\stt%UPD%49.res %_DEST%\bin%_EXT%\testtool.res +..\%__SRC%\bin\stt*.res %_DEST%\bin%_EXT%\stt*.res +..\%__SRC%\inc\classes %_DEST%\bin%_EXT%\classes +..\%__SRC%\inc\keycodes %_DEST%\bin%_EXT%\keycodes +..\%__SRC%\inc\res_type %_DEST%\bin%_EXT%\res_type +..\%__SRC%\lib\app.lib %_DEST%\lib%_EXT%\app.lib +..\%__SRC%\lib\libapp.a %_DEST%\lib%_EXT%\libapp.a +..\%__SRC%\lib\sample.lib %_DEST%\lib%_EXT%\sample.lib +..\%__SRC%\lib\libsample.a %_DEST%\lib%_EXT%\libsample.a + +mkdir: %_DEST%\inc%_EXT%\basic +hedabu: ..\inc\sbdef.hxx %_DEST%\inc%_EXT%\basic\sbdef.hxx +hedabu: ..\inc\sbmod.hxx %_DEST%\inc%_EXT%\basic\sbmod.hxx +hedabu: ..\inc\sbjsmod.hxx %_DEST%\inc%_EXT%\basic\sbjsmod.hxx +hedabu: ..\inc\sbmeth.hxx %_DEST%\inc%_EXT%\basic\sbmeth.hxx +hedabu: ..\inc\sbprop.hxx %_DEST%\inc%_EXT%\basic\sbprop.hxx +hedabu: ..\inc\sbstar.hxx %_DEST%\inc%_EXT%\basic\sbstar.hxx +hedabu: ..\inc\sbuno.hxx %_DEST%\inc%_EXT%\basic\sbuno.hxx +hedabu: ..\inc\basmgr.hxx %_DEST%\inc%_EXT%\basic\basmgr.hxx +hedabu: ..\inc\sberrors.hxx %_DEST%\inc%_EXT%\basic\sberrors.hxx +hedabu: ..\inc\basrdll.hxx %_DEST%\inc%_EXT%\basic\basrdll.hxx +hedabu: ..\inc\stdobj1.hxx %_DEST%\inc%_EXT%\basic\sbstdobj.hxx +hedabu: ..\inc\hilight.hxx %_DEST%\inc%_EXT%\basic\hilight.hxx +hedabu: ..\inc\process.hxx %_DEST%\inc%_EXT%\basic\process.hxx +hedabu: ..\inc\testtool.hrc %_DEST%\inc%_EXT%\basic\testtool.hrc +hedabu: ..\inc\ttmsg.hrc %_DEST%\inc%_EXT%\basic\ttmsg.hrc +hedabu: ..\inc\mybasic.hxx %_DEST%\inc%_EXT%\basic\mybasic.hxx +hedabu: ..\inc\testtool.hxx %_DEST%\inc%_EXT%\basic\testtool.hxx +hedabu: ..\inc\basicrt.hxx %_DEST%\inc%_EXT%\basic\basicrt.hxx +hedabu: ..\inc\dispdefs.hxx %_DEST%\inc%_EXT%\basic\dispdefs.hxx +hedabu: ..\inc\ttstrhlp.hxx %_DEST%\inc%_EXT%\basic\ttstrhlp.hxx + diff --git a/basic/source/app/app.cxx b/basic/source/app/app.cxx new file mode 100644 index 000000000000..35a50b904abd --- /dev/null +++ b/basic/source/app/app.cxx @@ -0,0 +1,1580 @@ +/************************************************************************* + * + * $RCSfile: app.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _MSGBOX_HXX //autogen +#include <vcl/msgbox.hxx> +#endif +#ifndef _FSYS_HXX //autogen +#include <tools/fsys.hxx> +#endif +#ifndef _SV_FILEDLG_HXX //autogen +#include <svtools/filedlg.hxx> +#endif +#ifndef _SV_CONFIG_HXX //autogen +#include <vcl/config.hxx> +#endif + +#include <vcl/system.hxx> + +#include <vcl/font.hxx> + +#ifndef _BASIC_TTRESHLP_HXX +#include "ttstrhlp.hxx" +#endif + +#ifndef _SBXCLASS_HXX //autogen +#include <svtools/sbx.hxx> +#endif +#ifdef VCL +#include <svtools/filedlg.hxx> +#endif + +#include "basic.hrc" +#include "app.hxx" +#include "printer.hxx" +#include "status.hxx" +#include "appedit.hxx" +#include "appbased.hxx" +#include "apperror.hxx" +#include "mybasic.hxx" +#include "ttbasic.hxx" +#include "dialogs.hxx" +#include "basrdll.hxx" + +#ifndef _RUNTIME_HXX +#include "runtime.hxx" +#endif + +#ifndef _SB_INTERN_HXX +#include "sbintern.hxx" +#endif + +#ifdef _USE_UNO +#include <ucbhelper/contentbroker.hxx> +#include <ucbhelper/registerucb.hxx> +#include <unotools/regpathhelper.hxx> +#include <unotools/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 <com/sun/star/ucb/ContentProviderServiceInfo2.hpp> + +using namespace utl; +using namespace ucb; +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; + +#endif /* _USE_UNO */ + + +BasicApp aBasicApp; // Applikations-Instanz + +#ifdef _USE_UNO +Reference< XContentProviderManager > InitializeUCB( std::vector< ucb::ContentProviderRegistrationInfo > &rRegisteredProviders ) +{ + ////////////////////////////////////////////////////////////////////// + // Bootstrap service factory, set global factory + Reference< XMultiServiceFactory > xSMgr( createRegistryServiceFactory( getPathToSystemRegistry() ) ); + setProcessServiceFactory( xSMgr ); + + ////////////////////////////////////////////////////////////////////// + // Create UCB. + Reference< XImplementationRegistration > + xIR( xSMgr->createInstance( OUString::createFromAscii( "com.sun.star.registry.ImplementationRegistration" ) ), UNO_QUERY ); + xIR->registerImplementation( OUString::createFromAscii( "com.sun.star.loader.SharedLibrary" ), + OUString::createFromAscii( "ucb1.dll" ), + Reference< XSimpleRegistry >() ); + xIR->registerImplementation( OUString::createFromAscii( "com.sun.star.loader.SharedLibrary" ), + OUString::createFromAscii( "ucpfile1.dll" ), + Reference< XSimpleRegistry >() ); + xIR->registerImplementation( OUString::createFromAscii( "com.sun.star.loader.SharedLibrary" ), + OUString::createFromAscii( "fileacc.dll" ), + Reference< XSimpleRegistry >() ); + + // Create unconfigured Ucb: + Sequence< Any > aArgs(1); + aArgs[0] <<= sal_False; + ucb::ContentBroker::initialize( xSMgr, aArgs ); + Reference< XContentProviderManager > xUcb = ucb::ContentBroker::get()->getContentProviderManagerInterface(); + /* + Reference< XContentProviderManager > xUcb( + xSMgr->createInstanceWithArguments( + OUString::createFromAscii( + "com.sun.star.ucb.UniversalContentBroker" ), + aArgs ), + UNO_QUERY ); + */ + // Configure Ucb (use only file content provider): + Sequence< ContentProviderServiceInfo2 > aProviders(1); + aProviders[0].Service + = OUString::createFromAscii( + "com.sun.star.ucb.FileContentProvider"); + aProviders[0].Scheme = OUString::createFromAscii("file"); + aProviders[0].ReplaceExisting = false; + ucb::registerAtUcb(xUcb, xSMgr, aProviders, &rRegisteredProviders); + return xUcb; +} +#endif + +void BasicApp::Main( ) +{ +#ifdef _USE_UNO + std::vector< ucb::ContentProviderRegistrationInfo > aRegisteredProviders; + Reference< XContentProviderManager > xUcb = InitializeUCB( aRegisteredProviders ); +#endif + { + LanguageType aRequestedLanguage; + Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); + + // 1033 = LANGUAGE_ENGLISH_US + // 1031 = LANGUAGE_GERMAN + aConf.SetGroup("Misc"); + ByteString aLang = aConf.ReadKey( "Language", ByteString::CreateFromInt32( LANGUAGE_SYSTEM ) ); + aRequestedLanguage = LanguageType( aLang.ToInt32() ); + + AllSettings aSettings = GetSettings(); + International aInternational; + aInternational = GetSettings().GetInternational(); + aInternational = International( aRequestedLanguage ); + aSettings.SetInternational( aInternational ); + SetSettings( aSettings ); + aInternational = GetSettings().GetInternational(); + } + + +// ResMgr::CreateResMgr( CREATEVERSIONRESMGR( stt ), ) +//const char* ResMgr::GetLang( LanguageType& nType, USHORT nPrio ) + + Resource::SetResManager( CREATEVERSIONRESMGR( stt ) ); +// ResMgr::CreateResMgr( CREATEVERSIONRESMGR( stt ) +// ResMgr *pRes = new ResMgr( "testtool.res" ); +// Resource::SetResManager( pRes ); + + BasicDLL aBasicDLL; + nWait = 0; + + // Hilfe: +// pHelp = new Help; +// SetHelp( pHelp ); +// Help::EnableContextHelp(); +// Help::EnableExtHelp(); +// DeactivateExtHelp(); + + // Acceleratoren + Accelerator aAccel( ResId( MAIN_ACCEL ) ); + InsertAccel( &aAccel ); + pMainAccel = &aAccel; + + // Frame Window: + pFrame = new BasicFrame; + aAccel.SetSelectHdl( LINK( pFrame, BasicFrame, Accel ) ); + + pFrame->Show(); + + GetpApp()->PostUserEvent( LINK( this, BasicApp, LateInit ) ); + Execute(); + + // Loeschen der Members: +// delete pHelp; + delete pFrame; + + RemoveAccel( pMainAccel ); +#ifdef _USE_UNO + ucb::deregisterFromUcb(xUcb, aRegisteredProviders); +#endif +} + +void BasicApp::LoadIniFile() +{ + pFrame->LoadIniFile(); +} + +void BasicApp::SetFocus() +{ + if( pFrame->pWork && pFrame->pWork->ISA(AppEdit) ) + ((AppEdit*)pFrame->pWork)->pDataEdit->GrabFocus(); +} + +IMPL_LINK( BasicApp, LateInit, void *, pDummy ) +{ + BOOL bFileLoaded = FALSE; + for ( int i = 0 ; i < Application::GetCommandLineParamCount() ; i++ ) + { + if ( Application::GetCommandLineParam( i ).Copy(0,1).CompareToAscii("-") != COMPARE_EQUAL ) + { + pFrame->LoadFile( Application::GetCommandLineParam( i ) ); + bFileLoaded = TRUE; + } + else + { + if ( Application::GetCommandLineParam( i ).Copy(0,4).CompareIgnoreCaseToAscii("-run") == COMPARE_EQUAL ) + pFrame->SetAutoRun( TRUE ); + } + } + + if ( !bFileLoaded ) + { + AppWin *pWin = new AppBasEd( pFrame, NULL ); + pWin->Show(); + } + + pFrame->pStatus->SetStatusSize( pFrame->pStatus->GetStatusSize()+1 ); + pFrame->pStatus->SetStatusSize( pFrame->pStatus->GetStatusSize()-1 ); + + if ( pFrame->IsAutoRun() ) + { + pFrame->Command( RID_RUNSTART ); + } + + if ( pFrame->IsAutoRun() ) + pFrame->Command( RID_QUIT ); + + return 0; +} + +////////////////////////////////////////////////////////////////////////// + +class FloatingExecutionStatus : public FloatingWindow +{ +public: + FloatingExecutionStatus( Window * pParent ); + void SetStatus( String aW ); + void SetAdditionalInfo( String aF ); + +private: + Timer aAusblend; + DECL_LINK(HideNow, FloatingExecutionStatus* ); + FixedText aStatus; + FixedText aAdditionalInfo; +}; + + +FloatingExecutionStatus::FloatingExecutionStatus( Window * pParent ) + : FloatingWindow( pParent, ResId(LOAD_CONF) ), + aStatus( this, ResId( WORK ) ), + aAdditionalInfo( this, ResId( FILENAME ) ) +{ + FreeResource(); + aAusblend.SetTimeoutHdl( LINK(this, FloatingExecutionStatus, HideNow ) ); + aAusblend.SetTimeout(5000); // in ms + aAusblend.Start(); +} + +void FloatingExecutionStatus::SetStatus( String aW ) +{ + Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); + ToTop( TOTOP_NOGRABFOCUS ); + aAusblend.Start(); + aStatus.SetText( aW ); +} + +void FloatingExecutionStatus::SetAdditionalInfo( String aF ) +{ + Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); + ToTop( TOTOP_NOGRABFOCUS ); + aAusblend.Start(); + aAdditionalInfo.SetText( aF ); +} + +IMPL_LINK(FloatingExecutionStatus, HideNow, FloatingExecutionStatus*, pFLC ) +{ + Hide(); + return 0; +} + +////////////////////////////////////////////////////////////////////////// + +TYPEINIT1(TTExecutionStatusHint, SfxSimpleHint); + +BasicFrame::BasicFrame() : WorkWindow( NULL, + WinBits( WB_APP | WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE ) ) +, bIsAutoRun ( FALSE ) +, pDisplayHidDlg( NULL ) +, pBasic( NULL ) +, pWork( NULL ) +, pExecutionStatus( NULL ) +{ + + pBasic = TTBasic::CreateMyBasic(); // depending on what was linked to the executable + bInBreak = FALSE; + bDisas = FALSE; + nFlags = 0; +// Icon aAppIcon; + + if ( pBasic->pTestObject ) // also sid wir testtool + { +// aAppIcon = Icon( ResId( RID_APPICON2 ) ); + aAppName = String( ResId( IDS_APPNAME2 ) ); + } + else + { +// aAppIcon = Icon( ResId( RID_APPICON ) ); + aAppName = String( ResId( IDS_APPNAME ) ); + } + + // Menu: + MenuBar *pBar = new MenuBar( ResId( RID_APPMENUBAR ) ); + SetMenuBar( pBar ); + + pBar->SetHighlightHdl( LINK( this, BasicFrame, HighlightMenu ) ); + + + // Menu Handler: + PopupMenu* pFileMenu = pBar->GetPopupMenu( RID_APPFILE ); + pFileMenu->SetSelectHdl( LINK( this, BasicFrame, MenuCommand ) ); + pFileMenu->SetHighlightHdl( LINK( this, BasicFrame, HighlightMenu ) ); + pFileMenu->SetActivateHdl( LINK( this, BasicFrame, InitMenu ) ); + pFileMenu->SetDeactivateHdl( LINK( this, BasicFrame, DeInitMenu ) ); + if (Basic().pTestObject ) // Wir sind also TestTool + { + pFileMenu->RemoveItem( pFileMenu->GetItemPos( RID_FILELOADLIB ) -1 ); // Der Trenner davor + pFileMenu->RemoveItem( pFileMenu->GetItemPos( RID_FILELOADLIB ) ); + pFileMenu->RemoveItem( pFileMenu->GetItemPos( RID_FILESAVELIB ) ); + } + + PopupMenu* pEditMenu = pBar->GetPopupMenu( RID_APPEDIT ); + pEditMenu->SetSelectHdl( LINK( this, BasicFrame, MenuCommand ) ); + pEditMenu->SetHighlightHdl( LINK( this, BasicFrame, HighlightMenu ) ); + pEditMenu->SetActivateHdl( LINK( this, BasicFrame, InitMenu ) ); + pEditMenu->SetDeactivateHdl( LINK( this, BasicFrame, DeInitMenu ) ); + PopupMenu* pRunMenu = pBar->GetPopupMenu( RID_APPRUN ); + pRunMenu->SetSelectHdl( LINK( this, BasicFrame, MenuCommand ) ); + pRunMenu->SetHighlightHdl( LINK( this, BasicFrame, HighlightMenu ) ); + pRunMenu->SetActivateHdl( LINK( this, BasicFrame, InitMenu ) ); + pRunMenu->SetDeactivateHdl( LINK( this, BasicFrame, DeInitMenu ) ); + if (Basic().pTestObject ) // Wir sind also TestTool + { + pRunMenu->RemoveItem( pRunMenu->GetItemPos( RID_RUNDISAS ) ); + } + + PopupMenu *pExtras; + if (Basic().pTestObject ) // Wir sind also TestTool + { + pExtras = new PopupMenu( ResId( RID_TT_EXTRAS ) ); + pBar->InsertItem( RID_TT_EXTRAS, String( ResId( RID_TT_EXTRAS_NAME ) ), 0, pBar->GetItemPos( RID_APPWINDOW ) ); + pBar->SetPopupMenu( RID_TT_EXTRAS, pExtras ); + + pExtras->SetSelectHdl( LINK( this, BasicFrame, MenuCommand ) ); + pExtras->SetHighlightHdl( LINK( this, BasicFrame, HighlightMenu ) ); + pExtras->SetDeactivateHdl( LINK( this, BasicFrame, DeInitMenu ) ); + } + + PopupMenu* pWinMenu = pBar->GetPopupMenu( RID_APPWINDOW ); + pWinMenu->SetSelectHdl( LINK( this, BasicFrame, MenuCommand ) ); + pWinMenu->SetHighlightHdl( LINK( this, BasicFrame, HighlightMenu ) ); + pWinMenu->SetDeactivateHdl( LINK( this, BasicFrame, DeInitMenu ) ); + PopupMenu* pHelpMenu = pBar->GetPopupMenu( RID_APPHELP ); + pHelpMenu->SetSelectHdl( LINK( this, BasicFrame, MenuCommand ) ); + pHelpMenu->SetHighlightHdl( LINK( this, BasicFrame, HighlightMenu ) ); + pHelpMenu->SetActivateHdl( LINK( this, BasicFrame, InitMenu ) ); + pHelpMenu->SetDeactivateHdl( LINK( this, BasicFrame, DeInitMenu ) ); + + LoadLRU(); + + LoadIniFile(); + +#ifndef UNX + pPrn = new BasicPrinter; +#else + pPrn = NULL; +#endif + pList = new EditList; + pStatus = new StatusLine( this ); + + UpdateTitle(); +// SetIcon( aAppIcon ); + + // Groesse: halbe Breite, dreiviertel Hoehe minus 2 * IconSize + { + Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); + aConf.SetGroup("WinGeom"); + SetWindowState( aConf.ReadKey("WinParams", "") ); + } + +// pWork = new AppEdit( this, NULL ); +// pWork->Show(); +// pWork->Close(); + + aLineNum.SetTimeoutHdl( LINK( this, BasicFrame, ShowLineNr ) ); + aLineNum.SetTimeout(200); + aLineNum.Start(); + + + aCheckFiles.SetTimeout( 10000 ); + aCheckFiles.SetTimeoutHdl( LINK( this, BasicFrame, CheckAllFiles ) ); + aCheckFiles.Start(); + + GetMenuBar()->SetCloserHdl( LINK( this, BasicFrame, CloseButtonClick ) ); + GetMenuBar()->SetFloatButtonClickHdl( LINK( this, BasicFrame, FloatButtonClick ) ); + GetMenuBar()->SetHideButtonClickHdl( LINK( this, BasicFrame, HideButtonClick ) ); +} + +void BasicFrame::LoadIniFile() +{ + Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); + aConf.SetGroup("Misc"); + + ByteString aTemp = aConf.ReadKey( "AutoReload", "0" ); + bAutoReload = ( aTemp.CompareTo("1") == COMPARE_EQUAL ); + + if ( pBasic ) + pBasic->LoadIniFile(); +} + +BasicFrame::~BasicFrame() +{ + AppWin* p = pList->First(); + if( p ) while( (p = pList->Remove() ) != NULL ) delete p; + delete pStatus; + delete pPrn; + delete pList; +// delete pExecutionStatus; +// delete pBasic; + pBasic.Clear(); // Da jetzt REF +} + +void BasicFrame::UpdateTitle() +{ + String aTitle; + aTitle += aAppName; + if ( aAppMode.Len() ) + { + aTitle.AppendAscii(" ["); + aTitle += aAppMode; + aTitle.AppendAscii("]"); + } + aTitle.AppendAscii(" - "); + aTitle += aAppFile; + SetText( aTitle ); +} + +IMPL_LINK( BasicFrame, CheckAllFiles, Timer*, pTimer ) +{ + if ( pWork ) + { + AppWin* pStartWin = pWork; + Window* pFocusWin = Application::GetFocusWindow(); + for ( int i = pList->Count()-1 ; i >= 0 ; i-- ) + pList->GetObject( i )->CheckReload(); + + if ( pWork != pStartWin ) + { + pWork = pStartWin; + pWork->ToTop(); + } + if ( pFocusWin ) + pFocusWin->GrabFocus(); + } + pTimer->Start(); + return 0; +} + +BOOL BasicFrame::IsAutoRun() +{ + return bIsAutoRun; +} + +void BasicFrame::SetAutoRun( BOOL bAuto ) +{ + bIsAutoRun = bAuto; +} + +void BasicFrame::SFX_NOTIFY( SfxBroadcaster&, const TypeId&, + const SfxHint& rHint, const TypeId& ) +{ + if ( rHint.ISA( TTExecutionStatusHint ) ) + { + TTExecutionStatusHint *pStatusHint = ( TTExecutionStatusHint* )&rHint; + switch ( pStatusHint->GetType() ) + { + case TT_EXECUTION_ENTERWAIT: + { + EnterWait(); + } + break; + case TT_EXECUTION_LEAVEWAIT: + { + LeaveWait(); + } + break; + case TT_EXECUTION_SHOW_ACTION: + { + if ( !pExecutionStatus ) + pExecutionStatus = new FloatingExecutionStatus( this ); + pExecutionStatus->SetStatus( pStatusHint->GetExecutionStatus() ); + pExecutionStatus->SetAdditionalInfo( pStatusHint->GetAdditionalExecutionStatus() ); + } + break; + } + } + + + Broadcast( rHint ); +} + +void BasicFrame::Resize() +{ + Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); + aConf.SetGroup("WinGeom"); + aConf.WriteKey("WinParams",GetWindowState()); + + // Statusbar + Size aOutSize = GetOutputSizePixel(); + Size aStatusSize = pStatus->GetSizePixel(); + Point aStatusPos( 0, aOutSize.Height() - aStatusSize.Height() ); + aStatusSize.Width() = aOutSize.Width(); + + pStatus->SetPosPixel( aStatusPos ); + pStatus->SetSizePixel( aStatusSize ); + + + // Eventuell Maximized window resizen + ULONG i; + for( i = pList->Count(); i > 0 ; i-- ) + { + if ( pList->GetObject( i-1 )->GetWinState() == TT_WIN_STATE_MAX ) + pList->GetObject( i-1 )->Maximize(); // resized auch + } +} + +void BasicFrame::Move() +{ + Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); + aConf.SetGroup("WinGeom"); + aConf.WriteKey("WinParams",GetWindowState()); +} + +IMPL_LINK( BasicFrame, CloseButtonClick, void*, EMPTYARG ) +{ + AppWin* p; + for ( p = pList->Last() ; p && p->GetWinState() != TT_WIN_STATE_MAX ; p = pList->Prev() ) + {}; + if ( p ) + p->GrabFocus(); + return Command( RID_FILECLOSE, FALSE ); +} + +IMPL_LINK( BasicFrame, FloatButtonClick, void*, EMPTYARG ) +{ + AppWin* p; + for ( p = pList->Last() ; p && p->GetWinState() != TT_WIN_STATE_MAX ; p = pList->Prev() ) + {}; + if ( p ) + p->TitleButtonClick( TITLE_BUTTON_DOCKING ); + return 1; +} + +IMPL_LINK( BasicFrame, HideButtonClick, void*, EMPTYARG ) +{ + AppWin* p; + for ( p = pList->Last() ; p && p->GetWinState() != TT_WIN_STATE_MAX ; p = pList->Prev() ) + {}; + if ( p ) + p->TitleButtonClick( TITLE_BUTTON_HIDE ); + return 1; +} + +void BasicFrame::WinShow_Hide() +{ + if ( !pList->Count() ) + return; + + AppWin* p; + BOOL bWasFullscreen = FALSE; + for ( p = pList->Last() ; p ; p = pList->Prev() ) + { + if ( p->pDataEdit ) + { + if ( p->GetWinState() & TT_WIN_STATE_HIDE // Versteckt + || ( bWasFullscreen + && ( !p->IsPined() || p->GetWinState() & TT_WIN_STATE_MAX ) + ) + ) + p->Hide( SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); + else + p->Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); + } + bWasFullscreen |= p->GetWinState() == TT_WIN_STATE_MAX; + } +} + +void BasicFrame::WinMax_Restore() +{ + // Die ApplicationButtons + AppWin* p; + BOOL bHasFullscreenWin = FALSE; + for( p = pList->First(); p && !bHasFullscreenWin ; p = pList->Next() ) + bHasFullscreenWin |= ( p->GetWinState() == TT_WIN_STATE_MAX ); + GetMenuBar()->ShowButtons( bHasFullscreenWin, bHasFullscreenWin, bHasFullscreenWin ); + WinShow_Hide(); +} + +void BasicFrame::RemoveWindow( AppWin *pWin ) +{ +// delete pIcon; + pList->Remove( pWin ); + pWork = pList->Last(); + + WinShow_Hide(); + + if ( pWork ) + pWork->ToTop(); + + WinMax_Restore(); + + Menu* pMenu = GetMenuBar(); + if( pList->Count() == 0 ) { + pMenu->EnableItem( RID_APPEDIT, FALSE ); + pMenu->EnableItem( RID_APPRUN, FALSE ); + pMenu->EnableItem( RID_APPWINDOW, FALSE ); + } + + PopupMenu* pWinMenu = pMenu->GetPopupMenu( RID_APPWINDOW ); + + pWinMenu->RemoveItem( pWinMenu->GetItemPos( pWin->GetWinId() ) ); + + // Trenner entfernen + if ( pWinMenu->GetItemType( pWinMenu->GetItemCount() - 1 ) == MENUITEM_SEPARATOR ) + pWinMenu->RemoveItem( pWinMenu->GetItemCount() - 1 ); + + pStatus->LoadTaskToolBox(); +} + +void BasicFrame::AddWindow( AppWin *pWin ) +{ + // Eintragen: + pList->Insert( pWin, LIST_APPEND ); + pWork = pWin; + + WinMax_Restore(); + + // Hauptmenue aktivieren: + MenuBar* pMenu = GetMenuBar(); + if( pList->Count() > 0 ) { + pMenu->EnableItem( RID_APPEDIT, TRUE ); + pMenu->EnableItem( RID_APPRUN, TRUE ); + pMenu->EnableItem( RID_APPWINDOW, TRUE ); + } + + PopupMenu* pWinMenu = pMenu->GetPopupMenu( RID_APPWINDOW ); + USHORT nLastID = pWinMenu->GetItemId( pWinMenu->GetItemCount() - 1 ); + + // Trenner erforderlich + if ( nLastID < RID_WIN_FILE1 && pWinMenu->GetItemType( pWinMenu->GetItemCount() - 1 ) != MENUITEM_SEPARATOR ) + pWinMenu->InsertSeparator(); + + // Freie ID finden + USHORT nFreeID = RID_WIN_FILE1; + while ( pWinMenu->GetItemPos( nFreeID ) != MENU_ITEM_NOTFOUND && nFreeID < RID_WIN_FILEn ) + nFreeID++; + + pWin->SetWinId( nFreeID ); + pWinMenu->InsertItem( nFreeID, pWin->GetText() ); +} + +void BasicFrame::WindowRenamed( AppWin *pWin ) +{ + MenuBar* pMenu = GetMenuBar(); + PopupMenu* pWinMenu = pMenu->GetPopupMenu( RID_APPWINDOW ); + + pWinMenu->SetItemText( pWin->GetWinId(), pWin->GetText() ); + + pStatus->LoadTaskToolBox(); + + aAppFile = pWin->GetText(); + UpdateTitle(); +} + +void BasicFrame::FocusWindow( AppWin *pWin ) +{ + pWork = pWin; + pList->Remove( pWin ); + pList->Insert( pWin, LIST_APPEND ); + pWin->Minimize( FALSE ); + + aAppFile = pWin->GetText(); + UpdateTitle(); + + WinShow_Hide(); + pStatus->LoadTaskToolBox(); +} + +BOOL BasicFrame::Close() +{ + if( bInBreak || Basic().IsRunning() ) + if( RET_NO == QueryBox( this, ResId( IDS_RUNNING ) ).Execute() ) + return FALSE; + + StarBASIC::Stop(); + bInBreak = FALSE; + if( CloseAll() ) + { + aLineNum.Stop(); + + // Alle übrigen Dialoge schliessen um assertions zu vermeiden!! + while ( GetWindow( WINDOW_OVERLAP )->GetWindow( WINDOW_FIRSTOVERLAP ) ) + { + delete GetWindow( WINDOW_OVERLAP )->GetWindow( WINDOW_FIRSTOVERLAP )->GetWindow( WINDOW_CLIENT ); + } + + WorkWindow::Close(); + + return TRUE; + } else return FALSE; +} + +BOOL BasicFrame::CloseAll() +{ + while ( pList->Count() ) + if ( !pList->Last()->Close() ) + return FALSE; + return TRUE; +} + +BOOL BasicFrame::CompileAll() +{ + AppWin* p; + for( p = pList->First(); p; p = pList->Next() ) + if( p->ISA(AppBasEd) && !((AppBasEd*)p)->Compile() ) return FALSE; + return TRUE; +} + +// Menu aufsetzen + +#define MENU2FILENAME Copy(3) +#define FILENAME2MENU( Nr, Name ) CUniString("~").Append( UniString::CreateFromInt32(i) ).AppendAscii(" ").Append( Name ) +#define LRUNr( nNr ) CByteString("LRU").Append( ByteString::CreateFromInt32(nNr) ) +void BasicFrame::AddToLRU(String const& aFile) +{ + Config aConfig(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); + PopupMenu *pPopup = GetMenuBar()->GetPopupMenu(RID_APPFILE); + + aConfig.SetGroup("LRU"); + DirEntry aFileEntry( aFile ); + USHORT i,nLastMove = 4; + + for ( i = 1 ; i<4 && nLastMove == 4 ; i++ ) + { + if ( DirEntry( UniString( aConfig.ReadKey(LRUNr(i),""), RTL_TEXTENCODING_UTF8 ) ) == aFileEntry ) + nLastMove = i; + } + + for ( i = nLastMove ; i>1 ; i-- ) + { + aConfig.WriteKey(LRUNr(i), aConfig.ReadKey(LRUNr(i-1),"")); + pPopup->SetItemText(IDM_FILE_LRU1 + i-1,FILENAME2MENU( i, pPopup->GetItemText(IDM_FILE_LRU1 + i-1-1).MENU2FILENAME )); + } + aConfig.WriteKey(LRUNr(1), ByteString( aFile, RTL_TEXTENCODING_UTF8 ) ); + pPopup->SetItemText(IDM_FILE_LRU1,FILENAME2MENU( 1, aFile) ); +} + +void BasicFrame::LoadLRU() +{ + Config aConfig(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); + PopupMenu *pPopup = GetMenuBar()->GetPopupMenu(RID_APPFILE); + BOOL bAddSep = TRUE; + + aConfig.SetGroup("LRU"); + + for (int i=1; i<=4 && pPopup!=NULL; i++) + { + String aFile = UniString( aConfig.ReadKey(LRUNr(i)), RTL_TEXTENCODING_UTF8 ); + + if (aFile.Len() != 0) + { + if (bAddSep) + { + pPopup->InsertSeparator(); + bAddSep = FALSE; + } + + pPopup->InsertItem(IDM_FILE_LRU1 + i-1, FILENAME2MENU( i, aFile )); + } + } +} + +IMPL_LINK( BasicFrame, InitMenu, Menu *, pMenu ) +{ + BOOL bNormal = BOOL( !bInBreak ); + pMenu->EnableItem( RID_RUNCOMPILE, bNormal ); + + BOOL bHasEdit = BOOL( /*bNormal &&*/ pWork != NULL ); + +// pMenu->EnableItem( RID_FILENEW, bNormal ); // immer möglich +// pMenu->EnableItem( RID_FILEOPEN, bNormal ); + pMenu->EnableItem( RID_FILECLOSE, bHasEdit ); + pMenu->EnableItem( RID_FILESAVE, bHasEdit ); + pMenu->EnableItem( RID_FILESAVEAS, bHasEdit ); + pMenu->EnableItem( RID_FILEPRINT, bHasEdit ); + pMenu->EnableItem( RID_FILESETUP, bHasEdit ); + pMenu->EnableItem( RID_FILELOADLIB, bNormal ); + pMenu->EnableItem( RID_FILESAVELIB, bHasEdit ); + + BOOL bHasErr = BOOL( bNormal && pBasic->GetErrors() != 0 ); + BOOL bNext = bHasErr & bNormal; + BOOL bPrev = bHasErr & bNormal; + if( bHasErr ) { + short n = (short) pBasic->aErrors.GetCurPos(); + if( n == 0 ) bPrev = FALSE; + if( n ==( pBasic->GetErrors() - 1 ) ) bNext = FALSE; + } + pMenu->EnableItem( RID_RUNNEXTERR, bNext ); + pMenu->EnableItem( RID_RUNPREVERR, bPrev ); + pMenu->CheckItem( RID_RUNDISAS, bDisas ); + if( pWork ) pWork->InitMenu( pMenu ); + + return TRUE; +} + +IMPL_LINK_INLINE_START( BasicFrame, DeInitMenu, Menu *, pMenu ) +{ + pMenu->EnableItem( RID_RUNCOMPILE ); + + pMenu->EnableItem( RID_FILECLOSE ); + pMenu->EnableItem( RID_FILESAVE ); + pMenu->EnableItem( RID_FILESAVEAS ); + pMenu->EnableItem( RID_FILEPRINT ); + pMenu->EnableItem( RID_FILESETUP ); + pMenu->EnableItem( RID_FILELOADLIB ); + pMenu->EnableItem( RID_FILESAVELIB ); + + pMenu->EnableItem( RID_RUNNEXTERR ); + pMenu->EnableItem( RID_RUNPREVERR ); + if( pWork ) pWork->DeInitMenu( pMenu ); + + + SetAutoRun( FALSE ); + String aString; + pStatus->Message( aString ); + return 0L; +} +IMPL_LINK_INLINE_END( BasicFrame, DeInitMenu, Menu *, pMenu ) + +IMPL_LINK_INLINE_START( BasicFrame, HighlightMenu, Menu *, pMenu ) +{ + String s = pMenu->GetHelpText( pMenu->GetCurItemId() ); + pStatus->Message( s ); + return 0L; +} +IMPL_LINK_INLINE_END( BasicFrame, HighlightMenu, Menu *, pMenu ) + +IMPL_LINK_INLINE_START( BasicFrame, MenuCommand, Menu *, pMenu ) +{ + USHORT nId = pMenu->GetCurItemId(); + BOOL bChecked = pMenu->IsItemChecked( nId ); + return Command( nId, bChecked ); +} +IMPL_LINK_INLINE_END( BasicFrame, MenuCommand, Menu *, pMenu ) + +IMPL_LINK_INLINE_START( BasicFrame, Accel, Accelerator*, pAcc ) +{ + SetAutoRun( FALSE ); + return Command( pAcc->GetCurItemId() ); +} +IMPL_LINK_INLINE_END( BasicFrame, Accel, Accelerator*, pAcc ) + +IMPL_LINK_INLINE_START( BasicFrame, ShowLineNr, AutoTimer *, pTimer ) +{ + String aPos; + if ( pWork ) + { + aPos = String::CreateFromInt32(pWork->GetLineNr()); + } + pStatus->Pos( aPos ); + return 0L; +} +IMPL_LINK_INLINE_END( BasicFrame, ShowLineNr, AutoTimer *, pTimer ) + + +MsgEdit* BasicFrame::GetMsgTree( String aLogFileName ) +{ + if ( FindErrorWin( aLogFileName ) ) + { + return FindErrorWin( aLogFileName )->GetMsgTree(); + } + else + { // create new Window on the fly + AppError *pNewWindow = new AppError( this, aLogFileName ); + pNewWindow->Show(); + pNewWindow->GrabFocus(); + return pNewWindow->GetMsgTree(); + } +} + +IMPL_LINK( BasicFrame, Log, TTLogMsg *, pLogMsg ) +{ + GetMsgTree( pLogMsg->aLogFileName )->AddAnyMsg( pLogMsg ); + return 0L; +} + +IMPL_LINK( BasicFrame, WinInfo, WinInfoRec*, pWinInfo ) +{ + if ( !pDisplayHidDlg ) + pDisplayHidDlg = new DisplayHidDlg( this ); + if ( pDisplayHidDlg ) + { + pDisplayHidDlg->AddData( pWinInfo ); + pDisplayHidDlg->Show(); + } + return 0; +} + +BOOL BasicFrame::LoadFile( String aFilename ) +{ + BOOL bIsResult = DirEntry( aFilename ).GetExtension().CompareIgnoreCaseToAscii("RES") == COMPARE_EQUAL; + BOOL bIsBasic = DirEntry( aFilename ).GetExtension().CompareIgnoreCaseToAscii("BAS") == COMPARE_EQUAL; + bIsBasic |= DirEntry( aFilename ).GetExtension().CompareIgnoreCaseToAscii("INC") == COMPARE_EQUAL; + + AppWin* p; + if ( bIsResult ) + { + p = new AppError( this, aFilename ); + } + else if ( bIsBasic ) + { + p = new AppBasEd( this, NULL ); + p->Load( aFilename ); + } + else + { + p = new AppEdit( this ); + p->Load( aFilename ); + } + p->Show(); + p->GrabFocus(); + return TRUE; +} + +// Kommando ausfuehren + +long BasicFrame::Command( short nID, BOOL bChecked ) +{ + BasicError* pErr; + + switch( nID ) { + case RID_FILENEW: { + AppBasEd* p = new AppBasEd( this, NULL ); + p->Show(); + p->GrabFocus(); + // InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN )); + } break; + case RID_FILEOPEN: + { + String s; + if( QueryFileName( s, FT_BASIC_SOURCE | FT_RESULT_FILE, FALSE ) ) { + AddToLRU( s ); + LoadFile( s ); +// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN )); + } + } break; + case RID_FILELOADLIB: + LoadLibrary(); + break; + case RID_FILESAVELIB: + SaveLibrary(); + break; + case RID_FILECLOSE: + if( pWork && pWork->Close() ){}; +// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN )); + break; + case RID_FILEPRINT: +#ifndef UNX + if( pWork ) + pPrn->Print( pWork->GetText(), pWork->pDataEdit->GetText(), this ); +#else + InfoBox( this, ResId( IDS_NOPRINTERERROR ) ).Execute(); +#endif + break; + case RID_FILESETUP: +#ifndef UNX + pPrn->Setup(); +#else + InfoBox( this, ResId( IDS_NOPRINTERERROR ) ).Execute(); +#endif + break; + case RID_QUIT: + if( Close() ) aBasicApp.Quit(); + break; + case IDM_FILE_LRU1: + case IDM_FILE_LRU2: + case IDM_FILE_LRU3: + case IDM_FILE_LRU4: + { + String s = GetMenuBar()->GetPopupMenu(RID_APPFILE)->GetItemText(nID).MENU2FILENAME; + + AddToLRU( s ); + LoadFile( s ); +// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN )); + } + break; + + + case RID_RUNSTART: + nFlags = SbDEBUG_BREAK; + goto start; + case RID_RUNSTEPOVER: + nFlags = SbDEBUG_STEPINTO | SbDEBUG_STEPOVER; + goto start; + case RID_RUNSTEPINTO: + nFlags = SbDEBUG_STEPINTO; + goto start; + case RID_RUNTOCURSOR: + if ( pWork && pWork->ISA(AppBasEd) && ((AppBasEd*)pWork)->GetModule()->SetBP(pWork->GetLineNr()) ) + { + SbModule *pModule = ((AppBasEd*)pWork)->GetModule(); +#ifdef DEBUG + USHORT x; + x = pWork->GetLineNr(); + x = ((AppBasEd*)pWork)->GetModule()->GetBPCount(); + if ( !x ) + x = pModule->SetBP(pWork->GetLineNr()); + x = pModule->GetBPCount(); +#endif + + for ( USHORT nMethod = 0; nMethod < pModule->GetMethods()->Count(); nMethod++ ) + { + SbMethod* pMethod = (SbMethod*)pModule->GetMethods()->Get( nMethod ); + DBG_ASSERT( pMethod, "Methode nicht gefunden! (NULL)" ); + pMethod->SetDebugFlags( pMethod->GetDebugFlags() | SbDEBUG_BREAK ); + } + } + nFlags = SbDEBUG_BREAK; + goto start; + start: { +// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN )); + if ( !Basic().IsRunning() || bInBreak ) + { + AppBasEd* p = NULL; + if( pWork && pWork->ISA(AppBasEd) ) + { + p = ((AppBasEd*)pWork); + p->ToTop(); + } + else + SetAutoRun( FALSE ); // Wenn kein Programm geladen wurde, dann auch nicht beenden + + if( bInBreak ) + // Nur das Flag zuruecksetzen + bInBreak = FALSE; + else + { + if( !SaveAll() ) break; + if( !CompileAll() ) break; + String aString; + pStatus->Message( aString ); + if( p ) + { + BasicDLL::SetDebugMode( TRUE ); + Basic().ClearGlobalVars(); + p->Run(); + BasicDLL::SetDebugMode( FALSE ); + // Falls waehrend Interactive=FALSE abgebrochen +// BasicDLL::EnableBreak( TRUE ); + } + }} + } +// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN )); // nach run + break; + case RID_RUNCOMPILE: + if( pWork && pWork->ISA(AppBasEd) && SaveAll() ) + { + ((AppBasEd*)pWork)->Compile(); + pWork->ToTop(); + pWork->GrabFocus(); + } + break; + case RID_RUNDISAS: + bDisas = BOOL( !bChecked ); + break; + case RID_RUNBREAK: + if ( Basic().IsRunning() && !bInBreak ) + { +// pINST->CalcBreakCallLevel(SbDEBUG_STEPINTO); + pINST->nBreakCallLvl = pINST->nCallLvl; + } + break; + case RID_RUNSTOP: + Basic().Stop(); + bInBreak = FALSE; + break; + case RID_RUNNEXTERR: + pErr = pBasic->aErrors.Next(); + if( pErr ) pErr->Show(); + break; + case RID_RUNPREVERR: + pErr = pBasic->aErrors.Prev(); + if( pErr ) pErr->Show(); + break; + + case RID_OPTIONS: + { + new OptionsDialog( this, ResId(IDD_OPTIONS_DLG) ); + } + break; + case RID_DECLARE_HELPER: + InfoBox( this, ResId( IDS_NOT_YET_IMPLEMENTED ) ).Execute(); + break; + + case RID_WINTILE: + { + WindowArrange aArange; + for ( ULONG i = 0 ; i < pList->Count() ; i++ ) + { + aArange.AddWindow( pList->GetObject( i ) ); + pList->GetObject( i )->Restore(); + } + + + long nTitleHeight; + { + long nDummy1, nDummy2, nDummy3; + GetBorder( nDummy1, nTitleHeight, nDummy2, nDummy3 ); + } + + Size aSize = GetOutputSizePixel(); + aSize.Height() -= nTitleHeight; + Rectangle aRect( Point( 0, nTitleHeight ), aSize ); + + aArange.Arrange( WINDOWARRANGE_TILE, aRect ); + + } + break; + case RID_WINTILEHORZ: + { + WindowArrange aArange; + for ( ULONG i = 0 ; i < pList->Count() ; i++ ) + { + aArange.AddWindow( pList->GetObject( i ) ); + pList->GetObject( i )->Restore(); + } + + + long nTitleHeight; + { + long nDummy1, nDummy2, nDummy3; + GetBorder( nDummy1, nTitleHeight, nDummy2, nDummy3 ); + } + + Size aSize = GetOutputSizePixel(); + aSize.Height() -= nTitleHeight; + Rectangle aRect( Point( 0, nTitleHeight ), aSize ); + + aArange.Arrange( WINDOWARRANGE_HORZ, aRect ); + + } + break; + case RID_WINTILEVERT: +//#define WINDOWARRANGE_TILE 1 +//#define WINDOWARRANGE_HORZ 2 +//#define WINDOWARRANGE_VERT 3 +//#define WINDOWARRANGE_CASCADE 4 + { + WindowArrange aArange; + for ( ULONG i = 0 ; i < pList->Count() ; i++ ) + { + aArange.AddWindow( pList->GetObject( i ) ); + pList->GetObject( i )->Restore(); + } + + + long nTitleHeight; + { + long nDummy1, nDummy2, nDummy3; + GetBorder( nDummy1, nTitleHeight, nDummy2, nDummy3 ); + } + + Size aSize = GetOutputSizePixel(); + aSize.Height() -= nTitleHeight; + Rectangle aRect( Point( 0, nTitleHeight ), aSize ); + + aArange.Arrange( WINDOWARRANGE_VERT, aRect ); + + } + break; + case RID_WINCASCADE: + { + for ( ULONG i = 0 ; i < pList->Count() ; i++ ) + { + pList->GetObject( i )->Cascade( i ); + } + } + break; + +/* case RID_HELPTOPIC: + if( pWork ) pWork->Help(); + break; + case RID_HELPKEYS: + aBasicApp.pHelp->Start( CUniString( "Keyboard" ) ); + break; + case RID_HELPINDEX: + aBasicApp.pHelp->Start( HELP_INDEX ); + break; + case RID_HELPINTRO: + aBasicApp.pHelp->Start( HELP_HELPONHELP ); + break; +*/ case RID_HELPABOUT: + { + ResId aResId( IDD_ABOUT_DIALOG ); + if ( Basic().pTestObject ) // Wir sind also TestTool + aResId = ResId( IDD_TT_ABOUT_DIALOG ); + else + aResId = ResId( IDD_ABOUT_DIALOG ); + AboutDialog( this, aResId ).Execute(); + } + break; + case RID_POPUPEDITVAR: + { + new VarEditDialog( this, pEditVar ); + } + break; + default: + if ( nID >= RID_WIN_FILE1 && nID <= RID_WIN_FILEn ) + { + MenuBar* pMenu = GetMenuBar(); + PopupMenu* pWinMenu = pMenu->GetPopupMenu( RID_APPWINDOW ); + String aName = pWinMenu->GetItemText( nID ); + AppWin* pWin = FindWin( aName ); + if ( pWin ) + pWin->ToTop(); + } + else + { +// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPEDIT )); // So daß Delete richtig ist + if( pWork ) + pWork->Command( CommandEvent( Point(), nID ) ); +// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPEDIT )); // So daß Delete richtig ist + } + } + return TRUE; +} + +BOOL BasicFrame::SaveAll() +{ + AppWin* p, *q = pWork; + for( p = pList->First(); p; p = pList->Next() ) + { + USHORT nRes = p->QuerySave( QUERY_DISK_CHANGED ); + if( (( nRes == SAVE_RES_ERROR ) && QueryBox(this,ResId(IDS_ASKSAVEERROR)).Execute() == RET_NO ) + || ( nRes == SAVE_RES_CANCEL ) ) + return FALSE; + } + if ( q ) + q->ToTop(); + return TRUE; +} + +IMPL_LINK( BasicFrame, ModuleWinExists, String*, pFilename ) +{ + return FindModuleWin( *pFilename ) != NULL; +} + +AppBasEd* BasicFrame::FindModuleWin( const String& rName ) +{ + AppWin* p; + for( p = pList->First(); p; p = pList->Next() ) + { + if( p->ISA(AppBasEd) && ((AppBasEd*)p)->GetModName() == rName ) + return ((AppBasEd*)p); + } + return NULL; +} + +AppError* BasicFrame::FindErrorWin( const String& rName ) +{ + AppWin* p; + for( p = pList->First(); p; p = pList->Next() ) + { + if( p->ISA(AppError) && ((AppError*)p)->GetText() == rName ) + return ((AppError*)p); + } + return NULL; +} + +AppWin* BasicFrame::FindWin( const String& rName ) +{ + AppWin* p; + for( p = pList->First(); p; p = pList->Next() ) + { + if( p->GetText() == rName ) + return p; + } + return NULL; +} + +AppWin* BasicFrame::FindWin( USHORT nWinId ) +{ + AppWin* p; + for( p = pList->First(); p; p = pList->Next() ) + { + if( p->GetWinId() == nWinId ) + return p; + } + return NULL; +} + +class NewFileDialog : public FileDialog +{ +private: + String aLastPath; +public: + ByteString aPathName; + NewFileDialog( Window* pParent, WinBits nWinStyle ):FileDialog( pParent, nWinStyle ){}; + virtual short Execute(); + virtual void FilterSelect(); +}; + +void NewFileDialog::FilterSelect() +{ + String aTemp = GetPath(); + if ( aLastPath.Len() == 0 ) + aLastPath = DirEntry( GetPath() ).GetPath().GetFull(); + if ( aLastPath.CompareIgnoreCaseToAscii( DirEntry( GetPath() ).GetPath().GetFull() ) != COMPARE_EQUAL ) + return; // Der Benutzer entscheidet sich nachdem er den Pfad geändert hat. + + String aCurFilter = GetCurFilter(); + USHORT nFilterNr = 0; + while ( nFilterNr < GetFilterCount() && aCurFilter != GetFilterName( nFilterNr ) ) + { + nFilterNr++; + } + aPathName = ByteString( GetFilterType( nFilterNr ), RTL_TEXTENCODING_UTF8 ); + + Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); + aConf.SetGroup( "Path" ); + aLastPath = UniString( aConf.ReadKey( aPathName, aConf.ReadKey( "Basisverzeichnis" ) ), RTL_TEXTENCODING_UTF8 ); + SetPath( aLastPath ); +// if ( IsInExecute() ) +// SetPath( "" ); +} + +short NewFileDialog::Execute() +{ + BOOL bRet = FileDialog::Execute(); + if ( bRet ) + { + Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); + aConf.SetGroup( "Path" ); + aConf.WriteKey( aPathName, ByteString( DirEntry( GetPath() ).GetPath().GetFull(), RTL_TEXTENCODING_UTF8 ) ); + } + return bRet; +} + +BOOL BasicFrame::QueryFileName + (String& rName, FileType nFileType, BOOL bSave ) +{ + NewFileDialog aDlg( this, bSave ? WinBits( WB_SAVEAS ) : + WinBits( WB_OPEN ) ); + aDlg.SetText( String( ResId( bSave ? IDS_SAVEDLG : IDS_LOADDLG ) ) ); + + if ( nFileType & FT_RESULT_FILE ) + { + aDlg.SetDefaultExt( String( ResId( IDS_RESFILE ) ) ); + aDlg.AddFilter( String( ResId( IDS_RESFILTER ) ), String( ResId( IDS_RESFILE ) ) ); + aDlg.AddFilter( String( ResId( IDS_TXTFILTER ) ), String( ResId( IDS_TXTFILE ) ) ); + aDlg.SetCurFilter( ResId( IDS_RESFILTER ) ); + } + + if ( nFileType & FT_BASIC_SOURCE ) + { + aDlg.SetDefaultExt( String( ResId( IDS_NONAMEFILE ) ) ); + aDlg.AddFilter( String( ResId( IDS_BASFILTER ) ), String( ResId( IDS_NONAMEFILE ) ) ); + aDlg.AddFilter( String( ResId( IDS_INCFILTER ) ), String( ResId( IDS_INCFILE ) ) ); + aDlg.SetCurFilter( ResId( IDS_BASFILTER ) ); + } + + if ( nFileType & FT_BASIC_LIBRARY ) + { + aDlg.SetDefaultExt( String( ResId( IDS_LIBFILE ) ) ); + aDlg.AddFilter( String( ResId( IDS_LIBFILTER ) ), String( ResId( IDS_LIBFILE ) ) ); + aDlg.SetCurFilter( ResId( IDS_LIBFILTER ) ); + } + + + aDlg.FilterSelect(); // Setzt den Pfad vom letzten mal. +// if ( bSave ) + if ( rName.Len() > 0 ) + aDlg.SetPath( rName ); + + if( aDlg.Execute() ) + { + rName = aDlg.GetPath(); +/* rExtension = aDlg.GetCurrentFilter(); + var i:integer; + for ( i = 0 ; i < aDlg.GetFilterCount() ; i++ ) + if ( rExtension == aDlg.GetFilterName( i ) ) + rExtension = aDlg.GetFilterType( i ); +*/ + return TRUE; + } else return FALSE; +} + +USHORT BasicFrame::BreakHandler() +{ + bInBreak = TRUE; +// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN )); +// MenuBar aBar( ResId( RID_APPMENUBAR ) ); +// aBar.EnableItem( RID_APPEDIT, FALSE ); + SetAppMode( String( ResId ( IDS_APPMODE_BREAK ) ) ); + while( bInBreak ) +#if SUPD >= 357 + GetpApp()->Yield(); +#else + GetpApp()->Reschedule(); +#endif + SetAppMode( String( ResId ( IDS_APPMODE_RUN ) ) ); +// aBar.EnableItem( RID_APPEDIT, TRUE ); +// InitMenu(GetMenuBar()->GetPopupMenu( RID_APPRUN )); + return nFlags; +} + +void BasicFrame::LoadLibrary() +{ + String s; + if( QueryFileName( s, FT_BASIC_LIBRARY, FALSE ) ) + { + CloseAll(); + SvFileStream aStrm( s, STREAM_STD_READ ); + MyBasic* pNew = (MyBasic*) SbxBase::Load( aStrm ); + if( pNew && pNew->ISA( MyBasic ) ) + { + pBasic = pNew; + // Alle Inhalte - sofern vorhanden - anzeigen + SbxArray* pMods = pBasic->GetModules(); + for( USHORT i = 0; i < pMods->Count(); i++ ) + { + SbModule* pMod = (SbModule*) pMods->Get( i ); + AppWin* p = new AppBasEd( this, pMod ); + p->Show(); + } + } + else + { + delete pNew; + ErrorBox( this, ResId( IDS_READERROR ) ).Execute(); + } + } +} + +void BasicFrame::SaveLibrary() +{ + String s; + if( QueryFileName( s, FT_BASIC_LIBRARY, TRUE ) ) + { + SvFileStream aStrm( s, STREAM_STD_WRITE ); + if( !Basic().Store( aStrm ) ) + ErrorBox( this, ResId( IDS_WRITEERROR ) ).Execute(); + } +} + +String BasicFrame::GenRealString( const String &aResString ) +{ + xub_StrLen nStart,nGleich,nEnd,nStartPos = 0; + String aType,aValue,aResult(aResString); + String aString; + xub_StrLen nInsertPos; + BOOL bFound; + + while ( (nStart = aResult.Search(StartKenn,nStartPos)) != STRING_NOTFOUND && + (nGleich = aResult.SearchAscii("=",nStart+StartKenn.Len())) != STRING_NOTFOUND && + (nEnd = aResult.Search(EndKenn,nGleich+1)) != STRING_NOTFOUND) + { + aType = aResult.Copy(nStart,nGleich-nStart); + aValue = aResult.Copy(nGleich+1,nEnd-nGleich-1); + bFound = FALSE; + if ( aType.CompareTo(ResKenn) == COMPARE_EQUAL ) + { +// if ( Resource::GetResManager()->IsAvailable( ResId( aValue ) ) ) + aString = String( ResId( aValue.ToInt32() ) ); +// else + { +// DBG_ERROR( "Ressource konnte nicht geladen werden" ); +// return aResString; + } + nInsertPos = nStart; + nStartPos = nStart; + aResult.Erase( nStart, nEnd-nStart+1 ); + } + else if ( aType.Search(BaseArgKenn) == 0 ) // Fängt mit BaseArgKenn an + { + USHORT nArgNr = aType.Copy( BaseArgKenn.Len() ).ToInt32(); + DBG_ASSERT( aString.Search( CUniString("($Arg").Append( String::CreateFromInt32(nArgNr) ).AppendAscii(")") ) != STRING_NOTFOUND, "Extra Argument given in String"); + aString.SearchAndReplace( CUniString("($Arg").Append( String::CreateFromInt32(nArgNr) ).AppendAscii(")"), aValue ); + nStartPos = nStart; + aResult.Erase( nStart, nEnd-nStart+1 ); + } + else + { + DBG_ERROR( CByteString("Unknown replacement in String: ").Append( ByteString( aResult.Copy(nStart,nEnd-nStart), RTL_TEXTENCODING_UTF8 ) ).GetBuffer() ); + nStartPos += StartKenn.Len(); + } + } + DBG_ASSERT( aString.SearchAscii( "($Arg" ) == STRING_NOTFOUND, "Argument missing in String"); + aResult.Insert( aString, nInsertPos ); + return aResult; +} + + diff --git a/basic/source/app/app.hxx b/basic/source/app/app.hxx new file mode 100644 index 000000000000..c65a6f126abd --- /dev/null +++ b/basic/source/app/app.hxx @@ -0,0 +1,228 @@ +/************************************************************************* + * + * $RCSfile: app.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _BASICAPP_HXX +#define _BASICAPP_HXX + +#ifndef _SV_SVAPP_HXX +#include <vcl/svapp.hxx> +#endif +#ifndef _HELP_HXX //autogen +#include <vcl/help.hxx> +#endif +#ifndef _MENU_HXX //autogen +#include <vcl/menu.hxx> +#endif +#ifndef _WRKWIN_HXX //autogen +#include <vcl/wrkwin.hxx> +#endif +#ifndef _TIMER_HXX //autogen +#include <vcl/timer.hxx> +#endif +#ifndef _SFXBRDCST_HXX +#include <svtools/brdcst.hxx> +#endif +#ifndef _SFXLSTNER_HXX +#include <svtools/lstner.hxx> +#endif + +class BasicFrame; +#include "mybasic.hxx" + +class EditList; +class AppWin; +class AppEdit; +class AppBasEd; +class MsgEdit; +class AppError; +class StatusLine; +class BasicPrinter; +struct TTLogMsg; + +class BasicApp : public Application { + short nWait; // Wait-Zaehler +public: +// Help* pHelp; // Hilfesystem + BasicFrame* pFrame; // Frame Window +// MenuBar* pMainMenu; // Hauptmenue + Accelerator* pMainAccel; // Acceleratoren + +#ifndef VCL + void Main( int, char*[] ); +#else + void Main( ); +#endif + + void LoadIniFile(); + void SetFocus(); + void Wait( BOOL ); + DECL_LINK( LateInit, void * ); +}; + + +typedef USHORT FileType; + +#define FT_NO_FILE (FileType)0x00 // Ein Fehler ist aufgetreten ... +#define FT_BASIC_SOURCE (FileType)0x01 +#define FT_BASIC_INCLUDE (FileType)0x02 +#define FT_RESULT_FILE (FileType)0x04 +#define FT_RESULT_FILE_TXT (FileType)0x08 +#define FT_BASIC_LIBRARY (FileType)0x10 + +struct WinInfoRec; +class DisplayHidDlg; + +class FloatingExecutionStatus; + +class BasicFrame : public WorkWindow, public SfxBroadcaster, public SfxListener +{ +virtual BOOL Close(); // Schliessen + BOOL CloseAll(); // Alle Fenster schliessen + BOOL CompileAll(); // Alle Texte compilieren + AutoTimer aLineNum; // Zeigt die Zeilennummer an +virtual void Resize(); +virtual void Move(); + void LoadLibrary(); + void SaveLibrary(); + BOOL bIsAutoRun; + DisplayHidDlg* pDisplayHidDlg; + +// BreakPoint *pRunToCursorBP; + + SbxVariable *pEditVar; + + + + Timer aCheckFiles; // Prüfen der Dateien auf Änderungen + BOOL bAutoReload; + DECL_LINK( CheckAllFiles, Timer* ); + + MyBasicRef pBasic; // BASIC-Engine + + String aAppName; // Inhalt der Titelteile der App: + String aAppFile; // AppName AppFile [AppMode] + String aAppMode; + void UpdateTitle(); + DECL_LINK( CloseButtonClick, void* ); + DECL_LINK( FloatButtonClick, void* ); + DECL_LINK( HideButtonClick, void* ); + + FloatingExecutionStatus *pExecutionStatus; + +public: + BOOL IsAutoRun(); + void SetAutoRun( BOOL bAuto ); + BOOL bInBreak; // TRUE, wenn im Break-Handler + StatusLine* pStatus; // Statuszeile + EditList* pList; // List der Edit-Fenster + AppWin* pWork; // aktuelles Edit-Fenster + BasicPrinter* pPrn; // Drucker + BOOL bDisas; // TRUE: disassemble + USHORT nFlags; // Debugging-Flags + USHORT nMaximizedWindows; // Anzahl der Fenster, die maximized sind + void FocusWindow( AppWin *pWin ); + void WinMax_Restore(); + void WinShow_Hide(); + void RemoveWindow( AppWin *pWin ); + void AddWindow( AppWin *pWin ); + void WindowRenamed( AppWin *pWin ); + + BasicFrame(); + ~BasicFrame(); + MyBasic& Basic() { return *pBasic; } + void AddToLRU(String const& aFile); + void LoadLRU(); + DECL_LINK( InitMenu, Menu * ); + DECL_LINK( DeInitMenu, Menu * ); + DECL_LINK( HighlightMenu, Menu * ); + DECL_LINK( MenuCommand, Menu * ); + DECL_LINK( Accel, Accelerator * ); + DECL_LINK( ShowLineNr, AutoTimer * ); + MsgEdit* GetMsgTree( String aLogFileName ); + DECL_LINK( Log, TTLogMsg * ); + DECL_LINK( WinInfo, WinInfoRec * ); + BOOL LoadFile( String aFilename ); + long Command( short,BOOL=FALSE );// Kommando-Handler + BOOL SaveAll(); // Alle Fenster speichern + BOOL QueryFileName( String& rName, FileType nFileType, BOOL bSave );// Dateinamen ermitteln + DECL_LINK( ModuleWinExists, String* ); + AppBasEd* FindModuleWin( const String& ); + AppError* FindErrorWin( const String& ); + AppWin* FindWin( const String& ); + AppWin* FindWin( USHORT nWinId ); + USHORT BreakHandler(); // Break-Handler-Callback + + void SetEditVar( SbxVariable *pVar ){ pEditVar = pVar;} + SbxVariable* GetEditVar(){ return pEditVar;} + BOOL IsAutoReload() { return bAutoReload; } + void LoadIniFile(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + void SetAppMode( const String &aNewMode ){ aAppMode = aNewMode; UpdateTitle(); } + + String GenRealString( const String &aResString ); + +}; + +extern BasicApp aBasicApp; + +#endif diff --git a/basic/source/app/appbased.cxx b/basic/source/app/appbased.cxx new file mode 100644 index 000000000000..47b22bd795cb --- /dev/null +++ b/basic/source/app/appbased.cxx @@ -0,0 +1,338 @@ +/************************************************************************* + * + * $RCSfile: appbased.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _MSGBOX_HXX //autogen +#include <vcl/msgbox.hxx> +#endif +#ifndef _SBXCLASS_HXX //autogen +#include <svtools/sbx.hxx> +#endif +#ifndef _TEXTENG_HXX //autogen +#include <svtools/texteng.hxx> +#endif +#ifndef _TEXTVIEW_HXX //autogen +#include <svtools/textview.hxx> +#endif +#ifndef _SB_SBMETH_HXX //autogen +#include <sbmeth.hxx> +#endif + +#ifndef _CLIP_HXX //autogen +#include <vcl/clip.hxx> +#endif + +#ifndef _BASIC_TTRESHLP_HXX +#include "ttstrhlp.hxx" +#endif + +#include "basic.hrc" +#include "status.hxx" +#include "appbased.hxx" +#include "brkpnts.hxx" +#include "testtool.hxx" // defines für das Syntaxhighlighting + + +TYPEINIT1(AppBasEd,AppEdit); +AppBasEd::AppBasEd( BasicFrame* pParent, SbModule* p ) +: AppEdit( pParent ) +, pBreakpoints( NULL ) +{ + pBreakpoints = new BreakpointWindow( this ); + pBreakpoints->SetFont( ((TextEdit*)pDataEdit)->GetTextEditImp().pTextEngine->GetFont() ); + + pBreakpoints->Show(); + + + ((TextEdit*)pDataEdit)->GetTextEditImp().pTextView->SetAutoIndentMode( TRUE ); + ((TextEdit*)pDataEdit)->GetTextEditImp().pTextEngine->SetMaxTextLen( STRING_MAXLEN ); + ((TextEdit*)pDataEdit)->GetTextEditImp().pTextEngine->SetWordDelimiters( CUniString(" ,.;:(){}[]\"'+-*/<>^\\") ); + ((TextEdit*)pDataEdit)->GetTextEditImp().SyntaxHighlight( TRUE ); + ((TextEdit*)pDataEdit)->SaveAsUTF8( TRUE ); + + String aEmpty; + + pMod = p; + if( !pMod ) + { + String aModName = *pNoName; + aModName += String::CreateFromInt32( nCount ); + pMod = pFrame->Basic().MakeModule( aModName, aEmpty ); + } + bCompiled = pMod->IsCompiled(); + + pBreakpoints->SetModule( pMod ); + + // Icon definieren: +// pIcon = new Icon( ResId( RID_WORKICON ) ); +// if( pIcon ) SetIcon( *pIcon ); + + SetText( pMod->GetName() ); + pDataEdit->SetText( pMod->GetSource() ); + + // Wurde ein Modul übergeben, dann den Quelltext von Platte laden + if ( p ) + LoadSource(); + + // Erst nach Laden des Quelltextes die Events weiterleiten + ((TextEdit*)pDataEdit)->SetBreakpointWindow( pBreakpoints ); + + // Compiled-Flag pflegen: + pDataEdit->SetModifyHdl( LINK( this, AppBasEd, EditChange ) ); + +} + +AppBasEd::~AppBasEd() +{ + pBreakpoints->SaveBreakpoints( GetText() ); + delete pBreakpoints; + pMod->SetName( CUniString("--").Append( pMod->GetName() ) ); +} + +void AppBasEd::SFX_NOTIFY( SfxBroadcaster&, const TypeId&, + const SfxHint& rHint, const TypeId& ) +{ + const SfxSimpleHint* p = PTR_CAST(SfxSimpleHint,&rHint); + if( p ) + { + ULONG nHintId = p->GetId(); + if( nHintId == SBX_HINT_LANGUAGE_EXTENSION_LOADED ) + { + ((TextEdit*)pDataEdit)->GetTextEditImp().InvalidateSyntaxHighlight(); + } + } +} + +FileType AppBasEd::GetFileType() +{ + return FT_BASIC_SOURCE; +} + +IMPL_LINK_INLINE_START( AppBasEd, EditChange, void *, p ) +{ + bCompiled = FALSE; + return TRUE; +} +IMPL_LINK_INLINE_END( AppBasEd, EditChange, void *, p ) + +// Set up the menu +long AppBasEd::InitMenu( Menu* pMenu ) +{ + AppEdit::InitMenu (pMenu ); + BOOL bRunning = pFrame->Basic().IsRunning(); + pMenu->EnableItem( RID_RUNCOMPILE, !bCompiled && !bRunning ); + return TRUE; +} + +long AppBasEd::DeInitMenu( Menu* pMenu ) +{ + AppEdit::DeInitMenu (pMenu ); + pMenu->EnableItem( RID_RUNCOMPILE ); + return TRUE; +} + +// Menu Handler + +void AppBasEd::Command( const CommandEvent& rCEvt ) +{ + switch( rCEvt.GetCommand() ) { + case RID_TOGLEBRKPNT: + ((TextEdit*)pDataEdit)->GetBreakpointWindow()->ToggleBreakpoint( pDataEdit->GetLineNr() ); + break; + default: + AppEdit::Command( rCEvt ); + } +} + +// Sourcecode-Datei laden + +void AppBasEd::Resize() +{ + if( pDataEdit ) { + AppEdit::Resize(); + + // Breakpoint window einfügen + Size aEditSize = pDataEdit->GetSizePixel(); + Point aEditPos = pDataEdit->GetPosPixel(); + + pBreakpoints->SetPosPixel( aEditPos ); + + aEditPos.X() += BREAKPOINTSWIDTH; + pDataEdit->SetPosPixel( aEditPos ); + aEditSize.Width() -= BREAKPOINTSWIDTH; + pDataEdit->SetSizePixel( aEditSize ); + + aEditSize.Width() = BREAKPOINTSWIDTH; + pBreakpoints->SetSizePixel( aEditSize ); + } +} + +void AppBasEd::PostLoad() +{ + pMod->SetName( GetText() ); + pMod->Clear(); + pMod->SetSource( pDataEdit->GetText() ); + AppEdit::PostLoad(); + + pBreakpoints->LoadBreakpoints( GetText() ); +} + +USHORT AppBasEd::ImplSave() +{ + pBreakpoints->SaveBreakpoints( GetText() ); + return AppEdit::ImplSave(); +} + +void AppBasEd::Reload() +{ + TextSelection aSelMemo = pDataEdit->GetSelection(); + LoadSource(); + pDataEdit->SetSelection( aSelMemo ); +} + +// Sourcecode-Datei nach Änderung auf Platte neu laden +void AppBasEd::LoadSource() +{ + BOOL bErr; + +// if( pDataEdit->GetText().Len() != 0 ) return; + String aName = pMod->GetName(); + bErr = !pDataEdit->Load( aName ); + pBreakpoints->LoadBreakpoints( GetText() ); + if( bErr ) + ErrorBox( this, ResId( IDS_READERROR ) ).Execute(); + else + UpdateFileInfo( HAS_BEEN_LOADED ); +} + +// mit neuem Namen speichern +void AppBasEd::PostSaveAs() +{ + pMod->SetName( GetText() ); + AppEdit::PostSaveAs(); +} + +// Compilieren + +BOOL AppBasEd::Compile() +{ + if( !pDataEdit->HasText() || bCompiled ) + return TRUE; + pMod->SetSource( pDataEdit->GetText() ); + BOOL bRes = FALSE; + if( pFrame->Basic().Compile( pMod ) ) + { + bRes = TRUE; + if( pFrame->bDisas ) + Disassemble(); + TextSelection aSel( pDataEdit->GetSelection() ); + String aString; + pFrame->pStatus->Message( aString ); + if( aSel.HasRange() ) + aSel.GetStart() = aSel.GetEnd(), pDataEdit->SetSelection( aSel ); + + pBreakpoints->SetBPsInModule(); + } + else + { + BasicError* pErr = pFrame->Basic().aErrors.First(); + if( pErr ) pErr->Show(); + } + return bCompiled = bRes; +} + +void AppBasEd::Disassemble() +{ + String aText; + if( pFrame->Basic().Disassemble( pMod, aText ) ) + Clipboard::CopyString( aText ); +} + +void AppBasEd::Run() +{ + SbxArray* pAllModules = pFrame->Basic().GetModules(); + for (USHORT i = 0; i < pAllModules->Count(); i++) + { + if ( (pAllModules->Get(i)->GetName()).Copy(0,2).CompareToAscii( "--" ) == COMPARE_EQUAL ) + { + SbxVariableRef pMod = pAllModules->Get(i); // Kleiner Hack um ums basic rumzukommen. Sollte demnächst wieder dirkt gehen. + pFrame->Basic().Remove(pMod); + i--; + } + } + + SbMethod* pMain = (SbMethod*) pMod->Find( CUniString("Main"), SbxCLASS_METHOD ); + if( pMain ) + { + pMain->SetDebugFlags( pFrame->nFlags ); + // Loest Call aus! + pFrame->SetAppMode( String( ResId ( IDS_APPMODE_RUN ) ) ); + pMain->Run(); + if (aBasicApp.pFrame) + { + BasicError* pErr = aBasicApp.pFrame->Basic().aErrors.First(); + if( pErr ) pErr->Show(); + aBasicApp.pFrame->SetAppMode( String() ); + } + pMain->SetDebugFlags( 0 ); + } +} + + diff --git a/basic/source/app/appbased.hxx b/basic/source/app/appbased.hxx new file mode 100644 index 000000000000..b51974852afb --- /dev/null +++ b/basic/source/app/appbased.hxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * $RCSfile: appbased.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _APPBASED_HXX +#define _APPBASED_HXX + +#ifndef _SB_SBMOD_HXX //autogen +#include <sbmod.hxx> +#endif +#ifndef _SB_APPEDIT_HXX +#include "appedit.hxx" +#endif +#ifndef _SB_TEXTEDIT_HXX +#include "textedit.hxx" +#endif + +class BasicFrame; +class BreakpointWindow; + +class AppBasEd : public AppEdit { // Editor-Window: + SbModuleRef pMod; // compiliertes Modul + BOOL bCompiled; // TRUE, wenn compiliert +protected: + DECL_LINK( EditChange, void * ); +#define BREAKPOINTSWIDTH 15 + BreakpointWindow *pBreakpoints; + virtual USHORT ImplSave(); // Datei speichern + +public: + TYPEINFO(); + AppBasEd( BasicFrame*, SbModule* ); + ~AppBasEd(); + FileType GetFileType(); // Liefert den Filetype + SbModule* GetModule() { return pMod; } + long InitMenu( Menu* ); // Initialisierung des Menues + virtual long DeInitMenu( Menu* ); // rücksetzen, so daß wieder alle Shortcuts enabled sind + virtual void Command( const CommandEvent& rCEvt ); // Kommando-Handler + virtual void Resize(); // Berücksichtigt die Breakpointleiste + virtual void PostLoad(); // Nachbearbeiten des geladenen (Source am Modul setzen) + virtual void PostSaveAs(); // Nachbearbeiten des Modils ... + void Reload(); + void LoadSource(); // Quelltext zu Objekt laden + BOOL Compile(); // Text compilieren + void Run(); // Image laufenlassen + void Disassemble(); // Image disassemblieren + const String& GetModName() const { return pMod->GetName(); } + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); +}; + +#endif diff --git a/basic/source/app/appedit.cxx b/basic/source/app/appedit.cxx new file mode 100644 index 000000000000..c21f8dd3c5a0 --- /dev/null +++ b/basic/source/app/appedit.cxx @@ -0,0 +1,286 @@ +/************************************************************************* + * + * $RCSfile: appedit.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TEXTVIEW_HXX //autogen +#include <svtools/textview.hxx> +#endif + +#ifndef _TEXTENG_HXX //autogen +#include <svtools/texteng.hxx> +#endif + +#ifndef _UNDO_HXX +#include <svtools/undo.hxx> +#endif + +#ifndef _BASIC_TTRESHLP_HXX +#include "ttstrhlp.hxx" +#endif + +#include "basic.hrc" +#include "appedit.hxx" +#include "brkpnts.hxx" + +TYPEINIT1(AppEdit,AppWin); +AppEdit::AppEdit( BasicFrame* pParent ) +: AppWin( pParent ) +, nCurTextWidth(5) +, pVScroll( NULL ) +, pHScroll( NULL ) +{ + String aEmpty; + // evtl. den Untitled-String laden: + + pDataEdit = new TextEdit( this, WB_LEFT ); + // Icon definieren: +// pIcon = new Icon( ResId( RID_WORKICON ) ); +// if( pIcon ) SetIcon( *pIcon ); + + pDataEdit->SetText( aEmpty ); + + pDataEdit->Show(); + + pVScroll = new ScrollBar( this, WB_VSCROLL|WB_DRAG ); + pVScroll->Show(); + pVScroll->SetScrollHdl( LINK( this, AppEdit, Scroll ) ); + pHScroll = new ScrollBar( this, WB_HSCROLL|WB_DRAG ); + pHScroll->Show(); + pHScroll->SetScrollHdl( LINK( this, AppEdit, Scroll ) ); + + InitScrollBars(); +} + +AppEdit::~AppEdit() +{ + DataEdit *pHold = pDataEdit; + pDataEdit = NULL; // Erst abklemmen, dann löschen + delete pHold; + delete pHScroll; + delete pVScroll; +} + +IMPL_LINK( AppEdit, Scroll, ScrollBar*, pScroll ) +{ + if ( !pHScroll || !pVScroll ) + return 0; + + TextView *pTextView = ((TextEdit*)pDataEdit)->aEdit.pTextView; + pTextView->SetStartDocPos( Point( pHScroll->GetThumbPos(), pVScroll->GetThumbPos() ) ); + pTextView->Invalidate(); + + if ( ((TextEdit*)pDataEdit)->GetBreakpointWindow() ) + ((TextEdit*)pDataEdit)->GetBreakpointWindow()->Scroll( 0, ((TextEdit*)pDataEdit)->GetBreakpointWindow()->GetCurYOffset() - pTextView->GetStartDocPos().Y() ); + + return 0L; +} + + +void AppEdit::InitScrollBars() +{ + if ( !pHScroll || !pVScroll ) + return; + + TextView *pTextView = ((TextEdit*)pDataEdit)->aEdit.pTextView; +// Kopiert und angepasst. + SetScrollBarRanges(); + + Size aOutSz( pTextView->GetWindow()->GetOutputSizePixel() ); + pVScroll->SetVisibleSize( aOutSz.Height() ); + pVScroll->SetPageSize( aOutSz.Height() * 8 / 10 ); + pVScroll->SetLineSize( GetTextHeight() ); + pVScroll->SetThumbPos( pTextView->GetStartDocPos().Y() ); + pVScroll->Show(); + + pHScroll->SetVisibleSize( aOutSz.Width() ); + pHScroll->SetPageSize( aOutSz.Width() * 8 / 10 ); + pHScroll->SetLineSize( GetTextWidth( CUniString("x") ) ); + pHScroll->SetThumbPos( pTextView->GetStartDocPos().X() ); + pHScroll->Show(); +} + +void AppEdit::SetScrollBarRanges() +{ + // Extra-Methode, nicht InitScrollBars, da auch fuer EditEngine-Events. + + if ( !pHScroll || !pVScroll ) + return; + + pHScroll->SetRange( Range( 0, nCurTextWidth ) ); + + pVScroll->SetRange( Range( 0, ((TextEdit*)pDataEdit)->aEdit.pTextEngine->GetTextHeight() ) ); +} + + + +USHORT AppEdit::GetLineNr(){ return pDataEdit->GetLineNr(); } + +FileType AppEdit::GetFileType() +{ + return FT_BASIC_SOURCE; +} + +// Set up the menu +long AppEdit::InitMenu( Menu* pMenu ) +{ + AppWin::InitMenu (pMenu ); + + USHORT UndoCount = ((TextEdit*)pDataEdit)->aEdit.pTextEngine->GetUndoManager().GetUndoActionCount(); + USHORT RedoCount = ((TextEdit*)pDataEdit)->aEdit.pTextEngine->GetUndoManager().GetRedoActionCount(); + + pMenu->EnableItem( RID_EDITUNDO, UndoCount > 0 ); + pMenu->EnableItem( RID_EDITREDO, RedoCount > 0 ); + + return TRUE; +} + +long AppEdit::DeInitMenu( Menu* pMenu ) +{ + AppWin::DeInitMenu (pMenu ); + + pMenu->EnableItem( RID_EDITUNDO ); + pMenu->EnableItem( RID_EDITREDO ); + + return TRUE; +} + +// Sourcecode-Datei laden + +void AppEdit::Resize() +{ + if( !pDataEdit ) + return; + + Point rHStart,rVStart; + Size rHSize,rVSize; + Size rNewSize( GetOutputSizePixel() ); + + if ( pHScroll ) + { + rHSize = pHScroll->GetSizePixel(); + ULONG nHieght = rHSize.Height(); + rNewSize.Height() -= nHieght; + rHStart.Y() = rNewSize.Height(); + } + + if ( pVScroll ) + { + rVSize = pVScroll->GetSizePixel(); + ULONG nWidth = rVSize.Width(); + rNewSize.Width() -= nWidth; + rVStart.X() = rNewSize.Width(); + } + + rHSize.Width() = rNewSize.Width(); + rVSize.Height() = rNewSize.Height(); + + if ( pHScroll ) + { + pHScroll->SetPosPixel( rHStart ); + pHScroll->SetSizePixel( rHSize ); + } + + if ( pVScroll ) + { + pVScroll->SetPosPixel( rVStart ); + pVScroll->SetSizePixel( rVSize ); + } + pDataEdit->SetPosPixel( Point() ); + pDataEdit->SetSizePixel( rNewSize ); + + + TextView *pTextView = ((TextEdit*)pDataEdit)->aEdit.pTextView; +// Kopiert und adaptiert + long nVisY = pTextView->GetStartDocPos().Y(); + pTextView->ShowCursor(); + Size aOutSz( pTextView->GetWindow()->GetOutputSizePixel() ); + long nMaxVisAreaStart = pTextView->GetTextEngine()->GetTextHeight() - aOutSz.Height(); + if ( nMaxVisAreaStart < 0 ) + nMaxVisAreaStart = 0; + if ( pTextView->GetStartDocPos().Y() > nMaxVisAreaStart ) + { + Point aStartDocPos( pTextView->GetStartDocPos() ); + aStartDocPos.Y() = nMaxVisAreaStart; + pTextView->SetStartDocPos( aStartDocPos ); + pTextView->ShowCursor(); +// pModulWindow->GetBreakPointWindow().GetCurYOffset() = aStartDocPos.Y(); + } + InitScrollBars(); + if ( nVisY != pTextView->GetStartDocPos().Y() ) + pTextView->GetWindow()->Invalidate(); + +} + +void AppEdit::PostLoad() +{ +} + +// mit neuem Namen speichern + +void AppEdit::PostSaveAs() +{ +} + +void AppEdit::Highlight( USHORT nLine, USHORT nCol1, USHORT nCol2 ) +{ + ((TextEdit*)pDataEdit)->Highlight( nLine, nCol1, nCol2 ); + ToTop(); +} + diff --git a/basic/source/app/appedit.hxx b/basic/source/app/appedit.hxx new file mode 100644 index 000000000000..812c642c419a --- /dev/null +++ b/basic/source/app/appedit.hxx @@ -0,0 +1,101 @@ +/************************************************************************* + * + * $RCSfile: appedit.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _APPEDIT_HXX +#define _APPEDIT_HXX + +#ifndef _SCRBAR_HXX //autogen +#include <vcl/scrbar.hxx> +#endif + +#include "appwin.hxx" +#include "textedit.hxx" + +class BasicFrame; + +class AppEdit : public AppWin { // Editor-Window: +public: + ScrollBar *pVScroll; + ScrollBar *pHScroll; + void SetScrollBarRanges(); + ULONG nCurTextWidth; +private: + void InitScrollBars(); +protected: + DECL_LINK( Scroll, ScrollBar* ); +public: + TYPEINFO(); + AppEdit( BasicFrame* ); + ~AppEdit(); + USHORT GetLineNr(); // Aktuelle Zeilennummer + FileType GetFileType(); // Liefert den Filetype + virtual long InitMenu( Menu* ); // Initialisierung des Menues + virtual long DeInitMenu( Menu* ); // rücksetzen, so daß wieder alle Shortcuts enabled sind +// long Command( short ); // Kommando-Handler + void Resize(); + void PostLoad(); // Nachbearbeiten des geladenen (Source am Modul setzen) + void PostSaveAs(); // Nachbearbeiten des Modils ... + void Mark( short, short, short );// Text markieren + void Highlight( USHORT nLine, USHORT nCol1, USHORT nCol2 ); + virtual BOOL ReloadAllowed(){ return !StarBASIC::IsRunning(); } +}; + +#endif diff --git a/basic/source/app/apperror.cxx b/basic/source/app/apperror.cxx new file mode 100644 index 000000000000..15b6cb4e53fc --- /dev/null +++ b/basic/source/app/apperror.cxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * $RCSfile: apperror.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include "basic.hrc" +#include "apperror.hxx" + +TYPEINIT1(AppError,AppWin); +AppError::AppError( BasicFrame* pParent, String aFileName ) +: AppWin( pParent ) +{ + SetText( aFileName ); // Muß vor new MsgEdit stehen!! + pDataEdit = new MsgEdit( this, pParent, WB_HSCROLL | WB_VSCROLL | WB_LEFT ); + DirEntry aEntry( aFileName ); + UpdateFileInfo( HAS_BEEN_LOADED ); + // Icon definieren: +// pIcon = new Icon( ResId( RID_WORKICON ) ); +// if( pIcon ) SetIcon( *pIcon ); + + pDataEdit->Show(); + GrabFocus(); +} + +AppError::~AppError() +{ + DataEdit* pTemp = pDataEdit; + pDataEdit = NULL; + delete pTemp; +} + +// Set up the menu +long AppError::InitMenu( Menu* pMenu ) +{ + AppWin::InitMenu (pMenu ); + + pMenu->EnableItem( RID_EDITUNDO, FALSE ); + pMenu->EnableItem( RID_EDITREDO, FALSE ); + + return TRUE; +} + +long AppError::DeInitMenu( Menu* pMenu ) +{ + AppWin::DeInitMenu (pMenu ); + + pMenu->EnableItem( RID_EDITUNDO ); + pMenu->EnableItem( RID_EDITREDO ); + + return TRUE; +} + +USHORT AppError::GetLineNr(){ return pDataEdit->GetLineNr(); } + +FileType AppError::GetFileType() +{ + return FT_RESULT_FILE; +} + diff --git a/basic/source/app/apperror.hxx b/basic/source/app/apperror.hxx new file mode 100644 index 000000000000..a806175deaac --- /dev/null +++ b/basic/source/app/apperror.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * $RCSfile: apperror.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <appwin.hxx> +#include <msgedit.hxx> + +class AppError : public AppWin +{ +protected: + DECL_LINK( EditChange, MsgEdit * ); +public: + TYPEINFO(); + AppError( BasicFrame*, String ); + ~AppError(); +// long Command( short nID ); + virtual long InitMenu( Menu* ); // Initialisierung des Menues + virtual long DeInitMenu( Menu* ); // rücksetzen, so daß wieder alle Shortcuts enabled sind + USHORT GetLineNr(); // Aktuelle Zeilennummer + FileType GetFileType(); // Liefert den Filetype + MsgEdit* GetMsgTree() { return ((MsgEdit*)pDataEdit); } + virtual BOOL ReloadAllowed(){ return !StarBASIC::IsRunning(); } +}; + diff --git a/basic/source/app/appwin.cxx b/basic/source/app/appwin.cxx new file mode 100644 index 000000000000..2cd1cc4196bf --- /dev/null +++ b/basic/source/app/appwin.cxx @@ -0,0 +1,647 @@ +/************************************************************************* + * + * $RCSfile: appwin.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _MSGBOX_HXX //autogen +#include <vcl/msgbox.hxx> +#endif +#ifndef _FSYS_HXX //autogen +#include <tools/fsys.hxx> +#endif +#ifndef _CLIP_HXX //autogen +#include <vcl/clip.hxx> +#endif + +#include "basic.hrc" +#include "app.hxx" +#include "mybasic.hxx" +#include "status.hxx" +#include "appwin.hxx" +#include "dataedit.hxx" +#include "dialogs.hxx" + +String *AppWin::pNoName = NULL; // enthaelt den "Untitled"-String +short AppWin::nNumber = 0; // fortlaufende Nummer +short AppWin::nCount = 0; // Anzahl Editfenster + +TYPEINIT0(AppWin); +AppWin::AppWin( BasicFrame* pParent ) +: DockingWindow( pParent, WB_SIZEMOVE | WB_CLOSEABLE | WB_PINABLE ) +, pDataEdit(NULL) +, nSkipReload(0) +, bHasFile( FALSE ) +, bReloadAborted( FALSE ) +, bFind( TRUE ) +, pFrame( pParent ) +{ + // evtl. den Untitled-String laden: + if( !pNoName ) + pNoName = new String( ResId( IDS_NONAME ) ); + nCount++; + + // Maximized Status von aktuellem Fenster holen + USHORT nInitialWinState; + if ( pFrame->pWork ) + { + nInitialWinState = pFrame->pWork->GetWinState(); + nInitialWinState &= TT_WIN_STATE_MAX | TT_WIN_STATE_FLOAT; + } + else + nInitialWinState = TT_WIN_STATE_MAX; + + StartListening( *pFrame ); + pFrame->AddWindow( this ); + + ShowTitleButton( TITLE_BUTTON_DOCKING ); + ShowTitleButton( TITLE_BUTTON_HIDE ); + SetActivateMode( ACTIVATE_MODE_GRABFOCUS ); + + Cascade( nCount ); + if ( TT_WIN_STATE_MAX == nInitialWinState ) + Maximize(); +} + +AppWin::~AppWin() +{ + nCount--; + pFrame->RemoveWindow( this ); + pFrame = NULL; // So daß nach BasicRun nicht mehr versucht wird Fenstertext zu setzen +} + +void AppWin::SetText( const XubString& rStr ) +{ + DockingWindow::SetText( rStr ); + pFrame->WindowRenamed( this ); +} + +void AppWin::TitleButtonClick( USHORT nButton ) +{ + if ( TITLE_BUTTON_DOCKING == nButton ) + if ( TT_WIN_STATE_MAX != nWinState ) + Maximize(); + else + Restore(); + else // if ( TITLE_BUTTON_HIDE == nButton ) + Minimize( TRUE ); +} + +void AppWin::Maximize() +{ + if ( TT_WIN_STATE_MAX != nWinState ) + { + nNormalPos = GetPosPixel(); + nNormalSize = GetSizePixel(); + + SetFloatingMode( FALSE ); + + pFrame->nMaximizedWindows++; + nWinState = TT_WIN_STATE_MAX; + } + long nTitleHeight; + { + long nDummy1, nDummy2, nDummy3; + pFrame->GetBorder( nDummy1, nTitleHeight, nDummy2, nDummy3 ); + } + + Size aSize = pFrame->GetOutputSizePixel(); + aSize.Height() -= nTitleHeight; + aSize.Height() -= 2; + aSize.Width() -= 2; + SetSizePixel( aSize ); + SetPosPixel( Point( 1,1 ) ); + pFrame->WinMax_Restore(); +} + +void AppWin::Restore() +{ + SetFloatingMode( TRUE ); + SetPosSizePixel( nNormalPos, nNormalSize ); + + if ( TT_WIN_STATE_MAX == nWinState ) + pFrame->nMaximizedWindows--; + + nWinState = TT_WIN_STATE_FLOAT; + pFrame->WinMax_Restore(); +} + +void AppWin::Minimize( BOOL bMinimize ) +{ + if ( bMinimize ) + nWinState |= TT_WIN_STATE_HIDE; + else + nWinState &= ~TT_WIN_STATE_HIDE; + pFrame->WinMax_Restore(); +} + +void AppWin::Cascade( USHORT nNr ) +{ + Restore(); + + nNr--; + nNr %= 10; + nNr++; + + long nTitleHeight; + { + long nDummy1, nDummy2, nDummy3; + pFrame->GetBorder( nDummy1, nTitleHeight, nDummy2, nDummy3 ); + } + + Size aWinSize = pFrame->GetOutputSizePixel(); + aWinSize.Width() -= aWinSize.Width() / 5; // auf 80 % reduzieren + aWinSize.Height() -= nTitleHeight * nNr; // Unten entsprechen kürzen + aWinSize.Height() -= 2; + + Point nPos( nTitleHeight * nNr, nTitleHeight * nNr ); + + SetPosSizePixel( nPos, aWinSize ); +} + +void AppWin::RequestHelp( const HelpEvent& ) +{ + Help(); +} + +void AppWin::Help() +{ + String s = pDataEdit->GetSelected(); + if( s.Len() ) { + // Leerstellen davor weg: + while( s.GetChar(0) == ' ' ) s.Erase( 0, 1 ); +// aBasicApp.pHelp->Start( s ); + } else { +// aBasicApp.pHelp->Start( HELP_INDEX ); + } +} + +void AppWin::Resize() +{ + if( pDataEdit ) + { + pDataEdit->SetPosPixel( Point( 0, 0 ) ); + pDataEdit->SetSizePixel( GetOutputSizePixel() ); + } +} + +void AppWin::GetFocus() +{ + pFrame->FocusWindow( this ); + if( pDataEdit ) // Im Destruktor wird GetFocus gerufen, daher diese Abfrage + { + pDataEdit->GrabFocus(); +// InitMenu(GetpApp()->GetAppMenu()->GetPopupMenu( RID_APPEDIT )); // So daß Delete richtig ist + } +} + +long AppWin::PreNotify( NotifyEvent& rNEvt ) +{ + + if ( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN ) + Activate(); + if ( rNEvt.GetType() == EVENT_GETFOCUS ) + if ( pFrame->pList->Last() != this ) + Activate(); + return FALSE; // Der event soll weiter verarbeitet werden +} + +void AppWin::Activate() +{ + GrabFocus(); +} + +// Set up the menu +long AppWin::InitMenu( Menu* pMenu ) +{ + Clipboard cb; + TextSelection r = pDataEdit->GetSelection(); + BOOL bMarked = r.HasRange(); + pMenu->EnableItem( RID_EDITREPEAT, (aFind.Len() != 0 ) ); + pMenu->EnableItem( RID_EDITCUT, bMarked ); + pMenu->EnableItem( RID_EDITCOPY, bMarked ); +// pMenu->EnableItem( RID_EDITPASTE, (cb.GetDataLen( FORMAT_STRING ) != 0 ) ); + pMenu->EnableItem( RID_EDITPASTE, (cb.HasFormat( FORMAT_STRING ) ) ); + pMenu->EnableItem( RID_EDITDEL, bMarked ); +// pMenu->EnableItem( RID_HELPTOPIC, bMarked ); + + BOOL bHasText = pDataEdit->HasText(); + BOOL bRunning = pFrame->Basic().IsRunning(); + BOOL bCanExecute = BOOL( (!bRunning && bHasText) || pFrame->bInBreak ); + pMenu->EnableItem( RID_RUNSTART, bCanExecute ); + pMenu->EnableItem( RID_RUNBREAK, bRunning && !pFrame->bInBreak); + pMenu->EnableItem( RID_RUNSTOP, bRunning ); + pMenu->EnableItem( RID_RUNTOCURSOR, bCanExecute ); + pMenu->EnableItem( RID_RUNSTEPINTO, bCanExecute ); + pMenu->EnableItem( RID_RUNSTEPOVER, bCanExecute ); + return TRUE; +} + +long AppWin::DeInitMenu( Menu* pMenu ) +{ + pMenu->EnableItem( RID_EDITREPEAT ); + pMenu->EnableItem( RID_EDITCUT ); + pMenu->EnableItem( RID_EDITCOPY ); + pMenu->EnableItem( RID_EDITPASTE ); + pMenu->EnableItem( RID_EDITDEL ); + + pMenu->EnableItem( RID_RUNSTART ); + pMenu->EnableItem( RID_RUNBREAK ); + pMenu->EnableItem( RID_RUNSTOP ); + pMenu->EnableItem( RID_RUNTOCURSOR ); + pMenu->EnableItem( RID_RUNSTEPINTO ); + pMenu->EnableItem( RID_RUNSTEPOVER ); + return TRUE; +} + +// Menu Handler + +void AppWin::Command( const CommandEvent& rCEvt ) +{ + TextSelection r = pDataEdit->GetSelection(); + BOOL bHasMark = r.HasRange(); + switch( rCEvt.GetCommand() ) { + case RID_FILESAVE: + QuerySave( QUERY_DISK_CHANGED | SAVE_NOT_DIRTY ); break; + case RID_FILESAVEAS: + SaveAs(); break; + case RID_EDITSEARCH: + Find(); break; + case RID_EDITREPLACE: + Replace(); break; + case RID_EDITREPEAT: + Repeat(); break; + case RID_EDITCUT: + if( bHasMark ) pDataEdit->Cut(); break; + case RID_EDITCOPY: + if( bHasMark ) pDataEdit->Copy(); break; + case RID_EDITPASTE: + if( Clipboard::HasFormat( FORMAT_STRING ) ) pDataEdit->Paste(); break; + case RID_EDITDEL: + /*if( bHasMark ) */pDataEdit->Delete(); + break; + case RID_EDITUNDO: + pDataEdit->Undo(); + break; + case RID_EDITREDO: + pDataEdit->Redo(); + break; + case COMMAND_CONTEXTMENU: + { + PopupMenu *pKontext = NULL; + pDataEdit->BuildKontextMenu( pKontext ); + if ( pKontext ) + { + USHORT nRes = pKontext->Execute( this, GetPointerPosPixel() ); + if ( nRes ) + pFrame->Command( nRes ); + delete pKontext; + } + } + } +} + + +BOOL AppWin::IsSkipReload() +{ + return nSkipReload != 0; +} + +void AppWin::SkipReload( BOOL bSkip ) +{ + DBG_ASSERT( bSkip || nSkipReload, "SkipReload aufgehoben ohne es zu aktivieren"); + if ( bSkip ) + nSkipReload++; + else + nSkipReload--; +} + +BOOL AppWin::DiskFileChanged( USHORT nWhat ) +{ + if ( !bHasFile ) + return FALSE; + + switch ( nWhat ) + { + case SINCE_LAST_LOAD: + { + if ( bReloadAborted ) + return TRUE; + else + return DiskFileChanged( SINCE_LAST_ASK_RELOAD ); + } + break; + case SINCE_LAST_ASK_RELOAD: + { + String aFilename( GetText() ); + + DirEntry aFile( aFilename ); + FileStat aStat( aFile ); + + return ( !aLastAccess.GetError() != !aStat.GetError() ) + || aLastAccess.IsYounger( aStat ) || aStat.IsYounger( aLastAccess ); + } + break; + default: + DBG_ERROR("Not Implemented in AppWin::DiskFileChanged"); + } + return TRUE; +} + +void AppWin::UpdateFileInfo( USHORT nWhat ) +{ + switch ( nWhat ) + { + case HAS_BEEN_LOADED: + { + bReloadAborted = FALSE; + UpdateFileInfo( ASKED_RELOAD ); + + } + break; + case ASKED_RELOAD: + { + String aFilename( GetText() ); + + DirEntry aFile( aFilename ); + aLastAccess.Update( aFile ); + } + break; + default: + DBG_ERROR("Not Implemented in AppWin::UpdateFileInfo"); + } +} + +void AppWin::CheckReload() +{ + if ( IsSkipReload() || !bHasFile ) + return; + + String aFilename( GetText() ); + DirEntry aFile( aFilename ); + if ( !aFilename.Len() ) + return; + + if ( !aFile.Exists() ) + return; + +// FileStat aStat( aFile ); + + if ( DiskFileChanged( SINCE_LAST_ASK_RELOAD ) && ReloadAllowed() ) + { + UpdateFileInfo( ASKED_RELOAD ); + ToTop(); + Update(); + if ( (IsModified() && QueryBox( this, ResId( IDS_ASKDIRTYRELOAD ) ).Execute() == RET_YES ) + || ( !IsModified() && ( pFrame->IsAutoReload() || QueryBox( this, ResId( IDS_ASKRELOAD ) ).Execute() == RET_YES ) ) ) + { + Reload(); + } + else + { + bReloadAborted = TRUE; + } + } +} + +void AppWin::Reload() +{ + SkipReload(); + TextSelection aSelMemo = pDataEdit->GetSelection(); + Load( GetText() ); + pDataEdit->SetSelection( aSelMemo ); + SkipReload( FALSE ); +} + +// Datei laden + +void AppWin::Load( const String& aName ) +{ + SkipReload(); + BOOL bErr; + +// if( !QuerySave() ) +// return; + bErr = !pDataEdit->Load( aName ); + if( bErr ) + ErrorBox( this, ResId( IDS_READERROR ) ).Execute(); + else + { + DirEntry aEntry( aName ); + String aModName = aEntry.GetFull(); + SetText( aModName ); + UpdateFileInfo( HAS_BEEN_LOADED ); + PostLoad(); + bHasFile = TRUE; + } + SkipReload( FALSE ); +} + +// Datei speichern + +USHORT AppWin::ImplSave() +{ + SkipReload(); + BOOL bResult = SAVE_RES_NOT_SAVED; + String s1 = *pNoName; + String s2 = GetText().Copy( 0, s1.Len() ); + if( s1 == s2 ) + bResult = SaveAs(); + else { + String aName = GetText(); + if ( pDataEdit->Save( aName ) ) + { + bResult = SAVE_RES_SAVED; + bHasFile = TRUE; + } + else + { + bResult = SAVE_RES_ERROR; + ErrorBox( this, ResId( IDS_WRITEERROR ) ).Execute(); + } + UpdateFileInfo( HAS_BEEN_LOADED ); + } + SkipReload( FALSE ); + return bResult; +} + +// mit neuem Namen speichern + +USHORT AppWin::SaveAs() +{ + SkipReload(); + String s1 = *pNoName; + String s2 = GetText().Copy( 0, s1.Len() ); + if( s1 == s2 ) s2.Erase(); + else s2 = GetText(); + if( pFrame->QueryFileName( s2, GetFileType(), TRUE ) ) + { + SetText( s2 ); + PostSaveAs(); + SkipReload( FALSE ); + return ImplSave(); + } + else + { + SkipReload( FALSE ); + return SAVE_RES_CANCEL; + } +} + +// Soll gespeichert werden? + +USHORT AppWin::QuerySave( QueryBits nBits ) +{ + BOOL bQueryDirty = ( nBits & QUERY_DIRTY ) != 0; + BOOL bQueryDiskChanged = ( nBits & QUERY_DISK_CHANGED ) != 0; + BOOL bSaveNotDirty = ( nBits & SAVE_NOT_DIRTY ) != 0; + + SkipReload(); + short nResult; + if ( IsModified() || bSaveNotDirty ) + nResult = RET_YES; + else + nResult = RET_NO; + + if( ( ( IsModified() || bSaveNotDirty ) && bQueryDirty ) || ( DiskFileChanged( SINCE_LAST_LOAD ) && bQueryDiskChanged ) ) + { + ToTop(); + if ( ( ( IsModified() && bQueryDirty ) && DiskFileChanged( SINCE_LAST_LOAD ) ) + || ( IsModified() && ( DiskFileChanged( SINCE_LAST_LOAD ) && bQueryDiskChanged ) ) ) + nResult = QueryBox( this, ResId( IDS_ASK_DIRTY_AND_DISKCHANGE_SAVE ) ).Execute(); + else if ( ( IsModified() && bQueryDirty ) ) + nResult = QueryBox( this, ResId( IDS_ASK_DIRTY_SAVE ) ).Execute(); + else + nResult = QueryBox( this, ResId( IDS_ASK_DISKCHANGE_SAVE ) ).Execute(); + } + + + USHORT nReturn; + switch( nResult ) + { + case RET_YES: + nReturn = ImplSave(); + break; + case RET_NO: + nReturn = SAVE_RES_NOT_SAVED; + break; + case RET_CANCEL: + nReturn = SAVE_RES_CANCEL; + break; + } + SkipReload( FALSE ); + return nReturn; +} + +BOOL AppWin::Close() +{ + switch ( QuerySave( QUERY_DIRTY ) ) + { + case SAVE_RES_NOT_SAVED: + case SAVE_RES_SAVED: + { + DockingWindow::Close(); + delete this; + return TRUE; + } + break; + case SAVE_RES_ERROR: // Fehlermeldung schon ausgegeben + return FALSE; + break; + case SAVE_RES_CANCEL: + return FALSE; + break; + default: + DBG_ERROR("Not Implemented in AppWin::Close") + return FALSE; + } +} + +// Text suchen + +void AppWin::Find() +{ + ResId aResId( IDD_FIND_DIALOG ); + FindDialog aDlg( this, aResId, aFind ); + if( aDlg.Execute() ) { + bFind = TRUE; + Repeat(); + } +} + +// Text ersetzen + +void AppWin::Replace() +{ + ResId aResId( IDD_REPLACE_DIALOG ); + ReplaceDialog* pDlg = new ReplaceDialog + (this, aResId, aFind, aReplace ); + if( pDlg->Execute() ) { + bFind = FALSE; + Repeat(); + } +} + +// Suchen/ersetzen wiederholen + +void AppWin::Repeat() +{ + if( (aFind.Len() != 0 ) && ( pDataEdit->Find( aFind ) || (ErrorBox(this,ResId(IDS_PATTERNNOTFOUND)).Execute() && FALSE) ) && !bFind ) + pDataEdit->ReplaceSelected( aReplace ); +} + diff --git a/basic/source/app/appwin.hxx b/basic/source/app/appwin.hxx new file mode 100644 index 000000000000..2a8c953acf32 --- /dev/null +++ b/basic/source/app/appwin.hxx @@ -0,0 +1,175 @@ +/************************************************************************* + * + * $RCSfile: appwin.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _APPWIN_HXX +#define _APPWIN_HXX + +//#include <sb.hxx> +#ifndef _SV_DOCKWIN_HXX +#include <vcl/dockwin.hxx> +#endif +#ifndef _FSYS_HXX //autogen +#include <tools/fsys.hxx> +#endif + +#include "app.hxx" +#include "dataedit.hxx" + +typedef USHORT QueryBits; +#define QUERY_NONE ( QueryBits ( 0x00 ) ) +#define QUERY_DIRTY ( QueryBits ( 0x01 ) ) +#define QUERY_DISK_CHANGED ( QueryBits ( 0x02 ) ) +#define QUERY_ALL ( QUERY_DIRTY | QUERY_DISK_CHANGED ) +#define SAVE_NOT_DIRTY ( QueryBits ( 0x04 ) ) + +#define SAVE_RES_SAVED TRUE +#define SAVE_RES_NOT_SAVED FALSE +#define SAVE_RES_ERROR 3 +#define SAVE_RES_CANCEL 4 + + +#define SINCE_LAST_LOAD 1 +#define SINCE_LAST_ASK_RELOAD 2 + +#define HAS_BEEN_LOADED 1 // includes ASKED_RELOAD +#define ASKED_RELOAD 2 + + +#define TT_WIN_STATE_MAX 0x01 +#define TT_WIN_STATE_FLOAT 0x02 +#define TT_WIN_STATE_HIDE 0x04 + +class BasicFrame; + +class AppWin : public DockingWindow, public SfxListener // Dokumentfenster +{ + friend MsgEdit; +protected: + static short nNumber; // fortlaufende Nummer + static short nCount; // Anzahl Editfenster + static String *pNoName; // "Untitled" + FileStat aLastAccess; // Wann wurde die geladene Dateiversion verändert + USHORT nSkipReload; // Manchmal darf kein Reload erfolgen + BOOL bHasFile; // Ansonsten hat reload auch keinen Sinn + BOOL bReloadAborted; // Wird gesetzt, wenn reload abgelehnt wurde, so daß beim Schließen nochmal gefragt werden kann + + short nId; // ID-Nummer( "Unbenannt n" ) + BasicFrame* pFrame; // Parent-Window +// Icon* pIcon; // Dokument-Icon + String aFind; // Suchstring + String aReplace; // Ersetze-String + BOOL bFind; // TRUE, wenn Suchen und nicht Ersetzen + void RequestHelp( const HelpEvent& );// Hilfe-Handler + void GetFocus(); // aktivieren + virtual USHORT ImplSave(); // Datei speichern + USHORT nWinState; // Maximized, Iconized oder Normal + Point nNormalPos; // Position wenn Normal + Size nNormalSize; // Größe wenn Normal + virtual long PreNotify( NotifyEvent& rNEvt ); + USHORT nWinId; + +public: + TYPEINFO(); + AppWin( BasicFrame* ); + ~AppWin(); + DataEdit* pDataEdit; // Daten-Flaeche + virtual USHORT GetLineNr()=0; // Aktuelle Zeilennummer + virtual long InitMenu( Menu* ); // Initialisierung des Menues + virtual long DeInitMenu( Menu* ); // rücksetzen, so daß wieder alle Shortcuts enabled sind + virtual void Command( const CommandEvent& rCEvt ); // Kommando-Handler + virtual void Resize(); // Aenderung Fenstergroesse + virtual void Help(); // Hilfe aktivieren + virtual void Load( const String& ); // Datei laden + virtual void PostLoad(){} // Nachbearbeiten des geladenen (Source am Modul setzen) + virtual USHORT SaveAs(); // Datei unter neuem Namen speichern + virtual void PostSaveAs(){} // Nachbearbeiten des Moduls ... + virtual void Find(); // Text suchen + virtual void Replace(); // Text ersetzen + virtual void Repeat(); // Suche wiederholen + virtual BOOL Close(); // Fenster schliessen + virtual void Activate(); // Fenster wurde aktiviert + virtual FileType GetFileType()=0; // Liefert den Filetype + virtual BOOL ReloadAllowed(){ return TRUE; } // Ermöglicht dem Dok temporär NEIN zu sagen + virtual void Reload(); // Reload nach änderung auf Platte + void CheckReload(); // Prüft und Fragt ob reloaded werden soll + BOOL DiskFileChanged( USHORT nWhat ); // Prüft ob die Datei sich verändert hat + void UpdateFileInfo( USHORT nWhat ); // Merkt sich den aktuellen Zustand der Datei + BOOL IsSkipReload(); // Soll reload getestet werden + void SkipReload( BOOL bSkip = TRUE ); + USHORT GetWinState(){ return nWinState; } + void Maximize(); + void Restore(); + void Minimize( BOOL bMinimize ); + void Cascade( USHORT nNr ); + + USHORT QuerySave( QueryBits nBits = QUERY_ALL ); // Speichern + BOOL IsModified() { return pDataEdit->IsModified(); } + BasicFrame* GetBasicFrame() { return pFrame; } + virtual void TitleButtonClick( USHORT nButton ); + virtual void SetText( const XubString& rStr ); + + USHORT GetWinId() { return nWinId; } + void SetWinId( USHORT nId ) { nWinId = nId; } +}; + +DECLARE_LIST( EditList, AppWin* ); + +#endif diff --git a/basic/source/app/basic.hrc b/basic/source/app/basic.hrc new file mode 100644 index 000000000000..2b49303e3c33 --- /dev/null +++ b/basic/source/app/basic.hrc @@ -0,0 +1,218 @@ +/************************************************************************* + * + * $RCSfile: basic.hrc,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#define RID_OPTLIST 101 +#define RID_OPTLINES 102 +#define RID_OPTPACKS 103 +#define RID_OPTPACKD 104 +#define RID_OPTWARN1 105 +#define RID_OPTWARN2 106 +#define RID_OPTVIRT 107 +#define RID_PARAMS 108 +#define RID_RETTYPE 109 +#define RID_RETVAL 110 +//#define RID_APPICON 500 +//#define RID_APPICON2 501 +//#define RID_WORKICON 502 +//#define RID_LOADICON 503 +//#define RID_SAVEICON 504 +#define RID_APPMENUBAR 1000 +#define RID_APPFILE 1001 +#define RID_APPEDIT 1002 +#define RID_APPRUN 1003 +#define RID_APPWINDOW 1004 +#define RID_APPHELP 1005 +#define RID_FILE 1100 +#define RID_FILENEW 1101 +#define RID_FILEOPEN 1102 +#define RID_FILECLOSE 1103 +#define RID_FILESAVE 1104 +#define RID_FILESAVEAS 1105 +#define RID_FILELOADLIB 1106 +#define RID_FILESAVELIB 1107 +#define RID_FILEPRINT 1109 +#define RID_FILESETUP 1110 +#define RID_QUIT 1111 +#define IDM_FILE_LRU1 1112 +#define IDM_FILE_LRU2 (IDM_FILE_LRU1 + 1) +#define IDM_FILE_LRU3 (IDM_FILE_LRU2 + 1) +#define IDM_FILE_LRU4 (IDM_FILE_LRU3 + 1) +#define RID_EDIT 1200 +#define RID_EDITUNDO 1201 +#define RID_EDITREDO 1202 +#define RID_EDITCUT 1203 +#define RID_EDITCOPY 1204 +#define RID_EDITPASTE 1205 +#define RID_EDITDEL 1206 +#define RID_EDITSEARCH 1207 +#define RID_EDITREPLACE 1208 +#define RID_EDITREPEAT 1209 +#define RID_RUN 1300 +#define RID_RUNCOMPILE 1301 +#define RID_RUNSTART 1302 +#define RID_RUNBREAK 1304 +#define RID_RUNSTOP 1303 +#define RID_RUNNEXTERR 1307 +#define RID_RUNPREVERR 1308 +#define RID_RUNDISAS 1310 +#define RID_RUNSTEPINTO 1311 +#define RID_RUNSTEPOVER 1312 +#define RID_RUNTOCURSOR 1313 +#define RID_TOGLEBRKPNT 1314 +#define RID_TT_EXTRAS_NAME 1400 +#define RID_TT_EXTRAS 1401 +#define RID_OPTIONS 1402 +#define RID_DECLARE_HELPER 1403 +#define RID_WINDOW 1501 +#define RID_WINTILE 1502 +#define RID_WINTILEHORZ 1503 +#define RID_WINTILEVERT 1504 +#define RID_WINCASCADE 1505 +#define RID_WIN_FILE1 1520 +#define RID_WIN_FILEn 1599 + +#define RID_HELP 1601 +//#define RID_HELPINDEX 1602 +//#define RID_HELPKEYS 1603 +//#define RID_HELPINTRO 1604 +//#define RID_HELPTOPIC 1605 +#define RID_HELPABOUT 1606 +#define RID_POPUP 1700 +#define RID_POPUPEDITVAR 1701 + + + +#define IDS_APPNAME 2000 +#define IDS_APPNAME2 2001 +#define IDS_APPMODE_BREAK 2002 +#define IDS_APPMODE_RUN 2003 +#define IDS_NONAME 2100 +#define IDS_NONAMEFILE 2101 +#define IDS_INCFILE 2102 +#define IDS_LIBFILE 2103 +#define IDS_RESFILE 2104 +#define IDS_TXTFILE 2105 +#define IDS_READERROR 2103 +#define IDS_WRITEERROR 2104 +#define IDS_COMPERROR 2105 +#define IDS_CONTINUE 2106 +#define IDS_CANCEL 2107 +#define IDS_NOPRINTERERROR 2108 +#define IDS_PATTERNNOTFOUND 2109 +#define IDS_INVALID_VALUE 2110 +#define IDS_ASK_DIRTY_SAVE 2200 +#define IDS_ASK_DISKCHANGE_SAVE 2201 +#define IDS_ASK_DIRTY_AND_DISKCHANGE_SAVE 2202 +#define IDS_ASKSAVEERROR 2203 +#define IDS_ASKRELOAD 2204 +#define IDS_ASKDIRTYRELOAD 2205 +#define IDS_LOADDLG 2300 +#define IDS_SAVEDLG 2301 +#define IDS_BASFILTER 2304 +#define IDS_LIBFILTER 2305 +#define IDS_INCFILTER 2306 +#define IDS_RESFILTER 2307 +#define IDS_TXTFILTER 2308 +#define IDS_PAGE 2401 +#define IDS_PRINTMSG 2402 +#define IDS_CANTLOAD 2501 +#define IDS_CANTSAVE 2502 +#define IDS_ERROR1 2601 +#define IDS_ERROR2 2602 +#define IDS_WARNING1 2603 +#define IDS_NO_LONGNAME 2604 +#define IDS_WARNING_PREFIX 2605 +#define IDS_OBJECT 2606 +#define IDS_EDIT_VAR 2607 + +#define IDS_NOMAINPGM 2701 +#define IDS_DISASWIN 2702 +#define IDS_RUNNING 2703 +#define IDS_NOT_YET_IMPLEMENTED 2704 +#define IDS_LOSS_OF_INFORMATION 2705 + +#define RID_ACCEL 3000 + +#define IDD_LOADSAVE_DIALOG 4001 +#define IDD_ABOUT_DIALOG 4002 +#define IDD_TT_ABOUT_DIALOG 4003 +#define IDD_FIND_DIALOG 4004 +#define IDD_REPLACE_DIALOG 4005 +#define IDD_PRINT_DIALOG 4006 +#define IDD_OPTIONS_DLG 4007 +#define RID_TP_SPECIAL 4008 +#define RID_TP_GENERIC 4009 +#define IDD_DISPLAY_HID 4010 +#define IDD_EDIT_VAR 4010 + + +//#define RID_APPFONT 5000 +//#define RID_APPEDITFONT 5001 +//#define RID_DLGBRUSH 5002 +#define RID_CALLDLG 6001 +#define MBP_PLUS 8001 +#define MBP_MINUS 8002 +#define MBP_ASSERT 8003 +#define RID_IMGLST_LAYOUT 8004 +#define MAIN_ACCEL 9001 + +#define LOAD_CONF 10001 +#define WORK 10002 +#define FILENAME 10003 diff --git a/basic/source/app/basic.src b/basic/source/app/basic.src new file mode 100644 index 000000000000..f96d5641ddd1 --- /dev/null +++ b/basic/source/app/basic.src @@ -0,0 +1,4089 @@ +/************************************************************************* + * + * $RCSfile: basic.src,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include "basic.hrc" +#include "resids.hrc" + +ModalDialog RID_CALLDLG { + Text = "Dynamischer Link Nr. "; + Text [ english_us ] = "Dynamic Link No. "; + PosSize = MAP_SYSFONT (18,18,142,142); + SVLook = TRUE; + MOVEABLE = TRUE; + CLOSEABLE = TRUE; +// WinChilds = { +// FixedText { +// Text = "Aktuelle Parameter"; +// Text [ english_us ] = "Aktuelle Parameter"; +// PosSize = MAP_SYSFONT (10,10,120,8); +// }; +// }; + FixedText RID_RETTYPE { + PosSize = MAP_SYSFONT (10,70,120,8); + }; + Edit RID_RETVAL { + PosSize = MAP_SYSFONT (10,85,120,12); + Border = TRUE; + TabStop = TRUE; + }; + ListBox RID_PARAMS { + PosSize = MAP_SYSFONT (10,25,120,40); + TabStop = TRUE; + Border = TRUE; + }; + OKButton RID_OK { + PosSize = MAP_SYSFONT (50,105,40,14); + TabStop = TRUE; + DefButton = TRUE; + }; + Text[ portuguese ] = "Ligação dinâmica nº. "; + Text[ russian ] = "Dynamic Link No. "; + Text[ greek ] = "Dynamic Link No. "; + Text[ dutch ] = "Dynamische link no. "; + Text[ french ] = "Lien dynamique No. "; + Text[ spanish ] = "Vínculo dinámico núm.: "; + Text[ italian ] = "Dynamic Link No. "; + Text[ danish ] = "Dynamic Link No. "; + Text[ swedish ] = "Dynamic link No. "; + Text[ polish ] = "Dynamic Link No. "; + Text[ portuguese_brazilian ] = "Dynamischer Link Nr. "; + Text[ japanese ] = "Dynamic Link No. "; + Text[ korean ] = "µ¿Àû ¸µÅ© ¹øÈ£ "; + Text[ chinese_simplified ] = "Dynamischer Link Nr. "; + Text[ chinese_traditional ] = "Dynamic Link No. "; + Text[ arabic ] = "Dynamic Link No. "; + Text[ turkish ] = "Dinamik baðlantý no. "; +}; + +ModalDialog IDD_ABOUT_DIALOG { + Pos = MAP_APPFONT( 58, 17 ); + Size = MAP_APPFONT( 155, 106 ); + SVLook = TRUE; +/* + WINCHILDS = { + FixedText { + Pos = MAP_APPFONT( 40, 5 ); + Size = MAP_APPFONT( 110, 10 ); + TEXT = "StarBasic"; + TEXT [ english_us ] = "StarBasic"; + CENTER = TRUE; + }; + FixedText { + Pos = MAP_APPFONT( 40, 20 ); + Size = MAP_APPFONT( 110, 20 ); + TEXT = "Ojektorientiertes BASIC-Entwicklungssystem"; + TEXT [ english_us ] = "Ojektorientiertes BASIC-Entwicklungssystem"; + CENTER = TRUE; + }; + FixedText { + Pos = MAP_APPFONT( 40, 45 ); + Size = MAP_APPFONT( 110, 10 ); + TEXT = "Version 2.0 Mai 1995"; + TEXT [ english_us ] = "Version 2.0 Mai 1995"; + CENTER = TRUE; + }; + FixedText { + Pos = MAP_APPFONT( 40, 60 ); + Size = MAP_APPFONT( 110, 10 ); + TEXT = "®1995 Sun Microsystems, Inc."; + TEXT [ english_us ] = "®1995 Sun Microsystems, Inc."; + CENTER = TRUE; + }; + }; +*/ +// FixedIcon RID_ICON { +// Pos = MAP_APPFONT( 20, 26 ); +// Size = MAP_APPFONT( 20, 20 ); +// FIXED = Icon { +// FILE = "basic.ico"; +// }; +// }; + OKButton RID_OK { + Pos = MAP_APPFONT( 55, 80 ); + Size = MAP_APPFONT( 40, 14 ); + DefButton = TRUE; + }; +}; + +ModalDialog IDD_TT_ABOUT_DIALOG { + Pos = MAP_APPFONT( 58, 17 ); + Size = MAP_APPFONT( 155, 106 ); + SVLook = TRUE; + FixedText 1 { + Pos = MAP_APPFONT( 40, 5 ); + Size = MAP_APPFONT( 110, 10 ); + TEXT = "StarTestTool"; + TEXT [ english_us ] = "StarTestTool"; + CENTER = TRUE; + TEXT[ portuguese ] = "StarTestTool"; + TEXT[ russian ] = "StarTestTool"; + TEXT[ greek ] = "StarTestTool"; + TEXT[ dutch ] = "StarTestTool"; + TEXT[ french ] = "StarTestTool"; + TEXT[ spanish ] = "StarTestTool"; + TEXT[ italian ] = "StarTestTool"; + TEXT[ danish ] = "StarTestTool"; + TEXT[ swedish ] = "StarTestTool"; + TEXT[ polish ] = "StarTestTool"; + TEXT[ portuguese_brazilian ] = "StarTestTool"; + TEXT[ japanese ] = "StarTestTool"; + TEXT[ korean ] = "StarTestTool"; + TEXT[ chinese_simplified ] = "StarTestTool"; + TEXT[ chinese_traditional ] = "StarTestTool"; + TEXT[ arabic ] = "StarTestTool"; + TEXT[ turkish ] = "StarTestTool"; + }; + FixedText 3 { + Pos = MAP_APPFONT( 40, 45 ); + Size = MAP_APPFONT( 110, 10 ); + TEXT = "Version 1.0"; + TEXT [ english_us ] = "Version 1.0"; + CENTER = TRUE; + TEXT[ portuguese ] = "Versão 1.0"; + TEXT[ russian ] = "Version 1.0"; + TEXT[ greek ] = "Version 1.0"; + TEXT[ dutch ] = "Versie 1.0"; + TEXT[ french ] = "Version 1.0"; + TEXT[ spanish ] = "Versión 1.0"; + TEXT[ italian ] = "Version 1.0"; + TEXT[ danish ] = "Version 1.0"; + TEXT[ swedish ] = "Version 1.0"; + TEXT[ polish ] = "Version 1.0"; + TEXT[ portuguese_brazilian ] = "Version 1.0"; + TEXT[ japanese ] = "Version 1.0"; + TEXT[ korean ] = "¹öÁ¯ 1.0"; + TEXT[ chinese_simplified ] = "Version 1.0"; + TEXT[ chinese_traditional ] = "Version 1.0"; + TEXT[ arabic ] = "Version 1.0"; + TEXT[ turkish ] = "Sürüm 1.0"; + }; + FixedText RID_VERSIONSTRING { + Pos = MAP_APPFONT( 40, 55 ); + Size = MAP_APPFONT( 110, 10 ); + Text = UPDVER; + CENTER = TRUE; + }; + FixedText 4 { + Pos = MAP_APPFONT( 40, 70 ); + Size = MAP_APPFONT( 110, 10 ); + TEXT = "®1995-1998 Sun Microsystems, Inc."; + TEXT [ english_us ] = "®1995-1998 Sun Microsystems, Inc."; + CENTER = TRUE; + TEXT[ portuguese ] = "®1995-1998 Sun Microsystems, Inc."; + TEXT[ russian ] = "®1995-1998 Sun Microsystems, Inc."; + TEXT[ greek ] = "®1995-1998 Sun Microsystems, Inc."; + TEXT[ dutch ] = "®1995-1998 Sun Microsystems, Inc."; + TEXT[ french ] = "®1995-1998 Sun Microsystems, Inc."; + TEXT[ spanish ] = "®1995-1998 Sun Microsystems, Inc."; + TEXT[ italian ] = "®1995-1998 Sun Microsystems, Inc."; + TEXT[ danish ] = "®1995-1998 Sun Microsystems, Inc."; + TEXT[ swedish ] = "®1995-1998 Sun Microsystems, Inc."; + TEXT[ polish ] = "®1995-1998 Sun Microsystems, Inc."; + TEXT[ portuguese_brazilian ] = "®1995-1998 Sun Microsystems, Inc."; + TEXT[ japanese ] = "®1995-1998 Sun Microsystems, Inc."; + TEXT[ korean ] = "1995-1998 Sun Microsystems, Inc."; + TEXT[ chinese_simplified ] = "?995-1998 Sun Microsystems, Inc."; + TEXT[ chinese_traditional ] = "1995-1998 Sun Microsystems, Inc."; + TEXT[ arabic ] = "®1995-1998 Sun Microsystems, Inc."; + TEXT[ turkish ] = "®1995-1998 Sun Microsystems, Inc."; + }; +// FixedIcon RID_ICON { +// Pos = MAP_APPFONT( 20, 26 ); +// Size = MAP_APPFONT( 20, 20 ); +// FIXED = Icon { +// FILE = "basic.ico"; +// }; +// }; + OKButton RID_OK { + Pos = MAP_APPFONT( 55, 85 ); + Size = MAP_APPFONT( 40, 14 ); + DefButton = TRUE; + }; +}; + +ModalDialog IDD_FIND_DIALOG { + Pos = MAP_APPFONT( 69, 30 ); + Size = MAP_APPFONT( 185, 70 ); + SVLook = TRUE; + TEXT = "StarBasic: Text suchen"; + TEXT [ english_us ] = "StarBasic: Find Text"; + MOVEABLE = TRUE; + // CLOSEABLE = TRUE; // Hat cancelbutton + + FixedText RID_FIXEDTEXT1 { + Pos = MAP_APPFONT( 5, 10 ); + Size = MAP_APPFONT( 30, 10 ); + TEXT = "~Text"; + TEXT [ english_us ] = "~Text"; + TEXT[ portuguese ] = "~Texto"; + TEXT[ russian ] = "~Text"; + TEXT[ greek ] = "~Text"; + TEXT[ dutch ] = "~Tekst"; + TEXT[ french ] = "~Texte"; + TEXT[ spanish ] = "Te~xto"; + TEXT[ italian ] = "~Text"; + TEXT[ danish ] = "~Text"; + TEXT[ swedish ] = "~Text"; + TEXT[ polish ] = "~Text"; + TEXT[ portuguese_brazilian ] = "~Text"; + TEXT[ japanese ] = "•¶Žš—ñ"; + TEXT[ korean ] = "ÅØ½ºÆ®(~T)"; + TEXT[ chinese_simplified ] = "~Text"; + TEXT[ chinese_traditional ] = "~Text"; + TEXT[ arabic ] = "~Text"; + TEXT[ turkish ] = "~Metin"; + }; + Edit RID_FIND { + BORDER = TRUE; + Pos = MAP_APPFONT( 40, 8 ); + Size = MAP_APPFONT( 135, 12 ); + TABSTOP = TRUE; + }; + OKButton RID_OK { + Pos = MAP_APPFONT( 30, 30 ); + Size = MAP_APPFONT( 50, 14 ); + TEXT = "~Suchen"; + TEXT [ english_us ] = "~Find"; + TABSTOP = TRUE; + DefButton = TRUE; + TEXT[ portuguese ] = "~Procurar"; + TEXT[ russian ] = "~Find"; + TEXT[ greek ] = "~Find"; + TEXT[ dutch ] = "~Zoeken"; + TEXT[ french ] = "~Rechercher"; + TEXT[ spanish ] = "~Buscar"; + TEXT[ italian ] = "~Find"; + TEXT[ danish ] = "~Find"; + TEXT[ swedish ] = "~Find"; + TEXT[ polish ] = "~Find"; + TEXT[ portuguese_brazilian ] = "~Suchen"; + TEXT[ japanese ] = "ŒŸõ"; + TEXT[ korean ] = "ã±â(~F)"; + TEXT[ chinese_simplified ] = "~Suchen"; + TEXT[ chinese_traditional ] = "~Find"; + TEXT[ arabic ] = "~Find"; + TEXT[ turkish ] = "~Ara"; + }; + CancelButton RID_CANCEL { + Pos = MAP_APPFONT( 105, 30 ); + Size = MAP_APPFONT( 50, 14 ); + TEXT = "~Abbruch"; + TEXT [ english_us ] = "~Cancel"; + TABSTOP = TRUE; + TEXT[ portuguese ] = "~Cancelar"; + TEXT[ russian ] = "~Cancel"; + TEXT[ greek ] = "~Cancel"; + TEXT[ dutch ] = "~Annuleren"; + TEXT[ french ] = "~Annuler"; + TEXT[ spanish ] = "~Cancelar"; + TEXT[ italian ] = "~Cancel"; + TEXT[ danish ] = "~Cancel"; + TEXT[ swedish ] = "~Cancel"; + TEXT[ polish ] = "~Cancel"; + TEXT[ portuguese_brazilian ] = "~Abbruch"; + TEXT[ japanese ] = "·¬Ý¾Ù"; + TEXT[ korean ] = "Ãë¼Ò(~C)"; + TEXT[ chinese_simplified ] = "~Abbruch"; + TEXT[ chinese_traditional ] = "~Cancel"; + TEXT[ arabic ] = "~Cancel"; + TEXT[ turkish ] = "~Ýptal"; + }; + TEXT[ portuguese ] = "StarOffice Basic: Procurar texto"; + TEXT[ russian ] = "StarBasic: Find Text"; + TEXT[ greek ] = "StarBasic: Find Text"; + TEXT[ dutch ] = "StarOffice Basic: tekst zoeken"; + TEXT[ french ] = "StarBasic: Recherche de texte"; + TEXT[ spanish ] = "StarBasic: Buscar texto"; + TEXT[ italian ] = "StarOffice Basic: Find Text"; + TEXT[ danish ] = "StarBasic: Find Text"; + TEXT[ swedish ] = "StarOffice Basic: Find Text"; + TEXT[ polish ] = "StarBasic: Find Text"; + TEXT[ portuguese_brazilian ] = "StarBasic: Text suchen"; + TEXT[ japanese ] = "StarBasic: •¶Žš—ñ‚ÌŒŸõ"; + TEXT[ korean ] = "StarBasic: ÅØ½ºÆ® ã±â"; + TEXT[ chinese_simplified ] = "StarBasic: Text suchen"; + TEXT[ chinese_traditional ] = "StarOffice Basic¡GFind Text"; + TEXT[ arabic ] = "StarBasic: Find Text"; + TEXT[ turkish ] = "StarBasic: Metni ara"; +}; + +ModalDialog IDD_REPLACE_DIALOG { + Pos = MAP_APPFONT( 69, 30 ); + Size = MAP_APPFONT( 185, 88 ); + SVLook = TRUE; + TEXT = "StarBasic: Text ersetzen"; + TEXT [ english_us ] = "StarBasic: Replace Text"; + MOVEABLE = TRUE; + // CLOSEABLE = TRUE; // Hat cancelbutton + FixedText RID_FIXEDTEXT1 { + Pos = MAP_APPFONT( 5, 10 ); + Size = MAP_APPFONT( 55, 10 ); + TEXT = "~Alter Text"; + TEXT [ english_us ] = "~Previous text"; + TEXT[ portuguese ] = "~Antigo texto"; + TEXT[ russian ] = "~Previous text"; + TEXT[ greek ] = "~Previous text"; + TEXT[ dutch ] = "~Oude tekst"; + TEXT[ french ] = "~Ancien texte"; + TEXT[ spanish ] = "~Antiguo texto"; + TEXT[ italian ] = "~Previous text"; + TEXT[ danish ] = "~Previous text"; + TEXT[ swedish ] = "~Previous text"; + TEXT[ polish ] = "~Previous text "; + TEXT[ portuguese_brazilian ] = "~Alter Text"; + TEXT[ japanese ] = "‹Œ•¶Žš—ñ"; + TEXT[ korean ] = "ÀÌÀü ÅØ½ºÆ®(~P)"; + TEXT[ chinese_simplified ] = "~Alter Text"; + TEXT[ chinese_traditional ] = "~Previous text"; + TEXT[ arabic ] = "~Previous text"; + TEXT[ turkish ] = "~Eski metin"; + }; + FixedText RID_FIXEDTEXT2 { + Pos = MAP_APPFONT( 5, 30 ); + Size = MAP_APPFONT( 55, 10 ); + TEXT = "~Neuer Text"; + TEXT [ english_us ] = "~New text"; + TEXT[ portuguese ] = "~Texto novo"; + TEXT[ russian ] = "~New text"; + TEXT[ greek ] = "~New text"; + TEXT[ dutch ] = "~Nieuwe tekst"; + TEXT[ french ] = "~Nouveau texte"; + TEXT[ spanish ] = "~Nuevo texto"; + TEXT[ italian ] = "~New text"; + TEXT[ danish ] = "~New text"; + TEXT[ swedish ] = "~New text"; + TEXT[ polish ] = "~New text "; + TEXT[ portuguese_brazilian ] = "~Neuer Text"; + TEXT[ japanese ] = "V•¶Žš—ñ"; + TEXT[ korean ] = "»õ ÅØ½ºÆ®(~N)"; + TEXT[ chinese_simplified ] = "~Neuer Text"; + TEXT[ chinese_traditional ] = "~New text"; + TEXT[ arabic ] = "~New text"; + TEXT[ turkish ] = "~Yeni metin"; + }; + Edit RID_FIND { + BORDER = TRUE; + Pos = MAP_APPFONT( 65, 8 ); + Size = MAP_APPFONT( 110, 12 ); + TABSTOP = TRUE; + }; + Edit RID_REPLACE { + BORDER = TRUE; + Pos = MAP_APPFONT( 65, 28 ); + Size = MAP_APPFONT( 110, 12 ); + TABSTOP = TRUE; + }; + OKButton RID_OK { + Pos = MAP_APPFONT( 30, 50 ); + Size = MAP_APPFONT( 50, 14 ); + TEXT = "~Ersetzen"; + TEXT [ english_us ] = "~Replace"; + TABSTOP = TRUE; + DefButton = TRUE; + TEXT[ portuguese ] = "~Substituir"; + TEXT[ russian ] = "~Replace"; + TEXT[ greek ] = "~Replace"; + TEXT[ dutch ] = "~Vervangen"; + TEXT[ french ] = "~Remplacer"; + TEXT[ spanish ] = "~Sustituir"; + TEXT[ italian ] = "~Replace"; + TEXT[ danish ] = "~Replace"; + TEXT[ swedish ] = "~Replace"; + TEXT[ polish ] = "~Replace"; + TEXT[ portuguese_brazilian ] = "~Ersetzen"; + TEXT[ japanese ] = "’uŠ·"; + TEXT[ korean ] = "¹Ù²Ù±â(~R)"; + TEXT[ chinese_simplified ] = "~Ersetzen"; + TEXT[ chinese_traditional ] = "~Replace"; + TEXT[ arabic ] = "~Replace"; + TEXT[ turkish ] = "~Deðiþtir"; + }; + CancelButton RID_CANCEL { + Pos = MAP_APPFONT( 105, 50 ); + Size = MAP_APPFONT( 50, 14 ); + TEXT = "~Abbruch"; + TEXT [ english_us ] = "~Cancel"; + TABSTOP = TRUE; + TEXT[ portuguese ] = "~Cancelar"; + TEXT[ russian ] = "~Cancel"; + TEXT[ greek ] = "~Cancel"; + TEXT[ dutch ] = "~Annuleren"; + TEXT[ french ] = "~Annuler"; + TEXT[ spanish ] = "~Cancelar"; + TEXT[ italian ] = "~Cancel"; + TEXT[ danish ] = "~Cancel"; + TEXT[ swedish ] = "~Cancel"; + TEXT[ polish ] = "~Cancel "; + TEXT[ portuguese_brazilian ] = "~Abbruch"; + TEXT[ japanese ] = "·¬Ý¾Ù"; + TEXT[ korean ] = "Ãë¼Ò(~C)"; + TEXT[ chinese_simplified ] = "~Abbruch"; + TEXT[ chinese_traditional ] = "~Cancel"; + TEXT[ arabic ] = "~Cancel"; + TEXT[ turkish ] = "Ýptal"; + }; + TEXT[ portuguese ] = "StarOffice Basic: Substituir texto"; + TEXT[ russian ] = "StarBasic: Replace Text"; + TEXT[ greek ] = "StarBasic: Replace Text"; + TEXT[ dutch ] = "StarOffice Basic: tekst vervangen"; + TEXT[ french ] = "StarBasic : Remplacement de texte"; + TEXT[ spanish ] = "StarBasic: Sustituir texto"; + TEXT[ italian ] = "StarOffice Basic: Replace Text"; + TEXT[ danish ] = "StarBasic: Replace Text"; + TEXT[ swedish ] = "StarOffice Basic: Replace Text"; + TEXT[ polish ] = "StarBasic: Replace Text "; + TEXT[ portuguese_brazilian ] = "StarBasic: Text ersetzen"; + TEXT[ japanese ] = "StarBasic: •¶Žš—ñ‚Ì’uŠ·"; + TEXT[ korean ] = "StarBasic: ÅØ½ºÆ® ¹Ù²Ù±â"; + TEXT[ chinese_simplified ] = "StarBasic: Text ersetzen"; + TEXT[ chinese_traditional ] = "StarOffcie Basic¡GReplace Text"; + TEXT[ arabic ] = "StarBasic: Replace Text"; + TEXT[ turkish ] = "StarBasic: Metni deðiþtir"; +}; + +InfoBox IDS_NOPRINTERERROR { + MESSAGE = "Drucken steht nicht zur Verfügung!"; + MESSAGE [ english_us ] = "The print function is not available!"; + MESSAGE[ portuguese ] = "A função de impressão não está disponível!"; + MESSAGE[ russian ] = "The print function is not available!"; + MESSAGE[ greek ] = "The print function is not available!"; + MESSAGE[ dutch ] = "De functie Afdrukken is niet beschikbaar!"; + MESSAGE[ french ] = "La fonction d'impresssion n'est pas disponible !"; + MESSAGE[ spanish ] = "¡No disponible la función para imprimir!"; + MESSAGE[ italian ] = "The print function is not available!"; + MESSAGE[ danish ] = "The print function is not available!"; + MESSAGE[ swedish ] = "The print function is not available!"; + MESSAGE[ polish ] = "The print function is not available! "; + MESSAGE[ portuguese_brazilian ] = "Drucken steht nicht zur Verfügung!"; + MESSAGE[ japanese ] = "ÌߨÝÀ‚ª‚ ‚è‚Ü‚¹‚ñ!"; + MESSAGE[ korean ] = "ÇÁ¸°ÅÍ ±â´ÉÀÌ ¾ÈµÊ!"; + MESSAGE[ chinese_simplified ] = "Drucken steht nicht zur Verfügung!"; + MESSAGE[ chinese_traditional ] = "The print function is not available!"; + MESSAGE[ arabic ] = "The print function is not available"; + MESSAGE[ turkish ] = "Yazdýrma iþlevi kullanýlamaz!"; +}; +ErrorBox IDS_CANTLOAD { + TITLE = "StarBasic-Fehler"; + TITLE [ english_us ] = "StarBasic Error"; + MESSAGE = "Library kann nicht geladen werden!"; + MESSAGE [ english_us ] = "Library cannot be loaded!"; + MESSAGE[ portuguese ] = "Impossível carregar a biblioteca!"; + MESSAGE[ russian ] = "Library cannot be loaded!"; + MESSAGE[ greek ] = "Library cannot be loaded!"; + MESSAGE[ dutch ] = "Library kan niet worden geladen!"; + MESSAGE[ french ] = "Impossible de charger la bibliothèque !"; + MESSAGE[ spanish ] = "¡No se puede cargar la biblioteca!"; + MESSAGE[ italian ] = "Library cannot be loaded!"; + MESSAGE[ danish ] = "Library cannot be loaded!"; + MESSAGE[ swedish ] = "Library cannot be loaded!"; + MESSAGE[ polish ] = "Library cannot be loaded! "; + MESSAGE[ portuguese_brazilian ] = "Library kann nicht geladen werden!"; + MESSAGE[ japanese ] = "ײÌÞר‚͓ǂݞ‚݂ł«‚Ü‚¹‚ñ!"; + MESSAGE[ korean ] = "¶óÀ̺귯¸®°¡ ·ÎµåµÉ ¼ö ¾ø½À´Ï´Ù!"; + MESSAGE[ chinese_simplified ] = "Library kann nicht geladen werden!"; + MESSAGE[ chinese_traditional ] = "Library cannot be loaded!"; + MESSAGE[ arabic ] = "Library cannot be loaded!"; + Title[ portuguese ] = "StarBasic-Fehler"; + Title[ russian ] = "StarBasic-Fehler"; + Title[ greek ] = "StarBasic Error"; + Title[ dutch ] = "StarBasic-Fehler"; + Title[ french ] = "StarBasic-Fehler"; + Title[ spanish ] = "Error de StarBasic"; + Title[ italian ] = "StarBasic-Fehler"; + Title[ danish ] = "StarBasic Error"; + Title[ swedish ] = "StarBasic Error"; + Title[ polish ] = "B³¹d StarBasic"; + Title[ portuguese_brazilian ] = "StarBasic-Fehler"; + Title[ japanese ] = "StarBasic-Fehler"; + Title[ korean ] = "StarBasic-Fehler"; + Title[ chinese_simplified ] = "StarBasic-Fehler"; + Title[ chinese_traditional ] = "StarBasic-Fehler"; + Title[ arabic ] = "StarBasic-Fehler"; + MESSAGE[ turkish ] = "Kitaplýk yüklenemiyor!"; +}; +ErrorBox IDS_CANTSAVE { + TITLE = "StarBasic-Fehler"; + TITLE [ english_us ] = "StarBasic Error"; + MESSAGE = "Library kann nicht gespeichert werden!"; + MESSAGE [ english_us ] = "Library cannot be saved!"; + MESSAGE[ portuguese ] = "Impossível guardar a biblioteca!"; + MESSAGE[ russian ] = "Library cannot be saved!"; + MESSAGE[ greek ] = "Library cannot be saved!"; + MESSAGE[ dutch ] = "Library kan niet worden opgeslagen!"; + MESSAGE[ french ] = "Impossible d'enregistrer la bibliothèque !"; + MESSAGE[ spanish ] = "¡No se puede guardar la biblioteca!"; + MESSAGE[ italian ] = "Library cannot be saved!"; + MESSAGE[ danish ] = "Library cannot be saved!"; + MESSAGE[ swedish ] = "Library cannot be saved!"; + MESSAGE[ polish ] = "Library cannot be saved! "; + MESSAGE[ portuguese_brazilian ] = "Library kann nicht gespeichert werden!"; + MESSAGE[ japanese ] = "ײÌÞר‚͕ۑ¶‚Å‚«‚Ü‚¹‚ñ!"; + MESSAGE[ korean ] = "¶óÀ̺귯¸®°¡ ÀúÀåµÇÁö¾Ê¾ÒÀ½!"; + MESSAGE[ chinese_simplified ] = "Library kann nicht gespeichert werden!"; + MESSAGE[ chinese_traditional ] = "Library cannot be saved!"; + MESSAGE[ arabic ] = "Library cannot be saved!"; + Title[ portuguese ] = "StarBasic-Fehler"; + Title[ russian ] = "StarBasic-Fehler"; + Title[ greek ] = "StarBasic Error"; + Title[ dutch ] = "StarBasic-Fehler"; + Title[ french ] = "StarBasic-Fehler"; + Title[ spanish ] = "Error de StarBasic"; + Title[ italian ] = "StarBasic-Fehler"; + Title[ danish ] = "StarBasic Error"; + Title[ swedish ] = "StarBasic Error"; + Title[ polish ] = "B³¹d StarBasic"; + Title[ portuguese_brazilian ] = "StarBasic-Fehler"; + Title[ japanese ] = "StarBasic-Fehler"; + Title[ korean ] = "StarBasic-Fehler"; + Title[ chinese_simplified ] = "StarBasic-Fehler"; + Title[ chinese_traditional ] = "StarBasic-Fehler"; + Title[ arabic ] = "StarBasic-Fehler"; + MESSAGE[ turkish ] = "Kitaplýk kaydedilemiyor!"; +}; +ErrorBox IDS_NOMAINPGM { + TITLE = "StarBasic-Fehler"; + TITLE [ english_us ] = "StarBasic Error"; + MESSAGE = "Dieses Fenster enthält kein Hauptprogramm!"; + MESSAGE [ english_us ] = "This window does not contain a main program!"; + MESSAGE[ portuguese ] = "Esta janela não contém nenhum programa principal!"; + MESSAGE[ russian ] = "This window does not contain a main program!"; + MESSAGE[ greek ] = "This window does not contain a main program!"; + MESSAGE[ dutch ] = "Dit venster bevat geen hoofdprogramma!"; + MESSAGE[ french ] = "Cette fenêtre ne contient aucun programme principal !"; + MESSAGE[ spanish ] = "¡Esta ventana no contiene ningún programa principal!"; + MESSAGE[ italian ] = "The window does not contain a main program!"; + MESSAGE[ danish ] = "This window does not contain a main program!"; + MESSAGE[ swedish ] = "This window does not contain a main program!"; + MESSAGE[ polish ] = "This window does not contain a main program! "; + MESSAGE[ portuguese_brazilian ] = "Dieses Fenster enthält kein Hauptprogramm!"; + MESSAGE[ japanese ] = "‚±‚̳¨ÝÄÞ³‚É‚ÍÒ²ÝÌßÛ¸Þ×т͂ ‚è‚Ü‚¹‚ñ!"; + MESSAGE[ korean ] = "ÀÌ À©µµ¿ì´Â ¸ÞÀÎÇÁ·Î±×·¥À» Æ÷ÇÔÇϰí ÀÖÁö ¾Ê½À´Ï´Ù !"; + MESSAGE[ chinese_simplified ] = "Dieses Fenster enthält kein Hauptprogramm!"; + MESSAGE[ chinese_traditional ] = "This window does not contain a main program!"; + MESSAGE[ arabic ] = "This window does not contain a main program!"; + Title[ portuguese ] = "StarBasic-Fehler"; + Title[ russian ] = "StarBasic-Fehler"; + Title[ greek ] = "StarBasic Error"; + Title[ dutch ] = "StarBasic-Fehler"; + Title[ french ] = "StarBasic-Fehler"; + Title[ spanish ] = "Error de StarBasic"; + Title[ italian ] = "StarBasic-Fehler"; + Title[ danish ] = "StarBasic Error"; + Title[ swedish ] = "StarBasic Error"; + Title[ polish ] = "B³¹d StarBasic"; + Title[ portuguese_brazilian ] = "StarBasic-Fehler"; + Title[ japanese ] = "StarBasic-Fehler"; + Title[ korean ] = "StarBasic-Fehler"; + Title[ chinese_simplified ] = "StarBasic-Fehler"; + Title[ chinese_traditional ] = "StarBasic-Fehler"; + Title[ arabic ] = "StarBasic-Fehler"; + MESSAGE[ turkish ] = "Bu pencere ana program içermiyor!"; +}; +ErrorBox IDS_READERROR { + TITLE = "StarBasic-Fehler"; + TITLE [ english_us ] = "StarBasic Error"; + MESSAGE = "Datei kann nicht eingelesen werden!"; + MESSAGE [ english_us ] = "File cannot be read!"; + MESSAGE[ portuguese ] = "Impossível ler ficheiro!"; + MESSAGE[ russian ] = "File cannot be read!"; + MESSAGE[ greek ] = "File cannot be read!"; + MESSAGE[ dutch ] = "Bestand kan niet worden gelezen!"; + MESSAGE[ french ] = "Impossible de lire le fichier !"; + MESSAGE[ spanish ] = "¡No se puede leer el archivo!"; + MESSAGE[ italian ] = "File cannot be read!"; + MESSAGE[ danish ] = "File cannot be read!"; + MESSAGE[ swedish ] = "File cannot be read!"; + MESSAGE[ polish ] = "File cannot be read! "; + MESSAGE[ portuguese_brazilian ] = "Datei kann nicht eingelesen werden!"; + MESSAGE[ japanese ] = "̧²Ù‚͓ǂݎæ‚ê‚Ü‚¹‚ñ!"; + MESSAGE[ korean ] = "ÆÄÀÏÀ» ÀÐÀ»¼ö ¾ø½À´Ï´Ù!"; + MESSAGE[ chinese_simplified ] = "Datei kann nicht eingelesen werden!"; + MESSAGE[ chinese_traditional ] = "File cannot be read!"; + MESSAGE[ arabic ] = "File cannot be read!"; + Title[ portuguese ] = "StarBasic-Fehler"; + Title[ russian ] = "StarBasic-Fehler"; + Title[ greek ] = "StarBasic Error"; + Title[ dutch ] = "StarBasic-Fehler"; + Title[ french ] = "StarBasic-Fehler"; + Title[ spanish ] = "Error de StarBasic"; + Title[ italian ] = "StarBasic-Fehler"; + Title[ danish ] = "StarBasic Error"; + Title[ swedish ] = "StarBasic Error"; + Title[ polish ] = "B³¹d StarBasic"; + Title[ portuguese_brazilian ] = "StarBasic-Fehler"; + Title[ japanese ] = "StarBasic-Fehler"; + Title[ korean ] = "StarBasic-Fehler"; + Title[ chinese_simplified ] = "StarBasic-Fehler"; + Title[ chinese_traditional ] = "StarBasic-Fehler"; + Title[ arabic ] = "StarBasic-Fehler"; + MESSAGE[ turkish ] = "Dosya okunamýyor!"; +}; +ErrorBox IDS_WRITEERROR { + TITLE = "StarBasic-Fehler"; + TITLE [ english_us ] = "StarBasic Error"; + MESSAGE = "Datei kann nicht abgespeichert werden!"; + MESSAGE [ english_us ] = "File cannot be saved!"; + MESSAGE[ portuguese ] = "Impossível guardar ficheiro!"; + MESSAGE[ russian ] = "File cannot be saved!"; + MESSAGE[ greek ] = "File cannot be saved!"; + MESSAGE[ dutch ] = "Bestand kan niet worden opgeslagen!"; + MESSAGE[ french ] = "Impossible d'enregister le fichier !"; + MESSAGE[ spanish ] = "¡No se puede guardar el archivo!"; + MESSAGE[ italian ] = "File cannt be saved!"; + MESSAGE[ danish ] = "File cannot be saved!"; + MESSAGE[ swedish ] = "File cannot be saved!"; + MESSAGE[ polish ] = "File cannot be saved! "; + MESSAGE[ portuguese_brazilian ] = "Datei kann nicht abgespeichert werden!"; + MESSAGE[ japanese ] = "̧²Ù‚͕ۑ¶‚Å‚«‚Ü‚¹‚ñ!"; + MESSAGE[ korean ] = "ÆÄÀÏÀÌ ÀúÀåµÇÁö ¾Ê¾Ò½À´Ï´Ù !"; + MESSAGE[ chinese_simplified ] = "Datei kann nicht abgespeichert werden!"; + MESSAGE[ chinese_traditional ] = "File cannot be saved!"; + MESSAGE[ arabic ] = "File cannot be saved!"; + Title[ portuguese ] = "StarBasic-Fehler"; + Title[ russian ] = "StarBasic-Fehler"; + Title[ greek ] = "StarBasic Error"; + Title[ dutch ] = "StarBasic-Fehler"; + Title[ french ] = "StarBasic-Fehler"; + Title[ spanish ] = "Error de StarBasic"; + Title[ italian ] = "StarBasic-Fehler"; + Title[ danish ] = "StarBasic Error"; + Title[ swedish ] = "StarBasic Error"; + Title[ polish ] = "B³¹d StarBasic"; + Title[ portuguese_brazilian ] = "StarBasic-Fehler"; + Title[ japanese ] = "StarBasic-Fehler"; + Title[ korean ] = "StarBasic-Fehler"; + Title[ chinese_simplified ] = "StarBasic-Fehler"; + Title[ chinese_traditional ] = "StarBasic-Fehler"; + Title[ arabic ] = "StarBasic-Fehler"; + MESSAGE[ turkish ] = "Dosya kaydedilemiyor!"; +}; +ErrorBox IDS_PATTERNNOTFOUND { + TITLE = "StarBasic-Fehler"; + TITLE [ english_us ] = "StarBasic Error"; + MESSAGE = "Suchbegriff nicht gefunden!"; + MESSAGE [ english_us ] = "Search key not found!"; + MESSAGE[ portuguese ] = "Impossível encontrar expressão procurada!"; + MESSAGE[ russian ] = "Search key not found!"; + MESSAGE[ greek ] = "Search key not found!"; + MESSAGE[ dutch ] = "Zoekbegrip niet gevonden!"; + MESSAGE[ french ] = "Élément recherché introuvable !"; + MESSAGE[ spanish ] = "¡No se encontró el término buscado!"; + MESSAGE[ italian ] = "Search key not found!"; + MESSAGE[ danish ] = "Search key not found!"; + MESSAGE[ swedish ] = "Search term not found!"; + MESSAGE[ polish ] = "Search key not found!"; + MESSAGE[ portuguese_brazilian ] = "Suchbegriff nicht gefunden!"; + MESSAGE[ japanese ] = "ŒŸõ·°‚ÍŒ©‚‚©‚è‚Ü‚¹‚ñ!"; + MESSAGE[ korean ] = "°Ë»ö¾î¸¦ ãÁö ¸øÇßÀ½!"; + MESSAGE[ chinese_simplified ] = "Suchbegriff nicht gefunden!"; + MESSAGE[ chinese_traditional ] = "Search key not found!"; + MESSAGE[ arabic ] = "Search term not found!"; + Title[ portuguese ] = "StarBasic-Fehler"; + Title[ russian ] = "StarBasic-Fehler"; + Title[ greek ] = "StarBasic Error"; + Title[ dutch ] = "StarBasic-Fehler"; + Title[ french ] = "StarBasic-Fehler"; + Title[ spanish ] = "Error de StarBasic"; + Title[ italian ] = "StarBasic-Fehler"; + Title[ danish ] = "StarBasic Error"; + Title[ swedish ] = "StarBasic Error"; + Title[ polish ] = "B³¹d StarBasic"; + Title[ portuguese_brazilian ] = "StarBasic-Fehler"; + Title[ japanese ] = "StarBasic-Fehler"; + Title[ korean ] = "StarBasic-Fehler"; + Title[ chinese_simplified ] = "StarBasic-Fehler"; + Title[ chinese_traditional ] = "StarBasic-Fehler"; + Title[ arabic ] = "StarBasic-Fehler"; + MESSAGE[ turkish ] = "Arama terimi bulunamadý!"; +}; +ErrorBox IDS_INVALID_VALUE { + TITLE = "StarBasic-Fehler"; + TITLE [ english_us ] = "StarBasic Error"; + MESSAGE = "Der Wert ist ungültig und kann daher nicht gesetzt werden."; + MESSAGE [ english_us ] = "The value is invalid and cannot be set."; + MESSAGE[ portuguese ] = "O valor não é válido e não pode ser aplicado."; + MESSAGE[ russian ] = "Ýòî çíà÷åíèå íå äåéñòâèòåëüíî è ïîýòîìó íå ìîæåò áûòü èñïîëüçîâàíî."; + MESSAGE[ greek ] = "The value is invalid and cannot be set."; + MESSAGE[ dutch ] = "De waarde is ongeldig en kan daarom niet worden gebruikt."; + MESSAGE[ french ] = "Valeur incorrecte, impossible de la placer."; + MESSAGE[ spanish ] = "Valor incorrecto; no se puede aplicar."; + MESSAGE[ italian ] = "The value is invalid and cannot be set."; + MESSAGE[ danish ] = "The value is invalid and cannot be set."; + MESSAGE[ swedish ] = "The value is invalid and cannot be set."; + MESSAGE[ polish ] = "Wartoœæ jest nieprawdi³owa i nie mo¿na jeje dlatego osadziæ."; + MESSAGE[ portuguese_brazilian ] = "Der Wert ist ungültig und kann daher nicht gesetzt werden."; + MESSAGE[ japanese ] = "’l‚ª–³Œø‚Ȃ̂ÅÝ’è‚Å‚«‚Ü‚¹‚ñB"; + MESSAGE[ korean ] = "À¯È¿ÇÏÁö ¾ÊÀº °ªÀ̹ǷΠ¼³Á¤µÉ ¼ö ¾ø½À´Ï´Ù ."; + MESSAGE[ chinese_simplified ] = "The value is invalid and cannot be set."; + MESSAGE[ chinese_traditional ] = "The value is invalid and cannot be set."; + MESSAGE[ arabic ] = "The value is invalid and cannot be set."; + Title[ portuguese ] = "StarBasic Error"; + Title[ russian ] = "StarBasic Error"; + Title[ greek ] = "StarBasic Error"; + Title[ dutch ] = "StarBasic Error"; + Title[ french ] = "StarBasic Error"; + Title[ spanish ] = "StarBasic Error"; + Title[ italian ] = "StarBasic Error"; + Title[ danish ] = "StarBasic Error"; + Title[ swedish ] = "StarBasic Error"; + Title[ polish ] = "B³¹d StarBasic"; + Title[ portuguese_brazilian ] = "StarBasic Error"; + Title[ japanese ] = "StarBasic Error"; + Title[ korean ] = "StarBasic Error"; + Title[ chinese_simplified ] = "StarBasic Error"; + Title[ chinese_traditional ] = "StarBasic Error"; + Title[ arabic ] = "StarBasic Error"; + MESSAGE[ turkish ] = "Bu deðer geçersiz olduðu için belirlenemez."; +}; + +QueryBox IDS_ASKSAVEERROR { + TITLE = "StarBasic"; + TITLE [ english_us ] = "StarBasic"; + MESSAGE = "Fehler beim Speichern der Dateien! Trotzdem ausführen?"; + MESSAGE [ english_us ] = "Error saving files! Run anyway?"; + BUTTONS = WB_YES_NO; + MESSAGE[ portuguese ] = "Ocorreu um erro ao guardar os ficheiros!Mesmo assim, executar?"; + MESSAGE[ russian ] = "Error saving files! Run anyway?"; + MESSAGE[ greek ] = "Error saving files! Run anyway?"; + MESSAGE[ dutch ] = "Fout bij opslaan van bestanden! Toch uitvoeren?"; + MESSAGE[ french ] = "Une erreur s'est produite lors de l'enregistrement des fichiers ! Souhaitez-vous quand même poursuivre l'exécution ?"; + MESSAGE[ spanish ] = "¡Error al guardar los archivos! ¿Ejecutar de todas formas?"; + MESSAGE[ italian ] = "Error saving files! Run anyway?"; + MESSAGE[ danish ] = "Error saving files! Run anyway?"; + MESSAGE[ swedish ] = "Error saving files! Run anyway?"; + MESSAGE[ polish ] = "Error saving files! Run anyway? "; + MESSAGE[ portuguese_brazilian ] = "Fehler beim Speichern der Dateien! Trotzdem ausführen?"; + MESSAGE[ japanese ] = "̧²Ù‚̕ۑ¶‚ÌÛ‚Ì´×°! ‚»‚ê‚Å‚àŽÀs‚µ‚Ü‚·‚©?"; + MESSAGE[ korean ] = "ÆÄÀÏ ÀúÀå ½Ã ¿À·ù°¡ ¹ß»ýÇß½À´Ï´Ù! °è¼Ó ½ÇÇàÇϽðڽÀ´Ï±î?"; + MESSAGE[ chinese_simplified ] = "Fehler beim Speichern der Dateien! Trotzdem ausführen?"; + MESSAGE[ chinese_traditional ] = "Error saving files! Run anyway?"; + MESSAGE[ arabic ] = "Error saving files! Run anyway?"; + Title[ portuguese ] = "StarBasic"; + Title[ russian ] = "StarBasic"; + Title[ greek ] = "StarBasic"; + Title[ dutch ] = "StarBasic"; + Title[ french ] = "StarBasic"; + Title[ spanish ] = "StarBasic"; + Title[ italian ] = "StarBasic"; + Title[ danish ] = "StarBasic"; + Title[ swedish ] = "StarBasic"; + Title[ polish ] = "StarBasic"; + Title[ portuguese_brazilian ] = "StarBasic"; + Title[ japanese ] = "StarBasic"; + Title[ korean ] = "StarBasic"; + Title[ chinese_simplified ] = "StarBasic"; + Title[ chinese_traditional ] = "StarBasic"; + Title[ arabic ] = "StarBasic"; + MESSAGE[ turkish ] = "Dosya kaydý sýrasýnda bir hata ortaya çýktý! Ýþlem yine de yürütülsün mü?"; +}; +QueryBox IDS_ASK_DIRTY_SAVE { + TITLE = "StarBasic"; + TITLE [ english_us ] = "StarBasic"; + MESSAGE = "Datei ist geändert worden. Abspeichern?"; + MESSAGE [ english_us ] = "File has been changed. Save?"; + BUTTONS = WB_YES_NO_CANCEL; + MESSAGE[ portuguese ] = "O ficheiro foi modificado. Guardar?"; + MESSAGE[ russian ] = "File has been changed. Save?"; + MESSAGE[ greek ] = "File has been changed. Save?"; + MESSAGE[ dutch ] = "Bestand is gewijzigd. Opslaan?"; + MESSAGE[ french ] = "Le fichier a été modifié. Souhaitez-vous l'enregistrer ?"; + MESSAGE[ spanish ] = "El archivo ha sido modificado. ¿Guardar?"; + MESSAGE[ italian ] = "File has been changed. Save?"; + MESSAGE[ danish ] = "File has been changed. Save?"; + MESSAGE[ swedish ] = "File has been changed. Save?"; + MESSAGE[ polish ] = "File has been changed. Save? "; + MESSAGE[ portuguese_brazilian ] = "Datei ist geändert worden. Abspeichern?"; + MESSAGE[ japanese ] = "̧²Ù‚ª•ÏX‚µ‚Ä‚¢‚Ü‚·Bã‘‚«‚µ‚Ü‚·‚©?"; + MESSAGE[ korean ] = "ÆÄÀÏÀÌ ¹Ù²î¾ú½À´Ï´Ù. ÀúÀåÇϽðڽÀ´Ï±î?"; + MESSAGE[ chinese_simplified ] = "Datei ist geändert worden. Abspeichern?"; + MESSAGE[ chinese_traditional ] = "File has been changed. Save?"; + MESSAGE[ arabic ] = "File has been changed. Save?"; + Title[ portuguese ] = "StarBasic"; + Title[ russian ] = "StarBasic"; + Title[ greek ] = "StarBasic"; + Title[ dutch ] = "StarBasic"; + Title[ french ] = "StarBasic"; + Title[ spanish ] = "StarBasic"; + Title[ italian ] = "StarBasic"; + Title[ danish ] = "StarBasic"; + Title[ swedish ] = "StarBasic"; + Title[ polish ] = "StarBasic"; + Title[ portuguese_brazilian ] = "StarBasic"; + Title[ japanese ] = "StarBasic"; + Title[ korean ] = "StarBasic"; + Title[ chinese_simplified ] = "StarBasic"; + Title[ chinese_traditional ] = "StarBasic"; + Title[ arabic ] = "StarBasic"; + MESSAGE[ turkish ] = "Dosya deðiþtirildi. Deðiþiklikler kaydedilsin mi?"; +}; +QueryBox IDS_ASK_DIRTY_AND_DISKCHANGE_SAVE { + TITLE = "StarBasic"; + TITLE [ english_us ] = "StarBasic"; + MESSAGE = "Datei ist auf dem Datenträger und\nim Editor geändert worden. Abspeichern?"; + MESSAGE [ english_us ] = "File has been changed on data medium\nand in the Editor. Save?"; + BUTTONS = WB_YES_NO_CANCEL; + MESSAGE[ portuguese ] = "O ficheiro foi modificado no suporte\nde dados e no Editor. Guardar?"; + MESSAGE[ russian ] = "File has been changed on data medium\nand in the Editor. Save?"; + MESSAGE[ greek ] = "File has been changed on data medium\nand in the Editor. Save?"; + MESSAGE[ dutch ] = "Bestand op datamedium en \nin editor werd gewijzigd. Opslaan?"; + MESSAGE[ french ] = "Le fichier a été modifié sur le média\net dans l'éditeur. Enregistrer ?"; + MESSAGE[ spanish ] = "El archivo se ha modificado en el disco\ny en el editor. ¿Desea guardarlo?"; + MESSAGE[ italian ] = "File has been changed on data medium\nand in the Editor. Save?"; + MESSAGE[ danish ] = "File has been changed on data medium\nand in the Editor. Save?"; + MESSAGE[ swedish ] = "File has been changed on data medium\nand in the Editor. Save?"; + MESSAGE[ polish ] = "File has been changed on data medium\nand in the Editor. Save? "; + MESSAGE[ portuguese_brazilian ] = "Datei ist auf dem Datenträger und\nim Editor geändert worden. Abspeichern?"; + MESSAGE[ japanese ] = "̧²Ù‚ÍÃÞ¨½¸ã‚Å\n•ÒW’†‚É•ÏX‚³‚ê‚Ä‚¢‚Ü‚·Bã‘‚«‚µ‚Ü‚·‚©?"; + MESSAGE[ korean ] = "µ¥ÀÌÅÍ ¸Åü¿Í ÆíÁý±â ³»ÀÇ ÆÄÀÏÀ̺¯°æµÇ¾ú½À´Ï´Ù. \nÀúÀåÇϽðڽÀ´Ï±î ?"; + MESSAGE[ chinese_simplified ] = "Datei ist auf dem Datenträger und\nim Editor geändert worden. Abspeichern?"; + MESSAGE[ chinese_traditional ] = "File has been changed on data medium\nand in the Editor. Save?"; + MESSAGE[ arabic ] = "File has been changed on data medium\nand in the Editor. Save?"; + Title[ portuguese ] = "StarBasic"; + Title[ russian ] = "StarBasic"; + Title[ greek ] = "StarBasic"; + Title[ dutch ] = "StarBasic"; + Title[ french ] = "StarBasic"; + Title[ spanish ] = "StarBasic"; + Title[ italian ] = "StarBasic"; + Title[ danish ] = "StarBasic"; + Title[ swedish ] = "StarBasic"; + Title[ polish ] = "StarBasic"; + Title[ portuguese_brazilian ] = "StarBasic"; + Title[ japanese ] = "StarBasic"; + Title[ korean ] = "StarBasic"; + Title[ chinese_simplified ] = "StarBasic"; + Title[ chinese_traditional ] = "StarBasic"; + Title[ arabic ] = "StarBasic"; + MESSAGE[ turkish ] = "Dosya, veri kayýt ortamýnda\nve editörde deðiþtirildi. Kaydedilsin mi?"; +}; +QueryBox IDS_ASK_DISKCHANGE_SAVE { + TITLE = "StarBasic"; + TITLE [ english_us ] = "StarBasic"; + MESSAGE = "Datei ist auf dem Datenträger geändert worden.\nÜberschreiben?"; + MESSAGE [ english_us ] = "File has been changed on data medium.\nOverwrite?"; + BUTTONS = WB_YES_NO_CANCEL; + MESSAGE[ portuguese ] = "O ficheiro foi modificado no suporte de dados.\nSobregravar?"; + MESSAGE[ russian ] = "File has been changed on data medium.\nOverwrite?"; + MESSAGE[ greek ] = "File has been changed on data medium.\nOverwrite?"; + MESSAGE[ dutch ] = "Bestand op het datamedium werd gewijzigd.\nOverschrijven?"; + MESSAGE[ french ] = "Le fichier a été modifié sur le média.\nRemplacer ?"; + MESSAGE[ spanish ] = "El archivo en el disco se ha modificado\n¿Desea sobrescribirlo?"; + MESSAGE[ italian ] = "File has been changed on data medium.\nOverwrite?"; + MESSAGE[ danish ] = "File has been changed on data medium.\nOverwrite?"; + MESSAGE[ swedish ] = "File has been changed on data medium.\nOverwrite?"; + MESSAGE[ polish ] = "File has been changed on data medium.\nOverwrite? "; + MESSAGE[ portuguese_brazilian ] = "Datei ist auf dem Datenträger geändert worden.\nÜberschreiben?"; + MESSAGE[ japanese ] = "̧²Ù‚ÍÃÞ¨½¸ã‚Å•ÏX‚³‚ê‚Ä‚¢‚Ü‚·B\nã‘‚«‚µ‚Ü‚·‚©?"; + MESSAGE[ korean ] = "µ¥ÀÌÅÍ ¸ÅüÀÇ ÆÄÀÏÀ̺¯°æµÇ¾ú½À´Ï´Ù. \n µ¤¾î¾²½Ã°Ú½À´Ï±î?"; + MESSAGE[ chinese_simplified ] = "Datei ist auf dem Datenträger geändert worden.\nÜberschreiben?"; + MESSAGE[ chinese_traditional ] = "File has been changed on data medium.\nOverwrite?"; + MESSAGE[ arabic ] = "File has been changed on data medium.\nOverwrite?"; + Title[ portuguese ] = "StarBasic"; + Title[ russian ] = "StarBasic"; + Title[ greek ] = "StarBasic"; + Title[ dutch ] = "StarBasic"; + Title[ french ] = "StarBasic"; + Title[ spanish ] = "StarBasic"; + Title[ italian ] = "StarBasic"; + Title[ danish ] = "StarBasic"; + Title[ swedish ] = "StarBasic"; + Title[ polish ] = "StarBasic"; + Title[ portuguese_brazilian ] = "StarBasic"; + Title[ japanese ] = "StarBasic"; + Title[ korean ] = "StarBasic"; + Title[ chinese_simplified ] = "StarBasic"; + Title[ chinese_traditional ] = "StarBasic"; + Title[ arabic ] = "StarBasic"; + MESSAGE[ turkish ] = "Dosya, veri ortamýnda deðiþtirildi.\nKaydedilsin mi?"; +}; +QueryBox IDS_ASKRELOAD { + TITLE = "StarBasic"; + TITLE [ english_us ] = "StarBasic"; + MESSAGE = "Datei ist auf dem Datenträger geändert worden. Erneut Laden?"; + MESSAGE [ english_us ] = "File has been changed on data medium. Reload?"; + BUTTONS = WB_YES_NO; + MESSAGE[ portuguese ] = "O ficheiro foi modificado no suporte de dados. Recarregar?"; + MESSAGE[ russian ] = "File has been changed on data medium. Reload?"; + MESSAGE[ greek ] = "File has been changed on data medium. Reload?"; + MESSAGE[ dutch ] = "Bestand op het datamedium werd gewijzigd. Opnieuw laden?"; + MESSAGE[ french ] = "Le fichier a été modifié sur le média. Recharger ?"; + MESSAGE[ spanish ] = "Se ha modificado el archivo en el disco. ¿Desea recargarlo?"; + MESSAGE[ italian ] = "File has been changed on data medium. Reload?"; + MESSAGE[ danish ] = "File has been changed on data medium. Reload?"; + MESSAGE[ swedish ] = "File has been changed on data medium. Reload?"; + MESSAGE[ polish ] = "File has been changed on data medium. Reload? "; + MESSAGE[ portuguese_brazilian ] = "Datei ist auf dem Datenträger geändert worden. Erneut Laden?"; + MESSAGE[ japanese ] = "̧²Ù‚ÍÃÞ¨½¸ã‚Å•ÏX‚³‚ê‚Ä‚¢‚Ü‚·Bēǂݞ‚Ý‚µ‚Ü‚·‚©?"; + MESSAGE[ korean ] = "µ¥ÀÌÅÍ ¸Åü¿Í ÆíÁý±â ³»ÀÇ ÆÄÀÏÀ̺¯°æµÇ¾ú½À´Ï´Ù. ´Ù½Ã ·ÎµåÇϰڽÀ´Ï±î?"; + MESSAGE[ chinese_simplified ] = "Datei ist auf dem Datenträger geändert worden. Erneut Laden?"; + MESSAGE[ chinese_traditional ] = "File has been changed on data medium. Reload?"; + MESSAGE[ arabic ] = "File has been changed on data medium. Reload?"; + Title[ portuguese ] = "StarBasic"; + Title[ russian ] = "StarBasic"; + Title[ greek ] = "StarBasic"; + Title[ dutch ] = "StarBasic"; + Title[ french ] = "StarBasic"; + Title[ spanish ] = "StarBasic"; + Title[ italian ] = "StarBasic"; + Title[ danish ] = "StarBasic"; + Title[ swedish ] = "StarBasic"; + Title[ polish ] = "StarBasic"; + Title[ portuguese_brazilian ] = "StarBasic"; + Title[ japanese ] = "StarBasic"; + Title[ korean ] = "StarBasic"; + Title[ chinese_simplified ] = "StarBasic"; + Title[ chinese_traditional ] = "StarBasic"; + Title[ arabic ] = "StarBasic"; + MESSAGE[ turkish ] = "Dosya, veri ortamýnda deðiþtirildi. Yeniden yüklensin mi?"; +}; +QueryBox IDS_ASKDIRTYRELOAD { + TITLE = "StarBasic"; + TITLE [ english_us ] = "StarBasic"; + MESSAGE = "Datei ist auf dem Datenträger und\nim Editor geändert worden. Erneut Laden?"; + MESSAGE [ english_us ] = "File has been changed on data medium\nand in the Editor. Reload?"; + BUTTONS = WB_YES_NO; + MESSAGE[ portuguese ] = "O ficheiro foi modificado no\\suporte de dados e no Editor. Recarregar?"; + MESSAGE[ russian ] = "File has been changed on data medium\nand in the Editor. Reload?"; + MESSAGE[ greek ] = "File has been changed on data medium\nand in the Editor. Reload?"; + MESSAGE[ dutch ] = "Bestand op het datamedium en\nin de editor werd gewijzigd. Opnieuw laden?"; + MESSAGE[ french ] = "Le fichier a été modifié sur le média\net dans l'éditeur. Recharger ?"; + MESSAGE[ spanish ] = "Se ha modificado el archivo en el disco y\nen el editor. ¿Desea recargarlo?"; + MESSAGE[ italian ] = "File has been changed on data medium\nand in the Editor. Reload?"; + MESSAGE[ danish ] = "File has been changed on data medium\nand in the Editor. Reload?"; + MESSAGE[ swedish ] = "File has been changed on data medium\nand in the Editor. Reload?"; + MESSAGE[ polish ] = "File has been changed on data medium\nand in the Editor. Reload? "; + MESSAGE[ portuguese_brazilian ] = "Datei ist auf dem Datenträger und\nim Editor geändert worden. Erneut Laden?"; + MESSAGE[ japanese ] = "̧²Ù‚ÍÃÞ¨½¸ã‚Å\n•ÒW’†‚É•ÏX‚³‚ê‚Ä‚¢‚Ü‚·Bēǂݞ‚Ý‚µ‚Ü‚·‚©?"; + MESSAGE[ korean ] = "µ¥ÀÌÅÍ ¸Åü¿Í ÆíÁý±â ³»ÀÇ ÆÄÀÏÀ̺¯°æµÇ¾ú½À´Ï´Ù. \n ´Ù½Ã ·ÎµåÇϰڽÀ´Ï±î?"; + MESSAGE[ chinese_simplified ] = "Datei ist auf dem Datenträger und\nim Editor geändert worden. Erneut Laden?"; + MESSAGE[ chinese_traditional ] = "File has been changed on data medium\nand in the Editor. Reload?"; + MESSAGE[ arabic ] = "File has been changed on data medium\nand in the Editor. Reload?"; + Title[ portuguese ] = "StarBasic"; + Title[ russian ] = "StarBasic"; + Title[ greek ] = "StarBasic"; + Title[ dutch ] = "StarBasic"; + Title[ french ] = "StarBasic"; + Title[ spanish ] = "StarBasic"; + Title[ italian ] = "StarBasic"; + Title[ danish ] = "StarBasic"; + Title[ swedish ] = "StarBasic"; + Title[ polish ] = "StarBasic"; + Title[ portuguese_brazilian ] = "StarBasic"; + Title[ japanese ] = "StarBasic"; + Title[ korean ] = "StarBasic"; + Title[ chinese_simplified ] = "StarBasic"; + Title[ chinese_traditional ] = "StarBasic"; + Title[ arabic ] = "StarBasic"; + MESSAGE[ turkish ] = "Dosya, veri ortamýnda ve\neditörde deðiþtirildi deðiþtirildi. Yeniden yüklensin mi?"; +}; +QueryBox IDS_RUNNING { + TITLE = "StarBasic"; + TITLE [ english_us ] = "StarBasic"; + MESSAGE = "BASIC-Programm ist noch aktiv! Dennoch beenden?"; + MESSAGE [ english_us ] = "BASIC is still running! Exit anyway?"; + BUTTONS = WB_YES_NO; + MESSAGE[ portuguese ] = "O programa BASIC ainda está activo! Mesmo assim, sair?"; + MESSAGE[ russian ] = "BASIC is still running! Exit anyway?"; + MESSAGE[ greek ] = "BASIC is still running! Exit anyway?"; + MESSAGE[ dutch ] = "BASIC-programma is nog actief! Toch beëindigen?"; + MESSAGE[ french ] = "BASIC est encore actif ! Êtes-vous sûr de vouloir quitter le programme ?"; + MESSAGE[ spanish ] = "¡El programa BASIC está aún activo! ¿Desea cerrar de todas formas?"; + MESSAGE[ italian ] = "BASIC is still running! Exit anyway?"; + MESSAGE[ danish ] = "BASIC is still running! Exit anyway?"; + MESSAGE[ swedish ] = "BASIC is still running! Exit anyway?"; + MESSAGE[ polish ] = "BASIC is still running! Exit anyway? "; + MESSAGE[ portuguese_brazilian ] = "BASIC-Programm ist noch aktiv! Dennoch beenden?"; + MESSAGE[ japanese ] = "BASICÌßÛ¸Þ×т͂܂¾±¸Ã¨ÌނɂȂÁ‚Ä‚¢‚Ü‚·! ‚»‚̂܂ÜI—¹‚µ‚Ü‚·‚©?"; + MESSAGE[ korean ] = "BASIC ÇÁ·Î±×·¥ÀÌ ¾ÆÁ÷ ÀÛµ¿ÁßÀÔ´Ï´Ù. Á¾·áÇϽðڽÀ´Ï±î??"; + MESSAGE[ chinese_simplified ] = "BASIC-Programm ist noch aktiv! Dennoch beenden?"; + MESSAGE[ chinese_traditional ] = "BASIC is still running! Exit anyway?"; + MESSAGE[ arabic ] = "BASIC is still running! Exit anyway?"; + Title[ portuguese ] = "StarBasic"; + Title[ russian ] = "StarBasic"; + Title[ greek ] = "StarBasic"; + Title[ dutch ] = "StarBasic"; + Title[ french ] = "StarBasic"; + Title[ spanish ] = "StarBasic"; + Title[ italian ] = "StarBasic"; + Title[ danish ] = "StarBasic"; + Title[ swedish ] = "StarBasic"; + Title[ polish ] = "StarBasic"; + Title[ portuguese_brazilian ] = "StarBasic"; + Title[ japanese ] = "StarBasic"; + Title[ korean ] = "StarBasic"; + Title[ chinese_simplified ] = "StarBasic"; + Title[ chinese_traditional ] = "StarBasic"; + Title[ arabic ] = "StarBasic"; + MESSAGE[ turkish ] = "BASIC programý hâlâ etkin. Yine de çýkmak istiyor musunuz?"; +}; +QueryBox IDS_LOSS_OF_INFORMATION { + TITLE = "StarBasic"; + TITLE [ english_us ] = "StarBasic"; + MESSAGE = "Speichern in Fremdformat verursacht Informationsverlust"; + MESSAGE [ english_us ] = "Saving in an external format causes information loss."; + BUTTONS = WB_OK_CANCEL; + MESSAGE[ portuguese ] = "Guardar em formatos externos causará perda de informação."; + MESSAGE[ russian ] = "Ñîõðàíåíèå â ÷óæîì ôîðìàòå ïðèâåäåò ê ïîòåðå èíôîðìàöèè"; + MESSAGE[ greek ] = "Saving in an external format causes information loss."; + MESSAGE[ dutch ] = "Door het opslaan in een extern formaat kan informatie verloren gaan."; + MESSAGE[ french ] = "L'enregistrement dans un format externe entraîne une perte d'informations."; + MESSAGE[ spanish ] = "Al guardar en formato externo se perderá información"; + MESSAGE[ italian ] = "Saving in an external format causes information loss."; + MESSAGE[ danish ] = "Saving in an external format causes information loss."; + MESSAGE[ swedish ] = "Saving in an external format causes information loss."; + MESSAGE[ polish ] = "Zapisanie w innym formacie spowoduje utratê informacji"; + MESSAGE[ portuguese_brazilian ] = "BASIC is still running! Exit anyway?"; + MESSAGE[ japanese ] = "ŠO•”‚Ì‘Ž®Ý’è‚ŕۑ¶‚·‚邯î•ñ‚ðŽ¸‚¤‚±‚ƂɂȂè‚Ü‚·"; + MESSAGE[ korean ] = "¿ÜºÎ Æ÷¸ËÀÇ ÀúÀåÀº Á¤º¸ ¼Õ½ÇÀ» À¯¹ßÇÕ´Ï´Ù."; + MESSAGE[ chinese_simplified ] = "Saving in an external format causes information loss."; + MESSAGE[ chinese_traditional ] = "Saving in an external format causes information loss."; + MESSAGE[ arabic ] = "Saving in an external format causes information loss."; + Title[ portuguese ] = "StarBasic"; + Title[ russian ] = "StarBasic"; + Title[ greek ] = "StarBasic"; + Title[ dutch ] = "StarBasic"; + Title[ french ] = "StarBasic"; + Title[ spanish ] = "StarBasic"; + Title[ italian ] = "StarBasic"; + Title[ danish ] = "StarBasic"; + Title[ swedish ] = "StarBasic"; + Title[ polish ] = "StarBasic"; + Title[ portuguese_brazilian ] = "StarBasic"; + Title[ japanese ] = "StarBasic"; + Title[ korean ] = "StarBasic"; + Title[ chinese_simplified ] = "StarBasic"; + Title[ chinese_traditional ] = "StarBasic"; + Title[ arabic ] = "StarBasic"; + MESSAGE[ turkish ] = "Yabancý formatta kaydetmek bilgi kaybýna yol açar"; +}; + +InfoBox IDS_NOT_YET_IMPLEMENTED +{ + MESSAGE = "Noch nicht implementiert"; + MESSAGE[ english_us ] = "Not yet implemented"; + MESSAGE[ portuguese ] = "Ainda não implementado"; + MESSAGE[ russian ] = "Åùå íå âíåäðåíî"; + MESSAGE[ greek ] = "Not yet implemented"; + MESSAGE[ dutch ] = "Nog niet geïmplementeerd"; + MESSAGE[ french ] = "Pas encore implémenté"; + MESSAGE[ spanish ] = "Todavía no implementado"; + MESSAGE[ italian ] = "Not yet implemented"; + MESSAGE[ danish ] = "Not yet implemented"; + MESSAGE[ swedish ] = "Not yet implemented"; + MESSAGE[ polish ] = "Na razie nie implementowane"; + MESSAGE[ portuguese_brazilian ] = "Noch nicht implementiert"; + MESSAGE[ japanese ] = "‚Ü‚¾ŽÀ‘•‚³‚ê‚Ä‚¢‚Ü‚¹‚ñ"; + MESSAGE[ korean ] = "¾ÆÁ÷ ±¸ÇöµÇÁö ¾Ê¾Ò½À´Ï´Ù."; + MESSAGE[ chinese_simplified ] = "Not yet implemented"; + MESSAGE[ chinese_traditional ] = "Not yet implemented"; + MESSAGE[ arabic ] = "Not yet implemented"; + MESSAGE[ turkish ] = "Henüz uygulanmadý"; +}; + + +String IDS_WARNING1 { + TEXT = "Warnung "; + TEXT [ english_us ] = "Warning "; + TEXT[ portuguese ] = "Aviso "; + TEXT[ russian ] = "Warning "; + TEXT[ greek ] = "Warning "; + TEXT[ dutch ] = "Waarschuwing "; + TEXT[ french ] = "Attention !"; + TEXT[ spanish ] = "Advertencia "; + TEXT[ italian ] = "Warning "; + TEXT[ danish ] = "Warning "; + TEXT[ swedish ] = "Warning "; + TEXT[ polish ] = "Warning "; + TEXT[ portuguese_brazilian ] = "Warnung "; + TEXT[ japanese ] = "Œx "; + TEXT[ korean ] = "°æ°í "; + TEXT[ chinese_simplified ] = "Warnung "; + TEXT[ chinese_traditional ] = "Warning "; + TEXT[ arabic ] = "Warning "; + TEXT[ turkish ] = "Uyarý "; +}; +String IDS_ERROR1 { + TEXT = "Fehler "; + TEXT [ english_us ] = "Error "; + TEXT[ portuguese ] = "Erro "; + TEXT[ russian ] = "Error "; + TEXT[ greek ] = "Error "; + TEXT[ dutch ] = "Fout "; + TEXT[ french ] = "Erreur "; + TEXT[ spanish ] = "Error "; + TEXT[ italian ] = "Error "; + TEXT[ danish ] = "Error "; + TEXT[ swedish ] = "Error "; + TEXT[ polish ] = "Error "; + TEXT[ portuguese_brazilian ] = "Fehler "; + TEXT[ japanese ] = "´×° "; + TEXT[ korean ] = "¿À·ù "; + TEXT[ chinese_simplified ] = "Fehler "; + TEXT[ chinese_traditional ] = "Error "; + TEXT[ arabic ] = "Error "; + TEXT[ turkish ] = "Hata "; +}; +String IDS_ERROR2 { + TEXT = " in Zeile "; + TEXT [ english_us ] = "in row "; + TEXT[ portuguese ] = "na linha "; + TEXT[ russian ] = "in row "; + TEXT[ greek ] = "in row "; + TEXT[ dutch ] = "in regel "; + TEXT[ french ] = "à la ligne "; + TEXT[ spanish ] = "en fila "; + TEXT[ italian ] = "in row "; + TEXT[ danish ] = "in row "; + TEXT[ swedish ] = "in row "; + TEXT[ polish ] = "in row "; + TEXT[ portuguese_brazilian ] = "in Zeile "; + TEXT[ japanese ] = "s "; + TEXT[ korean ] = "ÇàÀ¸·Î "; + TEXT[ chinese_simplified ] = "in Zeile "; + TEXT[ chinese_traditional ] = "in row "; + TEXT[ arabic ] = "in row "; + TEXT[ turkish ] = "Satýr: "; +}; +String IDS_NO_LONGNAME { + TEXT = "Kein Eintrag in Hid.Lst"; + TEXT[ english_us ] = "No entries in Hid.Lst"; + TEXT[ portuguese ] = "Nenhuma entrada em Hid.Lst"; + TEXT[ russian ] = " Hid.Lst çàïèñè íå èìååòñÿ"; + TEXT[ greek ] = "No entries in Hid.Lst"; + TEXT[ dutch ] = "Geen item in Hid.Lst"; + TEXT[ french ] = "Aucune entrée dans Hid.Lst"; + TEXT[ spanish ] = "Ninguna entrada en Hid.Lst"; + TEXT[ italian ] = "No esntries in Hid.Lst"; + TEXT[ danish ] = "No entries in Hid.Lst"; + TEXT[ swedish ] = "No entries in Hid.Lst"; + TEXT[ polish ] = "Brak wpisu w Hid.Lst"; + TEXT[ portuguese_brazilian ] = "Kein Eintrag in Hid.Lst"; + TEXT[ japanese ] = "Hid.Lst‚É€–Ú‚Í‚ ‚è‚Ü‚¹‚ñ"; + TEXT[ korean ] = "Hid.Lst ¿¡ µî·ÏµÇÁö ¾Ê¾Ò½À´Ï´Ù."; + TEXT[ chinese_simplified ] = "No entries in Hid.Lst"; + TEXT[ chinese_traditional ] = "No entries in Hid.Lst"; + TEXT[ arabic ] = "No entries in Hid.Lst"; + TEXT[ turkish ] = "Hid.Lst'te giriþ yok"; +}; +String IDS_WARNING_PREFIX +{ + Text = "Warnung: "; + Text[ english_us ] = "Warning: "; + Text[ portuguese ] = "Aviso: "; + Text[ russian ] = "Ïðåäóïðåæäåíèå: "; + Text[ greek ] = "Warning: "; + Text[ dutch ] = "Waarschuwing: "; + Text[ french ] = "Attention ! "; + Text[ spanish ] = "Advertencia: "; + Text[ italian ] = "Warning: "; + Text[ danish ] = "Warning: "; + Text[ swedish ] = "Warning: "; + Text[ polish ] = "Ostrze¿enie: "; + Text[ portuguese_brazilian ] = "Warnung: "; + Text[ japanese ] = "Œx: "; + Text[ korean ] = "°æ°í "; + Text[ chinese_simplified ] = "Warning: "; + Text[ chinese_traditional ] = "Warning: "; + Text[ arabic ] = "Warning: "; + Text[ turkish ] = "Uyarý: "; +}; +String IDS_OBJECT +{ + Text = "Objekt"; + Text[ english_us ] = "Object"; + Text[ LANGUAGE_USER1 ] = "Gemeint sind Objekte aus der Objektorientierten Programmierung"; + Text[ portuguese ] = "Objecto"; + Text[ russian ] = "Îáúåêò"; + Text[ greek ] = "Objekt"; + Text[ dutch ] = "Object"; + Text[ french ] = "Objet"; + Text[ spanish ] = "Objeto"; + Text[ italian ] = "Object"; + Text[ danish ] = "Object"; + Text[ swedish ] = "Object"; + Text[ polish ] = "Obiekt"; + Text[ portuguese_brazilian ] = "Object"; + Text[ japanese ] = "µÌÞ¼Þª¸Ä"; + Text[ korean ] = "°³Ã¼"; + Text[ chinese_simplified ] = "Object"; + Text[ chinese_traditional ] = "Object"; + Text[ arabic ] = "Object"; + Text[ turkish ] = "Nesne"; +}; +String IDS_EDIT_VAR +{ + Text = "($Arg1) Editieren"; + Text[ english_us ] = "Edit ($Arg1)"; + Text[ LANGUAGE_USER1 ] = "Keine Dati, sondern eine Variable"; + Text[ portuguese ] = "Editar ($Arg1)"; + Text[ russian ] = "Ïðàâêà ($Arg1)"; + Text[ greek ] = "Edit ($Arg1)"; + Text[ dutch ] = "Editeren ($Arg1)"; + Text[ french ] = "Éditer ($Arg1)"; + Text[ spanish ] = "Editar ($Arg1)"; + Text[ italian ] = "Edit ($Arg1)"; + Text[ danish ] = "Edit ($Arg1)"; + Text[ swedish ] = "Edit ($Arg1)"; + Text[ polish ] = "Edytuj ($Arg1)"; + Text[ portuguese_brazilian ] = "Edit ($Arg1)"; + Text[ japanese ] = "($Arg1)•ÒW"; + Text[ korean ] = "ÆíÁý ($Arg1)"; + Text[ chinese_simplified ] = "Edit ($Arg1)"; + Text[ chinese_traditional ] = "Edit ($Arg1)"; + Text[ arabic ] = "Edit ($Arg1)"; + Text[ turkish ] = "($Arg1) Düzenle"; +}; + +String IDS_APPNAME { + TEXT = "StarBasic"; + TEXT [ english_us ] = "StarBasic"; + TEXT[ portuguese ] = "StarOffice Basic"; + TEXT[ russian ] = "StarBasic"; + TEXT[ greek ] = "StarBasic"; + TEXT[ dutch ] = "StarOffice Basic"; + TEXT[ french ] = "StarBasic"; + TEXT[ spanish ] = "StarBasic"; + TEXT[ italian ] = "StarOffice Basic"; + TEXT[ danish ] = "StarBasic"; + TEXT[ swedish ] = "StarOffice Basic"; + TEXT[ polish ] = "StarBasic"; + TEXT[ portuguese_brazilian ] = "StarBasic"; + TEXT[ japanese ] = "StarBasic"; + TEXT[ korean ] = "StarOffice Basic"; + TEXT[ chinese_simplified ] = "StarOffice Basic"; + TEXT[ chinese_traditional ] = "StarOffice Basic"; + TEXT[ arabic ] = "StarBasic"; + TEXT[ turkish ] = "StarOffice Basic"; +}; +String IDS_APPNAME2 { + TEXT = "StarTestTool"; + TEXT [ english_us ] = "StarTestTool"; + TEXT[ portuguese ] = "StarTestTool"; + TEXT[ russian ] = "StarTestTool"; + TEXT[ greek ] = "StarTestTool"; + TEXT[ dutch ] = "StarTestTool"; + TEXT[ french ] = "StarTestTool"; + TEXT[ spanish ] = "StarTestTool"; + TEXT[ italian ] = "StarTestTool"; + TEXT[ danish ] = "StarTestTool"; + TEXT[ swedish ] = "StarTestTool"; + TEXT[ polish ] = "StarTestTool"; + TEXT[ portuguese_brazilian ] = "StarTestTool"; + TEXT[ japanese ] = "StarTestTool"; + TEXT[ korean ] = "StarTestTool"; + TEXT[ chinese_simplified ] = "StarTestTool"; + TEXT[ chinese_traditional ] = "StarTestTool"; + TEXT[ arabic ] = "StarTestTool"; + TEXT[ turkish ] = "StarTestTool"; +}; +String IDS_APPMODE_BREAK { + text = "Break"; + text[ english_us ] = "Break"; + text[ portuguese ] = "Break"; + text[ russian ] = "Break"; + text[ greek ] = "Break"; + text[ dutch ] = "Break"; + text[ french ] = "Break"; + text[ spanish ] = "Break"; + text[ italian ] = "Break"; + text[ danish ] = "Break"; + text[ swedish ] = "Break"; + text[ polish ] = "Przerwa"; + text[ portuguese_brazilian ] = "Break"; + text[ japanese ] = "Break"; + text[ korean ] = "Break"; + text[ chinese_simplified ] = "Break"; + text[ chinese_traditional ] = "Break"; + text[ arabic ] = "Break"; + text[ turkish ] = "Break"; +}; +String IDS_APPMODE_RUN { + text = "Run"; + text[ english_us ] = "Run"; + text[ portuguese ] = "Run"; + text[ russian ] = "Run"; + text[ greek ] = "Run"; + text[ dutch ] = "Run"; + text[ french ] = "Run"; + text[ spanish ] = "Run"; + text[ italian ] = "Run"; + text[ danish ] = "Run"; + text[ swedish ] = "Run"; + text[ polish ] = "Run"; + text[ portuguese_brazilian ] = "Run"; + text[ japanese ] = "Run"; + text[ korean ] = "½ÇÇà"; + text[ chinese_simplified ] = "Run"; + text[ chinese_traditional ] = "Run"; + text[ arabic ] = "Run"; + text[ turkish ] = "Run"; +}; +String IDS_NONAME { + TEXT = "Unbenannt"; + TEXT [ english_us ] = "Unnamed"; + TEXT[ portuguese ] = "Sem nome"; + TEXT[ russian ] = "Unnamed"; + TEXT[ greek ] = "Unnamed"; + TEXT[ dutch ] = "Naamloos"; + TEXT[ french ] = "Sans nom"; + TEXT[ spanish ] = "Desconocido"; + TEXT[ italian ] = "Unnamed"; + TEXT[ danish ] = "Unnamed"; + TEXT[ swedish ] = "Unnamed"; + TEXT[ polish ] = "Unnamed "; + TEXT[ portuguese_brazilian ] = "Unbenannt"; + TEXT[ japanese ] = "•s–¾"; + TEXT[ korean ] = "À̸§ÀÌ ¾øÀ½"; + TEXT[ chinese_simplified ] = "Unbenannt"; + TEXT[ chinese_traditional ] = "Unnamed"; + TEXT[ arabic ] = "Unnamed"; + TEXT[ turkish ] = "Adsýz"; +}; + +String IDS_NONAMEFILE { +#if defined ( UNX ) +TEXT = "*.bas"; +#else +TEXT = "*.BAS"; +#endif +}; +String IDS_INCFILE { +#if defined ( UNX ) +TEXT = "*.inc"; +#else +TEXT = "*.INC"; +#endif +}; +String IDS_LIBFILE { +#if defined ( UNX ) +TEXT = "*.sb"; +#else +TEXT = "*.SB"; +#endif +}; +String IDS_RESFILE { +#if defined ( UNX ) +TEXT = "*.res"; +#else +TEXT = "*.RES"; +#endif +}; +String IDS_TXTFILE { +#if defined ( UNX ) +TEXT = "*.txt"; +#else +TEXT = "*.TXT"; +#endif +}; + +String IDS_LOADDLG { + TEXT = "StarBasic: Datei einlesen"; + TEXT [ english_us ] = "StarBasic: Load File"; + TEXT[ portuguese ] = "StarOffice Basic: ler ficheiro"; + TEXT[ russian ] = "StarBasic: Load File"; + TEXT[ greek ] = "StarBasic: Load File"; + TEXT[ dutch ] = "StarOffice Basic: bestand lezen"; + TEXT[ french ] = "StarBasic : Lecture du fichier"; + TEXT[ spanish ] = "StarBasic: Leer archivo"; + TEXT[ italian ] = "StarBasic: Load File"; + TEXT[ danish ] = "StarBasic: Load File"; + TEXT[ swedish ] = "StarBasic: Load File"; + TEXT[ polish ] = "StarBasic: Load File "; + TEXT[ portuguese_brazilian ] = "StarBasic: Datei einlesen"; + TEXT[ japanese ] = "StarBasic: ̧²Ù‚̓ǂݞ‚Ý"; + TEXT[ korean ] = "StarBasic: ÆÄÀÏ ·Îµå"; + TEXT[ chinese_simplified ] = "StarBasic: Datei einlesen"; + TEXT[ chinese_traditional ] = "StarOffice Basic¡GLoad File"; + TEXT[ arabic ] = "StarBasic: Load File"; + TEXT[ turkish ] = "StarBasic: Dosyayý yükle"; +}; +String IDS_SAVEDLG { + TEXT = "StarBasic: Datei speichern"; + TEXT [ english_us ] = "StarBasic: Save File"; + TEXT[ portuguese ] = "StarOffice Basic: guardar ficheiro"; + TEXT[ russian ] = "StarBasic: Save File"; + TEXT[ greek ] = "StarBasic: Save File"; + TEXT[ dutch ] = "StarOffice Basic: bestand opslaan"; + TEXT[ french ] = "StarBasic: Enregistrement du fichier"; + TEXT[ spanish ] = "StarBasic: Guardar archivo"; + TEXT[ italian ] = "StarBasic: Save File"; + TEXT[ danish ] = "StarBasic: Save File"; + TEXT[ swedish ] = "StarBasic: Save File"; + TEXT[ polish ] = "StarBasic: Save File "; + TEXT[ portuguese_brazilian ] = "StarBasic: Datei speichern"; + TEXT[ japanese ] = "StarBasic: ̧²Ù‚̕ۑ¶"; + TEXT[ korean ] = "StarBasic: ÆÄÀÏ ÀúÀå"; + TEXT[ chinese_simplified ] = "StarBasic: Datei speichern"; + TEXT[ chinese_traditional ] = "StarOffice Basic: Save File"; + TEXT[ arabic ] = "StarBasic: Save File"; + TEXT[ turkish ] = "StarBasic: Dosyayý kaydet"; +}; +String IDS_BASFILTER { + TEXT = "Quelltexte (*.BAS)"; + TEXT [ english_us ] = "Source text (*.BAS)"; + TEXT[ portuguese ] = "Textos-fonte (*.BAS)"; + TEXT[ russian ] = "Source text (*.BAS)"; + TEXT[ greek ] = "Source text (*.BAS)"; + TEXT[ dutch ] = "Brontekst (*.BAS)"; + TEXT[ french ] = "Texte source (*.BAS)"; + TEXT[ spanish ] = "Textos fuente (*.BAS)"; + TEXT[ italian ] = "Source text (*.BAS)"; + TEXT[ danish ] = "Source text (*.BAS)"; + TEXT[ swedish ] = "Source text (*.BAS)"; + TEXT[ polish ] = "Source text (*.BAS) "; + TEXT[ portuguese_brazilian ] = "Quelltexte (*.BAS)"; + TEXT[ japanese ] = "¿°½(*.BAS)"; + TEXT[ korean ] = "¼Ò½º ÅØ½ºÆ® (*.BAS)"; + TEXT[ chinese_simplified ] = "Quelltexte (*.BAS)"; + TEXT[ chinese_traditional ] = "Source text(*.BAS)"; + TEXT[ arabic ] = "Source text (*.BAS)"; + TEXT[ turkish ] = "Kaynak metinler (*.BAS)"; +}; +String IDS_INCFILTER { + TEXT = "Include-Dateien (*.INC)"; + TEXT [ english_us ] = "Include files (*.INC)"; + TEXT[ portuguese ] = "Ficheiros \"Include\" (*.INC)"; + TEXT[ russian ] = "Include files (*.INC)"; + TEXT[ greek ] = "Include files (*.INC)"; + TEXT[ dutch ] = "Include-bestanden (*.INC)"; + TEXT[ french ] = "Fichiers \"Include\" (*.INC)"; + TEXT[ spanish ] = "Archivos \"Include\" (*.INC)"; + TEXT[ italian ] = "Include files (*.INC)"; + TEXT[ danish ] = "Include files (*.INC)"; + TEXT[ swedish ] = "Include files (*.INC)"; + TEXT[ polish ] = "Include files (*.INC) "; + TEXT[ portuguese_brazilian ] = "Include-Dateien (*.INC)"; + TEXT[ japanese ] = "Include files (*.INC)"; + TEXT[ korean ] = "ÆÄÀÏ Æ÷ÇÔ (*.INC)"; + TEXT[ chinese_simplified ] = "Include-Dateien (*.INC)"; + TEXT[ chinese_traditional ] = "Include files(*.INC)"; + TEXT[ arabic ] = "Include files (*.INC)"; + TEXT[ turkish ] = "Include dosyalarý (*.INC)"; +}; +String IDS_LIBFILTER { + TEXT = "Libraries (*.SB)"; + TEXT [ english_us ] = "Libraries (*.SB)"; + TEXT[ portuguese ] = "Bibliotecas (*.SB)"; + TEXT[ russian ] = "Libraries (*.SB)"; + TEXT[ greek ] = "Libraries (*.SB)"; + TEXT[ dutch ] = "Libraries (*.SB)"; + TEXT[ french ] = "Bibliothèques (*.SB)"; + TEXT[ spanish ] = "Bibliotecas (*.SB)"; + TEXT[ italian ] = "Libraries (*.SB)"; + TEXT[ danish ] = "Libraries (*.SB)"; + TEXT[ swedish ] = "Libraries (*.SB)"; + TEXT[ polish ] = "Libraries (*.SB) "; + TEXT[ portuguese_brazilian ] = "Libraries (*.SB)"; + TEXT[ japanese ] = "ײÌÞר(*.SB)"; + TEXT[ korean ] = "¶óÀ̺귯¸® (*.SB)"; + TEXT[ chinese_simplified ] = "Libraries (*.SB)"; + TEXT[ chinese_traditional ] = "Libraries(*.SB)"; + TEXT[ arabic ] = "Libraries (*.SB)"; + TEXT[ turkish ] = "Kitaplýklar (*.SB)"; +}; +String IDS_RESFILTER { + TEXT = "Results (*.RES)"; + TEXT [ english_us ] = "Results (*.RES)"; + TEXT[ portuguese ] = "Resultados (*.RES)"; + TEXT[ russian ] = "Results (*.RES)"; + TEXT[ greek ] = "Results (*.RES)"; + TEXT[ dutch ] = "Results (*.RES)"; + TEXT[ french ] = "Résultats (*.RES)"; + TEXT[ spanish ] = "Resultados (*.RES)"; + TEXT[ italian ] = "Results (*.RES)"; + TEXT[ danish ] = "Results (*.RES)"; + TEXT[ swedish ] = "Results (*.RES)"; + TEXT[ polish ] = "Results (*.RES) "; + TEXT[ portuguese_brazilian ] = "Results (*.RES)"; + TEXT[ japanese ] = "Œ‹‰Ê(*.RES)"; + TEXT[ korean ] = "°á°ú (*.RES)"; + TEXT[ chinese_simplified ] = "Results (*.RES)"; + TEXT[ chinese_traditional ] = "Results(*.RES)"; + TEXT[ arabic ] = "Results (*.RES)"; + TEXT[ turkish ] = "Sonuçlar (*.RES)"; +}; +String IDS_TXTFILTER { + TEXT = "Results als Textdatei (*.TXT)"; + TEXT [ english_us ] = "Results as text file (*.TXT)"; + TEXT[ portuguese ] = "Resultados como ficheiro de texto (*.TXT)"; + TEXT[ russian ] = "Results as text file (*.TXT)"; + TEXT[ greek ] = "Results as text file (*.TXT)"; + TEXT[ dutch ] = "Results als tekstbestand (*.TXT)"; + TEXT[ french ] = "Résultats sous forme de fichier texte (*.TXT)"; + TEXT[ spanish ] = "Resultados como archivo de texto (*.TXT)"; + TEXT[ italian ] = "Results as text file (*.TXT)"; + TEXT[ danish ] = "Results as text file (*.TXT)"; + TEXT[ swedish ] = "Results as text file (*.TXT)"; + TEXT[ polish ] = "Results as text file (*.TXT) "; + TEXT[ portuguese_brazilian ] = "Results als Textdatei (*.TXT)"; + TEXT[ japanese ] = "•¶‘̧²Ù‚Æ‚µ‚Ă̌‹‰Ê(*.TXT)"; + TEXT[ korean ] = "ÅØ½ºÆ® ÆÄÀÏ °á°ú (*.TXT)"; + TEXT[ chinese_simplified ] = "Results als Textdatei (*.TXT)"; + TEXT[ chinese_traditional ] = "Results as text file(*.TXT)"; + TEXT[ arabic ] = "Results as text file (*.TXT)"; + TEXT[ turkish ] = "Metin dosyasý olarak sonuçlar (*.TXT)"; +}; +String IDS_PAGE { + TEXT = "Seite "; + TEXT [ english_us ] = "Page "; + TEXT[ portuguese ] = "Página "; + TEXT[ russian ] = "Page "; + TEXT[ greek ] = "Page "; + TEXT[ dutch ] = "Pagina "; + TEXT[ french ] = "Page "; + TEXT[ spanish ] = "Página "; + TEXT[ italian ] = "Page "; + TEXT[ danish ] = "Page "; + TEXT[ swedish ] = "Page "; + TEXT[ polish ] = "Page "; + TEXT[ portuguese_brazilian ] = "Seite "; + TEXT[ japanese ] = "Íß°¼Þ "; + TEXT[ korean ] = "ÆäÀÌÁö "; + TEXT[ chinese_simplified ] = "Seite "; + TEXT[ chinese_traditional ] = "Page "; + TEXT[ arabic ] = "Page "; + TEXT[ turkish ] = "Sayfa "; +}; +String IDS_PRINTMSG { + TEXT = "Ausdruck von "; + TEXT [ english_us ] = "Printout from "; + TEXT[ portuguese ] = "Impressão de "; + TEXT[ russian ] = "Printout from "; + TEXT[ greek ] = "Printout from "; + TEXT[ dutch ] = "Afdruk van "; + TEXT[ french ] = "Impression de "; + TEXT[ spanish ] = "Imprimir "; + TEXT[ italian ] = "Printout from "; + TEXT[ danish ] = "Printout from "; + TEXT[ swedish ] = "Printout from "; + TEXT[ polish ] = "Printout from "; + TEXT[ portuguese_brazilian ] = "Ausdruck von "; + TEXT[ japanese ] = "ˆóü”ÍˆÍ "; + TEXT[ korean ] = "Ãâ·Â "; + TEXT[ chinese_simplified ] = "Ausdruck von "; + TEXT[ chinese_traditional ] = "Printout from "; + TEXT[ arabic ] = "Printout from "; + TEXT[ turkish ] = "Çýktý kaynaðý: "; +}; +String IDS_CONTINUE { + TEXT = "Weiter"; + TEXT [ english_us ] = "Continue"; + TEXT[ portuguese ] = "Continuar"; + TEXT[ russian ] = "Continue"; + TEXT[ greek ] = "Continue"; + TEXT[ dutch ] = "Volgende"; + TEXT[ french ] = "Poursuivre"; + TEXT[ spanish ] = "Avanzar"; + TEXT[ italian ] = "Continue"; + TEXT[ danish ] = "Continue"; + TEXT[ swedish ] = "Continue"; + TEXT[ polish ] = "Continue "; + TEXT[ portuguese_brazilian ] = "Weiter"; + TEXT[ japanese ] = "‘±s"; + TEXT[ korean ] = "°è¼Ó"; + TEXT[ chinese_simplified ] = "Weiter"; + TEXT[ chinese_traditional ] = "Contiune"; + TEXT[ arabic ] = "Continue"; + TEXT[ turkish ] = "Ýleri"; +}; +String IDS_CANCEL { + TEXT = "Abbruch"; + TEXT [ english_us ] = "Cancel"; + TEXT[ portuguese ] = "Cancelar"; + TEXT[ russian ] = "Cancel"; + TEXT[ greek ] = "Cancel"; + TEXT[ dutch ] = "Annuleren"; + TEXT[ french ] = "Annuler"; + TEXT[ spanish ] = "Cancelar"; + TEXT[ italian ] = "Cancel"; + TEXT[ danish ] = "Cancel"; + TEXT[ swedish ] = "Cancel"; + TEXT[ polish ] = "Cancel "; + TEXT[ portuguese_brazilian ] = "Abbruch"; + TEXT[ japanese ] = "·¬Ý¾Ù"; + TEXT[ korean ] = "Ãë¼Ò"; + TEXT[ chinese_simplified ] = "Abbruch"; + TEXT[ chinese_traditional ] = "Cancel"; + TEXT[ arabic ] = "Cancel"; + TEXT[ turkish ] = "Ýptal"; +}; +String IDS_DISASWIN { + TEXT = "Disassembly"; + TEXT [ english_us ] = "Disassembly"; + TEXT[ portuguese ] = "Descodificar"; + TEXT[ russian ] = "Disassembly"; + TEXT[ greek ] = "Disassembly"; + TEXT[ dutch ] = "Disassembly"; + TEXT[ french ] = "Désassembler"; + TEXT[ spanish ] = "Desensamblar"; + TEXT[ italian ] = "Disassembly"; + TEXT[ danish ] = "Disassembly"; + TEXT[ swedish ] = "Disassembly"; + TEXT[ polish ] = "Disassembly "; + TEXT[ portuguese_brazilian ] = "Disassembly"; + TEXT[ japanese ] = "Disassembly"; + TEXT[ korean ] = "Disassembly"; + TEXT[ chinese_simplified ] = "Disassembly"; + TEXT[ chinese_traditional ] = "Disassembly"; + TEXT[ arabic ] = "Disassembly"; + TEXT[ turkish ] = "Disassembly"; +}; +//Icon RID_APPICON { +// FILE = "basic.ico"; +//}; +//Icon RID_APPICON2 { +// FILE = "testtool.ico"; +//}; +//Icon RID_WORKICON { +// FILE = "work.ico"; +//}; + +Bitmap MBP_PLUS { + File = "plus.bmp"; +}; +Bitmap MBP_MINUS { + File = "minus.bmp"; +}; +Bitmap MBP_ASSERT { + File = "assert.bmp"; +}; + +Menu RID_APPMENUBAR { + ItemList = { + MenuItem { + Identifier = RID_APPFILE; + TEXT = "~Datei"; + TEXT [ english_us ] = "~File"; + HELPTEXT = "Dateien öffnen, schließen und drucken"; + HELPTEXT [ english_us ] = "Dateien öffnen, schließen und drucken"; + SUBMENU = Menu ,RID_FILE; + TEXT[ portuguese ] = "~Ficheiro"; + TEXT[ russian ] = "~Ôàéë"; + TEXT[ greek ] = "~File"; + TEXT[ dutch ] = "~Bestand"; + TEXT[ french ] = "~Fichier"; + TEXT[ spanish ] = "~Archivo"; + TEXT[ italian ] = "~File"; + TEXT[ danish ] = "~File"; + TEXT[ swedish ] = "~File"; + TEXT[ polish ] = "~File "; + TEXT[ portuguese_brazilian ] = "~Datei"; + TEXT[ japanese ] = "̧²Ù(~F)"; + TEXT[ korean ] = "ÆÄÀÏ(~F)"; + TEXT[ chinese_simplified ] = "~Datei"; + TEXT[ chinese_traditional ] = "~File"; + TEXT[ arabic ] = "~File"; + TEXT[ turkish ] = "~Dosya"; + }; + MenuItem { + Identifier = RID_APPEDIT; + TEXT = "~Bearbeiten"; + TEXT [ english_us ] = "~Edit"; + HELPTEXT = "Editier-Funktionen"; + HELPTEXT [ english_us ] = "Editier-Funktionen"; + SUBMENU = Menu ,RID_EDIT; + TEXT[ portuguese ] = "~Editar"; + TEXT[ russian ] = "~Edit"; + TEXT[ greek ] = "~Edit"; + TEXT[ dutch ] = "~Bewerken"; + TEXT[ french ] = "~Éditer"; + TEXT[ spanish ] = "~Editar"; + TEXT[ italian ] = "~Edit"; + TEXT[ danish ] = "~Edit"; + TEXT[ swedish ] = "~Edit"; + TEXT[ polish ] = "~Edit "; + TEXT[ portuguese_brazilian ] = "~Bearbeiten"; + TEXT[ japanese ] = "•ÒW(~E)"; + TEXT[ korean ] = "ÆíÁý(~E)"; + TEXT[ chinese_simplified ] = "~Bearbeiten"; + TEXT[ chinese_traditional ] = "~Edit"; + TEXT[ arabic ] = "~Edit"; + TEXT[ turkish ] = "Dü~zenle"; + }; + MenuItem { + Identifier = RID_APPRUN; + TEXT = "~Programm"; + TEXT [ english_us ] = "~Program"; + HELPTEXT = "Programme compilieren und ausführen"; + HELPTEXT [ english_us ] = "Programme compilieren und ausführen"; + SUBMENU = Menu ,RID_RUN; + TEXT[ portuguese ] = "~Programa"; + TEXT[ russian ] = "~Program"; + TEXT[ greek ] = "~Program"; + TEXT[ dutch ] = "~Programma"; + TEXT[ french ] = "~Programme"; + TEXT[ spanish ] = "~Programa"; + TEXT[ italian ] = "~Program"; + TEXT[ danish ] = "~Program"; + TEXT[ swedish ] = "~Program"; + TEXT[ polish ] = "~Program "; + TEXT[ portuguese_brazilian ] = "~Programm"; + TEXT[ japanese ] = "ÌßÛ¸Þ×Ñ(~P)"; + TEXT[ korean ] = "ÇÁ·Î±×·¥(~P)"; + TEXT[ chinese_simplified ] = "~Programm"; + TEXT[ chinese_traditional ] = "~Program"; + TEXT[ arabic ] = "~Program"; + TEXT[ turkish ] = "P~rogram"; + }; + MenuItem { + Identifier = RID_APPWINDOW; + TEXT = "~Fenster"; + TEXT [ english_us ] = "~Window"; + HELPTEXT = "Fenster anordnen"; + HELPTEXT [ english_us ] = "Fenster anordnen"; + SUBMENU = Menu ,RID_WINDOW; + TEXT[ portuguese ] = "~Janela"; + TEXT[ russian ] = "~Window"; + TEXT[ greek ] = "~Window"; + TEXT[ dutch ] = "~Venster"; + TEXT[ french ] = "~Fenêtre"; + TEXT[ spanish ] = "~Ventana"; + TEXT[ italian ] = "~Window"; + TEXT[ danish ] = "~Window"; + TEXT[ swedish ] = "~Window"; + TEXT[ polish ] = "~Window "; + TEXT[ portuguese_brazilian ] = "~Fenster"; + TEXT[ japanese ] = "³¨ÝÄÞ³(~W)"; + TEXT[ korean ] = "â(~W)"; + TEXT[ chinese_simplified ] = "~Fenster"; + TEXT[ chinese_traditional ] = "~Window"; + TEXT[ arabic ] = "~Window"; + TEXT[ turkish ] = "~Pencere"; + }; + MenuItem { + SEPARATOR = TRUE; + }; + MenuItem { + HELP = TRUE; + Identifier = RID_APPHELP; + TEXT = "~Hilfe"; + TEXT [ english_us ] = "~Help"; + HELPTEXT = "Hilfe-Funktionen"; + HELPTEXT [ english_us ] = "Hilfe-Funktionen"; + SUBMENU = Menu ,RID_HELP; + TEXT[ portuguese ] = "~Ajuda"; + TEXT[ russian ] = "~Help"; + TEXT[ greek ] = "~Help"; + TEXT[ dutch ] = "~Help"; + TEXT[ french ] = "~Aide"; + TEXT[ spanish ] = "~Ayuda"; + TEXT[ italian ] = "~Help"; + TEXT[ danish ] = "~Help"; + TEXT[ swedish ] = "~Help"; + TEXT[ polish ] = "~Help "; + TEXT[ portuguese_brazilian ] = "~Hilfe"; + TEXT[ japanese ] = "ÍÙÌß(~H)"; + TEXT[ korean ] = "µµ¿ò¸»(~H)"; + TEXT[ chinese_simplified ] = "~Hilfe"; + TEXT[ chinese_traditional ] = "~Help"; + TEXT[ arabic ] = "~Help"; + TEXT[ turkish ] = "~Yardým"; + }; + }; +}; +Menu RID_FILE { + ITEMLIST = { + MenuItem { + Identifier = RID_FILENEW; + TEXT = "~Neu"; + TEXT [ english_us ] = "~New"; + HELPTEXT = "Neues, leeres Fenster öffnen"; + HELPTEXT [ english_us ] = "Neues, leeres Fenster öffnen"; + AccelKey = KeyCode { Function = KEYFUNC_NEW; }; + TEXT[ portuguese ] = "~Novo"; + TEXT[ russian ] = "~New"; + TEXT[ greek ] = "~New"; + TEXT[ dutch ] = "~Nieuw"; + TEXT[ french ] = "~Nouveau"; + TEXT[ spanish ] = "~Nuevo"; + TEXT[ italian ] = "~New"; + TEXT[ danish ] = "~New"; + TEXT[ swedish ] = "~New"; + TEXT[ polish ] = "~New "; + TEXT[ portuguese_brazilian ] = "~Neu"; + TEXT[ japanese ] = "V‹Kì¬(~N)"; + TEXT[ korean ] = "»õ·Î(~N)"; + TEXT[ chinese_simplified ] = "~Neu"; + TEXT[ chinese_traditional ] = "~New"; + TEXT[ arabic ] = "~New"; + TEXT[ turkish ] = "Y~eni"; + }; + MenuItem { + Identifier = RID_FILEOPEN; + TEXT = "Ö~ffnen..."; + TEXT [ english_us ] = "~Open..."; + HELPTEXT = "Datei in Fenster einlesen"; + HELPTEXT [ english_us ] = "Datei in Fenster einlesen"; + AccelKey = KeyCode { Function = KEYFUNC_OPEN; }; + TEXT[ portuguese ] = "A~brir..."; + TEXT[ russian ] = "~Open..."; + TEXT[ greek ] = "~Open..."; + TEXT[ dutch ] = "O~penen..."; + TEXT[ french ] = "~Ouvrir..."; + TEXT[ spanish ] = "A~brir..."; + TEXT[ italian ] = "~Open..."; + TEXT[ danish ] = "~Open..."; + TEXT[ swedish ] = "~Open..."; + TEXT[ polish ] = "~Open... "; + TEXT[ portuguese_brazilian ] = "Ö~ffnen..."; + TEXT[ japanese ] = "ŠJ‚(~O)..."; + TEXT[ korean ] = "¿±â(~O)..."; + TEXT[ chinese_simplified ] = "Ö~ffnen..."; + TEXT[ chinese_traditional ] = "~Open..."; + TEXT[ arabic ] = "~Open..."; + TEXT[ turkish ] = "~Aç..."; + }; + MenuItem { + SEPARATOR = TRUE; + }; + MenuItem { + Identifier = RID_FILECLOSE; + TEXT = "S~chließen"; + TEXT [ english_us ] = "~Close"; + HELPTEXT = "Fenster schließen"; + HELPTEXT [ english_us ] = "Fenster schließen"; + TEXT[ portuguese ] = "~Fechar"; + TEXT[ russian ] = "~Close"; + TEXT[ greek ] = "~Close"; + TEXT[ dutch ] = "S~luiten"; + TEXT[ french ] = "~Fermer"; + TEXT[ spanish ] = "~Cerrar"; + TEXT[ italian ] = "~Close"; + TEXT[ danish ] = "~Close"; + TEXT[ swedish ] = "~Close"; + TEXT[ polish ] = "~Close "; + TEXT[ portuguese_brazilian ] = "S~chließen"; + TEXT[ japanese ] = "•‚¶‚é(~C)"; + TEXT[ korean ] = "´Ý±â(~C)"; + TEXT[ chinese_simplified ] = "S~chließen"; + TEXT[ chinese_traditional ] = "~Close"; + TEXT[ arabic ] = "~Close"; + TEXT[ turkish ] = "Kapa~t"; + }; + MenuItem { + Identifier = RID_FILESAVE; + TEXT = "~Speichern"; + TEXT [ english_us ] = "~Save"; + HELPTEXT = "Datei unter dem aktuellen Namen speichern"; + HELPTEXT [ english_us ] = "Datei unter dem aktuellen Namen speichern"; + AccelKey = KeyCode { Function = KEYFUNC_SAVE; }; + TEXT[ portuguese ] = "~Guardar"; + TEXT[ russian ] = "~Save"; + TEXT[ greek ] = "~Save"; + TEXT[ dutch ] = "~Opslaan"; + TEXT[ french ] = "~Enregistrer"; + TEXT[ spanish ] = "~Guardar"; + TEXT[ italian ] = "~Save"; + TEXT[ danish ] = "~Save"; + TEXT[ swedish ] = "~Save"; + TEXT[ polish ] = "~Save "; + TEXT[ portuguese_brazilian ] = "~Speichern"; + TEXT[ japanese ] = "•Û‘¶(~S)"; + TEXT[ korean ] = "ÀúÀå(~S)"; + TEXT[ chinese_simplified ] = "~Speichern"; + TEXT[ chinese_traditional ] = "~Save"; + TEXT[ arabic ] = "~Save"; + TEXT[ turkish ] = "Kay~det"; + }; + MenuItem { + Identifier = RID_FILESAVEAS; + TEXT = "Speichern ~unter..."; + TEXT [ english_us ] = "Save~ As..."; + HELPTEXT = "Datei unter einem neuen Namen speichern"; + HELPTEXT [ english_us ] = "Datei unter einem neuen Namen speichern"; + AccelKey = KeyCode { Function = KEYFUNC_SAVEAS; }; + TEXT[ portuguese ] = "Guardar ~como..."; + TEXT[ russian ] = "Save~ As..."; + TEXT[ greek ] = "Save~ As..."; + TEXT[ dutch ] = "Opslaan ~als..."; + TEXT[ french ] = "Enregistrer ~sous..."; + TEXT[ spanish ] = "Guardar ~como..."; + TEXT[ italian ] = "Save ~As..."; + TEXT[ danish ] = "Save~ As..."; + TEXT[ swedish ] = "Save ~As..."; + TEXT[ polish ] = "Save~ As... "; + TEXT[ portuguese_brazilian ] = "Speichern ~unter..."; + TEXT[ japanese ] = "ã‘‚«•Û‘¶(~U)..."; + TEXT[ korean ] = "´Ù¸¥ À̸§À¸·Î ÀúÀå(~ )..."; + TEXT[ chinese_simplified ] = "Speichern ~unter..."; + TEXT[ chinese_traditional ] = "Save ~as..."; + TEXT[ arabic ] = "Save~ As..."; + TEXT[ turkish ] = "~Farklý kaydet..."; + }; + MenuItem { + SEPARATOR = TRUE; + }; + MenuItem { + Identifier = RID_FILELOADLIB; + TEXT = "~Library laden..."; + TEXT [ english_us ] = "~Load Library..."; + HELPTEXT = "Modul-Library laden und aktivieren"; + HELPTEXT [ english_us ] = "Modul-Library laden und aktivieren"; + TEXT[ portuguese ] = "~Carregar biblioteca..."; + TEXT[ russian ] = "~Load Library..."; + TEXT[ greek ] = "~Load Library..."; + TEXT[ dutch ] = "~Library laden..."; + TEXT[ french ] = "Charger la ~bibliothèque..."; + TEXT[ spanish ] = "Cargar ~Biblioteca..."; + TEXT[ italian ] = "~Load Library..."; + TEXT[ danish ] = "~Load Library..."; + TEXT[ swedish ] = "~Load Library..."; + TEXT[ polish ] = "~Load Library... "; + TEXT[ portuguese_brazilian ] = "~Library laden..."; + TEXT[ japanese ] = "ײÌÞר‚̓ǂݞ‚Ý(~L)..."; + TEXT[ korean ] = "·Îµå ¶óÀ̺귯¸®(~L)..."; + TEXT[ chinese_simplified ] = "~Library laden..."; + TEXT[ chinese_traditional ] = "~Load Library..."; + TEXT[ arabic ] = "~Load Library..."; + TEXT[ turkish ] = "~Kitaplýðý yükle"; + }; + MenuItem { + Identifier = RID_FILESAVELIB; + TEXT = "Li~brary speichern..."; + TEXT [ english_us ] = "Save Li~brary..."; + HELPTEXT = "Aktuelle Module als Library speichern"; + HELPTEXT [ english_us ] = "Aktuelle Module als Library speichern"; + TEXT[ portuguese ] = "~Guardar biblioteca..."; + TEXT[ russian ] = "Save Li~brary..."; + TEXT[ greek ] = "Save Li~brary..."; + TEXT[ dutch ] = "Li~brary opslaan..."; + TEXT[ french ] = "En~registrer la bibliothèque..."; + TEXT[ spanish ] = "Guardar Bibli~oteca..."; + TEXT[ italian ] = "Save Li~brary..."; + TEXT[ danish ] = "Save Li~brary..."; + TEXT[ swedish ] = "Save Li~brary..."; + TEXT[ polish ] = "Save Li~brary... "; + TEXT[ portuguese_brazilian ] = "Li~brary speichern..."; + TEXT[ japanese ] = "ײÌÞר‚̕ۑ¶(~B)..."; + TEXT[ korean ] = "¶óÀ̺귯¸® ÀúÀå(~B)..."; + TEXT[ chinese_simplified ] = "Li~brary speichern..."; + TEXT[ chinese_traditional ] = "Save L~ibrary..."; + TEXT[ arabic ] = "Save Li~brary..."; + TEXT[ turkish ] = "Kitaplýðý kaydet..."; + }; + MenuItem { + SEPARATOR = TRUE; + }; + MenuItem { + Identifier = RID_FILEPRINT; + TEXT = "~Drucken"; + TEXT [ english_us ] = "~Print"; + HELPTEXT = "Datei ausdrucken"; + HELPTEXT [ english_us ] = "Datei ausdrucken"; + TEXT[ portuguese ] = "~Imprimir"; + TEXT[ russian ] = "~Print"; + TEXT[ greek ] = "~Print"; + TEXT[ dutch ] = "~Afdrukken"; + TEXT[ french ] = "~Imprimer"; + TEXT[ spanish ] = "~Imprimir"; + TEXT[ italian ] = "~Print"; + TEXT[ danish ] = "~Print"; + TEXT[ swedish ] = "~Print"; + TEXT[ polish ] = "~Print "; + TEXT[ portuguese_brazilian ] = "~Drucken"; + TEXT[ japanese ] = "ˆóü(~P)"; + TEXT[ korean ] = "Àμâ(~P)"; + TEXT[ chinese_simplified ] = "~Drucken"; + TEXT[ chinese_traditional ] = "~Print"; + TEXT[ arabic ] = "~Print"; + TEXT[ turkish ] = "~Yazdýr"; + }; + MenuItem { + Identifier = RID_FILESETUP; + TEXT = "Druckereinstellun~g..."; + TEXT [ english_us ] = "P~rinter Setting..."; + HELPTEXT = "Drucker einrichten"; + HELPTEXT [ english_us ] = "Drucker einrichten"; + TEXT[ portuguese ] = "Configurar ~impressora..."; + TEXT[ russian ] = "P~rinter Setup..."; + TEXT[ greek ] = "P~rinter Setup..."; + TEXT[ dutch ] = "Printerinstellin~g..."; + TEXT[ french ] = "Para~métrage de l'imprimante..."; + TEXT[ spanish ] = "~Configuración de impresora..."; + TEXT[ italian ] = "P~rinter Setup..."; + TEXT[ danish ] = "P~rinter Setup..."; + TEXT[ swedish ] = "P~rinter Setup..."; + TEXT[ polish ] = "P~rinter Setup... "; + TEXT[ portuguese_brazilian ] = "Druckereinstellun~g..."; + TEXT[ japanese ] = "ˆóüÝ’è(~R)..."; + TEXT[ korean ] = "ÇÁ¸°ÅÍ ¼³Á¤(~R)..."; + TEXT[ chinese_simplified ] = "Druckereinstellun~g..."; + TEXT[ chinese_traditional ] = "~Printer Setup..."; + TEXT[ arabic ] = "P~rinter Setup..."; + TEXT[ turkish ] = "Yazýcý ayarlarý..."; + }; + MenuItem { + SEPARATOR = TRUE; + }; + MenuItem { + Identifier = RID_QUIT; + TEXT = "~Beenden"; + TEXT [ english_us ] = "~Exit"; + HELPTEXT = "Programm beenden"; + HELPTEXT [ english_us ] = "Programm beenden"; + AccelKey = KeyCode { Function = KEYFUNC_QUIT; }; + TEXT[ portuguese ] = "~Sair"; + TEXT[ russian ] = "Âûõîä"; + TEXT[ greek ] = "~Exit"; + TEXT[ dutch ] = "~Beëindigen"; + TEXT[ french ] = "~Quitter"; + TEXT[ spanish ] = "~Terminar"; + TEXT[ italian ] = "~Exit"; + TEXT[ danish ] = "~Exit"; + TEXT[ swedish ] = "~Exit"; + TEXT[ polish ] = "~Exit "; + TEXT[ portuguese_brazilian ] = "~Beenden"; + TEXT[ japanese ] = "I—¹(~X)"; + TEXT[ korean ] = "Á¾·á(~E)"; + TEXT[ chinese_simplified ] = "~Beenden"; + TEXT[ chinese_traditional ] = "~Exit"; + TEXT[ arabic ] = "~Exit"; + TEXT[ turkish ] = "Çý~kýþ"; + }; + }; +}; +Menu RID_EDIT { + ITEMLIST = { + MenuItem { + Identifier = RID_EDITUNDO; + TEXT = "~Rückgängig"; + TEXT [ english_us ] = "~Undo"; + HELPTEXT = "Die letzte Änderung rückgängig machen"; + HELPTEXT [ english_us ] = "Die letzte Änderung rückgängig machen"; +// AccelKey = KeyCode { Function = KEYFUNC_CUT; }; + TEXT[ portuguese ] = "~Desfazer"; + TEXT[ russian ] = "~Undo"; + TEXT[ greek ] = "~Undo"; + TEXT[ dutch ] = "~Ongedaan"; + TEXT[ french ] = "~Annuler"; + TEXT[ spanish ] = "~Deshacer"; + TEXT[ italian ] = "~Undo"; + TEXT[ danish ] = "~Undo"; + TEXT[ swedish ] = "~Undo"; + TEXT[ polish ] = "~Undo "; + TEXT[ portuguese_brazilian ] = "~Rückgängig"; + TEXT[ japanese ] = "Œ³‚É–ß‚·(~U)"; + TEXT[ korean ] = "½ÇÇàÃë¼Ò(~U)"; + TEXT[ chinese_simplified ] = "~Rückgängig"; + TEXT[ chinese_traditional ] = "~Undo"; + TEXT[ arabic ] = "ÊÑÇÌÚ"; + TEXT[ turkish ] = "Geri ~al"; + }; + MenuItem { + Identifier = RID_EDITREDO; + TEXT = "~Wiederholen"; + TEXT [ english_us ] = "~Repeat"; + HELPTEXT = "Die zuletzt rückgängig gemachte Änderung wiederherstellen"; + HELPTEXT [ english_us ] = "Die zuletzt rückgängig gemachte Änderung wiederherstellen"; +// AccelKey = KeyCode { Function = KEYFUNC_CUT; }; + TEXT[ portuguese ] = "~Repetir"; + TEXT[ russian ] = "~Repeat"; + TEXT[ greek ] = "~Repeat"; + TEXT[ dutch ] = "~Herhalen"; + TEXT[ french ] = "~Répéter"; + TEXT[ spanish ] = "~Repetir"; + TEXT[ italian ] = "~Repeat"; + TEXT[ danish ] = "~Repeat"; + TEXT[ swedish ] = "~Repeat"; + TEXT[ polish ] = "~Repeat "; + TEXT[ portuguese_brazilian ] = "~Wiederholen"; + TEXT[ japanese ] = "‚â‚è’¼‚µ(~R)"; + TEXT[ korean ] = "Àç½ÇÇà(~R)"; + TEXT[ chinese_simplified ] = "~Wiederholen"; + TEXT[ chinese_traditional ] = "~Repeat"; + TEXT[ arabic ] = "~Repeat"; + TEXT[ turkish ] = "~Yinele"; + }; + MenuItem { + SEPARATOR = TRUE; + }; + MenuItem { + Identifier = RID_EDITCUT; + TEXT = "~Ausschneiden"; + TEXT [ english_us ] = "~Cut"; + HELPTEXT = "Markierten Text in Zwischenablage ablegen"; + HELPTEXT [ english_us ] = "Markierten Text in Zwischenablage ablegen"; + AccelKey = KeyCode { Function = KEYFUNC_CUT; }; + TEXT[ portuguese ] = "Cor~tar"; + TEXT[ russian ] = "~Cut"; + TEXT[ greek ] = "~Cut"; + TEXT[ dutch ] = "~Knippen"; + TEXT[ french ] = "~Couper"; + TEXT[ spanish ] = "~Cortar"; + TEXT[ italian ] = "~Cut"; + TEXT[ danish ] = "~Cut"; + TEXT[ swedish ] = "~Cut"; + TEXT[ polish ] = "~Cut "; + TEXT[ portuguese_brazilian ] = "~Ausschneiden"; + TEXT[ japanese ] = "Ø‚èŽæ‚è(~T)"; + TEXT[ korean ] = "Àß¶ó³»±â(~C)"; + TEXT[ chinese_simplified ] = "~Ausschneiden"; + TEXT[ chinese_traditional ] = "~Cut"; + TEXT[ arabic ] = "~Cut"; + TEXT[ turkish ] = "Kes"; + }; + MenuItem { + Identifier = RID_EDITCOPY; + TEXT = "~Kopieren"; + TEXT [ english_us ] = "~Copy"; + HELPTEXT = "Markierten Text in Zwischenablage kopieren"; + HELPTEXT [ english_us ] = "Markierten Text in Zwischenablage kopieren"; + AccelKey = KeyCode { Function = KEYFUNC_COPY; }; + TEXT[ portuguese ] = "~Copiar"; + TEXT[ russian ] = "~Copy"; + TEXT[ greek ] = "~Copy"; + TEXT[ dutch ] = "~Kopiëren"; + TEXT[ french ] = "Co~pier"; + TEXT[ spanish ] = "Copiar"; + TEXT[ italian ] = "~Copy"; + TEXT[ danish ] = "~Copy"; + TEXT[ swedish ] = "~Copy"; + TEXT[ polish ] = "~Copy "; + TEXT[ portuguese_brazilian ] = "~Kopieren"; + TEXT[ japanese ] = "ºËß°(~C)"; + TEXT[ korean ] = "º¹»ç(~C)"; + TEXT[ chinese_simplified ] = "~Kopieren"; + TEXT[ chinese_traditional ] = "~Copy"; + TEXT[ arabic ] = "~Copy"; + TEXT[ turkish ] = "Kopyala"; + }; + MenuItem { + Identifier = RID_EDITPASTE; + TEXT = "E~infügen"; + TEXT [ english_us ] = "~Paste"; + HELPTEXT = "Inhalt der Zwischenablage einfügen"; + HELPTEXT [ english_us ] = "Inhalt der Zwischenablage einfügen"; + AccelKey = KeyCode { Function = KEYFUNC_PASTE; }; + TEXT[ portuguese ] = "In~serir"; + TEXT[ russian ] = "~Paste"; + TEXT[ greek ] = "~Paste"; + TEXT[ dutch ] = "I~nvoegen"; + TEXT[ french ] = "C~oller"; + TEXT[ spanish ] = "In~sertar"; + TEXT[ italian ] = "~Paste"; + TEXT[ danish ] = "~Paste"; + TEXT[ swedish ] = "~Paste"; + TEXT[ polish ] = "~Paste "; + TEXT[ portuguese_brazilian ] = "E~infügen"; + TEXT[ japanese ] = "“\\‚è•t‚¯(~P)"; + TEXT[ korean ] = "ºÙ¿©³Ö±â(~P)"; + TEXT[ chinese_simplified ] = "E~infügen"; + TEXT[ chinese_traditional ] = "~Paste"; + TEXT[ arabic ] = "~Insert"; + TEXT[ turkish ] = "Ekle"; + }; + MenuItem { + Identifier = RID_EDITDEL; + TEXT = "~Löschen"; + TEXT [ english_us ] = "~Delete"; + HELPTEXT = "Markierten Text löschen"; + HELPTEXT [ english_us ] = "Markierten Text löschen"; + AccelKey = KeyCode { Function = KEYFUNC_DELETE; }; + TEXT[ portuguese ] = "E~liminar"; + TEXT[ russian ] = "~Delete"; + TEXT[ greek ] = "~Delete"; + TEXT[ dutch ] = "~Wissen"; + TEXT[ french ] = "~Supprimer"; + TEXT[ spanish ] = "~Eliminar"; + TEXT[ italian ] = "~Delete"; + TEXT[ danish ] = "~Delete"; + TEXT[ swedish ] = "~Delete"; + TEXT[ polish ] = "~Delete "; + TEXT[ portuguese_brazilian ] = "~Löschen"; + TEXT[ japanese ] = "íœ(~D)"; + TEXT[ korean ] = "Áö¿ì±â(~D)"; + TEXT[ chinese_simplified ] = "~Löschen"; + TEXT[ chinese_traditional ] = "~Delete"; + TEXT[ arabic ] = "~Delete"; + TEXT[ turkish ] = "Sil"; + }; + MenuItem { + SEPARATOR = TRUE; + }; + MenuItem { + Identifier = RID_EDITSEARCH; + TEXT = "~Suchen..."; + TEXT [ english_us ] = "~Find..."; + HELPTEXT = "Textstelle suchen"; + HELPTEXT [ english_us ] = "Textstelle suchen"; + AccelKey = KeyCode { Function = KEYFUNC_FIND; }; + TEXT[ portuguese ] = "~Localizar..."; + TEXT[ russian ] = "~Find..."; + TEXT[ greek ] = "~Find..."; + TEXT[ dutch ] = "~Zoeken..."; + TEXT[ french ] = "~Rechercher..."; + TEXT[ spanish ] = "~Buscar..."; + TEXT[ italian ] = "~Find..."; + TEXT[ danish ] = "~Find..."; + TEXT[ swedish ] = "~Find..."; + TEXT[ polish ] = "~Find... "; + TEXT[ portuguese_brazilian ] = "~Suchen..."; + TEXT[ japanese ] = "ŒŸõ(~F)..."; + TEXT[ korean ] = "ã±â(~F)..."; + TEXT[ chinese_simplified ] = "~Suchen..."; + TEXT[ chinese_traditional ] = "~Find..."; + TEXT[ arabic ] = "~Find..."; + TEXT[ turkish ] = "Ara..."; + }; + MenuItem { + Identifier = RID_EDITREPLACE; + TEXT = "~Ersetzen..."; + TEXT [ english_us ] = "~Replace..."; + HELPTEXT = "Textstelle durch anderen Text ersetzen"; + HELPTEXT [ english_us ] = "Textstelle durch anderen Text ersetzen"; + TEXT[ portuguese ] = "~Substituir..."; + TEXT[ russian ] = "~Replace..."; + TEXT[ greek ] = "~Replace..."; + TEXT[ dutch ] = "~Vervangen..."; + TEXT[ french ] = "R~emplacer..."; + TEXT[ spanish ] = "~Sustituir..."; + TEXT[ italian ] = "~Replace..."; + TEXT[ danish ] = "~Replace..."; + TEXT[ swedish ] = "~Replace..."; + TEXT[ polish ] = "~Replace... "; + TEXT[ portuguese_brazilian ] = "~Ersetzen..."; + TEXT[ japanese ] = "’uŠ·(~R)..."; + TEXT[ korean ] = "¹Ù²Ù±â(~R)..."; + TEXT[ chinese_simplified ] = "~Ersetzen..."; + TEXT[ chinese_traditional ] = "~Replace..."; + TEXT[ arabic ] = "~Replace..."; + TEXT[ turkish ] = "Deðiþtir..."; + }; + MenuItem { + Identifier = RID_EDITREPEAT; + TEXT = "S~uchen Wiederholen"; + TEXT [ english_us ] = "Repeat S~earch"; + HELPTEXT = "Suchen/ersetzen wiederholen"; + HELPTEXT [ english_us ] = "Suchen/ersetzen wiederholen"; + AccelKey = KeyCode { Code = KEY_F3; }; +// AccelKey = KeyCode { Function = KEYFUNC_REPEAT; }; + TEXT[ portuguese ] = "~Repetir Localizar"; + TEXT[ russian ] = "Repeat S~earch"; + TEXT[ greek ] = "Repeat S~earch"; + TEXT[ dutch ] = "Z~oeken herhalen"; + TEXT[ french ] = "Ré~péter la recherche"; + TEXT[ spanish ] = "~Repetir búsqueda"; + TEXT[ italian ] = "Repeat S~earch"; + TEXT[ danish ] = "Repeat S~earch"; + TEXT[ swedish ] = "Repeat S~earch"; + TEXT[ polish ] = "Repeat S~earch "; + TEXT[ portuguese_brazilian ] = "S~uchen Wiederholen"; + TEXT[ japanese ] = "ŒŸõ‚ÌŒJ‚è•Ô‚µ(~U)"; + TEXT[ korean ] = "´Ù½Ã ã±â(~E)"; + TEXT[ chinese_simplified ] = "S~uchen Wiederholen"; + TEXT[ chinese_traditional ] = "Repeat S~earch"; + TEXT[ arabic ] = "Repeat S~earch"; + TEXT[ turkish ] = "Yeniden ara"; + }; + }; +}; +Menu RID_RUN { + ITEMLIST = { + MenuItem { + Identifier = RID_RUNCOMPILE; + TEXT = "~Compilieren"; + TEXT [ english_us ] = "~Compile"; + HELPTEXT = "Programm übersetzen"; + HELPTEXT [ english_us ] = "Programm übersetzen"; + AccelKey = KeyCode { Code = KEY_F5; Shift = TRUE; }; + TEXT[ portuguese ] = "~Compilar"; + TEXT[ russian ] = "~Compile"; + TEXT[ greek ] = "~Compile"; + TEXT[ dutch ] = "~Compileren"; + TEXT[ french ] = "~Compiler"; + TEXT[ spanish ] = "~Compilar"; + TEXT[ italian ] = "~Compile"; + TEXT[ danish ] = "~Compile"; + TEXT[ swedish ] = "~Compile"; + TEXT[ polish ] = "~Compile "; + TEXT[ portuguese_brazilian ] = "~Compilieren"; + TEXT[ japanese ] = "ºÝÊß²Ù‚ðs‚¤"; + TEXT[ korean ] = "ÄÄÆÄÀÏ(~C)"; + TEXT[ chinese_simplified ] = "~Compilieren"; + TEXT[ chinese_traditional ] = "~Compile"; + TEXT[ arabic ] = "~Compile"; + TEXT[ turkish ] = "~Derle"; + }; + MenuItem { + Identifier = RID_RUNDISAS; + TEXT = "~Disassemblieren"; + TEXT [ english_us ] = "~Disassemble"; + HELPTEXT = "Programm disassemblieren und Ergebnis ins Clipboard stellen"; + HELPTEXT [ english_us ] = "Programm disassemblieren und Ergebnis ins Clipboard stellen"; + TEXT[ portuguese ] = "~Descodificar"; + TEXT[ russian ] = "~Disassemble"; + TEXT[ greek ] = "~Disassemble"; + TEXT[ dutch ] = "~Disassembleren"; + TEXT[ french ] = "~Désassembler"; + TEXT[ spanish ] = "~Desensamblar"; + TEXT[ italian ] = "~Disassemble"; + TEXT[ danish ] = "~Disassemble"; + TEXT[ swedish ] = "~Disassemble"; + TEXT[ polish ] = "~Disassemble "; + TEXT[ portuguese_brazilian ] = "~Disassemblieren"; + TEXT[ japanese ] = "~Disassemble"; + TEXT[ korean ] = "ÇØÃ¼(~D)"; + TEXT[ chinese_simplified ] = "~Disassemblieren"; + TEXT[ chinese_traditional ] = "~Disassemble"; + TEXT[ arabic ] = "~Disassemble"; + TEXT[ turkish ] = "~Disassemble"; + }; + MenuItem { + Identifier = RID_RUNSTART; + TEXT = "~Start"; + TEXT [ english_us ] = "~Start"; + HELPTEXT = "Programm starten"; + HELPTEXT [ english_us ] = "Programm starten"; + AccelKey = KeyCode { Code = KEY_F5; }; + TEXT[ portuguese ] = "~Iniciar"; + TEXT[ russian ] = "~Start"; + TEXT[ greek ] = "~Start"; + TEXT[ dutch ] = "~Start"; + TEXT[ french ] = "~Démarrer"; + TEXT[ spanish ] = "~Iniciar"; + TEXT[ italian ] = "~Start"; + TEXT[ danish ] = "~Start"; + TEXT[ swedish ] = "~Start"; + TEXT[ polish ] = "~Start"; + TEXT[ portuguese_brazilian ] = "~Start"; + TEXT[ japanese ] = "½À°Ä"; + TEXT[ korean ] = "½ÃÀÛ(~S)"; + TEXT[ chinese_simplified ] = "~Start"; + TEXT[ chinese_traditional ] = "~Start"; + TEXT[ arabic ] = "~Start"; + TEXT[ turkish ] = "~Baþlat"; + }; + MenuItem { + Identifier = RID_RUNSTEPINTO; + TEXT = "~Einzelschritt"; + TEXT [ english_us ] = "~Single Stepping"; + HELPTEXT = "Ein Programmschritt"; + HELPTEXT [ english_us ] = "Ein Programmschritt"; + AccelKey = KeyCode { Code = KEY_F8; }; + TEXT[ portuguese ] = "Pa~sso a passo"; + TEXT[ russian ] = "~Single Stepping"; + TEXT[ greek ] = "~Single Stepping"; + TEXT[ dutch ] = "~Stap voor stap"; + TEXT[ french ] = "É~tape par étape"; + TEXT[ spanish ] = "~Paso a paso"; + TEXT[ italian ] = "~Single Stepping"; + TEXT[ danish ] = "~Single Stepping"; + TEXT[ swedish ] = "~Single stepping"; + TEXT[ polish ] = "~Single Stepping "; + TEXT[ portuguese_brazilian ] = "~Einzelschritt"; + TEXT[ japanese ] = "~Single Stepping"; + TEXT[ korean ] = "°³º° ´Ü°è(~S)"; + TEXT[ chinese_simplified ] = "~Einzelschritt"; + TEXT[ chinese_traditional ] = "~Single Stepping"; + TEXT[ arabic ] = "~Single Stepping"; + TEXT[ turkish ] = "~Tek adým"; + }; + MenuItem { + Identifier = RID_RUNSTEPOVER; + TEXT = "Einzelschritt über ~Prozeduren"; + TEXT [ english_us ] = "Si~ngle Step over Procedure"; + HELPTEXT = "Ein Programmschritt, ohne Prozeduren"; + HELPTEXT [ english_us ] = "Ein Programmschritt, ohne Prozeduren"; + AccelKey = KeyCode { Code = KEY_F10; }; + TEXT[ portuguese ] = "~Procedimentos passo a passo"; + TEXT[ russian ] = "Si~ngle Step over Procedure"; + TEXT[ greek ] = "Si~ngle Step over Procedure"; + TEXT[ dutch ] = "Stap voor stap ~procedures"; + TEXT[ french ] = "~Procédures étape par étape"; + TEXT[ spanish ] = "Procesos ~paso a paso"; + TEXT[ italian ] = "Si~ngle Stepping (subroutines excluded)"; + TEXT[ danish ] = "Si~ngle Step over Procedure"; + TEXT[ swedish ] = "Si~ngle Step over Procedure"; + TEXT[ polish ] = "Si~ngle Step over Procedure"; + TEXT[ portuguese_brazilian ] = "Einzelschritt über ~Prozeduren"; + TEXT[ japanese ] = "Si~ngle Stepping (subroutines excluded)"; + TEXT[ korean ] = "ÇÁ·Î½ÃÀú À§ÀÇ °³º° ´Ü°è(~N)"; + TEXT[ chinese_simplified ] = "Einzelschritt über ~Prozeduren"; + TEXT[ chinese_traditional ] = "Si~ngle Step over Procedure"; + TEXT[ arabic ] = "Si~ngle Step over Procedure"; + TEXT[ turkish ] = "Si~ngle Step over Procedure"; + }; +// MenuItem { +// Identifier = RID_RUNTOCURSOR; +// TEXT = "Ausführen ~bis Cursor"; +// TEXT [ english_us ] = "Ausführen ~bis Cursor"; +// HELPTEXT = "Ausführen des Programmes bis zur aktuellen Cursorposition"; +// HELPTEXT [ english_us ] = "Ausführen des Programmes bis zur aktuellen Cursorposition"; +// AccelKey = KeyCode { Code = KEY_F7; }; +// }; + MenuItem { + Identifier = RID_TOGLEBRKPNT; + TEXT = "Brechpunkt setzen/löschen"; + TEXT [ english_us ] = "Set / Delete Break Point"; + HELPTEXT = "Brechpunkt setzen/löschen an der aktuellen Cursorposition"; + HELPTEXT [ english_us ] = "Brechpunkt setzen/löschen an der aktuellen Cursorposition"; + AccelKey = KeyCode { Code = KEY_F9; }; + TEXT[ portuguese ] = "Colocar/Eliminar ponto de quebra "; + TEXT[ russian ] = "Set / Delete Break Point"; + TEXT[ greek ] = "Set / Delete Break Point"; + TEXT[ dutch ] = "Break point zetten/wissen"; + TEXT[ french ] = "Placer / supprimer un point d'arrêt (breakpoint)"; + TEXT[ spanish ] = "Poner/eliminar punto de detención"; + TEXT[ italian ] = "Set / Delete Break Point"; + TEXT[ danish ] = "Set / Delete Break Point"; + TEXT[ swedish ] = "Set / Delete Break Point"; + TEXT[ polish ] = "Set / Delete Break Point"; + TEXT[ portuguese_brazilian ] = "Brechpunkt setzen/löschen"; + TEXT[ japanese ] = "Set / Delete Break Point"; + TEXT[ korean ] = "Break Æ÷ÀÎÆ® ¼³Á¤/»èÁ¦"; + TEXT[ chinese_simplified ] = "Brechpunkt setzen/löschen"; + TEXT[ chinese_traditional ] = "Set / Delete Break Point"; + TEXT[ arabic ] = "Set / Delete Break Point"; + TEXT[ turkish ] = "Set / Delete Break Point"; + }; + MenuItem { + Identifier = RID_RUNBREAK; + TEXT = "~Unterbrechen"; + TEXT [ english_us ] = "~Interrupt"; + HELPTEXT = "Programmlauf unterbrechen"; + HELPTEXT [ english_us ] = "Programmlauf unterbrechen"; + AccelKey = KeyCode { Code = KEY_F5; Modifier1 = TRUE; }; + TEXT[ portuguese ] = "~Interromper"; + TEXT[ russian ] = "~Interrupt"; + TEXT[ greek ] = "~Interrupt"; + TEXT[ dutch ] = "~Onderbreken"; + TEXT[ french ] = "~Interrompre"; + TEXT[ spanish ] = "Interru~mpir"; + TEXT[ italian ] = "~Interrupt"; + TEXT[ danish ] = "~Interrupt"; + TEXT[ swedish ] = "~Interrupt"; + TEXT[ polish ] = "~Interrupt "; + TEXT[ portuguese_brazilian ] = "~Unterbrechen"; + TEXT[ japanese ] = "’†’f"; + TEXT[ korean ] = "ÀÎÅÍ·´Æ®(~I)"; + TEXT[ chinese_simplified ] = "~Unterbrechen"; + TEXT[ chinese_traditional ] = "~Interrupt"; + TEXT[ arabic ] = "~Interrupt"; + TEXT[ turkish ] = "~Duraklat"; + }; + MenuItem { + Identifier = RID_RUNSTOP; + TEXT = "~Abbrechen"; + TEXT [ english_us ] = "~Cancel"; + HELPTEXT = "Programmlauf abbrechen"; + HELPTEXT [ english_us ] = "Programmlauf abbrechen"; + TEXT[ portuguese ] = "~Cancelar"; + TEXT[ russian ] = "~Cancel"; + TEXT[ greek ] = "~Cancel"; + TEXT[ dutch ] = "~Stoppen"; + TEXT[ french ] = "~Annuler"; + TEXT[ spanish ] = "~Cancelar"; + TEXT[ italian ] = "~Cancel"; + TEXT[ danish ] = "~Cancel"; + TEXT[ swedish ] = "~Cancel"; + TEXT[ polish ] = "~Cancel"; + TEXT[ portuguese_brazilian ] = "~Abbrechen"; + TEXT[ japanese ] = "·¬Ý¾Ù"; + TEXT[ korean ] = "Ãë¼Ò(~C)"; + TEXT[ chinese_simplified ] = "~Abbrechen"; + TEXT[ chinese_traditional ] = "~Cancel"; + TEXT[ arabic ] = "~Cancel"; + TEXT[ turkish ] = "~Ýptal"; + }; + MenuItem { + Identifier = RID_RUNNEXTERR; + TEXT = "~Nächster Fehler"; + TEXT [ english_us ] = "~Next Error"; + HELPTEXT = "Den nächsten Programmfehler anzeigen"; + HELPTEXT [ english_us ] = "Den nächsten Programmfehler anzeigen"; + AccelKey = KeyCode { Code = KEY_F8; Shift = TRUE; }; + TEXT[ portuguese ] = "Erro ~seguinte"; + TEXT[ russian ] = "~Next Error"; + TEXT[ greek ] = "~Next Error"; + TEXT[ dutch ] = "~Volgende fout"; + TEXT[ french ] = "~Erreur suivante"; + TEXT[ spanish ] = "~Error siguiente"; + TEXT[ italian ] = "Errore successivo"; + TEXT[ danish ] = "~Next Error"; + TEXT[ swedish ] = "~Next Error"; + TEXT[ polish ] = "~Next Error"; + TEXT[ portuguese_brazilian ] = "~Nächster Fehler"; + TEXT[ japanese ] = "ŽŸ‚Ì´×°"; + TEXT[ korean ] = "´ÙÀ½ ¿À·ù(~N)"; + TEXT[ chinese_simplified ] = "~Nächster Fehler"; + TEXT[ chinese_traditional ] = "~Next Error"; + TEXT[ arabic ] = "~Next Error"; + TEXT[ turkish ] = "~Sonraki hata"; + }; + MenuItem { + Identifier = RID_RUNPREVERR; + TEXT = "~Vorheriger Fehler"; + TEXT [ english_us ] = "~Previous Error"; + HELPTEXT = "Den vorherigen Programmfehler anzeigen"; + HELPTEXT [ english_us ] = "Den vorherigen Programmfehler anzeigen"; + AccelKey = KeyCode { Code = KEY_F7; Shift = TRUE; }; + TEXT[ portuguese ] = "Erro ~anterior"; + TEXT[ russian ] = "~Previous Error"; + TEXT[ greek ] = "~Previous Error"; + TEXT[ dutch ] = "~Vorige fout"; + TEXT[ french ] = "~Erreur précédente"; + TEXT[ spanish ] = "Error ~anterior"; + TEXT[ italian ] = "~Previous error"; + TEXT[ danish ] = "~Previous Error"; + TEXT[ swedish ] = "~Previous Error"; + TEXT[ polish ] = "~Previous Error"; + TEXT[ portuguese_brazilian ] = "~Vorheriger Fehler"; + TEXT[ japanese ] = "‘O‚Ì´×°"; + TEXT[ korean ] = "ÀÌÀü ¿À·ù(~P)"; + TEXT[ chinese_simplified ] = "~Vorheriger Fehler"; + TEXT[ chinese_traditional ] = "~Previous Error"; + TEXT[ arabic ] = "~Previous Error"; + TEXT[ turkish ] = "~Önceki hata"; + }; + MenuItem { + SEPARATOR = TRUE; + }; + }; +}; +// Wird nur beim Test Tool eingef³gt + +// unter Folgendem Name +String RID_TT_EXTRAS_NAME +{ + Text = "E~xtras"; + Text[ english_us ] = "E~xtras"; + Text[ portuguese ] = "~Ferramentas"; + Text[ russian ] = "Áîëüøå"; + Text[ greek ] = "E~xtras"; + Text[ dutch ] = "E~xtra"; + Text[ french ] = "~Outils"; + Text[ spanish ] = "~Herramientas"; + Text[ italian ] = "E~xtras"; + Text[ danish ] = "E~xtras"; + Text[ swedish ] = "E~xtras"; + Text[ polish ] = "Narzêdzia"; + Text[ portuguese_brazilian ] = "E~xtras"; + Text[ japanese ] = "E~xtras"; + Text[ korean ] = "º°µµ Ãß°¡(~X)"; + Text[ chinese_simplified ] = "E~xtras"; + Text[ chinese_traditional ] = "E~xtras"; + Text[ arabic ] = "E~xtras"; + Text[ turkish ] = "Araçlar"; +}; + +Menu RID_TT_EXTRAS { + ITEMLIST = { + MenuItem { + Identifier = RID_OPTIONS; + TEXT = "~Einstellungen"; + TEXT [ english_us ] = "~Settings"; + HELPTEXT = "Einstellungen f³r das Test Tool"; + HELPTEXT [ english_us ] = "Einstellungen f³r das Test Tool"; + TEXT[ portuguese ] = "~Definições"; + TEXT[ russian ] = "~Settings"; + TEXT[ greek ] = "~Settings"; + TEXT[ dutch ] = "~Instellingen"; + TEXT[ french ] = "~Paramètres"; + TEXT[ spanish ] = "~Configuración"; + TEXT[ italian ] = "~Settings"; + TEXT[ danish ] = "~Settings"; + TEXT[ swedish ] = "~Settings"; + TEXT[ polish ] = "~Settings"; + TEXT[ portuguese_brazilian ] = "~Einstellungen"; + TEXT[ japanese ] = "Ý’è"; + TEXT[ korean ] = "¼³Á¤(~S)"; + TEXT[ chinese_simplified ] = "~Einstellungen"; + TEXT[ chinese_traditional ] = "~Settings"; + TEXT[ arabic ] = "~Settings"; + TEXT[ turkish ] = "~Ayarlar"; + }; + MenuItem { + Identifier = RID_DECLARE_HELPER; + TEXT = "~Dialoge aufnehmen"; + TEXT [ english_us ] = "~Include Dialogs"; + HELPTEXT = "Modus zum aufnehmen der Dialoge aktivieren"; + HELPTEXT [ english_us ] = "Modus zum aufnehmen der Dialoge aktivieren"; + TEXT[ portuguese ] = "~Incluir caixas de diálogo"; + TEXT[ russian ] = "~Include Dialogs"; + TEXT[ greek ] = "~Include Dialogs"; + TEXT[ dutch ] = "~Dialogen opnemen"; + TEXT[ french ] = "Ajouter une boîte de ~dialogue"; + TEXT[ spanish ] = "In~cluir diálogos"; + TEXT[ italian ] = "~Include Dialogs"; + TEXT[ danish ] = "~Include Dialogs"; + TEXT[ swedish ] = "~Include Dialogs"; + TEXT[ polish ] = "~Include Dialogs"; + TEXT[ portuguese_brazilian ] = "~Dialoge aufnehmen"; + TEXT[ japanese ] = "ÀÞ²±Û¸Þ‚ðŽn‚ß‚é"; + TEXT[ korean ] = "´ÙÀ̾ó·Î±× Æ÷ÇÔ(~I)"; + TEXT[ chinese_simplified ] = "~Dialoge aufnehmen"; + TEXT[ chinese_traditional ] = "~Include Dialogs"; + TEXT[ arabic ] = "~Include Dialogs"; + TEXT[ turkish ] = "~Diyaloglarý ekle"; + }; + }; +}; +Menu RID_WINDOW { + ITEMLIST = { + MenuItem { + Identifier = RID_WINCASCADE; + TEXT = "~Überlappend"; + TEXT [ english_us ] = "~Overlapping"; + HELPTEXT = "Fenster überlappend anordnen"; + HELPTEXT [ english_us ] = "Fenster überlappend anordnen"; + TEXT[ portuguese ] = "Em ~cascata"; + TEXT[ russian ] = "~Overlapping"; + TEXT[ greek ] = "~Overlapping"; + TEXT[ dutch ] = "~Overlappend"; + TEXT[ french ] = "~Cascade"; + TEXT[ spanish ] = "~Cascada"; + TEXT[ italian ] = "~Overlapping"; + TEXT[ danish ] = "~Overlapping"; + TEXT[ swedish ] = "~Overlapping"; + TEXT[ polish ] = "~Overlapping"; + TEXT[ portuguese_brazilian ] = "~Überlappend"; + TEXT[ japanese ] = "d‚˂ĕ\\ަ"; + TEXT[ korean ] = "°ãÄ¡±â(~O)"; + TEXT[ chinese_simplified ] = "~Überlappend"; + TEXT[ chinese_traditional ] = "~Overlapping"; + TEXT[ arabic ] = "~Overlapping"; + TEXT[ turkish ] = "B~asamakla"; + }; + MenuItem { + Identifier = RID_WINTILE; + TEXT = "~Nebeneinander"; + TEXT [ english_us ] = "~Tile"; + HELPTEXT = "Fenster nebeneinander anordnen"; + HELPTEXT [ english_us ] = "Fenster nebeneinander anordnen"; + TEXT[ portuguese ] = "~Lado a lado"; + TEXT[ russian ] = "~Tile"; + TEXT[ greek ] = "~Tile"; + TEXT[ dutch ] = "~Naast elkaar"; + TEXT[ french ] = "Ca~rrelage"; + TEXT[ spanish ] = "~Mosaico"; + TEXT[ italian ] = "~Tile"; + TEXT[ danish ] = "~Tile"; + TEXT[ swedish ] = "~Tile"; + TEXT[ polish ] = "~Tile"; + TEXT[ portuguese_brazilian ] = "~Nebeneinander"; + TEXT[ japanese ] = "•À‚ׂĕ\\ަ"; + TEXT[ korean ] = "â ³ª´©±â(~T)"; + TEXT[ chinese_simplified ] = "~Nebeneinander"; + TEXT[ chinese_traditional ] = "~Tiled"; + TEXT[ arabic ] = "~Tiled"; + TEXT[ turkish ] = "~Yan yana"; + }; + MenuItem { + Identifier = RID_WINTILEHORZ; + TEXT = "~Horizontal anordnen"; + TEXT [ english_us ] = "~Arrange Horizontally"; + HELPTEXT = "Fenster horizontal übereinander anordnen"; + HELPTEXT [ english_us ] = "Fenster horizontal übereinander anordnen"; + TEXT[ portuguese ] = "~Dispor na horizontal"; + TEXT[ russian ] = "~Arrange Horizontally"; + TEXT[ greek ] = "~Arrange Horizontally"; + TEXT[ dutch ] = "~Horizontaal schikken"; + TEXT[ french ] = "~Aligner horizontalement"; + TEXT[ spanish ] = "~Horizontal"; + TEXT[ italian ] = "~Arrange Horizontally"; + TEXT[ danish ] = "~Arrange Horizontally"; + TEXT[ swedish ] = "~Arrange Horizontally"; + TEXT[ polish ] = "~Arrange Horizontally"; + TEXT[ portuguese_brazilian ] = "~Horizontal anordnen"; + TEXT[ japanese ] = "¶‰E‚É•À‚ׂĕ\\ަ"; + TEXT[ korean ] = "¼öÆò ³ª´©±â(~A)"; + TEXT[ chinese_simplified ] = "~Horizontal anordnen"; + TEXT[ chinese_traditional ] = "~Arrange Horizontally"; + TEXT[ arabic ] = "~Arrange Horizontally"; + TEXT[ turkish ] = "~Yatay yerleþtir"; + }; + MenuItem { + Identifier = RID_WINTILEVERT; + TEXT = "~Vertikal anordnen"; + TEXT [ english_us ] = "~Arrange Vertically"; + HELPTEXT = "Fenster vertikal nebeneinander anordnen"; + HELPTEXT [ english_us ] = "Fenster vertikal nebeneinander anordnen"; + TEXT[ portuguese ] = "~Dispor na vertical"; + TEXT[ russian ] = "~Arrange Vertically"; + TEXT[ greek ] = "~Arrange Vertically"; + TEXT[ dutch ] = "~Verticaal schikken"; + TEXT[ french ] = "~Verticalement"; + TEXT[ spanish ] = "~Vertical"; + TEXT[ italian ] = "~Arrange Vertically"; + TEXT[ danish ] = "~Arrange Vertically"; + TEXT[ swedish ] = "~Arrange Vertically"; + TEXT[ polish ] = "~Arrange Vertically"; + TEXT[ portuguese_brazilian ] = "~Vertikal anordnen"; + TEXT[ japanese ] = "㉺‚É•À‚ׂĕ\\ަ"; + TEXT[ korean ] = "¼öÁ÷ ³ª´©±â(~A)"; + TEXT[ chinese_simplified ] = "~Vertikal anordnen"; + TEXT[ chinese_traditional ] = "~Arrange Vertically"; + TEXT[ arabic ] = "~Arrange Vertically"; + TEXT[ turkish ] = "~Dikey yerleþtir"; + }; + }; +}; +Menu RID_HELP { + ITEMLIST = { +/* MenuItem { + Identifier = RID_HELPINDEX; + TEXT = "~Index"; + TEXT [ english_us ] = "~Index"; + HELPTEXT = "Inhaltsverzeichnis der Hilfe"; + HELPTEXT [ english_us ] = "Inhaltsverzeichnis der Hilfe"; + }; + MenuItem { + SEPARATOR = TRUE; + }; + MenuItem { + Identifier = RID_HELPKEYS; + TEXT = "~Tastaturbelegung"; + TEXT [ english_us ] = "~Tastaturbelegung"; + HELPTEXT = "Liste der definierten Sondertasten"; + HELPTEXT [ english_us ] = "Liste der definierten Sondertasten"; + }; + MenuItem { + Identifier = RID_HELPINTRO; + TEXT = "~Anleitung"; + TEXT [ english_us ] = "~Anleitung"; + HELPTEXT = "Einführung in die Programmierung"; + HELPTEXT [ english_us ] = "Einführung in die Programmierung"; + }; + MenuItem { + SEPARATOR = TRUE; + }; + MenuItem { + Identifier = RID_HELPTOPIC; + TEXT = "~Markierter Text"; + TEXT [ english_us ] = "~Markierter Text"; + HELPTEXT = "Aktuell markierten Text erläutern"; + HELPTEXT [ english_us ] = "Aktuell markierten Text erläutern"; + }; + MenuItem { + SEPARATOR = TRUE; + }; +*/ MenuItem { + ABOUT = TRUE; + Identifier = RID_HELPABOUT; + TEXT = "~Info..."; + TEXT [ english_us ] = "~About..."; + HELPTEXT = "Copyright-Informationen"; + HELPTEXT [ english_us ] = "Copyright-Informationen"; + TEXT[ portuguese ] = "~Informação..."; + TEXT[ russian ] = "~About..."; + TEXT[ greek ] = "~About..."; + TEXT[ dutch ] = "~Info..."; + TEXT[ french ] = "~Info..."; + TEXT[ spanish ] = "~Información..."; + TEXT[ italian ] = "~Info..."; + TEXT[ danish ] = "~About..."; + TEXT[ swedish ] = "~About..."; + TEXT[ polish ] = "~About..."; + TEXT[ portuguese_brazilian ] = "~Info..."; + TEXT[ japanese ] = "î•ñ(~I)..."; + TEXT[ korean ] = "Á¤º¸(~A)..."; + TEXT[ chinese_simplified ] = "~Info..."; + TEXT[ chinese_traditional ] = "~About..."; + TEXT[ arabic ] = "ãÚáæãÇÊ..."; + TEXT[ turkish ] = "~Bilgi..."; + }; + }; +}; +ModelessDialog IDD_PRINT_DIALOG { + Pos = MAP_APPFONT( 83, 42 ); + Size = MAP_APPFONT( 171, 94 ); + TEXT = "StarBasic: Datei drucken"; + TEXT [ english_us ] = "StarBasic: Print File"; + MOVEABLE = TRUE; + SVLook = TRUE; + FixedText RID_TEXT { + Pos = MAP_APPFONT( 11, 9 ); + Size = MAP_APPFONT( 146, 28 ); + TEXT = "Druck von "; + TEXT [ english_us ] = "Print from "; + CENTER = TRUE; + TEXT[ portuguese ] = "Impressão de "; + TEXT[ russian ] = "Print from "; + TEXT[ greek ] = "Print from "; + TEXT[ dutch ] = "Afdruk van "; + TEXT[ french ] = "Impression de "; + TEXT[ spanish ] = "Imprimir "; + TEXT[ italian ] = "Print from "; + TEXT[ danish ] = "Print from "; + TEXT[ swedish ] = "Print from "; + TEXT[ polish ] = "Print from "; + TEXT[ portuguese_brazilian ] = "Druck von "; + TEXT[ japanese ] = "ˆóü”ÍˆÍ "; + TEXT[ korean ] = "·ÎºÎÅÍ Àμâ "; + TEXT[ chinese_simplified ] = "Druck von "; + TEXT[ chinese_traditional ] = "Print from "; + TEXT[ arabic ] = "Print from "; + TEXT[ turkish ] = "Çýktý kaynaðý "; + }; + CancelButton RID_CANCEL { + Pos = MAP_APPFONT( 56, 46 ); + Size = MAP_APPFONT( 47, 19 ); + TEXT = "Abbruch"; + TEXT [ english_us ] = "Cancel"; + TEXT[ portuguese ] = "Cancelar"; + TEXT[ russian ] = "Cancel"; + TEXT[ greek ] = "Cancel"; + TEXT[ dutch ] = "Annuleren"; + TEXT[ french ] = "Annuler"; + TEXT[ spanish ] = "Cancelar"; + TEXT[ italian ] = "Cancel"; + TEXT[ danish ] = "Cancel"; + TEXT[ swedish ] = "Cancel"; + TEXT[ polish ] = "Cancel"; + TEXT[ portuguese_brazilian ] = "Abbruch"; + TEXT[ japanese ] = "·¬Ý¾Ù"; + TEXT[ korean ] = "Ãë¼Ò"; + TEXT[ chinese_simplified ] = "Abbruch"; + TEXT[ chinese_traditional ] = "Cancel"; + TEXT[ arabic ] = "Cancel"; + TEXT[ turkish ] = "Ýptal"; + }; + TEXT[ portuguese ] = "StarOffice Basic: imprimir ficheiro"; + TEXT[ russian ] = "StarBasic: Print File"; + TEXT[ greek ] = "StarBasic: Print File"; + TEXT[ dutch ] = "StarOffice Basic: bestand afdrukken"; + TEXT[ french ] = "StarBasic: Impression d'un fichier"; + TEXT[ spanish ] = "StarBasic: Imprimir archivo"; + TEXT[ italian ] = "StarBasic: Print file"; + TEXT[ danish ] = "StarBasic: Print File"; + TEXT[ swedish ] = "StarBasic: Print File"; + TEXT[ polish ] = "StarBasic: Print File"; + TEXT[ portuguese_brazilian ] = "StarBasic: Datei drucken"; + TEXT[ japanese ] = "StarBasic: ̧²Ù‚̈óü"; + TEXT[ korean ] = "StarBasic: ÇÁ¸°Æ® ÆÄÀÏ"; + TEXT[ chinese_simplified ] = "StarBasic: Datei drucken"; + TEXT[ chinese_traditional ] = "StarOffcie Basic: Print File"; + TEXT[ arabic ] = "StarBasic: Print File"; + TEXT[ turkish ] = "StarBasic: Dosyayý yazdýr"; +}; + + +ModelessDialog IDD_OPTIONS_DLG +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT( 248, 140 ); + Text = "Einstellungen" ; + Text [ english_us ] = "Settings" ; + Moveable = TRUE ; + Closeable = TRUE ; + TabControl RES_TC_OPTIONS + { + OutputSize = TRUE ; + Pos = MAP_APPFONT( 4, 4 ); + Size = MAP_APPFONT( 240, 116 ); + Hide = FALSE ; + PageList = + { + PageItem + { + Identifier = RID_TP_GEN ; + Text = "Generisch" ; + Text [ english_us ] = "Generic" ; + Text[ portuguese ] = "Genérico"; + Text[ russian ] = "Generic"; + Text[ greek ] = "Generic"; + Text[ dutch ] = "Generiek"; + Text[ french ] = "Générique"; + Text[ spanish ] = "Genérico"; + Text[ italian ] = "Generic"; + Text[ danish ] = "Generic"; + Text[ swedish ] = "Generic"; + Text[ polish ] = "Generic"; + Text[ portuguese_brazilian ] = "Generisch"; + Text[ japanese ] = "•“I"; + Text[ korean ] = "ÀϹÝÀûÀÎ"; + Text[ chinese_simplified ] = "Generisch"; + Text[ chinese_traditional ] = "Generic"; + Text[ arabic ] = "Generic"; + Text[ turkish ] = "Genel"; + }; + PageItem + { + Identifier = RID_TP_SPE ; + Text = "Spezial" ; + Text [ english_us ] = "Specialized" ; + Text[ portuguese ] = "Especial"; + Text[ russian ] = "Specialized"; + Text[ greek ] = "Specialized"; + Text[ dutch ] = "Speciaal"; + Text[ french ] = "Spécial"; + Text[ spanish ] = "Especial"; + Text[ italian ] = "Special"; + Text[ danish ] = "Specialized"; + Text[ swedish ] = "Specialized"; + Text[ polish ] = "Specialized"; + Text[ portuguese_brazilian ] = "Spezial"; + Text[ japanese ] = "“ÁŽê"; + Text[ korean ] = "Ư¼öÇÑ"; + Text[ chinese_simplified ] = "Spezial"; + Text[ chinese_traditional ] = "Specialized"; + Text[ arabic ] = "Specialized"; + Text[ turkish ] = "Özel"; + }; + }; + OKButton RID_OK { + Pos = MAP_APPFONT( 65, 124 ); + Size = MAP_APPFONT( 55, 12 ); + TabStop = TRUE; + DefButton = TRUE; + }; + CancelButton RID_CANCEL { + Pos = MAP_APPFONT( 135, 124 ); + Size = MAP_APPFONT( 55, 12 ); + TabStop = TRUE; + }; + }; + Text[ portuguese ] = "Definições"; + Text[ russian ] = "Settings"; + Text[ greek ] = "Settings"; + Text[ dutch ] = "Instellingen"; + Text[ french ] = "Paramètres"; + Text[ spanish ] = "Configuración"; + Text[ italian ] = "Settings"; + Text[ danish ] = "Settings"; + Text[ swedish ] = "Settings"; + Text[ polish ] = "Settings"; + Text[ portuguese_brazilian ] = "Einstellungen"; + Text[ japanese ] = "Ý’è"; + Text[ korean ] = "¼³Á¤"; + Text[ chinese_simplified ] = "Einstellungen"; + Text[ chinese_traditional ] = "Settings"; + Text[ arabic ] = "Settings"; + Text[ turkish ] = "Ayarlar"; +}; + + +TabPage RID_TP_GENERIC { + Hide = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT( 244, 100 ); + GroupBox RID_GB_AREA { + Pos = MAP_APPFONT( 4, 4 ); + Size = MAP_APPFONT( 228, 28 ); + Text = "Bereich"; + Text [ english_us ] = "Range"; + Text[ portuguese ] = "Área"; + Text[ russian ] = "Range"; + Text[ greek ] = "Range"; + Text[ dutch ] = "Bereik"; + Text[ french ] = "Zone"; + Text[ spanish ] = "Área"; + Text[ italian ] = "Range"; + Text[ danish ] = "Range"; + Text[ swedish ] = "Range"; + Text[ polish ] = "Range"; + Text[ portuguese_brazilian ] = "Bereich"; + Text[ japanese ] = "”͈Í"; + Text[ korean ] = "¹üÀ§"; + Text[ chinese_simplified ] = "Bereich"; + Text[ chinese_traditional ] = "Range"; + Text[ arabic ] = "Range"; + Text[ turkish ] = "Aralýk"; + }; + ComboBox RID_CB_AREA { + HScroll = TRUE; + VScroll = TRUE; + AutoHScroll = TRUE; + Border = TRUE; + Pos = MAP_APPFONT( 8, 16 ); + Size = MAP_APPFONT( 132, 88 ); + TabStop = TRUE; + DropDown = TRUE; + }; + PushButton RID_PB_NEW_AREA { + Pos = MAP_APPFONT( 144, 16 ); + Size = MAP_APPFONT( 40, 12 ); + Text = "Neu"; + Text [ english_us ] = "New"; + TabStop = TRUE; + Text[ portuguese ] = "Novo"; + Text[ russian ] = "New"; + Text[ greek ] = "New"; + Text[ dutch ] = "Nieuw"; + Text[ french ] = "Nouveau"; + Text[ spanish ] = "Nuevo"; + Text[ italian ] = "New"; + Text[ danish ] = "New"; + Text[ swedish ] = "New"; + Text[ polish ] = "New "; + Text[ portuguese_brazilian ] = "Neu"; + Text[ japanese ] = "V‹K"; + Text[ korean ] = "»õ·Î"; + Text[ chinese_simplified ] = "Neu"; + Text[ chinese_traditional ] = "New"; + Text[ arabic ] = "New"; + Text[ turkish ] = "Yeni"; + }; + PushButton RID_PD_DEL_AREA { + Pos = MAP_APPFONT( 188, 16 ); + Size = MAP_APPFONT( 40, 12 ); + Text = "Löschen"; + Text [ english_us ] = "Delete"; + TabStop = TRUE; + Text[ portuguese ] = "Eliminar"; + Text[ russian ] = "Delete"; + Text[ greek ] = "Delete"; + Text[ dutch ] = "Wissen"; + Text[ french ] = "Supprimer"; + Text[ spanish ] = "Eliminar"; + Text[ italian ] = "Cancel"; + Text[ danish ] = "Delete"; + Text[ swedish ] = "Delete"; + Text[ polish ] = "Delete"; + Text[ portuguese_brazilian ] = "Löschen"; + Text[ japanese ] = "íœ"; + Text[ korean ] = "Áö¿ì±â"; + Text[ chinese_simplified ] = "Löschen"; + Text[ chinese_traditional ] = "Delete"; + Text[ arabic ] = "Delete"; + Text[ turkish ] = "Sil"; + }; + GroupBox RID_GB_VALUE { + Pos = MAP_APPFONT( 4, 36 ); + Size = MAP_APPFONT( 228, 60 ); + Text = "Einstellung"; + Text [ english_us ] = "Setting"; + Text[ portuguese ] = "Configuração"; + Text[ russian ] = "Setting"; + Text[ greek ] = "Setting"; + Text[ dutch ] = "Instelling"; + Text[ french ] = "Paramètre"; + Text[ spanish ] = "Configuración"; + Text[ italian ] = "Setting"; + Text[ danish ] = "Setting"; + Text[ swedish ] = "Setting"; + Text[ polish ] = "Setting"; + Text[ portuguese_brazilian ] = "Einstellung"; + Text[ japanese ] = "Ý’è"; + Text[ korean ] = "¼³Á¤"; + Text[ chinese_simplified ] = "Einstellung"; + Text[ chinese_traditional ] = "Settings"; + Text[ arabic ] = "Setting"; + Text[ turkish ] = "Ayarlar"; + }; + ComboBox RID_CB_VALUE { + HScroll = TRUE; + VScroll = TRUE; + AutoHScroll = TRUE; + Border = TRUE; + Pos = MAP_APPFONT( 8, 48 ); + Size = MAP_APPFONT( 176, 44 ); + TabStop = TRUE; + }; + PushButton RID_PB_NEW_VALUE { + Pos = MAP_APPFONT( 188, 48 ); + Size = MAP_APPFONT( 40, 12 ); + Text = "Neu"; + Text [ english_us ] = "New"; + TabStop = TRUE; + Text[ portuguese ] = "Novo"; + Text[ russian ] = "New"; + Text[ greek ] = "New"; + Text[ dutch ] = "Nieuw"; + Text[ french ] = "Nouveau"; + Text[ spanish ] = "Nuevo"; + Text[ italian ] = "New"; + Text[ danish ] = "New"; + Text[ swedish ] = "New"; + Text[ polish ] = "New"; + Text[ portuguese_brazilian ] = "Neu"; + Text[ japanese ] = "V‹K"; + Text[ korean ] = "»õ·Î"; + Text[ chinese_simplified ] = "Neu"; + Text[ chinese_traditional ] = "New"; + Text[ arabic ] = "New"; + Text[ turkish ] = "Yeni"; + }; + PushButton RID_PB_DEL_VALUE { + Pos = MAP_APPFONT( 188, 64 ); + Size = MAP_APPFONT( 40, 12 ); + Text = "Löschen"; + Text [ english_us ] = "Delete"; + TabStop = TRUE; + Text[ portuguese ] = "Eliminar"; + Text[ russian ] = "Delete"; + Text[ greek ] = "Delete"; + Text[ dutch ] = "Wissen"; + Text[ french ] = "Supprimer"; + Text[ spanish ] = "Eliminar"; + Text[ italian ] = "Cancel"; + Text[ danish ] = "Delete"; + Text[ swedish ] = "Delete"; + Text[ polish ] = "Delete"; + Text[ portuguese_brazilian ] = "Löschen"; + Text[ japanese ] = "íœ"; + Text[ korean ] = "Áö¿ì±â"; + Text[ chinese_simplified ] = "Löschen"; + Text[ chinese_traditional ] = "Delete"; + Text[ arabic ] = "Delete"; + Text[ turkish ] = "Sil"; + }; +}; + + +TabPage RID_TP_SPECIAL { + Hide = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT( 244, 100 ); + GroupBox GB_DIRECTORIES { + Pos = MAP_APPFONT( 4, 4 ); + Size = MAP_APPFONT( 230, 56 ); + Text = "Verzeichnisse"; + Text [ english_us ] = "Directories"; + Text[ portuguese ] = "Directórios"; + Text[ russian ] = "Directories"; + Text[ greek ] = "Directories"; + Text[ dutch ] = "Directory's"; + Text[ french ] = "Répertoires"; + Text[ spanish ] = "Directorios"; + Text[ italian ] = "Directories"; + Text[ danish ] = "Directories"; + Text[ swedish ] = "Directories"; + Text[ polish ] = "Directories"; + Text[ portuguese_brazilian ] = "Verzeichnisse"; + Text[ japanese ] = "ÃÞ¨Ú¸ÄØ"; + Text[ korean ] = "µð·ºÅ丮"; + Text[ chinese_simplified ] = "Verzeichnisse"; + Text[ chinese_traditional ] = "Directories"; + Text[ arabic ] = "Directories"; + Text[ turkish ] = "Dizinler"; + }; + FixedText LOG_TEXT { + Pos = MAP_APPFONT( 7, 12 ); + Size = MAP_APPFONT( 76, 12 ); + Text = "Log Basisverzeichnis"; + Text [ english_us ] = "Log home directory"; + Text[ portuguese ] = "Directório LOG de base"; + Text[ russian ] = "Log home directory"; + Text[ greek ] = "Log home directory"; + Text[ dutch ] = "Log home directory"; + Text[ french ] = "Répertoire racine LOG"; + Text[ spanish ] = "Directorio base de Log"; + Text[ italian ] = "Cartella log home"; + Text[ danish ] = "Log home directory"; + Text[ swedish ] = "Log home directory"; + Text[ polish ] = "Log home directory"; + Text[ portuguese_brazilian ] = "Log Basisverzeichnis"; + Text[ japanese ] = "Û¸Þ Î°Ñ ÃÞ¨Ú¸ÄØ"; + Text[ korean ] = "·Î±× Ȩ µð·ºÅ丮"; + Text[ chinese_simplified ] = "Log Basisverzeichnis"; + Text[ chinese_traditional ] = "Log home directory"; + Text[ arabic ] = "Log home directory"; + Text[ turkish ] = "Log ana dizin"; + }; + FixedText BASIS_TEXT { + Pos = MAP_APPFONT( 7, 28 ); + Size = MAP_APPFONT( 76, 12 ); + Text = "Basisverzeichnis"; + Text [ english_us ] = "Home directory"; + Text[ portuguese ] = "Directório de base"; + Text[ russian ] = "Home directory"; + Text[ greek ] = "Home directory"; + Text[ dutch ] = "Home directory"; + Text[ french ] = "Répertoire racine"; + Text[ spanish ] = "Directorio base"; + Text[ italian ] = "Cartella home"; + Text[ danish ] = "Home directory"; + Text[ swedish ] = "Home directory"; + Text[ polish ] = "Home directory"; + Text[ portuguese_brazilian ] = "Basisverzeichnis"; + Text[ japanese ] = "롄 ÃÞ¨Ú¸ÄØ"; + Text[ korean ] = "Ȩ µð·ºÅ丮"; + Text[ chinese_simplified ] = "Basisverzeichnis"; + Text[ chinese_traditional ] = "Home directory"; + Text[ arabic ] = "Home directory"; + Text[ turkish ] = "Ana dizin"; + }; + FixedText HID_TEXT { + Pos = MAP_APPFONT( 7, 44 ); + Size = MAP_APPFONT( 76, 12 ); + Text = "HID Verzeichnis"; + Text [ english_us ] = "HID directory"; + Text[ portuguese ] = "Directório HID"; + Text[ russian ] = "HID directory"; + Text[ greek ] = "HID directory"; + Text[ dutch ] = "HID directory"; + Text[ french ] = "Répertoire HID"; + Text[ spanish ] = "Directorio HID"; + Text[ italian ] = "Cartella HID"; + Text[ danish ] = "HID directory"; + Text[ swedish ] = "HID directory"; + Text[ polish ] = "HID directory"; + Text[ portuguese_brazilian ] = "HID Verzeichnis"; + Text[ japanese ] = "HID ÃÞ¨Ú¸ÄØ"; + Text[ korean ] = "HID µð·ºÅ丮"; + Text[ chinese_simplified ] = "HID Verzeichnis"; + Text[ chinese_traditional ] = "HID directory"; + Text[ arabic ] = "HID directory"; + Text[ turkish ] = "HID diziniz"; + }; + Edit LOG_NAME { + Border = TRUE; + Pos = MAP_APPFONT( 87, 12 ); + Size = MAP_APPFONT( 126, 12 ); + TabStop = TRUE; + }; + Edit BASIS_NAME { + Border = TRUE; + Pos = MAP_APPFONT( 87, 28 ); + Size = MAP_APPFONT( 126, 12 ); + TabStop = TRUE; + }; + Edit HID_NAME { + Border = TRUE; + Pos = MAP_APPFONT( 87, 44 ); + Size = MAP_APPFONT( 126, 12 ); + TabStop = TRUE; + }; + PushButton LOG_SET { + Pos = MAP_APPFONT( 217, 12 ); + Size = MAP_APPFONT( 12, 12 ); + Text = "..."; + Text [ english_us ] = "..."; + TabStop = TRUE; + Text[ portuguese ] = "..."; + Text[ russian ] = "..."; + Text[ greek ] = "..."; + Text[ dutch ] = "..."; + Text[ french ] = "..."; + Text[ spanish ] = "..."; + Text[ italian ] = "..."; + Text[ danish ] = "..."; + Text[ swedish ] = "..."; + Text[ polish ] = "..."; + Text[ portuguese_brazilian ] = "..."; + Text[ japanese ] = "..."; + Text[ korean ] = "..."; + Text[ chinese_simplified ] = "..."; + Text[ chinese_traditional ] = "..."; + Text[ arabic ] = "..."; + Text[ turkish ] = "..."; + }; + PushButton BASIS_SET { + Pos = MAP_APPFONT( 217, 28 ); + Size = MAP_APPFONT( 12, 12 ); + Text = "..."; + Text [ english_us ] = "..."; + TabStop = TRUE; + Text[ portuguese ] = "..."; + Text[ russian ] = "..."; + Text[ greek ] = "..."; + Text[ dutch ] = "..."; + Text[ french ] = "..."; + Text[ spanish ] = "..."; + Text[ italian ] = "..."; + Text[ danish ] = "..."; + Text[ swedish ] = "..."; + Text[ polish ] = "..."; + Text[ portuguese_brazilian ] = "..."; + Text[ japanese ] = "..."; + Text[ korean ] = "..."; + Text[ chinese_simplified ] = "..."; + Text[ chinese_traditional ] = "..."; + Text[ arabic ] = "..."; + Text[ turkish ] = "..."; + }; + PushButton HID_SET { + Pos = MAP_APPFONT( 217, 44 ); + Size = MAP_APPFONT( 12, 12 ); + Text = "..."; + Text [ english_us ] = "..."; + TabStop = TRUE; + Text[ portuguese ] = "..."; + Text[ russian ] = "..."; + Text[ greek ] = "..."; + Text[ dutch ] = "..."; + Text[ french ] = "..."; + Text[ spanish ] = "..."; + Text[ italian ] = "..."; + Text[ danish ] = "..."; + Text[ swedish ] = "..."; + Text[ polish ] = "..."; + Text[ portuguese_brazilian ] = "..."; + Text[ japanese ] = "..."; + Text[ korean ] = "..."; + Text[ chinese_simplified ] = "..."; + Text[ chinese_traditional ] = "..."; + Text[ arabic ] = "..."; + Text[ turkish ] = "..."; + }; + GroupBox GB_OTHER { + Pos = MAP_APPFONT( 4, 62 ); + Size = MAP_APPFONT( 230, 34 ); + Text = "Andere Einstellungen"; + Text [ english_us ] = "Other settings"; + Text[ portuguese ] = "Outras definições"; + Text[ russian ] = "Other settings"; + Text[ greek ] = "Other settings"; + Text[ dutch ] = "Andere instellingen"; + Text[ french ] = "Autres paramètres"; + Text[ spanish ] = "Otra configuración"; + Text[ italian ] = "Other settings"; + Text[ danish ] = "Other settings"; + Text[ swedish ] = "Other settings"; + Text[ polish ] = "Other settings"; + Text[ portuguese_brazilian ] = "Andere Einstellungen"; + Text[ japanese ] = "‚»‚Ì‘¼‚ÌÝ’è"; + Text[ korean ] = "´Ù¸¥ ¼³Á¤"; + Text[ chinese_simplified ] = "Andere Einstellungen"; + Text[ chinese_traditional ] = "Ohter settings"; + Text[ arabic ] = "Other settings"; + Text[ turkish ] = "Diðer ayarlar"; + }; + FixedText TIMEOUT_TEXT { + Pos = MAP_APPFONT( 8, 70 ); + Size = MAP_APPFONT( 70, 12 ); + Text = "Server Timeout"; + Text [ english_us ] = "Server Timeout"; + Text[ portuguese ] = "Timeout do servidor"; + Text[ russian ] = "Server Timeout"; + Text[ greek ] = "Server Timeout"; + Text[ dutch ] = "Server timeout"; + Text[ french ] = "Timeout du serveur (dépassement de délai)"; + Text[ spanish ] = "Server Timeout"; + Text[ italian ] = "Server Timeout"; + Text[ danish ] = "Server Timeout"; + Text[ swedish ] = "Server Timeout"; + Text[ polish ] = "Server Timeout"; + Text[ portuguese_brazilian ] = "Server Timeout"; + Text[ japanese ] = "»°ÊÞ° À²Ñ±³Ä"; + Text[ korean ] = "¼¹ö ŸÀӾƿô"; + Text[ chinese_simplified ] = "Server Timeout"; + Text[ chinese_traditional ] = "Server Timeout"; + Text[ arabic ] = "Server Timeout"; + Text[ turkish ] = "Sunucu zaman aþýmý"; + }; + TimeField SERVER_TIMEOUT { + Border = TRUE; + Pos = MAP_APPFONT( 83, 70 ); + Size = MAP_APPFONT( 40, 12 ); + TabStop = TRUE; + Repeat = TRUE; + Spin = TRUE; + Format = TIMEF_SEC; + Duration = TRUE; + }; + CheckBox CB_AUTORELOAD { + Pos = MAP_APPFONT( 8, 83 ); + Size = MAP_APPFONT( 115, 12 ); + Text = "Automatischer Reload"; + Text [ english_us ] = "AutoReload"; + Text[ portuguese ] = "Recarga automática"; + Text[ russian ] = "AutoReload"; + Text[ greek ] = "AutoReload"; + Text[ dutch ] = "Automatische reload"; + Text[ french ] = "Recharge automatique"; + Text[ spanish ] = "Recarga automática"; + Text[ italian ] = "AutoReload"; + Text[ danish ] = "AutoReload"; + Text[ swedish ] = "AutoReload"; + Text[ polish ] = "AutoReload"; + Text[ portuguese_brazilian ] = "Automatischer Reload"; + Text[ japanese ] = "AutoReload"; + Text[ korean ] = "ÀÚµ¿·Îµå"; + Text[ chinese_simplified ] = "Automatischer Reload"; + Text[ chinese_traditional ] = "AutoReload"; + Text[ arabic ] = "AutoReload"; + Text[ turkish ] = "Otomatik yeniden yükleme"; + }; +// CheckBox 5555 { +// Pos = MAP_APPFONT( 127, 70 ); +// Size = MAP_APPFONT( 103, 12 ); +// Text = "Unbenutzt aber Positioniert"; +// Text [ english_us ] = "Unbenutzt aber Positioniert"; +// }; +}; + + + +FloatingWindow IDD_DISPLAY_HID { + OutputSize = TRUE; + SVLook = TRUE; + Size = MAP_APPFONT( 261, 160 ); + Text = "Display HId"; + Text [ english_us ] = "Display HId"; + Moveable = TRUE; + Closeable = TRUE; + Sizeable = TRUE; + Zoomable = TRUE; + Hide = TRUE; + ClipChildren = TRUE; + ToolBox RID_TB_CONF { + Border = TRUE; + Pos = MAP_APPFONT( 0, 0 ); + Size = MAP_APPFONT( 260, 14 ); +/* ItemList = { + ToolBoxItem { + Text = "erster der Toolbox"; + Text [ english_us ] = "erster der Toolbox"; + }; + };*/ +// Hide = TRUE; + }; + FixedText RID_FT_CONTROLS { + Pos = MAP_APPFONT( 4, 16 ); + Size = MAP_APPFONT( 128, 10 ); + Text = "Controls"; + Text [ english_us ] = "Controls"; + Text[ portuguese ] = "Controlos"; + Text[ russian ] = "Controls"; + Text[ greek ] = "Controls"; + Text[ dutch ] = "Controls"; + Text[ french ] = "Contrôles"; + Text[ spanish ] = "Controles"; + Text[ italian ] = "Controls"; + Text[ danish ] = "Controls"; + Text[ swedish ] = "Controls"; + Text[ polish ] = "Controls"; + Text[ portuguese_brazilian ] = "Controls"; + Text[ japanese ] = "Controls"; + Text[ korean ] = "ÄÁÆ®·Ñ"; + Text[ chinese_simplified ] = "Controls"; + Text[ chinese_traditional ] = "Controls"; + Text[ arabic ] = "Controls"; + Text[ turkish ] = "Denetimler"; + }; + MultiListBox RID_MLB_CONTROLS { + Border = TRUE; + AutoHScroll = TRUE; + Pos = MAP_APPFONT( 4, 28 ); + Size = MAP_APPFONT( 208, 88 ); + TabStop = TRUE; + }; + FixedText RID_FT_SLOTS { + Pos = MAP_APPFONT( 4, 120 ); + Size = MAP_APPFONT( 128, 10 ); + Text = "Slots"; + Text [ english_us ] = "Slots"; + Text[ portuguese ] = "Slots"; + Text[ russian ] = "Slots"; + Text[ greek ] = "Slots"; + Text[ dutch ] = "Slots"; + Text[ french ] = "Ports (slots)"; + Text[ spanish ] = "Puertos (slots)"; + Text[ italian ] = "Slots"; + Text[ danish ] = "Slots"; + Text[ swedish ] = "Slots"; + Text[ polish ] = "Slots"; + Text[ portuguese_brazilian ] = "Slots"; + Text[ japanese ] = "Slots"; + Text[ korean ] = "Slots"; + Text[ chinese_simplified ] = "Slots"; + Text[ chinese_traditional ] = "Slots"; + Text[ arabic ] = "Slots"; + Text[ turkish ] = "Yuvalar"; + }; + MultiListBox RID_MLB_SLOTS { + Border = TRUE; + AutoHScroll = TRUE; + Pos = MAP_APPFONT( 4, 132 ); + Size = MAP_APPFONT( 208, 24 ); + TabStop = TRUE; + }; + PushButton RID_PB_KOPIEREN { + Pos = MAP_APPFONT( 216, 28 ); + Size = MAP_APPFONT( 40, 12 ); + Text = "Kopieren"; + Text [ english_us ] = "Copy"; + TabStop = TRUE; + Text[ portuguese ] = "Copiar"; + Text[ russian ] = "Copy"; + Text[ greek ] = "Copy"; + Text[ dutch ] = "Kopiëren"; + Text[ french ] = "Copier"; + Text[ spanish ] = "Copiar"; + Text[ italian ] = "Copy"; + Text[ danish ] = "Copy"; + Text[ swedish ] = "Copy"; + Text[ polish ] = "Copy"; + Text[ portuguese_brazilian ] = "Kopieren"; + Text[ japanese ] = "Copy"; + Text[ korean ] = "º¹»ç"; + Text[ chinese_simplified ] = "Kopieren"; + Text[ chinese_traditional ] = "Copy"; + Text[ arabic ] = "Copy"; + Text[ turkish ] = "Kopyala"; + }; + PushButton RID_PB_BENENNEN { + Pos = MAP_APPFONT( 216, 44 ); + Size = MAP_APPFONT( 40, 12 ); + Text = "Benennen"; + Text [ english_us ] = "Name"; + TabStop = TRUE; + Hide = TRUE; + Text[ portuguese ] = "Atribuir nome"; + Text[ russian ] = "Name"; + Text[ greek ] = "Name"; + Text[ dutch ] = "Naam geven"; + Text[ french ] = "Nommer"; + Text[ spanish ] = "Nombrar"; + Text[ italian ] = "Name"; + Text[ danish ] = "Name"; + Text[ swedish ] = "Name"; + Text[ polish ] = "Name"; + Text[ portuguese_brazilian ] = "Benennen"; + Text[ japanese ] = "Name"; + Text[ korean ] = "À̸§"; + Text[ chinese_simplified ] = "Benennen"; + Text[ chinese_traditional ] = "Name"; + Text[ arabic ] = "Name"; + Text[ turkish ] = "Adlandýr"; + }; + PushButton RID_PB_SELECTALL { + Pos = MAP_APPFONT( 216, 44 ); + Size = MAP_APPFONT( 40, 12 ); + Text = "Alle Markieren"; + Text [ english_us ] = "Select all"; + TabStop = TRUE; + Text[ portuguese ] = "Seleccionar tudo"; + Text[ russian ] = "Select all"; + Text[ greek ] = "Select all"; + Text[ dutch ] = "Alle markeren"; + Text[ french ] = "Sélectionner tout"; + Text[ spanish ] = "Seleccionar todos"; + Text[ italian ] = "Select all"; + Text[ danish ] = "Select all"; + Text[ swedish ] = "Select all"; + Text[ polish ] = "Select all"; + Text[ portuguese_brazilian ] = "Alle Markieren"; + Text[ japanese ] = "Select all"; + Text[ korean ] = "Àüü ¼±ÅÃ"; + Text[ chinese_simplified ] = "Alle Markieren"; + Text[ chinese_traditional ] = "Select all"; + Text[ arabic ] = "Select all"; + Text[ turkish ] = "Tümünü seç"; + }; + OKButton RID_OK_CLOSE { + Pos = MAP_APPFONT( 216, 144 ); + Size = MAP_APPFONT( 40, 12 ); + Text = "Schließen"; + Text [ english_us ] = "Close"; + TabStop = TRUE; + Text[ portuguese ] = "Fechar"; + Text[ russian ] = "Close"; + Text[ greek ] = "Close"; + Text[ dutch ] = "Sluiten"; + Text[ french ] = "Fermer"; + Text[ spanish ] = "Cerrar"; + Text[ italian ] = "Close"; + Text[ danish ] = "Close"; + Text[ swedish ] = "Close"; + Text[ polish ] = "Close"; + Text[ portuguese_brazilian ] = "Schließen"; + Text[ japanese ] = "Close"; + Text[ korean ] = "´Ý±â"; + Text[ chinese_simplified ] = "Schließen"; + Text[ chinese_traditional ] = "Close"; + Text[ arabic ] = "Close"; + Text[ turkish ] = "Kapat"; + }; + Text[ portuguese ] = "Mostrar HId"; + Text[ russian ] = "Display HId"; + Text[ greek ] = "Display HId"; + Text[ dutch ] = "Display HId"; + Text[ french ] = "Display HId"; + Text[ spanish ] = "Mostrar HId"; + Text[ italian ] = "Display HId"; + Text[ danish ] = "Display HId"; + Text[ swedish ] = "Display HId"; + Text[ polish ] = "Display HId"; + Text[ portuguese_brazilian ] = "Display HId"; + Text[ japanese ] = "Display HId"; + Text[ korean ] = "µð½ºÇ÷¹ÀÌ HId"; + Text[ chinese_simplified ] = "Display HId"; + Text[ chinese_traditional ] = "Display HId"; + Text[ arabic ] = "Display HId"; + Text[ turkish ] = "Görüntüle: HId"; +}; + + + +Accelerator MAIN_ACCEL { + ItemList = { + AcceleratorItem { + Identifier = RID_FILENEW; + Key = KeyCode { Function = KEYFUNC_NEW; }; + }; + AcceleratorItem { + Identifier = RID_FILEOPEN; + Key = KeyCode { Function = KEYFUNC_OPEN; }; + }; + AcceleratorItem { + Identifier = RID_FILESAVE; + Key = KeyCode { Function = KEYFUNC_SAVE; }; + }; + AcceleratorItem { + Identifier = RID_FILESAVEAS; + Key = KeyCode { Function = KEYFUNC_SAVEAS; }; + }; + AcceleratorItem { + Identifier = RID_QUIT; + Key = KeyCode { Function = KEYFUNC_QUIT; }; + }; +// AcceleratorItem { +// Identifier = RID_EDITCUT; +// Key = KeyCode { Function = KEYFUNC_CUT; }; +// }; +// AcceleratorItem { +// Identifier = RID_EDITCOPY; +// Key = KeyCode { Function = KEYFUNC_COPY; }; +// }; +// AcceleratorItem { +// Identifier = RID_EDITPASTE; +// Key = KeyCode { Function = KEYFUNC_PASTE; }; +// }; +// AcceleratorItem { +// Identifier = RID_EDITDEL; +// Key = KeyCode { Function = KEYFUNC_DELETE; }; +// }; + AcceleratorItem { + Identifier = RID_EDITSEARCH; + Key = KeyCode { Function = KEYFUNC_FIND; }; + }; + AcceleratorItem { + Identifier = RID_EDITREPEAT; + Key = KeyCode { Code = KEY_F3; }; +// Key = KeyCode { Function = KEYFUNC_REPEAT; }; + }; + AcceleratorItem { + Identifier = RID_RUNCOMPILE; + Key = KeyCode { Code = KEY_F5; Shift = TRUE; }; + }; + AcceleratorItem { + Identifier = RID_RUNSTART; + Key = KeyCode { Code = KEY_F5; }; + }; + AcceleratorItem { + Identifier = RID_RUNSTEPINTO; + Key = KeyCode { Code = KEY_F8; }; + }; + AcceleratorItem { + Identifier = RID_TOGLEBRKPNT; + Key = KeyCode { Code = KEY_F9; }; + }; + AcceleratorItem { + Identifier = RID_RUNSTEPOVER; + Key = KeyCode { Code = KEY_F10; }; + }; + AcceleratorItem { + Identifier = RID_RUNTOCURSOR; + Key = KeyCode { Code = KEY_F7; }; + }; + AcceleratorItem { + Identifier = RID_RUNBREAK; + Key = KeyCode { Code = KEY_F5; Modifier1 = TRUE; }; + }; + AcceleratorItem { + Identifier = RID_RUNNEXTERR; + Key = KeyCode { Code = KEY_F8; Shift = TRUE; }; + }; + AcceleratorItem { + Identifier = RID_RUNPREVERR; + Key = KeyCode { Code = KEY_F7; Shift = TRUE; }; + }; + }; +}; + +ImageList RID_IMGLST_LAYOUT +{ + ImageBitmap = Bitmap { FILE = "images2.bmp" ; }; + MaskColor = Color { Red = 0xFFFF ; Green = 0xFFFF ; Blue = 0xFFFF ; }; + IdList = + { + IMGID_BRKENABLED ; + IMGID_BRKDISABLED ; + IMGID_STEPMARKER ; + IMGID_ERRORMARKER ; + }; +}; + + +ModelessDialog IDD_EDIT_VAR { + Pos = MAP_APPFONT( 0, 0 ); + Size = MAP_APPFONT( 171, 87 ); + Text = "Variable editieren"; + Text [ english_us ] = "Edit variable"; + Moveable = TRUE; + Closeable = TRUE; + FixedText RID_FT_NAME { + Pos = MAP_APPFONT( 8, 8 ); + Size = MAP_APPFONT( 40, 10 ); + Text = "Name"; + Text [ english_us ] = "Name"; + Text[ portuguese ] = "Nome"; + Text[ russian ] = "Name"; + Text[ greek ] = "Name"; + Text[ dutch ] = "Naam"; + Text[ french ] = "Nom"; + Text[ spanish ] = "Nombre"; + Text[ italian ] = "Name"; + Text[ danish ] = "Name"; + Text[ swedish ] = "Name"; + Text[ polish ] = "Name"; + Text[ portuguese_brazilian ] = "Name"; + Text[ japanese ] = "Name"; + Text[ korean ] = "À̸§"; + Text[ chinese_simplified ] = "Name"; + Text[ chinese_traditional ] = "Name"; + Text[ arabic ] = "Name"; + Text[ turkish ] = "Ad"; + }; + FixedText RID_FT_CONTENT { + Pos = MAP_APPFONT( 8, 21 ); + Size = MAP_APPFONT( 40, 10 ); + Text = "Inhalt"; + Text [ english_us ] = "Content"; + Text[ portuguese ] = "Conteúdo"; + Text[ russian ] = "Content"; + Text[ greek ] = "Content"; + Text[ dutch ] = "Inhoud"; + Text[ french ] = "Contenu"; + Text[ spanish ] = "Contenido"; + Text[ italian ] = "Content"; + Text[ danish ] = "Content"; + Text[ swedish ] = "Content"; + Text[ polish ] = "Content"; + Text[ portuguese_brazilian ] = "Inhalt"; + Text[ japanese ] = "Content"; + Text[ korean ] = "¸ñÂ÷"; + Text[ chinese_simplified ] = "Inhalt"; + Text[ chinese_traditional ] = "Content"; + Text[ arabic ] = "Content"; + Text[ turkish ] = "Ýçerik"; + }; + FixedText RID_FT_NEW_CONTENT { + Pos = MAP_APPFONT( 8, 38 ); + Size = MAP_APPFONT( 40, 10 ); + Text = "Neuer Inhalt"; + Text [ english_us ] = "New content"; + Text[ portuguese ] = "Novo conteúdo"; + Text[ russian ] = "New content"; + Text[ greek ] = "New content"; + Text[ dutch ] = "Nieuwe inhoud"; + Text[ french ] = "Nouveau contenu"; + Text[ spanish ] = "Nuevo contenido"; + Text[ italian ] = "New content"; + Text[ danish ] = "New content"; + Text[ swedish ] = "New content"; + Text[ polish ] = "New content"; + Text[ portuguese_brazilian ] = "Neuer Inhalt"; + Text[ japanese ] = "New content"; + Text[ korean ] = "»õ·Î¿î ¸ñÂ÷"; + Text[ chinese_simplified ] = "Neuer Inhalt"; + Text[ chinese_traditional ] = "New content"; + Text[ arabic ] = "New content"; + Text[ turkish ] = "Yeni içerik"; + }; + FixedText RID_FT_NAME_VALUE { + Pos = MAP_APPFONT( 53, 8 ); + Size = MAP_APPFONT( 111, 10 ); + Text = "name der variablen"; + Text [ english_us ] = "Name of variable"; + Text[ portuguese ] = "nome das variáveis"; + Text[ russian ] = "Name of variable"; + Text[ greek ] = "Name of variable"; + Text[ dutch ] = "Naam van de variabelen"; + Text[ french ] = "Noms des variables"; + Text[ spanish ] = "nombre de variables"; + Text[ italian ] = "Name of variables"; + Text[ danish ] = "Name of variable"; + Text[ swedish ] = "Name of variable"; + Text[ polish ] = "Name of variable"; + Text[ portuguese_brazilian ] = "name der variablen"; + Text[ japanese ] = "Name of variable"; + Text[ korean ] = "º¯¼ö ¸í"; + Text[ chinese_simplified ] = "name der variablen"; + Text[ chinese_traditional ] = "name of variable"; + Text[ arabic ] = "Name of variable"; + Text[ turkish ] = "Deðiþken adý"; + }; + FixedText RID_FT_CONTENT_VALUE { + Pos = MAP_APPFONT( 53, 21 ); + Size = MAP_APPFONT( 111, 10 ); + Text = "Alter Inhalt"; + Text [ english_us ] = "Previous contents"; + Text[ portuguese ] = "Antigo conteúdo"; + Text[ russian ] = "Previous contents"; + Text[ greek ] = "Previous contents"; + Text[ dutch ] = "Oude inhoud"; + Text[ french ] = "Ancien contenu"; + Text[ spanish ] = "Contenido antiguo"; + Text[ italian ] = "Previous content"; + Text[ danish ] = "Previous contents"; + Text[ swedish ] = "Previous content"; + Text[ polish ] = "Previous contents"; + Text[ portuguese_brazilian ] = "Alter Inhalt"; + Text[ japanese ] = "Previous contents"; + Text[ korean ] = "ÀÌÀü ¸ñÂ÷"; + Text[ chinese_simplified ] = "Alter Inhalt"; + Text[ chinese_traditional ] = "Previous content"; + Text[ arabic ] = "Previous contents"; + Text[ turkish ] = "Eski içerik"; + }; + RadioButton RID_RB_NEW_BOOL_T { + Hide = TRUE; + Pos = MAP_APPFONT( 53, 37 ); + Size = MAP_APPFONT( 40, 12 ); + Text = "True"; + Text [ english_us ] = "True"; + TabStop = TRUE; + Text[ portuguese ] = "Verdadeiro"; + Text[ russian ] = "True"; + Text[ greek ] = "True"; + Text[ dutch ] = "True"; + Text[ french ] = "Vrai"; + Text[ spanish ] = "Verdadero"; + Text[ italian ] = "True"; + Text[ danish ] = "True"; + Text[ swedish ] = "True"; + Text[ polish ] = "True"; + Text[ portuguese_brazilian ] = "True"; + Text[ japanese ] = "True"; + Text[ korean ] = "Âü"; + Text[ chinese_simplified ] = "True"; + Text[ chinese_traditional ] = "True"; + Text[ arabic ] = "True"; + Text[ turkish ] = "Doðru"; + }; + RadioButton RID_RB_NEW_BOOL_F { + Hide = TRUE; + Pos = MAP_APPFONT( 98, 37 ); + Size = MAP_APPFONT( 40, 12 ); + Text = "False"; + Text [ english_us ] = "False"; + TabStop = TRUE; + Text[ portuguese ] = "Falso"; + Text[ russian ] = "False"; + Text[ greek ] = "False"; + Text[ dutch ] = "False"; + Text[ french ] = "Faux"; + Text[ spanish ] = "Falso"; + Text[ italian ] = "False"; + Text[ danish ] = "False"; + Text[ swedish ] = "False"; + Text[ polish ] = "False"; + Text[ portuguese_brazilian ] = "False"; + Text[ japanese ] = "False"; + Text[ korean ] = "°ÅÁþ"; + Text[ chinese_simplified ] = "False"; + Text[ chinese_traditional ] = "False"; + Text[ arabic ] = "False"; + Text[ turkish ] = "Yanlýþ"; + }; + NumericField RID_NF_NEW_INTEGER { + Border = TRUE; + Hide = TRUE; + Pos = MAP_APPFONT( 53, 37 ); + Size = MAP_APPFONT( 111, 12 ); + TabStop = TRUE; + Repeat = TRUE; + Spin = TRUE; + Minimum = -32768; + Maximum = 32767; + First = -32768; + Last = 32767; + SpinSize = 10; + }; + NumericField RID_NF_NEW_LONG { + Border = TRUE; + Hide = TRUE; + Pos = MAP_APPFONT( 53, 37 ); + Size = MAP_APPFONT( 111, 12 ); + TabStop = TRUE; + Repeat = TRUE; + Spin = TRUE; + Minimum = -2147483648; + Maximum = 2147483647; + First = -2147483648; + Last = 2147483647; + SpinSize = 10; + }; + Edit RID_ED_NEW_STRING { + Hide = TRUE; + Border = TRUE; + Pos = MAP_APPFONT( 53, 37 ); + Size = MAP_APPFONT( 111, 12 ); + Text = "Edit"; + Text [ english_us ] = "Edit"; + TabStop = TRUE; + Text[ portuguese ] = "Editar"; + Text[ russian ] = "Edit"; + Text[ greek ] = "Edit"; + Text[ dutch ] = "Edit"; + Text[ french ] = "Éditer"; + Text[ spanish ] = "Editar"; + Text[ italian ] = "Edit"; + Text[ danish ] = "Edit"; + Text[ swedish ] = "Edit"; + Text[ polish ] = "Edit"; + Text[ portuguese_brazilian ] = "Edit"; + Text[ japanese ] = "Edit"; + Text[ korean ] = "ÆíÁý"; + Text[ chinese_simplified ] = "Edit"; + Text[ chinese_traditional ] = "Edit"; + Text[ arabic ] = "Edit"; + Text[ turkish ] = "Düzenle"; + }; + OKButton RID_OK { + Pos = MAP_APPFONT( 33, 58 ); + Size = MAP_APPFONT( 40, 12 ); + TabStop = TRUE; + }; + CancelButton RID_CANCEL { + Pos = MAP_APPFONT( 93, 58 ); + Size = MAP_APPFONT( 40, 12 ); + TabStop = TRUE; + }; + Text[ portuguese ] = "Editar variáveis"; + Text[ russian ] = "Edit variable"; + Text[ greek ] = "Edit variable"; + Text[ dutch ] = "Variabele editeren"; + Text[ french ] = "Édition de variable"; + Text[ spanish ] = "Editar variable"; + Text[ italian ] = "Edit variable"; + Text[ danish ] = "Edit variable"; + Text[ swedish ] = "Edit variable"; + Text[ polish ] = "Edit variable"; + Text[ portuguese_brazilian ] = "Variable editieren"; + Text[ japanese ] = "Edit variable"; + Text[ korean ] = "º¯¼ö ÆíÁý"; + Text[ chinese_simplified ] = "Variable editieren"; + Text[ chinese_traditional ] = "Edit variable"; + Text[ arabic ] = "Edit variable"; + Text[ turkish ] = "Deðiþken düzenle"; +}; + +FloatingWindow LOAD_CONF { + SVLook = TRUE; + Pos = MAP_APPFONT( 66, 23 ); + Size = MAP_APPFONT( 156, 51 ); + Text = "Lese Konfigurationsdateien"; + Text[ english_us ] = "Load configuration files"; + Moveable = TRUE; + FixedText WORK { + SVLook = TRUE; + Pos = MAP_APPFONT( 0, 8 ); + Size = MAP_APPFONT( 155, 10 ); + Text = "Slot IDs"; + Text[ english_us ] = "Slot IDs"; + Center = TRUE; + Text[ portuguese ] = "Slot IDs"; + Text[ russian ] = "Slot IDs"; + Text[ greek ] = "Slot IDs"; + Text[ dutch ] = "Slot IDs"; + Text[ french ] = "Slot IDs"; + Text[ spanish ] = "Slot IDs"; + Text[ italian ] = "Slot IDs"; + Text[ danish ] = "Slot IDs"; + Text[ swedish ] = "Slot IDs"; + Text[ polish ] = "Slot IDs"; + Text[ portuguese_brazilian ] = "Slot IDs"; + Text[ japanese ] = "Slot IDs"; + Text[ korean ] = "Slot IDs"; + Text[ chinese_simplified ] = "Slot IDs"; + Text[ chinese_traditional ] = "Slot IDs"; + Text[ arabic ] = "Slot IDs"; + Text[ turkish ] = "Slot IDs"; + }; + FixedText FILENAME { + SVLook = TRUE; + Pos = MAP_APPFONT( 0, 21 ); + Size = MAP_APPFONT( 155, 10 ); + Text = "Datei.win"; + Text[ english_us ] = "File.win"; + Center = TRUE; + Text[ portuguese ] = "File.win"; + Text[ russian ] = "File.win"; + Text[ greek ] = "File.win"; + Text[ dutch ] = "Bestand.win"; + Text[ french ] = "Fichier.win"; + Text[ spanish ] = "Archivo.win"; + Text[ italian ] = "File.win"; + Text[ danish ] = "File.win"; + Text[ swedish ] = "File.win"; + Text[ polish ] = "Plik.win"; + Text[ portuguese_brazilian ] = "Datei.win"; + Text[ japanese ] = "File.win"; + Text[ korean ] = "File.win"; + Text[ chinese_simplified ] = "File.win"; + Text[ chinese_traditional ] = "Datei.win"; + Text[ arabic ] = "File.win"; + Text[ turkish ] = "File.win"; + }; + Text[ portuguese ] = "A ler ficheiros de configuração"; + Text[ russian ] = "Load configuration files"; + Text[ greek ] = "Load configuration files"; + Text[ dutch ] = "Lees configuratiebestanden"; + Text[ french ] = "Lecture des fichiers de configuration"; + Text[ spanish ] = "Leyendo archivos de configuración"; + Text[ italian ] = "Load configuration files"; + Text[ danish ] = "Load configuration files"; + Text[ swedish ] = "Load configuration files"; + Text[ polish ] = "Czytaj pliki konfiguracyjne"; + Text[ portuguese_brazilian ] = "Lese Konfigurationsdateien"; + Text[ japanese ] = "Load configuration files"; + Text[ korean ] = "±¸¼º ÆÄÀÏ ·Îµå"; + Text[ chinese_simplified ] = "Load configuration files"; + Text[ chinese_traditional ] = "Lese Konfigurationsdateien"; + Text[ arabic ] = "Load configuration files"; + Text[ turkish ] = "Konfigürasyon dosyalarý okunuyor"; +}; diff --git a/basic/source/app/basicrt.cxx b/basic/source/app/basicrt.cxx new file mode 100644 index 000000000000..2ca8d5ee6edf --- /dev/null +++ b/basic/source/app/basicrt.cxx @@ -0,0 +1,163 @@ +/************************************************************************* + * + * $RCSfile: basicrt.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include "sbintern.hxx" +#include "runtime.hxx" +#include "basicrt.hxx" + + +const String BasicRuntime::GetModuleName( SbxNameType nType ) +{ + return pRun->GetModule()->GetName( nType ); +} + +const String BasicRuntime::GetMethodName( SbxNameType nType ) +{ + return pRun->GetMethod()->GetName( nType ); +} + +xub_StrLen BasicRuntime::GetLine() +{ + return pRun->nLine; +} + +xub_StrLen BasicRuntime::GetCol1() +{ + return pRun->nCol1; +} + +xub_StrLen BasicRuntime::GetCol2() +{ + return pRun->nCol2; +} + +BasicRuntime BasicRuntime::GetNextRuntime() +{ + return BasicRuntime ( pRun->pNext ); +} + + + + +const String BasicErrorStackEntry::GetModuleName( SbxNameType nType ) +{ + return pEntry->aMethod->GetModule()->GetName( nType ); +} + +const String BasicErrorStackEntry::GetMethodName( SbxNameType nType ) +{ + return pEntry->aMethod->GetName( nType ); +} + +xub_StrLen BasicErrorStackEntry::GetLine() +{ + return pEntry->nLine; +} + +xub_StrLen BasicErrorStackEntry::GetCol1() +{ + return pEntry->nCol1; +} + +xub_StrLen BasicErrorStackEntry::GetCol2() +{ + return pEntry->nCol2; +} + + + + +BasicRuntime BasicRuntimeAccess::GetRuntime() +{ + return BasicRuntime( pINST->pRun ); +} + +BOOL BasicRuntimeAccess::HasRuntime() +{ + return pINST ? ( pINST->pRun != NULL ) : FALSE; +} + +USHORT BasicRuntimeAccess::GetStackEntryCount() +{ + return GetSbData()->pErrStack->Count(); +} + +BasicErrorStackEntry BasicRuntimeAccess::GetStackEntry( USHORT nIndex ) +{ + return BasicErrorStackEntry( GetSbData()->pErrStack->GetObject( nIndex ) ); +} + +BOOL BasicRuntimeAccess::HasStack() +{ + return GetSbData()->pErrStack != NULL; +} + +void BasicRuntimeAccess::DeleteStack() +{ + delete GetSbData()->pErrStack; + GetSbData()->pErrStack = NULL; +} + +BOOL BasicRuntimeAccess::IsRunInit() +{ + return GetSbData()->bRunInit; +} diff --git a/basic/source/app/basmsg.hrc b/basic/source/app/basmsg.hrc new file mode 100644 index 000000000000..2e900e258209 --- /dev/null +++ b/basic/source/app/basmsg.hrc @@ -0,0 +1,79 @@ +/************************************************************************* + * + * $RCSfile: basmsg.hrc,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#include <svtools/ttglobal.hrc> + + +// Hier sind die Messages aus dem Verzeichnis /basic/source/app enhalten + + +/////////////////////////////// +// Fehlermeldungen, die in das Resultfile gelangen. +// ********************* +// *** !!ACHTUNG!! *** +// ********************* +// Die Nummern dürfen sich NIE! ändern, +// da sie in den Resultfiles gespeichert sind, und bei erneutem Anzeigen +// statdessen die entsprechenden neuen oder garkeine Strings angzeigt werden. +/////////////////////////////// + +#define S_PROG_START ( BAS_START + 0 ) +#define S_ERROR_OUTSIDE_TESTCASE ( BAS_START + 1 ) +#define S_WARNING_PREFIX ( BAS_START + 2 ) diff --git a/basic/source/app/basmsg.src b/basic/source/app/basmsg.src new file mode 100644 index 000000000000..abaab9a6b21f --- /dev/null +++ b/basic/source/app/basmsg.src @@ -0,0 +1,142 @@ +/************************************************************************* + * + * $RCSfile: basmsg.src,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#include "basmsg.hrc" + + +// Hier sind die Messages aus dem Verzeichnis /basic/source/app enhalten + + +/////////////////////////////// +// Fehlermeldungen, die in das Resultfile gelangen. +// ********************* +// *** !!ACHTUNG!! *** +// ********************* +// Die Nummern dürfen sich NIE! ändern, +// da sie in den Resultfiles gespeichert sind, und bei erneutem Anzeigen +// statdessen die entsprechenden neuen oder garkeine Strings angzeigt werden. +/////////////////////////////// +String S_PROG_START +{ + Text = "Programmstart: ($Arg1); ($Arg2)"; + Text[ english_us ] = "Program start: ($Arg1); ($Arg2)"; + Text[ LANGUAGE_USER1 ] = "Programmstart: <Datum>; <Uhrzeit>"; + Text[ portuguese ] = "Início do programa: ($Arg1); ($Arg2)"; + Text[ russian ] = "Program start: ($Arg1); ($Arg2)"; + Text[ greek ] = "Program start: ($Arg1); ($Arg2)"; + Text[ dutch ] = "Programma start: ($Arg1); ($Arg2)"; + Text[ french ] = "Démarrage du programme : ($Arg1); ($Arg2)"; + Text[ spanish ] = "Inicio de programa: ($Arg1); ($Arg2)"; + Text[ italian ] = "Program start: ($Arg1); ($Arg2)"; + Text[ danish ] = "Program start: ($Arg1); ($Arg2)"; + Text[ swedish ] = "Program start: ($Arg1); ($Arg2)"; + Text[ polish ] = "Uruchomienie programu: ($Arg1); ($Arg2)"; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "Program start: ($Arg1); ($Arg2)"; + Text[ korean ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ chinese_simplified ] = "Program start: ($Arg1); ($Arg2)"; + Text[ chinese_traditional ] = "Program start: ($Arg1); ($Arg2)"; + Text[ arabic ] = "Program start: ($Arg1); ($Arg2)"; + Text[ turkish ] = "Program baþlatma: ($Arg1); ($Arg2)"; +}; +String S_ERROR_OUTSIDE_TESTCASE +{ + Text = "Fehler außerhalb eines Testcase."; + Text[ english_us ] = "Error outside of test case"; + Text[ portuguese ] = "Erro fora de um «test case»."; + Text[ russian ] = "Error outside of test case."; + Text[ greek ] = "Error outside of test case."; + Text[ dutch ] = "Fout buiten testcase."; + Text[ french ] = "Erreur en dehors d'un scénario de test (test case)."; + Text[ spanish ] = "Error fuera de un Testcase."; + Text[ italian ] = "Error outside of test case"; + Text[ danish ] = "Error outside of test case."; + Text[ swedish ] = "Error outside of test case"; + Text[ polish ] = "B³¹d poza Testcase."; + Text[ portuguese_brazilian ] = "Fehler außerhalb eines Testcase."; + Text[ japanese ] = "Error outside of test case."; + Text[ korean ] = "Å×½ºÆ® ÄÉÀ̽º ¿ÜºÎÀÇ ¿À·ù"; + Text[ chinese_simplified ] = "Error outside of test case"; + Text[ chinese_traditional ] = "Error outside of test case"; + Text[ arabic ] = "Error outside of test case"; + Text[ turkish ] = "Error outside of test case"; +}; +String S_WARNING_PREFIX +{ + Text = "Warnung: "; + Text[ english_us ] = "Warning: "; + Text[ portuguese ] = "Aviso: "; + Text[ russian ] = "Ïðåäóïðåæäåíèå: "; + Text[ greek ] = "Warning: "; + Text[ dutch ] = "Waarschuwing: "; + Text[ french ] = "Avertissement : "; + Text[ spanish ] = "Advertencia: "; + Text[ italian ] = "Warning: "; + Text[ danish ] = "Warning: "; + Text[ swedish ] = "Warning: "; + Text[ polish ] = "Ostrze¿enie: "; + Text[ portuguese_brazilian ] = "Warning: "; + Text[ japanese ] = "Œx: "; + Text[ korean ] = "°æ°í: "; + Text[ chinese_simplified ] = "Warning: "; + Text[ chinese_traditional ] = "Warning: "; + Text[ arabic ] = "ÊÍÐíÑ: "; + Text[ turkish ] = "Uyarý: "; +}; diff --git a/basic/source/app/brkpnts.cxx b/basic/source/app/brkpnts.cxx new file mode 100644 index 000000000000..29b7326c2ff7 --- /dev/null +++ b/basic/source/app/brkpnts.cxx @@ -0,0 +1,434 @@ +/************************************************************************* + * + * $RCSfile: brkpnts.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _LIST_HXX //autogen +#include <tools/list.hxx> +#endif +#ifndef _SBXCLASS_HXX //autogen +#include <svtools/sbx.hxx> +#endif +#ifndef _SB_SBMOD_HXX //autogen +#include <sbmod.hxx> +#endif +#ifndef _SB_SBSTAR_HXX //autogen +#include <sbstar.hxx> +#endif +#ifndef _SB_SBMETH_HXX //autogen +#include <sbmeth.hxx> +#endif +#ifndef _SV_IMAGE_HXX //autogen +#include <vcl/image.hxx> +#endif +#ifndef _TEXTDATA_HXX //autogen +#include <svtools/textdata.hxx> +#endif +#ifndef _SV_CONFIG_HXX //autogen +#include <vcl/config.hxx> +#endif +#ifndef _SV_GRADIENT_HXX +#include <vcl/gradient.hxx> +#endif + +#ifndef _BASIC_TTRESHLP_HXX +#include "ttstrhlp.hxx" +#endif + +#include <brkpnts.hxx> +#include "basic.hrc" +#include "resids.hrc" + +struct Breakpoint +{ + USHORT nLine; + + Breakpoint( USHORT nL ) { nLine = nL; } +}; + + +ImageList* BreakpointWindow::pImages = NULL; + + +BreakpointWindow::BreakpointWindow( Window *pParent ) +: Window( pParent ) +, nCurYOffset( 0 ) +, pModule( NULL ) +{ + if ( !pImages ) + pImages = new ImageList( ResId( RID_IMGLST_LAYOUT ) ); + + Gradient aGradient( GRADIENT_AXIAL, Color( 185, 182, 215 ), Color( 250, 245, 255 ) ); + aGradient.SetAngle(900); + SetBackground( aGradient ); + Show(); +} + + +void BreakpointWindow::Reset() +{ + Breakpoint* pBrk = First(); + while ( pBrk ) + { + delete pBrk; + pBrk = Next(); + } + Clear(); + + pModule->ClearAllBP(); +} + +void BreakpointWindow::SetModule( SbModule *pMod ) +{ + pModule = pMod; + USHORT i; + for ( i=0 ; i < pModule->GetBPCount() ; i++ ) + { + InsertBreakpoint( pModule->GetBP( i ) ); + } + SetBPsInModule(); +} + + +void BreakpointWindow::SetBPsInModule() +{ + pModule->ClearAllBP(); + + Breakpoint* pBrk = First(); + while ( pBrk ) + { + pModule->SetBP( (USHORT)pBrk->nLine ); +#ifdef DEBUG + DBG_ASSERT( pModule->IsBP( (USHORT)pBrk->nLine ), "Brechpunkt wurde nicht gesetzt" ) +#endif + pBrk = Next(); + } + for ( USHORT nMethod = 0; nMethod < pModule->GetMethods()->Count(); nMethod++ ) + { + SbMethod* pMethod = (SbMethod*)pModule->GetMethods()->Get( nMethod ); + DBG_ASSERT( pMethod, "Methode nicht gefunden! (NULL)" ); + pMethod->SetDebugFlags( pMethod->GetDebugFlags() | SbDEBUG_BREAK ); + } +} + + +void BreakpointWindow::InsertBreakpoint( USHORT nLine ) +{ + Breakpoint* pNewBrk = new Breakpoint( nLine ); + Breakpoint* pBrk = First(); + while ( pBrk ) + { + if ( nLine <= pBrk->nLine ) + { + if ( pBrk->nLine != nLine ) + Insert( pNewBrk ); + else + delete pNewBrk; + pNewBrk = NULL; + pBrk = NULL; + } + else + pBrk = Next(); + } + // Keine Einfuegeposition gefunden => LIST_APPEND + if ( pNewBrk ) + Insert( pNewBrk, LIST_APPEND ); + + // vielleicht mal etwas genauer... + Invalidate(); + + if ( pModule->SetBP( nLine ) ) + { +#ifdef DEBUG + DBG_ASSERT( pModule->IsBP( nLine ), "Brechpunkt wurde nicht gesetzt" ) +#endif + if ( StarBASIC::IsRunning() ) + { + for ( USHORT nMethod = 0; nMethod < pModule->GetMethods()->Count(); nMethod++ ) + { + SbMethod* pMethod = (SbMethod*)pModule->GetMethods()->Get( nMethod ); + DBG_ASSERT( pMethod, "Methode nicht gefunden! (NULL)" ); + pMethod->SetDebugFlags( pMethod->GetDebugFlags() | SbDEBUG_BREAK ); + } + } + } +#ifdef DEBUG + DBG_ASSERT( pModule->IsBP( nLine ), "Brechpunkt wurde nicht gesetzt" ) +#endif +} + + +Breakpoint* BreakpointWindow::FindBreakpoint( ULONG nLine ) +{ + Breakpoint* pBrk = First(); + while ( pBrk ) + { + if ( pBrk->nLine == nLine ) + return pBrk; + + pBrk = Next(); + } + + return (Breakpoint*)0; +} + + +void BreakpointWindow::AdjustBreakpoints( ULONG nLine, BOOL bInserted ) +{ + if ( nLine == TEXT_PARA_ALL+1 ) + return; + Breakpoint* pBrk = First(); + while ( pBrk ) + { + BOOL bDelBrk = FALSE; + if ( pBrk->nLine == nLine ) + { + if ( bInserted ) + pBrk->nLine++; + else + bDelBrk = TRUE; + } + else if ( pBrk->nLine > nLine ) + { + if ( bInserted ) + pBrk->nLine++; + else + pBrk->nLine--; + } + + if ( bDelBrk ) + { + ULONG n = GetCurPos(); + delete Remove( pBrk ); + pBrk = Seek( n ); + } + else + { + pBrk = Next(); + } + } +} + + +void BreakpointWindow::LoadBreakpoints( String aFilename ) +{ + Config aConfig(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); + + aConfig.SetGroup("Breakpoints"); + + ByteString aBreakpoints; + aBreakpoints = aConfig.ReadKey( ByteString( aFilename, RTL_TEXTENCODING_UTF8 ) ); + + xub_StrLen i; + + for ( i = 0 ; i < aBreakpoints.GetTokenCount( ';' ) ; i++ ) + { + InsertBreakpoint( aBreakpoints.GetToken( i, ';' ).ToInt32() ); + } +} + + +void BreakpointWindow::SaveBreakpoints( String aFilename ) +{ + ByteString aBreakpoints; + + Breakpoint* pBrk = First(); + while ( pBrk ) + { + if ( aBreakpoints.Len() ) + aBreakpoints += ';'; + + aBreakpoints += ByteString::CreateFromInt32( pBrk->nLine ); + pBrk = Next(); + } + + Config aConfig(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); + + aConfig.SetGroup("Breakpoints"); + + if ( aBreakpoints.Len() ) + aConfig.WriteKey( ByteString( aFilename, RTL_TEXTENCODING_UTF8 ), aBreakpoints ); + else + aConfig.DeleteKey( ByteString( aFilename, RTL_TEXTENCODING_UTF8 ) ); +} + + +void BreakpointWindow::Paint( const Rectangle& ) +{ + Size aOutSz( GetOutputSize() ); + long nLineHeight = GetTextHeight(); + + Image aBrk( pImages->GetImage( IMGID_BRKENABLED ) ); + Size aBmpSz( aBrk.GetSizePixel() ); + aBmpSz = PixelToLogic( aBmpSz ); + Point aBmpOff( 0, 0 ); + aBmpOff.X() = ( aOutSz.Width() - aBmpSz.Width() ) / 2; + aBmpOff.Y() = ( nLineHeight - aBmpSz.Height() ) / 2; + + Breakpoint* pBrk = First(); + while ( pBrk ) + { +#ifdef DEBUG + DBG_ASSERT( pModule->IsBP( pBrk->nLine ), "Brechpunkt wurde nicht gesetzt" ) +#endif + ULONG nLine = pBrk->nLine-1; + ULONG nY = nLine*nLineHeight - nCurYOffset; + DrawImage( Point( 0, nY ) + aBmpOff, aBrk ); + pBrk = Next(); + } + ShowMarker( TRUE ); +} + + +Breakpoint* BreakpointWindow::FindBreakpoint( const Point& rMousePos ) +{ + long nLineHeight = GetTextHeight(); + long nYPos = rMousePos.Y() + nCurYOffset; + + Breakpoint* pBrk = First(); + while ( pBrk ) + { + ULONG nLine = pBrk->nLine-1; + long nY = nLine*nLineHeight; + if ( ( nYPos > nY ) && ( nYPos < ( nY + nLineHeight ) ) ) + return pBrk; + pBrk = Next(); + } + return 0; +} + + +void BreakpointWindow::ToggleBreakpoint( USHORT nLine ) +{ + BOOL bNewBreakPoint = FALSE; + Breakpoint* pBrk = FindBreakpoint( nLine ); + if ( pBrk ) // entfernen + { + pModule->ClearBP( nLine ); + delete Remove( pBrk ); + } + else // einen erzeugen + { + InsertBreakpoint( nLine ); + } + // vielleicht mal etwas genauer... + Invalidate(); +} + +void BreakpointWindow::ShowMarker( BOOL bShow ) +{ + if ( nMarkerPos == MARKER_NOMARKER ) + return; + + Size aOutSz( GetOutputSize() ); + long nLineHeight = GetTextHeight(); + + Image aMarker; + if ( bErrorMarker ) + aMarker = pImages->GetImage( IMGID_ERRORMARKER ); + else + aMarker = pImages->GetImage( IMGID_STEPMARKER ); + + Size aMarkerSz( aMarker.GetSizePixel() ); + aMarkerSz = PixelToLogic( aMarkerSz ); + Point aMarkerOff( 0, 0 ); + aMarkerOff.X() = ( aOutSz.Width() - aMarkerSz.Width() ) / 2; + aMarkerOff.Y() = ( nLineHeight - aMarkerSz.Height() ) / 2; + + ULONG nY = nMarkerPos*nLineHeight - nCurYOffset; + Point aPos( 0, nY ); + aPos += aMarkerOff; + if ( bShow ) + DrawImage( aPos, aMarker ); + else + Invalidate( Rectangle( aPos, aMarkerSz ) ); +} + + +void BreakpointWindow::MouseButtonDown( const MouseEvent& rMEvt ) +{ + if ( rMEvt.GetClicks() == 2 ) + { + Point aMousePos( PixelToLogic( rMEvt.GetPosPixel() ) ); + long nLineHeight = GetTextHeight(); + long nYPos = aMousePos.Y() + nCurYOffset; + long nLine = nYPos / nLineHeight + 1; + ToggleBreakpoint( nLine ); + // vielleicht mal etwas genauer... + Invalidate(); + } +} + + +void BreakpointWindow::SetMarkerPos( USHORT nLine, BOOL bError ) +{ + ShowMarker( FALSE ); // Alten wegzeichen... + nMarkerPos = nLine; + bErrorMarker = bError; + ShowMarker( TRUE ); // Neuen zeichnen... + Update(); +} + + +void BreakpointWindow::Scroll( long nHorzScroll, long nVertScroll ) +{ + nCurYOffset -= nVertScroll; + Window::Scroll( nHorzScroll, nVertScroll ); +} + diff --git a/basic/source/app/brkpnts.hxx b/basic/source/app/brkpnts.hxx new file mode 100644 index 000000000000..9150542a9304 --- /dev/null +++ b/basic/source/app/brkpnts.hxx @@ -0,0 +1,130 @@ +/************************************************************************* + * + * $RCSfile: brkpnts.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SV_WINDOW_HXX //autogen +#include <vcl/window.hxx> +#endif + +#define MARKER_NOMARKER 0xFFFF + + +class SbModule; +class BreakpointListe; +struct Breakpoint; +class ImageList; + +DECLARE_LIST( BreakpointList, Breakpoint* ); + +class BreakpointWindow : public Window, public BreakpointList +{ +public: + BreakpointWindow( Window *pParent ); +// ~BreakpointWindow(); + + void Reset(); + + void SetModule( SbModule *pMod ); + void SetBPsInModule(); + + void InsertBreakpoint( USHORT nLine ); + void ToggleBreakpoint( USHORT nLine ); + void AdjustBreakpoints( ULONG nLine, BOOL bInserted ); + + void LoadBreakpoints( String aFilename ); + void SaveBreakpoints( String aFilename ); + +protected: + Breakpoint* FindBreakpoint( ULONG nLine ); + +private: + BreakpointListe *pBreakpoints; + +private: + long nCurYOffset; + USHORT nMarkerPos; + SbModule* pModule; + BOOL bErrorMarker; + static ImageList *pImages; + +protected: + virtual void Paint( const Rectangle& ); + Breakpoint* FindBreakpoint( const Point& rMousePos ); + void ShowMarker( BOOL bShow ); + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + +public: + +// void SetModulWindow( ModulWindow* pWin ) +// { pModulWindow = pWin; } + + void SetMarkerPos( USHORT nLine, BOOL bErrorMarker = FALSE ); + + void Scroll( long nHorzScroll, long nVertScroll ); + long& GetCurYOffset() { return nCurYOffset; } +}; + + + + + + + + diff --git a/basic/source/app/dataedit.hxx b/basic/source/app/dataedit.hxx new file mode 100644 index 000000000000..5727f157bd37 --- /dev/null +++ b/basic/source/app/dataedit.hxx @@ -0,0 +1,155 @@ +/************************************************************************* + * + * $RCSfile: dataedit.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:08 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef DATAEDIT_HXX +#define DATAEDIT_HXX + +#ifndef _SV_MENU_HXX +#include <vcl/menu.hxx> +#endif +#ifndef _LINK_HXX //autogen +#include <tools/link.hxx> +#endif +#ifndef _SV_GEN_HXX +#include <tools/gen.hxx> +#endif +#ifndef _TEXTDATA_HXX //autogen +#include <svtools/textdata.hxx> +#endif + +class String; +class Font; + +// Find, Load und Save müssen implementiert werden, +// die anderen müssen in MemberType existieren +#define DATA_FUNC_DEF( MemberName, MemberType ) \ +public: \ + MemberType MemberName; \ + BOOL Find( const String& rStr ); \ + BOOL Load( const String& rStr ); \ + BOOL Save( const String& rStr ); \ + \ + void GrabFocus(){ MemberName.GrabFocus(); } \ + void Show(){ MemberName.Show(); } \ + void SetPosPixel( const Point& rNewPos ){ MemberName.SetPosPixel(rNewPos); }\ + void SetSizePixel( const Size& rNewSize ){ MemberName.SetSizePixel(rNewSize); } \ + Size GetSizePixel(){ return MemberName.GetSizePixel(); } \ + Point GetPosPixel(){ return MemberName.GetPosPixel(); } \ + void Update(){ MemberName.Update(); } \ + void SetFont( const Font& rNewFont ){ MemberName.SetFont(rNewFont); } \ + \ + void Delete(); \ + void Cut(); \ + void Copy(); \ + void Paste(); \ + void Undo(); \ + void Redo(); \ + String GetText() const; \ + void SetText( const String& rStr ); \ + BOOL HasText() const; \ + String GetSelected(); \ + TextSelection GetSelection() const; \ + void SetSelection( const TextSelection& rSelection ); \ + USHORT GetLineNr() const; \ + void ReplaceSelected( const String& rStr ); \ + BOOL IsModified(); \ + void SetModifyHdl( Link l ); + + +class DataEdit +{ +public: + virtual ~DataEdit(){} + + virtual void Delete()=0; + virtual void Cut()=0; + virtual void Copy()=0; + virtual void Paste()=0; + + virtual void Undo()=0; + virtual void Redo()=0; + + virtual BOOL Find( const String& )=0; // Text suchen & markieren + virtual BOOL Load( const String& )=0; // Text aus Datei laden + virtual BOOL Save( const String& )=0; // Text in Datei speichern + virtual String GetSelected()=0; + virtual void GrabFocus()=0; + virtual TextSelection GetSelection() const=0; + virtual void SetSelection( const TextSelection& rSelection )=0; + virtual USHORT GetLineNr() const=0; + virtual String GetText() const=0; + virtual void SetText( const String& rStr )=0; + virtual BOOL HasText() const=0; // damit vermeiden wir GetText.Len() + virtual void ReplaceSelected( const String& rStr )=0; + virtual BOOL IsModified()=0; + virtual void SetModifyHdl( Link )=0; + virtual void Show()=0; + virtual void SetPosPixel( const Point& rNewPos )=0; + virtual void SetSizePixel( const Size& rNewSize )=0; + virtual Size GetSizePixel()=0; + virtual Point GetPosPixel()=0; + virtual void Update()=0; + virtual void SetFont( const Font& rNewFont )=0; + + virtual void BuildKontextMenu( PopupMenu *&pMenu ){;} // Wer will kann hier eigene Einträge hinzufügen +}; + +#endif diff --git a/basic/source/app/dialogs.cxx b/basic/source/app/dialogs.cxx new file mode 100644 index 000000000000..31865100b098 --- /dev/null +++ b/basic/source/app/dialogs.cxx @@ -0,0 +1,1064 @@ +/************************************************************************* + * + * $RCSfile: dialogs.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SOLAR_H +#include <tools/solar.h> +#endif + +HACK( #define protected public ) +#define protected public // Kleine Schweinerei um an FreeResource ranzukommen +#ifndef _TOOLS_RC_HXX //autogen +#include <tools/rc.hxx> +#endif +#undef protected + +#ifndef _DIALOG_HXX //autogen +#include <vcl/dialog.hxx> +#endif +#ifndef _BUTTON_HXX //autogen +#include <vcl/button.hxx> +#endif +#ifndef _FIXED_HXX //autogen +#include <vcl/fixed.hxx> +#endif +#ifndef _EDIT_HXX //autogen +#include <vcl/edit.hxx> +#endif +#ifndef _CONFIG_HXX //autogen +#include <vcl/config.hxx> +#endif +#ifndef _MSGBOX_HXX //autogen +#include <vcl/msgbox.hxx> +#endif +#ifndef _TOOLS_DEBUG_HXX //autogen +#include <tools/debug.hxx> +#endif +#ifndef _SV_FILEDLG_HXX //autogen +#include <svtools/filedlg.hxx> +#endif +#ifndef _STREAM_HXX //autogen +#include <tools/stream.hxx> +#endif +#ifndef _FSYS_HXX //autogen +#include <tools/fsys.hxx> +#endif +#ifndef _SV_CLIP_HXX //autogen +#include <vcl/clip.hxx> +#endif +#ifndef _SV_SPLITWIN_HXX //autogen +#include <vcl/splitwin.hxx> +#endif +#ifndef _ZFORLIST_HXX //autogen +#include <svtools/zformat.hxx> +#endif + +#include <svtools/pver.hxx> + +// Ohne Includeschutz +#include <svtools/svtdata.hxx> +#include <svtools/solar.hrc> + + +#ifndef _BASIC_DISPDEFS_HXX +#include "dispdefs.hxx" +#endif +#include "testtool.hxx" +#include "dialogs.hxx" +#include "resids.hrc" +#include "basic.hrc" + +#include "app.hxx" + +AboutDialog::AboutDialog( Window* pParent, const ResId& id ) +: ModalDialog( pParent, id ) +, a1( this, ResId( 1 ) ) +, a3( this, ResId( 3 ) ) +, a4( this, ResId( 4 ) ) +, aVersionString( this, ResId( RID_VERSIONSTRING ) ) +//, aIcon( this, ResId( RID_ICON ) ) +, aOk ( this, ResId( RID_OK ) ) +{ + aVersionString.SetText( ProductVersion::GetMajorVersion().Append( ProductVersion::GetMinorVersion() ) + .AppendAscii( " BUILD:" ).Append( ProductVersion::GetBuildNumber() ) ); + FreeResource(); +} + +//////////////////////////////////////////////////////////////////// + +FindDialog::FindDialog( Window* pParent, const ResId& id, String& Text ) +: ModalDialog( pParent, id ) +, aFT1( this, ResId( RID_FIXEDTEXT1 ) ) +, aFind( this, ResId( RID_FIND ) ) +, aOk( this, ResId( RID_OK ) ) +, aCancel( this, ResId( RID_CANCEL ) ) +{ + FreeResource(); + pFind = &Text; + // Button-Handler: + aOk.SetClickHdl( LINK( this, FindDialog, ButtonClick ) ); + aCancel.SetClickHdl( LINK( this, FindDialog, ButtonClick ) ); + aFind.SetText( Text ); +} + +IMPL_LINK_INLINE_START( FindDialog, ButtonClick, Button *, pB ) +{ + if( pB == &aOk ) { + *pFind = aFind.GetText(); + EndDialog( TRUE ); + } else EndDialog( FALSE ); + return TRUE; +} +IMPL_LINK_INLINE_END( FindDialog, ButtonClick, Button *, pB ) + +ReplaceDialog::ReplaceDialog(Window* pParent, const ResId& id, String& Old, String& New ) +: ModalDialog( pParent, id ) +, aFT1( this, ResId( RID_FIXEDTEXT1 ) ) +, aFT2( this, ResId( RID_FIXEDTEXT2 ) ) +, aFind( this, ResId( RID_FIND ) ) +, aReplace(this, ResId( RID_REPLACE ) ) +, aOk( this, ResId( RID_OK ) ) +, aCancel( this, ResId( RID_CANCEL ) ) +{ + FreeResource(); + pFind = &Old; + pReplace = &New; + // Button-Handler: + aOk.SetClickHdl( LINK( this, ReplaceDialog, ButtonClick ) ); + aCancel.SetClickHdl( LINK( this, ReplaceDialog, ButtonClick ) ); + aFind.SetText( Old ); + aReplace.SetText( New ); +} + +IMPL_LINK( ReplaceDialog, ButtonClick, Button *, pB ) +{ + if( pB == &aOk ) { + *pFind = aFind.GetText(); + *pReplace = aReplace.GetText(); + EndDialog( TRUE ); + } else EndDialog( FALSE ); + return TRUE; +} + +//////////////////////////////////////////////////////////////////// + +ConfEdit::ConfEdit( Window* pParent, USHORT nResText, USHORT nResEdit, USHORT nResButton, const ByteString& aKN ) +: PushButton( pParent, ResId(nResButton) ) +, aText( pParent, ResId(nResText) ) +, aEdit( pParent, ResId(nResEdit) ) +, aKeyName(aKN) +{ + Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); + aConf.SetGroup("Path"); + + String aTemp = UniString( aConf.ReadKey( aKeyName ), RTL_TEXTENCODING_UTF8 ); + aEdit.SetText( aTemp ); +} + +void ConfEdit::Save() +{ + Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); + aConf.SetGroup("Path"); + + aConf.WriteKey( aKeyName, ByteString( aEdit.GetText(), RTL_TEXTENCODING_UTF8 ) ); +} + +void ConfEdit::Click() +{ + PathDialog aPD( this ); + aPD.SetPath( aEdit.GetText() ); + aPD.Execute(); + aEdit.SetText( aPD.GetPath() ); +} + + +OptionsDialog::OptionsDialog( Window* pParent, const ResId& aResId ) +: ModelessDialog( pParent, aResId ) +, aTabCtrl( this, ResId( RES_TC_OPTIONS ) ) +, aOK( this, ResId( RID_OK ) ) +, aCancel( this, ResId( RID_CANCEL ) ) +{ + aTabCtrl.FreeResource(); + FreeResource(); + aTabCtrl.SetActivatePageHdl( LINK( this, OptionsDialog, ActivatePageHdl ) ); + aTabCtrl.SetCurPageId( RID_TP_GEN ); + ActivatePageHdl( &aTabCtrl ); + + aOK.SetClickHdl( LINK( this, OptionsDialog, OKClick ) ); +} + +OptionsDialog::~OptionsDialog() +{ + for ( USHORT i = 0; i < aTabCtrl.GetPageCount(); i++ ) + delete aTabCtrl.GetTabPage( aTabCtrl.GetPageId( i ) ); +}; + +BOOL OptionsDialog::Close() +{ + if ( ModelessDialog::Close() ) + { + delete this; + return TRUE; + } + else + return FALSE; +} + + +IMPL_LINK( OptionsDialog, ActivatePageHdl, TabControl *, pTabCtrl ) +{ + USHORT nId = pTabCtrl->GetCurPageId(); + // Wenn TabPage noch nicht erzeugt wurde, dann erzeugen + if ( !pTabCtrl->GetTabPage( nId ) ) + { + TabPage *pNewTabPage = NULL; + switch ( nId ) + { + case RID_TP_SPE: + pNewTabPage = new SpecialOptions( pTabCtrl ); + break; + case RID_TP_GEN: + pNewTabPage = new GenericOptions( pTabCtrl ); + break; + default: DBG_ERROR( "PageHdl: Unbekannte ID!" ); + } + DBG_ASSERT( pNewTabPage, "Keine Page!" ); + pTabCtrl->SetTabPage( nId, pNewTabPage ); + } + return 0; +} + + + + +IMPL_LINK( OptionsDialog, OKClick, Button *, pButton ) +{ + SpecialOptions *pSpecial; + pSpecial = (SpecialOptions*)aTabCtrl.GetTabPage( RID_TP_SPE ); + if ( pSpecial ) + pSpecial->Save(); + + GenericOptions *pGeneric; + pGeneric = (GenericOptions*)aTabCtrl.GetTabPage( RID_TP_GEN ); + if ( pGeneric ) + pGeneric->Save(); + + Close(); + return 0; +} + + +SpecialOptions::SpecialOptions( Window* pParent ) +: TabPage( pParent, ResId( RID_TP_SPECIAL ) ) +, aDirs( this, ResId(GB_DIRECTORIES) ) +, aLog( this, LOG_TEXT, LOG_NAME, LOG_SET ,"LogBasisverzeichnis" ) +, aBasis( this, BASIS_TEXT, BASIS_NAME, BASIS_SET ,"Basisverzeichnis" ) +, aHID( this, HID_TEXT, HID_NAME, HID_SET ,"HIDVerzeichnis" ) +, aOther( this, ResId(GB_OTHER) ) +, aTimeoutText( this, ResId(TIMEOUT_TEXT) ) +, aServerTimeout( this, ResId(SERVER_TIMEOUT) ) +, aAutoReload( this, ResId(CB_AUTORELOAD) ) +{ + FreeResource(); + + Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); + aConf.SetGroup("Misc"); + ByteString aTemp = aConf.ReadKey( "ServerTimeout", "10000" ); // Vorgabe 1 Minute + aServerTimeout.SetTime( Time(aTemp.ToInt32()) ); + + aTemp = aConf.ReadKey( "AutoReload", "0" ); + aAutoReload.Check( aTemp.CompareTo("1") == COMPARE_EQUAL ); +} + + +void SpecialOptions::Save() +{ + aLog.Save(); + aBasis.Save(); + aHID.Save(); + + Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); + aConf.SetGroup("Misc"); + aConf.WriteKey( "ServerTimeout", ByteString::CreateFromInt32( aServerTimeout.GetTime().GetTime() ) ); + aConf.WriteKey( "AutoReload", aAutoReload.IsChecked()?"1":"0" ); + + ((BasicApp*)GetpApp())->LoadIniFile(); +} + + +GenericOptions::GenericOptions( Window* pParent ) +: TabPage( pParent, ResId( RID_TP_GENERIC ) ) +, aConf( Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") ) ) + +, aGbArea( this, ResId( RID_GB_AREA ) ) +, aCbArea( this, ResId( RID_CB_AREA ) ) +, aPbNewArea( this, ResId( RID_PB_NEW_AREA ) ) +, aPbDelArea( this, ResId( RID_PD_DEL_AREA ) ) + +, aGbValue( this, ResId( RID_GB_VALUE ) ) +, aCbValue( this, ResId( RID_CB_VALUE ) ) +, aPbNewValue( this, ResId( RID_PB_NEW_VALUE ) ) +, aPbDelValue( this, ResId( RID_PB_DEL_VALUE ) ) +{ + FreeResource(); + DirEntry aDE; + aTempConfName = aDE.TempName().GetFull(); + pTempConf = new Config( aTempConfName ); + pTempConf->SetGroup("Main"); + + LoadData(); + + aCbArea.EnableAutocomplete( TRUE ); + aCbValue.EnableAutocomplete( TRUE ); + + aCbArea.SetSelectHdl( LINK( this, GenericOptions, LoadGroup ) ); + + aPbNewArea.SetClickHdl( LINK( this, GenericOptions, NewGroup ) ); + aPbDelArea.SetClickHdl( LINK( this, GenericOptions, DelGroup ) ); + + aPbNewValue.SetClickHdl( LINK( this, GenericOptions, NewValue ) ); + aPbDelValue.SetClickHdl( LINK( this, GenericOptions, DelValue ) ); + + + aCbArea.SetModifyHdl( LINK( this, GenericOptions, CheckButtonsHdl ) ); + aCbValue.SetModifyHdl( LINK( this, GenericOptions, CheckButtonsHdl ) ); + aCbValue.SetSelectHdl( LINK( this, GenericOptions, CheckButtonsHdl ) ); + +} + +GenericOptions::~GenericOptions() +{ + pTempConf->DeleteGroup("Main"); + delete pTempConf; +} + +StringList* GenericOptions::GetAllGroups() +{ + StringList* pGroups = new StringList(); + for ( USHORT i = 0 ; i < aConf.GetGroupCount() ; i++ ) + { + String *pGroup = new String( aConf.GetGroupName( i ), RTL_TEXTENCODING_UTF8 ); + pGroups->Insert( pGroup ); + } + return pGroups; +} + +void GenericOptions::LoadData() +{ + StringList* pGroups = GetAllGroups(); + String* pGroup; + while ( pGroup = pGroups->First() ) + { + pGroups->Remove( pGroup ); + aConf.SetGroup( ByteString( *pGroup, RTL_TEXTENCODING_UTF8 ) ); + if ( HasKey( aConf, C_KEY_AKTUELL ) ) + { + aCbArea.InsertEntry( *pGroup ); + } + delete pGroup; + } + aCbArea.SetText( aCbArea.GetEntry( 0 ) ); + CheckButtons( aCbArea, aPbNewArea, aPbDelArea ); + + // Und auch die Daten laden + LINK( this, GenericOptions, LoadGroup ).Call( NULL ); +} + + +String GenericOptions::ReadKey( const ByteString &aGroup, const ByteString &aKey ) +{ + ByteString aGroupKey( aGroup ); + aGroupKey.Append( aKey ); + if ( HasKey( *pTempConf, aGroupKey ) ) + return UniString( pTempConf->ReadKey( aGroupKey ), RTL_TEXTENCODING_UTF8 ); + else + { + aConf.SetGroup( aGroup ); + return UniString( aConf.ReadKey( aKey ), RTL_TEXTENCODING_UTF8 ); + } +} + +BOOL GenericOptions::HasKey( Config &aConfig, const ByteString &aKey ) +{ + return ! ( aConfig.ReadKey( aKey ).Len() == 0 && aConfig.ReadKey( aKey, "Default" ).Len() != 0 ); +} + +IMPL_LINK( GenericOptions, LoadGroup, ComboBox*, EMPTYARG ) +{ + String aCurrentValue; + String aAllValues; + + if ( aLastGroupName.Len() ) + { // Werte zwischenspeichern? + aCurrentValue = aCbValue.GetText(); + if ( aCbValue.GetEntryPos( aCurrentValue ) == COMBOBOX_ENTRY_NOTFOUND ) + { // Dann legen wir mal einen neuen Wert an + LINK( this, GenericOptions, NewValue ).Call( NULL ); + } + + pTempConf->WriteKey( ByteString( aLastGroupName ).Append( C_KEY_AKTUELL ), ByteString( aCurrentValue, RTL_TEXTENCODING_UTF8 ) ); + USHORT i; + for ( i=0 ; i < aCbValue.GetEntryCount() ; i++ ) + { + if ( i ) // ab Entry 1 + aAllValues += ';'; + aAllValues += aCbValue.GetEntry( i ); + } + pTempConf->WriteKey( ByteString( aLastGroupName ).Append( C_KEY_ALLE ), ByteString( aAllValues, RTL_TEXTENCODING_UTF8 ) ); + } + + aCbValue.Clear(); + + ByteString aGroupName = ByteString( aCbArea.GetText(), RTL_TEXTENCODING_UTF8 ); + aCurrentValue = ReadKey( aGroupName, C_KEY_AKTUELL ); + aAllValues = ReadKey( aGroupName, C_KEY_ALLE ); + + xub_StrLen i; + for ( i=0 ; i < aAllValues.GetTokenCount() ; i++ ) + { + aCbValue.InsertEntry( aAllValues.GetToken( i ) ); + } + aCbValue.SetText( aCurrentValue ); + + aLastGroupName = aGroupName; + CheckButtons( aCbArea, aPbNewArea, aPbDelArea ); + CheckButtons( aCbValue, aPbNewValue, aPbDelValue ); + return 0; +} + +IMPL_LINK( GenericOptions, DelGroup, Button*, EMPTYARG ) +{ + String aGroup = aCbArea.GetText(); + if ( aCbArea.GetEntryPos( aGroup ) != COMBOBOX_ENTRY_NOTFOUND ) + { + aCbArea.RemoveEntry( aGroup ); + ByteString aByteGroup( aGroup, RTL_TEXTENCODING_UTF8 ); + pTempConf->WriteKey( C_KEY_DELETE, pTempConf->ReadKey( C_KEY_DELETE ).Append( aByteGroup ) ); + pTempConf->DeleteKey( ByteString( aByteGroup ).Append( C_KEY_AKTUELL ) ); + pTempConf->DeleteKey( ByteString( aByteGroup ).Append( C_KEY_ALLE ) ); + } + + aCbArea.SetText( aCbArea.GetEntry( 0 ) ); + LINK( this, GenericOptions, LoadGroup ).Call( NULL ); + + return 0; +} + +IMPL_LINK( GenericOptions, NewGroup, Button*, EMPTYARG ) +{ + aCbArea.InsertEntry( aCbArea.GetText() ); + + LINK( this, GenericOptions, LoadGroup ).Call( NULL ); + + return 0; +} + +IMPL_LINK( GenericOptions, DelValue, Button*, EMPTYARG ) +{ + String aValue = aCbValue.GetText(); + if ( aCbValue.GetEntryPos( aValue ) != COMBOBOX_ENTRY_NOTFOUND ) + { + aCbValue.RemoveEntry( aValue ); + } + + aCbValue.SetText( aCbValue.GetEntry( 0 ) ); + CheckButtons( aCbValue, aPbNewValue, aPbDelValue ); + return 0; +} + +IMPL_LINK( GenericOptions, NewValue, Button*, EMPTYARG ) +{ + aCbValue.InsertEntry( aCbValue.GetText() ); + CheckButtons( aCbValue, aPbNewValue, aPbDelValue ); + return 0; +} + +IMPL_LINK( GenericOptions, CheckButtonsHdl, ComboBox*, pCB ) +{ + if ( pCB == &aCbArea ) + CheckButtons( aCbArea, aPbNewArea, aPbDelArea ); + if ( pCB == &aCbValue ) + CheckButtons( aCbValue, aPbNewValue, aPbDelValue ); + return 0; +} + +void GenericOptions::CheckButtons( ComboBox &aCB, Button &aNewB, Button &aDelB ) +{ + aNewB.Enable( aCB.GetEntryPos( aCB.GetText() ) == COMBOBOX_ENTRY_NOTFOUND && aCB.GetText().Len() ); +} + +void GenericOptions::Save() +{ + xub_StrLen i; + + // Erstmal eventuelle Änderungen Speichern + LINK( this, GenericOptions, LoadGroup ).Call( NULL ); + + // Zuerst alles was wir Gelöscht haben raushauen + ByteString aDelete = pTempConf->ReadKey( C_KEY_DELETE ); + for ( i=0 ; i < aDelete.GetTokenCount() ; i++ ) + { + aConf.DeleteGroup( aDelete.GetToken( i ) ); + } + + // Dann alles aus der Temporären in die Echte ini kopieren. + for ( i=0 ; i < aCbArea.GetEntryCount() ; i++ ) + { + ByteString aGroup = ByteString( aCbArea.GetEntry( i ), RTL_TEXTENCODING_UTF8 ); + ByteString aGroupKeyAktuell( aGroup ); + aGroupKeyAktuell.Append( C_KEY_AKTUELL ); + if ( HasKey( *pTempConf, aGroupKeyAktuell ) ) + { + ByteString aCurrentValue = pTempConf->ReadKey( aGroupKeyAktuell ); + aConf.SetGroup( ByteString( aCbArea.GetEntry( i ), RTL_TEXTENCODING_UTF8 ) ); + aConf.WriteKey( C_KEY_AKTUELL, aCurrentValue ); + aConf.WriteKey( C_KEY_ALLE, pTempConf->ReadKey( ByteString( aGroup ).Append( C_KEY_ALLE ) ) ); + } + } + aConf.Flush(); +} + + +class TextAndWin : public DockingWindow +{ + FixedText *pFt; + Window *pWin; + Window* pFtOriginalParent; + Window* pWinOriginalParent; + long nSpace; // Standardabstand + BOOL bAlignTop; + +public: + TextAndWin( Window *pParent, FixedText *pFtP, Window *pWinP, long nSpaceP, BOOL bAlignTopP ); + ~TextAndWin(); + + virtual void Resize(); +}; + +TextAndWin::TextAndWin( Window *pParent, FixedText *pFtP, Window *pWinP, long nSpaceP, BOOL bAlignTopP ) +: DockingWindow( pParent ) +, pFt( pFtP ) +, pWin( pWinP ) +, nSpace( nSpaceP ) +, bAlignTop( bAlignTopP ) +{ + pFtOriginalParent = pFt->GetParent(); + pWinOriginalParent = pWin->GetParent(); + pFt->SetParent( this ); + pWin->SetParent( this ); +} + +TextAndWin::~TextAndWin() +{ + pFt->SetParent( pFtOriginalParent ); + pWin->SetParent( pWinOriginalParent ); +} + +void TextAndWin::Resize() +{ + long nTopSpace = bAlignTop ? 0 : nSpace; + long nBottomSpace = bAlignTop ? nSpace : 0; + + long nFixedTextOffset; + if ( GetOutputSizePixel().Height() < 3 * pFt->GetSizePixel().Height() ) + { + pFt->Hide(); + nFixedTextOffset = 0; + } + else + { + pFt->Show(); + nFixedTextOffset = pFt->GetSizePixel().Height() + nSpace; + + // FixedText Positionieren + pFt->SetPosPixel( Point( 0, nTopSpace ) ); + } + + // Window Positionieren + long nWinPosY = nFixedTextOffset; + nWinPosY += nTopSpace; + pWin->SetPosPixel( Point( 0, nWinPosY ) ); + + // Größe des Window anpassen + long nWinHeight = GetOutputSizePixel().Height(); + nWinHeight -= nWinPosY; + nWinHeight -= nBottomSpace; + pWin->SetSizePixel( Size( GetOutputSizePixel().Width(), nWinHeight ) ); +} + +DisplayHidDlg::DisplayHidDlg( Window * pParent ) +: FloatingWindow( pParent, ResId( IDD_DISPLAY_HID ) ) +, aTbConf( this, ResId( RID_TB_CONF ) ) +, aFtControls( this, ResId( RID_FT_CONTROLS ) ) +, aMlbControls( this, ResId( RID_MLB_CONTROLS ) ) +, aFtSlots( this, ResId( RID_FT_SLOTS ) ) +, aMlbSlots( this, ResId( RID_MLB_SLOTS ) ) +, aPbKopieren( this, ResId( RID_PB_KOPIEREN ) ) +, aPbBenennen( this, ResId( RID_PB_BENENNEN ) ) +, aPbSelectAll( this, ResId( RID_PB_SELECTALL ) ) +, aOKClose( this, ResId( RID_OK_CLOSE ) ) +, nDisplayMode( DH_MODE_KURZNAME | DH_MODE_LANGNAME ) // Falls wir ein altes Office haben diesen Default verwenden +{ + FreeResource(); + + ResMgr* pRM = CREATERESMGR( svt ); + ToolBox aOrig( this, ResId( 12345, pRM ) ); + delete pRM; + + aTbConf.CopyItem( aOrig, 4 ); + aTbConf.InsertSeparator(); + aTbConf.CopyItem( aOrig, 5 ); + aTbConf.CopyItem( aOrig, 6 ); + aTbConf.CopyItem( aOrig, 7 ); + aTbConf.SetOutStyle( TOOLBOX_STYLE_FLAT ); + +#ifndef DEBUG + aTbConf.Hide(); +#endif + + pSplit = new SplitWindow( this ); + pControls = new TextAndWin( pSplit, &aFtControls, &aMlbControls, aMlbControls.GetPosPixel().X(), TRUE ); + pSlots = new TextAndWin( pSplit, &aFtSlots, &aMlbSlots, aMlbControls.GetPosPixel().X(), FALSE ); + + pSplit->SetPosPixel( aFtControls.GetPosPixel() ); + pSplit->InsertItem( 1, pControls, 70, SPLITWINDOW_APPEND, 0, SWIB_PERCENTSIZE ); + pSplit->InsertItem( 2, pSlots, 30, SPLITWINDOW_APPEND, 0, SWIB_PERCENTSIZE ); + pSplit->Show(); + + aTbConf.SetBorderStyle( WINDOW_BORDER_NORMAL ); + aPbKopieren.SetClickHdl( LINK( this, DisplayHidDlg, CopyToClipboard ) ); + aPbSelectAll.SetClickHdl( LINK( this, DisplayHidDlg, SelectAll ) ); + + aMlbControls.SetSelectHdl( LINK( this, DisplayHidDlg, Select ) ); + aMlbSlots.SetSelectHdl( LINK( this, DisplayHidDlg, Select ) ); + Select( NULL ); +} + +DisplayHidDlg::~DisplayHidDlg() +{ + delete pControls; + delete pSlots; + delete pSplit; +} + +IMPL_LINK( DisplayHidDlg, CopyToClipboard, void*, EMPTYARG ) +{ + String aSammel; + USHORT i; + + for ( i=0 ; i < aMlbControls.GetSelectEntryCount() ; i++ ) + { + if ( aSammel.Len() ) + aSammel += '\n'; + aSammel += aMlbControls.GetSelectEntry( i ); + } + for ( i=0 ; i < aMlbSlots.GetSelectEntryCount() ; i++ ) + { + if ( aSammel.Len() ) + aSammel += '\n'; + aSammel += aMlbSlots.GetSelectEntry( i ); + } + Clipboard::Clear(); + Clipboard::CopyString( aSammel ); + return 0; +} + +IMPL_LINK( DisplayHidDlg, SelectAll, PushButton*, pButton ) +{ + if ( pButton->GetState() != STATE_CHECK ) + { + USHORT i; + for ( i=0 ; i < aMlbControls.GetEntryCount() ; i++ ) + aMlbControls.SelectEntryPos( i ); + for ( i=0 ; i < aMlbSlots.GetEntryCount() ; i++ ) + aMlbSlots.SelectEntryPos( i ); + } + else + { + aMlbControls.SetNoSelection(); + aMlbControls.Invalidate(); + aMlbSlots.SetNoSelection(); + aMlbSlots.Invalidate(); + } + Select( NULL ); + return 0; +} + +IMPL_LINK( DisplayHidDlg, Select, void*, EMPTYARG ) +{ + if ( !aMlbControls.GetSelectEntryCount() && !aMlbSlots.GetSelectEntryCount() ) + aPbSelectAll.SetState( STATE_NOCHECK ); + else if ( aMlbControls.GetSelectEntryCount() == aMlbControls.GetEntryCount() + && aMlbSlots.GetSelectEntryCount() == aMlbSlots.GetEntryCount() ) + aPbSelectAll.SetState( STATE_CHECK ); + else + aPbSelectAll.SetState( STATE_DONTKNOW ); + return 0; +} + +void DisplayHidDlg::AddData( WinInfoRec* pWinInfo ) +{ + if ( pWinInfo->bIsReset ) + { + aMlbControls.Clear(); + aMlbSlots.Clear(); + + if ( pWinInfo->nUId & DH_MODE_DATA_VALID ) // kein altes Office + nDisplayMode = pWinInfo->nUId; // Wird im Reset zur Übermittlung des Modus verwendet + + return; + } + + String aMsg; + if ( ( nDisplayMode & DH_MODE_KURZNAME ) ) + { + if ( pWinInfo->aKurzname.Len() > 0 ) + aMsg += pWinInfo->aKurzname; + else + { + aMsg.AppendAscii( "--" ); + aMsg += String::CreateFromInt64( pWinInfo->nUId ); + aMsg.AppendAscii( ": " ); + aMsg += pWinInfo->aRName; + } + aMsg.Expand(20); + } + else + { + aMsg += String::CreateFromInt64( pWinInfo->nUId ); + aMsg.Expand(13); + } + aMsg.AppendAscii( " " ); // Mindestens 3 Blanks sollten schon sein. + + if ( nDisplayMode & DH_MODE_LANGNAME ) + { + if ( pWinInfo->aLangname.Len() > 0 ) + aMsg += pWinInfo->aLangname; + else + aMsg += String( ResId( IDS_NO_LONGNAME ) ); + } + + aMlbControls.InsertEntry( aMsg ); + + + // Haben wir noch einen Slotname? + if ( ( nDisplayMode & DH_MODE_KURZNAME ) && pWinInfo->aSlotname.Len() > 0 ) + { + aMsg = pWinInfo->aSlotname; + aMsg.Expand(20); + aMsg.AppendAscii( " " ); // Mindestens 3 Blanks sollten schon sein. + + if ( nDisplayMode & DH_MODE_LANGNAME ) + { + if ( pWinInfo->aLangname.Len() > 0 ) + aMsg += pWinInfo->aLangname; + else + aMsg += String( ResId( IDS_NO_LONGNAME ) ); + } + + aMlbSlots.InsertEntry( aMsg ); + } +} + +void DisplayHidDlg::Resize() +{ + + if ( IsRollUp() ) + { + // Wir wollen nur die Toolbox sehen + SetOutputSizePixel( aTbConf.GetSizePixel() ); + } + else + { +// SetUpdateMode( FALSE ); + + // Minimalgröße + Size aSize( GetOutputSizePixel() ); + aSize.Width() = max( aSize.Width(), aOKClose.GetSizePixel().Width() * 3 ); + aSize.Height() = max( aSize.Height(), aOKClose.GetSizePixel().Height() * 8 ); + SetOutputSizePixel( aSize ); + + // Standardabstand + long nSpace = pSplit->GetPosPixel().X(); + + // ToolBox Breite anpassen + aTbConf.SetSizePixel( Size ( GetSizePixel().Width(), aTbConf.CalcWindowSizePixel().Height() ) ); + aTbConf.SetSizePixel( Size() ); // Vorerst verstecken! + + // SplitWindow Positionieren + pSplit->SetPosPixel( Point( nSpace, nSpace + aTbConf.GetPosPixel().Y() + aTbConf.GetSizePixel().Height() ) ); + + // Breite des SplitWindows bestimmen + long nSplitWidth = GetSizePixel().Width(); + nSplitWidth -= aPbBenennen.GetSizePixel().Width(); + nSplitWidth -= 3 * nSpace; // Die Zwischenräume + nSplitWidth -= nSpace / 2; // Etwas mehr Platz am rechten Rand + + // Höhe des SplitWindows bestimmen + long nSplitHeight = GetOutputSizePixel().Height(); + nSplitHeight -= pSplit->GetPosPixel().Y(); + nSplitHeight -= nSpace; // der Abstand unten + + // Größe des SplitWindows setzen + pSplit->SetSizePixel( Size( nSplitWidth, nSplitHeight ) ); + + Point aPos; + + // Button "Kopieren" Positionieren + aPos = pSplit->GetPosPixel(); + aPos.Move( nSplitWidth, 0 ); + aPos.Move( nSpace, 0 ); + aPbKopieren.SetPosPixel( aPos ); + + // Button "Alles Wählen" gleich darunter positionieren + aPos.Move( 0, aPbKopieren.GetSizePixel().Height() ); + aPos.Move( 0, nSpace ); + aPbSelectAll.SetPosPixel( aPos ); + + // Button "Benennen" gleich darunter positionieren + aPos.Move( 0, aPbSelectAll.GetSizePixel().Height() ); + aPos.Move( 0, nSpace ); + aPbBenennen.SetPosPixel( aPos ); + + // Und zum Schluß noch den "Close" Button positionieren + aPos = pSplit->GetPosPixel(); + aPos.Move( nSpace, -aOKClose.GetSizePixel().Height() ); + aPos.Move( pSplit->GetSizePixel().Width(), pSplit->GetSizePixel().Height() ); + aOKClose.SetPosPixel( aPos ); + +// SetUpdateMode( TRUE ); +// Invalidate(); + } + FloatingWindow::Resize(); +} + + +VarEditDialog::VarEditDialog( Window * pParent, SbxVariable *pPVar ) +: ModelessDialog( pParent, ResId( IDD_EDIT_VAR ) ) +, aFixedTextRID_FT_NAME( this, ResId( RID_FT_NAME ) ) +, aFixedTextRID_FT_CONTENT( this, ResId( RID_FT_CONTENT ) ) +, aFixedTextRID_FT_NEW_CONTENT( this, ResId( RID_FT_NEW_CONTENT ) ) +, aFixedTextRID_FT_NAME_VALUE( this, ResId( RID_FT_NAME_VALUE ) ) +, aFixedTextRID_FT_CONTENT_VALUE( this, ResId( RID_FT_CONTENT_VALUE ) ) + +, aRadioButtonRID_RB_NEW_BOOL_T( this, ResId( RID_RB_NEW_BOOL_T ) ) +, aRadioButtonRID_RB_NEW_BOOL_F( this, ResId( RID_RB_NEW_BOOL_F ) ) +, aNumericFieldRID_NF_NEW_INTEGER( this, ResId( RID_NF_NEW_INTEGER ) ) +, aNumericFieldRID_NF_NEW_LONG( this, ResId( RID_NF_NEW_LONG ) ) +, aEditRID_ED_NEW_STRING( this, ResId( RID_ED_NEW_STRING ) ) + +, aOKButtonRID_OK( this, ResId( RID_OK ) ) +, aCancelButtonRID_CANCEL( this, ResId( RID_CANCEL ) ) +, pVar( pPVar ) +{ + aFixedTextRID_FT_NAME_VALUE.SetText( pVar->GetName() ); + aFixedTextRID_FT_CONTENT_VALUE.SetText( pVar->GetString() ); + + SbxDataType eType = pVar->GetType(); + if ( ( eType & ( SbxVECTOR | SbxARRAY | SbxBYREF )) == 0 ) + { + switch ( eType ) + { + case SbxBOOL: + aRadioButtonRID_RB_NEW_BOOL_T.Show(); + aRadioButtonRID_RB_NEW_BOOL_F.Show(); + if ( pVar->GetBool() ) + aRadioButtonRID_RB_NEW_BOOL_T.Check(); + else + aRadioButtonRID_RB_NEW_BOOL_F.Check(); + break; +// case SbxCURRENCY: +// case SbxDATE: + break; + case SbxINTEGER: + aNumericFieldRID_NF_NEW_INTEGER.Show(); + aNumericFieldRID_NF_NEW_INTEGER.SetText( pVar->GetString() ); + aNumericFieldRID_NF_NEW_INTEGER.Reformat(); + break; + case SbxLONG: + aNumericFieldRID_NF_NEW_LONG.Show(); + aNumericFieldRID_NF_NEW_LONG.SetText( pVar->GetString() ); + aNumericFieldRID_NF_NEW_LONG.Reformat(); + // Müssen hart gesetzt werden, da der Rsc Compiler damit nicht klar kommt. + aNumericFieldRID_NF_NEW_LONG.SetMin( -aNumericFieldRID_NF_NEW_LONG.GetMax()-1 ); + aNumericFieldRID_NF_NEW_LONG.SetFirst( -aNumericFieldRID_NF_NEW_LONG.GetLast()-1 ); + break; +// case SbxOBJECT: // kann nicht editiert werden + break; + case SbxSINGLE: + case SbxDOUBLE: + case SbxSTRING: + case SbxVARIANT: // Taucht wohl auch nicht auf. stattdessen SbxEMPTY + case SbxEMPTY: + aEditRID_ED_NEW_STRING.Show(); + aEditRID_ED_NEW_STRING.SetText( pVar->GetString() ); + break; + } + } + + + aOKButtonRID_OK.SetClickHdl( LINK( this, VarEditDialog, OKClick ) ); +} + + +IMPL_LINK( VarEditDialog, OKClick, Button *, pButton ) +{ + BOOL bWasError = SbxBase::IsError(); // Da eventuell ein Fehler geschmissen wird. + + + SbxDataType eType = pVar->GetType(); +/* +Boolean +Currency +Date +Double +Integer +Long +Object +Single +String +Variant + + +atof + + ecvt + f + gcvt + +SvNumberformat:: + static double StringToDouble( const xub_Unicode* pStr, + const International& rIntl, + int& nErrno, + const xub_Unicode** ppEnd = NULL ); + // Konvertiert analog strtod einen dezimalen String in einen double, + // Dezimalseparator und Tausenderseparator werden aus International + // genommen, fuehrende Leerzeichen werden weggeparst. + // Ist ppEnd!=NULL wird *ppEnd hinter das Weggeparste gesetzt. + // Enthaelt pStr nur den zu parsenden String, ist also bei Erfolg + // **ppEnd=='\0' und *ppEnd-pStr==strlen(pStr). + // Bei Ueberlauf wird fVal=+/-HUGE_VAL gesetzt, bei Unterlauf 0, + // nErrno wird in diesen Faellen auf ERANGE gesetzt, sonst 0. + // "+/-1.#INF" werden als +/-HUGE_VAL erkannt. + + */ + + + + String aContent( aEditRID_ED_NEW_STRING.GetText() ); + BOOL bError = FALSE; + switch ( eType ) + { + case SbxBOOL: + pVar->PutBool( aRadioButtonRID_RB_NEW_BOOL_T.IsChecked() ); + break; +// case SbxCURRENCY: +// pVar->PutCurrency( aContent ); + break; +// case SbxDATE: +// pVar->PutDate( aContent ); + break; + case SbxINTEGER: + pVar->PutInteger( aNumericFieldRID_NF_NEW_INTEGER.GetValue() ); + break; + case SbxLONG: + pVar->PutLong( aNumericFieldRID_NF_NEW_LONG.GetValue() ); + break; + case SbxDOUBLE: + case SbxSINGLE: + bError = !pVar->PutStringExt( aContent ); + break; + case SbxSTRING: + pVar->PutString( aContent ); + break; + case SbxVARIANT: + case SbxEMPTY: + bError = !pVar->PutStringExt( aContent ); + break; + } + + +// pVar->PutStringExt( aEditRID_ED_NEW_STRING.GetText() ); + if ( !bWasError && SbxBase::IsError() ) + { + bError = TRUE; + SbxBase::ResetError(); + } + + if ( bError ) + { +// ErrorBox( this, WB_OK | WB_DEF_OK, "Der Wert ist ungültig und kann daher nicht gesetzt werden" ).Execute(); + ErrorBox( this, ResId( IDS_INVALID_VALUE ) ).Execute(); + return 1; + } + +// if ( aEditRID_ED_NEW_STRING.GetText().Compare( pVar->GetString() ) != COMPARE_EQUAL ) +// { +// aFixedTextRID_FT_CONTENT_VALUE.SetText( pVar->GetString() ); +// aEditRID_ED_NEW_STRING.SetText( pVar->GetString() ); +// return 1; +// } + + Close(); + return 0; +} + + + diff --git a/basic/source/app/dialogs.hxx b/basic/source/app/dialogs.hxx new file mode 100644 index 000000000000..ab98752d2741 --- /dev/null +++ b/basic/source/app/dialogs.hxx @@ -0,0 +1,307 @@ +/************************************************************************* + * + * $RCSfile: dialogs.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _DIALOGS_HXX +#define _DIALOGS_HXX + +#ifndef _DIALOG_HXX //autogen +#include <vcl/dialog.hxx> +#endif +#ifndef _BUTTON_HXX //autogen +#include <vcl/button.hxx> +#endif +#ifndef _EDIT_HXX //autogen +#include <vcl/edit.hxx> +#endif +#ifndef _FIELD_HXX //autogen +#include <vcl/field.hxx> +#endif +#ifndef _SV_FIXED_HXX //autogen +#include <vcl/fixed.hxx> +#endif +#ifndef _SV_TABDLG_HXX //autogen +#include <vcl/tabdlg.hxx> +#endif +#ifndef _SV_TABCTRL_HXX //autogen +#include <vcl/tabctrl.hxx> +#endif +#ifndef _SV_TABPAGE_HXX //autogen +#include <vcl/tabpage.hxx> +#endif +#ifndef _SV_GROUP_HXX //autogen +#include <vcl/group.hxx> +#endif +#ifndef _SV_CONFIG_HXX //autogen +#include <vcl/config.hxx> +#endif +#ifndef _TOOLS_LIST_HXX +#include <tools/list.hxx> +#endif +#ifndef _SV_LSTBOX_HXX //autogen +#include <vcl/lstbox.hxx> +#endif +#ifndef _SV_FLOATWIN_HXX //autogen +#include <vcl/floatwin.hxx> +#endif +#ifndef _SV_TOOLBOX_HXX //autogen +#include <vcl/toolbox.hxx> +#endif + +class SbxVariable; + +#ifndef _BASIC_TTRESHLP_HXX +#include "ttstrhlp.hxx" +#endif + +class AboutDialog : public ModalDialog { + FixedText a1,a3,a4,aVersionString; + OKButton aOk; +// FixedIcon aIcon; +public: + AboutDialog (Window*, const ResId&); +}; + +class FindDialog : public ModalDialog { + FixedText aFT1; + Edit aFind; + OKButton aOk; + CancelButton aCancel; + String* pFind; + DECL_LINK( ButtonClick, Button * ); +public: + FindDialog (Window*, const ResId&, String&); +}; + +class ReplaceDialog : public ModalDialog { + FixedText aFT1; + FixedText aFT2; + Edit aFind; + Edit aReplace; + OKButton aOk; + CancelButton aCancel; + String* pFind; + String* pReplace; + DECL_LINK( ButtonClick, Button * ); +public: + ReplaceDialog (Window*, const ResId&, String&, String&); +}; + +class ConfEdit : public PushButton +{ + FixedText aText; + ByteString aKeyName; + Edit aEdit; +public: + ConfEdit( Window* pParent, USHORT nResText, USHORT nResEdit, USHORT nResButton, const ByteString& aKN ); + void Save(); + void Click(); +}; + + +class OptionsDialog : public ModelessDialog +{ +private: + TabControl aTabCtrl; + + OKButton aOK; + CancelButton aCancel; + DECL_LINK( OKClick, Button * ); + +public: + OptionsDialog( Window* pParent, const ResId& ); + ~OptionsDialog(); + virtual BOOL Close(); + + + DECL_LINK( ActivatePageHdl, TabControl * ); +}; + +class SpecialOptions : public TabPage +{ + GroupBox aDirs; + ConfEdit aLog; + ConfEdit aBasis; + ConfEdit aHID; + GroupBox aOther; + FixedText aTimeoutText; + TimeField aServerTimeout; + CheckBox aAutoReload; + +public: + SpecialOptions( Window* ); + void Save(); +}; + + +DECLARE_LIST( StringList, String * ); +#define C_KEY_ALLE CByteString("Alle") +#define C_KEY_AKTUELL CByteString("Aktuell") +#define C_KEY_DELETE CByteString("Deleted Groups") + +class GenericOptions : public TabPage +{ + GroupBox aGbArea; + ComboBox aCbArea; + PushButton aPbNewArea; + PushButton aPbDelArea; + + GroupBox aGbValue; + ComboBox aCbValue; + PushButton aPbNewValue; + PushButton aPbDelValue; + + Config aConf; + String aTempConfName; + Config *pTempConf; + ByteString aLastGroupName; + + String ReadKey( const ByteString &aGroup, const ByteString &aKey ); + BOOL HasKey( Config &aConfig, const ByteString &aKey ); + + void LoadValues(); + + StringList* GetAllGroups(); + void LoadData(); + + DECL_LINK( LoadGroup, ComboBox* ); + DECL_LINK( DelGroup, Button* ); + DECL_LINK( NewGroup, Button* ); + DECL_LINK( DelValue, Button* ); + DECL_LINK( NewValue, Button* ); + DECL_LINK( CheckButtonsHdl, ComboBox* ); + + void CheckButtons( ComboBox &aCB, Button &aNewB, Button &aDelB ); + +public: + GenericOptions( Window* ); + ~GenericOptions(); + void Save(); +}; + + +struct WinInfoRec; +class SplitWindow; + +class DisplayHidDlg : public FloatingWindow +{ +protected: + ToolBox aTbConf; + FixedText aFtControls; + MultiListBox aMlbControls; + FixedText aFtSlots; + MultiListBox aMlbSlots; + PushButton aPbKopieren; + PushButton aPbBenennen; + PushButton aPbSelectAll; + OKButton aOKClose; + + DockingWindow* pControls; + DockingWindow* pSlots; + SplitWindow *pSplit; + + ULONG nDisplayMode; + + DECL_LINK( Select, void* ); + DECL_LINK( SelectAll, PushButton* ); + DECL_LINK( CopyToClipboard, void* ); + +public: + DisplayHidDlg( Window * pParent ); + virtual ~DisplayHidDlg(); + + virtual void Resize(); + + void AddData( WinInfoRec* pWinInfo ); + +}; + + +class VarEditDialog : public ModelessDialog +{ +protected: + FixedText aFixedTextRID_FT_NAME; + FixedText aFixedTextRID_FT_CONTENT; + FixedText aFixedTextRID_FT_NEW_CONTENT; + FixedText aFixedTextRID_FT_NAME_VALUE; + FixedText aFixedTextRID_FT_CONTENT_VALUE; + + RadioButton aRadioButtonRID_RB_NEW_BOOL_T; + RadioButton aRadioButtonRID_RB_NEW_BOOL_F; + NumericField aNumericFieldRID_NF_NEW_INTEGER; + NumericField aNumericFieldRID_NF_NEW_LONG; + Edit aEditRID_ED_NEW_STRING; + + OKButton aOKButtonRID_OK; + CancelButton aCancelButtonRID_CANCEL; + + SbxVariable *pVar; + + DECL_LINK( OKClick, Button * ); + +// BOOL bCompare = FALSE; +// String aCompareString; + +public: + VarEditDialog( Window * pParent, SbxVariable *pPVar ); +}; + + +#endif diff --git a/basic/source/app/makefile.mk b/basic/source/app/makefile.mk new file mode 100644 index 000000000000..8150a9e7cff8 --- /dev/null +++ b/basic/source/app/makefile.mk @@ -0,0 +1,164 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=BASIC +TARGET=app + +# --- Settings ------------------------------------------------------------ + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Allgemein ------------------------------------------------------------ + +.INCLUDE : $(UPD)minor.mk +RSCUPDVER=$(RSCREVISION)SV$(UPD)$(UPDMINOR) + + +CXXFILES = \ + ttstrhlp.cxx \ + ttbasic.cxx \ + basicrt.cxx \ + processw.cxx \ + process.cxx \ + brkpnts.cxx \ + app.cxx \ + mybasic.cxx \ + status.cxx \ + printer.cxx \ + appwin.cxx \ + appedit.cxx \ + appbased.cxx \ + apperror.cxx \ + textedit.cxx \ + msgedit.cxx \ + dialogs.cxx \ + comm_bas.cxx \ + testbasi.cxx + + +OBJFILES = \ + $(OBJ)$/ttstrhlp.obj \ + $(OBJ)$/ttbasic.obj \ + $(OBJ)$/basicrt.obj \ + $(OBJ)$/processw.obj \ + $(OBJ)$/process.obj \ + $(OBJ)$/brkpnts.obj \ + $(OBJ)$/app.obj \ + $(OBJ)$/mybasic.obj \ + $(OBJ)$/status.obj \ + $(OBJ)$/printer.obj \ + $(OBJ)$/appwin.obj \ + $(OBJ)$/appedit.obj \ + $(OBJ)$/appbased.obj \ + $(OBJ)$/apperror.obj \ + $(OBJ)$/textedit.obj \ + $(OBJ)$/msgedit.obj \ + $(OBJ)$/dialogs.obj \ + $(OBJ)$/comm_bas.obj \ + $(SLO)$/sbintern.obj + + +SRCFILES = \ + basic.src \ + ttmsg.src \ + basmsg.src \ + svtmsg.src \ + testtool.src + +LIBTARGET = NO + +LIB1TARGET=$(LB)$/app.lib +LIB1ARCHIV=$(LB)$/libapp.a +LIB1OBJFILES = \ + $(OBJ)$/ttstrhlp.obj \ + $(OBJ)$/basicrt.obj \ + $(OBJ)$/processw.obj \ + $(OBJ)$/process.obj \ + $(OBJ)$/brkpnts.obj \ + $(OBJ)$/app.obj \ + $(OBJ)$/mybasic.obj \ + $(OBJ)$/status.obj \ + $(OBJ)$/printer.obj \ + $(OBJ)$/appwin.obj \ + $(OBJ)$/appedit.obj \ + $(OBJ)$/appbased.obj \ + $(OBJ)$/apperror.obj \ + $(OBJ)$/textedit.obj \ + $(OBJ)$/msgedit.obj \ + $(OBJ)$/dialogs.obj \ + $(OBJ)$/comm_bas.obj \ + $(SLO)$/sbintern.obj + +.IF "$(depend)" == "" + +ALL: $(LB)$/app.lib \ + ALLTAR + +.ENDIF + +# --- Targets ------------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/basic/source/app/msgedit.cxx b/basic/source/app/msgedit.cxx new file mode 100644 index 000000000000..6de5e44a892c --- /dev/null +++ b/basic/source/app/msgedit.cxx @@ -0,0 +1,858 @@ +/************************************************************************* + * + * $RCSfile: msgedit.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* +File Versions so far: +No Version Initial Implementation without Version Information +Version 2 changed order of entries(New Entries at the end) +Version 3 Changed Charset from CHARSET_IBMPC to RTL_TEXTENCODING_UTF8 + +*************************************************************************/ +#ifndef _INTN_HXX //autogen +#include <tools/intn.hxx> +#endif +#ifndef _TIME_HXX //autogen +#include <tools/time.hxx> +#endif +#ifndef _STREAM_HXX //autogen +#include <tools/stream.hxx> +#endif +#ifndef _MSGBOX_HXX //autogen +#include <vcl/msgbox.hxx> +#endif +#ifndef _SOUND_HXX //autogen +#include <vcl/sound.hxx> +#endif +#ifndef _FSYS_HXX //autogen +#include <tools/fsys.hxx> +#endif +#ifndef _CLIP_HXX //autogen +#include <vcl/clip.hxx> +#endif +#ifndef NOOLDSV //autogen +#include <vcl/system.hxx> +#endif +#ifndef _BASIC_TTRESHLP_HXX +#include "ttstrhlp.hxx" +#endif +#ifndef _SV_SYSTEM_HXX +#include <vcl/system.hxx> +#endif + +#include "basic.hrc" +#include "msgedit.hxx" +#include "app.hxx" +#include "appbased.hxx" +#include "basmsg.hrc" + +#define WARNING_PREFIX String( ResId( S_WARNING_PREFIX ) ) +#define VERSION_STRING CUniString("File Format Version: ") +#define THIS_VERSION 2 + +#define LOGTYPE( pEntry ) ((pEntry && pEntry->GetUserData())?((TTDebugData*)pEntry->GetUserData())->aLogType:LOG_ERROR) + +MsgEdit::MsgEdit( AppWin* pParent, BasicFrame *pBF, const WinBits& aBits ) +: aEditTree( pParent, pBF, aBits | WB_HASBUTTONS | WB_HASLINES | WB_HASBUTTONSATROOT ) +, pBasicFrame(pBF) +, pCurrentRun(NULL) +, pCurrentTestCase(NULL) +, pCurrentError(NULL) +, nVersion(0) +, bFileLoading(FALSE) +, bModified(FALSE) +, pAppWin( pParent ) +{ + SetFont( System::GetStandardFont(STDFONT_FIXED) ); + aEditTree.SetNodeBitmaps( Bitmap( ResId (MBP_PLUS) ), Bitmap( ResId (MBP_MINUS) ) ); + aEditTree.SetSelectionMode( MULTIPLE_SELECTION ); + if ( aEditTree.GetModel()->GetSortMode() != SortNone ) + aEditTree.GetModel()->SetSortMode( SortNone ); + + pParent->bHasFile = Load( pParent->GetText() ); +} + +MsgEdit::~MsgEdit() +{} + +#define ADD_TTDEBUGDATA( aLBoxEntry ) \ + { \ + TTDebugData *pData = new TTDebugData; \ + *pData = aDebugData; \ + aLBoxEntry->SetUserData( pData ); \ + } \ + + +void MsgEdit::AddAnyMsg( TTLogMsg *LogMsg ) +{ + if ( LogMsg->aDebugData.aFilename.Copy(0,2).CompareToAscii( "--" ) == COMPARE_EQUAL ) + LogMsg->aDebugData.aFilename.Erase(0,2); + xub_StrLen nPos; + LogMsg->aDebugData.aMsg.ConvertLineEnd(); + if ( (nPos = LogMsg->aDebugData.aMsg.Search( CUniString("\n").ConvertLineEnd() )) != STRING_NOTFOUND ) + { + xub_StrLen nSysLineEndLen = CUniString("\n").ConvertLineEnd().Len(); + String aLastPart = LogMsg->aDebugData.aMsg.Copy( nPos+nSysLineEndLen ); + LogMsg->aDebugData.aMsg.Erase( nPos ); + AddAnyMsg( LogMsg ); + LogMsg->aDebugData.aMsg = aLastPart; + AddAnyMsg( LogMsg ); + } + else + { + String aUILogMsg( pBasicFrame->GenRealString( LogMsg->aDebugData.aMsg ) ); + switch ( LogMsg->aDebugData.aLogType ) + { + case LOG_RUN: + { + if ( LogMsg->aDebugData.aMsg.Len() == 0 ) + { + LogMsg->aDebugData.aMsg = GEN_RES_STR2( S_PROG_START, + GetpApp()->GetAppInternational().GetDate(Date()), + GetpApp()->GetAppInternational().GetTime(Time(),FALSE) ); + aUILogMsg = pBasicFrame->GenRealString( LogMsg->aDebugData.aMsg ); + } + AddRun( aUILogMsg, LogMsg->aDebugData ); break; + } + case LOG_TEST_CASE: AddTestCase( aUILogMsg, LogMsg->aDebugData ); break; + case LOG_ERROR: AddError( aUILogMsg, LogMsg->aDebugData ); break; + case LOG_CALL_STACK:AddCallStack( aUILogMsg, LogMsg->aDebugData ); break; + case LOG_MESSAGE: AddMessage( aUILogMsg, LogMsg->aDebugData ); break; + case LOG_WARNING: AddWarning( aUILogMsg, LogMsg->aDebugData ); break; + case LOG_ASSERTION: AddAssertion( aUILogMsg, LogMsg->aDebugData ); break; + } + + if ( !bFileLoading ) + { // Kommt vom Testtool und muß gleich geschrieben werden. + BOOL bFileWasChanged = pAppWin->DiskFileChanged( SINCE_LAST_LOAD ); + + DBG_ASSERT( aLogFileName == LogMsg->aLogFileName, "Logging to different logfile as before" ); + SvFileStream aStrm( LogMsg->aLogFileName, STREAM_STD_WRITE ); + String aLogMsg = Impl_MakeSaveText( LogMsg->aDebugData ).AppendAscii("\n"); + if( aStrm.IsOpen() ) + { + aLogMsg.ConvertLineEnd(LINEEND_CRLF); + aStrm.Seek(STREAM_SEEK_TO_END); + aStrm << ByteString( aLogMsg, RTL_TEXTENCODING_UTF8 ).GetBuffer(); + aStrm.Close(); + } + if ( !bFileWasChanged ) + pAppWin->UpdateFileInfo( HAS_BEEN_LOADED ); + } + } +} + +void MsgEdit::AddRun( String aMsg, TTDebugData aDebugData ) +{ + if ( !bFileLoading || ( bFileLoading && nVersion >= 2 ) ) + pCurrentRun = aEditTree.InsertEntry( aMsg, NULL, FALSE, 0 ); + else // Erstes Dateiformat + pCurrentRun = aEditTree.InsertEntry( aMsg ); // und damit an Ende! + + aEditTree.ShowEntry( pCurrentRun ); + pCurrentTestCase = NULL; + pCurrentError = NULL; + aDebugData.aLogType = LOG_RUN; // Da auch von anderswo aufgerufen + ADD_TTDEBUGDATA( pCurrentRun ); +} + +void MsgEdit::AddTestCase( String aMsg, TTDebugData aDebugData ) +{ + if ( pCurrentRun ) + { + if ( aMsg.Len() == 0 ) // Am Ende des Testcase + { + pCurrentTestCase = NULL; + } + else + { + pCurrentTestCase = aEditTree.InsertEntry( aMsg, pCurrentRun ); + aEditTree.ShowEntry( pCurrentTestCase ); + aDebugData.aLogType = LOG_TEST_CASE; // Da auch von anderswo aufgerufen + ADD_TTDEBUGDATA( pCurrentTestCase ); + } + } + pCurrentError = NULL; +} + +void MsgEdit::AddError( String aMsg, TTDebugData aDebugData ) +{ + if ( !pCurrentTestCase ) + { + TTLogMsg aLogMsg; + aLogMsg.aDebugData = aDebugData; + aLogMsg.aDebugData.aMsg = GEN_RES_STR0( S_ERROR_OUTSIDE_TESTCASE ); + aLogMsg.aDebugData.aLogType = LOG_TEST_CASE; + aLogMsg.aLogFileName = aLogFileName; + AddAnyMsg( &aLogMsg ); + } + if ( pCurrentTestCase ) + { + pCurrentError = aEditTree.InsertEntry( aMsg, pCurrentTestCase ); + aEditTree.ShowEntry( pCurrentError ); + aDebugData.aLogType = LOG_ERROR; // Da auch von anderswo aufgerufen + ADD_TTDEBUGDATA( pCurrentError ); + } +} + +void MsgEdit::AddCallStack( String aMsg, TTDebugData aDebugData ) +{ + DBG_ASSERT( pCurrentError, "Callstack ohne CurrentError im Journal" ); + if ( pCurrentError ) + { + SvLBoxEntry *pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentError ,0 ); + aDebugData.aLogType = LOG_CALL_STACK; // Da auch von anderswo aufgerufen + ADD_TTDEBUGDATA( pThisEntry ); + } +} + +void MsgEdit::AddMessage( String aMsg, TTDebugData aDebugData ) +{ + SvLBoxEntry *pThisEntry = NULL; + if ( pCurrentTestCase ) + pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentTestCase ); + else if ( pCurrentRun ) + { + pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun ); + aEditTree.ShowEntry( pThisEntry ); + } + else + { + AddRun( aMsg, aDebugData ); + pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun ); + aEditTree.ShowEntry( pThisEntry ); + } + aDebugData.aLogType = LOG_MESSAGE; // Da auch von anderswo aufgerufen + ADD_TTDEBUGDATA( pThisEntry ); +} + +void MsgEdit::AddWarning( String aMsg, TTDebugData aDebugData ) +{ + SvLBoxEntry *pThisEntry = NULL; + String aCompleteMsg; + aCompleteMsg = WARNING_PREFIX.Append( aMsg ); + + if ( pCurrentTestCase ) + pThisEntry = aEditTree.InsertEntry( aCompleteMsg, pCurrentTestCase ); + else if ( pCurrentRun ) + { + pThisEntry = aEditTree.InsertEntry( aCompleteMsg, pCurrentRun ); + aEditTree.ShowEntry( pThisEntry ); + } + else + { + AddRun( aMsg, aDebugData ); + pThisEntry = aEditTree.InsertEntry( aCompleteMsg, pCurrentRun ); + aEditTree.ShowEntry( pThisEntry ); + } + aDebugData.aLogType = LOG_WARNING; // Da auch von anderswo aufgerufen + ADD_TTDEBUGDATA( pThisEntry ); + + while ( !aEditTree.IsEntryVisible( pThisEntry ) && ( pThisEntry = aEditTree.GetParent( pThisEntry ) ) ) + aEditTree.InvalidateEntry( pThisEntry ); +} + +void MsgEdit::AddAssertion( String aMsg, TTDebugData aDebugData ) +{ + SvLBoxEntry *pThisEntry = NULL; + if ( pCurrentTestCase ) + pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentTestCase ); + else if ( pCurrentRun ) + { + pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun ); + aEditTree.ShowEntry( pThisEntry ); + } + else + { + AddRun( aMsg, aDebugData ); + pThisEntry = aEditTree.InsertEntry( aMsg, pCurrentRun ); + aEditTree.ShowEntry( pThisEntry ); + } + aDebugData.aLogType = LOG_ASSERTION; // Da auch von anderswo aufgerufen + ADD_TTDEBUGDATA( pThisEntry ); + + while ( !aEditTree.IsEntryVisible( pThisEntry ) && ( pThisEntry = aEditTree.GetParent( pThisEntry ) ) ) + aEditTree.InvalidateEntry( pThisEntry ); +} + +/* + SvLBoxEntry* GetEntry( SvLBoxEntry* pParent, ULONG nPos ) const { return SvLBox::GetEntry(pParent,nPos); } + SvLBoxEntry* GetEntry( ULONG nRootPos ) const { return SvLBox::GetEntry(nRootPos);} + + + + SvLBoxEntry* FirstChild(SvLBoxEntry* pParent ) const { return (SvLBoxEntry*)(pModel->FirstChild(pParent)); } + SvLBoxEntry* NextSibling(SvLBoxEntry* pEntry ) const { return (SvLBoxEntry*)(pModel->NextSibling( pEntry )); } + SvLBoxEntry* PrevSibling(SvLBoxEntry* pEntry ) const { return (SvLBoxEntry*)(pModel->PrevSibling( pEntry )); } + + SvLBoxEntry* FirstSelected() const { return (SvLBoxEntry*)SvListView::FirstSelected(); } + SvLBoxEntry* NextSelected( SvLBoxEntry* pEntry ) const { return (SvLBoxEntry*)(SvListView::NextSelected(pEntry)); } + SvLBoxEntry* PrevSelected( SvLBoxEntry* pEntry ) const { return (SvLBoxEntry*)(SvListView::PrevSelected(pEntry)); } + SvLBoxEntry* LastSelected() const { return (SvLBoxEntry*)(SvListView::LastSelected()); } + + SvLBoxEntry* GetEntry( SvLBoxEntry* pParent, ULONG nPos ) const { return (SvLBoxEntry*)(pModel->GetEntry(pParent,nPos)); } + SvLBoxEntry* GetEntry( ULONG nRootPos ) const { return (SvLBoxEntry*)(pModel->GetEntry(nRootPos)); } + + SvLBoxEntry* GetParent( SvLBoxEntry* pEntry ) const { return (SvLBoxEntry*)(pModel->GetParent(pEntry)); } + SvLBoxEntry* GetRootLevelParent(SvLBoxEntry* pEntry ) const { return (SvLBoxEntry*)(pModel->GetRootLevelParent( pEntry ));} + + BOOL IsInChildList( SvListEntry* pParent, SvListEntry* pChild) const; + SvListEntry* GetEntry( SvListEntry* pParent, ULONG nPos ) const; + SvListEntry* GetEntry( ULONG nRootPos ) const; + SvListEntry* GetEntryAtAbsPos( ULONG nAbsPos ) const; + SvListEntry* GetParent( SvListEntry* pEntry ) const; + SvListEntry* GetRootLevelParent( SvListEntry* pEntry ) const; +*/ + +//#define CHECK( pMemo ) if ( pMemo && !aEditTree.GetViewData( pMemo ) ) pMemo = NULL +#define CHECK( pMemo ) if ( pMemo && !aEditTree.GetModel()->IsInChildList( NULL, pMemo ) ) pMemo = NULL +void MsgEdit::Delete() +{ + aEditTree.RemoveSelection(); + CHECK( pCurrentRun ); + CHECK( pCurrentTestCase ); + CHECK( pCurrentError ); + bModified = TRUE; + lModify.Call( NULL ); +} + +void MsgEdit::Cut(){ Copy(); Delete(); bModified = TRUE; lModify.Call( NULL ); } +void MsgEdit::Copy(){ Clipboard::Clear();Clipboard::CopyString( GetSelected() ); } +/**/void MsgEdit::Paste(){ Sound::Beep(); } +void MsgEdit::Undo(){ Sound::Beep(); } +void MsgEdit::Redo(){ Sound::Beep(); } + + +String MsgEdit::Impl_MakeText( SvLBoxEntry *pEntry ) const +{ + String aRet; + TTDebugData *aData = (TTDebugData*)pEntry->GetUserData(); + switch ( aData->aLogType ) + { + case LOG_RUN: aRet.AppendAscii("\n"); break; + case LOG_TEST_CASE: break; + case LOG_ERROR: break; + case LOG_CALL_STACK:aRet.AppendAscii("--> "); break; + case LOG_MESSAGE: break; + case LOG_WARNING: break; + case LOG_ASSERTION: break; + default:DBG_ERROR("Unbekannter Typ im ResultFenster"); + } + aRet += aEditTree.GetEntryText( pEntry ); + return aRet; +} + +String MsgEdit::Impl_MakeSaveText( TTDebugData aData ) const +{ +// LogType;Filename;Line;Col1;Col2;Message + String aRet; + aRet += String::CreateFromInt32( (int)aData.aLogType ); + aRet += ';'; + aRet += aData.aFilename; + aRet += ';'; + aRet += String::CreateFromInt32( aData.nLine ); + aRet += ';'; + aRet += String::CreateFromInt32( aData.nCol1 ); + aRet += ';'; + aRet += String::CreateFromInt32( aData.nCol2 ); + aRet += ';'; + aRet += '"'; + aRet += aData.aMsg; + aRet += '"'; + return aRet; +} + +String MsgEdit::Impl_MakeSaveText( SvLBoxEntry *pEntry ) const +{ +// LogType;Filename;Line;Col1;Col2;Message + String aRet; + TTDebugData *aData = (TTDebugData*)pEntry->GetUserData(); + + if ( aEditTree.PrevSibling( pEntry ) && LOGTYPE( aEditTree.PrevSibling( pEntry ) ) == LOG_TEST_CASE ) + { // Um Cases richtig abzuschliessen, so daß Warnings und Msgs in Hirarchie richtig. + aRet += String::CreateFromInt32( (int)LOG_TEST_CASE ); + aRet.AppendAscii(";;0;0;0;\"\"\n"); + } + aRet += Impl_MakeSaveText( *aData ); + return aRet; +} + +String MsgEdit::GetSelected() +{ + String aRet; + SvLBoxEntry *pEntry = aEditTree.FirstSelected(); + while ( pEntry ) + { + aRet += Impl_MakeText( pEntry ); + aRet += '\n'; + pEntry = aEditTree.NextSelected( pEntry ); + } + aRet.ConvertLineEnd(); + return aRet; +} + +TextSelection MsgEdit::GetSelection() const +{ + ULONG nStart=0,nEnd=0; + + if ( aEditTree.FirstSelected() ) + { + nStart = aEditTree.GetModel()->GetAbsPos(aEditTree.FirstSelected() ); + if ( aEditTree.LastSelected() ) + nEnd = aEditTree.GetModel()->GetAbsPos(aEditTree.LastSelected() ); + return TextSelection( TextPaM( nStart, 0 ), TextPaM( nEnd, STRING_MAXLEN ) ); + } + else + return TextSelection(); +} + +void MsgEdit::SetSelection( const TextSelection& rSelection ) +{ + USHORT nStart,nEnd; + + while ( aEditTree.GetSelectionCount() ) + aEditTree.Select( aEditTree.FirstSelected(), FALSE ); + + if ( rSelection.HasRange() ) + { + nStart = rSelection.GetStart().GetPara(); + nEnd = rSelection.GetEnd().GetPara(); + + for ( int i = nStart ; i <= nEnd ; i++ ) + aEditTree.Select( aEditTree.GetModel()->GetEntryAtAbsPos( i ), TRUE ); + } +} + +USHORT MsgEdit::GetLineNr() const +{ + if ( aEditTree.GetCurEntry() ) + return aEditTree.GetModel()->GetAbsPos(aEditTree.GetCurEntry() ) + 1; + else + return 0; +} + +void MsgEdit::ReplaceSelected( const String& rStr ){ Sound::Beep();DBG_ERROR("Not Implemented"); } +BOOL MsgEdit::IsModified(){ return bModified; } +void MsgEdit::SetModifyHdl( Link l ){ lModify = l; } + +String MsgEdit::GetText() const +{ + String aRet; + SvLBoxEntry *pEntry = aEditTree.First(); + while ( pEntry ) + { + aRet += Impl_MakeText( pEntry ); + aRet += '\n'; + pEntry = aEditTree.Next( pEntry ); + } + aRet.ConvertLineEnd(); + return aRet; +} + +/**/void MsgEdit::SetText( const String& rStr ){ DBG_ERROR("Not Implemented"); } + +BOOL MsgEdit::HasText() const { return aEditTree.First() != NULL; } + +// Es wird entweder ab Beginn oder ab Markierungsbegin + 1 gesucht. +BOOL MsgEdit::Find( const String& s ) +{ + TextSelection r = GetSelection(); + USHORT bgn = (USHORT) r.GetStart().GetPara() + 1; + if ( r.GetStart().GetPara() == 0 ) bgn = 0; // Suchen ganz von Anfang + + SvLBoxEntry *pEntry = aEditTree.GetModel()->GetEntryAtAbsPos( bgn ); + while ( pEntry ) + { + if( aEditTree.GetEntryText( pEntry ).Search( s, 0 ) != STRING_NOTFOUND ) + { + aEditTree.SetCurEntry( pEntry ); + return TRUE; + } + pEntry = aEditTree.Next( pEntry ); + } + return FALSE; +} +/****************************************************************** + +Zum Fileformat der *.res Dateien: +Die Informationenn werden als Semikolon getrennte Strings +zusammengebastelt. Reihenfolge: + + LogType;Filename;Line;Col1;Col2;Message + +******************************************************************/ + +BOOL MsgEdit::Load( const String& aName ) +{ + aLogFileName = aName; + BOOL bOk = TRUE, bFirstLine = TRUE; + BOOL bLoadError = FALSE; + SvFileStream aStrm( aName, STREAM_STD_READ ); + if( aStrm.IsOpen() ) + { + aEditTree.Clear(); + String aLine; + bFileLoading = TRUE; // So daß nicht gleich wieder auf Platte mitgelogt wird. + TTLogMsg *pLogMsg = new TTLogMsg; + while( !aStrm.IsEof() && bOk ) + { + if ( nVersion >= 3 ) // Wir habe utf8 + aStrm.ReadByteStringLine( aLine, RTL_TEXTENCODING_UTF8 ); + else + aStrm.ReadByteStringLine( aLine, RTL_TEXTENCODING_IBM_850 ); + + if( aStrm.GetError() != SVSTREAM_OK ) + bOk = FALSE; + +#define TOKEN( n ) aLine.GetToken( n ) + + if ( aLine.GetTokenCount() >= 6 ) + { +// LogType;Filename;Line;Col1;Col2;Message + TTDebugData aDebugData; + aDebugData.aLogType = TTLogType( TOKEN(0).ToInt32() ); + aDebugData.aFilename = TOKEN(1); + aDebugData.nLine = TOKEN(2).ToInt32(); + aDebugData.nCol1 = TOKEN(3).ToInt32(); + aDebugData.nCol2 = TOKEN(4).ToInt32(); + aDebugData.aMsg = aLine.GetQuotedToken( 5, CUniString("\"\"") ); + aDebugData.aMsg.Erase(0,1); // Anführungszeichen entfernen + aDebugData.aMsg.Erase(aDebugData.aMsg.Len()-1,1); + + pLogMsg->aLogFileName.Erase(); + pLogMsg->aDebugData = aDebugData; + + AddAnyMsg( pLogMsg ); + } + else if ( bFirstLine && (aLine.Search( VERSION_STRING ) == 0) ) + nVersion = aLine.Copy( VERSION_STRING.Len() ).ToInt32(); + else bLoadError = TRUE; + + bFirstLine = FALSE; + } + bFileLoading = FALSE; + delete pLogMsg; + aStrm.Close(); + if ( nVersion < 2 && !bLoadError ) + Save( aName ); // Muß sein, sonst passiert beim mitloggen Blödsinn. + + } + else + bOk = FALSE; + return bOk; +} + +BOOL MsgEdit::Save( const String& aName ) +{ + BOOL bOk = TRUE; + BOOL bIsText = DirEntry( aName ).GetExtension().CompareIgnoreCaseToAscii("TXT") == COMPARE_EQUAL; + if ( bIsText && !QueryBox( NULL, ResId( IDS_LOSS_OF_INFORMATION ) ).Execute() ) + return FALSE; + SvFileStream aStrm( aName, STREAM_STD_WRITE | STREAM_TRUNC ); + if( aStrm.IsOpen() ) + { + if ( bIsText ) + { + String aSave = GetText(); + aSave.ConvertLineEnd(LINEEND_CRLF); + aStrm << ByteString( aSave, RTL_TEXTENCODING_UTF8 ).GetBuffer(); + } + else + { +// LogType;Filename;Line;Col1;Col2;Message + String aSave = VERSION_STRING.Append( UniString::CreateFromInt32( 3 ) ).AppendAscii("\n"); // Version 2 + SvLBoxEntry *pRun = aEditTree.First(); + while ( pRun && aEditTree.NextSibling( pRun ) ) + pRun = aEditTree.NextSibling( pRun ); + + aSave.ConvertLineEnd(LINEEND_CRLF); + aStrm << ByteString( aSave, RTL_TEXTENCODING_UTF8 ).GetBuffer(); + + SvLBoxEntry *pEntry; + while ( pRun ) + { + pEntry = pRun; + while ( pEntry && ( pEntry == pRun || LOGTYPE( pEntry ) != LOG_RUN ) ) + { + aSave = Impl_MakeSaveText( pEntry ); + aSave += '\n'; + aSave.ConvertLineEnd(LINEEND_CRLF); + aStrm << ByteString( aSave, RTL_TEXTENCODING_UTF8 ).GetBuffer(); + pEntry = aEditTree.Next( pEntry ); + } + pRun = aEditTree.PrevSibling( pRun ); + + } + } + if( aStrm.GetError() != SVSTREAM_OK ) + bOk = FALSE; + else + { + bModified = FALSE; + lModify.Call( NULL ); + } + + } + else + bOk = FALSE; + return bOk; +} + + +TTTreeListBox::TTTreeListBox( Window* pParent, BasicFrame* pBF, WinBits nWinStyle ) +: SvTreeListBox( pParent, nWinStyle ) +, pBasicFrame(pBF) +//, nDeselectParent(0) +{} + +BOOL TTTreeListBox::DoubleClickHdl() +{ + SvLBoxEntry *pThisEntry = GetHdlEntry(); + if ( pThisEntry && pThisEntry->GetUserData() && ((TTDebugData*)pThisEntry->GetUserData())->aFilename.Len() > 0 ) + { + TTDebugData *aData = (TTDebugData*)pThisEntry->GetUserData(); + if ( pBasicFrame->FindModuleWin( aData->aFilename ) ) + { + AppEdit *pWin = pBasicFrame->FindModuleWin( aData->aFilename ); + pWin->ToTop(); + } + else + pBasicFrame->LoadFile( aData->aFilename ); + + if ( pBasicFrame->pWork && pBasicFrame->pWork->ISA(AppEdit) ) + ((AppEdit*)pBasicFrame->pWork)->Highlight( aData->nLine, aData->nCol1, aData->nCol2 ); + return FALSE; + } + return TRUE; +} + +/*ULONG TTTreeListBox::SelectChildren( SvLBoxEntry* pParent, BOOL bSelect ) +{ + SvLBoxEntry *pEntry = FirstChild( pParent ); + ULONG nRet = 0; + while ( pEntry ) + { + nRet++; + Select( pEntry, bSelect ); + pEntry = NextSibling( pEntry ); + } + return nRet; +} + + +void TTTreeListBox::SelectHdl() +{ + SvLBoxEntry* pHdlEntry = GetHdlEntry(); + + SelectChildren( pHdlEntry, TRUE ); + Select( pHdlEntry, TRUE ); +// InitMenu(pApp->GetAppMenu()->GetPopupMenu( RID_APPEDIT )); // So daß Delete richtig ist +} + +void TTTreeListBox::DeselectHdl() +{ + SvLBoxEntry* pHdlEntry = GetHdlEntry(); + if ( GetParent( pHdlEntry ) ) + { + nDeselectParent++; + Select( GetParent( pHdlEntry ), FALSE ); + nDeselectParent--; + } + if ( !nDeselectParent ) + { + SelectChildren( pHdlEntry, FALSE ); + Select( pHdlEntry, FALSE ); + } + Invalidate(); +} */ + + +void TTTreeListBox::KeyInput( const KeyEvent& rKEvt ) +{ + switch ( rKEvt.GetKeyCode().GetFunction() ) + { + case KEYFUNC_CUT: + Control::GetParent()->Command( CommandEvent( Point(), RID_EDITCUT ) ); + break; + case KEYFUNC_COPY: + Control::GetParent()->Command( CommandEvent( Point(), RID_EDITCOPY ) ); + break; + case KEYFUNC_PASTE: + Control::GetParent()->Command( CommandEvent( Point(), RID_EDITPASTE ) ); + break; + case KEYFUNC_DELETE: + Control::GetParent()->Command( CommandEvent( Point(), RID_EDITDEL ) ); + break; + default: + SvTreeListBox::KeyInput( rKEvt ); + } +} + + +TTFeatures TTTreeListBox::GetFeatures( SvLBoxEntry* pEntry ) +{ + switch ( LOGTYPE( pEntry ) ) + { + case LOG_MESSAGE: + return HasNothing; + case LOG_WARNING : + return HasWarning; + case LOG_ERROR: + case LOG_CALL_STACK: + return HasError; + case LOG_RUN: + case LOG_TEST_CASE: + { + SvLBoxEntry* pThisEntry = FirstChild( pEntry ); + TTFeatures aResult = HasNothing; + while ( pThisEntry && !( (aResult & HasError) == HasError ) ) + { + if ( !IsEntryVisible( pThisEntry ) ) + aResult |= GetFeatures( pThisEntry ); + pThisEntry = NextSibling( pThisEntry ); + } + return aResult; + } + case LOG_ASSERTION: + return HasAssertion; + default: + DBG_ERROR("Unbekannter Typ im ResultFenster"); + } + return HasNothing; // da der Comp nich sieht, daß kein dafault nötig ist. +} + + +class TTLBoxString : public SvLBoxString +{ +public: + + TTLBoxString( SvLBoxEntry* pEntry, USHORT nFlags, + const String& rStr ) : SvLBoxString(pEntry,nFlags,rStr) {} + + virtual void Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags, + SvLBoxEntry* pEntry); +}; + + +void TTLBoxString::Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags, + SvLBoxEntry* pEntry ) +{ + TTFeatures aFeatures = ((TTTreeListBox*)&rDev)->GetFeatures( pEntry ); + + if ( aFeatures != HasNothing ) + { + Font aOldFont( rDev.GetFont()); + Font aFont( aOldFont ); + + if ( ( aFeatures & HasError ) != 0 || ( aFeatures & HasWarning ) != 0 ) + { + Color aCol; + if ( ( aFeatures & HasError ) == HasError ) + aCol = Color( 255, 120, 120 ); // Rot + else + aCol = Color( 255, 200, 120 ); // Ocker oder so + + if( rDev.IsSelected(pEntry) ) + aFont.SetColor( aCol ); + else + { + aFont.SetFillColor( aCol ); + aFont.SetTransparent( FALSE ); + } + } + else // also HasAssertion + { + if( rDev.IsSelected(pEntry) ) + { + Color aCol( 255, 255, 153 ); + aFont.SetColor( aCol ); + } + else + { + Size aSize( rDev.GetTextWidth( GetText() ), rDev.GetTextHeight() ); + Rectangle aRect( rPos, aSize ); + + static Bitmap aBmp( ResId( MBP_ASSERT ) ); + static BitmapEx aBmpEx( aBmp ); + static Wallpaper aWP( aBmpEx ); + + rDev.DrawWallpaper( aRect, aWP ); + } + +// virtual void NotifyScrolling( long nLines ); + } + rDev.SetFont( aFont ); + rDev.DrawText( rPos, GetText() ); + rDev.SetFont( aOldFont ); + } + else + SvLBoxString::Paint( rPos, rDev, nFlags, pEntry ); +} + + +void TTTreeListBox::InitEntry(SvLBoxEntry* pEntry, + const String& rStr ,const Image& rImg1, const Image& rImg2 ) +{ + USHORT nColToHilite = 1; //0==Bitmap;1=="Spalte1";2=="Spalte2" + SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2 ); + SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nColToHilite ); + TTLBoxString* pStr = new TTLBoxString( pEntry, 0, pCol->GetText() ); + pEntry->ReplaceItem( pStr, nColToHilite ); +} + diff --git a/basic/source/app/msgedit.hxx b/basic/source/app/msgedit.hxx new file mode 100644 index 000000000000..ce26378694cb --- /dev/null +++ b/basic/source/app/msgedit.hxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * $RCSfile: msgedit.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _MSGEDIT_HXX +#define _MSGEDIT_HXX + +#ifndef _SVTREEBOX_HXX //autogen +#include <svtools/svtreebx.hxx> +#endif + +#include "dataedit.hxx" +#include "testtool.hxx" +class BasicFrame; +class AppWin; + +#define SelectChildren SelectChilds // Sonst wird mir schlecht + +typedef USHORT TTFeatures; // Bitfeld für Features der Entrys +#define HasNothing TTFeatures(0x00) +#define HasError TTFeatures(0x01) +#define HasWarning TTFeatures(0x02) +#define HasAssertion TTFeatures(0x04) + + +class TTTreeListBox : public SvTreeListBox +{ +protected: +// virtual void Command( const CommandEvent& rCEvt ); +// USHORT nDeselectParent; + BasicFrame *pBasicFrame; + void InitEntry( SvLBoxEntry*, const String&, const Image&, const Image& ); +public: + TTTreeListBox( Window* pParent, BasicFrame* pBF, WinBits nWinStyle=0 ); + ~TTTreeListBox(){} + +// virtual void SelectHdl(); +// virtual void DeselectHdl(); + virtual BOOL DoubleClickHdl(); + + virtual void KeyInput( const KeyEvent& rKEvt ); + +// ULONG SelectChildren( SvLBoxEntry* pParent, BOOL bSelect ); + TTFeatures GetFeatures( SvLBoxEntry* ); +}; + +class MsgEdit : public DataEdit +{ + SvLBoxEntry *pCurrentRun; + SvLBoxEntry *pCurrentTestCase; + SvLBoxEntry *pCurrentError; +protected: + BOOL bModified; + Link lModify; + BasicFrame *pBasicFrame; + BOOL bFileLoading; // TRUE während eine Datei geladen wird. + String Impl_MakeText( SvLBoxEntry *pEntry ) const; + String Impl_MakeSaveText( SvLBoxEntry *pEntry ) const; + String Impl_MakeSaveText( TTDebugData aData ) const; + USHORT nVersion; // Speichert die Dateiversion + AppWin* pAppWin; + String aLogFileName; // Name der Logdatei +public: + MsgEdit( AppWin*, BasicFrame *pBF, const WinBits& ); + ~MsgEdit(); + void AddAnyMsg( TTLogMsg *LogMsg ); + void AddRun( String aMsg, TTDebugData aDebugData ); + void AddTestCase( String aMsg, TTDebugData aDebugData ); + void AddError( String aMsg, TTDebugData aDebugData ); + void AddCallStack( String aMsg, TTDebugData aDebugData ); + void AddMessage( String aMsg, TTDebugData aDebugData ); + void AddWarning( String aMsg, TTDebugData aDebugData ); + void AddAssertion( String aMsg, TTDebugData aDebugData ); +DATA_FUNC_DEF( aEditTree, TTTreeListBox ) +}; + +#endif diff --git a/basic/source/app/mybasic.cxx b/basic/source/app/mybasic.cxx new file mode 100644 index 000000000000..e9d823a6ff8f --- /dev/null +++ b/basic/source/app/mybasic.cxx @@ -0,0 +1,330 @@ +/************************************************************************* + * + * $RCSfile: mybasic.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _MSGBOX_HXX //autogen +#include <vcl/msgbox.hxx> +#endif +#ifndef _SBXCLASS_HXX //autogen +#include <svtools/sbx.hxx> +#endif + +// AB-Uno-Test +//#define unotest +#ifdef unotest +#ifndef _USR_UNO_HXX +#include <usr/uno.hxx> +#endif +#include <sbuno.hxx> +#include <sbunoobj.hxx> +#endif + +#include "sbintern.hxx" + +#ifndef _BASIC_TTRESHLP_HXX +#include "ttstrhlp.hxx" +#endif +#include "mybasic.hxx" +#include "basic.hrc" +#include "appbased.hxx" + +#include "status.hxx" +#include "basic.hrc" + +#include "object.hxx" + +#include "comm_bas.hxx" +#include "processw.hxx" + +TYPEINIT1(MyBasic,StarBASIC) + +class MyFactory : public SbxFactory +{ +public: + virtual SbxBase* Create( UINT16 nSbxId, UINT32 = SBXCR_SBX ); +}; + +static SampleObjectFac aFac1; +static MyFactory aFac2; +static CommunicationFactory aComManFac; +static ProcessFactory aProcessFac; +static short nInst = 0; + +SbxBase* MyFactory::Create( UINT16 nSbxId, UINT32 nCr ) +{ + if( nCr == SBXCR_TEST && nSbxId == SBXID_MYBASIC ) + return new MyBasic; + else + return NULL; +} + +MyBasic::MyBasic() : StarBASIC() +{ + nError = 0; + if( !nInst++ ) + { + AddFactory( &aFac1 ); + AddFactory( &aFac2 ); + AddFactory( &aComManFac ); + AddFactory( &aProcessFac ); + } + SbxVariable* p = new SbxCollection( CUniString("MyColl") ); + p->SetName( CUniString("Objects") ); + Insert( p ); + + // AB-Uno-Test +#ifdef unotest + // Uno-Service-Manager holenReflection Service bolen + createAndSetDefaultServiceManager(); // spaeter schon erledigt + + // Uno-Test-Objekt holen + UsrAny aObjAny = getIntrospectionTestObject(); + + // Objekt verpacken in ein SbUnoObject packen + String aName( "UnoObject" ); + SbxObjectRef xSbUnoObj = GetSbUnoObject( aName, aObjAny ); + //SbxObjectRef xSbUnoObj = new SbUnoObject( aName, aObjAny ); + Insert( (SbxObject*)xSbUnoObj ); +#endif + + pTestObject = NULL; +} + +Link MyBasic::GenLogHdl() +{ + return LINK( GetpApp()->GetAppWindow(), BasicFrame, Log ); +} + +Link MyBasic::GenWinInfoHdl() +{ + return LINK( GetpApp()->GetAppWindow(), BasicFrame, WinInfo ); +} + +Link MyBasic::GenModuleWinExistsHdl() +{ + return LINK( GetpApp()->GetAppWindow(), BasicFrame, ModuleWinExists ); +} + +void MyBasic::StartListening( SfxBroadcaster &rBroadcaster ) +{ + ((BasicFrame*)GetpApp()->GetAppWindow())->StartListening( rBroadcaster ); +} + +void MyBasic::SetCompileModule( SbModule *pMod ) +{ + GetSbData()->pCompMod = pMod; +} + +SbModule *MyBasic::GetCompileModule() +{ + return GetSbData()->pCompMod; +} + +String MyBasic::GenRealString( const String &aResString ) +{ + return ((BasicFrame*)GetpApp()->GetAppWindow())->GenRealString( aResString ); +} + +void MyBasic::LoadIniFile() +{ +} + +SbTextType MyBasic::GetSymbolType( const String &rSymbol, BOOL bWasTTControl ) +{ + return SB_SYMBOL; // Alles was hier landet ist vom Typ SB_SYMBOL und bleibt es auch +} + + +MyBasic::~MyBasic() +{ + aErrors.Clear(); + if( !--nInst ) + { + RemoveFactory( &aFac1 ); + RemoveFactory( &aFac2 ); + RemoveFactory( &aComManFac ); + RemoveFactory( &aProcessFac ); + } +} + +BOOL MyBasic::Compile( SbModule* p ) +{ + aErrors.Clear(); + nError = 0; + return StarBASIC::Compile( p ); +} + +BOOL MyBasic::ErrorHdl() +{ + AppEdit *CurrWin = aBasicApp.pFrame->FindModuleWin( GetActiveModule()->GetName() ); + if(CurrWin) + CurrWin->ToTop(); + else + { // erstmal Fenster aufmachen + String aModName = GetActiveModule()->GetName(); + if ( aModName.Copy(0,2).CompareToAscii("--") == COMPARE_EQUAL ) + aModName.Erase(0,2); + GetActiveModule()->SetName(aModName); + AppWin* p = new AppBasEd( aBasicApp.pFrame, GetActiveModule() ); + p->Show(); + p->GrabFocus(); + } + if( IsCompilerError() ) + { + aErrors.Insert( + new BasicError + ( aBasicApp.pFrame->pWork, + 0, StarBASIC::GetErrorText(), GetLine(), GetCol1(), GetCol2() ), + LIST_APPEND ); + nError++; + return BOOL( nError < 20 ); // Abbruch nach 20 Fehlern + } + else + { + ReportRuntimeError(); + return FALSE; + } +} + +void MyBasic::ReportRuntimeError() +{ + String nErrorText; + nErrorText = GetSpechialErrorText(); + + BasicError( aBasicApp.pFrame->pWork, + GetVBErrorCode( GetErrorCode() ), nErrorText, GetLine(), + GetCol1(), GetCol2() ).Show(); +} + +const String MyBasic::GetSpechialErrorText() +{ + return GetErrorText(); +} + +USHORT MyBasic::BreakHdl() +{ + SbModule* pMod = GetActiveModule(); + if( pMod ) + { + AppEdit* pWin = aBasicApp.pFrame->FindModuleWin( pMod->GetName() ); + if( !pWin ) + { // erstmal Fenster aufmachen + String aModName = GetActiveModule()->GetName(); + if ( aModName.Copy(0,2).CompareToAscii("--") == COMPARE_EQUAL ) + aModName.Erase(0,2); + GetActiveModule()->SetName(aModName); + AppWin* p = new AppBasEd( aBasicApp.pFrame, GetActiveModule() ); + p->Show(); + p->GrabFocus(); + p->ToTop(); + pWin = aBasicApp.pFrame->FindModuleWin( aModName ); + } + pWin->Highlight( GetLine(), GetCol1(), GetCol2() ); + } + + if( IsBreak() ) // Wenn Breakpoint (oder "Run to Cursor") + { +// if ( GetActiveModule()->IsBP(GetLine()) ) +// GetActiveModule()->ClearBP(GetLine()); + return aBasicApp.pFrame->BreakHandler(); + } + else + { + return aBasicApp.pFrame->BreakHandler(); + } +} + +/*************************************************************************** +|* +|* class BasicError +|* +***************************************************************************/ + +BasicError::BasicError + ( AppWin* w, USHORT nE, const String& r, USHORT nL, USHORT nC1, USHORT nC2 ) + : aText( ResId( IDS_ERROR1 ) ) +{ + pWin = w; + nLine = nL; + nCol1 = nC1; + nCol2 = nC2; + if( nE ) + { + aText += String::CreateFromInt32( nE ); + aText.AppendAscii(": "); + aText += r; + } + else + aText = r; +} + +// Dies ist ein Beispiel, wie die Fehler-Information geschickt +// aufgebaut werden kann, um ein Statement zu highlighten. + +void BasicError::Show() +{ + if( pWin && pWin->ISA(AppEdit) ) { + ((AppEdit*)pWin)->Highlight( nLine, nCol1, nCol2 ); + aBasicApp.pFrame->pStatus->Message( aText ); + } else MessBox( aBasicApp.pFrame, WB_OK, aBasicApp.pFrame->GetText(), + aText ).Execute(); +} + + diff --git a/basic/source/app/printer.cxx b/basic/source/app/printer.cxx new file mode 100644 index 000000000000..2de59e17bf9e --- /dev/null +++ b/basic/source/app/printer.cxx @@ -0,0 +1,216 @@ +/************************************************************************* + * + * $RCSfile: printer.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _PRINT_HXX //autogen +#include <vcl/print.hxx> +#endif +#ifndef _DIALOG_HXX //autogen +#include <vcl/dialog.hxx> +#endif +#ifndef _FIXED_HXX //autogen +#include <vcl/fixed.hxx> +#endif +#ifndef _BUTTON_HXX //autogen +#include <vcl/button.hxx> +#endif +#ifndef _BASIC_TTRESHLP_HXX +#include "ttstrhlp.hxx" +#endif + +#include "app.hxx" +#include "printer.hxx" +#include "basic.hrc" +#include "resids.hrc" + +class PrintingDialog : public ModelessDialog { + String aName; + FixedText aText; + CancelButton aCancel; +public: + PrintingDialog( Window*, BasicPrinter*, ResId&, String& ); + void ChangeMessage( short ); +}; + +BasicPrinter::BasicPrinter() : Printer() +{ + nPage = 0; nLine = 9999; + SetMapMode( MapMode( MAP_POINT ) ); + Size s( GetOutputSize() ); + // 10-Punkt-Schrift verwenden + Font aFont( FAMILY_MODERN, Size( 0, 10 ) ); + aFont.SetPitch( PITCH_FIXED ); + SetFont( aFont ); + // Ausgabe: 6 Zeilen/Zoll = 12 Punkt + nLines = (short) s.Height() / 12; + nYoff = 12; + SetStartPrintHdl( LINK( this, BasicPrinter, StartPrintHdl ) ); + SetEndPrintHdl( LINK( this, BasicPrinter, EndPrintHdl ) ); + SetPrintPageHdl( LINK( this, BasicPrinter, PrintPageHdl ) ); +} + +void BasicPrinter::Header() +{ + if( nPage ) EndPage(); + nPage++; + StartPage(); + String aHdr; + String aPage( ResId( IDS_PAGE ) ); + aPage.Append( String::CreateFromInt32(nPage) ); + aHdr = aFile.Copy( 0, 80 - aPage.Len() ); + aHdr.Expand( 80 - aPage.Len(), ' ' ); + aHdr += aPage; + DrawText( Point( 0, 0 ), aHdr ); + nLine = 2; +} + +void BasicPrinter::Print( const String& rFile, const String& rText, BasicFrame *pFrame ) +{ + nPage = 0; nLine = 9999; + aFile = rFile; + // Dialog einrichten + ResId aResId( IDD_PRINT_DIALOG ); + pDlg = new PrintingDialog + ( aBasicApp.pFrame, this, aResId, aFile ); + // Position des Dialogs setzen + Size s1 = aBasicApp.pFrame->GetSizePixel(); + Size s2 = pDlg->GetSizePixel(); + pDlg->SetPosPixel( Point( (s1.Width() - s2.Width() ) / 2, + (s1.Height()- s2.Height() ) / 2 ) ); + // PRINT-Menu disablen + MenuBar* pBar = pFrame->GetMenuBar(); + Menu* pFileMenu = pBar->GetPopupMenu( RID_APPFILE ); + pFileMenu->EnableItem( RID_FILEPRINT, FALSE ); + + pDlg->ChangeMessage( 1 ); + pDlg->Show(); + StartJob( rFile ); + StartPage(); + xub_StrLen nDone=0; + while( nDone < rText.Len() ) + { + if( nLine >= nLines ) Header(); + xub_StrLen nLineEnd = min( rText.Search( '\n', nDone ), rText.Search( '\r', nDone ) ); + DrawText( Point( 0, nLine * nYoff ), rText, nDone, nLineEnd-nDone-1 ); + nDone = nLineEnd; + if( nDone <= rText.Len() && rText.GetChar(nDone) == '\r' ) nDone++; + if( nDone <= rText.Len() && rText.GetChar(nDone) == '\n' ) nDone++; + nLine++; + Application::Reschedule(); + } + EndPage(); + EndJob(); + nPage = 1; + while( IsPrinting() ) Application::Reschedule(); + delete pDlg; pDlg = NULL; + pFileMenu->EnableItem( RID_FILEPRINT, TRUE ); +} + +IMPL_LINK_INLINE_START( BasicPrinter, StartPrintHdl, Printer *, pPrinter ) +{ + if( pDlg ) pDlg->Show(); + return 0; +} +IMPL_LINK_INLINE_END( BasicPrinter, StartPrintHdl, Printer *, pPrinter ) + +IMPL_LINK_INLINE_START( BasicPrinter, EndPrintHdl, Printer *, pPrinter ) +{ + if( pDlg ) pDlg->Hide(); + return 0; +} +IMPL_LINK_INLINE_END( BasicPrinter, EndPrintHdl, Printer *, pPrinter ) + +IMPL_LINK_INLINE_START( BasicPrinter, PrintPageHdl, Printer *, pPrinter ) +{ + if( pDlg ) pDlg->ChangeMessage( nPage ); + return 0; +} +IMPL_LINK_INLINE_END( BasicPrinter, PrintPageHdl, Printer *, pPrinter ) + +IMPL_LINK_INLINE( BasicPrinter, Abort , void *, EMPTYARG, +{ + AbortJob(); + return 0L; +} +) + +///////////////////////////////////////////////////////////////////////// + +PrintingDialog::PrintingDialog + ( Window* pParent, BasicPrinter* pPrn, ResId& rId, String& rName ) + : ModelessDialog( pParent, rId ), + aCancel( this, ResId( RID_CANCEL ) ), + aText ( this, ResId( RID_TEXT ) ), + aName ( rName ) +{ + FreeResource(); + aCancel.SetClickHdl( LINK( pPrn, BasicPrinter, Abort ) ); +} + +void PrintingDialog::ChangeMessage( short nPage ) +{ + String aMsg( ResId( IDS_PRINTMSG ) ); + aMsg += aName; + aMsg += CUniString("\n"); + aMsg += String( ResId( IDS_PAGE ) ); + aMsg += String::CreateFromInt32( nPage ); + aText.SetText( aMsg ); +} + diff --git a/basic/source/app/printer.hxx b/basic/source/app/printer.hxx new file mode 100644 index 000000000000..5478fed7efa3 --- /dev/null +++ b/basic/source/app/printer.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * $RCSfile: printer.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _BASICPRN_HXX +#define _BASICPRN_HXX + +#ifndef _PRINT_HXX //autogen +#include <vcl/print.hxx> +#endif + +class PrintingDialog; + +class BasicPrinter : public Printer { + short nLine; // aktuelle Zeile + short nPage; // aktuelle Seite + short nLines; // Zeilen pro Seite + short nYoff; // Zeilenabstand in Points + String aFile; // Dateiname + PrintingDialog* pDlg; // Druck-Dialog + void Header(); // Seitenkopf drucken +public: + BasicPrinter(); + void Print( const String& rFile, const String& rText, BasicFrame *pFrame ); + DECL_LINK( Abort, void * ); + DECL_LINK( StartPrintHdl, Printer * ); + DECL_LINK( EndPrintHdl, Printer * ); + DECL_LINK( PrintPageHdl, Printer * ); +#if defined( PM20 ) + // StarView-Bug, bald wieder zu entfernen: + virtual void SetPageQueueSize( USHORT ) {} +#endif +}; + +#endif diff --git a/basic/source/app/process.cxx b/basic/source/app/process.cxx new file mode 100644 index 000000000000..0a0a9beae762 --- /dev/null +++ b/basic/source/app/process.cxx @@ -0,0 +1,222 @@ +/************************************************************************* + * + * $RCSfile: process.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifdef WNT +#include <tools/prewin.h> +#include "winbase.h" +#include <tools/postwin.h> +#endif + +#ifndef _ERRCODE_HXX //autogen +#include <tools/errcode.hxx> +#endif +#ifndef _VOS_PROCESS_HXX_ +#include <vos/process.hxx> +#endif +#ifndef _SBXCORE_HXX +#include <svtools/sbxcore.hxx> +#endif +#ifndef _STRING_HXX +#include <tools/string.hxx> +#endif +#ifndef _OSL_FILE_HXX_ +#include <osl/file.hxx> +#endif + +#ifndef _BASIC_TTRESHLP_HXX +#include "ttstrhlp.hxx" +#endif + +//#ifndef _BYTE_STRING_LIST +//DECLARE_LIST( ByteStringList, ByteString * ); +//#define _BYTE_STRING_LIST +//#endif + +#include "process.hxx" + +// Konstruktor für den Process +Process::Process() +: bWasGPF( FALSE ) +, pArgumentList( NULL ) +, pProcess( NULL ) +, bHasBeenStarted( FALSE ) +{ +} + +// Destruktor +Process::~Process() +{ + delete pArgumentList; + delete pProcess; +} + + +BOOL Process::ImplIsRunning() +{ + if ( pProcess && bHasBeenStarted ) + { + NAMESPACE_VOS(OProcess::TProcessInfo) aProcessInfo; + pProcess->getInfo( NAMESPACE_VOS(OProcess::TData_ExitCode), &aProcessInfo ); + if ( !(aProcessInfo.Fields & NAMESPACE_VOS(OProcess::TData_ExitCode)) ) + return TRUE; + else + return FALSE; + } + else + return FALSE; +} + +long Process::ImplGetExitCode() +{ + if ( pProcess ) + { + NAMESPACE_VOS(OProcess::TProcessInfo) aProcessInfo; + pProcess->getInfo( NAMESPACE_VOS(OProcess::TData_ExitCode), &aProcessInfo ); + if ( !(aProcessInfo.Fields & NAMESPACE_VOS(OProcess::TData_ExitCode)) ) + SbxBase::SetError( SbxERR_NO_ACTIVE_OBJECT ); + return aProcessInfo.Code; + } + else + SbxBase::SetError( SbxERR_NO_ACTIVE_OBJECT ); + return 0; +} + + +//////////////////////////////////////////////////////////////////////////// + +// Die Methoden: +void Process::SetImage( const String &aAppPath, const String &aAppParams ) +{ // Imagedatei des Executables + if ( pProcess && ImplIsRunning() ) + SbxBase::SetError( SbxERR_NO_ACTIVE_OBJECT ); + else + { + delete pArgumentList; + delete pProcess; + + xub_StrLen i, nCount = aAppParams.GetQuotedTokenCount( CUniString("\"\"" ), ' ' ); + NAMESPACE_RTL(OUString) *pParamList = new NAMESPACE_RTL(OUString)[nCount]; + for ( i = 0 ; i < nCount ; i++ ) + { + NAMESPACE_RTL(OUString) aTemp = NAMESPACE_RTL(OUString)(aAppParams.GetQuotedToken( i, CUniString("\"\"" ), ' ' )); + if ( aTemp.getLength() ) + pParamList[i] = aTemp; + } + pArgumentList = new NAMESPACE_VOS(OArgumentList)( pParamList, nCount ); + NAMESPACE_RTL(OUString) aNormalizedAppPath; + osl::FileBase::normalizePath( NAMESPACE_RTL(OUString)(aAppPath), aNormalizedAppPath ); + pProcess = new NAMESPACE_VOS(OProcess)( aNormalizedAppPath ); + bHasBeenStarted = FALSE; + } +} + +BOOL Process::Start() +{ // Programm wird gestartet + BOOL bSuccess=FALSE; + if ( pProcess && !ImplIsRunning() ) + { + bWasGPF = FALSE; +#ifdef WNT +// sal_uInt32 nErrorMode = SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_NOALIGNMENTFAULTEXCEPT | SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX); + sal_uInt32 nErrorMode = SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_NOALIGNMENTFAULTEXCEPT | SEM_NOGPFAULTERRORBOX); + try + { +#endif + bSuccess = pProcess->execute( (NAMESPACE_VOS(OProcess)::TProcessOption) + ( NAMESPACE_VOS(OProcess)::TOption_SearchPath + /*| NAMESPACE_VOS(OProcess)::TOption_Detached*/ + /*| NAMESPACE_VOS(OProcess)::TOption_Wait*/ ), + *pArgumentList ) == NAMESPACE_VOS(OProcess)::E_None; +#ifdef WNT + } + catch( ... ) + { + bWasGPF = TRUE; + } + nErrorMode = SetErrorMode(nErrorMode); +#endif + bHasBeenStarted = bSuccess; + } + else + SbxBase::SetError( SbxERR_NO_ACTIVE_OBJECT ); + return bSuccess; +} + +ULONG Process::GetExitCode() +{ // ExitCode des Programms(nachdem es beendet ist) + return ImplGetExitCode(); +} + +BOOL Process::IsRunning() +{ // Programm läuft noch + return ImplIsRunning(); +} + +BOOL Process::WasGPF() +{ // Programm mit GPF o.ä. abgebrochen +#ifdef WNT + return ImplGetExitCode() == 3221225477; +#else + return bWasGPF; +#endif +} + diff --git a/basic/source/app/processw.cxx b/basic/source/app/processw.cxx new file mode 100644 index 000000000000..d33c9ddfa208 --- /dev/null +++ b/basic/source/app/processw.cxx @@ -0,0 +1,324 @@ +/************************************************************************* + * + * $RCSfile: processw.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef _ERRCODE_HXX //autogen +#include <tools/errcode.hxx> +#endif +#ifndef _SBX_SBXOBJECT_HXX //autogen +#include <svtools/sbxobj.hxx> +#endif +#ifndef _SBXCLASS_HXX //autogen +#include <svtools/sbx.hxx> +#endif +#ifndef __SBX_SBXVARIABLE_HXX //autogen +#include <svtools/sbxvar.hxx> +#endif + +//#include <osl/thread.h> +#ifndef _BASIC_TTRESHLP_HXX +#include "ttstrhlp.hxx" +#endif + +#include "processw.hxx" + +//#include "collelem.hxx" +// Makro MEMBER() +#include "macfix.hxx" + +// Der Process hat folgende Elemente: +// 1) Properties: +// Keine +// 2) Methoden: +// SetImage( Filename ) +// BOOL Start +// USHORT GetExitCode +// BOOL IsRunning +// BOOL WasGPF + + +// Diese Implementation ist ein Beispiel fuer eine tabellengesteuerte +// Version, die sehr viele Elemente enthalten kann. Die Elemente werden +// je nach Bedarf aus der Tabelle in das Objekt uebernommen. + +// Das nArgs-Feld eines Tabelleneintrags ist wie folgt verschluesselt: + +#define _ARGSMASK 0x00FF // Bis zu 255 Argumente +#define _RWMASK 0x0F00 // Maske fuer R/W-Bits +#define _TYPEMASK 0xF000 // Maske fuer den Typ des Eintrags + +#define _READ 0x0100 // kann gelesen werden +#define _BWRITE 0x0200 // kann as Lvalue verwendet werden +#define _LVALUE _BWRITE // kann as Lvalue verwendet werden +#define _READWRITE 0x0300 // beides +#define _OPT 0x0400 // TRUE: optionaler Parameter +#define _METHOD 0x1000 // Masken-Bit fuer eine Methode +#define _PROPERTY 0x2000 // Masken-Bit fuer eine Property +#define _COLL 0x4000 // Masken-Bit fuer eine Collection + // Kombination von oberen Bits: +#define _FUNCTION 0x1100 // Maske fuer Function +#define _LFUNCTION 0x1300 // Maske fuer Function, die auch als Lvalue geht +#define _ROPROP 0x2100 // Maske Read Only-Property +#define _WOPROP 0x2200 // Maske Write Only-Property +#define _RWPROP 0x2300 // Maske Read/Write-Property +#define _COLLPROP 0x4100 // Maske Read-Collection-Element + +#define COLLNAME "Elements" // Name der Collection, hier mal hart verdrahtet + + + +ProcessWrapper::Methods ProcessWrapper::aProcessMethods[] = { +// Imagedatei des Executables +{ "SetImage", SbxEMPTY, 1 | _FUNCTION, MEMBER(ProcessWrapper::PSetImage) }, + // Zwei Named Parameter + { "Filename",SbxSTRING }, + { "Params",SbxSTRING, _OPT }, +// Programm wird gestartet +{ "Start", SbxBOOL, 0 | _FUNCTION, MEMBER(ProcessWrapper::PStart) }, +// ExitCode des Programms(nachdem es beendet ist) +{ "GetExitCode", SbxULONG, 0 | _FUNCTION, MEMBER(ProcessWrapper::PGetExitCode) }, +// Programm läuft noch +{ "IsRunning", SbxBOOL, 0 | _FUNCTION, MEMBER(ProcessWrapper::PIsRunning) }, +// Programm mit GPF o.ä. abgebrochen +{ "WasGPF", SbxBOOL, 0 | _FUNCTION, MEMBER(ProcessWrapper::PWasGPF) }, + +{ NULL, SbxNULL, -1 }}; // Tabellenende + + + +// Konstruktor für den Process +ProcessWrapper::ProcessWrapper() : SbxObject( CUniString("Process") ) +{ + pProcess = new Process(); + SetName( CUniString("Process") ); + pMethods = &aProcessMethods[0]; +} + +// Destruktor +ProcessWrapper::~ProcessWrapper() +{ + delete pProcess; +} + +// Suche nach einem Element: +// Hier wird linear durch die Methodentabelle gegangen, bis eine +// passende Methode gefunden wurde. +// Wenn die Methode/Property nicht gefunden wurde, nur NULL ohne +// Fehlercode zurueckliefern, da so auch eine ganze Chain von +// Objekten nach der Methode/Property befragt werden kann. + +SbxVariable* ProcessWrapper::Find( const String& rName, SbxClassType t ) +{ + // Ist das Element bereits vorhanden? + SbxVariable* pRes = SbxObject::Find( rName, t ); + if( !pRes && t != SbxCLASS_OBJECT ) + { + // sonst suchen + Methods* p = pMethods; + short nIndex = 0; + BOOL bFound = FALSE; + while( p->nArgs != -1 ) + { + if( rName.CompareIgnoreCaseToAscii( p->pName ) == COMPARE_EQUAL ) + { + bFound = TRUE; break; + } + nIndex += ( p->nArgs & _ARGSMASK ) + 1; + p = pMethods + nIndex; + } + if( bFound ) + { + // Args-Felder isolieren: + short nAccess = ( p->nArgs & _RWMASK ) >> 8; + short nType = ( p->nArgs & _TYPEMASK ); + String aName( p->pName, RTL_TEXTENCODING_ASCII_US ); + SbxClassType eCT = SbxCLASS_OBJECT; + if( nType & _PROPERTY ) + eCT = SbxCLASS_PROPERTY; + else if( nType & _METHOD ) + eCT = SbxCLASS_METHOD; + pRes = Make( aName, eCT, p->eType ); + // Wir setzen den Array-Index + 1, da ja noch andere + // Standard-Properties existieren, die auch aktiviert + // werden muessen. + pRes->SetUserData( nIndex + 1 ); + pRes->SetFlags( nAccess ); + } + } + return pRes; +} + +// Aktivierung eines Elements oder Anfordern eines Infoblocks + +void ProcessWrapper::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCT, + const SfxHint& rHint, const TypeId& rHT ) +{ + const SbxHint* pHint = PTR_CAST(SbxHint,&rHint); + if( pHint ) + { + SbxVariable* pVar = pHint->GetVar(); + SbxArray* pPar = pVar->GetParameters(); + USHORT nIndex = (USHORT) pVar->GetUserData(); + // kein Index: weiterreichen! + if( nIndex ) + { + ULONG t = pHint->GetId(); + if( t == SBX_HINT_INFOWANTED ) + pVar->SetInfo( GetInfo( (short) pVar->GetUserData() ) ); + else + { + BOOL bWrite = FALSE; + if( t == SBX_HINT_DATACHANGED ) + bWrite = TRUE; + if( t == SBX_HINT_DATAWANTED || bWrite ) + { + // Parameter-Test fuer Methoden: + USHORT nPar = pMethods[ --nIndex ].nArgs & 0x00FF; + // Element 0 ist der Returnwert + if( ( !pPar && nPar ) + || ( pPar && pPar->Count() < nPar+1 ) ) + SetError( SbxERR_WRONG_ARGS ); + // Alles klar, man kann den Call ausfuehren + else + { + (this->*(pMethods[ nIndex ].pFunc))( pVar, pPar, bWrite ); + } + } + } + } + SbxObject::SFX_NOTIFY( rBC, rBCT, rHint, rHT ); + } +} + +// Zusammenbau der Infostruktur fuer einzelne Elemente + +SbxInfo* ProcessWrapper::GetInfo( short nIdx ) +{ + Methods* p = &pMethods[ nIdx ]; + // Wenn mal eine Hilfedatei zur Verfuegung steht: + // SbxInfo* pInfo = new SbxInfo( Hilfedateiname, p->nHelpId ); + SbxInfo* pInfo = new SbxInfo; + short nPar = p->nArgs & _ARGSMASK; + for( short i = 0; i < nPar; i++ ) + { + p++; + String aName( p->pName, RTL_TEXTENCODING_ASCII_US ); + USHORT nFlags = ( p->nArgs >> 8 ) & 0x03; + if( p->nArgs & _OPT ) + nFlags |= SBX_OPTIONAL; + pInfo->AddParam( aName, p->eType, nFlags ); + } + return pInfo; +} + + +//////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////// + +// Properties und Methoden legen beim Get (bPut = FALSE) den Returnwert +// im Element 0 des Argv ab; beim Put (bPut = TRUE) wird der Wert aus +// Element 0 gespeichert. + +// Die Methoden: +void ProcessWrapper::PSetImage( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ) +{ // Imagedatei des Executables + if ( pPar->Count() >= 2 ) + pProcess->SetImage(pPar->Get( 1 )->GetString(), pPar->Get( 2 )->GetString() ); + else + pProcess->SetImage(pPar->Get( 1 )->GetString(), String() ); +} + +void ProcessWrapper::PStart( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ) +{ // Programm wird gestartet + pVar->PutBool( pProcess->Start() ); +} + +void ProcessWrapper::PGetExitCode( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ) +{ // ExitCode des Programms(nachdem es beendet ist) + pVar->PutULong( pProcess->GetExitCode() ); +} + +void ProcessWrapper::PIsRunning( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ) +{ // Programm läuft noch + pVar->PutBool( pProcess->IsRunning() ); +} + +void ProcessWrapper::PWasGPF( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ) +{ // Programm mit GPF o.ä. abgebrochen + pVar->PutBool( pProcess->WasGPF() ); +} + + + + + + +// Die Factory legt unser Objekte an. + +SbxObject* ProcessFactory::CreateObject( const String& rClass ) +{ + if( rClass.CompareIgnoreCaseToAscii( "Process" ) == COMPARE_EQUAL ) + return new ProcessWrapper(); + return NULL; +} + diff --git a/basic/source/app/processw.hxx b/basic/source/app/processw.hxx new file mode 100644 index 000000000000..ea1bff65605a --- /dev/null +++ b/basic/source/app/processw.hxx @@ -0,0 +1,131 @@ +/************************************************************************* + * + * $RCSfile: processw.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _PROCESSW_HXX +#define _PROCESSW_HXX + +#ifndef __SBX_SBX_FACTORY_HXX //autogen +#include <svtools/sbxfac.hxx> +#endif +#ifndef __SBX_SBXVARIABLE_HXX //autogen +#include <svtools/sbxvar.hxx> +#endif +#ifndef _SBX_SBXOBJECT_HXX //autogen +#include <svtools/sbxobj.hxx> +#endif +#include "process.hxx" + +class ProcessWrapper : public SbxObject +{ + // Definition eines Tabelleneintrags. Dies wird hier gemacht, + // da dadurch die Methoden und Properties als private deklariert + // werden koennen. +#if defined ( ICC ) || defined ( HPUX ) || defined ( C50 ) +public: +#endif + typedef void( ProcessWrapper::*pMeth ) + ( SbxVariable* pThis, SbxArray* pArgs, BOOL bWrite ); +#if defined ( ICC ) || defined ( HPUX ) +private: +#endif + + struct Methods { + const char* pName; // Name des Eintrags + SbxDataType eType; // Datentyp + short nArgs; // Argumente und Flags + pMeth pFunc; // Function Pointer + }; + static Methods aProcessMethods[]; // Methodentabelle + Methods *pMethods; // Aktuelle Methodentabelle + + // Methoden + void PSetImage( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ); + void PStart( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ); + void PGetExitCode( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ); + void PIsRunning( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ); + void PWasGPF( SbxVariable* pVar, SbxArray* pPar, BOOL bWrite ); + + // Interne Member und Methoden + Process *pProcess; + + // Infoblock auffuellen + SbxInfo* GetInfo( short nIdx ); + + // Broadcaster Notification + virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ); +public: + ProcessWrapper(); + ~ProcessWrapper(); + // Suchen eines Elements + virtual SbxVariable* Find( const String&, SbxClassType ); +}; + + +// Die dazugehoerige Factory: + +class ProcessFactory : public SbxFactory +{ +public: + virtual SbxObject* CreateObject( const String& ); +}; + +#endif diff --git a/basic/source/app/resids.hrc b/basic/source/app/resids.hrc new file mode 100644 index 000000000000..c2d775771892 --- /dev/null +++ b/basic/source/app/resids.hrc @@ -0,0 +1,148 @@ +/************************************************************************* + * + * $RCSfile: resids.hrc,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _RESIDS_HRC +#define _RESIDS_HRC + +#define RID_OK 1 +#define RID_CANCEL 2 +#define RID_FILENAME 3 +#define RID_PATHNAME 4 +#define RID_FILELIST 5 +#define RID_DIRSLIST 6 +#define RID_FIND 7 +#define RID_REPLACE 8 +//#define RID_ICON 9 +//#define RID_EDITFIELD 10 +#define RID_TEXT 11 +//#define RID_FRAME1 12 +//#define RID_FRAME2 13 +#define RID_VERSIONSTRING 14 +#define RID_FIXEDTEXT1 15 +#define RID_FIXEDTEXT2 16 + + +// OptionsDialog +#define RES_TC_OPTIONS 20 + +// SpecialOptions +#define RID_TP_SPE 30 +#define GB_DIRECTORIES 31 +#define LOG_TEXT 32 +#define BASIS_TEXT 33 +#define HID_TEXT 34 +#define GB_OTHER 35 +#define TIMEOUT_TEXT 36 +#define LOG_NAME 37 +#define BASIS_NAME 38 +#define HID_NAME 39 +#define LOG_SET 40 +#define BASIS_SET 41 +#define HID_SET 42 +#define SERVER_TIMEOUT 43 +#define CB_AUTORELOAD 44 + + +// GenericOptions +#define RID_TP_GEN 50 +#define RID_GB_AREA 51 +#define RID_CB_AREA 52 +#define RID_PB_NEW_AREA 53 +#define RID_PD_DEL_AREA 54 +#define RID_GB_VALUE 55 +#define RID_CB_VALUE 56 +#define RID_PB_NEW_VALUE 57 +#define RID_PB_DEL_VALUE 58 + +// DisplayHId +#define RID_TB_CONF 70 +#define RID_FT_CONTROLS 71 +#define RID_MLB_CONTROLS 72 +#define RID_FT_SLOTS 73 +#define RID_MLB_SLOTS 74 +#define RID_PB_KOPIEREN 75 +#define RID_PB_BENENNEN 76 +#define RID_PB_SELECTALL 77 +#define RID_OK_CLOSE 78 + + +// BreakpointWindow +#define IMGID_BRKENABLED 80 +#define IMGID_BRKDISABLED 81 +#define IMGID_STEPMARKER 82 +#define IMGID_ERRORMARKER 83 + + +// Edit Variables +#define RID_FT_NAME 90 +#define RID_FT_CONTENT 91 +#define RID_FT_NEW_CONTENT 92 +#define RID_FT_NAME_VALUE 93 +#define RID_FT_CONTENT_VALUE 94 + +#define RID_RB_NEW_BOOL_T 95 +#define RID_RB_NEW_BOOL_F 96 +#define RID_NF_NEW_INTEGER 97 +#define RID_NF_NEW_LONG 98 +#define RID_ED_NEW_STRING 99 + +#endif + diff --git a/basic/source/app/status.cxx b/basic/source/app/status.cxx new file mode 100644 index 000000000000..9e9cd80c47e7 --- /dev/null +++ b/basic/source/app/status.cxx @@ -0,0 +1,157 @@ +/************************************************************************* + * + * $RCSfile: status.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include "app.hxx" +#include "basic.hrc" +#include "appwin.hxx" +#include "status.hxx" + +#include <vcl/system.hxx> + +#include <vcl/decoview.hxx> + +StatusLine::StatusLine( BasicFrame* p ) +: TaskBar( p ) +, pFrame( p ) +{ + Show(); +} + +TaskToolBox* StatusLine::CreateTaskToolBox() +{ + TaskToolBox *pTTB = new TaskToolBox( this ); + pTTB->SetActivateTaskHdl( LINK( this, StatusLine, ActivateTask ) ); +// pTTB->Show(); + return pTTB; +} + +TaskStatusBar* StatusLine::CreateTaskStatusBar() +{ + TaskStatusBar* pBar = new TaskStatusBar( this, WB_3DLOOK | WB_BORDER | WB_LEFT ); + USHORT nCharWidth = GetTextWidth( '0' ); // Angenommen, alle Zahlen sind gleich breit + + pBar->InsertItem( ST_MESSAGE, GetTextWidth( 'X' ) * 20, SIB_LEFT | SIB_IN | SIB_AUTOSIZE ); + pBar->InsertItem( ST_LINE, 5*nCharWidth ); + pBar->InsertStatusField(); + return pBar; +} + +void StatusLine::Message( String& s ) +{ + GetStatusBar()->SetItemText( ST_MESSAGE, s ); +} + +void StatusLine::Pos( String& s ) +{ + GetStatusBar()->SetItemText( ST_LINE, s ); +} + +IMPL_LINK( StatusLine, ActivateTask, TaskToolBox*, pTTB ) +{ + USHORT nFirstWinPos=0; + MenuBar* pMenu = pFrame->GetMenuBar(); + PopupMenu* pWinMenu = pMenu->GetPopupMenu( RID_APPWINDOW ); + + while ( pWinMenu->GetItemId( nFirstWinPos ) < RID_WIN_FILE1 && nFirstWinPos < pWinMenu->GetItemCount() ) + nFirstWinPos++; + + nFirstWinPos += pTTB->GetItemPos( pTTB->GetCurItemId() ) / 2; + + USHORT x; + x = pTTB->GetItemPos( pTTB->GetCurItemId() ); + x = pWinMenu->GetItemId( nFirstWinPos ); + x = pWinMenu->GetItemCount(); + AppWin* pWin = pFrame->FindWin( pWinMenu->GetItemText( pWinMenu->GetItemId( nFirstWinPos ) ) ); + if ( pWin ) + { + pWin->Minimize( FALSE ); + pWin->ToTop(); + } + return 0; +} + +void StatusLine::LoadTaskToolBox() +{ + USHORT nFirstWinPos=0; + MenuBar* pMenu = pFrame->GetMenuBar(); + PopupMenu* pWinMenu = pMenu->GetPopupMenu( RID_APPWINDOW ); + + while ( pWinMenu->GetItemId( nFirstWinPos ) < RID_WIN_FILE1 && nFirstWinPos < pWinMenu->GetItemCount() ) + nFirstWinPos++; + + TaskToolBox* pTaskToolBox = GetTaskToolBox(); + + pTaskToolBox->StartUpdateTask(); + + while ( nFirstWinPos < pWinMenu->GetItemCount() ) + { // Es gibt Fenster + Window* pWin = pFrame->FindWin( pWinMenu->GetItemId( nFirstWinPos ) ); + + if ( pWin ) + pTaskToolBox->UpdateTask( Image(), pWin->GetText(), pWin == pFrame->pList->Last() && !( pFrame->pList->Last()->GetWinState() & TT_WIN_STATE_HIDE ) ); + + nFirstWinPos++; + } + + pTaskToolBox->EndUpdateTask(); +} + + diff --git a/basic/source/app/status.hxx b/basic/source/app/status.hxx new file mode 100644 index 000000000000..d1bc2135c4fd --- /dev/null +++ b/basic/source/app/status.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * $RCSfile: status.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _BASICSTATUS_HXX +#define _BASICSTATUS_HXX + +#ifndef _TASKBAR_HXX +#include <svtools/taskbar.hxx> +#endif +#ifndef _SV_STATUS_HXX +#include <vcl/status.hxx> +#endif + +#define ST_MESSAGE 1 +#define ST_LINE 2 + +class BasicFrame; + +class StatusLine : public TaskBar +{ +protected: + BasicFrame* pFrame; +// virtual TaskButtonBar* CreateButtonBar(); + virtual TaskToolBox* CreateTaskToolBox(); + virtual TaskStatusBar* CreateTaskStatusBar(); + DECL_LINK( ActivateTask, TaskToolBox* ); + +public: + StatusLine( BasicFrame* ); + void Message( String& ); // Text anzeigen + void Pos( String& s ); // Textposition anzeigen + void LoadTaskToolBox(); +}; + +#endif diff --git a/basic/source/app/svtmsg.src b/basic/source/app/svtmsg.src new file mode 100644 index 000000000000..f6231aefe4c5 --- /dev/null +++ b/basic/source/app/svtmsg.src @@ -0,0 +1,1330 @@ +/************************************************************************* + * + * $RCSfile: svtmsg.src,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#include <svtools/svtmsg.hrc> + + +// Hier sind die Messages aus dem Verzeichnis /basic/source/app enhalten + + +/////////////////////////////// +// Fehlermeldungen, die in das Resultfile gelangen. +// ********************* +// *** !!ACHTUNG!! *** +// ********************* +// Die Nummern dürfen sich NIE! ändern, +// da sie in den Resultfiles gespeichert sind, und bei erneutem Anzeigen +// statdessen die entsprechenden neuen oder garkeine Strings angzeigt werden. +/////////////////////////////// +String S_GPF_ABORT +{ + Text = "Programm abgebrochen mit GPF"; + Text[ english_us ] = "Program aborted with GPF"; + Text[ portuguese ] = "Programa abortado com GPF"; + Text[ russian ] = "Program aborted with GPF"; + Text[ greek ] = "Program aborted with GPF"; + Text[ dutch ] = "Programma gestopt met GPF"; + Text[ french ] = "Programme interrompu à l'aide de GPF"; + Text[ spanish ] = "Programa interrumpido con GPF"; + Text[ italian ] = "Program aborted with GPF"; + Text[ danish ] = "Program aborted with GPF"; + Text[ swedish ] = "Program aborted with GPF"; + Text[ polish ] = "Przerwanie programu przez GPF"; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "Program aborted with GPF"; + Text[ korean ] = "ÇÁ·Î±×·¥ÀÌ GPF¿Í ÇÔ²² Ãë¼ÒµÇ¾ú½À´Ï´Ù."; + Text[ chinese_simplified ] = "Program aborted with GPF"; + Text[ chinese_traditional ] = "Program aborted with GPF"; + Text[ arabic ] = "Program aborted with GPF"; + Text[ turkish ] = "Program aborted with GPF"; +}; +String S_APP_SHUTDOWN +{ + Text = "Applikation wurde Beendet"; + Text[ english_us ] = "Application has been shut down"; + Text[ portuguese ] = "A aplicação foi fechada."; + Text[ russian ] = "Application has been shut down"; + Text[ greek ] = "Application has been shut down"; + Text[ dutch ] = "Applicatie werd beëindigd"; + Text[ french ] = "L'application a été arrêtée."; + Text[ spanish ] = "Se cerró la aplicación"; + Text[ italian ] = "Application has been shut down"; + Text[ danish ] = "Application has been shut down"; + Text[ swedish ] = "Application has been shut down"; + Text[ polish ] = "Aplikacja zakoñczona"; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "Application has been shut down"; + Text[ korean ] = "ÀÀ¿ëÇÁ·Î±×·¥ÀÌ Á¾·á µÇ¾ú½À´Ï´Ù."; + Text[ chinese_simplified ] = "Application has been shut down"; + Text[ chinese_traditional ] = "Application has been shut down"; + Text[ arabic ] = "Application has been shut down"; + Text[ turkish ] = "Application has been shut down"; +}; +String S_SID_EXECUTE_FAILED_NO_DISPATCHER +{ + Text = "Konnte Slot ID nicht ausführen: Kein ActiveDispatcher"; + Text[ english_us ] = "Slot ID cannot be run. No ActiveDispatcher"; + Text[ portuguese ] = "Foi impossível executar Slot ID: ActiveDispatcher inexistente"; + Text[ russian ] = "Slot ID cannot be run. No ActiveDispatcher"; + Text[ greek ] = "Slot ID cannot be run. No ActiveDispatcher"; + Text[ dutch ] = "Kon slot ID niet uitvoeren: geen ActiveDispatcher"; + Text[ french ] = "Impossible d'exécuter Slot ID : aucun dispatcheur actif"; + Text[ spanish ] = "No se pudo ejecutar Slot ID. ActiveDispatcher inexistente"; + Text[ italian ] = "Slot ID cannot be run. No ActiveDispatcher"; + Text[ danish ] = "Slot ID cannot be run. No ActiveDispatcher"; + Text[ swedish ] = "Slot ID cannot be run. No ActiveDispatcher"; + Text[ polish ] = "Nie móg³ wykonaæ Slot ID: Brak ActiveDispatcher"; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "Slot ID cannot be run. No ActiveDispatcher"; + Text[ korean ] = "½½·Ô ID°¡ ÀÛµ¿µÉ ¼ö ¾ø½À´Ï´Ù. ActiveDispatcher°¡ ¾ø½À´Ï´Ù."; + Text[ chinese_simplified ] = "Slot ID cannot be run. No ActiveDispatcher"; + Text[ chinese_traditional ] = "Slot ID cannot be run. No ActiveDispatcher"; + Text[ arabic ] = "Slot ID cannot be run. No ActiveDispatcher"; + Text[ turkish ] = "Slot ID cannot be run. No ActiveDispatcher"; +}; +String S_SID_EXECUTE_FAILED +{ + Text = "Konnte Slot ID nicht ausführen"; + Text[ english_us ] = "Slot ID could not be run"; + Text[ portuguese ] = "Impossível executar Slot ID."; + Text[ russian ] = "Slot ID could not be run"; + Text[ greek ] = "Slot ID could not be run"; + Text[ dutch ] = "Kon slot ID niet uitvoeren"; + Text[ french ] = "Impossible d'exécuter Slot ID"; + Text[ spanish ] = "No se pudo ejecutar Slot ID"; + Text[ italian ] = "Slot ID could not be run"; + Text[ danish ] = "Slot ID could not be run"; + Text[ swedish ] = "Slot ID could not be run"; + Text[ polish ] = "Nie móg³ wykonaæ Slot ID"; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "Slot ID could not be run"; + Text[ korean ] = "½½·Ô ID°¡ ÀÛµ¿µÉ ¼ö ¾ø½À´Ï´Ù."; + Text[ chinese_simplified ] = "Slot ID could not be run"; + Text[ chinese_traditional ] = "Slot ID could not be run"; + Text[ arabic ] = "Slot ID could not be run"; + Text[ turkish ] = "Slot ID could not be run"; +}; +String S_UNO_PROPERTY_NITIALIZE_FAILED +{ + Text = "UnoSlot: Konnte Properties nicht initialisieren."; + Text[ english_us ] = "UnoSlot: Properties could not be initialized"; + Text[ portuguese ] = "UnoSlot: impossível inicializar Properties."; + Text[ russian ] = "UnoSlot: Properties could not be initialized"; + Text[ greek ] = "UnoSlot: Properties could not be initialized"; + Text[ dutch ] = "UnoSlot: kon Properties niet initialiseren"; + Text[ french ] = "UnoSlot : Impossible d'initialiser les propriétés."; + Text[ spanish ] = "UnoSlot: No se pudo instalar Properties"; + Text[ italian ] = "UnoSlot: Properties could not be initialized."; + Text[ danish ] = "UnoSlot: Properties could not be initialized"; + Text[ swedish ] = "UnoSlot: Properties could not be initialized"; + Text[ polish ] = "UnoSlot: Nie móg³ rozpocz¹æ Properties."; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "UnoSlot: Properties could not be initialized"; + Text[ korean ] = "UnoSlot: ¼Ó¼ºÀÌ ÃʱâÈ µÇÁö ¾Ê½À´Ï´Ù."; + Text[ chinese_simplified ] = "UnoSlot: Properties could not be initialized"; + Text[ chinese_traditional ] = "UnoSlot: Properties could not be initialized"; + Text[ arabic ] = "UnoSlot: Properties could not be initialized"; + Text[ turkish ] = "UnoSlot: Properties could not be initialized"; +}; +String S_RESETAPPLICATION_FAILED_COMPLEX +{ + Text = "ResetApplication fehlgeschlagen: Zu komplex"; + Text[ english_us ] = "ResetApplication failed: too complex"; + Text[ portuguese ] = "ResetApplication falhou: demasiado complexa"; + Text[ russian ] = "ResetApplication failed: too complex"; + Text[ greek ] = "ResetApplication failed: too complex"; + Text[ dutch ] = "ResetApplication mislukt: te gecompliceerd"; + Text[ french ] = "Échec de ResetApplication : trop complexe"; + Text[ spanish ] = "No se realizó ResetApplication: Demasiado compleja"; + Text[ italian ] = "ResetApplication failed: too complex"; + Text[ danish ] = "ResetApplication failed: too complex"; + Text[ swedish ] = "ResetApplication failed: too complex"; + Text[ polish ] = "ResetApplikation nie powid³o siê: za bardzo z³o¿one"; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "ResetApplication failed: too complex"; + Text[ korean ] = "ResetApplication ½ÇÆÐ : ³Ê¹« º¹ÀâÇÕ´Ï´Ù."; + Text[ chinese_simplified ] = "ResetApplication failed: too complex"; + Text[ chinese_traditional ] = "ResetApplication failed: too complex"; + Text[ arabic ] = "ResetApplication failed: too complex"; + Text[ turkish ] = "ResetApplication failed: too complex"; +}; +String S_RESETAPPLICATION_FAILED_UNKNOWN +{ + Text = "ResetApplication fehlgeschlagen: Unbekannter Fenstertyp"; + Text[ english_us ] = "ResetApplication failed: unknown window type"; + Text[ portuguese ] = "ResetApplication falhou: tipo de janela desconhecido"; + Text[ russian ] = "ResetApplication failed: unknown window type"; + Text[ greek ] = "ResetApplication failed: unknown window type"; + Text[ dutch ] = "RestApplication mislukt: onbekend venstertype"; + Text[ french ] = "Échec de ResetApplication : type de fenêtre inconnu"; + Text[ spanish ] = "No se realizó ResetApplication: Tipo desconocido de error"; + Text[ italian ] = "RestApplication failed: unknown window type."; + Text[ danish ] = "ResetApplication failed: unknown window type"; + Text[ swedish ] = "ResetApplication failed: unknown window type"; + Text[ polish ] = "ResetApplikation nie powiod³o siê: nieznany typ okna"; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "ResetApplication failed: unknown window type"; + Text[ korean ] = "ResetApplication ½ÇÆÐ : ¾Ë¼ö¾ø´Â â ŸÀÔ"; + Text[ chinese_simplified ] = "ResetApplication failed: unknown window type"; + Text[ chinese_traditional ] = "ResetApplication failed: unknown window type"; + Text[ arabic ] = "ResetApplication failed: unknown window type"; + Text[ turkish ] = "ResetApplication failed: unknown window type"; +}; +String S_NO_ACTIVE_WINDOW +{ + Text = "Kein aktives Fenster gefunden (GetNextCloseWindow)"; + Text[ english_us ] = "Active window not found (GetNextCloseWindow)"; + Text[ portuguese ] = "Impossível encontrar janela activa (GetNextCloseWindow)"; + Text[ russian ] = "Active window not found (GetNextCloseWindow)"; + Text[ greek ] = "Active window not found (GetNextCloseWindow)"; + Text[ dutch ] = "Geen actief venster gevonden (GetNextCloseWindows)"; + Text[ french ] = "Aucune fenêtre active détectée (GetNextCloseWindow)"; + Text[ spanish ] = "No se encontró ninguna ventana activa (GetNextCloseWindow)"; + Text[ italian ] = "Active window not found (GetNextCloseWindow)"; + Text[ danish ] = "Active window not found (GetNextCloseWindow)"; + Text[ swedish ] = "Active window not found (GetNextCloseWindow)"; + Text[ polish ] = "Nie znaleziono aktywnego okna (GetNextCloseWindow) "; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "Active window not found (GetNextCloseWindow)"; + Text[ korean ] = "Ȱ¼º âÀÌ ¹ß°ßµÇÁö ¾Ê½À´Ï´Ù.(GetNextCloseWindow)"; + Text[ chinese_simplified ] = "Active window not found (GetNextCloseWindow)"; + Text[ chinese_traditional ] = "ResetApplication failed: unknown window type"; + Text[ arabic ] = "Active window not found (GetNextCloseWindow)"; + Text[ turkish ] = "Active window not found (GetNextCloseWindow)"; +}; +String S_NO_DIALOG_IN_GETACTIVE +{ + Text = "GetActive liefert keinen Dialog zurück! Bitte Entwicklung informieren"; + Text[ english_us ] = "GetActive does not show a dialog! Inform development."; + Text[ portuguese ] = "GetActive não devolve nenhuma caixa de diálogo! Informe o departamento de programação."; + Text[ russian ] = "GetActive does not deliver a dialog! Inform development."; + Text[ greek ] = "GetActive does not deliver a dialog! Inform development."; + Text[ dutch ] = "GetActive levert geen dialoog terug! Ontwikkeling informeren!"; + Text[ french ] = "GetActive ne fournit aucune boîte de dialogue ! Veuillez informer le service de développement."; + Text[ spanish ] = "¡GetActive no devuelve ningún diálogo! Informe por favor al servicio de programación"; + Text[ italian ] = "GetActive does not deliver a dialog! Inform development."; + Text[ danish ] = "GetActive does not deliver a dialog! Inform development."; + Text[ swedish ] = "GetActive does not deliver a dialog! Inform development."; + Text[ polish ] = "GetActive nie wysy³a z powrotem ¿adnego dialogu! Proszê powiadomiæ o tym oddzia³ programowania."; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "GetActive does not deliver a dialog! Inform development."; + Text[ korean ] = "GetActive does not deliver a dialog! Inform development."; + Text[ chinese_simplified ] = "GetActive does not deliver a dialog! Inform development."; + Text[ chinese_traditional ] = "GetActive does not deliver a dialog! Inform development."; + Text[ arabic ] = "GetActive does not deliver a dialog! Inform development."; + Text[ turkish ] = "GetActive does not deliver a dialog! Inform development."; +}; +String S_NO_POPUP +{ + Text = "Kein PopupMenu geöffnet"; + Text[ english_us ] = "PopUp menu not open"; + Text[ portuguese ] = "PopupMenu não está aberto"; + Text[ russian ] = "PopUp menu not open"; + Text[ greek ] = "PopUp menu not open"; + Text[ dutch ] = "Geen PopUpMenu geopend"; + Text[ french ] = "Aucun menu Pop-Up ouvert"; + Text[ spanish ] = "No existe ningún PopupMenu abierto"; + Text[ italian ] = "PopUp menu not open"; + Text[ danish ] = "PopUp menu not open"; + Text[ swedish ] = "PopUp menu not open"; + Text[ polish ] = "Nie otworzono ¿adnego menu Popup"; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "PopUp menu not open"; + Text[ korean ] = "ÆË¾÷ ¸Þ´º°¡ ¿¸®Áö ¾Ê½À´Ï´Ù."; + Text[ chinese_simplified ] = "PopUp menu not open"; + Text[ chinese_traditional ] = "PopUp menu not open"; + Text[ arabic ] = "PopUp menu not open"; + Text[ turkish ] = "PopUp menu not open"; +}; +String S_NO_SUBMENU +{ + Text = "Untermenü nicht vorhanden"; + Text[ english_us ] = "Submenu does not exist"; + Text[ portuguese ] = "Submenu inexistente"; + Text[ russian ] = "Submenu does not exist"; + Text[ greek ] = "Submenu does not exist"; + Text[ dutch ] = "Submenu niet voorhanden"; + Text[ french ] = "Sous-menu inexistant"; + Text[ spanish ] = "Submenú inexistente"; + Text[ italian ] = "Submenu does not exists"; + Text[ danish ] = "Submenu does not exist"; + Text[ swedish ] = "Submenu does not exist"; + Text[ polish ] = "Menu podrzêdne nie istnieje"; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "Submenu does not exist"; + Text[ korean ] = "¼ºê ¸Þ´º°¡ ¾ø½À´Ï´Ù."; + Text[ chinese_simplified ] = "Submenu does not exist"; + Text[ chinese_traditional ] = "Submenu does not exist"; + Text[ arabic ] = "Submenu does not exist"; + Text[ turkish ] = "Submenu does not exist"; +}; +String S_CONTROLTYPE_NOT_SUPPORTED +{ + Text = "ControlType ($Arg1) wird nicht unterstützt"; + Text[ english_us ] = "ControlType ($Arg1) is not supported"; + Text[ portuguese ] = "ControlType ($Arg1) não tem suporte"; + Text[ russian ] = "ControlType ($Arg1) is not supported"; + Text[ greek ] = "ControlType ($Arg1) is not supported"; + Text[ dutch ] = "ControlType ($Arg1) wordt niet ondersteund"; + Text[ french ] = "ControlType ($Arg1) non supporté"; + Text[ spanish ] = "No se apoya ControlType ($Arg1)"; + Text[ italian ] = "ControlType ($Arg1) is not supported"; + Text[ danish ] = "ControlType ($Arg1) is not supported"; + Text[ swedish ] = "ControlType ($Arg1) is not supported"; + Text[ polish ] = "ControlType ($Arg1) nie jest obs³ugiwany"; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "ControlType ($Arg1) is not supported"; + Text[ korean ] = "ControlType ($Arg1) ÀÌ Áö¿øµÇÁö ¾Ê½À´Ï´Ù."; + Text[ chinese_simplified ] = "ControlType ($Arg1) is not supported"; + Text[ chinese_traditional ] = "ControlType ($Arg1) is not supported"; + Text[ arabic ] = "ControlType ($Arg1) is not supported"; + Text[ turkish ] = "ControlType ($Arg1) is not supported"; +}; +String S_SELECTION_BY_ATTRIBUTE_ONLY_DIRECTORIES +{ + Text = "Selektion nach Attributen nur für Directories möglich."; + Text[ english_us ] = "Selection by attributes only possible for directories"; + Text[ portuguese ] = "A selecção por atributos é somente possível para directórios."; + Text[ russian ] = "Selection by attributes only possible for directories"; + Text[ greek ] = "Selection by attributes only possible for directories"; + Text[ dutch ] = "Selectie naar attributen alleen voor directory's mogelijk."; + Text[ french ] = "La sélection en fonction des attributs n'est possible que pour les répertoires."; + Text[ spanish ] = "La selección por atributos es solo posible para directorios."; + Text[ italian ] = "Selection by attributes only possible for directories"; + Text[ danish ] = "Selection by attributes only possible for directories"; + Text[ swedish ] = "Selection by attributes only possible for directories"; + Text[ polish ] = "Selekcja wed³ug atrybutów mo¿liwa jest tylko w wypadku katalogów."; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "Selection by attributes only possible for directories"; + Text[ korean ] = "¼Ó¼º¿¡ÀÇÇÑ ¼±ÅÃÀº µð·¢Å丮¿¡¼¸¸ °¡´ÉÇÕ´Ï´Ù."; + Text[ chinese_simplified ] = "Selection by attributes only possible for directories"; + Text[ chinese_traditional ] = "Selection by attributes only possible for directories"; + Text[ arabic ] = "Selection by attributes only possible for directories"; + Text[ turkish ] = "Selection by attributes only possible for directories"; +}; +String S_NO_MORE_FILES +{ + Text = "Keine weiteren Dateien"; + Text[ english_us ] = "No further files"; + Text[ portuguese ] = "Não existem outros ficheiros"; + Text[ russian ] = "No further files"; + Text[ greek ] = "No further files"; + Text[ dutch ] = "Geen verdere bestanden"; + Text[ french ] = "Aucun autre fichier"; + Text[ spanish ] = "Ningún otro archivo"; + Text[ italian ] = "No further files"; + Text[ danish ] = "No further files"; + Text[ swedish ] = "No further files"; + Text[ polish ] = "Brak innych plików"; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "No further files"; + Text[ korean ] = "´õ ÀÌ»ó ÆÄÀÏÀÌ ¾ø½À´Ï´Ù."; + Text[ chinese_simplified ] = "No further files"; + Text[ chinese_traditional ] = "No further files"; + Text[ arabic ] = "No further files"; + Text[ turkish ] = "No further files"; +}; +String S_UNKNOWN_METHOD +{ + Text = "Unbekannte Methode '($Arg1)' an ($Arg2)"; + Text[ english_us ] = "Unknown method '($Arg1)' to ($Arg2)"; + Text[ portuguese ] = "Método desconhecido ($Arg1) para ($Arg2)"; + Text[ russian ] = "Unknown method '($Arg1)' to ($Arg2)"; + Text[ greek ] = "Unknown method '($Arg1)' to ($Arg2)"; + Text[ dutch ] = "Onbekende methode '($Arg1)' aan ($Arg2)"; + Text[ french ] = "Méthode inconnue '($Arg1)' vers ($Arg2)"; + Text[ spanish ] = "Método desconocido '($Arg1)' a ($Arg2)"; + Text[ italian ] = "Unknown method '($Arg1)' to ($Arg2)"; + Text[ danish ] = "Unknown method '($Arg1)' to ($Arg2)"; + Text[ swedish ] = "Unknown method '($Arg1)' to ($Arg2)"; + Text[ polish ] = "Nieznana metoda '($Arg1)' do ($Arg2)"; + Text[ portuguese_brazilian ] = "Unbekannte Methode an Objekt : ($Arg1).($Arg2)"; + Text[ japanese ] = "Unknown method '($Arg1)' to ($Arg2)"; + Text[ korean ] = "($Arg2)¿¡ º¸³»´Â ¾Ë ¼ö ¾ø´Â ¸Þ¼µå '($Arg1)'"; + Text[ chinese_simplified ] = "($Arg2)Éϲ»Ã÷µÄ·½·¨'($Arg1)'"; + Text[ chinese_traditional ] = "Unknown method '($Arg1)' to ($Arg2)"; + Text[ arabic ] = "Unknown method '($Arg1)' to ($Arg2)"; + Text[ turkish ] = "Unknown method '($Arg1)' to ($Arg2)"; +}; +String S_INVALID_PARAMETERS +{ + Text = "Ungültige Parameter"; + Text[ english_us ] = "Invalid Parameters"; + Text[ portuguese ] = "Parâmetros não válidos"; + Text[ russian ] = "Invalid Parameters"; + Text[ greek ] = "Invalid Parameters"; + Text[ dutch ] = "Ongeldige parameters"; + Text[ french ] = "Paramètres incorrects"; + Text[ spanish ] = "Parámetros incorrectos"; + Text[ italian ] = "Invalid parameters"; + Text[ danish ] = "Invalid Parameters"; + Text[ swedish ] = "Invalid Parameters"; + Text[ polish ] = "Nieprawid³owe parametry"; + Text[ portuguese_brazilian ] = "Invalid Parameters"; + Text[ japanese ] = "Invalid Parameters"; + Text[ korean ] = "À¯È¿ÇÏÁö ¾ÊÀº ÆÄ¶ó¹ÌÅÍ"; + Text[ chinese_simplified ] = "Invalid Parameters"; + Text[ chinese_traditional ] = "Invalid Parameters"; + Text[ arabic ] = "Invalid Parameters"; + Text[ turkish ] = "Invalid Parameters"; +}; +String S_POINTER_OUTSIDE_APPWIN +{ + Text = "Pointer nicht innerhalb des Applikationsfensters bei '($Arg1)'"; + Text[ english_us ] = "Pointer not located in application window at '($Arg1)'"; + Text[ portuguese ] = "O ponteiro não está dentro da janela de aplicação em '($Arg1)'"; + Text[ russian ] = "Pointer not located in application window at '($Arg1)'"; + Text[ greek ] = "Pointer not located in application window at '($Arg1)'"; + Text[ dutch ] = "Pointer niet in applicatievenster bij '($Arg1)'"; + Text[ french ] = "Pointeur en dehors de la fenêtre de l'application pour '($Arg1)'"; + Text[ spanish ] = "Pointer fuera de la ventana de aplicación en '($Arg1)'"; + Text[ italian ] = "Pointer not located in application window at '($Arg1)'"; + Text[ danish ] = "Pointer not located in application window at '($Arg1)'"; + Text[ swedish ] = "Pointer not located in application window at '($Arg1)'"; + Text[ polish ] = "Pointer poza obszarem okna aplikacji przy '($Arg1)' "; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "Pointer not located in application window at '($Arg1)'"; + Text[ korean ] = "ÀÀ¿ë ÇÁ·Î±×·¥ â '($Arg1)'¿¡ Æ÷ÀÎÅͰ¡ ¾ø½À´Ï´Ù."; + Text[ chinese_simplified ] = "Pointer not located in application window at '($Arg1)'"; + Text[ chinese_traditional ] = "Pointer not located in application window at '($Arg1)'"; + Text[ arabic ] = "Pointer not located in application window at '($Arg1)'"; + Text[ turkish ] = "Pointer not located in application window at '($Arg1)'"; +}; +String S_UNKNOWN_COMMAND +{ + Text = "Unbekannter Befehl '($Arg1)'"; + Text[ english_us ] = "Unknown command '($Arg1)'"; + Text[ portuguese ] = "Comando desconhecido '($Arg1)'"; + Text[ russian ] = "Unknown command '($Arg1)'"; + Text[ greek ] = "Unknown command '($Arg1)'"; + Text[ dutch ] = "Onbekende opdracht '($Arg1)'"; + Text[ french ] = "Commande inconnue '($Arg1)'"; + Text[ spanish ] = "Error desconocido '($Arg1)'"; + Text[ italian ] = "Unknown command '($Arg1)'"; + Text[ danish ] = "Unknown command '($Arg1)'"; + Text[ swedish ] = "Unknown command '($Arg1)'"; + Text[ polish ] = "Nieznane polecenie ($Arg1)"; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "Unknown command '($Arg1)'"; + Text[ korean ] = "¾Ë¼ö¾ø´Â ¸í·É¾î '($Arg1)'"; + Text[ chinese_simplified ] = "Unknown command '($Arg1)'"; + Text[ chinese_traditional ] = "Unknown command '($Arg1)'"; + Text[ arabic ] = "Unknown command '($Arg1)'"; + Text[ turkish ] = "Unknown command '($Arg1)'"; +}; +String S_WIN_NOT_FOUND +{ + Text = "Konnte ($Arg1) nicht finden."; + Text[ english_us ] = "($Arg1) could not be found"; + Text[ portuguese ] = "Foi impossível encontrar ($Arg1)."; + Text[ russian ] = "($Arg1) could not be found"; + Text[ greek ] = "($Arg1) could not be found"; + Text[ dutch ] = "Kon ($Arg1) niet vinden"; + Text[ french ] = "($Arg1) introuvable"; + Text[ spanish ] = "No se pudo encontrar ($Arg1)"; + Text[ italian ] = "($Arg1) could not be found."; + Text[ danish ] = "($Arg1) could not be found"; + Text[ swedish ] = "($Arg1) could not be found"; + Text[ polish ] = "($Arg1) could not be found"; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "($Arg1) could not be found"; + Text[ korean ] = "($Arg1) ÀÌ ¹ß°ßµÇÁö ¾Ê½À´Ï´Ù."; + Text[ chinese_simplified ] = "($Arg1) could not be found."; + Text[ chinese_traditional ] = "($Arg1) could not be found"; + Text[ arabic ] = "($Arg1) could not be found"; + Text[ turkish ] = "($Arg1) could not be found"; +}; +String S_WIN_INVISIBLE +{ + Text = "($Arg1) ist unsichtbar."; + Text[ english_us ] = "($Arg1) is not visible"; + Text[ portuguese ] = "($Arg1) é invisível."; + Text[ russian ] = "($Arg1) is not visible"; + Text[ greek ] = "($Arg1) is not visible"; + Text[ dutch ] = "($Arg1) is onzichtbaar"; + Text[ french ] = "($Arg1) invisible"; + Text[ spanish ] = "No se puede ver ($Arg1)."; + Text[ italian ] = "$Arg1) is not visible"; + Text[ danish ] = "($Arg1) is not visible"; + Text[ swedish ] = "($Arg1) is not visible"; + Text[ polish ] = "($Arg1) is not visible "; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "($Arg1) is not visible"; + Text[ korean ] = "($Arg1)Àº º¸ÀÌÁö ¾Ê½À´Ï´Ù."; + Text[ chinese_simplified ] = "($Arg1) is not visible."; + Text[ chinese_traditional ] = "($Arg1) is not visible"; + Text[ arabic ] = "($Arg1) is not visible"; + Text[ turkish ] = "($Arg1) is not visible"; +}; +String S_WIN_DISABLED +{ + Text = "Konnte auf ($Arg1) nicht zugreifen."; + Text[ english_us ] = "(Arg1) could not be accessed"; + Text[ portuguese ] = "Impossível o acesso a ($Arg1)."; + Text[ russian ] = "(Arg1) could not be accessed"; + Text[ greek ] = "(Arg1) could not be accessed"; + Text[ dutch ] = "Geen toegang tot ($Arg1)"; + Text[ french ] = "Accès à ($Arg1) impossible"; + Text[ spanish ] = "No se pudo acceder a ($Arg1)"; + Text[ italian ] = "(Arg1) could not be accessed."; + Text[ danish ] = "(Arg1) could not be accessed"; + Text[ swedish ] = "(Arg1) could not be accessed"; + Text[ polish ] = "(Arg1) could not be accessed "; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "(Arg1) could not be accessed"; + Text[ korean ] = "(Arg1)¿¡ Á¢±ÙÇÒ¼ö ¾ø½À´Ï´Ù."; + Text[ chinese_simplified ] = "(Arg1) could not be accessed."; + Text[ chinese_traditional ] = "(Arg1) could not be accessed."; + Text[ arabic ] = "(Arg1) could not be accessed"; + Text[ turkish ] = "(Arg1) could not be accessed"; +}; +String S_NUMBER_TOO_BIG +{ + Text = "Eintragsnummer ($Arg2) zu groß in ($Arg1). Maximum ist ($Arg3)"; + Text[ english_us ] = "Entry number ($Arg2) is too large in ($Arg1). Max. allowed is ($Arg3)"; + Text[ portuguese ] = "O número da entrada ($Arg2) é muito elevado em ($Arg1). O máximo é ($Arg3)"; + Text[ russian ] = "Entry number ($Arg2) is too large in ($Arg1). Max. allowed is ($Arg3)"; + Text[ greek ] = "Entry number ($Arg2) is too large in ($Arg1). Max. allowed is ($Arg3)"; + Text[ dutch ] = "Nummer voor ($Arg2) te hoog in ($Arg1). Maximum is ($Arg3)"; + Text[ french ] = "Le numéro d'entrée ($Arg2) est trop élevé pour ($Arg1). Le maximum possible est ($Arg3)"; + Text[ spanish ] = "Núm. de entradas ($Arg2) es demasiado grande en ($Arg1). El máximo es ($Arg3)"; + Text[ italian ] = "Entry number ($Arg2) is too large in ($Arg1). Max. allowed is ($Arg3)"; + Text[ danish ] = "Entry number ($Arg2) is too large in ($Arg1). Max. allowed is ($Arg3)"; + Text[ swedish ] = "Entry number ($Arg2) is too large in ($Arg1). Max. allowed is ($Arg3)"; + Text[ polish ] = "Entry number ($Arg2) is too large in ($Arg1). Max. allowed is ($Arg3)"; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "Entry number ($Arg2) is too large in ($Arg1). Max. allowed is ($Arg3)"; + Text[ korean ] = "($Arg1)¿¡¼ Ç׸ñ ¹øÈ£($Arg2)´Â ³Ê¹« Å®´Ï´Ù. Çã¿ëµÈ ÃÖ´ë°ªÀº ($Arg3)ÀÔ´Ï´Ù."; + Text[ chinese_simplified ] = "Entry number ($Arg2) is too large in ($Arg1). Max. allowed is ($Arg3)."; + Text[ chinese_traditional ] = "Entry number ($Arg2) is too large in ($Arg1). Max. allowed is ($Arg3)"; + Text[ arabic ] = "Entry number ($Arg2) is too large in ($Arg1). Max. allowed is ($Arg3)"; + Text[ turkish ] = "Entry number ($Arg2) is too large in ($Arg1). Max. allowed is ($Arg3)"; +}; +String S_NUMBER_TOO_SMALL +{ + Text = "Eintragsnummer ($Arg2) zu klein in ($Arg1). Minimum ist ($Arg3)"; + Text[ english_us ] = "The entry number ($Arg2) is too small in ($Arg1). Min allowed is ($Arg3)"; + Text[ portuguese ] = "O número da entrada ($Arg2) é muito baixo em ($Arg1). O mínimo é ($Arg3)"; + Text[ russian ] = "The entry number ($Arg2) is too small in ($Arg1). Min allowed is ($Arg3)"; + Text[ greek ] = "The entry number ($Arg2) is too small in ($Arg1). Min allowed is ($Arg3)"; + Text[ dutch ] = "Nummer voor ($Arg2) te laag in ($Arg1). Minimum is ($Arg3)"; + Text[ french ] = "Le numéro d'entrée ($Arg2) est trop bas pour ($Arg1). Le minimum possible est ($Arg3)"; + Text[ spanish ] = "Núm. de entradas ($Arg2) es demasiado pequeño en ($Arg1). El mínimo es ($Arg3)"; + Text[ italian ] = "The entry number ($Arg2) is too small in ($Arg1). Min allowed is ($Arg3)"; + Text[ danish ] = "The entry number ($Arg2) is too small in ($Arg1). Min allowed is ($Arg3)"; + Text[ swedish ] = "The entry number ($Arg2) is too small in ($Arg1). Min allowed is ($Arg3)"; + Text[ polish ] = "The entry number ($Arg2) is too small in ($Arg1). Min allowed is ($Arg3)"; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "The entry number ($Arg2) is too small in ($Arg1). Min allowed is ($Arg3)"; + Text[ korean ] = "($Arg1)¿¡¼ Ç׸ñ ¹øÈ£($Arg2)´Â ³Ê¹« ÀÛ½À´Ï´Ù. Çã¿ëµÈ ÃÖ¼Ò°ªÀº ($Arg3)ÀÔ´Ï´Ù."; + Text[ chinese_simplified ] = "The entry number ($Arg2) is too small in ($Arg1). Min. allowed is ($Arg3)."; + Text[ chinese_traditional ] = "The entry number ($Arg2) is too small in ($Arg1). Min allowed is ($Arg3)"; + Text[ arabic ] = "The entry number ($Arg2) is too small in ($Arg1). Min allowed is ($Arg3)"; + Text[ turkish ] = "The entry number ($Arg2) is too small in ($Arg1). Min allowed is ($Arg3)"; +}; +String S_WINDOW_DISAPPEARED +{ + Text = "Window zwischenzeitlich verschwunden bei ($Arg1)"; + Text[ english_us ] = "Window momentarily not visible at ($Arg1)"; + Text[ portuguese ] = "Desaparecimento momentâneo da janela em ($Arg1)"; + Text[ russian ] = "Window momentarily not visible at ($Arg1)"; + Text[ greek ] = "Window momentarily not visible at ($Arg1)"; + Text[ dutch ] = "Windows momenteel niet zichtbaar bij ($Arg1)"; + Text[ french ] = "Disparition momentanée de la fenêtre ($Arg1)"; + Text[ spanish ] = "Desaparación momentánea de Windows en ($Arg1)"; + Text[ italian ] = "Window momentarily not visible at ($Arg1)"; + Text[ danish ] = "Window momentarily not visible at ($Arg1)"; + Text[ swedish ] = "Window momentarily not visible at ($Arg1)"; + Text[ polish ] = "Window momentarily not visible at ($Arg1)"; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "Window momentarily not visible at ($Arg1)"; + Text[ korean ] = "Window°¡ ±× »çÀÌ ($Arg1)¿¡¼ »ç¶óÁü"; + Text[ chinese_simplified ] = "Window momentarily not visible at ($Arg1)"; + Text[ chinese_traditional ] = "Window momentarily not visible at ($Arg1)"; + Text[ arabic ] = "Window momentarily not visible at ($Arg1)"; + Text[ turkish ] = "Window momentarily not visible at ($Arg1)"; +}; +String S_ERROR_SAVING_IMAGE +{ + Text = "Fehler #($Arg1) beim Speichern des Bildes"; + Text[ english_us ] = "Error #($Arg1) when saving the image"; + Text[ portuguese ] = "Erro #($Arg1) ao guardar a imagem"; + Text[ russian ] = "Error #($Arg1) when saving the image"; + Text[ greek ] = "Error #($Arg1) when saving the image"; + Text[ dutch ] = "Fout #($Arg1) bij opslaan van afbeelding"; + Text[ french ] = "Erreur #($Arg1) lors de l'enregistrement de l'image"; + Text[ spanish ] = "Error #($Arg1) al guardar la imagen"; + Text[ italian ] = "Error #($Arg1) when saving the image"; + Text[ danish ] = "Error #($Arg1) when saving the image"; + Text[ swedish ] = "Error #($Arg1) when saving the image"; + Text[ polish ] = "Error #($Arg1) when saving the image"; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "Error #($Arg1) when saving the image"; + Text[ korean ] = "À̹ÌÁö ÀúÀå ½Ã ¿À·ù #($Arg1)"; + Text[ chinese_simplified ] = "Error #($Arg1) when saving the image"; + Text[ chinese_traditional ] = "Error #($Arg1) when saving the image"; + Text[ arabic ] = "Error #($Arg1) when saving the image"; + Text[ turkish ] = "Error #($Arg1) when saving the image"; +}; +String S_INVALID_POSITION +{ + Text = "Ungültige Positionsangabe bei ($Arg1)"; + Text[ english_us ] = "Invalid positon at ($Arg1)"; + Text[ portuguese ] = "Posição indicada incorrectamente em ($Arg1)"; + Text[ russian ] = "Invalid positon at ($Arg1)"; + Text[ greek ] = "Invalid positon at ($Arg1)"; + Text[ dutch ] = "Omgeldige positie aangegeven bij ($Arg1)"; + Text[ french ] = "Erreur d'indication de l'emplacement de ($Arg1)"; + Text[ spanish ] = "Posición indicada incorrecta en ($Arg1)"; + Text[ italian ] = "Invalid positon at ($Arg1)"; + Text[ danish ] = "Invalid positon at ($Arg1)"; + Text[ swedish ] = "Invalid positon at ($Arg1)"; + Text[ polish ] = "Invalid positon at ($Arg1)"; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "Invalid positon at ($Arg1)"; + Text[ korean ] = "($Arg1)¿¡ À¯È¿ÇÏÁö ¾ÊÀº À§Ä¡"; + Text[ chinese_simplified ] = "Invalid positon at ($Arg1)"; + Text[ chinese_traditional ] = "Invalid positon at ($Arg1)"; + Text[ arabic ] = "Invalid positon at ($Arg1)"; + Text[ turkish ] = "Invalid positon at ($Arg1)"; +}; +String S_SPLITWIN_NOT_FOUND +{ + Text = "Konnte SplitWindow nicht finden bei ($Arg1)"; + Text[ english_us ] = "Split window not found at ($Arg1)"; + Text[ portuguese ] = "Foi impossível encontrar SplitWindow em ($Arg1)"; + Text[ russian ] = "Split window not found at ($Arg1)"; + Text[ greek ] = "Split window not found at ($Arg1)"; + Text[ dutch ] = "Kon SplitWindow niet vinden bij ($Arg1)"; + Text[ french ] = "SplitWindow introuvable pour ($Arg1)"; + Text[ spanish ] = "No se pudo encontrar SplitWindow en ($Arg1)"; + Text[ italian ] = "Split window not found at ($Arg1)"; + Text[ danish ] = "Split window not found at ($Arg1)"; + Text[ swedish ] = "Split window not found at ($Arg1)"; + Text[ polish ] = "Split window not found at ($Arg1)"; + Text[ portuguese_brazilian ] = "Programmstart: ($Arg1); ($Arg2)"; + Text[ japanese ] = "Split window not found at ($Arg1)"; + Text[ korean ] = "SplitWindow¸¦ ($Arg1)¿¡¼ ãÁö ¸øÇßÀ½"; + Text[ chinese_simplified ] = "Split window not found at ($Arg1)"; + Text[ chinese_traditional ] = "Split window not found at ($Arg1)"; + Text[ arabic ] = "Split window not found at ($Arg1)"; + Text[ turkish ] = "Split window not found at ($Arg1)"; +}; +String S_INTERNAL_ERROR +{ + Text = "Interner Fehler bei ($Arg1)"; + Text[ english_us ] = "Internal error at ($Arg1)"; + Text[ portuguese ] = "Erro interno em ($Arg1)"; + Text[ russian ] = "Internal error at ($Arg1)"; + Text[ greek ] = "Internal error at ($Arg1)"; + Text[ dutch ] = "Interne fout bij ($Arg1)"; + Text[ french ] = "Erreur interne pour ($Arg1)"; + Text[ spanish ] = "Error interno en ($Arg1)"; + Text[ italian ] = "Internal error at ($Arg1)"; + Text[ danish ] = "Internal error at ($Arg1)"; + Text[ swedish ] = "Internal error at ($Arg1)"; + Text[ polish ] = "Internal error at ($Arg1)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "Internal error at ($Arg1)"; + Text[ korean ] = "($Arg1)¿¡ ³»ºÎ ¿À·ù"; + Text[ chinese_simplified ] = "Internal error at ($Arg1)"; + Text[ chinese_traditional ] = "Internal error at ($Arg1)"; + Text[ arabic ] = "Internal error at ($Arg1)"; + Text[ turkish ] = "Internal error at ($Arg1)"; +}; +String S_NO_STATUSBAR +{ + Text = "Keine StatusBar vorhanden bei ($Arg1)"; + Text[ english_us ] = "No status bar at ($Arg1)"; + Text[ portuguese ] = "Barra de estado em ($Arg1) inexistente"; + Text[ russian ] = "No status bar at ($Arg1)"; + Text[ greek ] = "No status bar at ($Arg1)"; + Text[ dutch ] = "Geen StatusBar voorhanden bij ($Arg1)"; + Text[ french ] = "Absence de barre d'état pour ($Arg1) "; + Text[ spanish ] = "No existe StatusBar en ($Arg1)"; + Text[ italian ] = "No status bar at ($Arg1)"; + Text[ danish ] = "No status bar at ($Arg1)"; + Text[ swedish ] = "No status bar at ($Arg1)"; + Text[ polish ] = "No status bar at ($Arg1)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "No status bar at ($Arg1)"; + Text[ korean ] = "($Arg1)¿¡ »óÅ ¹Ù°¡ ¾ø½À´Ï´Ù."; + Text[ chinese_simplified ] = "No status bar at ($Arg1)"; + Text[ chinese_traditional ] = "No status bar at ($Arg1)"; + Text[ arabic ] = "No status bar at ($Arg1)"; + Text[ turkish ] = "No status bar at ($Arg1)"; +}; +String S_ITEMS_INVISIBLE +{ + Text = "Die Items sind ausgeblendet bei ($Arg1)"; + Text[ english_us ] = "The items are hidden at ($Arg1)"; + Text[ portuguese ] = "Os items em ($Arg1) estão ocultos"; + Text[ russian ] = "The items are hidden at ($Arg1)"; + Text[ greek ] = "The items are hidden at ($Arg1)"; + Text[ dutch ] = "De items zijn verborgen bij ($Arg1)"; + Text[ french ] = "Les Items sont masqués pour ($Arg1)"; + Text[ spanish ] = "Los ítems en ($Arg1) están ocultos"; + Text[ italian ] = "The items are hidden at ($Arg1)"; + Text[ danish ] = "The items are hidden at ($Arg1)"; + Text[ swedish ] = "The items are hidden at ($Arg1)"; + Text[ polish ] = "The items are hidden at ($Arg1)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "The items are hidden at ($Arg1)"; + Text[ korean ] = "($Arg1)¿¡ Ç׸ñÀÌ ¼û°ÜÁ® ÀÖ½À´Ï´Ù."; + Text[ chinese_simplified ] = "The items are hidden at ($Arg1)"; + Text[ chinese_traditional ] = "The items are hidden at ($Arg1)"; + Text[ arabic ] = "The items are hidden at ($Arg1)"; + Text[ turkish ] = "The items are hidden at ($Arg1)"; +}; +String S_TABPAGE_NOT_FOUND +{ + Text = "Tabpage nicht gefunden bei ($Arg1)"; + Text[ english_us ] = "Tab page not found at ($Arg1)"; + Text[ portuguese ] = "Foi impossível encontrar o separador em ($Arg1)"; + Text[ russian ] = "Tab page not found at ($Arg1)"; + Text[ greek ] = "Tab page not found at ($Arg1)"; + Text[ dutch ] = "Tabpage niet gevonden bij ($Arg1"; + Text[ french ] = "Tabpage introuvable pour ($Arg1)"; + Text[ spanish ] = "No se encontró tabpage en ($Arg1)"; + Text[ italian ] = "Tab page not found at ($Arg1)"; + Text[ danish ] = "Tab page not found at ($Arg1)"; + Text[ swedish ] = "Tab page not found at ($Arg1)"; + Text[ polish ] = "Tab page not found at ($Arg1)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "Tab page not found at ($Arg1)"; + Text[ korean ] = "($Arg1)¿¡¼ ÅÇ ÆäÀÌÁö°¡ ¹ß°ßµÇÁö ¾Ê½À´Ï´Ù."; + Text[ chinese_simplified ] = "Tab page not found at ($Arg1)"; + Text[ chinese_traditional ] = "Tab page not found at ($Arg1)"; + Text[ arabic ] = "Tab page not found at ($Arg1)"; + Text[ turkish ] = "Tab page not found at ($Arg1)"; +}; +String S_TRISTATE_NOT_ALLOWED +{ + Text = "Tristate darf nicht gesetzt werden bei ($Arg1)"; + Text[ english_us ] = "Three state cannot be set at ($Arg1)"; + Text[ portuguese ] = "Impossível indicar um valor \"tristate\" em ($Arg1)"; + Text[ russian ] = "Three state cannot be set at ($Arg1)"; + Text[ greek ] = "Three state cannot be set at ($Arg1)"; + Text[ dutch ] = "Tristate mag niet worden gezet bij ($Arg1)"; + Text[ french ] = "Impossible de placer une valeur Tristate pour ($Arg1)"; + Text[ spanish ] = "No se pude aplicar tristate en ($Arg1)"; + Text[ italian ] = "Three state cannot be set at ($Arg1)"; + Text[ danish ] = "Three state cannot be set at ($Arg1)"; + Text[ swedish ] = "Three state cannot be set at ($Arg1)"; + Text[ polish ] = "Three state cannot be set at ($Arg1)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "Three state cannot be set at ($Arg1)"; + Text[ korean ] = "¼¼°¡Áö »óŰ¡ ($Arg1)¿¡ ¼³Á¤µÉ ¼ö ¾ø½À´Ï´Ù."; + Text[ chinese_simplified ] = "Three state cannot be set at ($Arg1)"; + Text[ chinese_traditional ] = "Three state cannot be set at ($Arg1)"; + Text[ arabic ] = "Three state cannot be set at ($Arg1)"; + Text[ turkish ] = "Three state cannot be set at ($Arg1)"; + Text[ language_user1 ] = " "; +}; +String S_ERROR_IN_SET_TEXT +{ + Text = "SetText hat nicht funktioniert"; + Text[ english_us ] = "Set text did not function"; + Text[ portuguese ] = "SetText não funcionou"; + Text[ russian ] = "Set text did not function"; + Text[ greek ] = "Set text did not function"; + Text[ dutch ] = "SetText heeft niet gefunctioneerd"; + Text[ french ] = "SetText n'a pas fonctionné"; + Text[ spanish ] = "No ha funcionado SetText"; + Text[ italian ] = "Set text did not function"; + Text[ danish ] = "Set text did not function"; + Text[ swedish ] = "Set text did not function"; + Text[ polish ] = "Set text did not function"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "Set text did not function"; + Text[ korean ] = "ÅØ½ºÆ® ¼³Á¤ÀÌ ÀÛµ¿ÇÏÁö ¾Ê½À´Ï´Ù."; + Text[ chinese_simplified ] = "Set text did not function"; + Text[ chinese_traditional ] = "Set text did not function"; + Text[ arabic ] = "Set text did not function"; + Text[ turkish ] = "Set text did not function"; +}; +String S_ATTEMPT_TO_WRITE_READONLY +{ + Text = "Schreibversuch auf ReadOnly ($Arg1)"; + Text[ english_us ] = "Attempt to write on read-only ($Arg1)"; + Text[ portuguese ] = "Tentativa de escrita em ($Arg1) como só leitura"; + Text[ russian ] = "Attempt to write on read-only ($Arg1)"; + Text[ greek ] = "Attempt to write on read-only ($Arg1)"; + Text[ dutch ] = "Schrijfpoging op ReadOnly ($Arg1)"; + Text[ french ] = "Tentative d'éciture sur ($Arg1) (en lecture seule)"; + Text[ spanish ] = "Intento de escritura en ReadOnly ($Arg1)"; + Text[ italian ] = "Attempt to write on read-only ($Arg1)"; + Text[ danish ] = "Attempt to write on read-only ($Arg1)"; + Text[ swedish ] = "Attempt to write on read-only ($Arg1)"; + Text[ polish ] = "Attempt to write on read-only ($Arg1)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "Attempt to write on read-only ($Arg1)"; + Text[ korean ] = "Àбâ Àü¿ë($Arg1)¿¡ ¾²±â¸¦ ½Ãµµ"; + Text[ chinese_simplified ] = "Attempt to write on read-only ($Arg1)"; + Text[ chinese_traditional ] = "Attempt to write on read-only ($Arg1)"; + Text[ arabic ] = "Attempt to write on read-only ($Arg1)"; + Text[ turkish ] = "Attempt to write on read-only ($Arg1)"; +}; +String S_NO_SELECT_FALSE +{ + Text = "Select FALSE nicht erlaubt. Bitte MultiSelect verwenden bei ($Arg1)"; + Text[ english_us ] = "Select FALSE not allowed. Use MultiSelect at ($Arg1)"; + Text[ portuguese ] = "Interdito seleccionar FALSE. Utilizar MultiSelect em ($Arg1)"; + Text[ russian ] = "Select FALSE not allowed. Use MultiSelect at ($Arg1)"; + Text[ greek ] = "Select FALSE not allowed. Use MultiSelect at ($Arg1)"; + Text[ dutch ] = "Select FALSE niet toegestaan. Gebruik MultiSelect bij ($Arg1)"; + Text[ french ] = "Interdit de sélectionner FALSE. Veuillez utiliser MultiSelect pour ($Arg1)"; + Text[ spanish ] = "No se permite Select FALSE. Use MultiSelect en ($Arg1)"; + Text[ italian ] = "Select FALSE not allowed. Use MultiSelect at ($Arg1)"; + Text[ danish ] = "Select FALSE not allowed. Use MultiSelect at ($Arg1)"; + Text[ swedish ] = "Select FALSE not allowed. Use MultiSelect at ($Arg1)"; + Text[ polish ] = "Select FALSE not allowed. Use MultiSelect at ($Arg1)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "Select FALSE not allowed. Use MultiSelect at ($Arg1)"; + Text[ korean ] = "FALSE ¼±ÅÃÀÌ Çã¿ëµÇÁö ¾Ê½À´Ï´Ù. ($Arg1)¿¡ ´ÙÁß ¼±Åà »ç¿ë."; + Text[ chinese_simplified ] = "Select FALSE not allowed. Use MultiSelect at ($Arg1)"; + Text[ chinese_traditional ] = "Select FALSE not allowed. Use MultiSelect at ($Arg1)"; + Text[ arabic ] = "Select FALSE not allowed. Use MultiSelect at ($Arg1)"; + Text[ turkish ] = "Select FALSE not allowed. Use MultiSelect at ($Arg1)"; +}; +String S_ENTRY_NOT_FOUND +{ + Text = "Eintrag \"($Arg2)\" bei ($Arg1) nicht gefunden"; + Text[ english_us ] = "\"($Arg2)\" entry at ($Arg1) not found"; + Text[ portuguese ] = "Foi impossível encontrar a entrada \"($Arg2) em ($Arg1)"; + Text[ russian ] = "\"($Arg2)\" entry at ($Arg1) not found"; + Text[ greek ] = "\"($Arg2)\" entry at ($Arg1) not found"; + Text[ dutch ] = "Optie ($Arg2) niet gevonden bij ($Arg1)"; + Text[ french ] = "Entrée \"($Arg2)\" introuvable pour ($Arg1)"; + Text[ spanish ] = "No se encontrá entrada \"($Arg2)\" en ($Arg1)"; + Text[ italian ] = "\"($Arg2)\" entry at ($Arg1) not found"; + Text[ danish ] = "\"($Arg2)\" entry at ($Arg1) not found"; + Text[ swedish ] = "\"($Arg2)\" entry at ($Arg1) not found"; + Text[ polish ] = "\"($Arg2)\" entry at ($Arg1) not found"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "\"($Arg2)\" entry at ($Arg1) not found"; + Text[ korean ] = "\"($Arg2)\" °¡ Ç׸ñ ($Arg1)¿¡¼ ¹ß°ßµÇÁö ¾Ê½À´Ï´Ù."; + Text[ chinese_simplified ] = "\"($Arg2)\" entry at ($Arg1) not found"; + Text[ chinese_traditional ] = "\"($Arg2)\" entry at ($Arg1) not found"; + Text[ arabic ] = "\"($Arg2)\" entry at ($Arg1) not found"; + Text[ turkish ] = "\"($Arg2)\" entry at ($Arg1) not found"; +}; +String S_METHOD_FAILED +{ + Text = "($Arg1) von Eintrag \"($Arg2)\" ist fehlgeschlagen"; + Text[ english_us ] = "($Arg1) of entry \"($Arg2)\" failed"; + Text[ portuguese ] = "($Arg1) da entrada \"($Arg2)\" falhou"; + Text[ russian ] = "($Arg1) of entry \"($Arg2)\" failed"; + Text[ greek ] = "($Arg1) of entry \"($Arg2)\" failed"; + Text[ dutch ] = "($Arg1) van optie ($Arg2) mislukt"; + Text[ french ] = "($Arg1) a échoué pour l'entrée \"($Arg2)\" "; + Text[ spanish ] = "No resultó ($Arg1) de la entrada \"($Arg2)\""; + Text[ italian ] = "($Arg1) of entry \"($Arg2)\" failed"; + Text[ danish ] = "($Arg1) of entry \"($Arg2)\" failed"; + Text[ swedish ] = "($Arg1) of entry \"($Arg2)\" failed"; + Text[ polish ] = "($Arg1) of entry \"($Arg2)\" failed"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "($Arg1) of entry \"($Arg2)\" failed"; + Text[ korean ] = "Ç׸ñ\"($Arg2)\"ÀÇ ($Arg1)°¡ À߸øµÆ½À´Ï´Ù."; + Text[ chinese_simplified ] = "($Arg1) of entry \"($Arg2)\" failed"; + Text[ chinese_traditional ] = "($Arg1) of entry \"($Arg2)\" failed"; + Text[ arabic ] = "($Arg1) of entry \"($Arg2)\" failed"; + Text[ turkish ] = "($Arg1) of entry \"($Arg2)\" failed"; +}; +String S_HELPID_ON_TOOLBOX_NOT_FOUND +{ + Text = "HelpID auf ToolBox nicht gefunden bei ($Arg1)"; + Text[ english_us ] = "HelpID in ToolBox not found at ($Arg1)"; + Text[ portuguese ] = "Impossível encontrar o HelpID da ToolBox em ($Arg1)"; + Text[ russian ] = "HelpID in ToolBox not found at ($Arg1)"; + Text[ greek ] = "HelpID in ToolBox not found at ($Arg1)"; + Text[ dutch ] = "HelpID op ToolBox niet gevonden bij ($Arg1)"; + Text[ french ] = "HelpID de la ToolBox introuvable pour ($Arg1)"; + Text[ spanish ] = "No se encontró en ($Arg1) HelpID en ToolBox"; + Text[ italian ] = "HelpID in ToolBox not found at ($Arg1)"; + Text[ danish ] = "HelpID in ToolBox not found at ($Arg1)"; + Text[ swedish ] = "HelpID in ToolBox not found at ($Arg1)"; + Text[ polish ] = "HelpID in ToolBox not found at ($Arg1)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "HelpID in ToolBox not found at ($Arg1)"; + Text[ korean ] = "µµ±¸»óÀÚÀÇ µµ¿ò¸» ID °¡ ($Arg1)¿¡¼ ¹ß°ßµÇÁö ¾Ê½À´Ï´Ù."; + Text[ chinese_simplified ] = "HelpID in ToolBox not found at ($Arg1)"; + Text[ chinese_traditional ] = "HelpID in ToolBox not found at ($Arg1)"; + Text[ arabic ] = "HelpID in ToolBox not found at ($Arg1)"; + Text[ turkish ] = "HelpID in ToolBox not found at ($Arg1)"; +}; +String S_BUTTON_DISABLED_ON_TOOLBOX +{ + Text = "Der Button ist disabled in ToolBox bei ($Arg1)"; + Text[ english_us ] = "The button is disabled in ToolBox at ($Arg1)"; + Text[ portuguese ] = "O botão da ToolBox em ($Arg1) está desactivado"; + Text[ russian ] = "The button is disabled in ToolBox at ($Arg1)"; + Text[ greek ] = "The button is disabled in ToolBox at ($Arg1)"; + Text[ dutch ] = "Button buiten werking in ToolBox bij ($Arg1)"; + Text[ french ] = "Le bouton est désactivé dans la ToolBox pour ($Arg1)"; + Text[ spanish ] = "El botón está desactivado en ToolBox en ($Arg1)"; + Text[ italian ] = "The button is disabled in ToolBox at ($Arg1)"; + Text[ danish ] = "The button is disabled in ToolBox at ($Arg1)"; + Text[ swedish ] = "The button is disabled in ToolBox at ($Arg1)"; + Text[ polish ] = "The button is disabled in ToolBox at ($Arg1)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "The button is disabled in ToolBox at ($Arg1)"; + Text[ korean ] = "($Arg1)¿¡ µµ±¸»óÀÚÀÇ ¹öưÀÌ »ç¿ëÀÌ ¾ÈµË´Ï´Ù."; + Text[ chinese_simplified ] = "The button is disabled in ToolBox at ($Arg1)"; + Text[ chinese_traditional ] = "The button is disabled in ToolBox at ($Arg1)"; + Text[ arabic ] = "The button is disabled in ToolBox at ($Arg1)"; + Text[ turkish ] = "The button is disabled in ToolBox at ($Arg1)"; +}; +String S_BUTTON_HIDDEN_ON_TOOLBOX +{ + Text = "Der Button ist hidden in ToolBox bei ($Arg1)"; + Text[ english_us ] = "The button is hidden in ToolBox at ($Arg1)"; + Text[ portuguese ] = "O botão da ToolBox em ($Arg1) está oculto"; + Text[ russian ] = "The button is hidden in ToolBox at ($Arg1)"; + Text[ greek ] = "The button is hidden in ToolBox at ($Arg1)"; + Text[ dutch ] = "Button verborgen in Toolbox bij ($Arg1)"; + Text[ french ] = "Le bouton est caché dans la ToolBox pour ($Arg1)"; + Text[ spanish ] = "El botón es hidden en ToolBox en ($Arg1)"; + Text[ italian ] = "The button is hidden in ToolBox at ($Arg1)"; + Text[ danish ] = "The button is hidden in ToolBox at ($Arg1)"; + Text[ swedish ] = "The button is hidden in ToolBox at ($Arg1)"; + Text[ polish ] = "The button is hidden in ToolBox at ($Arg1)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "The button is hidden in ToolBox at ($Arg1)"; + Text[ korean ] = "($Arg1)¿¡ µµ±¸»óÀÚÀÇ ¹öưÀÌ ¼û°ÜÁ® ÀÖ½À´Ï´Ù."; + Text[ chinese_simplified ] = "The button is hidden in ToolBox at ($Arg1)"; + Text[ chinese_traditional ] = "The button is hidden in ToolBox at ($Arg1)"; + Text[ arabic ] = "The button is hidden in ToolBox at ($Arg1)"; + Text[ turkish ] = "The button is hidden in ToolBox at ($Arg1)"; +}; +String S_CANNOT_MAKE_BUTTON_VISIBLE_IN_TOOLBOX +{ + Text = "Button konnte nicht sichtbar gemacht werden in ToolBox bei ($Arg1)"; + Text[ english_us ] = "Button cannot be made visible in ToolBox at ($Arg1)"; + Text[ portuguese ] = "Foi impossível tornar o botão da ToolBox em ($Arg1) visível"; + Text[ russian ] = "Button cannot be made visible in ToolBox at ($Arg1)"; + Text[ greek ] = "Button cannot be made visible in ToolBox at ($Arg1)"; + Text[ dutch ] = "Button kon niet zichtbaar worden gemaakt in Toolbox bij ($Arg1)"; + Text[ french ] = "Ímpossible d'afficher le bouton dans la ToolBox pour ($Arg1)"; + Text[ spanish ] = "No se pudo mostrar el boton en ToolBox para ($Arg1)"; + Text[ italian ] = "Button cannot be made visible in ToolBox at ($Arg1)"; + Text[ danish ] = "Button cannot be made visible in ToolBox at ($Arg1)"; + Text[ swedish ] = "Button cannot be made visible in ToolBox at ($Arg1)"; + Text[ polish ] = "Button cannot be made visible in ToolBox at ($Arg1)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "Button cannot be made visible in ToolBox at ($Arg1)"; + Text[ korean ] = "($Arg1)¿¡ µµ±¸»óÀÚÀÇ ¹öưÀ» º¸ÀÌ°Ô ÇÒ¼ö ¾ø½À´Ï´Ù."; + Text[ chinese_simplified ] = "Button cannot be made visible in ToolBox at ($Arg1)"; + Text[ chinese_traditional ] = "Button cannot be made visible in ToolBox at ($Arg1)"; + Text[ arabic ] = "Button cannot be made visible in ToolBox at ($Arg1)"; + Text[ turkish ] = "Button cannot be made visible in ToolBox at ($Arg1)"; +}; +String S_TEAROFF_FAILED +{ + Text = "TearOff Fehlgeschlagen in ToolBox bei ($Arg1)"; + Text[ english_us ] = "TearOff failed in ToolBox at ($Arg1)"; + Text[ portuguese ] = "TearOff falhou na ToolBox em ($Arg1)"; + Text[ russian ] = "TearOff failed in ToolBox at ($Arg1)"; + Text[ greek ] = "TearOff failed in ToolBox at ($Arg1)"; + Text[ dutch ] = "TearOff mislukt in ToolBox bij ($Arg1)"; + Text[ french ] = "TearOff a échoué dans la ToolBox pour ($Arg1)"; + Text[ spanish ] = "Ha fallado TearOff en ToolBox para ($Arg1)"; + Text[ italian ] = "TearOff failed in ToolBox at ($Arg1)"; + Text[ danish ] = "TearOff failed in ToolBox at ($Arg1)"; + Text[ swedish ] = "TearOff failed in ToolBox at ($Arg1)"; + Text[ polish ] = "TearOff failed in ToolBox at ($Arg1)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "TearOff failed in ToolBox at ($Arg1)"; + Text[ korean ] = "($Arg1)¿¡ µµ±¸»óÀÚ¿¡¼ ÀýÃë°¡ ½ÇÆÐÇÏ¿´½À´Ï´Ù."; + Text[ chinese_simplified ] = "TearOff failed in ToolBox at ($Arg1)"; + Text[ chinese_traditional ] = "TearOff failed in ToolBox at ($Arg1)"; + Text[ arabic ] = "TearOff failed in ToolBox at ($Arg1)"; + Text[ turkish ] = "TearOff failed in ToolBox at ($Arg1)"; +}; +String S_NO_SELECTED_ENTRY +{ + Text = "Es ist kein Eintrag Selektiert in TreeListBox bei ($Arg1)"; + Text[ english_us ] = "An entry has not been selected in TreeListBox at ($Arg1)"; + Text[ portuguese ] = "Nenhuma entrada seleccionada na TreeListBox para ($Arg1)"; + Text[ russian ] = "An entry has not been selected in TreeListBox at ($Arg1)"; + Text[ greek ] = "An entry has not been selected in TreeListBox at ($Arg1)"; + Text[ dutch ] = "Geen item geselecteerd in TreeListBox bij ($Arg1)"; + Text[ french ] = "Aucune entrée sélectionnée dans la TreeListBox pour ($Arg1)"; + Text[ spanish ] = "No hay ninguna entrada seleccionada en TreeListBox para ($Arg1)"; + Text[ italian ] = "An entry has not been selected in TreeListBox at ($Arg1)"; + Text[ danish ] = "An entry has not been selected in TreeListBox at ($Arg1)"; + Text[ swedish ] = "An entry has not been selected in TreeListBox at ($Arg1)"; + Text[ polish ] = "An entry has not been selected in TreeListBox at ($Arg1)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "An entry has not been selected in TreeListBox at ($Arg1)"; + Text[ korean ] = "($Arg1)¿¡ Æ®¸® ¸®½ºÆ® ¹Ú½º¿¡¼ ¼±ÅÃµÈ Ç׸ñÀÌ ¾ø½À´Ï´Ù."; + Text[ chinese_simplified ] = "An entry has not been selected in TreeListBox at ($Arg1)"; + Text[ chinese_traditional ] = "An entry has not been selected in TreeListBox at ($Arg1)"; + Text[ arabic ] = "An entry has not been selected in TreeListBox at ($Arg1)"; + Text[ turkish ] = "An entry has not been selected in TreeListBox at ($Arg1)"; +}; +String S_SELECT_DESELECT_VIA_STRING_NOT_IMPLEMENTED +{ + Text = "Select/Deselect mit String nicht implementiert bei ($Arg1)"; + Text[ english_us ] = "Select/Deselect with string not implemented at ($Arg1)"; + Text[ portuguese ] = "Seleccionar/Desseleccionar com String não implementado em ($Arg1)"; + Text[ russian ] = "Select/Deselect with string not implemented at ($Arg1)"; + Text[ greek ] = "Select/Deselect with string not implemented at ($Arg1)"; + Text[ dutch ] = "Select/Deselect met String niet geïmplementeerd bij ($Arg1)"; + Text[ french ] = "Sélection/déselection d'un string pas implémentée pour ($Arg1)"; + Text[ spanish ] = "Seleccionar/Deshacer selección con String no implementado para ($Arg1)"; + Text[ italian ] = "Select/Deselect with string not implemented at ($Arg1)"; + Text[ danish ] = "Select/Deselect with string not implemented at ($Arg1)"; + Text[ swedish ] = "Select/Deselect with string not implemented at ($Arg1)"; + Text[ polish ] = "Select/Deselect with string not implemented at ($Arg1)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "Select/Deselect with string not implemented at ($Arg1)"; + Text[ korean ] = "($Arg1)¿¡¼ ¹®ÀÚ¿°ú ÇÔ²² ¼±ÅÃ/¼±ÅÃÇØÁ¦°¡ ±¸ÇöµÇÁö ¾Ê¾Ò½À´Ï´Ù."; + Text[ chinese_simplified ] = "Select/Deselect with string not implemented at ($Arg1)"; + Text[ chinese_traditional ] = "Select/Deselect with string not implemented at ($Arg1)"; + Text[ arabic ] = "Select/Deselect with string not implemented at ($Arg1)"; + Text[ turkish ] = "Select/Deselect with string not implemented at ($Arg1)"; +}; +String S_ALLOWED_ONLY_IN_FLOATING_MODE +{ + Text = "Methode nur im Froating-Mode erlaubt bei ($Arg1)"; + Text[ english_us ] = "Method only allowed in floating mode at ($Arg1)"; + Text[ portuguese ] = "Método autorizado apenas em modo Froating em ($Arg1)"; + Text[ russian ] = "Method only allowed in floating mode at ($Arg1)"; + Text[ greek ] = "Method only allowed in floating mode at ($Arg1)"; + Text[ dutch ] = "Methode alleen toegestaan in Froating Mode bij ($Arg1)"; + Text[ french ] = "Méthode autorisée uniquement en mode Froating pour ($Arg1)"; + Text[ spanish ] = "Método permitido solo en modo Froating para ($Arg1)"; + Text[ italian ] = "Method only allowed in floating mode at ($Arg1)"; + Text[ danish ] = "Method only allowed in floating mode at ($Arg1)"; + Text[ swedish ] = "Method only allowed in floating mode at ($Arg1)"; + Text[ polish ] = "Method only allowed in floating mode at ($Arg1)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "Method only allowed in floating mode at ($Arg1)"; + Text[ korean ] = "($Arg1)¿¡¼ À̵¿ ¸ðµå¸Þ¼Òµå¸¸ Çã¿ëµË´Ï´Ù."; + Text[ chinese_simplified ] = "Method only allowed in floating mode at ($Arg1)"; + Text[ chinese_traditional ] = "Method only allowed in floating mode at ($Arg1)"; + Text[ arabic ] = "Method only allowed in floating mode at ($Arg1)"; + Text[ turkish ] = "Method only allowed in floating mode at ($Arg1)"; +}; +String S_ALLOWED_ONLY_IN_DOCKING_MODE +{ + Text = "Methode nur im Docking-Mode erlaubt bei ($Arg1)"; + Text[ english_us ] = "Method only allowed in docking mode at ($Arg1)"; + Text[ portuguese ] = "Método somente autorizado em modo Docking em ($Arg1)"; + Text[ russian ] = "Method only allowed in docking mode at ($Arg1)"; + Text[ greek ] = "Method only allowed in docking mode at ($Arg1)"; + Text[ dutch ] = "Methode alleen toegestaan in Docking-Mode bij ($Arg1)"; + Text[ french ] = "Méthode autorisée uniquement en mode Docking pour ($Arg1)"; + Text[ spanish ] = "Método permitido solo en modo Docking para ($Arg1)"; + Text[ italian ] = "Method only allowed in docking mode at ($Arg1)"; + Text[ danish ] = "Method only allowed in docking mode at ($Arg1)"; + Text[ swedish ] = "Method only allowed in docking mode at ($Arg1)"; + Text[ polish ] = "Method only allowed in docking mode at ($Arg1)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "Method only allowed in docking mode at ($Arg1)"; + Text[ korean ] = "($Arg1)¿¡¼ ¿¬°á ¸ðµå ¸Þ¼Òµå¸¸ Çã¿ëµË´Ï´Ù."; + Text[ chinese_simplified ] = "Method only allowed in docking mode at ($Arg1)"; + Text[ chinese_traditional ] = "Method only allowed in docking mode at ($Arg1)"; + Text[ arabic ] = "Method only allowed in docking mode at ($Arg1)"; + Text[ turkish ] = "Method only allowed in docking mode at ($Arg1)"; +}; +String S_SIZE_NOT_CHANGEABLE +{ + Text = "Größe ist nicht veränderbar bei ($Arg1)"; + Text[ english_us ] = "Size cannot be altered at ($Arg1)"; + Text[ portuguese ] = "Impossível alterar o tamanho em ($Arg1)"; + Text[ russian ] = "Size cannot be altered at ($Arg1)"; + Text[ greek ] = "Size cannot be altered at ($Arg1)"; + Text[ dutch ] = "Grootte kan niet worden veranderd bij ($Arg1)"; + Text[ french ] = "Taille non modifiable pour ($Arg1)"; + Text[ spanish ] = "Tamaño no modificable para ($Arg1)"; + Text[ italian ] = "Size cannot be altered at ($Arg1)"; + Text[ danish ] = "Size cannot be altered at ($Arg1)"; + Text[ swedish ] = "Size cannot be altered at ($Arg1)"; + Text[ polish ] = "Size cannot be altered at ($Arg1)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "Size cannot be altered at ($Arg1)"; + Text[ korean ] = "($Arg1)¿¡¼ Å©±â°¡ ¹Ù²ãÁöÁö ¾Ê½À´Ï´Ù."; + Text[ chinese_simplified ] = "Size cannot be altered at ($Arg1)"; + Text[ chinese_traditional ] = "Size cannot be altered at ($Arg1)"; + Text[ arabic ] = "Size cannot be altered at ($Arg1)"; + Text[ turkish ] = "Size cannot be altered at ($Arg1)"; +}; +String S_NO_OK_BUTTON +{ + Text = "Kein OK Button Vorhanden bei ($Arg1)"; + Text[ english_us ] = "There is no OK button at ($Arg1)"; + Text[ portuguese ] = "Botão OK inexistente em ($Arg1)"; + Text[ russian ] = "There is no OK button at ($Arg1)"; + Text[ greek ] = "There is no OK button at ($Arg1)"; + Text[ dutch ] = "Geen OK-button voorhanden bij ($Arg1)"; + Text[ french ] = "Absence de bouton OK pour ($Arg1)"; + Text[ spanish ] = "No existe botón Aceptar para ($Arg1)"; + Text[ italian ] = "There is no OK button at ($Arg1)"; + Text[ danish ] = "There is no OK button at ($Arg1)"; + Text[ swedish ] = "There is no OK button at ($Arg1)"; + Text[ polish ] = "There is no OK button at ($Arg1)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "There is no OK button at ($Arg1)"; + Text[ korean ] = "($Arg1)¿¡ È®ÀÎ ¹öưÀÌ ¾ø½À´Ï´Ù."; + Text[ chinese_simplified ] = "There is no OK button at ($Arg1)"; + Text[ chinese_traditional ] = "There is no OK button at ($Arg1)"; + Text[ arabic ] = "There is no OK button at ($Arg1)"; + Text[ turkish ] = "There is no OK button at ($Arg1)"; +}; +String S_NO_CANCEL_BUTTON +{ + Text = "Kein Abbrechen Button Vorhanden bei ($Arg1)"; + Text[ english_us ] = "There is no Cancel button at ($Arg1)"; + Text[ portuguese ] = "Botão Cancelar inexistente em ($Arg1)"; + Text[ russian ] = "There is no Cancel button at ($Arg1)"; + Text[ greek ] = "There is no Cancel button at ($Arg1)"; + Text[ dutch ] = "Geen Annuleren-button beschikbaar bij ($Arg1)"; + Text[ french ] = "Absence de bouton Annuler pour ($Arg1)"; + Text[ spanish ] = "No existe botón Cancelar para ($Arg1)"; + Text[ italian ] = "There is no Cancel button at ($Arg1)"; + Text[ danish ] = "There is no Cancel button at ($Arg1)"; + Text[ swedish ] = "There is no Cancel button at ($Arg1)"; + Text[ polish ] = "There is no Cancel button at ($Arg1)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "There is no Cancel button at ($Arg1)"; + Text[ korean ] = "($Arg1)¿¡ Ãë¼Ò ¹öưÀÌ ¾ø½À´Ï´Ù."; + Text[ chinese_simplified ] = "There is no Cancel button at ($Arg1)"; + Text[ chinese_traditional ] = "There is no Cancel button at ($Arg1)"; + Text[ arabic ] = "There is no Cancel button at ($Arg1)"; + Text[ turkish ] = "There is no Cancel button at ($Arg1)"; +}; +String S_NO_YES_BUTTON +{ + Text = "Kein Ja Button Vorhanden bei ($Arg1)"; + Text[ english_us ] = "There is no Yes button at ($Arg1)"; + Text[ portuguese ] = "Botão Sim inexistente em ($Arg1)"; + Text[ russian ] = "There is no Yes button at ($Arg1)"; + Text[ greek ] = "There is no Yes button at ($Arg1)"; + Text[ dutch ] = "Geen Ja-button beschikbaar bij ($Arg1)"; + Text[ french ] = "Absence de bouton Oui pour ($Arg1)"; + Text[ spanish ] = "No existe botón Sí para ($Arg1)"; + Text[ italian ] = "There is no Yes button at ($Arg1)"; + Text[ danish ] = "There is no Yes button at ($Arg1)"; + Text[ swedish ] = "There is no Yes button at ($Arg1)"; + Text[ polish ] = "There is no Yes button at ($Arg1)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "There is no Yes button at ($Arg1)"; + Text[ korean ] = "($Arg1)¿¡ \"¿¹\" ¹öưÀÌ ¾ø½À´Ï´Ù."; + Text[ chinese_simplified ] = "There is no Yes button at ($Arg1)"; + Text[ chinese_traditional ] = "There is no Yes button at ($Arg1)"; + Text[ arabic ] = "There is no Yes button at ($Arg1)"; + Text[ turkish ] = "There is no Yes button at ($Arg1)"; +}; +String S_NO_NO_BUTTON +{ + Text = "Kein Nein Button Vorhanden bei ($Arg1)"; + Text[ english_us ] = "There is no No button at ($Arg1)"; + Text[ portuguese ] = "Botão Não inexistente em ($Arg1)"; + Text[ russian ] = "There is no No button at ($Arg1)"; + Text[ greek ] = "There is no No button at ($Arg1)"; + Text[ dutch ] = "Geen Nee-button beschikbaar bij ($Arg1)"; + Text[ french ] = "Absence de bouton Non pour ($Arg1)"; + Text[ spanish ] = "No existe boton No para ($Arg1)"; + Text[ italian ] = "There is no No button at ($Arg1)"; + Text[ danish ] = "There is no No button at ($Arg1)"; + Text[ swedish ] = "There is no No button at ($Arg1)"; + Text[ polish ] = "There is no No button at ($Arg1)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "There is no No button at ($Arg1)"; + Text[ korean ] = "($Arg1)¿¡ \"¾Æ´Ï¿À\" ¹öưÀÌ ¾ø½À´Ï´Ù."; + Text[ chinese_simplified ] = "There is no No button at ($Arg1)"; + Text[ chinese_traditional ] = "There is no No button at ($Arg1)"; + Text[ arabic ] = "There is no No button at ($Arg1)"; + Text[ turkish ] = "There is no No button at ($Arg1)"; +}; +String S_NO_RETRY_BUTTON +{ + Text = "Kein Wiederholen Button Vorhanden bei ($Arg1)"; + Text[ english_us ] = "There is no Repeat button at ($Arg1)"; + Text[ portuguese ] = "Botão Repetir inexistente em ($Arg1)"; + Text[ russian ] = "There is no Repeat button at ($Arg1)"; + Text[ greek ] = "There is no Repeat button at ($Arg1)"; + Text[ dutch ] = "Geen Herhalen-button beschikbaar bij ($Arg1)"; + Text[ french ] = "Absence de bouton Réessayer pour ($Arg1)"; + Text[ spanish ] = "No existe botón Repetir para ($Arg1)"; + Text[ italian ] = "There is no Repeat button at ($Arg1)"; + Text[ danish ] = "There is no Repeat button at ($Arg1)"; + Text[ swedish ] = "There is no Repeat button at ($Arg1)"; + Text[ polish ] = "There is no Repeat button at ($Arg1)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "There is no Repeat button at ($Arg1)"; + Text[ korean ] = "($Arg1)¿¡ ¹Ýº¹ ¹öưÀÌ ¾ø½À´Ï´Ù."; + Text[ chinese_simplified ] = "There is no Repeat button at ($Arg1)"; + Text[ chinese_traditional ] = "There is no Repeat button at ($Arg1)"; + Text[ arabic ] = "There is no Repeat button at ($Arg1)"; + Text[ turkish ] = "There is no Repeat button at ($Arg1)"; +}; +String S_NO_HELP_BUTTON +{ + Text = "Kein Hilfe Button Vorhanden bei ($Arg1)"; + Text[ english_us ] = "There is no Help button at ($Arg1)"; + Text[ portuguese ] = "Botão Ajuda inexistente em ($Arg1)"; + Text[ russian ] = "There is no Help button at ($Arg1)"; + Text[ greek ] = "There is no Help button at ($Arg1)"; + Text[ dutch ] = "Geen Help-button beschikbaar bij ($Arg1)"; + Text[ french ] = "Absence de bouton Aide pour ($Arg1)"; + Text[ spanish ] = "No existe botón Ayuda para ($Arg1)"; + Text[ italian ] = "There is no Help button at ($Arg1)"; + Text[ danish ] = "There is no Help button at ($Arg1)"; + Text[ swedish ] = "There is no Help button at ($Arg1)"; + Text[ polish ] = "There is no Help button at ($Arg1)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "There is no Help button at ($Arg1)"; + Text[ korean ] = "($Arg1)¿¡ µµ¿ò¸» ¹öưÀÌ ¾ø½À´Ï´Ù."; + Text[ chinese_simplified ] = "There is no Help button at ($Arg1)"; + Text[ chinese_traditional ] = "There is no Help button at ($Arg1)"; + Text[ arabic ] = "There is no Help button at ($Arg1)"; + Text[ turkish ] = "There is no Help button at ($Arg1)"; +}; +String S_NO_DEFAULT_BUTTON +{ + Text = "Kein Default Button Definiert bei ($Arg1)"; + Text[ english_us ] = "There is no Default button defined at ($Arg1)"; + Text[ portuguese ] = "Botão Padrão inexistente em ($Arg1)"; + Text[ russian ] = "There is no Default button defined at ($Arg1)"; + Text[ greek ] = "There is no Default button defined at ($Arg1)"; + Text[ dutch ] = "Geen Default-button beschikbaar bij ($Arg1)"; + Text[ french ] = "Absence de bouton Par défaut pour ($Arg1)"; + Text[ spanish ] = "No hay definido un botón Default para ($Arg1)"; + Text[ italian ] = "There is no Default button defined at ($Arg1)"; + Text[ danish ] = "There is no Default button defined at ($Arg1)"; + Text[ swedish ] = "There is no Default button defined at ($Arg1)"; + Text[ polish ] = "There is no Default button defined at ($Arg1)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "There is no Default button defined at ($Arg1)"; + Text[ korean ] = "($Arg1)¿¡ Á¤ÀÇµÈ ±âº» ¹öưÀÌ ¾ø½À´Ï´Ù."; + Text[ chinese_simplified ] = "There is no Default button defined at ($Arg1)"; + Text[ chinese_traditional ] = "There is no Default button defined at ($Arg1)"; + Text[ arabic ] = "There is no Default button defined at ($Arg1)"; + Text[ turkish ] = "There is no Default button defined at ($Arg1)"; +}; +String S_BUTTON_ID_NOT_THERE +{ + Text = "Kein Button mit der ID ($Arg1) Vorhanden bei ($Arg2)"; + Text[ english_us ] = "There is no button with a ($Arg1) ID at ($Arg2)"; + Text[ portuguese ] = "Botão com ID ($Arg1) inexistente em ($Arg2)"; + Text[ russian ] = "There is no button with a ($Arg1) ID at ($Arg2)"; + Text[ greek ] = "There is no button with a ($Arg1) ID at ($Arg2)"; + Text[ dutch ] = "Geen button met ID ($Arg1) beschikbaar bij ($Arg2)"; + Text[ french ] = "Absence bouton portant l'ID ($Arg1) pour ($Arg2) "; + Text[ spanish ] = "No existe un botón con la ID ($Arg1) para ($Arg2)"; + Text[ italian ] = "There is no button with a ($Arg1) ID at ($Arg2)"; + Text[ danish ] = "There is no button with a ($Arg1) ID at ($Arg2)"; + Text[ swedish ] = "There is no button with a ($Arg1) ID at ($Arg2)"; + Text[ polish ] = "There is no button with a ($Arg1) ID at ($Arg2)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "There is no button with a ($Arg1) ID at ($Arg2)"; + Text[ korean ] = "($Arg2)¿¡ ID ($Arg1)¸¦ °¡Áø ¹öưÀÌ ¾øÀ½"; + Text[ chinese_simplified ] = "There is no button with a ($Arg1) ID at ($Arg2)"; + Text[ chinese_traditional ] = "There is no button with a ($Arg1) ID at ($Arg2)"; + Text[ arabic ] = "There is no button with a ($Arg1) ID at ($Arg2)"; + Text[ turkish ] = "There is no button with a ($Arg1) ID at ($Arg2)"; +}; +String S_BUTTONID_REQUIRED +{ + Text = "Es muss eine ButtonId angegeben werden bei ($Arg1)"; + Text[ english_us ] = "A button ID needs to be entered at ($Arg1)"; + Text[ portuguese ] = "Necessário indicar ButtonId em ($Arg1)"; + Text[ russian ] = "A button ID needs to be entered at ($Arg1)"; + Text[ greek ] = "A button ID needs to be entered at ($Arg1)"; + Text[ dutch ] = "Er moet een buttonID worden vermeld bij ($Arg1)"; + Text[ french ] = "Il manque un ButtonID pour ($Arg1) "; + Text[ spanish ] = "Debe indicarse un ButtonId para ($Arg1)"; + Text[ italian ] = "A button ID needs to be specified at ($Arg1)"; + Text[ danish ] = "A button ID needs to be entered at ($Arg1)"; + Text[ swedish ] = "A button ID needs to be entered at ($Arg1)"; + Text[ polish ] = "A button ID needs to be entered at ($Arg1)"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "A button ID needs to be entered at ($Arg1)"; + Text[ korean ] = "($Arg1)¿¡¼ ÀÔ·ÂµÉ ¹öư ID"; + Text[ chinese_simplified ] = "A button ID needs to be entered at ($Arg1)"; + Text[ chinese_traditional ] = "A button ID needs to be entered at ($Arg1)"; + Text[ arabic ] = "A button ID needs to be entered at ($Arg1)"; + Text[ turkish ] = "A button ID needs to be entered at ($Arg1)"; +}; +String S_UNKNOWN_TYPE +{ + Text = "Unbekannter Objekttyp ($Arg1) aus UId"; + Text[ english_us ] = "Unknown object type ($Arg1) from UId"; + Text[ portuguese ] = "Tipo de objecto ($Arg1) desconhecido deste UId"; + Text[ russian ] = "Unknown object type ($Arg1) from UId"; + Text[ greek ] = "Unknown object type ($Arg1) from UId"; + Text[ dutch ] = "Onbekend objecttype ($Arg1) uit UId"; + Text[ french ] = "Type d'objet ($Arg1) inconnu pour cet UId"; + Text[ spanish ] = "Tipo de objeto ($Arg1) desconocido por su UId"; + Text[ italian ] = "Unknown object type ($Arg1) from UId"; + Text[ danish ] = "Unknown object type ($Arg1) from UId"; + Text[ swedish ] = "Unknown object type ($Arg1) from UId"; + Text[ polish ] = "Unknown object type ($Arg1) from UId"; + Text[ portuguese_brazilian ] = "dummytext"; + Text[ japanese ] = "Unknown object type ($Arg1) from UId"; + Text[ korean ] = "UId·ÎºÎÅÍ ¾Ë¼ö¾ø´Â°³Ã¼ ŸÀÔ ($Arg1) "; + Text[ chinese_simplified ] = "Unknown object type ($Arg1) from UId"; + Text[ chinese_traditional ] = "Unknown object type ($Arg1) from UId"; + Text[ arabic ] = "Unknown object type ($Arg1) from UId"; + Text[ turkish ] = "Unknown object type ($Arg1) from UId"; +}; diff --git a/basic/source/app/testbasi.cxx b/basic/source/app/testbasi.cxx new file mode 100644 index 000000000000..e21c67587453 --- /dev/null +++ b/basic/source/app/testbasi.cxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * $RCSfile: testbasi.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#define testtool +#include "mybasic.cxx" diff --git a/basic/source/app/testtool.idl b/basic/source/app/testtool.idl new file mode 100644 index 000000000000..7666576c3e4e --- /dev/null +++ b/basic/source/app/testtool.idl @@ -0,0 +1,81 @@ +/************************************************************************* + * + * $RCSfile: testtool.idl,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +module +"484E40E0-1F23-101C-9961-04021C007002" +"5A30E000-1F23-101C-9961-04021C007002" +App +[ +HelpText( "Test" ), +TypeLibFile( "testtool.tlb" ) +] +{ + interface TestToolAutomation + [ + uuid( "6706E171-FB05-101B-804c-04021c007002" ) + ] + { + void Start( String aFilePath ); + BOOL Call( String aProcName, UINT32 nUId ); + void Close( ); + } +} + + diff --git a/basic/source/app/testtool.src b/basic/source/app/testtool.src new file mode 100644 index 000000000000..747d891ffc9c --- /dev/null +++ b/basic/source/app/testtool.src @@ -0,0 +1,221 @@ +/************************************************************************* + * + * $RCSfile: testtool.src,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#include "testtool.hrc" + + +/////////////////////////////// +// Strings +/////////////////////////////// +String S_INVALID_KEYCODE +{ + Text = "Ist kein gültiger KeyCode!"; + Text[ english_us ] = "Is an invalid KeyCode!"; + Text[ portuguese ] = "Não é um KeyCode válido!"; + Text[ russian ] = "Is an invalid KeyCode!"; + Text[ greek ] = "Is an invalid KeyCode!"; + Text[ dutch ] = "Is geen geldige KeyCode!"; + Text[ french ] = "KeyCode incorrect !"; + Text[ spanish ] = "¡No es un KeyCode correcto!"; + Text[ italian ] = "Is an invalid KeyCode!"; + Text[ danish ] = "Is an invalid KeyCode!"; + Text[ swedish ] = "Is an invalid KeyCode!"; + Text[ polish ] = "Nieprawid³owy KeyCode!"; + Text[ portuguese_brazilian ] = "Ist kein gültiger KeyCode!"; + Text[ japanese ] = "Is an invalid KeyCode!"; + Text[ korean ] = "Ű Äڵ尡 ¸ÂÁö¾Ê½À´Ï´Ù!"; + Text[ chinese_simplified ] = "Is an invalid KeyCode!"; + Text[ chinese_traditional ] = "Ist kein gültiger KeyCode!"; + Text[ arabic ] = "Is an invalid KeyCode!"; + Text[ turkish ] = "Geçerli bir KeyCode deðil!"; +}; +String S_MANDATORY_FILE +{ + Text = "\nwurde nicht gefunden.\nDiese Datei ist unentbehrlich."; + Text[ english_us ] = "\ncould not be found.\nThis file is indispensable."; + Text[ portuguese ] = "\nnão foi encontrado.\nEste ficheiro é indispensável."; + Text[ russian ] = "\ncould not be found.\nThis file is indispensable."; + Text[ greek ] = "\ncould not be found.\nThis file is indispensable."; + Text[ dutch ] = "\nniet gevonden.\nDit bestand is onontbeerlijk."; + Text[ french ] = "\nn'a pas pu être détecté.\nCe fichier est indispensable."; + Text[ spanish ] = "\nno se encontró.\nEste archivo es imprescindible."; + Text[ italian ] = "\ncould not be found.\nThis file is indispensable."; + Text[ danish ] = "\ncould not be found.\nThis file is indispensable."; + Text[ swedish ] = "\ncould not be found.\nThis file is indispensable."; + Text[ polish ] = "\nnie znaleziono.\n.Plik ten jest niezbêdny."; + Text[ portuguese_brazilian ] = "\nwurde nicht gefunden.\nDiese Datei ist unentbehrlich."; + Text[ japanese ] = "\ncould not be found.\nThis file is indispensable."; + Text[ korean ] = "\n¹ß°ßµÇÁö ¾Ê½À´Ï´Ù.\nÀÌ ÆÄÀÏÀº ¹Ýµå½Ã ÀÖ¾î¾ßÇÕ´Ï´Ù."; + Text[ chinese_simplified ] = "\ncould not be found.\nThis file is indispensable."; + Text[ chinese_traditional ] = "\nwurde nicht gefunden.\nDiese Datei ist unentbehrlich."; + Text[ arabic ] = "\ncould not be found.\nThis file is indispensable."; + Text[ turkish ] = "\nbulunamadý.\nBu dosya mutlaka gerekli."; +}; +String S_READING_LONGNAMES +{ + Text = "Einlesen der Langnamen"; + Text[ english_us ] = "Reading long names"; + Text[ portuguese ] = "Leitura dos nomes extensos"; + Text[ russian ] = "Reading long names"; + Text[ greek ] = "Reading long names"; + Text[ dutch ] = "Lezen van volledige namen"; + Text[ french ] = "Lecture des noms de fichiers longs (long names)"; + Text[ spanish ] = "Leyendo nombres largos"; + Text[ italian ] = "Reading long names"; + Text[ danish ] = "Reading long names"; + Text[ swedish ] = "Reading long names"; + Text[ polish ] = "Czytanie pe³nych nazw"; + Text[ portuguese_brazilian ] = "Einlesen der Langnamen"; + Text[ japanese ] = "Reading long names"; + Text[ korean ] = "±ä À̸§ Àбâ"; + Text[ chinese_simplified ] = "Reading long names"; + Text[ chinese_traditional ] = "Einlesen der Langnamen"; + Text[ arabic ] = "Reading long names"; + Text[ turkish ] = "Uzun adlar okunuyor"; +}; +String S_READING_SLOT_IDS +{ + Text = "Einlesen der Slot IDs"; + Text[ english_us ] = "Reading Slot IDs"; + Text[ portuguese ] = "Leitura dos Slot IDs"; + Text[ russian ] = "Reading Slot IDs"; + Text[ greek ] = "Reading Slot IDs"; + Text[ dutch ] = "Lezen van de Slot IDs"; + Text[ french ] = "Lecture des Slot IDs"; + Text[ spanish ] = "Leyendo Slot IDs"; + Text[ italian ] = "Reading Slot IDs"; + Text[ danish ] = "Reading Slot IDs"; + Text[ swedish ] = "Reading Slot IDs"; + Text[ polish ] = "Czytanie Slot ID"; + Text[ portuguese_brazilian ] = "Einlesen der Slot IDs"; + Text[ japanese ] = "Reading Slot IDs"; + Text[ korean ] = "½½·Ô ¾ÆÀ̵ð Àбâ"; + Text[ chinese_simplified ] = "Reading Slot IDs"; + Text[ chinese_traditional ] = "Einlesen der Slot IDs"; + Text[ arabic ] = "Reading Slot IDs"; + Text[ turkish ] = "Slot ID'ler okunuyor"; +}; +String S_READING_CONTROLS +{ + Text = "Einlesen der Controls"; + Text[ english_us ] = "Reading Controls"; + Text[ portuguese ] = "Leitura dos Controls"; + Text[ russian ] = "Reading Controls"; + Text[ greek ] = "Reading Controls"; + Text[ dutch ] = "Leuen van de Controls"; + Text[ french ] = "Lecture des contrôles"; + Text[ spanish ] = "Leyendo Controls"; + Text[ italian ] = "Reading Controls"; + Text[ danish ] = "Reading Controls"; + Text[ swedish ] = "Reading Controls"; + Text[ polish ] = "Odczyt pól kontrolnych"; + Text[ portuguese_brazilian ] = "Einlesen der Controls"; + Text[ japanese ] = "Reading Controls"; + Text[ korean ] = "ÄÁÆ®·Ñ Àбâ"; + Text[ chinese_simplified ] = "Reading Controls"; + Text[ chinese_traditional ] = "Einlesen der Controls"; + Text[ arabic ] = "Reading Controls"; + Text[ turkish ] = "Control'ler okunuyor"; +}; +String S_READING_BASIC_MODULE +{ + Text = "Einlesen BASIC Modul"; + Text[ english_us ] = "Reading BASIC module"; + Text[ portuguese ] = "Leitura do módulo BASIC"; + Text[ russian ] = "Reading BASIC module"; + Text[ greek ] = "Reading BASIC module"; + Text[ dutch ] = "Lezen van BASIC module"; + Text[ french ] = "Lecture du module BASIC"; + Text[ spanish ] = "Leyendo módulo BASIC"; + Text[ italian ] = "Reading BASIC module"; + Text[ danish ] = "Reading BASIC module"; + Text[ swedish ] = "Reading BASIC module"; + Text[ polish ] = "Czytanie modu³u BASIC"; + Text[ portuguese_brazilian ] = "Einlesen BASIC Modul"; + Text[ japanese ] = "Reading BASIC module"; + Text[ korean ] = "BASIC ¸ðµâ Àбâ"; + Text[ chinese_simplified ] = "Reading BASIC module"; + Text[ chinese_traditional ] = "Einlesen BASIC Modul"; + Text[ arabic ] = "Reading BASIC module"; + Text[ turkish ] = "BASIC modülü okunuyor"; +}; +String S_STARTING_APPLICATION +{ + Text = "Starten der Applikation"; + Text[ english_us ] = "Starting application"; + Text[ portuguese ] = "A iniciar aplicação"; + Text[ russian ] = "Starting application"; + Text[ greek ] = "Starting application"; + Text[ dutch ] = "Starten van applicatie"; + Text[ french ] = "Démarrage de l'application"; + Text[ spanish ] = "Iniciando la aplicación"; + Text[ italian ] = "Starting application"; + Text[ danish ] = "Starting application"; + Text[ swedish ] = "Starting application"; + Text[ polish ] = "Uruchamianie aplikacji"; + Text[ portuguese_brazilian ] = "Starten der Applikation"; + Text[ japanese ] = "Starting application"; + Text[ korean ] = "ÀÀ¿ëÇÁ·Î±×·¥ ½ÃÀÛ"; + Text[ chinese_simplified ] = "Starting application"; + Text[ chinese_traditional ] = "Starten der Applikation"; + Text[ arabic ] = "Starting application"; + Text[ turkish ] = "Uygulama baþlatýlýyor"; +}; + diff --git a/basic/source/app/textedit.cxx b/basic/source/app/textedit.cxx new file mode 100644 index 000000000000..cd0343ef63e2 --- /dev/null +++ b/basic/source/app/textedit.cxx @@ -0,0 +1,898 @@ +/************************************************************************* + * + * $RCSfile: textedit.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SYSTEM_HXX //autogen +#include <vcl/system.hxx> +#endif +#ifndef _STREAM_HXX //autogen +#include <tools/stream.hxx> +#endif + +#ifndef _TEXTENG_HXX //autogen +#include <svtools/texteng.hxx> +#endif +#ifndef _TEXTVIEW_HXX //autogen +#include <svtools/textview.hxx> +#endif +#ifndef _TXTATTR_HXX //autogen +#include <svtools/txtattr.hxx> +#endif +#ifndef __SBX_SBXMETHOD_HXX //autogen +#include <svtools/sbxmeth.hxx> +#endif +#ifndef _BASIC_TTRESHLP_HXX +#include "ttstrhlp.hxx" +#endif + +#include "basic.hrc" +#include "textedit.hxx" +#include "appedit.hxx" +#include "brkpnts.hxx" +#include "testtool.hxx" // defines für das Syntaxhighlighting + +TextEditImp::TextEditImp( AppEdit* pParent, const WinBits& aBits ) +: Window( pParent, aBits ) +, pAppEdit( pParent ) +, bHighlightning( FALSE ) +, bDoSyntaxHighlight( FALSE ) +, bDelayHighlight( TRUE ) +, nTipId( 0 ) +{ + pTextEngine = new TextEngine(); + pTextEngine->SetMaxTextLen( STRING_MAXLEN ); + pTextEngine->EnableUndo( TRUE ); + + pTextView = new TextView( pTextEngine, this ); + pTextEngine->InsertView( pTextView ); + pTextEngine->SetModified( FALSE ); + + aSyntaxIdleTimer.SetTimeout( 200 ); + aSyntaxIdleTimer.SetTimeoutHdl( LINK( this, TextEditImp, SyntaxTimerHdl ) ); + + aImplSyntaxIdleTimer.SetTimeout( 1 ); + aImplSyntaxIdleTimer.SetTimeoutHdl( LINK( this, TextEditImp, SyntaxTimerHdl ) ); + + StartListening( *pTextEngine ); + + HideTipTimer.SetTimeout( 5000 ); // 5 Sekunden + ShowTipTimer.SetTimeout( 500 ); // 1/2 Sekunde + HideTipTimer.SetTimeoutHdl( LINK( this, TextEditImp, HideVarContents ) ); + ShowTipTimer.SetTimeoutHdl( LINK( this, TextEditImp, ShowVarContents ) ); +} + +TextEditImp::~TextEditImp() +{ + pTextEngine->RemoveView( pTextView ); + delete pTextView; + delete pTextEngine; +} + +void TextEditImp::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) +{ + if ( rHint.ISA( TextHint ) ) + { + const TextHint& rTextHint = (const TextHint&)rHint; + if( rTextHint.GetId() == TEXT_HINT_VIEWSCROLLED ) + { + pAppEdit->pHScroll->SetThumbPos( pTextView->GetStartDocPos().X() ); + pAppEdit->pVScroll->SetThumbPos( pTextView->GetStartDocPos().Y() ); + if ( ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow() ) + ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow()->Scroll( 0, ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow()->GetCurYOffset() - pTextView->GetStartDocPos().Y() ); + } + else if( rTextHint.GetId() == TEXT_HINT_TEXTHEIGHTCHANGED ) + { + if ( pTextView->GetStartDocPos().Y() ) + { + long nOutHeight = GetOutputSizePixel().Height(); + long nTextHeight = pTextEngine->GetTextHeight(); + if ( nTextHeight < nOutHeight ) + pTextView->Scroll( 0, pTextView->GetStartDocPos().Y() ); + } + + pAppEdit->SetScrollBarRanges(); + } + else if( rTextHint.GetId() == TEXT_HINT_TEXTFORMATTED ) + { + ULONG nWidth = pTextEngine->CalcTextWidth(); + if ( (ULONG)nWidth != pAppEdit->nCurTextWidth ) + { + pAppEdit->nCurTextWidth = nWidth; + if ( pAppEdit->pHScroll ) + { // Initialisierung abgeschlossen? + pAppEdit->pHScroll->SetRange( Range( 0, (long)nWidth) ); + pAppEdit->pHScroll->SetThumbPos( pTextView->GetStartDocPos().X() ); + } + } + } + else if( rTextHint.GetId() == TEXT_HINT_PARAINSERTED ) + { + if ( ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow() ) + ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow()->AdjustBreakpoints( rTextHint.GetValue()+1, TRUE ); + + // Lästiges anpassen für 2 Zeichen am Zeilenende statt einem(Hartverdrateter Default) + pTextEngine->SetMaxTextLen( STRING_MAXLEN - pTextEngine->GetParagraphCount() ); + } + else if( rTextHint.GetId() == TEXT_HINT_PARAREMOVED ) + { + if ( ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow() ) + ((TextEdit*)(pAppEdit->pDataEdit))->GetBreakpointWindow()->AdjustBreakpoints( rTextHint.GetValue()+1, FALSE ); + + // Lästiges anpassen für 2 Zeichen am Zeilenende statt einem(Hartverdrateter Default) + pTextEngine->SetMaxTextLen( STRING_MAXLEN - pTextEngine->GetParagraphCount() ); + } + else if( rTextHint.GetId() == TEXT_HINT_FORMATPARA ) + { + DoDelayedSyntaxHighlight( rTextHint.GetValue() ); + ModifyHdl.Call( NULL ); + } + } +} + +#define TEXTATTR_SPECHIAL 55 +class TextAttribSpechial : public TextAttrib +{ +private: + FontWeight maFontWeight; + +public: + TextAttribSpechial( const FontWeight& rFontWeight ); + TextAttribSpechial( const TextAttribSpechial& rAttr ); + ~TextAttribSpechial() {;} + + virtual void SetFont( Font& rFont ) const; + virtual TextAttrib* Clone() const; + virtual int operator==( const TextAttrib& rAttr ) const; +}; + +TextAttribSpechial::TextAttribSpechial( const FontWeight& rFontWeight ) + : TextAttrib( TEXTATTR_SPECHIAL ), maFontWeight( rFontWeight ) +{} + +TextAttribSpechial::TextAttribSpechial( const TextAttribSpechial& rAttr ) + : TextAttrib( rAttr ), maFontWeight( rAttr.maFontWeight ) +{} + +void TextAttribSpechial::SetFont( Font& rFont ) const +{ + rFont.SetWeight( maFontWeight ); +} + +TextAttrib* TextAttribSpechial::Clone() const +{ + return new TextAttribSpechial( *this ); +} + +int TextAttribSpechial::operator==( const TextAttrib& rAttr ) const +{ + return ( ( TextAttrib::operator==(rAttr ) ) && + ( maFontWeight == ((const TextAttribSpechial&)rAttr).maFontWeight ) ); +} + +void TextEditImp::ImpDoHighlight( const String& rSource, ULONG nLineOff ) +{ + SbTextPortions aPortionList; + pAppEdit->GetBasicFrame()->Basic().Highlight( rSource, aPortionList ); + + USHORT nCount = aPortionList.Count(); + if ( !nCount ) + return; + + SbTextPortion& rLast = aPortionList[nCount-1]; + if ( rLast.nStart > rLast.nEnd ) // Nur bis Bug von MD behoben + { +#ifdef DEBUG + DBG_ERROR( "MD-Bug nicht beseitigt!" ); +#endif + nCount--; + aPortionList.Remove( nCount); + if ( !nCount ) + return; + } + + /// hier werden die Type für das Testtool nachbearbeitet + USHORT i; + BOOL bWasTTControl = FALSE; + for ( i = 0; i < aPortionList.Count(); i++ ) + { + SbTextPortion& r = aPortionList[i]; +// DBG_ASSERT( r.nStart <= r.nEnd, "Highlight: Start > End?" ); + if ( r.nStart > r.nEnd ) // Nur bis Bug von MD behoben + continue; + + SbTextType eType = r.eType; + Color aColor; + switch ( eType ) + { + case SB_SYMBOL: + { + String aSymbol = rSource.Copy( r.nStart, r.nEnd - r.nStart +1 ); + r.eType = pAppEdit->GetBasicFrame()->Basic().GetSymbolType( aSymbol, bWasTTControl ); + + if ( r.eType == TT_CONTROL ) + bWasTTControl = TRUE; + else + bWasTTControl = FALSE; + } + break; + case SB_PUNCTUATION: + { + String aPunctuation = rSource.Copy( r.nStart, r.nEnd - r.nStart +1 ); + if ( aPunctuation.CompareToAscii( "." ) != COMPARE_EQUAL ) + bWasTTControl = FALSE; + } + break; + default: + bWasTTControl = FALSE; + } + } + + // Evtl. Optimieren: + // Wenn haufig gleiche Farbe, dazwischen Blank ohne Farbe, + // ggf. zusammenfassen, oder zumindest das Blank, + // damit weniger Attribute + if ( TRUE /*bOptimizeHighlight*/ ) + { + // Es muessen nur die Blanks und Tabs mit attributiert werden. + // Wenn zwei gleiche Attribute hintereinander eingestellt werden, + // optimiert das die EditEngine. + xub_StrLen nLastEnd = 0; + xub_StrLen nLine = aPortionList[0].nLine; + for ( USHORT i = 0; i < nCount; i++ ) + { + SbTextPortion& r = aPortionList[i]; + DBG_ASSERT( r.nLine == nLine, "doch mehrere Zeilen ?" ); + DBG_ASSERT( r.nStart <= r.nEnd, "Highlight: Start > End?" ); + if ( r.nStart > r.nEnd ) // Nur bis Bug von MD behoben + continue; + + if ( r.nStart > nLastEnd ) + { + // Kann ich mich drauf verlassen, dass alle ausser + // Blank und Tab gehighlightet wird ?! + r.nStart = nLastEnd; + } + nLastEnd = r.nEnd+1; + if ( ( i == (nCount-1) ) && ( r.nEnd < rSource.Len() ) ) + r.nEnd = rSource.Len()-1; + } + } + + BOOL bWasModified = pTextEngine->IsModified(); + for ( i = 0; i < aPortionList.Count(); i++ ) + { + SbTextPortion& r = aPortionList[i]; +// DBG_ASSERT( r.nStart <= r.nEnd, "Highlight: Start > End?" ); + if ( r.nStart > r.nEnd ) // Nur bis Bug von MD behoben + continue; + + SbTextType eCol = r.eType; + Color aColor; + xub_StrLen nLine = nLineOff+r.nLine-1; // -1, weil Basic bei 1 beginnt + switch ( eCol ) + { + case SB_KEYWORD: + aColor = Color( COL_BLUE ); + break; + case SB_SYMBOL: + aColor = Color( RGB_COLORDATA( 0x00, 0x60, 0x00 ) ); + break; + case SB_STRING: + aColor = Color( COL_RED ); + break; + case SB_NUMBER: + aColor = Color( COL_MAGENTA ); + break; + case SB_PUNCTUATION: + aColor = Color( COL_BLACK ); + break; + case SB_COMMENT: + aColor = Color( COL_GRAY ); + break; + case TT_KEYWORD: + case TT_LOCALCMD: + aColor = Color( COL_LIGHTBLUE ); + break; + case TT_REMOTECMD: + aColor = Color( RGB_COLORDATA( 0x00, 0xB0, 0xB0 ) ); + break; + case TT_CONTROL: + case TT_SLOT: + aColor = Color( RGB_COLORDATA( 0x00, 0xB0, 0x00 ) ); + break; + case TT_METHOD: + aColor = Color( RGB_COLORDATA( 0x00, 0xB0, 0x00 ) ); + break; + case TT_NOMETHOD: + { + aColor = Color( COL_RED ); + pTextEngine->SetAttrib( TextAttribSpechial( WEIGHT_BOLD ), nLine, r.nStart, r.nEnd+1 ); + } + break; + default: + { + aColor = Color( RGB_COLORDATA( 0xff, 0x80, 0x80 ) ); + DBG_ERROR( "Unbekannte Syntax-Farbe?" ); + } + } + pTextEngine->SetAttrib( TextAttribFontColor( aColor ), nLine, r.nStart, r.nEnd+1 ); + } + // Das Highlighten soll kein Modify setzen + pTextEngine->SetModified( bWasModified ); +} + +void TextEditImp::DoSyntaxHighlight( ULONG nPara ) +{ + // Durch das DelayedSyntaxHighlight kann es passieren, + // dass die Zeile nicht mehr existiert! + if ( nPara < pTextEngine->GetParagraphCount() ) + { + // leider weis ich nicht, ob genau diese Zeile Modified() ... +// if ( pProgress ) +// pProgress->StepProgress(); + pTextEngine->RemoveAttribs( nPara ); + String aSource( pTextEngine->GetText( nPara ) ); + ImpDoHighlight( aSource, nPara ); + } +} + +void TextEditImp::DoDelayedSyntaxHighlight( xub_StrLen nPara ) +{ + // Zeile wird nur in 'Liste' aufgenommen, im TimerHdl abgearbeitet. + // => Nicht Absaetze manipulieren, waehrend EditEngine formatiert. +// if ( pProgress ) +// pProgress->StepProgress(); + + if ( !bHighlightning && bDoSyntaxHighlight ) + { + if ( bDelayHighlight ) + { + aSyntaxLineTable.Insert( nPara, (void*)(ULONG)1 ); + aSyntaxIdleTimer.Start(); + } + else + DoSyntaxHighlight( nPara ); + } +} + +IMPL_LINK( TextEditImp, SyntaxTimerHdl, Timer *, EMPTYARG ) +{ + DBG_ASSERT( pTextView, "Noch keine View, aber Syntax-Highlight ?!" ); + pTextEngine->SetUpdateMode( FALSE ); + + bHighlightning = TRUE; + USHORT nLine; + while ( aSyntaxLineTable.First() && !Application::AnyInput( INPUT_MOUSEANDKEYBOARD ) ) + { + nLine = (USHORT)aSyntaxLineTable.GetCurKey(); + DoSyntaxHighlight( nLine ); + aSyntaxLineTable.Remove( nLine ); +/* if ( Application::AnyInput() ) + { + aSyntaxIdleTimer.Start(); // Starten, falls wir in einem Dialog landen + pTextView->ShowCursor( TRUE, TRUE ); + pTextEngine->SetUpdateMode( TRUE ); + bHighlightning = FALSE; + GetpApp()->Reschedule(); + bHighlightning = TRUE; + pTextEngine->SetUpdateMode( FALSE ); + }*/ + } + + BOOL bWasModified = pTextEngine->IsModified(); + if ( aSyntaxLineTable.Count() > 3 ) // Ohne VDev + { + pTextEngine->SetUpdateMode( TRUE ); + pTextView->ShowCursor( TRUE, TRUE ); + } + else + pTextEngine->SetUpdateMode( TRUE ); // ! Mit VDev +// pTextView->ForceUpdate(); + + // SetUpdateMode( TRUE ) soll kein Modify setzen + pTextEngine->SetModified( bWasModified ); + + // SyntaxTimerHdl wird gerufen, wenn Text-Aenderung + // => gute Gelegenheit, Textbreite zu ermitteln! +// long nPrevTextWidth = nCurTextWidth; +// nCurTextWidth = pTextEngine->CalcTextWidth(); +// if ( nCurTextWidth != nPrevTextWidth ) +// SetScrollBarRanges(); + bHighlightning = FALSE; + + if ( aSyntaxLineTable.First() ) + aImplSyntaxIdleTimer.Start(); + +// while ( Application::AnyInput() ) +// Application::Reschedule(); // Reschedule, da der UserEvent keine Paints etc. durchlässt + + return 0; +} + +void TextEditImp::InvalidateSyntaxHighlight() +{ + for ( ULONG i = 0; i < pTextEngine->GetParagraphCount(); i++ ) + DoDelayedSyntaxHighlight( i ); +} + +void TextEditImp::SyntaxHighlight( BOOL bNew ) +{ + if ( ( bNew && bDoSyntaxHighlight ) || ( !bNew && !bDoSyntaxHighlight ) ) + return; + + bDoSyntaxHighlight = bNew; + if ( !pTextEngine ) + return; + + + if ( bDoSyntaxHighlight ) + { + InvalidateSyntaxHighlight(); + } + else + { + aSyntaxIdleTimer.Stop(); + pTextEngine->SetUpdateMode( FALSE ); + for ( ULONG i = 0; i < pTextEngine->GetParagraphCount(); i++ ) + pTextEngine->RemoveAttribs( i ); + +// pTextEngine->QuickFormatDoc(); + pTextEngine->SetUpdateMode( TRUE ); + pTextView->ShowCursor(TRUE, TRUE ); + } +} + + +void TextEditImp::SetFont( const Font& rNewFont ) +{ + pTextEngine->SetFont(rNewFont); +} + +BOOL TextEditImp::IsModified() +{ + return pTextEngine->IsModified(); +} + +void TextEditImp::KeyInput( const KeyEvent& rKeyEvent ) +{ + BOOL bWasModified = pTextView->GetTextEngine()->IsModified(); + pTextView->GetTextEngine()->SetModified( FALSE ); + + if ( !pTextView->KeyInput( rKeyEvent ) ) + Window::KeyInput( rKeyEvent ); + + if ( pTextView->GetTextEngine()->IsModified() ) + ModifyHdl.Call( NULL ); + else + pTextView->GetTextEngine()->SetModified( bWasModified ); // Eventuell wieder setzen +} + +void TextEditImp::Paint( const Rectangle& rRect ){ pTextView->Paint( rRect );} +void TextEditImp::MouseButtonUp( const MouseEvent& rMouseEvent ){ pTextView->MouseButtonUp( rMouseEvent );} +//void TextEditImp::MouseButtonDown( const MouseEvent& rMouseEvent ){ pTextView->MouseButtonDown( rMouseEvent );} +//void TextEditImp::MouseMove( const MouseEvent& rMouseEvent ){ pTextView->MouseMove( rMouseEvent );} +//void TextEditImp::Command( const CommandEvent& rCEvt ){ pTextView->Command( rCEvt );} +BOOL TextEditImp::Drop( const DropEvent& rEvt ){ return pTextView->Drop( rEvt );} +BOOL TextEditImp::QueryDrop( DropEvent& rEvt ){ return pTextView->QueryDrop( rEvt );} + + +void TextEditImp::Command( const CommandEvent& rCEvt ) +{ + switch( rCEvt.GetCommand() ) { + case COMMAND_CONTEXTMENU: + GetParent()->Command( rCEvt ); + break; + default: + pTextView->Command( rCEvt ); + } +} + + +void TextEditImp::MouseButtonDown( const MouseEvent& rMouseEvent ) +{ + pTextView->MouseButtonDown( rMouseEvent ); + HideVarContents( NULL ); + ShowTipTimer.Stop(); +} + + +void TextEditImp::MouseMove( const MouseEvent& rMEvt ) +{ + pTextView->MouseMove( rMEvt ); + HideVarContents( NULL ); + if ( rMEvt.GetButtons() == 0 ) + ShowTipTimer.Start(); + if ( rMEvt.IsLeaveWindow() ) + ShowTipTimer.Stop(); +} + + +IMPL_LINK( TextEditImp, HideVarContents, void*, EMPTYARG ) +{ + if ( nTipId ) + { + Help::HideTip( nTipId ); + nTipId = 0; + aTipWord = String(); + } + return 0; +} + +static const char cSuffixes[] = "%&!#@$"; + + +SbxBase* TextEditImp::GetSbxAtMousePos( String &aWord ) +{ + Point aPos = GetPointerPosPixel(); + Point aDocPos = pTextView->GetDocPos( aPos ); + aWord = pTextEngine->GetWord( pTextEngine->GetPaM( aDocPos ) ); + + if ( aWord.Len() && !Application::GetAppInternational().IsNumeric( aWord ) ) + { + xub_StrLen nLastChar = aWord.Len()-1; + String aSuffixes = CUniString( cSuffixes ); + if ( aSuffixes.Search( aWord.GetChar(nLastChar) ) != STRING_NOTFOUND ) + aWord.Erase( nLastChar, 1 ); + + BOOL bWasError = SbxBase::IsError(); // Da eventuell im Testtool ein Fehler geschmissen wird. + SbxBase* pSBX = StarBASIC::FindSBXInCurrentScope( aWord ); + if ( !bWasError && SbxBase::IsError() ) + SbxBase::ResetError(); + + return pSBX; + } + return NULL; +} + + +IMPL_LINK( TextEditImp, ShowVarContents, void*, EMPTYARG ) +{ + String aWord; + SbxBase* pSBX = GetSbxAtMousePos( aWord ); + String aHelpText; + Point aPos = GetPointerPosPixel(); + + if ( pSBX && pSBX->ISA( SbxVariable ) && !pSBX->ISA( SbxMethod ) ) + { + SbxVariable* pVar = (SbxVariable*)pSBX; + SbxDataType eType = pVar->GetType(); + if ( (BYTE)eType == (BYTE)SbxOBJECT ) + { + // Kann zu Absturz, z.B. bei Selections-Objekt fuehren + // Type == Object heisst nicht, dass pVar == Object! + if ( pVar->GetObject() && pVar->GetObject()->ISA( SbxObject ) ) + aHelpText = ((SbxObject*)(pVar->GetObject()))->GetClassName(); + else + aHelpText = CUniString("Object"); + } + else if ( eType & SbxARRAY ) + aHelpText = CUniString("{...}"); + else if ( (BYTE)eType != (BYTE)SbxEMPTY ) + { + aHelpText = pVar->GetName(); + if ( !aHelpText.Len() ) // Bei Uebergabeparametern wird der Name nicht kopiert + aHelpText = aWord; + aHelpText += '='; + aHelpText += pVar->GetString(); + } + } + + + if ( aHelpText.Len() && aTipPos != aPos && aTipWord != aWord ) + { + if ( nTipId ) + Help::HideTip( nTipId ); + nTipId = Help::ShowTip( this, Rectangle(), aHelpText ); + + HideTipTimer.Start(); + aTipWord = aWord; + aTipPos = aPos; + } + if ( nTipId && aTipPos != aPos ) + { + Help::HideTip( nTipId ); + nTipId = 0; + aTipWord = String(); + } + + return 0; +} + + +void TextEditImp::BuildKontextMenu( PopupMenu *&pMenu ) +{ + String aWord; + SbxBase* pSBX = GetSbxAtMousePos( aWord ); + if ( pSBX && pSBX->ISA( SbxVariable ) && !pSBX->ISA( SbxMethod ) ) + { + SbxVariable* pVar = (SbxVariable*)pSBX; + SbxDataType eType = pVar->GetType(); + + if ( ( eType & ( SbxVECTOR | SbxARRAY | SbxBYREF )) == 0 ) + { + +/* +Boolean +Currency +Date +Double +Integer +Long +Object +Single +String +Variant(Empty) +*/ + switch ( eType ) + { + case SbxBOOL: +// case SbxCURRENCY: +// case SbxDATE: + case SbxDOUBLE: + case SbxINTEGER: + case SbxLONG: +// case SbxOBJECT: // kann nicht editiert werden + case SbxSINGLE: + case SbxSTRING: + + case SbxVARIANT: // Taucht wohl auch nicht auf. stattdessen SbxEMPTY + case SbxEMPTY: + { + pAppEdit->GetBasicFrame()->SetEditVar( pVar ); + if ( !pMenu ) + pMenu = new PopupMenu(); + else + pMenu->InsertSeparator(); + + pMenu->InsertItem( RID_POPUPEDITVAR, ((BasicFrame*)GetpApp()->GetAppWindow())->GenRealString( GEN_RES_STR1( IDS_EDIT_VAR, aWord ) ) ); + } + break; + } + } + } +} + + + + +DBG_NAME(TextEdit) + +TextEdit::TextEdit( AppEdit* pParent, const WinBits& aBits ) +: aEdit( pParent, aBits | WB_NOHIDESELECTION ) +, pBreakpointWindow( NULL ) +, bFileWasUTF8( FALSE ) +, bSaveAsUTF8( FALSE ) +{ +DBG_CTOR(TextEdit,0); + Font aFont(System::GetStandardFont(STDFONT_FIXED)); + aFont.SetTransparent( FALSE ); + SetFont( aFont ); +} + +TextEdit::~TextEdit() +{DBG_DTOR(TextEdit,0);} + +void TextEdit::Highlight( ULONG nLine, xub_StrLen nCol1, xub_StrLen nCol2 ) +{ + if ( nLine ) // Kann eigentlich nicht vorkommen, außer bei Fehler 'Sub erwartet' in erster Zeile + nLine--; + + String s = aEdit.pTextEngine->GetText( nLine ); + + if( nCol1 == STRING_NOTFOUND ) + // Keine Spalte angegeben + nCol1 = 0, nCol2 = STRING_NOTFOUND; + if( nCol2 == STRING_NOTFOUND ) + { + nCol2 = s.Len(); + } + // Anpassung an den Precompiler | EditText != Compilierter Text + if ( nCol2 > s.Len() ) + nCol2 = s.Len(); + if ( nCol1 >= nCol2 ) + nCol1 = 0; + + // Da nCol2 u.U. hinter das aktuelle Statement zeigt + // (weil dort schon das naechste beginnt), muessen + // wird am Ende evtl. Whitespace, einen Doppelpunkt + // und mehr Whitespace entfernen + BOOL bColon = FALSE; + + while ( s.GetChar( nCol2 ) == ' ' && nCol2 > nCol1 && !bColon ) + { + nCol2--; + if ( s.GetChar( nCol2 ) == ':' ) + { + nCol2--; + bColon = TRUE; + } + } + + aEdit.pTextView->SetSelection( TextSelection(TextPaM(nLine,nCol2+1)) ); + aEdit.pTextView->SetSelection( TextSelection(TextPaM(nLine,nCol2+1), TextPaM(nLine,nCol1)) ); +} + + +void TextEdit::Delete(){ aEdit.pTextView->KeyInput( KeyEvent( 0, KeyCode( KEYFUNC_DELETE ) )); } +void TextEdit::Cut(){ aEdit.pTextView->Cut(); } +void TextEdit::Copy(){ aEdit.pTextView->Copy(); } +void TextEdit::Paste(){ aEdit.pTextView->Paste(); } +void TextEdit::Undo(){ aEdit.pTextView->Undo(); } +void TextEdit::Redo(){ aEdit.pTextView->Redo(); } +String TextEdit::GetSelected(){ return aEdit.pTextView->GetSelected(); } +TextSelection TextEdit::GetSelection() const{ return aEdit.pTextView->GetSelection(); } +void TextEdit::SetSelection( const TextSelection& rSelection ){ aEdit.pTextView->SetSelection( rSelection ); } + +USHORT TextEdit::GetLineNr() const +{ + return aEdit.pTextView->GetSelection().GetEnd().GetPara()+1; +} + +void TextEdit::ReplaceSelected( const String& rStr ){ aEdit.pTextView->InsertText(rStr); } +BOOL TextEdit::IsModified(){ return aEdit.IsModified(); } + +String TextEdit::GetText() const +{ + return aEdit.pTextEngine->GetText( GetSystemLineEnd() ); +} + +void TextEdit::SetText( const String& rStr ){ aEdit.pTextEngine->SetText(rStr); aEdit.pTextEngine->SetModified( FALSE ); } +void TextEdit::SetModifyHdl( Link l ){ aEdit.SetModifyHdl(l); } +BOOL TextEdit::HasText() const { return aEdit.pTextEngine->GetTextLen() > 0; } + +// Es wird entweder ab Beginn oder ab Markierungsbegin + 1 gesucht. + +BOOL TextEdit::Find( const String& s ) +{ + DBG_CHKTHIS(TextEdit,0); + + TextSelection aSelection = aEdit.pTextView->GetSelection(); + USHORT nPara = aSelection.GetStart().GetPara(); + xub_StrLen nIndex = aSelection.GetStart().GetIndex(); + + if ( aSelection.HasRange() ) + nIndex ++; + + while ( nPara <= aEdit.pTextEngine->GetParagraphCount() ) + { + String aText = aEdit.pTextEngine->GetText( nPara ); + + nIndex = aText.Search( s, nIndex ); + if( nIndex != STRING_NOTFOUND ) + { + aEdit.pTextView->SetSelection( TextSelection( TextPaM( nPara, nIndex ), TextPaM( nPara, nIndex + s.Len() ) ) ); + return TRUE; + } + nIndex = 0; + nPara++; + } + return FALSE; +} + +BOOL TextEdit::Load( const String& aName ) +{ +DBG_CHKTHIS(TextEdit,0); + BOOL bOk = TRUE; + SvFileStream aStrm( aName, STREAM_STD_READ ); + if( aStrm.IsOpen() ) + { + String aText, aLine; + BOOL bIsFirstLine = TRUE; + rtl_TextEncoding aFileEncoding = RTL_TEXTENCODING_IBM_850; + while( !aStrm.IsEof() && bOk ) + { + aStrm.ReadByteStringLine( aLine, aFileEncoding ); + if ( bIsFirstLine && aLine.EqualsAscii( TT_SIGNATURE_FOR_UNICODE_TEXTFILES ) ) + { + aFileEncoding = RTL_TEXTENCODING_UTF8; + bFileWasUTF8 = TRUE; + } + else + { + if ( !bIsFirstLine ) + aText += '\n'; + aText += aLine; + bIsFirstLine = FALSE; + } + if( aStrm.GetError() != SVSTREAM_OK ) + bOk = FALSE; + } + aText.ConvertLineEnd(); + SetText( aText ); + } + else + bOk = FALSE; + return bOk; +} + +BOOL TextEdit::Save( const String& aName ) +{ +DBG_CHKTHIS(TextEdit,0); + BOOL bOk = TRUE; + SvFileStream aStrm( aName, STREAM_STD_WRITE | STREAM_TRUNC ); + rtl_TextEncoding aFileEncoding = RTL_TEXTENCODING_IBM_850; + if( aStrm.IsOpen() ) + { + if ( bFileWasUTF8 || bSaveAsUTF8 ) + { + aStrm << TT_SIGNATURE_FOR_UNICODE_TEXTFILES; + aStrm << sal_Char(_CR); + aStrm << sal_Char(_LF); + aFileEncoding = RTL_TEXTENCODING_UTF8; + } + String aSave = GetText(); + aSave.ConvertLineEnd(LINEEND_CRLF); + aStrm << ByteString( aSave, aFileEncoding ).GetBuffer(); + if( aStrm.GetError() != SVSTREAM_OK ) + bOk = FALSE; + else + aEdit.pTextEngine->SetModified(FALSE); + } else bOk = FALSE; + return bOk; +} + + +void TextEdit::BuildKontextMenu( PopupMenu *&pMenu ) +{ + DataEdit::BuildKontextMenu( pMenu ); + aEdit.BuildKontextMenu( pMenu ); +} + + diff --git a/basic/source/app/textedit.hxx b/basic/source/app/textedit.hxx new file mode 100644 index 000000000000..a96123b507c9 --- /dev/null +++ b/basic/source/app/textedit.hxx @@ -0,0 +1,178 @@ +/************************************************************************* + * + * $RCSfile: textedit.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TEXTEDIT_HXX +#define _TEXTEDIT_HXX + +class AppEdit; +class TextEngine; +class TextView; +class TextEdit; +class BreakpointWindow; + +#ifndef _SV_TIMER_HXX //autogen +#include <vcl/timer.hxx> +#endif +#ifndef _TOOLS_TABLE_HXX //autogen +#include <tools/table.hxx> +#endif +#ifndef _TOOLS_DEBUG_HXX //autogen +#include <tools/debug.hxx> +#endif +#ifndef _SFXLSTNER_HXX //autogen +#include <svtools/lstner.hxx> +#endif +#ifdef VCL +#include <svtools/svmedit.hxx> +#endif + +#include "dataedit.hxx" + +//#include <xtextedt.hxx> + +class TextEditImp : public Window, public SfxListener +{ +protected: + void DoSyntaxHighlight( ULONG nPara ); + + +private: + AppEdit *pAppEdit; + Link ModifyHdl; + + Timer aSyntaxIdleTimer; + Timer aImplSyntaxIdleTimer; + DECL_LINK( SyntaxTimerHdl, Timer * ); + Table aSyntaxLineTable; + + void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + void ImpDoHighlight( const String& rSource, ULONG nLineOff ); + BOOL bHighlightning; + BOOL bDoSyntaxHighlight; + BOOL bDelayHighlight; + + + SbxBase* GetSbxAtMousePos( String &aWord ); + virtual void MouseMove( const MouseEvent& rMEvt ); + DECL_LINK( HideVarContents, void* ); + DECL_LINK( ShowVarContents, void* ); + Point aTipPos; + String aTipWord; + ULONG nTipId; + + Timer HideTipTimer; + Timer ShowTipTimer; + + +public: + TextEditImp( AppEdit *pParent, const WinBits& aBits ); + ~TextEditImp(); + + TextEngine *pTextEngine; + TextView *pTextView; + + void SetFont( const Font& rNewFont ); + BOOL IsModified(); + void SetModifyHdl( Link l ){ ModifyHdl = l; } + + void KeyInput( const KeyEvent& rKeyEvent ); + void Paint( const Rectangle& rRect ); + void MouseButtonUp( const MouseEvent& rMouseEvent ); + void MouseButtonDown( const MouseEvent& rMouseEvent ); +// void MouseMove( const MouseEvent& rMouseEvent ); + void Command( const CommandEvent& rCEvt ); + BOOL Drop( const DropEvent& rEvt ); + BOOL QueryDrop( DropEvent& rEvt ); + + + void DoDelayedSyntaxHighlight( xub_StrLen nPara ); + void InvalidateSyntaxHighlight(); + void SyntaxHighlight( BOOL bNew ); + void BuildKontextMenu( PopupMenu *&pMenu ); +}; + + + +DBG_NAMEEX(TextEdit) +class TextEdit : public DataEdit { + + BreakpointWindow *pBreakpointWindow; + BOOL bFileWasUTF8; + BOOL bSaveAsUTF8; + +public: + TextEdit( AppEdit*, const WinBits& ); + ~TextEdit(); + void Highlight( ULONG nLine, xub_StrLen nCol1, xub_StrLen nCol2 ); + TextEditImp& GetTextEditImp() { return aEdit; } + + void SetBreakpointWindow( BreakpointWindow *pBPWindow ){ pBreakpointWindow = pBPWindow; } + BreakpointWindow *GetBreakpointWindow(){ return pBreakpointWindow; } + + DATA_FUNC_DEF( aEdit, TextEditImp ) + + virtual void BuildKontextMenu( PopupMenu *&pMenu ); + + void SaveAsUTF8( BOOL bUTF8 ) { bSaveAsUTF8 = bUTF8; } +}; + +#endif diff --git a/basic/source/app/ttbasic.cxx b/basic/source/app/ttbasic.cxx new file mode 100644 index 000000000000..c80ecae055ca --- /dev/null +++ b/basic/source/app/ttbasic.cxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * $RCSfile: ttbasic.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#include "mybasic.hxx" +#include "ttbasic.hxx" + +MyBasic* TTBasic::CreateMyBasic() +{ + return new MyBasic; diff --git a/basic/source/app/ttbasic.hxx b/basic/source/app/ttbasic.hxx new file mode 100644 index 000000000000..1dc5fbeb7b09 --- /dev/null +++ b/basic/source/app/ttbasic.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * $RCSfile: ttbasic.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +class TTBasic +{ +public: + static MyBasic* CreateMyBasic(); +}; + diff --git a/basic/source/app/ttmsg.src b/basic/source/app/ttmsg.src new file mode 100644 index 000000000000..c19e892d5243 --- /dev/null +++ b/basic/source/app/ttmsg.src @@ -0,0 +1,659 @@ +/************************************************************************* + * + * $RCSfile: ttmsg.src,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#include "ttmsg.hrc" + + +// Hier sind die Messages aus dem Verzeichnis /basic/source/testtool enhalten + + +/////////////////////////////// +// Fehlermeldungen, die in das Resultfile gelangen. +// ********************* +// *** !!ACHTUNG!! *** +// ********************* +// Die Nummern dürfen sich NIE! ändern, +// da sie in den Resultfiles gespeichert sind, und bei erneutem Anzeigen +// statdessen die entsprechenden neuen oder garkeine Strings angzeigt werden. +/////////////////////////////// +String S_NAME_NOT_THERE +{ + Text = "Name nicht vorhanden: #($Arg1)"; + Text[ english_us ] = "Name doesn't exist: #($Arg1)"; + Text[ portuguese ] = "Nome inexistente: #($Arg1)"; + Text[ russian ] = "Name doesn't exist: #($Arg1)"; + Text[ greek ] = "Name doesn't exist: #($Arg1)"; + Text[ dutch ] = "Naam bestaat niet: #($Arg1)"; + Text[ french ] = "Nom inexistant : #($Arg1)"; + Text[ spanish ] = "El nombre no existe: #($Arg1)"; + Text[ italian ] = "Name doesn't exist: #($Arg1)"; + Text[ danish ] = "Name doesn't exist: #($Arg1)"; + Text[ swedish ] = "Name doesn't exist: #($Arg1)"; + Text[ polish ] = "Nazwa nie istnieje: #($Arg1)"; + Text[ portuguese_brazilian ] = "Name nicht vorhanden: #($Arg1)"; + Text[ japanese ] = "‚±‚Ì–¼‘O‚Í‘¶Ý‚µ‚Ä‚¢‚Ü‚¹‚ñ: #($Arg1)"; + Text[ korean ] = "À̸§ÀÌ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù: #($Arg1)"; + Text[ chinese_simplified ] = "Ãû³Æ²»´æÔÚ£º#($Arg1)"; + Text[ chinese_traditional ] = "¦WºÙ¤£¦s¦b¡G #($Arg1)"; + Text[ arabic ] = "Name doesn't exist: #($Arg1)"; + Text[ turkish ] = "Name doesn't exist: #($Arg1)"; +}; +String S_DOUBLE_NAME +{ + Text = "Name Doppelt: ($Arg1)"; + Text[ english_us ] = "Name double: ($Arg1)"; + Text[ portuguese ] = "Nome duplo: ($Arg1)"; + Text[ russian ] = "Name double: ($Arg1)"; + Text[ greek ] = "Name double: ($Arg1)"; + Text[ dutch ] = "Dubbele naam: ($Arg1)"; + Text[ french ] = "Nome double : ($Arg1)"; + Text[ spanish ] = "Nombre doble: ($Arg1)"; + Text[ italian ] = "Name double: ($Arg1)"; + Text[ danish ] = "Name double: ($Arg1)"; + Text[ swedish ] = "Name double: ($Arg1)"; + Text[ polish ] = "Podwójna nazwa: ($Arg1)"; + Text[ portuguese_brazilian ] = "Name Doppelt: ($Arg1)"; + Text[ japanese ] = "–¼‘O‚ªd•¡‚µ‚Ä‚¢‚Ü‚·: ($Arg1)"; + Text[ korean ] = "À̸§ÀÌ Áߺ¹µÇ¾ú½À´Ï´Ù. : ($Arg1)"; + Text[ chinese_simplified ] = "Ë«ÖØÃû³Æ£º($Arg1)"; + Text[ chinese_traditional ] = "¦WºÙÂù«¡G($Arg1)"; + Text[ arabic ] = "Name double: ($Arg1)"; + Text[ turkish ] = "Name double: ($Arg1)"; +}; +String S_READING_FILE +{ + Text = "Einlesen der Dateien"; + Text[ english_us ] = "Reading the files"; + Text[ portuguese ] = "Leitura dos ficheiros"; + Text[ russian ] = "Reading the files"; + Text[ greek ] = "Reading the files"; + Text[ dutch ] = "Bestanden lezen"; + Text[ french ] = "Lecture des fichiers"; + Text[ spanish ] = "Leyendo los archivos"; + Text[ italian ] = "Reading the files"; + Text[ danish ] = "Reading the files"; + Text[ swedish ] = "Reading the files"; + Text[ polish ] = "Czytanie plików"; + Text[ portuguese_brazilian ] = "Einlesen der Dateien"; + Text[ japanese ] = "̧²Ù‚̓ǂݞ‚Ý"; + Text[ korean ] = "ÆÄÀÏ Àбâ"; + Text[ chinese_simplified ] = "¶ÁÈ¡Îļþ"; + Text[ chinese_traditional ] = "Ū¨úÀÉ®×"; + Text[ arabic ] = "Reading the files"; + Text[ turkish ] = "Reading the files"; +}; +String S_CANNOT_OPEN_FILE +{ + Text = "Kann Datei nicht Öffnen: ($Arg1)"; + Text[ english_us ] = "File cannot be opened: ($Arg1)"; + Text[ portuguese ] = "Impossível abrir ficheiro: ($Arg1)"; + Text[ russian ] = "File cannot be opened: ($Arg1)"; + Text[ greek ] = "File cannot be opened: ($Arg1)"; + Text[ dutch ] = "Kan bestand niet openen: ($Arg1)"; + Text[ french ] = "Impossible d'ouvrir le fichier : ($Arg1)"; + Text[ spanish ] = "No se puede abrir el archivo: ($Arg1)"; + Text[ italian ] = "File cannot be opened: ($Arg1)"; + Text[ danish ] = "File cannot be opened: ($Arg1)"; + Text[ swedish ] = "File cannot be opened: ($Arg1)"; + Text[ polish ] = "Nie mo¿e otworzyæ pliku: ($Arg1)"; + Text[ portuguese_brazilian ] = "Kann Datei nicht Öffnen: ($Arg1)"; + Text[ japanese ] = "̧²Ù‚ªŠJ‚¯‚ç‚ê‚Ü‚¹‚ñ: ($Arg1)"; + Text[ korean ] = "ÆÄÀÏÀÌ ¿¸®Áö ¾Ê½À´Ï´Ù: ($Arg1)"; + Text[ chinese_simplified ] = "ÎÞ·¨´ò¿ªÎļþ£º($Arg1)"; + Text[ chinese_traditional ] = "µLªk¶}±ÒÀɮסG ($Arg1)"; + Text[ arabic ] = "File cannot be opened: ($Arg1)"; + Text[ turkish ] = "File cannot be opened: ($Arg1)"; +}; +String S_INVALID_LINE +{ + Text = "Zeile \"($Arg1)\" Ist ungültig."; + Text[ english_us ] = "Line \"($Arg1)\" is invalid."; + Text[ portuguese ] = "A linha \"($Arg1)\" não é válida."; + Text[ russian ] = "Line \"($Arg1)\" is invalid."; + Text[ greek ] = "Line \"($Arg1)\" is invalid."; + Text[ dutch ] = "Regel \"($Arg1)\" is ongeldig."; + Text[ french ] = "Ligne \"($Arg1)\" non valable."; + Text[ spanish ] = "La línea \"($Arg1)\" no es válida."; + Text[ italian ] = "Line \"($Arg1)\" is invalid."; + Text[ danish ] = "Line \"($Arg1)\" is invalid."; + Text[ swedish ] = "Line \"($Arg1)\" is invalid."; + Text[ polish ] = "Wiersz \"($Arg1)\" jest niewa¿ny."; + Text[ portuguese_brazilian ] = "Zeile \"($Arg1)\" Ist ungültig."; + Text[ japanese ] = "s \"($Arg1)\" ‚Í–³Œø‚Å‚·B"; + Text[ korean ] = "¼± \"($Arg1)\" Àº À¯È¿ÇÏÁö ¾Ê½À´Ï´Ù."; + Text[ chinese_simplified ] = "ÎÞЧµÄÐС°($Arg1)¡±"; + Text[ chinese_traditional ] = "¦æ \"($Arg1)\" µL®Ä¡C"; + Text[ arabic ] = "Line \"($Arg1)\" is invalid."; + Text[ turkish ] = "Line \"($Arg1)\" is invalid."; +}; +String S_SHORTNAME_UNKNOWN +{ + Text = "Kurzname Unbekannt beim Kopieren: ($Arg1)"; + Text[ english_us ] = "Short name unknown during copying: ($Arg1)"; + Text[ portuguese ] = "Abreviatura desconhecida ao copiar: ($Arg1)"; + Text[ russian ] = "Short name unknown during copying: ($Arg1)"; + Text[ greek ] = "Short name unknown during copying: ($Arg1)"; + Text[ dutch ] = "Afkorting onbekend bij kopiëren: ($Arg1)"; + Text[ french ] = "Abréviation inconnue lors de la copie : ($Arg1)"; + Text[ spanish ] = "Abreviatura desconocida al copiar: ($Arg1)"; + Text[ italian ] = "Short name unknown during copying: ($Arg1)"; + Text[ danish ] = "Short name unknown during copying: ($Arg1)"; + Text[ swedish ] = "Short name unknown during copying: ($Arg1)"; + Text[ polish ] = "Skrót nazwy nieznany podczas kopiowania: ($Arg1)"; + Text[ portuguese_brazilian ] = "Kurzname Unbekannt beim Kopieren: ($Arg1)"; + Text[ japanese ] = "Short name unknown during copying: ($Arg1)"; + Text[ korean ] = "º¹»çµÇ´Â µ¿¾È ¾Ë¼ö ¾ø´Â ªÀº À̸§: ($Arg1)"; + Text[ chinese_simplified ] = "¸´ÖÆÊ±²»Ã÷µÄ¼ò³Æ£º($Arg1)"; + Text[ chinese_traditional ] = "Î`¨î®Éµu¦WºÙ¤£©ú¡G($Arg1)"; + Text[ arabic ] = "Short name unknown during copying: ($Arg1)"; + Text[ turkish ] = "Short name unknown during copying: ($Arg1)"; +}; +String S_LONGNAME_UNKNOWN +{ + Text = "Kurzname Unbekannt beim Kopieren: ($Arg1)"; + Text[ english_us ] = "Short name unknown during copying: ($Arg1)"; + Text[ portuguese ] = "Abreviatura desconhecida ao copiar: ($Arg1)"; + Text[ russian ] = "Short name unknown during copying: ($Arg1)"; + Text[ greek ] = "Short name unknown during copying: ($Arg1)"; + Text[ dutch ] = "Afkorting onbekend bij kopiëren: ($Arg1)"; + Text[ french ] = "Abréviation inconnue lors de la copie : ($Arg1)"; + Text[ spanish ] = "Abreviatura desconocida al copiar: ($Arg1)"; + Text[ italian ] = "Short name unknown during copying: ($Arg1)"; + Text[ danish ] = "Short name unknown during copying: ($Arg1)"; + Text[ swedish ] = "Short name unknown during copying: ($Arg1)"; + Text[ polish ] = "Skrót nazwy nieznany podczas kopiowania: ($Arg1)"; + Text[ portuguese_brazilian ] = "Kurzname Unbekannt beim Kopieren: ($Arg1)"; + Text[ japanese ] = "Short name unknown during copying: ($Arg1)"; + Text[ korean ] = "º¹»çµÇ´Â µ¿¾È ¾Ë¼ö ¾ø´Â ªÀº À̸§: ($Arg1)"; + Text[ chinese_simplified ] = "¸´ÖÆÊ±²»Ã÷µÄ¼ò³Æ£º($Arg1)"; + Text[ chinese_traditional ] = "Î`¨î®Éµu¦WºÙ¤£©ú¡G($Arg1)"; + Text[ arabic ] = "Short name unknown during copying: ($Arg1)"; + Text[ turkish ] = "Short name unknown during copying: ($Arg1)"; +}; +String S_FIRST_SHORTNAME_REQ_ASTRX +{ + Text = "Erster Kurzname muss mit * beginnen. Überspringe."; + Text[ english_us ] = "First short name must start with * . Ignore."; + Text[ portuguese ] = "A primeira abreviatura deverá começar com *. Ignorar."; + Text[ russian ] = "First short name must start with * . Leave out."; + Text[ greek ] = "First short name must start with * . Ignore."; + Text[ dutch ] = "Eerste afkorting moet beginnen met *. Overslaan."; + Text[ french ] = "La première abréviation doit commencer par *. Ignorer."; + Text[ spanish ] = "La primera abreviatura debe comenzar con *. Ignorar."; + Text[ italian ] = "First short name must start with * . Ignore."; + Text[ danish ] = "First short name must start with *. Ignore. "; + Text[ swedish ] = "First short name must start with * . Ignore."; + Text[ polish ] = "Pierwszy skrót nazwy musi siê zaczynaæ na * . Omiñ."; + Text[ portuguese_brazilian ] = "Erster Kurzname muß mit * beginnen. Überspringe."; + Text[ japanese ] = "First short name must start with * . Ignore."; + Text[ korean ] = "ù¹øÂ° ªÀº À̸§Àº ¹Ýµå½Ã * . Ignore°ú ÇÔ²² ½ÃÀÛ µÇ¾î¾ß ÇÕ´Ï´Ù."; + Text[ chinese_simplified ] = "µÚÒ»¸ö¼ò³Æ±ØÐëÒÔ * ¿ªÍ·¡£Ê¡ÂÔ¡£"; + Text[ chinese_traditional ] = "²Ä¤@Óµu¦WºÙ¥²¶·¥H * ¶}©l¡C©¿²¤¡C"; + Text[ arabic ] = "First short name must start with * . Leave out."; + Text[ turkish ] = "First short name must start with * . Ignore."; +}; +String S_TIMOUT_WAITING +{ + Text = "Server Timeout beim Warten auf Antwort. Sequenz Nr: ($Arg1)"; + Text[ english_us ] = "Server Timeout while waiting for answer. Sequence No: ($Arg1)"; + Text[ portuguese ] = "Server Timeout ao esperar pela resposta. Sequência nº: ($Arg1)"; + Text[ russian ] = "Server Timeout while waiting for answer. Sequence No: ($Arg1)"; + Text[ greek ] = "Server Timeout while waiting for answer. Sequence No: ($Arg1)"; + Text[ dutch ] = "Server timeout bij het wachten op antwoord. Sequentie nr: ($Arg1)"; + Text[ french ] = "Timeout du serveur lors de l'attente de la réponse. N° de séquence : ($Arg1)"; + Text[ spanish ] = "Server Timeout al esperar por respuesta. Secuencia núm.: ($Arg1)"; + Text[ italian ] = "Server Timeout while waiting for answer. Sequence No: ($Arg1)"; + Text[ danish ] = "Server Timeout while waiting for answer. Sequence No: ($Arg1)"; + Text[ swedish ] = "Server Timeout while waiting for answer. Sequence No: ($Arg1)"; + Text[ polish ] = "Server Timeout podczas czekania na odpowiedŸ. Numer sekwencji: ($Arg1)"; + Text[ portuguese_brazilian ] = "Server Timeout beim Warten auf Antwort. Sequenz Nr: ($Arg1)"; + Text[ japanese ] = "‰ž“š‘Ò‚¿‚ÌÛ‚Ì»°ÊÞ°‚ÌÀ²Ñ±³ÄB¼°¹Ý½No.: ($Arg1)"; + Text[ korean ] = "ÀÀ´äÀ» ±â´Ù¸®´Â µ¿¾È ¼¹ö ŸÀÓ ¾Æ¿ô. ÀÏ·Ã ¹øÈ£: ($Arg1)"; + Text[ chinese_simplified ] = "ÔڵȺò´ð¸´Ê±·þÎñÆ÷³¬Ê±¡£ÐòÁкţº($Arg1)"; + Text[ chinese_traditional ] = "¦øªA¾¹µ¥ÔµªÎ`¶W®É¡C§Ç¦C¸¹½X¡G ($Arg1)"; + Text[ arabic ] = "Server Timeout while waiting for answer. Sequence No: ($Arg1)"; + Text[ turkish ] = "Server Timeout while waiting for answer. Sequence No: ($Arg1)"; +}; +String S_APPLICATION_RESTARTED +{ + Text = "Applikation wurde neu gestartet."; + Text[ english_us ] = "Application has been restarted."; + Text[ portuguese ] = "A aplicação foi reiniciada."; + Text[ russian ] = "Application has been restarted."; + Text[ greek ] = "Application has been restarted."; + Text[ dutch ] = "Applicatie werd opnieuw gestart"; + Text[ french ] = "L'application a été redémarrée."; + Text[ spanish ] = "Se reinició la aplicación."; + Text[ italian ] = "Application has been restarted."; + Text[ danish ] = "Application has been restarted."; + Text[ swedish ] = "Application has been restarted."; + Text[ polish ] = "Aplikacja zosta³a ponownie uruchomiona."; + Text[ portuguese_brazilian ] = "Applikation wurde neu gestartet."; + Text[ japanese ] = "±Ìߨ¹°¼®Ý‚ÍĽÀ°Ä‚³‚ê‚Ü‚µ‚½B"; + Text[ korean ] = "ÀÀ¿ëÇÁ·Î±×·¥ÀÌ ´Ù½Ã ½ÃÀÛ µÇ¾ú½À´Ï´Ù."; + Text[ chinese_simplified ] = "Ó¦ÓóÌÐòÒÑ¾ÖØÐÂÆô¶¯¡£"; + Text[ chinese_traditional ] = "«·s±Ò°Ê¤FÀ³¥Îµ{¦¡¡C"; + Text[ arabic ] = "Application has been restarted."; + Text[ turkish ] = "Application has been restarted."; +}; +String S_APPLICATION_START_FAILED +{ + Text = "Applikation \"($Arg1)\" kann nicht gestartet werden. "; + Text[ english_us ] = "Application \"($Arg1)\" cannot be started. "; + Text[ portuguese ] = "Impossível iniciar a aplicação \"($Arg1)\". "; + Text[ russian ] = "Application \"($Arg1)\" cannot be started. "; + Text[ greek ] = "Application \"($Arg1)\" cannot be started. "; + Text[ dutch ] = "Applicatie \"($Arg1)\" kan niet worden gestart. "; + Text[ french ] = "Impossible de lancer l'application \"($Arg1)\". "; + Text[ spanish ] = "No se puede iniciar la aplicación \"($Arg1)\". "; + Text[ italian ] = "Application \"($Arg1)\" cannot be started. "; + Text[ danish ] = "Application \"($Arg1)\" cannot be started. "; + Text[ swedish ] = "Application \"($Arg1)\" cannot be started. "; + Text[ polish ] = "Nie mo¿na uruchomiæ aplikacji \"($Arg1)\". "; + Text[ portuguese_brazilian ] = "Applikation \"($Arg1)\" kann nicht gestartet werden. "; + Text[ japanese ] = "±Ìߨ¹°¼®Ý \"($Arg1)\" ‚ͽÀ°Ä‚Å‚«‚Ü‚¹‚ñB "; + Text[ korean ] = "ÀÀ¿ëÇÁ·Î±×·¥ \"($Arg1)\" °¡ ½ÃÀ۵ɼö ¾ø½À´Ï´Ù. "; + Text[ chinese_simplified ] = "ÎÞ·¨Æô¶¯Ó¦ÓóÌÐò¡°($Arg1)¡±¡£ "; + Text[ chinese_traditional ] = "µLªk±Ò°ÊÀ³¥Îµ{¦¡ \"($Arg1)\" ¡C "; + Text[ arabic ] = "Application \"($Arg1)\" cannot be started. "; + Text[ turkish ] = "Application \"($Arg1)\" cannot be started. "; +}; +String S_TIMOUT_SENDING +{ + Text = "Server Timeout beim Senden. Sequenz Nr: ($Arg1)"; + Text[ english_us ] = "Server Timeout while sending. Sequence No: ($Arg1)"; + Text[ portuguese ] = "Server Timeout ao enviar. Sequência nº: ($Arg1)"; + Text[ russian ] = "Server Timeout while sending. Sequence No: ($Arg1)"; + Text[ greek ] = "Server Timeout while sending. Sequence No: ($Arg1)"; + Text[ dutch ] = "Server timeout bij het zenden. Sequentie nr: ($Arg1)"; + Text[ french ] = "Timeout du serveur lors de l'envoi. N° de séquence : ($Arg1)"; + Text[ spanish ] = "Server Timeout al enviar. Secuencia núm.: ($Arg1)"; + Text[ italian ] = "Server Timeout while sending. Sequence No: ($Arg1)"; + Text[ danish ] = "Server Timeout while sending. Sequence No: ($Arg1)"; + Text[ swedish ] = "Server Timeout while sending. Sequence No: ($Arg1)"; + Text[ polish ] = "Server Timeout podczas wysy³ania. Numer sekwencji: ($Arg1)"; + Text[ portuguese_brazilian ] = "Server Timeout beim Senden. Sequenz Nr: ($Arg1)"; + Text[ japanese ] = "‘—M‚ÌÛ‚Ì»°ÊÞ°‚ÌÀ²Ñ±³ÄB¼°¹Ý½No.: ($Arg1)"; + Text[ korean ] = "º¸³»´Â µ¿¾È ¼¹ö ŸÀÓ ¾Æ¿ô. ÀÏ·Ã ¹øÈ£: ($Arg1)"; + Text[ chinese_simplified ] = "Ôڼķ¢Ê±·þÎñÆ÷³¬Ê±¡£ÐòÁкţº($Arg1)"; + Text[ chinese_traditional ] = "¦øªA¾¹µo°e®É¶W®É¡C§Ç¦C¸¹½X¡G ($Arg1)"; + Text[ arabic ] = "Server Timeout while sending. Sequence No: ($Arg1)"; + Text[ turkish ] = "Server Timeout while sending. Sequence No: ($Arg1)"; +}; +String S_NO_CONNECTION +{ + Text = "Keine Verbindung. Sequenz Nr: ($Arg1)"; + Text[ english_us ] = "No connection. Sequence No: ($Arg1)"; + Text[ portuguese ] = "Sem ligação. Sequência nº: ($Arg1)"; + Text[ russian ] = "No connection. Sequence No: ($Arg1)"; + Text[ greek ] = "No connection. Sequence No: ($Arg1)"; + Text[ dutch ] = "Geen verbinding. Sequentie nr: ($Arg1)"; + Text[ french ] = "Aucune connexion. N° de séquence : ($Arg1)"; + Text[ spanish ] = "Sin conexión. Secuencia núm.: ($Arg1)"; + Text[ italian ] = "No connection. Sequence No: ($Arg1)"; + Text[ danish ] = "No connection. Sequence No: ($Arg1)"; + Text[ swedish ] = "No connection. Sequence No: ($Arg1)"; + Text[ polish ] = "Brak po³¹czenia. Numer sekwencji: ($Arg1)"; + Text[ portuguese_brazilian ] = "Keine Verbindung. Sequenz Nr: ($Arg1)"; + Text[ japanese ] = "Ú‘±‚È‚µB¼°¹Ý½No.: ($Arg1)"; + Text[ korean ] = "Á¢¼ÓÀÌ ¾ÈµÇ¾ú½À´Ï´Ù. ÀϷùøÈ£: ($Arg1)"; + Text[ chinese_simplified ] = "ûÓÐÁ¬½Ó¡£ÐòÁкţº($Arg1)"; + Text[ chinese_traditional ] = "µLªk³s½u¡C§Ç¦C¸¹½X¡G($Arg1)"; + Text[ arabic ] = "No connection. Sequence No: ($Arg1)"; + Text[ turkish ] = "No connection. Sequence No: ($Arg1)"; +}; +String S_NO_FILES_FOUND +{ + Text = "Keine ($Arg1) Dateien gefunden"; + Text[ english_us ] = "No ($Arg1) files found"; + Text[ portuguese ] = "Não foram encontrados quaisquer ficheiros ($Arg1)"; + Text[ russian ] = "No ($Arg1) files found"; + Text[ greek ] = "No ($Arg1) files found"; + Text[ dutch ] = "Geen ($Arg1) bestanden gevonden"; + Text[ french ] = "Aucun fichier ($Arg1) détecté"; + Text[ spanish ] = "No se encontró ningún archivo ($Arg1)"; + Text[ italian ] = "No ($Arg1) files found"; + Text[ danish ] = "No ($Arg1) files found"; + Text[ swedish ] = "No ($Arg1) files found"; + Text[ polish ] = "Nie znaleziono plików ($Arg1)"; + Text[ portuguese_brazilian ] = "Keine ($Arg1) Dateien gefunden"; + Text[ japanese ] = "($Arg1)̧²Ù‚ÍŒ©‚‚©‚è‚Ü‚¹‚ñB"; + Text[ korean ] = "($Arg1) ÆÄÀÏÀÌ ¹ß°ßµÇÁö ¾Ê½À´Ï´Ù."; + Text[ chinese_simplified ] = "ûÓÐÕÒµ½ ($Arg1) Îļþ"; + Text[ chinese_traditional ] = "¨S¦³§ä¨ì ($Arg1) ÀÉ®×"; + Text[ arabic ] = "No ($Arg1) files found"; + Text[ turkish ] = "No ($Arg1) files found"; +}; +String S_ERRORS_DETECTED +{ + Text = "** ($Arg1) Fehler aufgetreten"; + Text[ english_us ] = "** ($Arg1) errors occurred"; + Text[ portuguese ] = "** ($Arg1): erros ocorridos"; + Text[ russian ] = "** ($Arg1) errors occurred"; + Text[ greek ] = "** ($Arg1) errors occurred"; + Text[ dutch ] = "** ($Arg1) fout opgetreden"; + Text[ french ] = "** ($Arg1) : Erreurs survenues"; + Text[ spanish ] = "** Ha ocurrido el error ($Arg1)"; + Text[ italian ] = "** ($Arg1) errors occurred"; + Text[ danish ] = "** ($Arg1) errors occurred"; + Text[ swedish ] = "** ($Arg1) errors occurred"; + Text[ polish ] = "** Wyst¹pi³o ($Arg1) b³êdów"; + Text[ portuguese_brazilian ] = "** ($Arg1) Fehler aufgetreten"; + Text[ japanese ] = "** ($Arg1) ‚Ì´×°”¶"; + Text[ korean ] = "** ($Arg1) ¿À·ù ¹ß»ý"; + Text[ chinese_simplified ] = "·¢ÉúÁË** ($Arg1) ´íÎó"; + Text[ chinese_traditional ] = "** ($Arg1) ¿ù»~"; + Text[ arabic ] = "** ($Arg1) errors occurred"; + Text[ turkish ] = "** ($Arg1) errors occurred"; +}; +String S_NO_ERRORS_DETECTED +{ + Text = "** Keine Fehler aufgetreten"; + Text[ english_us ] = "** No errors have occurred"; + Text[ portuguese ] = "**Não ocorreram erros"; + Text[ russian ] = "** No errors have occurred"; + Text[ greek ] = "** No errors have occurred"; + Text[ dutch ] = "** Geen fouten opgetreden"; + Text[ french ] = "** Aucune erreur n'est survenue"; + Text[ spanish ] = "** No ha ocurrido ningún error"; + Text[ italian ] = "** No errors have occurred"; + Text[ danish ] = "** No errors have occurred"; + Text[ swedish ] = "** No errors have occurred"; + Text[ polish ] = "** Nie wyst¹pi³y ¿adne b³êdy"; + Text[ portuguese_brazilian ] = "** Keine Fehler aufgetreten"; + Text[ japanese ] = "** ´×°‚È‚µ"; + Text[ korean ] = "** ¹ß»ýµÈ ¿À·ù°¡ ¾ø½À´Ï´Ù."; + Text[ chinese_simplified ] = "** ûÓгöÏÖ´íÎó"; + Text[ chinese_traditional ] = "** ¨S¦³¥X²{¿ù»~"; + Text[ arabic ] = "** No errors have occurred"; + Text[ turkish ] = "** No errors have occurred"; +}; +String S_WARNINGS_DETECTED +{ + Text = "** ($Arg1) Warnungen aufgetreten"; + Text[ english_us ] = "** ($Arg1) warnings occurred"; + Text[ portuguese ] = "** ($Arg1): erros ocorridos"; + Text[ russian ] = "** ($Arg1) warnings occurred"; + Text[ greek ] = "** ($Arg1) warnings occurred"; + Text[ dutch ] = "** ($Arg1) waarschuwingen weergegeven"; + Text[ french ] = "** ($Arg1) : Avertissements survenus"; + Text[ spanish ] = "** Han aparecido las advertencias ($Arg1)"; + Text[ italian ] = "** ($Arg1) warnings occurred"; + Text[ danish ] = "** ($Arg1) warnings occurred"; + Text[ swedish ] = "** ($Arg1) warnings occurred"; + Text[ polish ] = "** Wyst¹pi³o ($Arg1) ostrze¿eñ"; + Text[ portuguese_brazilian ] = "** ($Arg1) Warnungen aufgetreten"; + Text[ japanese ] = "** ($Arg1) ‚ÌŒx”¶"; + Text[ korean ] = "** ($Arg1) °æ°í ¹ß»ý"; + Text[ chinese_simplified ] = "·¢ÉúÁË** ($Arg1) ¾¯¸æ"; + Text[ chinese_traditional ] = "** ($Arg1) ĵ§i"; + Text[ arabic ] = "** ($Arg1) warnings occurred"; + Text[ turkish ] = "** ($Arg1) warnings occurred"; +}; +String S_NO_WARNINGS_DETECTED +{ + Text = "** Keine Warnungen aufgetreten"; + Text[ english_us ] = "** No warnings have occurred"; + Text[ portuguese ] = "**Não ocorreram quaisquer erros"; + Text[ russian ] = "** No warnings have occurred"; + Text[ greek ] = "** No warnings have occurred"; + Text[ dutch ] = "** Geen waarschuwingen weergegeven"; + Text[ french ] = "** Aucun avertissement n'est survenu"; + Text[ spanish ] = "** No han aparecido advertencias"; + Text[ italian ] = "** No warnings have occurred"; + Text[ danish ] = "** No warnings have occurred"; + Text[ swedish ] = "** No warnings have occurred"; + Text[ polish ] = "** Nie wyst¹pi³y ¿adne ostrze¿enia"; + Text[ portuguese_brazilian ] = "** Keine Warnungen aufgetreten"; + Text[ japanese ] = "** Œx‚È‚µ"; + Text[ korean ] = "** ¹ß»ýµÈ °æ°í°¡ ¾ø½À´Ï´Ù."; + Text[ chinese_simplified ] = "** ûÓгöÏÖ¾¯¸æ"; + Text[ chinese_traditional ] = "** ¨S¦³Äµ§i"; + Text[ arabic ] = "** No warnings have occurred"; + Text[ turkish ] = "** No warnings have occurred"; +}; +String S_INCLUDE_FILE_WARNINGS_DETECTED +{ + Text = "** ($Arg1) Warnungen bei der Initialisierung aufgetreten"; + Text[ english_us ] = "** ($Arg1) warnings occurred"; + Text[ portuguese ] = "** ($Arg1): erros ocorridos"; + Text[ russian ] = "** ($Arg1) warnings occurred"; + Text[ greek ] = "** ($Arg1) warnings occurred"; + Text[ dutch ] = "** ($Arg1) waarschuwingen weergegeven"; + Text[ french ] = "** ($Arg1) : Avertissements survenus"; + Text[ spanish ] = "** Han aparecido las advertencias ($Arg1)"; + Text[ italian ] = "** ($Arg1) warnings occurred"; + Text[ danish ] = "** ($Arg1) warnings occurred"; + Text[ swedish ] = "** ($Arg1) warnings occurred"; + Text[ polish ] = "** Wyst¹pi³o ($Arg1) ostrze¿eñ"; + Text[ portuguese_brazilian ] = "** ($Arg1) Warnungen aufgetreten"; + Text[ japanese ] = "** ($Arg1) ‚ÌŒx”¶"; + Text[ korean ] = "** ($Arg1) °æ°í ¹ß»ý"; + Text[ chinese_simplified ] = "·¢ÉúÁË** ($Arg1) ¾¯¸æ"; + Text[ chinese_traditional ] = "** ($Arg1) ĵ§i"; + Text[ arabic ] = "** ($Arg1) warnings occurred"; + Text[ turkish ] = "** ($Arg1) warnings occurred"; +}; +String S_NO_INCLUDE_FILE_WARNINGS_DETECTED +{ + Text = "** Keine Warnungen bei der Initialisierung aufgetreten"; + Text[ english_us ] = "** No warnings have occurred"; + Text[ portuguese ] = "**Não ocorreram quaisquer erros"; + Text[ russian ] = "** No warnings have occurred"; + Text[ greek ] = "** No warnings have occurred"; + Text[ dutch ] = "** Geen waarschuwingen weergegeven"; + Text[ french ] = "** Aucun avertissement n'est survenu"; + Text[ spanish ] = "** No han aparecido advertencias"; + Text[ italian ] = "** No warnings have occurred"; + Text[ danish ] = "** No warnings have occurred"; + Text[ swedish ] = "** No warnings have occurred"; + Text[ polish ] = "** Nie wyst¹pi³y ¿adne ostrze¿enia"; + Text[ portuguese_brazilian ] = "** Keine Warnungen aufgetreten"; + Text[ japanese ] = "** Œx‚È‚µ"; + Text[ korean ] = "** ¹ß»ýµÈ °æ°í°¡ ¾ø½À´Ï´Ù."; + Text[ chinese_simplified ] = "** ûÓгöÏÖ¾¯¸æ"; + Text[ chinese_traditional ] = "** ¨S¦³Äµ§i"; + Text[ arabic ] = "** No warnings have occurred"; + Text[ turkish ] = "** No warnings have occurred"; +}; +String S_UNKNOWN_SLOT_CONTROL +{ + Text = "Slot/Control unbekannt :\"($Arg1)\""; + Text[ english_us ] = "Slot/Control unknown :\"($Arg1)\""; + Text[ portuguese ] = "Slot/Control desconhecido :\"($Arg1)\""; + Text[ russian ] = "Slot/Control unknown :\"($Arg1)\""; + Text[ greek ] = "Slot/Control unknown :\"($Arg1)\""; + Text[ dutch ] = "Slot/Control onbekend :\"($Arg1)\""; + Text[ french ] = "Slot/Control inconnu : \"($Arg1)\""; + Text[ spanish ] = "Slot/Control desconocido :\"($Arg1)\""; + Text[ italian ] = "Slot/Control unknown :\"($Arg1)\""; + Text[ danish ] = "Slot/Control unknown :\"($Arg1)\""; + Text[ swedish ] = "Slot/Control unknown :\"($Arg1)\""; + Text[ polish ] = "Nieznany Slot/Control :\"($Arg1)\""; + Text[ portuguese_brazilian ] = "Slot/Control unbekannt :\"($Arg1)\""; + Text[ japanese ] = "½Û¯Ä/ºÝÄÛ°Ù‚ª‚í‚©‚è‚Ü‚¹‚ñ:\"($Arg1)\""; + Text[ korean ] = "¾Ë¼ö ¾ø´Â ½½·Ô/ÄÁÆ®·Ñ :\"($Arg1)\""; + Text[ chinese_simplified ] = "²»Ã÷µÄ Slot/Control£º\"($Arg1)\""; + Text[ chinese_traditional ] = "Slot/Control ¤£©ú¡G\"($Arg1)\""; + Text[ arabic ] = "Slot/Control unknown :\"($Arg1)\""; + Text[ turkish ] = "Slot/Control unknown :\"($Arg1)\""; +}; +String S_RETURN_SEQUENCE_MISSMATCH +{ + Text = "Return Stream mit falscher Sequenz: ($Arg1) statt ($Arg2)"; + Text[ english_us ] = "Return Stream has wrong sequence: ($Arg1) instead of ($Arg2)"; + Text[ portuguese ] = "Return Stream com sequência incorrecta: ($Arg1) em lugar de ($Arg2)"; + Text[ russian ] = "Return Stream has wrong sequence: ($Arg1) instead of ($Arg2)"; + Text[ greek ] = "Return Stream has wrong sequence: ($Arg1) instead of ($Arg2)"; + Text[ dutch ] = "Return Stream met verkeerde sequentie: ($Arg1) in plaats van ($Arg2)"; + Text[ french ] = "Return Stream avec une séquence erronée : ($Arg1) au lieu de ($Arg2)"; + Text[ spanish ] = "Return Stream con secuencia falsa: ($Arg1) en vez de ($Arg2)"; + Text[ italian ] = "Return Stream has wrong sequence: ($Arg1) instead of ($Arg2)"; + Text[ danish ] = "Return Stream has wrong sequence: ($Arg1) instead of ($Arg2)"; + Text[ swedish ] = "Return Stream has wrong sequence: ($Arg1) instead of ($Arg2)"; + Text[ polish ] = "Return Stream o nieprawid³owej sekwencji: ($Arg1) zamiast ($Arg2)"; + Text[ portuguese_brazilian ] = "Return Stream mit falscher Sequenz: ($Arg1) statt ($Arg2)"; + Text[ japanese ] = "ØÀ°Ý½Äذт̼°¹Ý½‚ªŠÔˆá‚Á‚Ä‚¢‚Ü‚·: ($Arg2) ‚łȂ ($Arg1)"; + Text[ korean ] = "Ʋ¸° ÀÏ·Ã ¹øÈ£¸¦ Áö´Ñ ¸®ÅÏ ½ºÆ®¸²: ($Arg2) ´ë½Å ($Arg1)"; + Text[ chinese_simplified ] = "º¬ÓдíÎóÐòÁеķµ»ØÐÅÏ¢Á÷£º($Arg1) ´úÌæ($Arg2)"; + Text[ chinese_traditional ] = "ªð¦^¼ÆÕu¬yªº§Ç¦C¿ù»~¡G($Arg1)¡A À³¸Ó¬O ($Arg2)"; + Text[ arabic ] = "Return Stream has wrong sequence: ($Arg1) instead of ($Arg2)"; + Text[ turkish ] = "Return Stream has wrong sequence: ($Arg1) instead of ($Arg2)"; +}; +String S_RETURNED_VALUE_ID_MISSMATCH +{ + Text = "Returnwert Empfangen aber andere Id erwartet"; + Text[ english_us ] = "Return value received but different Id expected"; + Text[ portuguese ] = "Recebido o valor Return, mas espera-se outro ID"; + Text[ russian ] = "Return value received but different Id expected"; + Text[ greek ] = "Return value received but different Id expected"; + Text[ dutch ] = "Retourwaarde ontvangen echter andere Id verwacht"; + Text[ french ] = "Valeur de renvoi reçue mais attente d'un autre ID"; + Text[ spanish ] = "Recibido Valor Return, pero se esperaba otro Id"; + Text[ italian ] = "Return value received but different Id expected"; + Text[ danish ] = "Return value received but different Id expected"; + Text[ swedish ] = "Return value received but different Id expected"; + Text[ polish ] = "Odebrano wartoœæ return, ale oczekiwane jest inne ID"; + Text[ portuguese_brazilian ] = "Returnwert Empfangen aber andere Id erwartet"; + Text[ japanese ] = "ØÀ°Ý’l‚ðŽó‚¯Žæ‚è‚Ü‚µ‚½‚ªA•Ê‚ÌId‚ª•K—v‚Å‚·B"; + Text[ korean ] = "¼ö½ÅÀÇ ¸®ÅϰªÀÌ ´Ù¸¥ Id¸¦ ±â´ëÇÔ"; + Text[ chinese_simplified ] = "·µ»ØÖµ½ÓÊÕÆÚ´ýµÄÊÇÆäËüµÄ Id(±êʶ·û)"; + Text[ chinese_traditional ] = "±µ¦¬¨ìªð¦^È¡A¦ý¬O´Á«Ý¬O¨ä¥¦ Id"; + Text[ arabic ] = "Return value received but different Id expected"; + Text[ turkish ] = "Return value received but different Id expected"; +}; +String S_RETURNED_VALUE_NO_RECEIVER +{ + Text = "Returnwert Empfangen aber kein Empfänger definiert"; + Text[ english_us ] = "Return value received but receiver not defined"; + Text[ portuguese ] = "Recebido o valor Return, mas o destinatário não foi definido"; + Text[ russian ] = "Return value received but receiver not defined"; + Text[ greek ] = "Return value received but receiver not defined"; + Text[ dutch ] = "Retourwaarde ontvangen echter geen ontvanger gedefinieerd"; + Text[ french ] = "Valeur de renvoi reçue mais aucun destinataire défini"; + Text[ spanish ] = "Recibido valor Return sin definición de destinatario"; + Text[ italian ] = "Return value received but receiver not defined"; + Text[ danish ] = "Return value received but receiver not defined"; + Text[ swedish ] = "Return value received but receiver not defined"; + Text[ polish ] = "Odebrano wartoœæ return, ale brak zdefiniowanego odbiorcy"; + Text[ portuguese_brazilian ] = "Returnwert Empfangen aber kein Empfänger definiert"; + Text[ japanese ] = "ØÀ°Ý’l‚ðŽó‚¯Žæ‚è‚Ü‚µ‚½‚ªAŽóMŽÒ‚ªŒˆ’è‚Å‚«‚Ü‚¹‚ñB"; + Text[ korean ] = "¼ö½ÅÀÇ ¸®Åϰª¿¡ ¼ö½ÅÀÎÀÌ Á¤ÀǵÇÁö ¾ÊÀ½"; + Text[ chinese_simplified ] = "·µ»ØÖµ½ÓÊÕûÓÐÖ¸¶¨½ÓÊÕÕß"; + Text[ chinese_traditional ] = "±µ¦¬¨ìªð¦^È¡A¦ý¬O¨S¦³«ü©w±µ¦¬¥Ø¼Ð¡C"; + Text[ arabic ] = "Return value received but receiver not defined"; + Text[ turkish ] = "Return value received but receiver not defined"; +}; +String S_UNKNOWN_METHOD +{ + Text = "Unbekannte Methode an Objekt : ($Arg1).($Arg2)"; + Text[ english_us ] = "Unknown method on object :($Arg1).($Arg2)"; + Text[ portuguese ] = "Método desconhecido ($Arg1) para ($Arg2)"; + Text[ russian ] = "Unknown method '($Arg1)' to ($Arg2)"; + Text[ greek ] = "Unknown method on object :($Arg1).($Arg2)"; + Text[ dutch ] = "Onbekende methode aan object: ($Arg1).($Arg2)"; + Text[ french ] = "Méthode inconnue vers l'objet : ($Arg1).($Arg2)"; + Text[ spanish ] = "Método desconocido ($Arg1) a ($Arg2)"; + Text[ italian ] = "Unknown method '($Arg1)' to ($Arg2)"; + Text[ danish ] = "Unknown method on object: ($Arg1).($Arg2)"; + Text[ swedish ] = "Unknown method '($Arg1)' to ($Arg2)"; + Text[ polish ] = "Nieznana metoda do obiektu: ($Arg1).($Arg2)"; + Text[ portuguese_brazilian ] = "Unbekannte Methode an Objekt : ($Arg1).($Arg2)"; + Text[ japanese ] = "Unknown method '($Arg1)' to ($Arg2)"; + Text[ korean ] = "°³Ã¼¿¡ ¾Ë¼ö ¾ø´Â ¸Þ¼Òµå : ($Arg1).($Arg2)"; + Text[ chinese_simplified ] = "Unknown method on object:($Arg1).($Arg2)"; + Text[ chinese_traditional ] = "ª«¥ó¤è¦¡¤£©ú¡G ($Arg1).($Arg2)"; + Text[ arabic ] = "Unknown method '($Arg1)' to ($Arg2)"; + Text[ turkish ] = "Unknown method on object :($Arg1).($Arg2)"; +}; +/* +String +{ + Text = ; +}; +String +{ + Text = ; +}; +String +{ + Text = ; +}; +String +{ + Text = ; +}; +String +{ + Text = ; +}; +String +{ + Text = ; +}; +String +{ + Text = ; +}; +String +{ + Text = ; +}; +*/ diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx new file mode 100644 index 000000000000..94a26ef87600 --- /dev/null +++ b/basic/source/basmgr/basmgr.cxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * $RCSfile: basmgr.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <basmgr.hxx> + + +TYPEINIT1( BasicManager, SfxBroadcaster ); +DBG_NAME( BasicManager ); + +BasicManager::~BasicManager() +{ +} + diff --git a/basic/source/basmgr/makefile.mk b/basic/source/basmgr/makefile.mk new file mode 100644 index 000000000000..a2279673782f --- /dev/null +++ b/basic/source/basmgr/makefile.mk @@ -0,0 +1,82 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* +PRJ=..$/.. + +PRJNAME=BASIC +TARGET=basicmgr + +# --- Settings ----------------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + + +# --- Allgemein ----------------------------------------------------------- + +CXXFILES = basmgr.cxx + +SLOFILES= $(SLO)$/basmgr.obj + +# --- Targets ------------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/basic/source/classes/disas.cxx b/basic/source/classes/disas.cxx new file mode 100644 index 000000000000..74c3922f0ab0 --- /dev/null +++ b/basic/source/classes/disas.cxx @@ -0,0 +1,701 @@ +/************************************************************************* + * + * $RCSfile: disas.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <stdio.h> +#include <string.h> + +#ifndef _STREAM_HXX //autogen +#include <tools/stream.hxx> +#endif +#pragma hdrstop +#include <svtools/sbx.hxx> +#include "sb.hxx" +#include "iosys.hxx" +#include "disas.hxx" +// Makro MEMBER() +#include "macfix.hxx" + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBDISAS, SBDISAS_CODE ) + +static const char* pOp1[] = { + "NOP", + + // Operatoren + // die folgenden Operatoren sind genauso angeordnet + // wie der enum SbxVarOp + "EXP", "MUL", "DIV", "MOD", "PLUS", "MINUS", "NEG", + "EQ", "NE", "LT", "GT", "LE", "GE", + "IDIV", "AND", "OR", "XOR", "EQV", "IMP", "NOT", + "CAT", + // Ende enum SbxVarOp + "LIKE", "IS", + // Laden/speichern + "ARGC", // neuen Argv einrichten + "ARGV", // TOS ==> aktueller Argv + "INPUT", // Input ==> TOS + "LINPUT", // Line Input ==> TOS + "GET", // TOS anfassen + "SET", // Speichern Objekt TOS ==> TOS-1 + "PUT", // TOS ==> TOS-1 + "CONST", // TOS ==> TOS-1, dann ReadOnly + "DIM", // DIM + "REDIM", // REDIM + "REDIMP", // REDIM PRESERVE + "ERASE", // TOS loeschen + // Verzweigen + "STOP", // Programmende + "INITFOR", // FOR-Variable initialisieren + "NEXT", // FOR-Variable inkrementieren + "CASE", // Anfang CASE + "ENDCASE", // Ende CASE + "STDERR", // Standard-Fehlerbehandlung + "NOERROR", // keine Fehlerbehandlung + "LEAVE", // UP verlassen + // E/A + "CHANNEL", // TOS = Kanalnummer + "PRINT", // print TOS + "PRINTF", // print TOS in field + "WRITE", // write TOS + "RENAME", // Rename Tos+1 to Tos + "PROMPT", // TOS = Prompt for Input + "RESTART", // Restartpunkt definieren + "STDIO", // E/A-Kanal 0 einstellen + // Sonstiges + "EMPTY", // Leeren Ausdruck auf Stack + "ERROR", // TOS = Fehlercode + "LSET", // Speichern Objekt TOS ==> TOS-1 + "RSET" // Speichern Objekt TOS ==> TOS-1 +}; + +static const char* pOp2[] = { + "NUMBER", // Laden einer numerischen Konstanten (+ID) + "STRING", // Laden einer Stringkonstanten (+ID) + "CONST", // Immediate Load (+Wert) + "ARGN", // Speichern eines named Args in Argv (+StringID) + "PAD", // String auf feste Laenge bringen (+Laenge) + // Verzweigungen + "JUMP", // Sprung (+Target) + "JUMP.T", // TOS auswerten, bedingter Sprung (+Target) + "JUMP.F", // TOS auswerten, bedingter Sprung (+Target) + "ONJUMP", // TOS auswerten, Sprung in JUMP-Tabelle (+MaxVal) + "GOSUB", // UP-Aufruf (+Target) + "RETURN", // UP-Return (+0 oder Target) + "TESTFOR", // FOR-Variable testen, inkrementieren (+Endlabel) + "CASETO", // Tos+1 <= Case <= Tos, 2xremove (+Target) + "ERRHDL", // Fehler-Handler (+Offset) + "RESUME", // Resume nach Fehlern (+0 or 1 or Label) + // E/A + "CLOSE", // (+Kanal/0) + "PRCHAR", // (+char) + // Objekte + "CLASS", // Klassennamen testen (+StringId) + "LIB", // Libnamen fuer Declare-Procs setzen (+StringId) + // Neues ab Beta 3 + "BASED", // TOS wird um BASE erhoeht, BASE davor gepusht + "ARGTYP", // Letzten Parameter in Argv konvertieren (+Typ) +}; + +static const char* pOp3[] = { + // Alle Opcodes mit zwei Operanden + "RTL", // Laden aus RTL (+StringID+Typ) + "FIND", // Laden (+StringID+Typ) + "ELEM", // Laden Element (+StringID+Typ) + "PARAM", // Parameter (+Offset+Typ) + // Verzweigen + "CALL", // DECLARE-Methode rufen (+StringID+Typ) + "CALL.C", // Cdecl-DECLARE-Methode rufen (+StringID+Typ) + "CASEIS", // Case-Test (+Test-Opcode+False-Target) + "STMNT", // Beginn eines Statements (+Line+Col) + // E/A + "OPEN", // (+SvStreamFlags+Flags) + // Objekte und Variable + "LOCAL", // Lokale Variable (+StringID+Typ) + "PUBLIC", // Modulglobale Variable (+StringID+Typ) + "GLOBAL", // Globale Variable (+StringID+Typ) + "CREATE", // Objekt kreieren (+StringId+StringId) + "STATIC", // Objekt kreieren (+StringId+StringId) + "TCREATE", // User defined Objekt kreieren (+StringId+StringId) + "DCREATE", // User defined Objekt-Array kreieren (+StringId+StringId) +}; + +static const char** pOps[3] = { pOp1, pOp2, pOp3 }; + +typedef void( SbiDisas::*Func )( String& ); // Verarbeitungsroutine + +static const Func pOperand2[] = { + MEMBER(SbiDisas::StrOp), // Laden einer numerischen Konstanten (+ID) + MEMBER(SbiDisas::StrOp), // Laden einer Stringkonstanten (+ID) + MEMBER(SbiDisas::ImmOp), // Immediate Load (+Wert) + MEMBER(SbiDisas::StrOp), // Speichern eines benannten Arguments(+ID) + MEMBER(SbiDisas::ImmOp), // String auf feste Laenge bringen (+Laenge) + // Verzweigungen + MEMBER(SbiDisas::LblOp), // Sprung (+Target) + MEMBER(SbiDisas::LblOp), // TOS auswerten), bedingter Sprung (+Target) + MEMBER(SbiDisas::LblOp), // TOS auswerten), bedingter Sprung (+Target) + MEMBER(SbiDisas::OnOp), // TOS auswerten), Sprung in JUMP-Tabelle (+MaxVal) + MEMBER(SbiDisas::LblOp), // UP-Aufruf (+Target) + MEMBER(SbiDisas::ReturnOp), // UP-Return (+0 oder Target) + MEMBER(SbiDisas::LblOp), // FOR-Variable testen), inkrementieren (+Endlabel) + MEMBER(SbiDisas::LblOp), // Tos+1 <= Case <= Tos), 2xremove (+Target) + MEMBER(SbiDisas::LblOp), // Fehler-Handler (+Offset) + MEMBER(SbiDisas::ResumeOp), // Resume nach Fehlern (+0 or 1 or Label) + // E/A + MEMBER(SbiDisas::CloseOp), // (+Kanal/0) + MEMBER(SbiDisas::CharOp), // (+char) + // Objekte + MEMBER(SbiDisas::StrOp), // Klassennamen testen (+StringId) + MEMBER(SbiDisas::StrOp), // Libnamen fuer Declare-Procs setzen (+StringId) + MEMBER(SbiDisas::ImmOp), // TOS wird um BASE erhoeht, BASE davor gepusht + MEMBER(SbiDisas::TypeOp), // Letzten Parameter in Argv konvertieren (+Typ) +}; + +static const Func pOperand3[] = { + // Alle Opcodes mit zwei Operanden + MEMBER(SbiDisas::VarOp), // Laden aus RTL (+StringID+Typ) + MEMBER(SbiDisas::VarOp), // Laden (+StringID+Typ) + MEMBER(SbiDisas::VarOp), // Laden Element (+StringID+Typ) + MEMBER(SbiDisas::OffOp), // Parameter (+Offset+Typ) + // Verzweigen + MEMBER(SbiDisas::VarOp), // DECLARE-Methode rufen (+StringID+Typ) + MEMBER(SbiDisas::VarOp), // CDecl-DECLARE-Methode rufen (+StringID+Typ) + MEMBER(SbiDisas::CaseOp), // Case-Test (+Test-Opcode+False-Target) + MEMBER(SbiDisas::StmntOp), // Statement (+Zeilen+Spalte) + // E/A + MEMBER(SbiDisas::StrmOp), // (+SvStreamFlags+Flags) + // Objekte + MEMBER(SbiDisas::VarDefOp), // Lokale Variable definieren (+StringID+Typ) + MEMBER(SbiDisas::VarDefOp), // Modulglobale Variable definieren (+StringID+Typ) + MEMBER(SbiDisas::VarDefOp), // Globale Variable definieren (+StringID+Typ) + MEMBER(SbiDisas::Str2Op), // Objekt kreieren (+StringId+StringId) + MEMBER(SbiDisas::VarDefOp), // Statische Variable definieren (+StringID+Typ) + MEMBER(SbiDisas::Str2Op), // User defined Objekt kreieren (+StringId+StringId) + MEMBER(SbiDisas::Str2Op), // User defined Objekt-Array kreieren (+StringId+StringId) +}; + +static const char* _crlf() +{ +#if defined (MAC) + return "\n"; +#elif defined (UNX) || defined( PM2 ) + return "\n"; +#else + return "\r\n"; +#endif +} + +// Diese Methode ist hier, damit die Datei als eigenes Segment geladen werden +// kann. + +BOOL SbModule::Disassemble( String& rText ) +{ + rText.Erase(); + if( pImage ) + { + SbiDisas aDisas( this, pImage ); + aDisas.Disas( rText ); + } + return BOOL( rText.Len() != 0 ); +} + +SbiDisas::SbiDisas( SbModule* p, const SbiImage* q ) : rImg( *q ), pMod( p ) +{ + memset( cLabels, 0, 8192 ); + nLine = nOff = nPC = nOp1 = nOp2 = nParts = 0; + eOp = _NOP; + // Label-Bits setzen + USHORT nPos; + nOff = 0; + while( Fetch() ) + { + BOOL bLbl = FALSE; + switch( eOp ) + { + case _RESUME: if( nOp1 <= 1 ) break; + case _RETURN: if( !nOp1 ) break; + case _JUMP: + case _JUMPT: + case _JUMPF: + case _GOSUB: + case _TESTFOR: + case _CASEIS: + case _CASETO: + case _ERRHDL: nPos = nOp1; bLbl = TRUE; break; + } + if( bLbl ) + cLabels[ nPos >> 3 ] |= ( 1 << ( nPos & 7 ) ); + } + nOff = 0; + // Die Publics noch dazu + for( USHORT i = 0; i < pMod->GetMethods()->Count(); i++ ) + { + SbMethod* pMeth = PTR_CAST(SbMethod,pMod->GetMethods()->Get( i )); + if( pMeth ) + { + nPos = pMeth->GetId(); + cLabels[ nPos >> 3 ] |= ( 1 << ( nPos & 7 ) ); + } + } +} + +// Aktuellen Opcode auslesen + +BOOL SbiDisas::Fetch() +{ + nPC = nOff; + if( nOff >= rImg.GetCodeSize() ) + return FALSE; + const char* p = rImg.GetCode() + nOff; + eOp = (SbiOpcode) ( *p++ & 0xFF ); + if( eOp <= SbOP0_END ) + { + nOp1 = nOp2 = 0; + nParts = 1; + nOff++; + return TRUE; + } + else if( eOp <= SbOP1_END ) + { + nOff += 3; + if( nOff > rImg.GetCodeSize() ) + return FALSE; + nOp1 = *p++ & 0xFF; nOp1 |= *p << 8; + nParts = 2; + return TRUE; + } + else if( eOp <= SbOP2_END ) + { + nOff += 5; + if( nOff > rImg.GetCodeSize() ) + return FALSE; + nOp1 = *p++ & 0xFF; nOp1 |= *p++ << 8; + nOp2 = *p++ & 0xFF; nOp2 |= *p << 8; + nParts = 3; + return TRUE; + } + else + return FALSE; +} + +void SbiDisas::Disas( SvStream& r ) +{ + String aText; + nOff = 0; + while( DisasLine( aText ) ) + { + ByteString aByteText( aText, gsl_getSystemTextEncoding() ); + r.WriteLine( aByteText ); + } +} + +void SbiDisas::Disas( String& r ) +{ + r.Erase(); + String aText; + nOff = 0; + while( DisasLine( aText ) ) + { + r += aText; + r.AppendAscii( _crlf() ); + } + aText.ConvertLineEnd(); +} + +#ifdef HP9000 +const char* SbiDisas_DisasLine_pMask[] = { + "%04X ", + "%04X %02X ", + "%04X %02X %04X ", + "%04X %02X %04X %04X " }; +#define pMask SbiDisas_DisasLine_pMask +#endif +BOOL SbiDisas::DisasLine( String& rText ) +{ + char cBuf[ 30 ]; +#ifndef HP9000 + const char* pMask[] = { + "%04X ", + "%04X %02X ", + "%04X %02X %04X ", + "%04X %02X %04X %04X " }; +#endif + rText.Erase(); + if( !Fetch() ) + return FALSE; + // Neue Zeile? + if( eOp == _STMNT && (short) nOp1 != nLine ) + { + // Zeile raussuchen + USHORT n = 0, l = nLine = nOp1; + while( --l ) { + n = rImg.aSource.SearchAscii( "\n", n ); + if( n == STRING_NOTFOUND ) break; + else n++; + } + // Stelle anzeigen + if( n != STRING_NOTFOUND ) + { + USHORT n2 = rImg.aSource.SearchAscii( "\n", n ); + if( n2 == STRING_NOTFOUND ) n2 = rImg.aSource.Len() - n; + String s( rImg.aSource.Copy( n, n2 - n + 1 ) ); + BOOL bDone; + do { + bDone = TRUE; + n = s.Search( '\r' ); + if( n != STRING_NOTFOUND ) bDone = FALSE, s.Erase( n, 1 ); + n = s.Search( '\n' ); + if( n != STRING_NOTFOUND ) bDone = FALSE, s.Erase( n, 1 ); + } while( !bDone ); +// sprintf( cBuf, pMask[ 0 ], nPC ); +// rText += cBuf; + rText.AppendAscii( "; " ); + rText += s; + rText.AppendAscii( _crlf() ); + } + } + // Label? + const char* p = ""; + if( cLabels[ nPC >> 3 ] & ( 1 << ( nPC & 7 ) ) ) + { + // Public? + ByteString aByteMethName; + for( USHORT i = 0; i < pMod->GetMethods()->Count(); i++ ) + { + SbMethod* pMeth = PTR_CAST(SbMethod,pMod->GetMethods()->Get( i )); + if( pMeth ) + { + aByteMethName = ByteString( pMeth->GetName(), gsl_getSystemTextEncoding() ); + if( pMeth->GetId() == nPC ) + { + p = aByteMethName.GetBuffer(); + break; + } + if( pMeth->GetId() >= nPC ) + break; + } + } + sprintf( cBuf, pMask[ 0 ], nPC ); + rText.AppendAscii( cBuf ); + if( p && *p ) + { + rText.AppendAscii( p ); + } + else + { + sprintf( cBuf, "Lbl%04X", nPC ); + rText.AppendAscii( cBuf ); + } + rText += ':'; + rText.AppendAscii( _crlf() ); + } + sprintf( cBuf, pMask[ nParts ], nPC, (USHORT) eOp, nOp1, nOp2 ); + rText.AppendAscii( cBuf ); + short n = eOp; + if( eOp >= SbOP2_START ) + n -= SbOP2_START; + else if( eOp >= SbOP1_START ) + n -= SbOP1_START; + rText += '\t'; + rText.AppendAscii( pOps[ nParts-1 ][ n ] ); + rText += '\t'; + switch( nParts ) + { + case 2: (this->*( pOperand2[ n ] ) )( rText ); break; + case 3: (this->*( pOperand3[ n ] ) )( rText ); break; + } + return TRUE; +} +#ifdef HP9000 +#undef pMask +#endif + + +// Auslesen aus StringPool + +void SbiDisas::StrOp( String& rText ) +{ + String aStr = rImg.GetString( nOp1 ); + const char* p = ByteString( aStr, gsl_getSystemTextEncoding() ).GetBuffer(); + if( p ) + { + rText += '"'; + rText.AppendAscii( p ); + rText += '"'; + } + else + { + rText.AppendAscii( "?String? " ); + rText += nOp1; + } +} + +void SbiDisas::Str2Op( String& rText ) +{ + StrOp( rText ); + rText += ','; + String s; + nOp1 = nOp2; + StrOp( s ); + rText += s; +} + +// Immediate Operand + +void SbiDisas::ImmOp( String& rText ) +{ + rText += nOp1; +} + +// OnGoto Operand + +void SbiDisas::OnOp( String& rText ) +{ + rText += nOp1 & 0x7FFF; + if( nOp1 & 0x800 ) + rText.AppendAscii( "\t; Gosub" ); +} + +// Label + +void SbiDisas::LblOp( String& rText ) +{ + char cBuf[ 10 ]; + sprintf( cBuf, "Lbl%04X", nOp1 ); + rText.AppendAscii( cBuf ); +} + +// 0 oder Label + +void SbiDisas::ReturnOp( String& rText ) +{ + if( nOp1 ) + LblOp( rText ); +} + +// 0, 1 oder Label + +void SbiDisas::ResumeOp( String& rText ) +{ + switch( nOp1 ) + { + case 1: rText.AppendAscii( "NEXT" ); break; + case 2: LblOp( rText ); + } +} + +// Prompt ausgeben +// FALSE/TRUE + +void SbiDisas::PromptOp( String& rText ) +{ + if( nOp1 ) + rText.AppendAscii( "\"? \"" ); +} + +// 0 oder 1 + +void SbiDisas::CloseOp( String& rText ) +{ + rText.AppendAscii( nOp1 ? "Channel" : "All" ); +} + +// Zeichen ausgeben + +void SbiDisas::CharOp( String& rText ) +{ + const char* p = NULL; + switch( nOp1 ) + { + case 7: p = "'\\a'"; break; + case 9: p = "'\\t'"; break; + case 10: p = "'\\n'"; break; + case 12: p = "'\\f'"; break; + case 13: p = "'\\r'"; break; + } + if( p ) rText.AppendAscii( p ); + else if( nOp1 >= ' ' ) + rText += '\'', + rText += (char) nOp1, + rText += '\''; + else + rText.AppendAscii( "char " ), + rText += nOp1; +} + +// Variable ausgeben: String-ID und Typ + +void SbiDisas::VarOp( String& rText ) +{ + rText += rImg.GetString( nOp1 & 0x7FFF ); + rText.AppendAscii( "\t; " ); + // Der Typ + USHORT n = nOp1; + nOp1 = nOp2; + TypeOp( rText ); + if( n & 0x8000 ) + rText.AppendAscii( ", Args" ); +} + +// Variable definieren: String-ID und Typ + +void SbiDisas::VarDefOp( String& rText ) +{ + rText += rImg.GetString( nOp1 ); + rText.AppendAscii( "\t; " ); + // Der Typ + USHORT n = nOp1; + nOp1 = nOp2; + TypeOp( rText ); +} + +// Variable ausgeben: Offset und Typ + +void SbiDisas::OffOp( String& rText ) +{ + rText += ( nOp1 & 0x7FFF ); + rText.AppendAscii( "\t; " ); + // Der Typ + USHORT n = nOp1; + nOp1 = nOp2; + TypeOp( rText ); + if( n & 0x8000 ) + rText.AppendAscii( ", Args" ); +} + +// Datentyp +#ifdef HP9000 +static char* SbiDisas_TypeOp_pTypes[13] = { + "Empty","Null","Integer","Long","Single","Double", + "Currency","Date","String","Object","Error","Boolean", + "Variant" }; +#define pTypes SbiDisas_TypeOp_pTypes +#endif +void SbiDisas::TypeOp( String& rText ) +{ + // AB 19.1.96: Typ kann Flag für BYVAL enthalten (StepARGTYP) + if( nOp1 & 0x8000 ) + { + nOp1 &= 0x7FFF; // Flag wegfiltern + rText.AppendAscii( "BYVAL " ); + } + if( nOp1 < 13 ) + { +#ifndef HP9000 + static char* pTypes[13] = { + "Empty","Null","Integer","Long","Single","Double", + "Currency","Date","String","Object","Error","Boolean", + "Variant" }; +#endif + rText.AppendAscii( pTypes[ nOp1 ] ); + } + else + { + rText.AppendAscii( "type " ); + rText += nOp1; + } +} +#ifdef HP9000 +#undef pTypes +#endif + +// TRUE-Label, Bedingungs-Opcode + +void SbiDisas::CaseOp( String& rText ) +{ + LblOp( rText ); + rText += ','; + rText.AppendAscii( pOp1[ nOp2 - SbxEQ + _EQ ] ); +} + +// Zeile, Spalte + +void SbiDisas::StmntOp( String& rText ) +{ + rText += nOp1; + rText += ','; + USHORT nCol = nOp2 & 0xFF; + USHORT nFor = nOp2 / 0x100; + rText += nCol; + rText.AppendAscii( " (For-Level: " ); + rText += nFor; + rText += ')'; +} + +// open mode, flags + +void SbiDisas::StrmOp( String& rText ) +{ + char cBuf[ 10 ]; + sprintf( cBuf, "%04X", nOp1 ); + rText.AppendAscii( cBuf ); + if( nOp2 & SBSTRM_INPUT ) + rText.AppendAscii( ", Input" ); + if( nOp2 & SBSTRM_OUTPUT ) + rText.AppendAscii( ", Output" ); + if( nOp2 & SBSTRM_APPEND ) + rText.AppendAscii( ", Append" ); + if( nOp2 & SBSTRM_RANDOM ) + rText.AppendAscii( ", Random" ); + if( nOp2 & SBSTRM_BINARY ) + rText.AppendAscii( ", Binary" ); +} + + diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx new file mode 100644 index 000000000000..b857afd4fe09 --- /dev/null +++ b/basic/source/classes/image.cxx @@ -0,0 +1,431 @@ +/************************************************************************* + * + * $RCSfile: image.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _STREAM_HXX //autogen +#include <tools/stream.hxx> +#endif +#pragma hdrstop +#include <svtools/sbx.hxx> +#include "sb.hxx" +#include <string.h> // memset() etc +#include "image.hxx" +#include "filefmt.hxx" + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBASIC, SBASIC_CODE ) + +SbiImage::SbiImage() +{ + rTypes = new SbxArray; + pStringOff = NULL; + pStrings = NULL; + pCode = NULL; + nFlags = + nStrings = + nStringSize= + nCodeSize = + nDimBase = 0; + bInit = + bError = FALSE; + eCharSet = gsl_getSystemTextEncoding(); +} + +SbiImage::~SbiImage() +{ + Clear(); +} + +void SbiImage::Clear() +{ + delete pStringOff; + delete pStrings; + delete pCode; + pStringOff = NULL; + pStrings = NULL; + pCode = NULL; + nFlags = + nStrings = + nStringSize= + nCodeSize = 0; + eCharSet = gsl_getSystemTextEncoding(); + nDimBase = 0; + bError = FALSE; +} + +/************************************************************************** +* +* Service-Routinen fuer das Laden und Speichern +* +**************************************************************************/ + +BOOL SbiGood( SvStream& r ) +{ + return BOOL( !r.IsEof() && r.GetError() == SVSTREAM_OK ); +} + +// Oeffnen eines Records + +ULONG SbiOpenRecord( SvStream& r, UINT16 nSignature, UINT16 nElem ) +{ + ULONG nPos = r.Tell(); + r << nSignature << (INT32) 0 << nElem; + return nPos; +} + +// Schliessen eines Records + +void SbiCloseRecord( SvStream& r, ULONG nOff ) +{ + ULONG nPos = r.Tell(); + r.Seek( nOff + 2 ); + r << (INT32) ( nPos - nOff - 8 ); + r.Seek( nPos ); +} + +/************************************************************************** +* +* Laden und Speichern +* +**************************************************************************/ + +// Falls die Versionsnummer nicht passt, werden die binaeren Teile +// nicht geladen, wohl aber Source, Kommentar und Name. + +BOOL SbiImage::Load( SvStream& r ) +{ + UINT16 nSign, nCount; + UINT32 nLen, nOff; + + Clear(); + ULONG nStart = r.Tell(); + // Master-Record einlesen + r >> nSign >> nLen >> nCount; + ULONG nLast = r.Tell() + nLen; + UINT32 nVersion = 0; // Versionsnummer + UINT32 nCharSet; // System-Zeichensatz + UINT32 lDimBase; + UINT16 nReserved1; + UINT32 nReserved2; + UINT32 nReserved3; + BOOL bBadVer = FALSE; + if( nSign == B_MODULE ) + { + r >> nVersion >> nCharSet >> lDimBase + >> nFlags >> nReserved1 >> nReserved2 >> nReserved3; + eCharSet = (CharSet) nCharSet; + bBadVer = BOOL( nVersion != B_CURVERSION ); + nDimBase = (USHORT) lDimBase; + } + + ULONG nNext; + while( ( nNext = r.Tell() ) < nLast ) + { + short i; + + r >> nSign >> nLen >> nCount; + nNext += nLen + 8; + if( r.GetError() == SVSTREAM_OK ) + switch( nSign ) + { + case B_NAME: + r.ReadByteString( aName, eCharSet ); + //r >> aName; + break; + case B_COMMENT: + r.ReadByteString( aComment, eCharSet ); + //r >> aComment; + break; + case B_SOURCE: + r.ReadByteString( aSource, eCharSet ); + //r >> aSource; + break; + case B_PCODE: + if( bBadVer ) break; + pCode = new char[ nLen ]; + nCodeSize = (USHORT) nLen; + r.Read( pCode, nCodeSize ); + break; + case B_PUBLICS: + case B_POOLDIR: + case B_SYMPOOL: + case B_LINERANGES: + break; + case B_STRINGPOOL: + if( bBadVer ) break; + MakeStrings( nCount ); + for( i = 0; i < nStrings && SbiGood( r ); i++ ) + { + r >> nOff; + pStringOff[ i ] = (USHORT) nOff; + } + r >> nLen; + if( SbiGood( r ) ) + { + delete pStrings; + pStrings = new sal_Unicode[ nLen ]; + nStringSize = (USHORT) nLen; + + char* pByteStrings = new char[ nLen ]; + r.Read( pByteStrings, nStringSize ); + for( short i = 0; i < nStrings; i++ ) + { + USHORT nOff = pStringOff[ i ]; + String aStr( pByteStrings + nOff, eCharSet ); + memcpy( pStrings + nOff, aStr.GetBuffer(), (aStr.Len() + 1) * sizeof( sal_Unicode ) ); + } + delete pByteStrings; + } break; + case B_MODEND: + goto done; + default: + break; + } + else + break; + r.Seek( nNext ); + } +done: + r.Seek( nLast ); + //if( eCharSet != ::GetSystemCharSet() ) + //ConvertStrings(); + if( !SbiGood( r ) ) + bError = TRUE; + return BOOL( !bError ); +} + +BOOL SbiImage::Save( SvStream& r ) +{ + // Erst mal der Header: + ULONG nStart = SbiOpenRecord( r, B_MODULE, 1 ); + ULONG nPos; + r << (INT32) B_CURVERSION + << (INT32) eCharSet + << (INT32) nDimBase + << (INT16) nFlags + << (INT16) 0 + << (INT32) 0 + << (INT32) 0; + + // Name? + if( aName.Len() && SbiGood( r ) ) + { + nPos = SbiOpenRecord( r, B_NAME, 1 ); + r.WriteByteString( aName, eCharSet ); + //r << aName; + SbiCloseRecord( r, nPos ); + } + // Kommentar? + if( aComment.Len() && SbiGood( r ) ) + { + nPos = SbiOpenRecord( r, B_COMMENT, 1 ); + r.WriteByteString( aComment, eCharSet ); + //r << aComment; + SbiCloseRecord( r, nPos ); + } + // Source? + if( aSource.Len() && SbiGood( r ) ) + { + nPos = SbiOpenRecord( r, B_SOURCE, 1 ); + r.WriteByteString( aSource, eCharSet ); + //r << aSource; + SbiCloseRecord( r, nPos ); + } + // Binaere Daten? + if( pCode && SbiGood( r ) ) + { + nPos = SbiOpenRecord( r, B_PCODE, 1 ); + r.Write( pCode, nCodeSize ); + SbiCloseRecord( r, nPos ); + } + // String-Pool? + if( nStrings ) + { + nPos = SbiOpenRecord( r, B_STRINGPOOL, nStrings ); + // Fuer jeden String: + // UINT32 Offset des Strings im Stringblock + for( short i = 0; i < nStrings && SbiGood( r ); i++ ) + r << (UINT32) pStringOff[ i ]; + + // Danach der String-Block + char* pByteStrings = new char[ nStringSize ]; + for( i = 0; i < nStrings; i++ ) + { + USHORT nOff = pStringOff[ i ]; + ByteString aStr( pStrings + nOff, eCharSet ); + memcpy( pByteStrings + nOff, aStr.GetBuffer(), (aStr.Len() + 1) * sizeof( char ) ); + } + r << (UINT32) nStringSize; + r.Write( pByteStrings, nStringSize ); + delete pByteStrings; + SbiCloseRecord( r, nPos ); + } + // Und die Gesamtlaenge setzen + SbiCloseRecord( r, nStart ); + if( !SbiGood( r ) ) + bError = TRUE; + return BOOL( !bError ); +} + +/************************************************************************** +* +* Routinen, die auch vom Compiler gerufen werden +* +**************************************************************************/ + +void SbiImage::MakeStrings( short nSize ) +{ + nStrings = nStringIdx = nStringOff = 0; + nStringSize = 1024; + pStrings = new sal_Unicode[ nStringSize ]; + pStringOff = new UINT16[ nSize ]; + if( pStrings && pStringOff ) + { + nStrings = nSize; + memset( pStringOff, 0, nSize * sizeof( UINT16 ) ); + memset( pStrings, 0, nStringSize * sizeof( sal_Unicode ) ); + } + else + bError = TRUE; +} + +// Hinzufuegen eines Strings an den StringPool. Der String-Puffer +// waechst dynamisch in 1K-Schritten + +// AB 12.5.2000 Aus Zeitgruenden vorerst weiter auf char-Basis +// TODO: Auch hier auf Unicode umstellen, d.h. sal_Unicode-Array +void SbiImage::AddString( const String& r ) +{ + if( nStringIdx >= nStrings ) + bError = TRUE; + if( !bError ) + { + UINT16 len = r.Len() + 1; + long needed = (long) nStringOff + len; + if( needed > 0xFF00L ) + bError = TRUE; // out of mem! + else if( (USHORT) needed > nStringSize ) + { + sal_Unicode* p = new sal_Unicode[ nStringSize + 1024 ]; + if( p ) + { + memcpy( p, pStrings, nStringSize * sizeof( sal_Unicode ) ); + delete pStrings; + pStrings = p; + nStringSize += 1024; + } + else + bError = TRUE; + } + if( !bError ) + { + pStringOff[ nStringIdx++ ] = nStringOff; + //ByteString aByteStr( r, eCharSet ); + memcpy( pStrings + nStringOff, r.GetBuffer(), len * sizeof( sal_Unicode ) ); + nStringOff += len; + // war das der letzte String? Dann die Groesse + // des Puffers aktualisieren + if( nStringIdx >= nStrings ) + nStringSize = nStringOff; + } + } +} + +// Codeblock hinzufuegen +// Der Block wurde vom Compiler aus der Klasse SbBuffer herausgeholt +// und ist bereits per new angelegt. Ausserdem enthaelt er alle Integers +// im Big Endian-Format, kann also direkt gelesen/geschrieben werden. + +void SbiImage::AddCode( char* p, USHORT s ) +{ + pCode = p; + nCodeSize = s; +} + +void SbiImage::AddType(SbxObject* pObject) // User-Type mit aufnehmen +{ + SbxObject *pCopyObject = new SbxObject(*pObject); + rTypes->Insert (pCopyObject,rTypes->Count()); +} + +/************************************************************************** +* +* Zugriffe auf das Image +* +**************************************************************************/ + +// IDs zaehlen ab 1!! + +String SbiImage::GetString( short nId ) const +{ + if( nId && nId <= nStrings ) + { + USHORT nOff = pStringOff[ --nId ]; + String aStr( pStrings + nOff ); + return aStr; + } + return String(); +} + +const SbxObject* SbiImage::FindType (String aTypeName) const +{ + return (SbxObject *)rTypes->Find(aTypeName,SbxCLASS_OBJECT); +} + diff --git a/basic/source/classes/makefile.mk b/basic/source/classes/makefile.mk new file mode 100644 index 000000000000..da2218d70b77 --- /dev/null +++ b/basic/source/classes/makefile.mk @@ -0,0 +1,93 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=BASIC +TARGET=classes + +# --- Settings ----------------------------------------------------------- + +ENABLE_EXCEPTIONS=TRUE + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + + + +# --- Allgemein ----------------------------------------------------------- + +SLOFILES= \ + $(SLO)$/sb.obj \ + $(SLO)$/sbxmod.obj \ + $(SLO)$/image.obj \ + $(SLO)$/sbintern.obj \ + $(SLO)$/sbunoobj.obj \ + $(SLO)$/propacc.obj \ + $(SLO)$/disas.obj + +SRCFILES= sb.src + +# --- Targets ------------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/basic/source/classes/propacc.cxx b/basic/source/classes/propacc.cxx new file mode 100644 index 000000000000..d28282379bd6 --- /dev/null +++ b/basic/source/classes/propacc.cxx @@ -0,0 +1,435 @@ +/************************************************************************* + * + * $RCSfile: propacc.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:09 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include "propacc.hxx" + +#include <tools/urlobj.hxx> +#include <tools/errcode.hxx> +#include <svtools/svarray.hxx> +#include <svtools/sbx.hxx> +#include <sbstar.hxx> +#include <sbunoobj.hxx> + +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace cppu; +using namespace rtl; + + +//======================================================================== + +// Deklaration Konvertierung von Sbx nach Uno mit bekannter Zielklasse +Any sbxToUnoValue( SbxVariable* pVar, const Reference< XIdlClass >& xIdlTargetClass ); +Reference<XIdlClass> TypeToIdlClass( const Type& rType ); + +//======================================================================== + +#ifdef WNT +#define CDECL _cdecl +#endif +#ifdef OS2 +#define CDECL _Optlink +#endif +#if defined(UNX) || defined(MAC) +#define CDECL +#endif + +int CDECL SbCompare_PropertyValues_Impl( const void *arg1, const void *arg2 ) +{ + return ((PropertyValue*)arg1)->Name.compareTo( ((PropertyValue*)arg2)->Name ); +} + +int CDECL SbCompare_UString_PropertyValue_Impl( const void *arg1, const void *arg2 ) +{ + const OUString *pArg1 = (OUString*) arg1; + const PropertyValue **pArg2 = (const PropertyValue**) arg2; + return pArg1->compareTo( (*pArg2)->Name ); +} + +int CDECL SbCompare_Properties_Impl( const void *arg1, const void *arg2 ) +{ + return ((Property*)arg1)->Name.compareTo( ((Property*)arg2)->Name ); +} + +int CDECL SbCompare_UString_Property_Impl( const void *arg1, const void *arg2 ) +{ + const OUString *pArg1 = (OUString*) arg1; + const Property *pArg2 = (Property*) arg2; + return pArg1->compareTo( pArg2->Name ); +} + +//---------------------------------------------------------------------------- + +SbPropertyValues::SbPropertyValues() +{ +} + +//---------------------------------------------------------------------------- + +SbPropertyValues::~SbPropertyValues() +{ + _xInfo = Reference< XPropertySetInfo >(); + + for ( USHORT n = 0; n < _aPropVals.Count(); ++n ) + delete _aPropVals.GetObject( n ); +} + +//---------------------------------------------------------------------------- + +Reference< XPropertySetInfo > SbPropertyValues::getPropertySetInfo(void) throw( RuntimeException ) +{ + // create on demand? + if ( !_xInfo.is() ) + { + SbPropertySetInfo *pInfo = new SbPropertySetInfo( _aPropVals ); + ((SbPropertyValues*)this)->_xInfo = (XPropertySetInfo*)pInfo; + } + return _xInfo; +} + +//------------------------------------------------------------------------- + +INT32 SbPropertyValues::GetIndex_Impl( const OUString &rPropName ) const +{ + PropertyValue **ppPV; + ppPV = (PropertyValue **) + bsearch( &rPropName, _aPropVals.GetData(), _aPropVals.Count(), + sizeof( PropertyValue* ), + SbCompare_UString_PropertyValue_Impl ); + return ppPV ? ( (ppPV-_aPropVals.GetData()) / sizeof(ppPV) ) : USHRT_MAX; +} + +//---------------------------------------------------------------------------- + +void SbPropertyValues::setPropertyValue( + const OUString& aPropertyName, + const Any& aValue) +{ + USHORT nIndex = GetIndex_Impl( aPropertyName ); + PropertyValue *pPropVal = _aPropVals.GetObject(nIndex); + pPropVal->Value = aValue; +} + +//---------------------------------------------------------------------------- + +Any SbPropertyValues::getPropertyValue( + const OUString& aPropertyName) throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) +{ + USHORT nIndex = GetIndex_Impl( aPropertyName ); + if ( nIndex != USHRT_MAX ) + return _aPropVals.GetObject(nIndex)->Value; + return Any(); +} + +//---------------------------------------------------------------------------- + +void SbPropertyValues::addPropertyChangeListener( + const OUString& aPropertyName, + const Reference< XPropertyChangeListener >& ) +{ +} + +//---------------------------------------------------------------------------- + +void SbPropertyValues::removePropertyChangeListener( + const OUString& aPropertyName, + const Reference< XPropertyChangeListener >& ) +{ +} + +//---------------------------------------------------------------------------- + +void SbPropertyValues::addVetoableChangeListener( + const OUString& aPropertyName, + const Reference< XVetoableChangeListener >& ) +{ +} + +//---------------------------------------------------------------------------- + +void SbPropertyValues::removeVetoableChangeListener( + const OUString& aPropertyName, + const Reference< XVetoableChangeListener >& ) +{ +} + +//---------------------------------------------------------------------------- + +Sequence< PropertyValue > SbPropertyValues::getPropertyValues(void) +{ + Sequence<PropertyValue> aRet( _aPropVals.Count()); + for ( USHORT n = 0; n < _aPropVals.Count(); ++n ) + aRet.getArray()[n] = *_aPropVals.GetObject(n); + return aRet; +} + +//---------------------------------------------------------------------------- + +void SbPropertyValues::setPropertyValues(const Sequence< PropertyValue >& rPropertyValues ) +{ + if ( _aPropVals.Count() ) + throw PropertyExistException(); + + const PropertyValue *pPropVals = rPropertyValues.getConstArray(); + for ( sal_Int16 n = 0; n < rPropertyValues.getLength(); ++n ) + { + PropertyValue *pPropVal = new PropertyValue(pPropVals[n]); + _aPropVals.Insert( pPropVal, n ); + } +} + +//============================================================================ +//PropertySetInfoImpl + +PropertySetInfoImpl::PropertySetInfoImpl() +{ +} + +INT32 PropertySetInfoImpl::GetIndex_Impl( const OUString &rPropName ) const +{ + Property *pP; + pP = (Property*) + bsearch( &rPropName, _aProps.getConstArray(), _aProps.getLength(), + sizeof( Property ), + SbCompare_UString_Property_Impl ); + return pP ? ( (pP-_aProps.getConstArray()) / sizeof(pP) ) : -1; +} + +Sequence< Property > PropertySetInfoImpl::getProperties(void) +{ + return _aProps; +} + +Property PropertySetInfoImpl::getPropertyByName(const OUString& Name) throw( RuntimeException ) +{ + USHORT nIndex = GetIndex_Impl( Name ); + if( USHRT_MAX != nIndex ) + return _aProps.getConstArray()[ nIndex ]; + return Property(); +} + +sal_Bool PropertySetInfoImpl::hasPropertyByName(const OUString& Name) throw( RuntimeException ) +{ + USHORT nIndex = GetIndex_Impl( Name ); + return USHRT_MAX != nIndex; +} + + +//============================================================================ + +SbPropertySetInfo::SbPropertySetInfo() +{ +} + +//---------------------------------------------------------------------------- + +SbPropertySetInfo::SbPropertySetInfo( const SbPropertyValueArr_Impl &rPropVals ) +{ + aImpl._aProps.realloc( rPropVals.Count() ); + for ( USHORT n = 0; n < rPropVals.Count(); ++n ) + { + Property &rProp = aImpl._aProps.getArray()[n]; + const PropertyValue &rPropVal = *rPropVals.GetObject(n); + rProp.Name = rPropVal.Name; + rProp.Handle = rPropVal.Handle; + rProp.Type = getCppuVoidType(); + rProp.Attributes = 0; + } +} + +//---------------------------------------------------------------------------- + +SbPropertySetInfo::~SbPropertySetInfo() +{ +} + +//------------------------------------------------------------------------- + +Sequence< Property > SbPropertySetInfo::getProperties(void) throw( RuntimeException ) +{ + return aImpl.getProperties(); +} + +Property SbPropertySetInfo::getPropertyByName(const OUString& Name) + throw( RuntimeException ) +{ + return aImpl.getPropertyByName( Name ); +} + +BOOL SbPropertySetInfo::hasPropertyByName(const OUString& Name) + throw( RuntimeException ) +{ + return aImpl.hasPropertyByName( Name ); +} + + +//---------------------------------------------------------------------------- + +SbPropertyContainer::SbPropertyContainer() +{ +} + +//---------------------------------------------------------------------------- + +SbPropertyContainer::~SbPropertyContainer() +{ +} + +//---------------------------------------------------------------------------- +void SbPropertyContainer::addProperty(const OUString& Name, + INT16 Attributes, + const Any& DefaultValue) + throw( PropertyExistException, IllegalTypeException, + IllegalArgumentException, RuntimeException ) +{ +} + +//---------------------------------------------------------------------------- +void SbPropertyContainer::removeProperty(const OUString& Name) + throw( UnknownPropertyException, RuntimeException ) +{ +} + +//---------------------------------------------------------------------------- +// XPropertySetInfo +Sequence< Property > SbPropertyContainer::getProperties(void) +{ + return aImpl.getProperties(); +} + +Property SbPropertyContainer::getPropertyByName(const OUString& Name) + throw( RuntimeException ) +{ + return aImpl.getPropertyByName( Name ); +} + +BOOL SbPropertyContainer::hasPropertyByName(const OUString& Name) + throw( RuntimeException ) +{ + return aImpl.hasPropertyByName( Name ); +} + +//---------------------------------------------------------------------------- + +Sequence< PropertyValue > SbPropertyContainer::getPropertyValues(void) +{ + return Sequence<PropertyValue>(); +} + +//---------------------------------------------------------------------------- + +void SbPropertyContainer::setPropertyValues(const Sequence< PropertyValue >& PropertyValues_) +{ +} + +//---------------------------------------------------------------------------- + +void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) +{ + // Wir brauchen mindestens 1 Parameter + if ( rPar.Count() < 2 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + // Klassen-Name der struct holen + String aServiceName( RTL_CONSTASCII_USTRINGPARAM("stardiv.uno.beans.PropertySet") ); + +#if 0 + // Service suchen und instanzieren + Reference< XMultiServiceFactory > xServiceManager = getProcessServiceFactory(); + Reference< XInterface > xInterface; + if( xProv.is() ) + xInterface = xProv->newInstance(); +#else + Reference< XInterface > xInterface = (OWeakObject*) new SbPropertyValues(); +#endif + + SbxVariableRef refVar = rPar.Get(0); + if( xInterface.is() ) + { + // PropertyValues setzen + Any aArgAsAny = sbxToUnoValue( rPar.Get(1), + TypeToIdlClass( getCppuType( (Sequence<PropertyValue>*)0 ) ) ); + Sequence<PropertyValue> *pArg = + (Sequence<PropertyValue>*) aArgAsAny.getValue(); + Reference< XPropertyAccess > xPropAcc = Reference< XPropertyAccess >::query( xInterface ); + xPropAcc->setPropertyValues( *pArg ); + + // SbUnoObject daraus basteln und zurueckliefern + Any aAny; + aAny <<= xInterface; + SbUnoObjectRef xUnoObj = new SbUnoObject( aServiceName, aAny ); + if( xUnoObj->getUnoAny().getValueType().getTypeClass() != TypeClass_VOID ) + { + // Objekt zurueckliefern + refVar->PutObject( (SbUnoObject*)xUnoObj ); + return; + } + } + + // Objekt konnte nicht erzeugt werden + refVar->PutObject( NULL ); +} + + diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx new file mode 100644 index 000000000000..6b3cd5c011ba --- /dev/null +++ b/basic/source/classes/sb.cxx @@ -0,0 +1,1028 @@ +/************************************************************************* + * + * $RCSfile: sb.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <stdio.h> // sprintf() + +#pragma hdrstop +#include "sb.hxx" +#ifdef VCL +#include <vcl/rcid.h> +#include <vcl/config.hxx> +#endif + +#ifndef _STREAM_HXX //autogen +#include <tools/stream.hxx> +#endif +#ifndef __RSC //autogen +#include <tools/errinf.hxx> +#endif +#ifndef _SBXCLASS_HXX //autogen +#include <svtools/sbx.hxx> +#endif +#ifndef _LIST_HXX //autogen +#include <tools/list.hxx> +#endif +#ifndef _SHL_HXX //autogen +#include <tools/shl.hxx> +#endif +#ifndef _TOOLS_RC_HXX //autogen +#include <tools/rc.hxx> +#endif +#ifndef _SV_SVAPP_HXX //autogen +#include <vcl/svapp.hxx> +#endif +#include "sbunoobj.hxx" +#include "sbjsmeth.hxx" +#include "sbjsmod.hxx" +#include "sbintern.hxx" +#include "disas.hxx" +#include "runtime.hxx" +#include "sbuno.hxx" +#include "stdobj.hxx" +#include "filefmt.hxx" +#include "sb.hrc" +#include <basrid.hxx> + +#pragma SW_SEGMENT_CLASS( SBASIC, SBASIC_CODE ) + +SV_IMPL_VARARR(SbTextPortions,SbTextPortion) + +TYPEINIT1(StarBASIC,SbxObject) + +#define RTLNAME "@SBRTL" + + +//======================================================================== +// Array zur Umrechnung SFX <-> VB-Fehlercodes anlegen + +struct SFX_VB_ErrorItem +{ + USHORT nErrorVB; + SbError nErrorSFX; +}; + +const SFX_VB_ErrorItem __FAR_DATA SFX_VB_ErrorTab[] = +{ + { 2, SbERR_SYNTAX }, + { 3, SbERR_NO_GOSUB }, + { 4, SbERR_REDO_FROM_START }, + { 5, SbERR_BAD_ARGUMENT }, + { 6, SbERR_MATH_OVERFLOW }, + { 7, SbERR_NO_MEMORY }, + { 8, SbERR_ALREADY_DIM }, + { 9, SbERR_OUT_OF_RANGE }, + { 10, SbERR_DUPLICATE_DEF }, + { 11, SbERR_ZERODIV }, + { 12, SbERR_VAR_UNDEFINED }, + { 13, SbERR_CONVERSION }, + { 14, SbERR_BAD_PARAMETER }, + { 18, SbERR_USER_ABORT }, + { 20, SbERR_BAD_RESUME }, + { 28, SbERR_STACK_OVERFLOW }, + { 35, SbERR_PROC_UNDEFINED }, + { 48, SbERR_BAD_DLL_LOAD }, + { 49, SbERR_BAD_DLL_CALL }, + { 51, SbERR_INTERNAL_ERROR }, + { 52, SbERR_BAD_CHANNEL }, + { 53, SbERR_FILE_NOT_FOUND }, + { 54, SbERR_BAD_FILE_MODE }, + { 55, SbERR_FILE_ALREADY_OPEN }, + { 57, SbERR_IO_ERROR }, + { 58, SbERR_FILE_EXISTS }, + { 59, SbERR_BAD_RECORD_LENGTH }, + { 61, SbERR_DISK_FULL }, + { 62, SbERR_READ_PAST_EOF }, + { 63, SbERR_BAD_RECORD_NUMBER }, + { 67, SbERR_TOO_MANY_FILES }, + { 68, SbERR_NO_DEVICE }, + { 70, SbERR_ACCESS_DENIED }, + { 71, SbERR_NOT_READY }, + { 73, SbERR_NOT_IMPLEMENTED }, + { 74, SbERR_DIFFERENT_DRIVE }, + { 75, SbERR_ACCESS_ERROR }, + { 76, SbERR_PATH_NOT_FOUND }, + { 91, SbERR_NO_OBJECT }, + { 93, SbERR_BAD_PATTERN }, + { 94, SBERR_IS_NULL }, + { 250, SbERR_DDE_ERROR }, + { 280, SbERR_DDE_WAITINGACK }, + { 281, SbERR_DDE_OUTOFCHANNELS }, + { 282, SbERR_DDE_NO_RESPONSE }, + { 283, SbERR_DDE_MULT_RESPONSES }, + { 284, SbERR_DDE_CHANNEL_LOCKED }, + { 285, SbERR_DDE_NOTPROCESSED }, + { 286, SbERR_DDE_TIMEOUT }, + { 287, SbERR_DDE_USER_INTERRUPT }, + { 288, SbERR_DDE_BUSY }, + { 289, SbERR_DDE_NO_DATA }, + { 290, SbERR_DDE_WRONG_DATA_FORMAT }, + { 291, SbERR_DDE_PARTNER_QUIT }, + { 292, SbERR_DDE_CONV_CLOSED }, + { 293, SbERR_DDE_NO_CHANNEL }, + { 294, SbERR_DDE_INVALID_LINK }, + { 295, SbERR_DDE_QUEUE_OVERFLOW }, + { 296, SbERR_DDE_LINK_ALREADY_EST }, + { 297, SbERR_DDE_LINK_INV_TOPIC }, + { 298, SbERR_DDE_DLL_NOT_FOUND }, + { 323, SbERR_CANNOT_LOAD }, + { 341, SbERR_BAD_INDEX }, + { 366, SbERR_NO_ACTIVE_OBJECT }, + { 380, SbERR_BAD_PROP_VALUE }, + { 382, SbERR_PROP_READONLY }, + { 394, SbERR_PROP_WRITEONLY }, + { 420, SbERR_INVALID_OBJECT }, + { 423, SbERR_NO_METHOD }, + { 424, SbERR_NEEDS_OBJECT }, + { 425, SbERR_INVALID_USAGE_OBJECT }, + { 430, SbERR_NO_OLE }, + { 438, SbERR_BAD_METHOD }, + { 440, SbERR_OLE_ERROR }, + { 445, SbERR_BAD_ACTION }, + { 446, SbERR_NO_NAMED_ARGS }, + { 447, SbERR_BAD_LOCALE }, + { 448, SbERR_NAMED_NOT_FOUND }, + { 449, SbERR_NOT_OPTIONAL }, + { 450, SbERR_WRONG_ARGS }, + { 451, SbERR_NOT_A_COLL }, + { 452, SbERR_BAD_ORDINAL }, + { 453, SbERR_DLLPROC_NOT_FOUND }, + { 460, SbERR_BAD_CLIPBD_FORMAT }, + { 951, SbERR_UNEXPECTED }, + { 952, SbERR_EXPECTED }, + { 953, SbERR_SYMBOL_EXPECTED }, + { 954, SbERR_VAR_EXPECTED }, + { 955, SbERR_LABEL_EXPECTED }, + { 956, SbERR_LVALUE_EXPECTED }, + { 957, SbERR_VAR_DEFINED }, + { 958, SbERR_PROC_DEFINED }, + { 959, SbERR_LABEL_DEFINED }, + { 960, SbERR_UNDEF_VAR }, + { 961, SbERR_UNDEF_ARRAY }, + { 962, SbERR_UNDEF_PROC }, + { 963, SbERR_UNDEF_LABEL }, + { 964, SbERR_UNDEF_TYPE }, + { 965, SbERR_BAD_EXIT }, + { 966, SbERR_BAD_BLOCK }, + { 967, SbERR_BAD_BRACKETS }, + { 968, SbERR_BAD_DECLARATION }, + { 969, SbERR_BAD_PARAMETERS }, + { 970, SbERR_BAD_CHAR_IN_NUMBER }, + { 971, SbERR_MUST_HAVE_DIMS }, + { 972, SbERR_NO_IF }, + { 973, SbERR_NOT_IN_SUBR }, + { 974, SbERR_NOT_IN_MAIN }, + { 975, SbERR_WRONG_DIMS }, + { 976, SbERR_BAD_OPTION }, + { 977, SbERR_CONSTANT_REDECLARED }, + { 978, SbERR_PROG_TOO_LARGE }, + { 979, SbERR_NO_STRINGS_ARRAYS }, + { 1000, SbERR_PROPERTY_NOT_FOUND }, + { 1001, SbERR_METHOD_NOT_FOUND }, + { 1002, SbERR_ARG_MISSING }, + { 1003, SbERR_BAD_NUMBER_OF_ARGS }, + { 1004, SbERR_METHOD_FAILED }, + { 1005, SbERR_SETPROP_FAILED }, + { 1006, SbERR_GETPROP_FAILED }, + { 0xFFFF, 0xFFFFFFFFL } // End-Marke +}; + +//////////////////////////////////////////////////////////////////////////// + +// Die StarBASIC-Factory hat einen Hack. Wenn ein SbModule eingerichtet wird, +// wird der Pointer gespeichert und an nachfolgende SbProperties/SbMethods +// uebergeben. Dadurch wird die Modul-Relationship wiederhergestellt. Das +// klappt aber nur, wenn ein Modul geladen wird. Fuer getrennt geladene +// Properties kann es Probleme geben! + +SbxBase* SbiFactory::Create( UINT16 nSbxId, UINT32 nCreator ) +{ + if( nCreator == SBXCR_SBX ) + { + String aEmpty; + switch( nSbxId ) + { + case SBXID_BASIC: + return new StarBASIC( NULL ); + case SBXID_BASICMOD: + return new SbModule( aEmpty ); + case SBXID_BASICPROP: + return new SbProperty( aEmpty, SbxVARIANT, NULL ); + case SBXID_BASICMETHOD: + return new SbMethod( aEmpty, SbxVARIANT, NULL ); + case SBXID_JSCRIPTMOD: + return new SbJScriptModule( aEmpty ); + case SBXID_JSCRIPTMETH: + return new SbJScriptMethod( aEmpty, SbxVARIANT, NULL ); + } + } + return NULL; +} + +SbxObject* SbiFactory::CreateObject( const String& rClass ) +{ + if( rClass.EqualsIgnoreCaseAscii( "StarBASIC" ) ) + return new StarBASIC( NULL ); + else + if( rClass.EqualsIgnoreCaseAscii( "StarBASICModule" ) ) + { + String aEmpty; + return new SbModule( aEmpty ); + } + else + return NULL; +} + +//////////////////////////////////////////////////////////////////////////// + +StarBASIC::StarBASIC( StarBASIC* p ) + : SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("StarBASIC") ) ) +{ + SetParent( p ); + pLibInfo = NULL; + bNoRtl = bBreak = FALSE; + pModules = new SbxArray; + +#ifdef DBG_UTIL + Config LangConfig( String( RTL_CONSTASCII_USTRINGPARAM("d:\\LANGUAGE.INI") ) ); + LangConfig.SetGroup( "main" ); + ByteString aStr = LangConfig.ReadKey( "language","basic" ); + if( aStr == "vbscript" ) + SetGlobalLanguageMode( SB_LANG_VBSCRIPT ); + else + if( aStr == "javascript" ) + SetGlobalLanguageMode( SB_LANG_JAVASCRIPT ); +#endif + + if( !GetSbData()->nInst++ ) + { + pSBFAC = new SbiFactory; + AddFactory( pSBFAC ); + pUNOFAC = new SbUnoFactory; + AddFactory( pUNOFAC ); + } + pRtl = new SbiStdObject( String( RTL_CONSTASCII_USTRINGPARAM(RTLNAME) ), this ); + // Suche ueber StarBASIC ist immer global + SetFlag( SBX_GBLSEARCH ); +} + +// #51727 SetModified ueberladen, damit der Modified- +// Zustand nicht an den Parent weitergegeben wird. +void StarBASIC::SetModified( BOOL b ) +{ + SbxBase::SetModified( b ); +} + +//*** + +StarBASIC::~StarBASIC() +{ + if( !--GetSbData()->nInst ) + { + RemoveFactory( pSBFAC ); + pSBFAC = NULL; + RemoveFactory( pUNOFAC ); + pUNOFAC = NULL; + +#ifdef DBG_UTIL + // SbiData braucht am Programm-Ende nicht abgeraeumt werden, + // aber wir wollen keine MLK's beim Purify + // Wo sollte es sonst geschehen??? + SbiGlobals** pp = (SbiGlobals**) ::GetAppData( SHL_SBC ); + SbiGlobals* p = *pp; + if( p ) + { + delete p; + *pp = 0; + } +#endif + } +} + +// operator new() wird hier versenkt, damit jeder eine Instanz +// anlegen kann, ohne neu zu bilden. + +void* StarBASIC::operator new( size_t n ) +{ + if( n < sizeof( StarBASIC ) ) + { +// DBG_ASSERT( FALSE, "Warnung: inkompatibler BASIC-Stand!" ); + n = sizeof( StarBASIC ); + } + return ::operator new( n ); +} + +void StarBASIC::operator delete( void* p ) +{ + ::operator delete( p ); +} + +/************************************************************************** +* +* Erzeugen/Verwalten von Modulen +* +**************************************************************************/ + +SbModule* StarBASIC::MakeModule( const String& rName, const String& rSrc ) +{ + SbModule* p = new SbModule( rName ); + p->SetSource( rSrc ); + p->SetParent( this ); + pModules->Insert( p, pModules->Count() ); + SetModified( TRUE ); + return p; +} + +void StarBASIC::Insert( SbxVariable* pVar ) +{ + if( pVar->IsA( TYPE(SbModule) ) ) + { + pModules->Insert( pVar, pModules->Count() ); + pVar->SetParent( this ); + StartListening( pVar->GetBroadcaster(), TRUE ); + } + else + { + BOOL bWasModified = IsModified(); + SbxObject::Insert( pVar ); + if( !bWasModified && pVar->IsSet( SBX_DONTSTORE ) ) + SetModified( FALSE ); + } +} + +void StarBASIC::Remove( SbxVariable* pVar ) +{ + if( pVar->IsA( TYPE(SbModule) ) ) + { + pModules->Remove( pVar ); + pVar->SetParent( 0 ); + EndListening( pVar->GetBroadcaster() ); + } + else + SbxObject::Remove( pVar ); +} + +BOOL StarBASIC::Compile( SbModule* pMod ) +{ + return pMod ? pMod->Compile() : FALSE; +} + +BOOL StarBASIC::Disassemble( SbModule* pMod, String& rText ) +{ + rText.Erase(); + if( pMod ) + pMod->Disassemble( rText ); + return BOOL( rText.Len() != 0 ); +} + +void StarBASIC::Clear() +{ + while( pModules->Count() ) + pModules->Remove( pModules->Count() - 1 ); +} + +SbModule* StarBASIC::FindModule( const String& rName ) +{ + for( USHORT i = 0; i < pModules->Count(); i++ ) + { + SbModule* p = (SbModule*) pModules->Get( i ); + if( p->GetName().EqualsIgnoreCaseAscii( rName ) ) + return p; + } + return NULL; +} + +// Init-Code aller Module ausfuehren (auch in inserteten Bibliotheken) +void StarBASIC::InitAllModules( void ) +{ + // Eigene Module initialisieren + for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ ) + { + SbModule* pModule = (SbModule*)pModules->Get( nMod ); + if( !pModule->IsCompiled() ) + pModule->Compile(); + pModule->RunInit(); + } + // Alle Objekte ueberpruefen, ob es sich um ein Basic handelt + // Wenn ja, auch dort initialisieren + for ( USHORT nObj = 0; nObj < pObjs->Count(); nObj++ ) + { + SbxVariable* pVar = pObjs->Get( nObj ); + StarBASIC* pBasic = PTR_CAST(StarBASIC,pVar); + if( pBasic ) + pBasic->InitAllModules(); + } +} + +// #43011 Fuer das TestTool, um globale Variablen loeschen zu koennen +void StarBASIC::ClearGlobalVars( void ) +{ + SbxArrayRef xProps( GetProperties() ); + USHORT nPropCount = xProps->Count(); + for ( USHORT nProp = 0 ; nProp < nPropCount ; ++nProp ) + { + SbxBase* pVar = xProps->Get( nProp ); + pVar->Clear(); + } + SetModified( TRUE ); +} + + +// Diese Implementation sucht erst innerhalb der Runtime-Library, dann +// nach einem Element innerhalb eines Moduls. Dieses Element kann eine +// Public-Variable oder ein Entrypoint sein. Wenn nicht gefunden, wird, +// falls nach einer Methode gesucht wird und ein Modul mit dem angege- +// benen Namen gefunden wurde, der Entrypoint "Main" gesucht. Wenn das +// auch nicht klappt, laeuft die traditionelle Suche ueber Objekte an. + +SbxVariable* StarBASIC::Find( const String& rName, SbxClassType t ) +{ + SbxVariable* pRes = NULL; + SbModule* pNamed = NULL; + // "Extended" search in Runtime Lib + // aber nur, wenn SbiRuntime nicht das Flag gesetzt hat + if( !bNoRtl ) + { + if( t == SbxCLASS_DONTCARE || t == SbxCLASS_OBJECT ) + { + if( rName.EqualsIgnoreCaseAscii( RTLNAME ) ) + pRes = pRtl; + } + if( !pRes ) + pRes = ((SbiStdObject*) (SbxObject*) pRtl)->Find( rName, t ); + if( pRes ) + pRes->SetFlag( SBX_EXTFOUND ); + } + // Module durchsuchen + if( !pRes ) + for( USHORT i = 0; i < pModules->Count(); i++ ) + { + SbModule* p = (SbModule*) pModules->Get( i ); + if( p->IsVisible() ) + { + // Modul merken fuer Main()-Aufruf + // oder stimmt etwa der Name ueberein?!? + if( p->GetName().EqualsIgnoreCaseAscii( rName ) ) + { + if( t == SbxCLASS_OBJECT || t == SbxCLASS_DONTCARE ) + { + pRes = p; break; + } + pNamed = p; + } + // Sonst testen, ob das Element vorhanden ist + // GBLSEARCH-Flag rausnehmen (wg. Rekursion) + USHORT nGblFlag = p->GetFlags() & SBX_GBLSEARCH; + p->ResetFlag( SBX_GBLSEARCH ); + pRes = p->Find( rName, t ); + p->SetFlag( nGblFlag ); + if( pRes ) + break; + } + } + if( !pRes && pNamed && ( t == SbxCLASS_METHOD || t == SbxCLASS_DONTCARE ) ) + pRes = pNamed->Find( String( RTL_CONSTASCII_USTRINGPARAM("Main") ), SbxCLASS_METHOD ); + if( !pRes ) + pRes = SbxObject::Find( rName, t ); + return pRes; +} + +BOOL StarBASIC::Call( const String& rName, SbxArray* pParam ) +{ + BOOL bRes = SbxObject::Call( rName, pParam ); + if( !bRes ) + { + SbxError eErr = SbxBase::GetError(); + SbxBase::ResetError(); + if( eErr != SbxERR_OK ) + RTError( (SbError)eErr, 0, 0, 0 ); + } + return bRes; +} + +// Find-Funktion ueber Name (z.B. Abfrage aus BASIC-IDE) +SbxBase* StarBASIC::FindSBXInCurrentScope( const String& rName ) +{ + if( !pINST ) + return NULL; + if( !pINST->pRun ) + return NULL; + return pINST->pRun->FindElementExtern( rName ); +} + +// Alte Schnittstelle vorerst erhalten +SbxVariable* StarBASIC::FindVarInCurrentScopy +( const String& rName, USHORT& rStatus ) +{ + rStatus = 1; // Annahme: Nichts gefunden + SbxVariable* pVar = NULL; + SbxBase* pSbx = FindSBXInCurrentScope( rName ); + if( pSbx ) + { + if( !pSbx->ISA(SbxMethod) && !pSbx->ISA(SbxObject) ) + pVar = PTR_CAST(SbxVariable,pSbx); + } + if( pVar ) + rStatus = 0; // doch gefunden + return pVar; +} + +void StarBASIC::Stop() +{ + SbiInstance* p = pINST; + while( p ) + { + p->Stop(); + p = p->pNext; + } +} + +BOOL StarBASIC::IsRunning() +{ + return BOOL( pINST != NULL ); +} + +/************************************************************************** +* +* Objekt-Factories etc. +* +**************************************************************************/ + +// Aktivierung eines Objekts. Aktive Objekte muessen nicht mehr +// von BASIC aus ueber den Namen angesprochen werden. Ist +// NULL angegeben, wird alles aktiviert. + +void StarBASIC::ActivateObject( const String* pName, BOOL bActivate ) +{ + if( pName ) + { + SbxObject* p = (SbxObject*) SbxObject::Find( *pName, SbxCLASS_OBJECT ); + if( p ) + if( bActivate ) + p->SetFlag( SBX_EXTSEARCH ); + else + p->ResetFlag( SBX_EXTSEARCH ); + } + else + { + for( USHORT i = 0; i < GetObjects()->Count(); i++ ) + { + SbxObject* p = (SbxObject*) GetObjects()->Get( i ); + if( bActivate ) + p->SetFlag( SBX_EXTSEARCH ); + else + p->ResetFlag( SBX_EXTSEARCH ); + } + } +} + +/************************************************************************** +* +* Debugging und Fehlerbehandlung +* +**************************************************************************/ + +SbMethod* StarBASIC::GetActiveMethod( USHORT nLevel ) +{ + if( pINST ) + return pINST->GetCaller( nLevel ); + else + return NULL; +} + +SbModule* StarBASIC::GetActiveModule() +{ + if( pINST && !IsCompilerError() ) + return pINST->GetActiveModule(); + else + return pCMOD; +} + +USHORT StarBASIC::BreakPoint( USHORT l, USHORT c1, USHORT c2 ) +{ + SetErrorData( 0, l, c1, c2 ); + bBreak = TRUE; + if( GetSbData()->aBreakHdl.IsSet() ) + return (USHORT) GetSbData()->aBreakHdl.Call( this ); + else + return BreakHdl(); +} + +USHORT StarBASIC::StepPoint( USHORT l, USHORT c1, USHORT c2 ) +{ + SetErrorData( 0, l, c1, c2 ); + bBreak = FALSE; + if( GetSbData()->aBreakHdl.IsSet() ) + return (USHORT) GetSbData()->aBreakHdl.Call( this ); + else + return BreakHdl(); +} + +USHORT __EXPORT StarBASIC::BreakHdl() +{ + return (USHORT) ( aBreakHdl.IsSet() + ? aBreakHdl.Call( this ) : SbDEBUG_CONTINUE ); +} + +// Abfragen fuer den Error-Handler und den Break-Handler: +USHORT StarBASIC::GetLine() { return GetSbData()->nLine; } +USHORT StarBASIC::GetCol1() { return GetSbData()->nCol1; } +USHORT StarBASIC::GetCol2() { return GetSbData()->nCol2; } + +// Spezifisch fuer den Error-Handler: +SbError StarBASIC::GetErrorCode() { return GetSbData()->nCode; } +const String& StarBASIC::GetErrorText() { return GetSbData()->aErrMsg; } +BOOL StarBASIC::IsCompilerError() { return GetSbData()->bCompiler; } +void StarBASIC::SetGlobalLanguageMode( SbLanguageMode eLanguageMode ) +{ + GetSbData()->eLanguageMode = eLanguageMode; +} +SbLanguageMode StarBASIC::GetGlobalLanguageMode() +{ + return GetSbData()->eLanguageMode; +} +// Lokale Einstellung +SbLanguageMode StarBASIC::GetLanguageMode() +{ + // Globale Einstellung nehmen? + if( eLanguageMode == SB_LANG_GLOBAL ) + return GetSbData()->eLanguageMode; + else + return eLanguageMode; +} + +// AB: 29.3.96 +// Das Mapping zwischen alten und neuen Fehlercodes erfolgt, indem die Tabelle +// SFX_VB_ErrorTab[] durchsucht wird. Dies ist zwar nicht besonders performant, +// verbraucht aber viel weniger Speicher als entsprechende switch-Bloecke. +// Die Umrechnung von Fehlercodes muss nicht schnell sein, daher auch keine +// binaere Suche bei VB-Error -> SFX-Error. + +// Neue Fehler-Codes auf alte, Sbx-Kompatible zurueckmappen +USHORT StarBASIC::GetVBErrorCode( SbError nError ) +{ + USHORT nRet = 0; + + // Suchschleife + const SFX_VB_ErrorItem* pErrItem; + USHORT nIndex = 0; + do + { + pErrItem = SFX_VB_ErrorTab + nIndex; + if( pErrItem->nErrorSFX == nError ) + { + nRet = pErrItem->nErrorVB; + break; + } + nIndex++; + } + while( pErrItem->nErrorVB != 0xFFFF ); // bis End-Marke + return nRet; +} + +SbError StarBASIC::GetSfxFromVBError( USHORT nError ) +{ + SbError nRet = 0L; + + // Suchschleife + const SFX_VB_ErrorItem* pErrItem; + USHORT nIndex = 0; + do + { + pErrItem = SFX_VB_ErrorTab + nIndex; + if( pErrItem->nErrorVB == nError ) + { + nRet = pErrItem->nErrorSFX; + break; + } + else if( pErrItem->nErrorVB > nError ) + break; // kann nicht mehr gefunden werden + + nIndex++; + } + while( pErrItem->nErrorVB != 0xFFFF ); // bis End-Marke + return nRet; +} + +// Error- / Break-Daten setzen +void StarBASIC::SetErrorData +( SbError nCode, USHORT nLine, USHORT nCol1, USHORT nCol2 ) +{ + SbiGlobals& aGlobals = *GetSbData(); + aGlobals.nCode = nCode; + aGlobals.nLine = nLine; + aGlobals.nCol1 = nCol1; + aGlobals.nCol2 = nCol2; +} + +//---------------------------------------------------------------- +// Hilfsklasse zum Zugriff auf String SubResourcen einer Resource. +// Quelle: sfx2\source\doc\docfile.cxx (TLX) +struct BasicStringList_Impl : private Resource +{ + ResId aResId; + + BasicStringList_Impl( ResId& rErrIdP, USHORT nId) + : Resource( rErrIdP ),aResId(nId){} + ~BasicStringList_Impl() { FreeResource(); } + + String GetString(){ return String( aResId ); } + BOOL IsErrorTextAvailable( void ) + { return IsAvailableRes(aResId.SetRT(RSC_STRING)); } +}; +//---------------------------------------------------------------- + +// #60175 Flag, das bei Basic-Fehlern das Anziehen der SFX-Resourcen verhindert +static BOOL bStaticSuppressSfxResource = FALSE; + +void StarBASIC::StaticSuppressSfxResource( BOOL bSuppress ) +{ + bStaticSuppressSfxResource = bSuppress; +} + +void StarBASIC::MakeErrorText( SbError nId, const String& aMsg ) +{ + if( bStaticSuppressSfxResource ) + { + GetSbData()->aErrMsg = String( RTL_CONSTASCII_USTRINGPARAM("No resource: Error message not available") ); + return; + } + + USHORT nOldID = GetVBErrorCode( nId ); + + // Hilfsklasse instanzieren + BasicResId aId( RID_BASIC_START ); + BasicStringList_Impl aMyStringList( aId, USHORT(nId & ERRCODE_RES_MASK) ); + + if( aMyStringList.IsErrorTextAvailable() ) + { + // Merge Message mit Zusatztext + String aMsg1 = aMyStringList.GetString(); + // Argument-Platzhalter durch %s ersetzen + String aSrgStr( RTL_CONSTASCII_USTRINGPARAM("$(ARG1)") ); + USHORT nResult = aMsg1.Search( aSrgStr ); + + if( nResult != STRING_NOTFOUND ) + { + aMsg1.Erase( nResult, aSrgStr.Len() ); + aMsg1.Insert( aMsg, nResult ); + } + GetSbData()->aErrMsg = aMsg1; + } + else + { + String aStdMsg( RTL_CONSTASCII_USTRINGPARAM("Fehler ") ); + aStdMsg += String::CreateFromInt32( nOldID); + aStdMsg += String( RTL_CONSTASCII_USTRINGPARAM(": Kein Fehlertext verfuegbar!") ); + GetSbData()->aErrMsg = aStdMsg; + } +} + +BOOL StarBASIC::CError + ( SbError code, const String& rMsg, USHORT l, USHORT c1, USHORT c2 ) +{ + // Compiler-Fehler waehrend der Laufzeit -> Programm anhalten + if( IsRunning() ) + Stop(); + + // #45741# Falls der Wait-Cursor gesetzt ist, jetzt zuruecksetzen + if( GetSbData()->bCompWait ) + { + Application::LeaveWait(); + GetSbData()->bCompWait = FALSE; + } + + // Flag setzen, damit GlobalRunInit den Fehler mitbekommt + GetSbData()->bGlobalInitErr = TRUE; + + // Fehlertext basteln + MakeErrorText( code, rMsg ); + + // Umsetzung des Codes fuer String-Transport in SFX-Error + if( rMsg.Len() ) + code = (ULONG)*new StringErrorInfo( code, String(rMsg) ); + + SetErrorData( code, l, c1, c2 ); + GetSbData()->bCompiler = TRUE; + BOOL bRet; + if( GetSbData()->aErrHdl.IsSet() ) + bRet = (BOOL) GetSbData()->aErrHdl.Call( this ); + else + bRet = ErrorHdl(); + GetSbData()->bCompiler = FALSE; // nur TRUE fuer Error-Handler + return bRet; +} + +BOOL StarBASIC::RTError + ( SbError code, USHORT l, USHORT c1, USHORT c2 ) +{ + return RTError( code, String(), l, c1, c2 ); +} + +BOOL StarBASIC::RTError( SbError code, const String& rMsg, USHORT l, USHORT c1, USHORT c2 ) +{ + SbError c = code; + if( (c & ERRCODE_CLASS_MASK) == ERRCODE_CLASS_COMPILER ) + c = 0; + MakeErrorText( c, rMsg ); + + // Umsetzung des Codes fuer String-Transport in SFX-Error + if( rMsg.Len() ) + code = (ULONG)*new StringErrorInfo( code, String(rMsg) ); + + SetErrorData( code, l, c1, c2 ); + if( GetSbData()->aErrHdl.IsSet() ) + return (BOOL) GetSbData()->aErrHdl.Call( this ); + else + return ErrorHdl(); +} + +void StarBASIC::Error( SbError n ) +{ + Error( n, String() ); +} + +void StarBASIC::Error( SbError n, const String& rMsg ) +{ + if( pINST ) + pINST->Error( n, rMsg ); +} + +void StarBASIC::FatalError( SbError n ) +{ + if( pINST ) + pINST->FatalError( n ); +} + +SbError StarBASIC::GetErr() +{ + if( pINST ) + return pINST->GetErr(); + else + return 0; +} + +// #66536 Zusatz-Message fuer RTL-Funktion Error zugreifbar machen +String StarBASIC::GetErrorMsg() +{ + if( pINST ) + return pINST->GetErrorMsg(); + else + return String(); +} + +USHORT StarBASIC::GetErl() +{ + if( pINST ) + return pINST->GetErl(); + else + return 0; +} + +BOOL __EXPORT StarBASIC::ErrorHdl() +{ + return (BOOL) ( aErrorHdl.IsSet() + ? aErrorHdl.Call( this ) : FALSE ); +} + +Link StarBASIC::GetGlobalErrorHdl() +{ + return GetSbData()->aErrHdl; +} + +void StarBASIC::SetGlobalErrorHdl( const Link& rLink ) +{ + GetSbData()->aErrHdl = rLink; +} + + +Link StarBASIC::GetGlobalBreakHdl() +{ + return GetSbData()->aBreakHdl; +} + +void StarBASIC::SetGlobalBreakHdl( const Link& rLink ) +{ + GetSbData()->aBreakHdl = rLink; +} + +/************************************************************************** +* +* Laden und Speichern +* +**************************************************************************/ + +BOOL StarBASIC::LoadData( SvStream& r, USHORT nVer ) +{ + if( !SbxObject::LoadData( r, nVer ) ) + return FALSE; + UINT16 nMod; + pModules->Clear(); + r >> nMod; + for( USHORT i = 0; i < nMod; i++ ) + { + SbModule* pMod = (SbModule*) SbxBase::Load( r ); + if( !pMod ) + return FALSE; + else if( pMod->ISA(SbJScriptModule) ) + { + // Ref zuweisen, damit pMod deleted wird + SbModuleRef xRef = pMod; + } + else + { + pMod->SetParent( this ); + pModules->Put( pMod, i ); + } + } + // HACK fuer SFX-Mist! + SbxVariable* p = Find( String( RTL_CONSTASCII_USTRINGPARAM("FALSE") ), SbxCLASS_PROPERTY ); + if( p ) + Remove( p ); + p = Find( String( RTL_CONSTASCII_USTRINGPARAM("TRUE") ), SbxCLASS_PROPERTY ); + if( p ) + Remove( p ); + // Ende des Hacks! + // Suche ueber StarBASIC ist immer global + DBG_ASSERT( IsSet( SBX_GBLSEARCH ), "Basic ohne GBLSEARCH geladen" ); + SetFlag( SBX_GBLSEARCH ); + return TRUE; +} + +BOOL StarBASIC::StoreData( SvStream& r ) const +{ + if( !SbxObject::StoreData( r ) ) + return FALSE; + r << (UINT16) pModules->Count(); + for( USHORT i = 0; i < pModules->Count(); i++ ) + { + SbModule* p = (SbModule*) pModules->Get( i ); + if( !p->Store( r ) ) + return FALSE; + } + return TRUE; +} + +BOOL StarBASIC::LoadOldModules( SvStream& r ) +{ + return FALSE; +} + + diff --git a/basic/source/classes/sb.src b/basic/source/classes/sb.src new file mode 100644 index 000000000000..ba78c4a83d89 --- /dev/null +++ b/basic/source/classes/sb.src @@ -0,0 +1,3747 @@ +/************************************************************************* + * + * $RCSfile: sb.src,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#define __RSC +#ifndef _ERRCODE_HXX //autogen +#include <tools/errcode.hxx> +#endif +#include "sb.hrc" +#include "sberrors.hxx" + +Resource RID_BASIC_START +{ + String SbERR_SYNTAX & ERRCODE_RES_MASK + { + Text = "Syntaxfehler" ; + Text [ ENGLISH ] = "Syntax error" ; + Text [ norwegian ] = "Syntax error" ; + Text [ italian ] = "Errore di sintassi" ; + Text [ portuguese_brazilian ] = "Syntax error" ; + Text [ portuguese ] = "Erro de sintaxe" ; + Text [ french ] = "Erreur de syntaxe" ; + Text [ dutch ] = "Fout in syntaxis" ; + Text [ spanish ] = "Error de sintaxis" ; + Text [ danish ] = "Syntaksfejl" ; + Text [ swedish ] = "Syntaxfel" ; + Text [ finnish ] = "Syntax error" ; + Text [ english_us ] = "Syntax error" ; + Text[ chinese_simplified ] = "Óï·¨´íÎó"; + Text[ russian ] = "Ñèíòàêñè÷åñêàÿ îøèáêà"; + Text[ polish ] = "B³¹d sk³adni"; + Text[ japanese ] = "¼ÝÀ¯¸½ ´×°"; + Text[ chinese_traditional ] = "»yªk¿ù»~"; + Text[ arabic ] = "ÎØÃ Ýí ÈäÇÁ ÇáÌãáÉ"; + Text[ dutch ] = "Fout in syntaxis"; + Text[ chinese_simplified ] = "Óï·¨´íÎó"; + Text[ greek ] = "ÓöÜëìá óýíôáîçò"; + Text[ korean ] = "½ÅÅØ½º ¿¡·¯"; + Text[ turkish ] = "Sözdizim hatasý"; + Text[ language_user1 ] = " "; + }; + String SbERR_NO_GOSUB & ERRCODE_RES_MASK + { + Text = "Return ohne Gosub" ; + Text [ ENGLISH ] = "Return without Gosub" ; + Text [ norwegian ] = "Return without Gosub" ; + Text [ italian ] = "Return senza Gosub" ; + Text [ portuguese_brazilian ] = "Return without Gosub" ; + Text [ portuguese ] = "Retorno sem Gosub" ; + Text [ french ] = "Return sans Gosub" ; + Text [ dutch ] = "Return zonder Gosub" ; + Text [ spanish ] = "Retorno sin Gosub" ; + Text [ danish ] = "Return uden Gosub" ; + Text [ swedish ] = "Return utan Gosub" ; + Text [ finnish ] = "Return without Gosub" ; + Text [ english_us ] = "Return without Gosub" ; + Text[ chinese_simplified ] = "Return ²»´ø Gosub"; + Text[ russian ] = "Âîçâðàò áåç Gosub"; + Text[ polish ] = "Powrót bez Gosub"; + Text[ japanese ] = "Return without Gosub"; + Text[ chinese_traditional ] = "Return ¤£±a Gosub"; + Text[ arabic ] = "Gosub ÈÏæä Return"; + Text[ dutch ] = "Return zonder Gosub"; + Text[ chinese_simplified ] = "Return ²»´ø Gosub"; + Text[ greek ] = "Return ÷ùñßò Gosub"; + Text[ korean ] = "Gosub ¾ø´Â ¸®ÅÏ"; + Text[ turkish ] = "Gosub olmadan return"; + Text[ language_user1 ] = " "; + }; + String SbERR_REDO_FROM_START & ERRCODE_RES_MASK + { + Text = "Inkorrekte Eingabe, bitte wiederholen" ; + Text [ ENGLISH ] = "Incorrect data, please retry" ; + Text [ norwegian ] = "Incorrect data, please retry" ; + Text [ italian ] = "Digitazione errata, riprovare" ; + Text [ portuguese_brazilian ] = "Incorrect data, please retry" ; + Text [ portuguese ] = "Entrada incorrecta, tente novamente" ; + Text [ french ] = "Saisie incorrecte, veuillez recommencer" ; + Text [ dutch ] = "Incorrecte gegevens, herhalen a.u.b." ; + Text [ spanish ] = "Entrada incorrecta. Inténtelo otra vez" ; + Text [ danish ] = "Forkert input, gentag venligst" ; + Text [ swedish ] = "Felaktig inmatning, var vänlig upprepa" ; + Text [ finnish ] = "Incorrect data, please retry" ; + Text [ english_us ] = "Incorrect entry; please retry" ; + Text[ chinese_simplified ] = "ÊäÈëÎÞЧ£¬ÇëÖØ¸´¡£"; + Text[ russian ] = "Íåïðàâèëüíûé ââîä äàííûõ, ïðîæàëóéñòà, ïîâòîðèòå"; + Text[ polish ] = "Niepoprawny wpis, proszê ponowiæ"; + Text[ japanese ] = "³‚µ‚‚È‚¢“ü—͂ł·A‚â‚è’¼‚µ‚ĉº‚³‚¢"; + Text[ chinese_traditional ] = "¿é¤JµL®Ä¡M½Ð«½Æ¡C"; + Text[ arabic ] = "ÅÏÎÇá ÎÇØÆ ºÇáÑÌÇÁ ÅÚÇÏÉ ÇáãÍÇæáÉ"; + Text[ dutch ] = "Incorrecte gegevens, herhalen a.u.b."; + Text[ chinese_simplified ] = "ÊäÈëÎÞЧ£¬ÇëÖØ¸´¡£"; + Text[ greek ] = "ËáíèáóìÝíç åéóáãùãÞ, ðáñáêáëþ îáíáðñïóðáèÞóôå"; + Text[ korean ] = "µî·ÏÀÌ À߸øµÇ¾ú½À´Ï´Ù. ´Ù½Ã µî·ÏÇØ ÁֽʽÿÀ."; + Text[ turkish ] = "Giriþ yanlýþ, lütfen yeniden girin"; + Text[ language_user1 ] = " "; + }; + String SbERR_BAD_ARGUMENT & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Ung³ltiger Prozeduraufruf : Ungltiger Prozeduraufruf */ + Text = "Ungültiger Prozeduraufruf" ; + Text [ ENGLISH ] = "Invalid procedure call" ; + Text [ norwegian ] = "Invalid procedure call" ; + Text [ italian ] = "Richiamo di procedura non valido" ; + Text [ portuguese_brazilian ] = "Invalid procedure call" ; + Text [ portuguese ] = "Chamada de procedimento não válida" ; + Text [ french ] = "Appel de procédure incorrect" ; + Text [ dutch ] = "Ongeldige oproep van procedure" ; + Text [ spanish ] = "Inicio del proceso no válido" ; + Text [ danish ] = "Ugyldigt procedurekald" ; + Text [ swedish ] = "Ogiltigt proceduranrop" ; + Text [ finnish ] = "Invalid procedure call" ; + Text [ english_us ] = "Invalid procedure call" ; + Text[ chinese_simplified ] = "ÎÞЧµÄµ÷Óùý³Ì"; + Text[ russian ] = "Íåäåéñòâèòåëüíûé âûçîâ ïðîöåäóðû"; + Text[ polish ] = "Nieprawid³owa procedura wywo³ania"; + Text[ japanese ] = "–³Œø‚ÈÌßÛ¼°¼Þ¬‚̌ĂÑo‚µ"; + Text[ chinese_traditional ] = "½Õ¥Î¹Lµ{µL®Ä"; + Text[ arabic ] = "ÇÓÊÏÚÇÁ ÛíÑ Óáíã áÅÌÑÇÁ"; + Text[ dutch ] = "Ongeldige oproep van procedure"; + Text[ chinese_simplified ] = "ÎÞЧµÄµ÷Óùý³Ì"; + Text[ greek ] = "Ìç Ýãêõñç êëÞóç äéáäéêáóßáò"; + Text[ korean ] = "À߸øµÈ ÇÁ·Î½ÃÁ® È£Ãâ"; + Text[ turkish ] = "Geçersiz yordam çaðrýsý"; + Text[ language_user1 ] = " "; + }; + String SbERR_MATH_OVERFLOW & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? šberlauf : Überlauf */ + Text = "Überlauf" ; + Text [ ENGLISH ] = "Overflow" ; + Text [ norwegian ] = "Overflow" ; + Text [ italian ] = "Overflow" ; + Text [ portuguese_brazilian ] = "Overflow" ; + Text [ portuguese ] = "Transbordo" ; + Text [ french ] = "Débordement" ; + Text [ dutch ] = "Overflow" ; + Text [ spanish ] = "Desbordamiento" ; + Text [ danish ] = "Overløb" ; + Text [ swedish ] = "Spill" ; + Text [ finnish ] = "Overflow" ; + Text [ english_us ] = "Overflow" ; + Text[ chinese_simplified ] = "ÒçÖµ"; + Text[ russian ] = "Ïåðåïîëíåíèå"; + Text[ polish ] = "Przepe³nienie"; + Text[ japanese ] = "µ°ÊÞ°ÌÛ°"; + Text[ chinese_traditional ] = "·¸È"; + Text[ arabic ] = "ÝÇÆÖ"; + Text[ dutch ] = "Overflow"; + Text[ chinese_simplified ] = "ÒçÖµ"; + Text[ greek ] = "Õðåñ÷åßëéóç"; + Text[ korean ] = "³Ñħ"; + Text[ turkish ] = "Taþma"; + Text[ language_user1 ] = " "; + }; + String SbERR_NO_MEMORY & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Nicht gen³gend Speicher : Nicht gengend Speicher */ + Text = "Nicht genügend Speicher" ; + Text [ ENGLISH ] = "Out of memory" ; + Text [ norwegian ] = "Out of memory" ; + Text [ italian ] = "Memoria insufficiente" ; + Text [ portuguese_brazilian ] = "Out of memory" ; + Text [ portuguese ] = "Memória insuficiente" ; + Text [ french ] = "Mémoire insuffisante" ; + Text [ dutch ] = "Niet voldoende geheugen" ; + Text [ spanish ] = "No hay memoria suficiente" ; + Text [ danish ] = "Ikke tilstrækkelig hukommelse" ; + Text [ swedish ] = "Inte tillräckligt med minne" ; + Text [ finnish ] = "Out of memory" ; + Text [ english_us ] = "Not enough memory" ; + Text[ chinese_simplified ] = "ÄÚ´æ²»×ã"; + Text[ russian ] = "Íåäîñòàòî÷íî ïàìÿòè"; + Text[ polish ] = "Za ma³o pamiêci"; + Text[ japanese ] = "\\•ª‚ȋ󂫗e—Ê‚ª‚ ‚è‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "°O¾ÐÅ餣¨¬"; + Text[ arabic ] = "áÇ íæÌÏ ÐÇßÑÉ ßÇÝíÉ"; + Text[ dutch ] = "Niet voldoende geheugen"; + Text[ chinese_simplified ] = "ÄÚ´æ²»×ã"; + Text[ greek ] = "Äåí õðÜñ÷åé áñêåôüò ÷þñïò áðïèÞêåõóçò"; + Text[ korean ] = "¸Þ¸ð¸® ºÎÁ·"; + Text[ turkish ] = "Bellek yeterli deðil"; + Text[ language_user1 ] = " "; + }; + String SbERR_ALREADY_DIM & ERRCODE_RES_MASK + { + Text = "Array bereits dimensioniert" ; + Text [ ENGLISH ] = "Array already dimensioned" ; + Text [ norwegian ] = "Array already dimensioned" ; + Text [ italian ] = "Array già dimensionato" ; + Text [ portuguese_brazilian ] = "Array already dimensioned" ; + Text [ portuguese ] = "A matriz já foi dimensionada" ; + Text [ french ] = "Array déjà dimensionné" ; + Text [ dutch ] = "Array reeds gedimensioneerd" ; + Text [ spanish ] = "Array ya dimensionado" ; + Text [ danish ] = "Array er allerede dimensioneret" ; + Text [ swedish ] = "Array redan dimensionerad" ; + Text [ finnish ] = "Array already dimensioned" ; + Text [ english_us ] = "Array already dimensioned" ; + Text[ chinese_simplified ] = "Êý×éÒѾ±»¶¨³ß¶È"; + Text[ russian ] = "Ðàçìåðíîñòü ìàññèâà óæå çàäàíà"; + Text[ polish ] = "Macierz ju¿ zosta³a zwymiarowana"; + Text[ japanese ] = "”z—ñ‚Í‚·‚łɎŸŒ³‰»‚³‚ê‚Ä‚¢‚Ü‚·"; + Text[ chinese_traditional ] = "¦æ¦C¤w¸g³Q©w¤Ø«×"; + Text[ arabic ] = "ÃÈÚÇÏ ÇáÕÝíÝ ãÚíäÉ ãÓÈÞÇð"; + Text[ dutch ] = "Array reeds gedimensioneerd"; + Text[ chinese_simplified ] = "Êý×éÒѾ±»¶¨³ß¶È"; + Text[ greek ] = "¸÷ïõí Þäç ïñéóôåß ïé äéáóôÜóåéò ôçò ìÞôñáò"; + Text[ korean ] = "¹è¿ÀÇ Â÷¿ø Å©±â°¡ ÀÌ¹Ì Á¤ÇØÁ® ÀÖÀ½"; + Text[ turkish ] = "Dizi boyutlandýrýlmýþ durumda"; + Text[ language_user1 ] = " "; + }; + String SbERR_OUT_OF_RANGE & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Index au˜erhalb des definierten Bereichs : Index auÿerhalb des definierten Bereichs */ + Text = "Index außerhalb des definierten Bereichs" ; + Text [ ENGLISH ] = "Subscript out of range" ; + Text [ norwegian ] = "Subscript out of range" ; + Text [ italian ] = "Indice al di fuori dell'area definita" ; + Text [ portuguese_brazilian ] = "Subscript out of range" ; + Text [ portuguese ] = "Índice fora da área definida" ; + Text [ french ] = "Index en dehors de la plage définie" ; + Text [ dutch ] = "Index buiten gedefinieerd bereik" ; + Text [ spanish ] = "El índice se encuentra fuera del área definida" ; + Text [ danish ] = "Indeks udenfor det definerede område" ; + Text [ swedish ] = "Index utanför definierat område" ; + Text [ finnish ] = "Subscript out of range" ; + Text [ english_us ] = "Index out of defined range" ; + Text[ chinese_simplified ] = "¶¨Ò巶Χ֮ÍâµÄË÷Òý"; + Text[ russian ] = "Èíäåêñ çà ïðåäåëàìè îïðåäåëåííîé îáëàñòè"; + Text[ polish ] = "Indeks poza zdefiniowanym obszarem"; + Text[ japanese ] = "’è‹`‚³‚ꂽ”͈͊O‚̲ÝÃÞ¯¸½"; + Text[ chinese_traditional ] = "©w¸q½d³ò¤§¥~ªº¯Á¤Þ"; + Text[ arabic ] = "íÞÚ ÇáÝåÑÓ ÎÇÑÌ ÇáäØÇÞ ÇáãÍÏÏ"; + Text[ dutch ] = "Index buiten gedefinieerd bereik"; + Text[ chinese_simplified ] = "¶¨Ò巶Χ֮ÍâµÄË÷Òý"; + Text[ greek ] = "Äåßêôçò Ýîù áðü ôçí êáèïñéæüìåíç ðåñéï÷Þ."; + Text[ korean ] = "Á¤ÀÇµÈ ¹üÀ§·Î ºÎÅÍÀÇ À妽º"; + Text[ turkish ] = "Dizin tanýmlanan aralýðýn dýþýnda"; + Text[ language_user1 ] = " "; + }; + String SbERR_DUPLICATE_DEF & ERRCODE_RES_MASK + { + Text = "Doppelt vorhandene Definition" ; + Text [ ENGLISH ] = "Duplicate definition" ; + Text [ norwegian ] = "Duplicate definition" ; + Text [ italian ] = "Definizione doppia" ; + Text [ portuguese_brazilian ] = "Duplicate definition" ; + Text [ portuguese ] = "Definição dupla" ; + Text [ french ] = "Définition faisant double emploi" ; + Text [ dutch ] = "Definitie dubbel voorhanden" ; + Text [ spanish ] = "La definición existe dos veces" ; + Text [ danish ] = "Dobbelt foreliggende definition" ; + Text [ swedish ] = "Dubbelt förekommande definition" ; + Text [ finnish ] = "Duplicate definition" ; + Text [ english_us ] = "Duplicate definition" ; + Text[ chinese_simplified ] = "´æÔÚË«ÖØ¶¨Òå"; + Text[ russian ] = "Äâîéíîå îïðåäåëåíèå"; + Text[ polish ] = "Zduplikowana definicja"; + Text[ japanese ] = "d•¡‚µ‚½’è‹`"; + Text[ chinese_traditional ] = "¦s¦bÂù«©w¸q"; + Text[ arabic ] = "ÊÚÑíÝ ãßÑÑ"; + Text[ dutch ] = "Definitie dubbel voorhanden"; + Text[ chinese_simplified ] = "´æÔÚË«ÖØ¶¨Òå"; + Text[ greek ] = "Äéðëüò ïñéóìüò"; + Text[ korean ] = "Áߺ¹ Á¤ÀÇ"; + Text[ turkish ] = "Çift tanýmlama"; + Text[ language_user1 ] = " "; + }; + String SbERR_ZERODIV & ERRCODE_RES_MASK + { + Text = "Division durch Null" ; + Text [ ENGLISH ] = "Division by zero" ; + Text [ norwegian ] = "Division by zero" ; + Text [ italian ] = "Diviso zero" ; + Text [ portuguese_brazilian ] = "Division by zero" ; + Text [ portuguese ] = "Dividir por zero" ; + Text [ french ] = "Division par zéro" ; + Text [ dutch ] = "Deling door nul" ; + Text [ spanish ] = "División por cero" ; + Text [ danish ] = "Divider med nul" ; + Text [ swedish ] = "Division med noll" ; + Text [ finnish ] = "Division by zero" ; + Text [ english_us ] = "Division by zero" ; + Text[ chinese_simplified ] = "³ýÓÚÁã"; + Text[ russian ] = "Äåëåíèå íà íîëü"; + Text[ polish ] = "Dzielenie przez zero"; + Text[ japanese ] = "¾ÞÛ‚É‚æ‚霎Z"; + Text[ chinese_traditional ] = "°£¤_¹s"; + Text[ arabic ] = "ÊÞÓíã Úáì ÕÝÑ"; + Text[ dutch ] = "Deling door nul"; + Text[ chinese_simplified ] = "³ýÓÚÁã"; + Text[ greek ] = "Äéáßñåóç ìå ìçäÝí"; + Text[ korean ] = "0 À¸·Î ³ª´®"; + Text[ turkish ] = "Sýfýra bölme"; + Text[ language_user1 ] = " "; + }; + String SbERR_VAR_UNDEFINED & ERRCODE_RES_MASK + { + Text = "Variable nicht definiert" ; + Text [ ENGLISH ] = "Variable not defined" ; + Text [ norwegian ] = "Variable not defined" ; + Text [ italian ] = "Variabile non definita" ; + Text [ portuguese_brazilian ] = "Variable not defined" ; + Text [ portuguese ] = "Variável não definida" ; + Text [ french ] = "Variable indéfinie" ; + Text [ dutch ] = "Variabele niet gedefinieerd" ; + Text [ spanish ] = "Variable no definida" ; + Text [ danish ] = "Variablen er ikke defineret" ; + Text [ swedish ] = "Variabel inte definierad" ; + Text [ finnish ] = "Variable not defined" ; + Text [ english_us ] = "Variable not defined" ; + Text[ chinese_simplified ] = "ûÓж¨Òå±äÊý"; + Text[ russian ] = "Ïåðåìåííàÿ íå îïðåäåëåíà"; + Text[ polish ] = "Zmienna nie zdefiniowana"; + Text[ japanese ] = "•Ï”‚Í’è‹`‚³‚ê‚Ä‚¢‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "¨S¦³©w¸qÅܼÆ"; + Text[ arabic ] = "ÇáãÊÛíÑÉ ÛíÑ ãÍÏÏÉ"; + Text[ dutch ] = "Variabele niet gedefinieerd"; + Text[ chinese_simplified ] = "ûÓж¨Òå±äÊý"; + Text[ greek ] = "Äåí Ý÷åé ïñéóôåß ìåôáâëçôÞ"; + Text[ korean ] = "Á¤ÀÇ µÇÁö¾ÊÀº º¯¼ö"; + Text[ turkish ] = "Deðiþken tanýmlanmadý"; + Text[ language_user1 ] = " "; + }; + String SbERR_CONVERSION & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Datentypen unvertrõglich : Datentypen unvertr§glich */ + Text = "Datentypen unverträglich" ; + Text [ ENGLISH ] = "Data type mismatch" ; + Text [ norwegian ] = "Data type mismatch" ; + Text [ italian ] = "Tipi di dati non compatibili" ; + Text [ portuguese_brazilian ] = "Data type mismatch" ; + Text [ portuguese ] = "Tipos de dados incompatíveis" ; + Text [ french ] = "Types de données incompatibles" ; + Text [ dutch ] = "Gegevenstypen passen niet bij elkaar" ; + Text [ spanish ] = "Los tipos de datos no coinciden" ; + Text [ danish ] = "Datatyper er uforenelige" ; + Text [ swedish ] = "Datatyper passar inte ihop" ; + Text [ finnish ] = "Data type mismatch" ; + Text [ english_us ] = "Data type mismatch" ; + Text[ chinese_simplified ] = "Êý¾ÝÀàÐͲ»Æ¥Åä"; + Text[ russian ] = "Íåñîâìåñòèìûå òèïû äàííûõ"; + Text[ polish ] = "Niezgodne typy danych"; + Text[ japanese ] = "ÃÞ°À‚ÌŽí—Þ‚Í‹¦’²«‚ ‚è‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "¸ê®ÆÃþ«¬¤£¤Ç°t"; + Text[ arabic ] = "ÚÏã ãØÇÈÞÉ ÃäæÇÚ ÇáÈíÇäÇÊ"; + Text[ dutch ] = "Gegevenstypen passen niet bij elkaar"; + Text[ chinese_simplified ] = "Êý¾ÝÀàÐͲ»Æ¥Åä"; + Text[ greek ] = "Áóõìöùíßá ôýðùí äåäïìÝíùí"; + Text[ korean ] = "µ¥ÀÌÅÍ Å¸ÀÔÀÌ ¸ÂÁö ¾Ê½À´Ï´Ù."; + Text[ turkish ] = "Veri tipleri arasýnda uyuþmazlýk"; + Text[ language_user1 ] = " "; + }; + String SbERR_BAD_PARAMETER & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Ung³ltiger Parameter : Ungltiger Parameter */ + Text = "Ungültiger Parameter" ; + Text [ ENGLISH ] = "Bad parameter" ; + Text [ norwegian ] = "Bad parameter" ; + Text [ italian ] = "Parametro non valido" ; + Text [ portuguese_brazilian ] = "Bad parameter" ; + Text [ portuguese ] = "Parâmetro não válido" ; + Text [ french ] = "Paramètre incorrect" ; + Text [ dutch ] = "Ongeldige parameter" ; + Text [ spanish ] = "Parámetro no válido" ; + Text [ danish ] = "Ugyldig parameter" ; + Text [ swedish ] = "Ogiltig parameter" ; + Text [ finnish ] = "Bad parameter" ; + Text [ english_us ] = "Invalid parameter" ; + Text[ chinese_simplified ] = "ÎÞЧµÄÖú±äÊý"; + Text[ russian ] = "Íåäåéñòâèòåëüíûé ïàðàìåòð"; + Text[ polish ] = "Nieprawid³owy parametr"; + Text[ japanese ] = "–³Œø‚ÈÊß×Ò°À"; + Text[ chinese_traditional ] = "§UÅܼƵL®Ä"; + Text[ arabic ] = "ãÚáãÉ ÛíÑ ÕÇáÍÉ"; + Text[ dutch ] = "Ongeldige parameter"; + Text[ chinese_simplified ] = "ÎÞЧµÄÖú±äÊý"; + Text[ greek ] = "Ìç Ýãêõñç ðáñÜìåôñïò"; + Text[ korean ] = "À߸øµÈ ÆÛ¶ó¹ÌÅÍ"; + Text[ turkish ] = "Geçersiz parametre"; + Text[ language_user1 ] = " "; + }; + String SbERR_USER_ABORT & ERRCODE_RES_MASK + { + Text = "Der Ablauf wurde durch den Benutzer unterbrochen" ; + Text [ ENGLISH ] = "User interrupt occurred" ; + Text [ norwegian ] = "User interrupt occurred" ; + Text [ italian ] = "Processo interrotto dall'utente" ; + Text [ portuguese_brazilian ] = "User interrupt occurred" ; + Text [ portuguese ] = "O processo foi interrompido pelo utilizador" ; + Text [ french ] = "Processus interrompu par l'utilisateur" ; + Text [ dutch ] = "Onderbreking door gebruiker" ; + Text [ spanish ] = "El proceso ha sido interrumpido por el usuario" ; + Text [ danish ] = "Processen blev afbrudt af brugeren" ; + Text [ swedish ] = "Användaren avslutade förloppet" ; + Text [ finnish ] = "User interrupt occurred" ; + Text [ english_us ] = "Process interrupted by user" ; + Text[ chinese_simplified ] = "ʹÓÃÕßÖжÏÔËËã¹ý³Ì¡£"; + Text[ russian ] = "Ïðîöåññ ïðåðâàí ïîëüçîâàòåëåì"; + Text[ polish ] = "Proces zosta³ przerwany przez u¿ytkownika"; + Text[ japanese ] = "ˆ—‚ÍÕ°»Þ°‚É‚æ‚Á‚Ä’†’f‚³‚ê‚Ü‚µ‚½"; + Text[ chinese_traditional ] = "¨Ï¥ÎªÌ¤¤Â_¹Bºâ¹Lµ{¡C"; + Text[ arabic ] = "ÊãÊ ãÞÇØÚÉ ÇáÚãáíÉ ãä ÞÈá ÇáãÓÊÎÏã"; + Text[ dutch ] = "Onderbreking door gebruiker"; + Text[ chinese_simplified ] = "ʹÓÃÕßÖжÏÔËËã¹ý³Ì¡£"; + Text[ greek ] = "Ç äéáäéêáóßá Ý÷åé äéáêïðåß áðü ôïí ÷ñÞóôç"; + Text[ korean ] = "»ç¿ëÀÚ¿¡ÀÇÇÑ ÇÁ·Î¼¼½º ÀÎÅÍ·´Æ®"; + Text[ turkish ] = "Süreç kullanýcý tarafýndan kesildi"; + Text[ language_user1 ] = " "; + }; + String SbERR_BAD_RESUME & ERRCODE_RES_MASK + { + Text = "Resume ohne Fehler" ; + Text [ ENGLISH ] = "Resume without error" ; + Text [ norwegian ] = "Resume without error" ; + Text [ italian ] = "Resume senza errori" ; + Text [ portuguese_brazilian ] = "Resume without error" ; + Text [ portuguese ] = "Resumo sem erros" ; + Text [ french ] = "Résumé sans erreur" ; + Text [ dutch ] = "Resume zonder fouten" ; + Text [ spanish ] = "Resumen sin error" ; + Text [ danish ] = "Resume uden fejl" ; + Text [ swedish ] = "Resume utan fel" ; + Text [ finnish ] = "Resume without error" ; + Text [ english_us ] = "Resume without error" ; + Text[ chinese_simplified ] = "Resume ²»´ø error"; + Text[ russian ] = "Ðåçþìå áåç îøèáîê"; + Text[ polish ] = "Resume bez b³êdu"; + Text[ japanese ] = "Resume without error"; + Text[ chinese_traditional ] = "Resume ¤£±a error"; + Text[ arabic ] = "ãÊÇÈÚÉ ÈÏæä ÎØÃ"; + Text[ dutch ] = "Resume zonder fouten"; + Text[ chinese_simplified ] = "Resume ²»´ø error"; + Text[ greek ] = "Óýíïøç ÷ùñßò óöÜëìáôá"; + Text[ korean ] = "¿À·ù¾øÀÌ ´Ù½Ã ½ÃÀÛ"; + Text[ turkish ] = "Resume ohne Fehler"; + Text[ language_user1 ] = " "; + }; + String SbERR_STACK_OVERFLOW & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Nicht gen³gend Stapelspeicher : Nicht gengend Stapelspeicher */ + Text = "Nicht genügend Stapelspeicher" ; + Text [ ENGLISH ] = "Out of stack space" ; + Text [ norwegian ] = "Out of stack space" ; + Text [ italian ] = "Memoria stack non sufficiente" ; + Text [ portuguese_brazilian ] = "Out of stack space" ; + Text [ portuguese ] = "Memória tampão insuficiente" ; + Text [ french ] = "Mémoire tampon insuffisante" ; + Text [ dutch ] = "Niet genoeg stack" ; + Text [ spanish ] = "Desbordamiento de pila" ; + Text [ danish ] = "Ikke nok stakhukommelse" ; + Text [ swedish ] = "Inte tillräckligt med stapelminne" ; + Text [ finnish ] = "Out of stack space" ; + Text [ english_us ] = "Not enough stack memory" ; + Text[ chinese_simplified ] = "ջʽÄÚ´æ²»×ã"; + Text[ russian ] = "Íåäîñòàòî÷íî ïàìÿòè ìàãàçèííîãî òèïà"; + Text[ polish ] = "Za ma³o pamiêci stosowej"; + Text[ japanese ] = "•s\\•ª‚ȽÀ¯¸ÒÓØ"; + Text[ chinese_traditional ] = "°ïÅ|¦¡°O¾ÐÅ餣¨¬"; + Text[ arabic ] = "ÇáÐÇßÑÉ ÇáãÊÑÇÕÉ ÛíÑ ßÇÝíÉ"; + Text[ dutch ] = "Niet genoeg stack"; + Text[ chinese_simplified ] = "ջʽÄÚ´æ²»×ã"; + Text[ greek ] = "Äåí õðÜñ÷åé áñêåôÞ ìíÞìç óôïßâáò"; + Text[ korean ] = "stack ¸Þ¸ð¸® ºÎÁ·"; + Text[ turkish ] = "Yýðýn bellek yeterli deðil"; + Text[ language_user1 ] = " "; + }; + String SbERR_PROC_UNDEFINED & ERRCODE_RES_MASK + { + Text = "Sub- oder Function-Prozedur nicht definiert" ; + Text [ ENGLISH ] = "Sub or Function not defined" ; + Text [ norwegian ] = "Sub or Function not defined" ; + Text [ italian ] = "Procedura sub o di funzione non definita" ; + Text [ portuguese_brazilian ] = "Sub or Function not defined" ; + Text [ portuguese ] = "Procedimento de função ou subordinado não definidos" ; + Text [ french ] = "La sous-procédure ou procédure fonctionnelle n'est pas définie" ; + Text [ dutch ] = "Sub- of functieprocedure niet gedefinieerd" ; + Text [ spanish ] = "Procedimiento de función o subordinado no definido" ; + Text [ danish ] = "Under- eller funktionsproceduren er ikke defineret" ; + Text [ swedish ] = "Sub- eller funktionsproceduren inte definierad" ; + Text [ finnish ] = "Sub or Function not defined" ; + Text [ english_us ] = "Sub-procedure or function procedure not defined" ; + Text[ chinese_simplified ] = "ûÓж¨Òå·Ö¹ý³Ì»òº¯Êý¹ý³Ì"; + Text[ russian ] = "Ïîäïðîöåäóðà èëè ïðîöåäóðà ôóíêöèè íå îïðåäåëåíà"; + Text[ polish ] = "Nie zdefiniowano procedury podrzêdnej lub funkcyjnej"; + Text[ japanese ] = "Sub‚Ü‚½‚ÍFunctionÌßÛ¼°¼Þ¬‚Í’è‹`‚³‚ê‚Ä‚¢‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "¨S¦³©w¸q¤À¹Lµ{©Î¨ç¼Æ¹Lµ{"; + Text[ arabic ] = "áã íÊã ÊÚííä ÅÌÑÇÁ ÇáÏÇáÉ Ãæ ÇáÅÌÑÇÁ ÇáÝÑÚí"; + Text[ dutch ] = "Sub- of functieprocedure niet gedefinieerd"; + Text[ chinese_simplified ] = "ûÓж¨Òå·Ö¹ý³Ì»òº¯Êý¹ý³Ì"; + Text[ greek ] = "Äåí ïñßóôçêå ç äéáäéêáóßá õðü (Sub) Þ ëåéôïõñãßáò (Function)"; + Text[ korean ] = "Á¤ÀÇ µÇÁö¾ÊÀº ¼ºê ÇÁ·Î½ÃÁ® ¶Ç´Â Æã¼Ç ÇÁ·Î½ÃÁ®"; + Text[ turkish ] = "Alt yordam ya da iþlev yordamý tanýmlanmadý"; + Text[ language_user1 ] = " "; + }; + String SbERR_BAD_DLL_LOAD & ERRCODE_RES_MASK + { + Text = "Fehler beim Laden einer DLL-Datei" ; + Text [ ENGLISH ] = "Error in loading DLL" ; + Text [ norwegian ] = "Error in loading DLL" ; + Text [ italian ] = "Errore nel caricamento del file DLL" ; + Text [ portuguese_brazilian ] = "Error in loading DLL" ; + Text [ portuguese ] = "Erro ao carregar um ficheiro DLL" ; + Text [ french ] = "Erreur lors du chargement d'un fichier DLL" ; + Text [ dutch ] = "Fout bei laden van DLL-bestand" ; + Text [ spanish ] = "Error al cargar un archivo DDL" ; + Text [ danish ] = "Fejl ved indlæsning af DLL-fil" ; + Text [ swedish ] = "Fel vid laddning av DLL-fil" ; + Text [ finnish ] = "Error in loading DLL" ; + Text [ english_us ] = "Error loading DLL file" ; + Text[ chinese_simplified ] = "×°ÔØ DLL Îļþʱ·¢Éú´íÎó"; + Text[ russian ] = "Îøèáêà ïðè çàãðóçêå ôàéëà DLL"; + Text[ polish ] = "B³¹d przy ³adowaniu pliku DLL"; + Text[ japanese ] = "DLĻ²Ù‚̓ǂݞ‚Ý‚ÌÛ‚Ì´×°"; + Text[ chinese_traditional ] = "¸Ë¸üDLLÀɮ׮ɵo¥Í¿ù»~"; + Text[ arabic ] = "DLL ÎØÃ ÃËäÇÁ ÊÍãíá ãáÝ"; + Text[ dutch ] = "Fout bei laden van DLL-bestand"; + Text[ chinese_simplified ] = "×°ÔØ DLL Îļþʱ·¢Éú´íÎó"; + Text[ greek ] = "ÓöÜëìá êáôÜ ôç öüñôùóç åíüò áñ÷åßïõ DLL"; + Text[ korean ] = "DLLÆÄÀÏ ·Îµù ¿À·ù"; + Text[ turkish ] = "DLL dosyasýný yükleme sýrasýnda hata"; + Text[ language_user1 ] = " "; + }; + String SbERR_BAD_DLL_CALL & ERRCODE_RES_MASK + { + Text = "Falsche DLL-Aufrufkonvention" ; + Text [ ENGLISH ] = "Bad DLL calling convention" ; + Text [ norwegian ] = "Bad DLL calling convention" ; + Text [ italian ] = "Convenzione di richiamo DLL errata" ; + Text [ portuguese_brazilian ] = "Bad DLL calling convention" ; + Text [ portuguese ] = "Convenção da chamada DLL incorrecta" ; + Text [ french ] = "Convention d'appel DLL incorrecte" ; + Text [ dutch ] = "Foutieve DLL-oproepconventie" ; + Text [ spanish ] = "Convención de la llamada DLL incorrecta" ; + Text [ danish ] = "Forkert DLL-kaldkonvention" ; + Text [ swedish ] = "Fel DLL-anropningskonvention" ; + Text [ finnish ] = "Bad DLL calling convention" ; + Text [ english_us ] = "Wrong DLL call convention" ; + Text[ chinese_simplified ] = "´íÎóµÄ DLLµ÷ÓÃÔ¼¶¨"; + Text[ russian ] = "Íåïðàâèëüíàÿ êîíâåíöèÿ âûçîâà DLL"; + Text[ polish ] = "Nieprawid³owa konwencja wywo³ania DLL"; + Text[ japanese ] = "³‚µ‚‚È‚¢DLLŒÄ‚Ño‚µŠµ—á"; + Text[ chinese_traditional ] = "¿ù»~ªºDLL½Õ¥Î¬ù©w"; + Text[ arabic ] = "ÎÇØÆ DLL ÇÓÊÏÚÇÁ ÇÕØáÇÍ"; + Text[ dutch ] = "Foutieve DLL-oproepconventie"; + Text[ chinese_simplified ] = "´íÎóµÄ DLLµ÷ÓÃÔ¼¶¨"; + Text[ greek ] = "ËÜèïò óõíèÞêç êëÞóçò DLL"; + Text[ korean ] = "Ʋ¸° DLL È£Ãâ ÇùÁ¤"; + Text[ turkish ] = "Yanlýþ DLL çaðrý kuralý"; + Text[ language_user1 ] = " "; + }; + String SbERR_INTERNAL_ERROR & ERRCODE_RES_MASK + { + Text = "Interner Fehler $(ARG1)" ; + Text [ ENGLISH ] = "Internal error $(ARG1)" ; + Text [ norwegian ] = "Internal error $(ARG1)" ; + Text [ italian ] = "Errore interno $(ARG1)" ; + Text [ portuguese_brazilian ] = "Internal error $(ARG1)" ; + Text [ portuguese ] = "Erro interno $(ARG1)" ; + Text [ french ] = "Erreur interne $(ARG1)" ; + Text [ dutch ] = "Interne fout $(ARG1)" ; + Text [ spanish ] = "Error interno $(ARG1)" ; + Text [ danish ] = "Intern fejl $(ARG1)" ; + Text [ swedish ] = "Internt fel $(ARG1)" ; + Text [ finnish ] = "Internal error $(ARG1)" ; + Text [ english_us ] = "Internal error $(ARG1)" ; + Text[ chinese_simplified ] = "ÄÚ²¿´íÎó $(ARG1)"; + Text[ russian ] = "Îøèáêà âíóòðè $(ARG1)"; + Text[ polish ] = "B³¹d wewnêtrzny $(ARG1)"; + Text[ japanese ] = "“à•”´×°$(ARG1)"; + Text[ chinese_traditional ] = "¤º³¡¿ù»~$(ARG1)"; + Text[ arabic ] = "$(ARG1) ÎØÃ ÏÇÎáí"; + Text[ dutch ] = "Interne fout $(ARG1)"; + Text[ chinese_simplified ] = "ÄÚ²¿´íÎó $(ARG1)"; + Text[ greek ] = "Åóùôåñéêü óöÜëìá $(ARG1)"; + Text[ korean ] = "³»ºÎ ¿À·ù $(ARG1)"; + Text[ turkish ] = "Dahili hata $(ARG1)"; + Text[ language_user1 ] = " "; + }; + String SbERR_BAD_CHANNEL & ERRCODE_RES_MASK + { + Text = "Dateiname oder -nummer falsch" ; + Text [ ENGLISH ] = "Bad file name or number" ; + Text [ norwegian ] = "Bad file name or number" ; + Text [ italian ] = "Nome file o numero file errato" ; + Text [ portuguese_brazilian ] = "Bad file name or number" ; + Text [ portuguese ] = "Nome ou número do ficheiro incorrecto" ; + Text [ french ] = "Nom ou numéro de fichier incorrect" ; + Text [ dutch ] = "Foutieve bestandsnaam of -nummer" ; + Text [ spanish ] = "Nombre o número incorrecto de archivo" ; + Text [ danish ] = "Forkert filnavn eller -nummer" ; + Text [ swedish ] = "Ogiltigt filnamn eller filnummer" ; + Text [ finnish ] = "Bad file name or number" ; + Text [ english_us ] = "Invalid file name or file number" ; + Text[ chinese_simplified ] = "ÎÞЧµÄÎļþ»òºÅÂë"; + Text[ russian ] = "Èìÿ èëè íîìåð ôàéëà íåïðàâèëüíû"; + Text[ polish ] = "Nazwa pliku lub numer nieprawid³owe"; + Text[ japanese ] = "̧²Ù–¼‚Ü‚½‚Í̧²Ù”Ô†‚ª³‚µ‚‚ ‚è‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "µL®ÄªºÀɮשθ¹½X"; + Text[ arabic ] = "ÇÓã ÇáãáÝ Ãæ ÑÞãå ÛíÑ ÕÍíÍ"; + Text[ dutch ] = "Foutieve bestandsnaam of -nummer"; + Text[ chinese_simplified ] = "ÎÞЧµÄÎļþ»òºÅÂë"; + Text[ greek ] = "ËÜèïò üíïìá Þ áñéèìüò áñ÷åßïõ"; + Text[ korean ] = "À߸øµÈ ÆÄÀÏ À̸§ ¶Ç´Â ÆÄÀÏ ¹øÈ£"; + Text[ turkish ] = "Dosya adý ya da numarasý yanlýþ"; + Text[ language_user1 ] = " "; + }; + String SbERR_FILE_NOT_FOUND & ERRCODE_RES_MASK + { + Text = "Datei nicht gefunden" ; + Text [ ENGLISH ] = "File not found" ; + Text [ norwegian ] = "File not found" ; + Text [ italian ] = "File non trovato" ; + Text [ portuguese_brazilian ] = "File not found" ; + Text [ portuguese ] = "O ficheiro não foi encontrado" ; + Text [ french ] = "Fichier introuvable" ; + Text [ dutch ] = "Bestand niet gevonden" ; + Text [ spanish ] = "No se encuentra el archivo" ; + Text [ danish ] = "Filen blev ikke fundet" ; + Text [ swedish ] = "Filen hittades inte" ; + Text [ finnish ] = "File not found" ; + Text [ english_us ] = "File not found" ; + Text[ chinese_simplified ] = "ûÓÐÕÒµ½Îļþ"; + Text[ russian ] = "Ôàéë íå íàéäåí"; + Text[ polish ] = "pliku nie znaleziono"; + Text[ japanese ] = "̧²Ù‚ÍŒ©‚‚©‚è‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "¨S¦³§ä¨ìÀÉ®×"; + Text[ arabic ] = "áã íÊã ÇáÚ辄 Úáì ÇáãáÝ"; + Text[ dutch ] = "Bestand niet gevonden"; + Text[ chinese_simplified ] = "ûÓÐÕÒµ½Îļþ"; + Text[ greek ] = "Ôï áñ÷åßï äåí âñÝèçêå"; + Text[ korean ] = "ÆÄÀÏÀÌ ¾ø½À´Ï´Ù."; + Text[ turkish ] = "Dosya bulunamadý"; + Text[ language_user1 ] = " "; + }; + String SbERR_BAD_FILE_MODE & ERRCODE_RES_MASK + { + Text = "Dateimodus falsch" ; + Text [ ENGLISH ] = "Bad file mode" ; + Text [ norwegian ] = "Bad file mode" ; + Text [ italian ] = "Modo file errato" ; + Text [ portuguese_brazilian ] = "Bad file mode" ; + Text [ portuguese ] = "Modo do ficheiro incorrecto" ; + Text [ french ] = "Mode de fichier incorrect" ; + Text [ dutch ] = "Foutieve bestandsmodus" ; + Text [ spanish ] = "Modo de archivo incorrecto" ; + Text [ danish ] = "Forkert filtilstand" ; + Text [ swedish ] = "Fel filläge" ; + Text [ finnish ] = "Bad file mode" ; + Text [ english_us ] = "Incorrect file mode" ; + Text[ chinese_simplified ] = "´íÎóµÄÎļþģʽ"; + Text[ russian ] = "Íåïðàâèëüíûé ðåæèì ôàéëà"; + Text[ polish ] = "Niepoprawny tryb pliku"; + Text[ japanese ] = "̧²Ù Ó°ÄÞ‚ª³‚µ‚‚ ‚è‚Ü‚¹‚ñ@@@@@@@@@@@@@"; + Text[ chinese_traditional ] = "¿ù»~ªºÀÉ®×¼Ò¦¡"; + Text[ arabic ] = "æÖÚ ÎÇØÆ ááãáÝ"; + Text[ dutch ] = "Foutieve bestandsmodus"; + Text[ chinese_simplified ] = "´íÎóµÄÎļþģʽ"; + Text[ greek ] = "Ìç Ýãêõñç êáôÜóôáóç áñ÷åßïõ"; + Text[ korean ] = "À߸øµÈ ÆÄÀÏ ÇüÅÂ"; + Text[ turkish ] = "Dosya kipi yanlýþ"; + Text[ language_user1 ] = " "; + }; + String SbERR_FILE_ALREADY_OPEN & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Datei bereits ge÷ffnet : Datei bereits ge”ffnet */ + Text = "Datei bereits geöffnet" ; + Text [ ENGLISH ] = "File already open" ; + Text [ norwegian ] = "File already open" ; + Text [ italian ] = "File già aperto" ; + Text [ portuguese_brazilian ] = "File already open" ; + Text [ portuguese ] = "O ficheiro já está aberto" ; + Text [ french ] = "Fichier déjà ouvert" ; + Text [ dutch ] = "Bestand reeds geopend" ; + Text [ spanish ] = "El archivo ya está abierto" ; + Text [ danish ] = "Filen er allerede åben" ; + Text [ swedish ] = "Filen är redan öppen" ; + Text [ finnish ] = "File already open" ; + Text [ english_us ] = "File already open" ; + Text[ chinese_simplified ] = "ÒѾ´ò¿ªÎļþ"; + Text[ russian ] = "Ôàéë óæå îòêðûò"; + Text[ polish ] = "Plik ju¿ otworzony"; + Text[ japanese ] = "̧²Ù‚Í‚·‚łɊJ‚©‚ê‚Ä‚¢‚Ü‚·"; + Text[ chinese_traditional ] = "¤w¸g¶}±ÒÀÉ®×"; + Text[ arabic ] = "ÇáãáÝ ãÝÊæÍ ãÓÈÞÇð"; + Text[ dutch ] = "Bestand reeds geopend"; + Text[ chinese_simplified ] = "ÒѾ´ò¿ªÎļþ"; + Text[ greek ] = "Ôï áñ÷åßï åßíáé Þäç áíïé÷ôü"; + Text[ korean ] = "ÆÄÀÏÀÌ ÀÌ¹Ì ¿·ÁÀÖ½À´Ï´Ù."; + Text[ turkish ] = "Dosya açýk durumda"; + Text[ language_user1 ] = " "; + }; + String SbERR_IO_ERROR & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Gerõte-E/A-Fehler : Ger§te-E/A-Fehler */ + Text = "Geräte-E/A-Fehler" ; + Text [ ENGLISH ] = "Device I/O error" ; + Text [ norwegian ] = "Device I/O error" ; + Text [ italian ] = "Errore di I/O" ; + Text [ portuguese_brazilian ] = "Device I/O error" ; + Text [ portuguese ] = "Erro periférico I/O" ; + Text [ french ] = "Erreur de périphérique E/S" ; + Text [ dutch ] = "Fout in-/uitvoerapparatuur" ; + Text [ spanish ] = "Error de dispositivo E/S" ; + Text [ danish ] = "I/O-fejl i enhed" ; + Text [ swedish ] = "Apparat I/O-fel" ; + Text [ finnish ] = "Device I/O error" ; + Text [ english_us ] = "Device I/O error" ; + Text[ chinese_simplified ] = "É豸·¢ÉúI/O´íÎó"; + Text[ russian ] = "Îøèáêà óñòðîéñòâà Ââîäà/Âûâîäà"; + Text[ polish ] = "B³¹d We/Wy urz¹dzenia"; + Text[ japanese ] = "ÃÞ¨ÊÞ²½ I/O ´×°"; + Text[ chinese_traditional ] = "³]³Æµo¥ÍI/O¿ù»~"; + Text[ arabic ] = "ÎØÃ Ýí ÅÏÎÇá æÅÎÑÇÌ ÇáÌåÇÒ"; + Text[ dutch ] = "Fout in-/uitvoerapparatuur"; + Text[ chinese_simplified ] = "É豸·¢ÉúI/O´íÎó"; + Text[ greek ] = "ÓöÜëìá óõóêåõÞò åéóüäïõ/åîüäïõ"; + Text[ korean ] = "µð¹ÙÀ̽º I/O ¿À·ù"; + Text[ turkish ] = "Cihaz I/O hatasý"; + Text[ language_user1 ] = " "; + }; + String SbERR_FILE_EXISTS & ERRCODE_RES_MASK + { + Text = "Datei bereits vorhanden" ; + Text [ ENGLISH ] = "File already exists" ; + Text [ norwegian ] = "File already exists" ; + Text [ italian ] = "File già esistente" ; + Text [ portuguese_brazilian ] = "File already exists" ; + Text [ portuguese ] = "O ficheiro já existe" ; + Text [ french ] = "Fichier existant déjà" ; + Text [ dutch ] = "Bestand bestaat reeds" ; + Text [ spanish ] = "El archivo ya existe" ; + Text [ danish ] = "Filen eksisterer allerede" ; + Text [ swedish ] = "Filen existerar redan" ; + Text [ finnish ] = "File already exists" ; + Text [ english_us ] = "File already exists" ; + Text[ chinese_simplified ] = "ÎļþÒѾ´æÔÚ"; + Text[ russian ] = "Ôàéë óæå ñóùåñòâóåò"; + Text[ polish ] = "Plik ju¿ istnieje"; + Text[ japanese ] = "̧²Ù‚Í‚·‚łɂ ‚è‚Ü‚·"; + Text[ chinese_traditional ] = "Àɮפw¸g¦s¦b"; + Text[ arabic ] = "ÇáãáÝ ãæÌæÏ ãÓÈÞÇð"; + Text[ dutch ] = "Bestand bestaat reeds"; + Text[ chinese_simplified ] = "ÎļþÒѾ´æÔÚ"; + Text[ greek ] = "Ôï áñ÷åßï õðÜñ÷åé Þäç"; + Text[ korean ] = "ÆÄÀÏÀÌ ÀÌ¹Ì Á¸ÀçÇÕ´Ï´Ù."; + Text[ turkish ] = "Dosya mevcut durumda"; + Text[ language_user1 ] = " "; + }; + String SbERR_BAD_RECORD_LENGTH & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Falsche Datensatzlõnge : Falsche Datensatzl§nge */ + Text = "Falsche Datensatzlänge" ; + Text [ ENGLISH ] = "Bad record length" ; + Text [ norwegian ] = "Bad record length" ; + Text [ italian ] = "Lunghezza record di dati errata" ; + Text [ portuguese_brazilian ] = "Bad record length" ; + Text [ portuguese ] = "Comprimento do registo de dados incorrecto" ; + Text [ french ] = "Longueur d'enregistrement incorrecte" ; + Text [ dutch ] = "Foutieve record-lengte" ; + Text [ spanish ] = "Longitud errónea del registro de datos" ; + Text [ danish ] = "Forkert datapostlængde" ; + Text [ swedish ] = "Felaktig datapostlängd" ; + Text [ finnish ] = "Bad record length" ; + Text [ english_us ] = "Incorrect record length" ; + Text[ chinese_simplified ] = "Êý¾ÝÌõÄ¿³¤¶È´íÎó"; + Text[ russian ] = "Íåïðàâèëüíàÿ äëèíà çàïèñè äàííûõ"; + Text[ polish ] = "Niepoprawna d³ugoœæ rekordów"; + Text[ japanese ] = "³‚µ‚‚È‚¢Úº°ÄÞ‚Ì’·‚³"; + Text[ chinese_traditional ] = "¿ù»~ªº¸ê®Æ¶µ¥Øªø«×"; + Text[ arabic ] = "Øæá ÓÌáÇÊ ÇáÈíÇäÇÊ ÛíÑ ÕÍíÍ"; + Text[ dutch ] = "Foutieve record-lengte"; + Text[ chinese_simplified ] = "Êý¾ÝÌõÄ¿³¤¶È´íÎó"; + Text[ greek ] = "Ìç áðïäåêôü ìÞêïò åããñáöÞò"; + Text[ korean ] = "À߸øµÈ µ¥ÀÌÅÍ ·¹ÄÚµå ±æÀÌ"; + Text[ turkish ] = "Yanlýþ veri kümesi uzunluðu"; + Text[ language_user1 ] = " "; + }; + String SbERR_DISK_FULL & ERRCODE_RES_MASK + { + Text = "Diskette/Festplatte voll" ; + Text [ ENGLISH ] = "Disk full" ; + Text [ norwegian ] = "Disk full" ; + Text [ italian ] = "Dischetto o disco rigido pieno" ; + Text [ portuguese_brazilian ] = "Disk full" ; + Text [ portuguese ] = "Disquete ou disco rígido cheios" ; + Text [ french ] = "Disquette/disque dur plein(e)" ; + Text [ dutch ] = "Diskette/harde schijf vol" ; + Text [ spanish ] = "Disquete o disco duro lleno" ; + Text [ danish ] = "Disketten/harddisken er fuld" ; + Text [ swedish ] = "Diskett eller hårddisk full" ; + Text [ finnish ] = "Disk full" ; + Text [ english_us ] = "Disk or hard drive full" ; + Text[ chinese_simplified ] = "ÈíÅÌ»òÓ²ÅÌÒÑÂú"; + Text[ russian ] = "Äèñê èëè æåñòêèé äèñê çàïîëíåíû"; + Text[ polish ] = "Dyskietka/Dysk twardy s¹ pe³ne"; + Text[ japanese ] = "ÌÛ¯Ëß°ÃÞ¨½¸‚Ü‚½‚ÍʰÄÞÃÞ¨½¸‚ª‚¢‚Á‚Ï‚¢"; + Text[ chinese_traditional ] = "³nºÏ½L©ÎºÏ½L¤wº¡"; + Text[ arabic ] = "ÇáÞÑÕ ÇáãÑä/ ÇáÕáÈ ããÊáÆ"; + Text[ dutch ] = "Diskette/harde schijf vol"; + Text[ chinese_simplified ] = "ÈíÅÌ»òÓ²ÅÌÒÑÂú"; + Text[ greek ] = "ÄéóêÝôá/ÌïíÜäá äßóêïõ åßíáé ðëÞñçò"; + Text[ korean ] = "µð½ºÄÏ/ ÇÏµå µð½ºÅ©°¡ ²Ë áÀ½"; + Text[ turkish ] = "Disket/disk dolu"; + Text[ language_user1 ] = " "; + }; + String SbERR_READ_PAST_EOF & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Lesen ³ber das Ende der Datei hinaus : Lesen ber das Ende der Datei hinaus */ + Text = "Lesen über das Ende der Datei hinaus" ; + Text [ ENGLISH ] = "Input past end of file" ; + Text [ norwegian ] = "Input past end of file" ; + Text [ italian ] = "Lettura oltre la fine del file" ; + Text [ portuguese_brazilian ] = "Input past end of file" ; + Text [ portuguese ] = "Ler para além do fim de ficheiro" ; + Text [ french ] = "Lecture au-delà de la fin du fichier" ; + Text [ dutch ] = "Lezen overschrijdt bestandseinde" ; + Text [ spanish ] = "Seguir leyendo tras el final del archivo" ; + Text [ danish ] = "Læs ud over filens slutning" ; + Text [ swedish ] = "Läsning utöver filens slut" ; + Text [ finnish ] = "Input past end of file" ; + Text [ english_us ] = "Reading exceeds EOF" ; + Text[ chinese_simplified ] = "¶ÁÈ¡³¬³öÎļþ·¶Î§"; + Text[ russian ] = "Ñ÷èòûâàíèå ïðåâûøàåò êîíåö ôàéëà"; + Text[ polish ] = "Odczyt przekracza koniec pliku"; + Text[ japanese ] = "EOF º°ÄÞ‚ð‰z‚¦‚é“ǂݎæ‚è"; + Text[ chinese_traditional ] = "Ū¨ú¶W¥XÀÉ®×½d³ò"; + Text[ arabic ] = "ÇáÞÑÇÁÉ ÍÊì äåÇíÉ ÇáãáÝ æãÇ ÈÚÏåÇ"; + Text[ dutch ] = "Lezen overschrijdt bestandseinde"; + Text[ chinese_simplified ] = "¶ÁÈ¡³¬³öÎļþ·¶Î§"; + Text[ greek ] = "ÁíÜãíùóç ðÝñá áðü ôï ôÝëïò ôïõ áñ÷åßïõ"; + Text[ korean ] = "ÆÄÀÏÀÇ ³¡À» ÃʰúÇÏ¿© ÀÐÀ½"; + Text[ turkish ] = "Okuma dosya sonunu aþýyor"; + Text[ language_user1 ] = " "; + }; + String SbERR_BAD_RECORD_NUMBER & ERRCODE_RES_MASK + { + Text = "Datensatznummer falsch" ; + Text [ ENGLISH ] = "Bad record number" ; + Text [ norwegian ] = "Bad record number" ; + Text [ italian ] = "Numero record errato" ; + Text [ portuguese_brazilian ] = "Bad record number" ; + Text [ portuguese ] = "Número do registo de dados incorrecto" ; + Text [ french ] = "Numéro d'enregistrement incorrect" ; + Text [ dutch ] = "Foutief record-nummer" ; + Text [ spanish ] = "Número erróneo de registro de datos" ; + Text [ danish ] = "Forkert datapostnummer" ; + Text [ swedish ] = "Felaktigt datapostnummer" ; + Text [ finnish ] = "Bad record number" ; + Text [ english_us ] = "Incorrect record number" ; + Text[ chinese_simplified ] = "Êý¾ÝÌõÄ¿ºÅÂë´íÎó"; + Text[ russian ] = "Íåïðàâèëüíûé íîìåð ðåãèñòðàöèè äàííûõ"; + Text[ polish ] = "Niepoprawna d³ugoœæ rekordów"; + Text[ japanese ] = "Úº°Äނ̔Ԇ‚ª³‚µ‚‚ ‚è‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "¸ê®Æ¶µ¥Ø¸¹½X¿ù»~"; + Text[ arabic ] = "ÑÞã ÓÌáÇÊ ÇáÈíÇäÇÊ ÛíÑ ÕÍíÍ"; + Text[ dutch ] = "Foutief record-nummer"; + Text[ chinese_simplified ] = "Êý¾ÝÌõÄ¿ºÅÂë´íÎó"; + Text[ greek ] = "ËáíèáóìÝíïò áñéèìüò åããñáöÞò"; + Text[ korean ] = "À߸øµÈ µ¥ÀÌÅÍ ·¹ÄÚµå ¹øÈ£"; + Text[ turkish ] = "Veri kümesi numarasý yanlýþ"; + Text[ language_user1 ] = " "; + }; + String SbERR_TOO_MANY_FILES & ERRCODE_RES_MASK + { + Text = "Zu viele Dateien" ; + Text [ ENGLISH ] = "Too many files" ; + Text [ norwegian ] = "Too many files" ; + Text [ italian ] = "Troppi file" ; + Text [ portuguese_brazilian ] = "Too many files" ; + Text [ portuguese ] = "Demasiados ficheiros" ; + Text [ french ] = "Trop de fichiers" ; + Text [ dutch ] = "Teveel bestanden" ; + Text [ spanish ] = "Demasiados archivos" ; + Text [ danish ] = "Der er for mange filer" ; + Text [ swedish ] = "För många filer" ; + Text [ finnish ] = "Too many files" ; + Text [ english_us ] = "Too many files" ; + Text[ chinese_simplified ] = "Ì«¶àÎļþ"; + Text[ russian ] = "Ñëèøêîì ìíîãî ôàéëîâ"; + Text[ polish ] = "Za du¿o plików"; + Text[ japanese ] = "̧²Ù‚ª‘½‚·‚¬‚Ü‚·"; + Text[ chinese_traditional ] = "¤Ó¦hÀÉ®×"; + Text[ arabic ] = "ãáÝÇÊ ßËíÑÉ ÌÏÇð"; + Text[ dutch ] = "Teveel bestanden"; + Text[ chinese_simplified ] = "Ì«¶àÎļþ"; + Text[ greek ] = "ÐÜñá ðïëëÜ áñ÷åßá"; + Text[ korean ] = "ÆÄÀϵéÀÌ ³Ê¹« ¸¹À½"; + Text[ turkish ] = "Dosya sayýsý fazla"; + Text[ language_user1 ] = " "; + }; + String SbERR_NO_DEVICE & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Gerõt nicht verf³gbar : Ger§t nicht verfgbar */ + Text = "Gerät nicht verfügbar" ; + Text [ ENGLISH ] = "Device not available" ; + Text [ norwegian ] = "Device not available" ; + Text [ italian ] = "Apparecchio non disponibile" ; + Text [ portuguese_brazilian ] = "Device not available" ; + Text [ portuguese ] = "Aparelho não disponível" ; + Text [ french ] = "Périphérique indisponible" ; + Text [ dutch ] = "Apparatuur niet beschikbaar" ; + Text [ spanish ] = "El dispositivo no está disponible" ; + Text [ danish ] = "Enheden er ikke tilgængelig" ; + Text [ swedish ] = "Enhet ej tillgänglig" ; + Text [ finnish ] = "Device not available" ; + Text [ english_us ] = "Device not available" ; + Text[ chinese_simplified ] = "É豸²»´æÔÚ"; + Text[ russian ] = "Óñòðîéñòâî íåäîñòóïíî"; + Text[ polish ] = "Urz¹dzenie niedostêpne"; + Text[ japanese ] = "ÃÞ¨ÊÞ²½‚Í‚ ‚è‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "³]³Æ¤£¦s¦b"; + Text[ arabic ] = "ÇáÌåÇÒ ÛíÑ ãÊÇÍ"; + Text[ dutch ] = "Apparatuur niet beschikbaar"; + Text[ chinese_simplified ] = "É豸²»´æÔÚ"; + Text[ greek ] = "Ç óõóêåõÞ äåí åßíáé äéáèÝóéìç"; + Text[ korean ] = "µð¹ÙÀ̽º »ç¿ëÀÌ ºÒ°¡´É"; + Text[ turkish ] = "Cihaz kullanýlabilir durumda deðil"; + Text[ language_user1 ] = " "; + }; + String SbERR_ACCESS_DENIED & ERRCODE_RES_MASK + { + Text = "Zugriff verweigert" ; + Text [ ENGLISH ] = "Permission denied" ; + Text [ norwegian ] = "Permission denied" ; + Text [ italian ] = "Accesso negato" ; + Text [ portuguese_brazilian ] = "Permission denied" ; + Text [ portuguese ] = "Acesso recusado" ; + Text [ french ] = "Accès refusé" ; + Text [ dutch ] = "Toegang geweigerd" ; + Text [ spanish ] = "Acceso denegado" ; + Text [ danish ] = "Adgang nægtet" ; + Text [ swedish ] = "Åtkomst nekad" ; + Text [ finnish ] = "Permission denied" ; + Text [ english_us ] = "Access denied" ; + Text[ chinese_simplified ] = "¾Ü¾ø¶ÁÈ¡"; + Text[ russian ] = "Äîñòóï çàïðåùåí"; + Text[ polish ] = "Dostêp zabroniony"; + Text[ japanese ] = "±¸¾½‚Å‚«‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "©Úµ´Åª¨ú"; + Text[ arabic ] = "áã íÓãÍ ÈÇáæÕæá"; + Text[ dutch ] = "Toegang geweigerd"; + Text[ chinese_simplified ] = "¾Ü¾ø¶ÁÈ¡"; + Text[ greek ] = "Äåí åðéôñÝðåôáé ç ðñüóâáóç"; + Text[ korean ] = "Á¢±Ù °ÅºÎ"; + Text[ turkish ] = "Eriþim engellendi"; + Text[ language_user1 ] = " "; + }; + String SbERR_NOT_READY & ERRCODE_RES_MASK + { + Text = "Diskette nicht bereit" ; + Text [ ENGLISH ] = "Disk not ready" ; + Text [ norwegian ] = "Disk not ready" ; + Text [ italian ] = "Dischetto non pronto" ; + Text [ portuguese_brazilian ] = "Disk not ready" ; + Text [ portuguese ] = "A disquete não está pronta" ; + Text [ french ] = "La disquette n'est pas prête" ; + Text [ dutch ] = "Diskette niet bereid" ; + Text [ spanish ] = "El disquete no está preparado" ; + Text [ danish ] = "Disketten er ikke klar" ; + Text [ swedish ] = "Disketten är inte beredd" ; + Text [ finnish ] = "Disk not ready" ; + Text [ english_us ] = "Disk not ready" ; + Text[ chinese_simplified ] = "ÈíÅÌ»¹Ã»ÓÐ×¼±¸ºÃ"; + Text[ russian ] = "Äèñê íå ãîòîâ"; + Text[ polish ] = "Dyskietka nie gotowa"; + Text[ japanese ] = "ÃÞ¨½¸‚Í—pˆÓ‚Å‚«‚Ä‚¢‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "³nºÏ½LÁÙ¨S¦³·Ç³Æ¦n"; + Text[ arabic ] = "ÇáÞÑÕ ÛíÑ ÌÇåÒ"; + Text[ dutch ] = "Diskette niet bereid"; + Text[ chinese_simplified ] = "ÈíÅÌ»¹Ã»ÓÐ×¼±¸ºÃ"; + Text[ greek ] = "Ç äéóêÝôá äåí åßíáé Ýôïéìç"; + Text[ korean ] = "µð½ºÅ©°¡ ÁغñµÇÁö ¾Ê¾Ò½À´Ï´Ù."; + Text[ turkish ] = "Disket hazýr deðil"; + Text[ language_user1 ] = " "; + }; + String SbERR_NOT_IMPLEMENTED & ERRCODE_RES_MASK + { + Text = "Nicht implementiert" ; + Text [ ENGLISH ] = "Feature not implemented" ; + Text [ norwegian ] = "Feature not implemented" ; + Text [ italian ] = "Non implementato" ; + Text [ portuguese_brazilian ] = "Feature not implemented" ; + Text [ portuguese ] = "Não implementado" ; + Text [ french ] = "Non implanté" ; + Text [ dutch ] = "Niet geïmplementeerd" ; + Text [ spanish ] = "No implementado" ; + Text [ danish ] = "Ikke implementeret" ; + Text [ swedish ] = "Ej implementerad" ; + Text [ finnish ] = "Feature not implemented" ; + Text [ english_us ] = "Not implemented" ; + Text[ chinese_simplified ] = "ÉÐδʵʩ"; + Text[ russian ] = "Íå ðåàëèçèðîâàíî"; + Text[ polish ] = "Nie zaimplementowane"; + Text[ japanese ] = "ŽÀ‘•‚³‚ê‚Ä‚¢‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "©|¥¼¹ê¬I"; + Text[ arabic ] = "áã íÊã ÇáÊØÈíÞ"; + Text[ dutch ] = "Niet geïmplementeerd"; + Text[ chinese_simplified ] = "ÉÐδʵʩ"; + Text[ greek ] = "Äåí Ý÷åé õëïðïéçèåß"; + Text[ korean ] = "±¸ÇöµÇÁö ¾Ê¾ÒÀ½"; + Text[ turkish ] = "Uygulanmadý"; + Text[ language_user1 ] = " "; + }; + String SbERR_DIFFERENT_DRIVE & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Umbenennen auf verschiedenen Laufwerken nicht m÷glich : Umbenennen auf verschiedenen Laufwerken nicht m”glich */ + Text = "Umbenennen auf verschiedenen Laufwerken nicht möglich" ; + Text [ ENGLISH ] = "No rename with different drive" ; + Text [ norwegian ] = "No rename with different drive" ; + Text [ italian ] = "Impossibile rinominare su drive diversi" ; + Text [ portuguese_brazilian ] = "No rename with different drive" ; + Text [ portuguese ] = "Impossível mudar nome em várias unidades" ; + Text [ french ] = "Impossible de renommer sur des lecteurs différents" ; + Text [ dutch ] = "Namen wijzigen op verschillende stations niet mogelijk" ; + Text [ spanish ] = "No se puede cambiar nombre en distintas unidades" ; + Text [ danish ] = "Omdøbning på forskellige drev er ikke mulig" ; + Text [ swedish ] = "Omöjligt att byta namn på olika enheter" ; + Text [ finnish ] = "No rename with different drive" ; + Text [ english_us ] = "Renaming on different drives impossible" ; + Text[ chinese_simplified ] = "ÎÞ·¨ÖØÃüÃû³É²»Í¬µÄÇý¶¯ÅÌ"; + Text[ russian ] = "Ïåðåèìåíîâàòü íà ðàçíûõ äèñêàõ íåâîçìîæíî"; + Text[ polish ] = "Zmiana nazwy na ró¿nych dyskach jest niemo¿liwa"; + Text[ japanese ] = "•¡”ÄÞײÌÞ‚Ì–¼‘O‚Ì•ÏX‚͂ł«‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "µLªk«·s©R¦W¦¨¤£¦PªººÏ½L"; + Text[ arabic ] = "ÅÚÇÏÉ ÇáÊÓãíÉ Úáì ãÍÑßÇÊ ÃÞÑÇÕ ãÎÊáÝÉ ÛíÑ ããßä"; + Text[ dutch ] = "Namen wijzigen op verschillende stations niet mogelijk"; + Text[ chinese_simplified ] = "ÎÞ·¨ÖØÃüÃû³É²»Í¬µÄÇý¶¯ÅÌ"; + Text[ greek ] = "Äåí åßíáé äõíáôÞ ç ìåôïíïìáóßá óå äéáöïñåôéêïýò äßóêïõò"; + Text[ korean ] = "´Ù¸¥ µå¶óÀ̹ö»óÀÇ »õ·Î¿î À̸§Àº ºÒ°¡´ÉÇÕ´Ï´Ù."; + Text[ turkish ] = "Farklý sürücülerde yeniden adlandýrma yapýlamaz"; + Text[ language_user1 ] = " "; + }; + String SbERR_ACCESS_ERROR & ERRCODE_RES_MASK + { + Text = "Pfad/Datei-Zugriffsfehler" ; + Text [ ENGLISH ] = "Path/File access error" ; + Text [ norwegian ] = "Path/File access error" ; + Text [ italian ] = "Errore di accesso al percorso/file" ; + Text [ portuguese_brazilian ] = "Path/File access error" ; + Text [ portuguese ] = "Atalho/Erro de acesso ao ficheiro" ; + Text [ french ] = "Erreur d'accès au chemin/fichier" ; + Text [ dutch ] = "Fout bij toegang op pad/bestand" ; + Text [ spanish ] = "Error de acceso a la ruta o al archivo" ; + Text [ danish ] = "Sti/fil adgangsfejl" ; + Text [ swedish ] = "Sökväg/fil åtkomstfel" ; + Text [ finnish ] = "Path/File access error" ; + Text [ english_us ] = "Path/File access error" ; + Text[ chinese_simplified ] = "¶Áȡ·¾¶/Îļþʱ·¢Éú´íÎó"; + Text[ russian ] = "Îøèáêà äîñòóïà ïóòè èëè ôàéëà"; + Text[ polish ] = "B³¹d dostêpu do œcie¿ki/pliku"; + Text[ japanese ] = "Êß½‚Ü‚½‚Í̧²Ù‚ւ̱¸¾½´×°"; + Text[ chinese_traditional ] = "Ū¨ú¸ô®|/Àɮ׮ɵo¥Í¿ù»~"; + Text[ arabic ] = "ÎØÃ ÃËäÇÁ ÇáÏÎæá Åáì ÇáãÓÇÑ/ÇáãáÝ"; + Text[ dutch ] = "Fout bij toegang op pad/bestand"; + Text[ chinese_simplified ] = "¶Áȡ·¾¶/Îļþʱ·¢Éú´íÎó"; + Text[ greek ] = "ÓöÜëìá ðñüóâáóçò äéáäñïìÞò/áñ÷åßïõ"; + Text[ korean ] = "ÆÐ½º/ÆÄÀÏ Á¢±Ù ¿À·ù"; + Text[ turkish ] = "Veri yolu/eriþim hatasý"; + Text[ language_user1 ] = " "; + }; + String SbERR_PATH_NOT_FOUND & ERRCODE_RES_MASK + { + Text = "Pfad nicht gefunden" ; + Text [ ENGLISH ] = "Path not found" ; + Text [ norwegian ] = "Path not found" ; + Text [ italian ] = "Percorso non trovato" ; + Text [ portuguese_brazilian ] = "Path not found" ; + Text [ portuguese ] = "Atalho não encontrado" ; + Text [ french ] = "Chemin introuvable" ; + Text [ dutch ] = "Pad niet gevonden" ; + Text [ spanish ] = "No se encontró la ruta" ; + Text [ danish ] = "Stien blev ikke fundet" ; + Text [ swedish ] = "Sökvägen hittades inte" ; + Text [ finnish ] = "Path not found" ; + Text [ english_us ] = "Path not found" ; + Text[ chinese_simplified ] = "ûÓÐÕÒµ½Â·¾¶"; + Text[ russian ] = "Ïóòü íå íàéäåí"; + Text[ polish ] = "Œcie¿ka nie zosta³a znaleziona"; + Text[ japanese ] = "Êß½‚ªŒ©‚‚©‚è‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "¨S¦³§ä¨ì¸ô®|"; + Text[ arabic ] = "áã íñÚËÑ Úáì ÇáãÓÇÑ"; + Text[ dutch ] = "Pad niet gevonden"; + Text[ chinese_simplified ] = "ûÓÐÕÒµ½Â·¾¶"; + Text[ greek ] = "Äåí âñÝèçêå ç äéáäñïìÞ"; + Text[ korean ] = "ÆÐ½º°¡ ¹ß°ßµÇÁö ¾Ê¾Ò½À´Ï´Ù."; + Text[ turkish ] = "Veri yolu bulunamadý"; + Text[ language_user1 ] = " "; + }; + String SbERR_NO_OBJECT & ERRCODE_RES_MASK + { + Text = "Objektvariable nicht belegt" ; + Text [ ENGLISH ] = "Object variable not set" ; + Text [ norwegian ] = "Object variable not set" ; + Text [ italian ] = "Variabile dell'oggetto non impostata" ; + Text [ portuguese_brazilian ] = "Object variable not set" ; + Text [ portuguese ] = "Variável do objecto não configurada" ; + Text [ french ] = "Variable d'objet non configurée" ; + Text [ dutch ] = "Objectvariabele niet gereserveerd" ; + Text [ spanish ] = "La variable del objeto no se ha establecido" ; + Text [ danish ] = "Objektvariablen er ikke optaget" ; + Text [ swedish ] = "Objektvariablerna inte bestämda" ; + Text [ finnish ] = "Object variable not set" ; + Text [ english_us ] = "Object variable not set" ; + Text[ chinese_simplified ] = "»¹Ã»ÓÐÉ趨¶ÔÏó±äÁ¿"; + Text[ russian ] = "Ïåðåìåííàÿ îáúåêòà íå óñòàíîâëåíà"; + Text[ polish ] = "Nie osadzono zmiennej obiektu"; + Text[ japanese ] = "µÌÞ¼Þª¸Ä•Ï”‚ÍÝ’è‚Å‚«‚Ä‚¢‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "ÁÙ¨S¦³³]©wª«¥óÅܶq"; + Text[ arabic ] = "áã íÊã ÊÚííä ãÊÛííÑÉ ÇáßÇÆä"; + Text[ dutch ] = "Objectvariabele niet gereserveerd"; + Text[ chinese_simplified ] = "»¹Ã»ÓÐÉ趨¶ÔÏó±äÁ¿"; + Text[ greek ] = "Äåí ïñßóôçêå ìåôáâëçôÞ áíôéêåéìÝíïõ"; + Text[ korean ] = "°³Ã¼º¯¼ö°¡ ¼³Á¤µÇÁö ¾Ê¾Ò½À´Ï´Ù."; + Text[ turkish ] = "Nesne deðiþkeni belirlenmedi"; + Text[ language_user1 ] = " "; + }; + String SbERR_BAD_PATTERN & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Zeichenfolgenmuster unzulõssig : Zeichenfolgenmuster unzul§ssig */ + Text = "Zeichenfolgenmuster unzulässig" ; + Text [ ENGLISH ] = "Invalid pattern string" ; + Text [ norwegian ] = "Invalid pattern string" ; + Text [ italian ] = "Sequenza di caratteri non valida" ; + Text [ portuguese_brazilian ] = "Invalid pattern string" ; + Text [ portuguese ] = "Sequência de caracteres não válida" ; + Text [ french ] = "Échantillon de chaîne de caractères incorrect" ; + Text [ dutch ] = "Ontoelaatbare tekenreeks" ; + Text [ spanish ] = "Secuencia de caracteres no válida" ; + Text [ danish ] = "Ugyldigt strengmønster" ; + Text [ swedish ] = "Ogiltig mönsterstring" ; + Text [ finnish ] = "Invalid pattern string" ; + Text [ english_us ] = "Invalid string pattern" ; + Text[ chinese_simplified ] = "ÎÞЧµÄ×Ö´®Ä£Ê½"; + Text[ russian ] = "Íåäîïóñòèìûé îáðàçåö ïîñëåäîâàòåëüíîñòè çíàêîâ"; + Text[ polish ] = "Nieprawid³owy ci¹g wzoru"; + Text[ japanese ] = "•¶Žš—ñÊßÀ°Ý‚Í‹–‰Â‚³‚ê‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "µL®Äªº¦r¦ê¼Ò¦¡"; + Text[ arabic ] = "äãæÐÌ ÊÊÇÈÚ ÇáÃÍÑÝ ÛíÑ ãÓãæÍ Èå"; + Text[ dutch ] = "Ontoelaatbare tekenreeks"; + Text[ chinese_simplified ] = "ÎÞЧµÄ×Ö´®Ä£Ê½"; + Text[ greek ] = "ÅóöáëìÝíç óõìâïëïóåéñÜ ìïôßâïõ"; + Text[ korean ] = "À¯È¿ÇÏÁö¾ÊÀº ¹®ÀÚ¿ À¯Çü"; + Text[ turkish ] = "Dizilim örneði geçerli deðil"; + Text[ language_user1 ] = " "; + }; + String SBERR_IS_NULL & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Verwendung von Null unzulõssig : Verwendung von Null unzul§ssig */ + Text = "Verwendung von Null unzulässig" ; + Text [ ENGLISH ] = "Invalid use of Null" ; + Text [ norwegian ] = "Invalid use of Null" ; + Text [ italian ] = "Uso dello zero non ammesso" ; + Text [ portuguese_brazilian ] = "Invalid use of Null" ; + Text [ portuguese ] = "Interdito o uso do zero" ; + Text [ french ] = "Utilisation du zéro interdite" ; + Text [ dutch ] = "Ongeldig gebruik van nul" ; + Text [ spanish ] = "No se admite el uso del cero" ; + Text [ danish ] = "Brug af nul er ikke tilladt" ; + Text [ swedish ] = "Användning av noll är ej tillåtet" ; + Text [ finnish ] = "Invalid use of Null" ; + Text [ english_us ] = "Use of zero not permitted" ; + Text[ chinese_simplified ] = "²»ÔÊÐíʹÓÃÓÃÁãÖµ"; + Text[ russian ] = "Èñïîëüçîâàíèå íóëÿ íåäîïóñòèìî"; + Text[ polish ] = "U¿ywanie zera niedopuszczalne"; + Text[ japanese ] = "¾ÞÛ‚ÌŽg—p‚Í‹–‰Â‚³‚ê‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "¤£¤¹³\\½Õ¥Î¹sÈ"; + Text[ arabic ] = "ÛíÑ ãÓãæÍ ÈÇÓÊÎÏÇã ÇáÕÝÑ"; + Text[ dutch ] = "Ongeldig gebruik van nul"; + Text[ chinese_simplified ] = "²»ÔÊÐíʹÓÃÓÃÁãÖµ"; + Text[ greek ] = "Äåí åðéôñÝðåôáé ç ÷ñÞóç ôïõ ìçäåíüò"; + Text[ korean ] = "0ÀÇ »ç¿ëÀÌ Çã¿ëµÇÁö ¾Ê¾Ò½À´Ï´Ù."; + Text[ turkish ] = "Sýfýr kullanýmý geçerli deðil"; + Text[ language_user1 ] = " "; + }; + String SbERR_DDE_ERROR & ERRCODE_RES_MASK + { + Text = "DDE-Fehler" ; + Text [ ENGLISH ] = "DDE Error" ; + Text [ norwegian ] = "DDE Error" ; + Text [ italian ] = "Errore DDE" ; + Text [ portuguese_brazilian ] = "DDE Error" ; + Text [ portuguese ] = "Erro DDE" ; + Text [ french ] = "Erreur DDE" ; + Text [ dutch ] = "DDE-fout" ; + Text [ spanish ] = "Error de DDE" ; + Text [ danish ] = "DDE-fejl" ; + Text [ swedish ] = "DDE-fel" ; + Text [ finnish ] = "DDE Error" ; + Text [ english_us ] = "DDE Error" ; + Text[ chinese_simplified ] = "DDE ´íÎó"; + Text[ russian ] = "Îøèáêà DDE"; + Text[ polish ] = "B³¹d DDE"; + Text[ japanese ] = "DDE‚Ì´×°"; + Text[ chinese_traditional ] = "DDE ¿ù»~"; + Text[ arabic ] = "DDE ÎØÃ"; + Text[ dutch ] = "DDE-fout"; + Text[ chinese_simplified ] = "DDE ´íÎó"; + Text[ greek ] = "ÓöÜëìá DDE"; + Text[ korean ] = "DDE ¿À·ù"; + Text[ turkish ] = "DDE hatasý"; + Text[ language_user1 ] = " "; + }; + String SbERR_DDE_WAITINGACK & ERRCODE_RES_MASK + { + Text = "Warten auf Antwort in DDE-Verbindung" ; + Text [ ENGLISH ] = "Awaiting response in DDE-Conversation" ; + Text [ norwegian ] = "Awaiting response in DDE-Conversation" ; + Text [ italian ] = "In attesa di risposta nel collegamento DDE" ; + Text [ portuguese_brazilian ] = "Awaiting response in DDE-Conversation" ; + Text [ portuguese ] = "Esperando resposta à ligação DDE" ; + Text [ french ] = "Attente de réponse dans une connexion DDE" ; + Text [ dutch ] = "Wachten op antwoord in DDE-verbinding" ; + Text [ spanish ] = "Esperando respuesta en la conexión DDE" ; + Text [ danish ] = "Venter på svar til DDE-forbindelsen" ; + Text [ swedish ] = "Väntar på svar till DDE-förbindelsen" ; + Text [ finnish ] = "Awaiting response in DDE-Conversation" ; + Text [ english_us ] = "Awaiting response to DDE connection" ; + Text[ chinese_simplified ] = "ÔÚ DDE Á¬½ÓʱµÈºò´ð¸´"; + Text[ russian ] = "Îæèäàíèå îòâåòà âî âðåìÿ ïîäêëþ÷åíèÿ DDE"; + Text[ polish ] = "Czekanie na odpowiedŸ w po³¹czeniu DDE"; + Text[ japanese ] = "DDEÚ‘±‚É‚¨‚¯‚鉞“š‘Ò‚¿"; + Text[ chinese_traditional ] = "¦b DDE ³sµ²®Éµ¥Ôµª´_"; + Text[ arabic ] = "DDE Ýí ÇäÊÙÇÑ ÇáÑÏ Ýí ÇÊÕÇá"; + Text[ dutch ] = "Wachten op antwoord in DDE-verbinding"; + Text[ chinese_simplified ] = "ÔÚ DDE Á¬½ÓʱµÈºò´ð¸´"; + Text[ greek ] = "ÁíáìÝíåôáé áðÜíôçóç ôçò óýíäåóçò DDE"; + Text[ korean ] = "DDE Á¢¼ÓÀÇ ÀÀ´ä ´ë±âÁß"; + Text[ turkish ] = "DDE baðlantýsýnda yanýt bekleniyor"; + Text[ language_user1 ] = " "; + }; + String SbERR_DDE_OUTOFCHANNELS & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Keine freien DDE-Kanõle : Keine freien DDE-Kan§le */ + Text = "Keine freien DDE-Kanäle" ; + Text [ ENGLISH ] = "No more DDE channels" ; + Text [ norwegian ] = "No more DDE channels" ; + Text [ italian ] = "Nessun canale DDE libero" ; + Text [ portuguese_brazilian ] = "No more DDE channels" ; + Text [ portuguese ] = "Nenhum canal DDE livre" ; + Text [ french ] = "Aucun canal DDE libre" ; + Text [ dutch ] = "Geen vrije DDE-kanalen" ; + Text [ spanish ] = "No hay canales DDE libres" ; + Text [ danish ] = "Ingen åbne DDE-kanaler" ; + Text [ swedish ] = "Inga fria DDE-kanaler" ; + Text [ finnish ] = "No more DDE channels" ; + Text [ english_us ] = "No DDE channels available" ; + Text[ chinese_simplified ] = "ûÓпÉÓÃµÄ DDE-ÐŵÀ"; + Text[ russian ] = "Ñâîáîäíûõ êàíàëîâ DDE íå èìååòñÿ"; + Text[ polish ] = "Nie ma wolnych kana³ów DDE"; + Text[ japanese ] = "Žg‚¦‚éDDEÁ¬ÝÈÙ‚ª‚ ‚è‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "¨S¦³¶}©ñ DDE-«H¹D"; + Text[ arabic ] = "DDE áÇ íæÌÏ ÞäæÇÊ"; + Text[ dutch ] = "Geen vrije DDE-kanalen"; + Text[ chinese_simplified ] = "ûÓпÉÓÃµÄ DDE-ÐŵÀ"; + Text[ greek ] = "Äåí õðÜñ÷ïõí äéáèÝóéìá êáíÜëéá DDE"; + Text[ korean ] = "DDE ä³ÎÀÌ ºÒ°¡´É"; + Text[ turkish ] = "Boþ DDE kanallarý yok"; + Text[ language_user1 ] = " "; + }; + String SbERR_DDE_NO_RESPONSE & ERRCODE_RES_MASK + { + Text = "Keine Applikation anwortet auf DDE-Verbindungswunsch" ; + Text [ ENGLISH ] = "No application responded to DDE initiate" ; + Text [ norwegian ] = "No application responded to DDE initiate" ; + Text [ italian ] = "Nessuna applicazione risponde al tentativo di collegamento DDE" ; + Text [ portuguese_brazilian ] = "No application responded to DDE initiate" ; + Text [ portuguese ] = "O estabelecimento da ligação DDE não obteve resposta de nenhuma aplicação" ; + Text [ french ] = "Aucune application ne réagit à la tentative de connexion DDE" ; + Text [ dutch ] = "Geen enkele applicatie antwoordt op DDE-verbindingsoproep" ; + Text [ spanish ] = "No responde ninguna aplicación a la conexión DDE deseada" ; + Text [ danish ] = "Ingen applikation svarer på DDE-forbindelsesinitialiseringen" ; + Text [ swedish ] = "Ingen applikation svarar på DDE-förbindelsinitieringen" ; + Text [ finnish ] = "No application responded to DDE initiate" ; + Text [ english_us ] = "No application responded to DDE connect initiation" ; + Text[ chinese_simplified ] = "ûÓÐÈκÎÓ¦ÓóÌÐò»ØÓ¦ DDE Á¬½ÓÇëÇó"; + Text[ russian ] = "Íèêàêîå ïðèëîæåíèå íå îòâå÷àåò íà òðåáîâàíèå ïîäêëþ÷åíèÿ DDE"; + Text[ polish ] = "Za du¿o aplikacji odpowiada na inicjacjê po³¹czenia DDE"; + Text[ japanese ] = "DDEÚ‘±Šó–]‚ɉž“š‚·‚é±Ìߨ¹°¼®Ý‚ª‚ ‚è‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "¨S¦³¥ô¦óÀ³¥Îµ{¦¡¦^À³ DDE ³sµ²½Ð¨D"; + Text[ arabic ] = "áÇ ÊæÌÏ ÇÓÊÌÇÈÉ ãä ÃíÉ ÊØÈíÞ ááÑÛÈÉ Ýí ÇÊÕÇá DDE"; + Text[ dutch ] = "Geen enkele applicatie antwoordt op DDE-verbindingsoproep"; + Text[ chinese_simplified ] = "ûÓÐÈκÎÓ¦ÓóÌÐò»ØÓ¦ DDE Á¬½ÓÇëÇó"; + Text[ greek ] = "Äåí áðáíôÜ êáìßá åöáñìïãÞ êáôÜ ôçí åðé÷åßñçóç óýíäåóçò DDE"; + Text[ korean ] = "DDE Á¢¼ÓÀÇ ÃʱâÈ¿¡ ÀÀ´äÇÏ´Â ÀÀ¿ëÇÁ·Î±×·¥ÀÌ ¾øÀ½"; + Text[ turkish ] = "Hiçbir uygulama DDE baðlantý talebine yanýt vermiyor"; + Text[ language_user1 ] = " "; + }; + String SbERR_DDE_MULT_RESPONSES & ERRCODE_RES_MASK + { + Text = "Zu viele Applikationen antworten auf DDE-Verbindungswunsch" ; + Text [ ENGLISH ] = "Multiple applications responded to DDE initiate" ; + Text [ norwegian ] = "Multiple applications responded to DDE initiate" ; + Text [ italian ] = "Troppe applicazioni rispondono al collegamento DDE desiderato" ; + Text [ portuguese_brazilian ] = "Multiple applications responded to DDE initiate" ; + Text [ portuguese ] = "Demasiadas aplicações respondem à tentativa de ligação DDE" ; + Text [ french ] = "Trop d'applications répondent à la tentative de connexion DDE" ; + Text [ dutch ] = "Teveel applicatiex antwoorden op de DDE-verbindingsoproep" ; + Text [ spanish ] = "Demasiadas aplicaciones responden a la conexión deseada DDE" ; + Text [ danish ] = "For mange applikationer svarer på DDE-forbindelsesinitialiseringen" ; + Text [ swedish ] = "Alltför många applikationer svarar på DDE-förbindelseinitieringen" ; + Text [ finnish ] = "Multiple applications responded to DDE initiate" ; + Text [ english_us ] = "Too many applications responded to DDE connect initiation" ; + Text[ chinese_simplified ] = "Ì«¶àµÄÓ¦ÓóÌÐò»ØÓ¦ DDE Á¬½ÓÇëÇó"; + Text[ russian ] = "Ñëèøêîì ìíîãî ïðèëîæåíèé îòâå÷àåò íà òðåáîâàíèå ïîäêëþ÷åíèÿ DDE"; + Text[ polish ] = "Za du¿o aplikacji odpowiada na inicjacjê po³¹czenia DDE"; + Text[ japanese ] = "DDEÚ‘±Šó–]‚ɉž“š‚·‚é±Ìߨ¹°¼®Ý‚ª‘½‚·‚¬‚Ü‚·"; + Text[ chinese_traditional ] = "¤Ó¦hªºÀ³¥Îµ{¦¡¦^À³ DDE ³sµ²½Ð¨D"; + Text[ arabic ] = "åäÇß ÇÓÊÌÇÈÉ ãä ÚÏÏ ßÈíÑ ÌÏÇð ãä ÇáÊØÈíÞÇÊ ááÑÛÈÉ Ýí ÇÊÕÇá DDE"; + Text[ dutch ] = "Teveel applicatiex antwoorden op de DDE-verbindingsoproep"; + Text[ chinese_simplified ] = "Ì«¶àµÄÓ¦ÓóÌÐò»ØÓ¦ DDE Á¬½ÓÇëÇó"; + Text[ greek ] = "ÁðÜíôçóáí õðåñâïëéêÜ ðïëëÝò åöáñìïãÝò êáôÜ ôçí åðé÷åßñçóç óýíäåóçò DDE"; + Text[ korean ] = "DDE Á¢¼ÓÀÇ ÃʱâÈ¿¡ ÀÀ´äÇÏ´Â ÀÀ¿ëÇÁ·Î±×·¥ÀÌ ³Ê¹« ¸¹À½"; + Text[ turkish ] = "DDE baðlantý talebine çok fazla uygulama yanýt veriyor"; + Text[ language_user1 ] = " "; + }; + String SbERR_DDE_CHANNEL_LOCKED & ERRCODE_RES_MASK + { + Text = "DDE-Kanal gesperrt" ; + Text [ ENGLISH ] = "DDE channel locked" ; + Text [ norwegian ] = "DDE channel locked" ; + Text [ italian ] = "Canale DDE bloccato" ; + Text [ portuguese_brazilian ] = "DDE channel locked" ; + Text [ portuguese ] = "Canal DDE bloqueado" ; + Text [ french ] = "Canal DDE verrouillé" ; + Text [ dutch ] = "DDE-kanaal geblokkeerd" ; + Text [ spanish ] = "Canal DDE bloqueado" ; + Text [ danish ] = "DDE-kanalen er låst" ; + Text [ swedish ] = "DDE-kanalen är spärrad" ; + Text [ finnish ] = "DDE channel locked" ; + Text [ english_us ] = "DDE channel locked" ; + Text[ chinese_simplified ] = "DDE ÐŵÀÒѾ±»Ëø¶¨"; + Text[ russian ] = "Êàíàë DDE áëîêèðîâàí"; + Text[ polish ] = "Kana³ DDE jest zablokowany"; + Text[ japanese ] = "DDEÁ¬ÝÈÙ‚ÍÛ¯¸‚³‚ê‚Ä‚¢‚Ü‚·"; + Text[ chinese_traditional ] = "DDE «H¹D¤w¸g³QÂê©w"; + Text[ arabic ] = "ãÄãäÉ.DDE ÞäÇÉ"; + Text[ dutch ] = "DDE-kanaal geblokkeerd"; + Text[ chinese_simplified ] = "DDE ÐŵÀÒѾ±»Ëø¶¨"; + Text[ greek ] = "Ôï êáíÜëé DDE åßíáé êëåéäùìÝíï"; + Text[ korean ] = "DDE ä³ÎÀÌ ´ÝÇûÀ½"; + Text[ turkish ] = "DDE kanalý kilitli"; + Text[ language_user1 ] = " "; + }; + String SbERR_DDE_NOTPROCESSED & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Fremdapplikation kann DDE-Operation nicht ausf³hren : Fremdapplikation kann DDE-Operation nicht ausfhren */ + Text = "Fremdapplikation kann DDE-Operation nicht ausführen" ; + Text [ ENGLISH ] = "Foreign application won't perform DDE operation" ; + Text [ norwegian ] = "Foreign application won't perform DDE operation" ; + Text [ italian ] = "L'applicazione esterna non può eseguire l'operazione DDE" ; + Text [ portuguese_brazilian ] = "Foreign application won't perform DDE operation" ; + Text [ portuguese ] = "A aplicação externa não pode executar a operação DDE" ; + Text [ french ] = "L'application externe ne peut pas exécuter l'opération DDE" ; + Text [ dutch ] = "Externe applicatie kan DDE niet uitvoeren" ; + Text [ spanish ] = "Una aplicación externa no puede realizar la operación DDE" ; + Text [ danish ] = "Den eksterne applikation kan ikke udføre DDE-operationen" ; + Text [ swedish ] = "Den externa applikationen kan inte utföra DDE-operationen" ; + Text [ finnish ] = "Foreign application won't perform DDE operation" ; + Text [ english_us ] = "External application cannot execute DDE operation" ; + Text[ chinese_simplified ] = "ÍⲿµÄÓ¦ÓóÌÐòÎÞ·¨Ö´ÐÐ DDE ÔËËã"; + Text[ russian ] = "Âíåøíèå ïðèëîæåíèÿ íå ìîãóò âûïîëíèòü îïåðàöèþ DDE"; + Text[ polish ] = "Obca aplikacja nie mo¿e wykonaæ operacjiDDE"; + Text[ japanese ] = "ŠO•”±Ìߨ¹°¼®Ý‚ÍDDE‚̵ÍßÚ°¼®Ý‚ðŽÀs‚Å‚«‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "¥~³¡ªºÀ³¥Îµ{§ÇµLªk°õ¦æ DDE ¹Bºâ"; + Text[ arabic ] = "DDE áÇ íÓÊØíÚ ÇáÊØÈíÞ ÇáÎÇÑÌí ÊäÝíÐ ÚãáíÉ"; + Text[ dutch ] = "Externe applicatie kan DDE niet uitvoeren"; + Text[ chinese_simplified ] = "ÍⲿµÄÓ¦ÓóÌÐòÎÞ·¨Ö´ÐÐ DDE ÔËËã"; + Text[ greek ] = "Ç åîùôåñéêÞ åöáñìïãÞ äåí åßíáé äõíáôüí íá åêôåëÝóåé ôçí ëåéôïõñãßá DDE"; + Text[ korean ] = "¿ÜºÎ ÀÀ¿ëÇÁ·Î±×·¥Àº DDE ÀÛµ¿À» ½ÇÇà½Ãų¼ö ¾ø½À´Ï´Ù."; + Text[ turkish ] = "Harici uygulama DDE iþlemini yürütemiyor"; + Text[ language_user1 ] = " "; + }; + String SbERR_DDE_TIMEOUT & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Zeit³berschreitung wõhrend des Wartens auf DDE-Antwort : Zeitberschreitung w§hrend des Wartens auf DDE-Antwort */ + Text = "Zeitüberschreitung während des Wartens auf DDE-Antwort" ; + Text [ ENGLISH ] = "Timeout while waiting for DDE response" ; + Text [ norwegian ] = "Timeout while waiting for DDE response" ; + Text [ italian ] = "Tempo d'attesa per la rispota DDE oltrepassato" ; + Text [ portuguese_brazilian ] = "Timeout while waiting for DDE response" ; + Text [ portuguese ] = "Ultrapassado tempo de espera pela resposta DDE" ; + Text [ french ] = "Timeout pendant l'attente de la réponse DDE" ; + Text [ dutch ] = "Tijdoverschrijding tijdens wachten op DDE-antwoord" ; + Text [ spanish ] = "Se ha excedido el tiempo de espera por una respuesta DDE" ; + Text [ danish ] = "Timeout mens der blev ventet på DDE-svar" ; + Text [ swedish ] = "Tiden har gått ut vid väntandet på DDE-svar" ; + Text [ finnish ] = "Timeout while waiting for DDE response" ; + Text [ english_us ] = "Timeout while waiting for DDE response" ; + Text[ chinese_simplified ] = "µÈºò DDE »ØÓ¦³¬¹ýʱÏÞ"; + Text[ russian ] = "Ïðåâûøåíèå äîïóñòèìîãî âðåìåíè âî âðåìÿ îæèäàíèÿ îòâåòà DDE"; + Text[ polish ] = "Przekroczenie limitu czasu podczas czekania na odpowiedŸ DDE"; + Text[ japanese ] = "DDE‚̉ž“š‘Ò‚¿‚ÌŠÔ‚ÉŽžŠÔ’´‰ß"; + Text[ chinese_traditional ] = "µ¥Ô DDE ¦^À³¶W¹L®É"; + Text[ arabic ] = "DDE Êã ÊÎØí ÇáæÞÊ ÃËäÇÁ ÇäÊÙÇÑ ÇáÑÏ ãä"; + Text[ dutch ] = "Tijdoverschrijding tijdens wachten op DDE-antwoord"; + Text[ chinese_simplified ] = "µÈºò DDE »ØÓ¦³¬¹ýʱÏÞ"; + Text[ greek ] = "ÕðÝñâáóç ÷ñüíïõ êáôÜ ôçí áíáìïíÞ áðÜíôçóçò áðü ôï DDE"; + Text[ korean ] = "DDE ÀÀ´äÀ» ±â´Ù¸®´Â µ¿¾È ŸÀӾƿô"; + Text[ turkish ] = "DDE yanýtýný beklemede zaman aþýmý"; + Text[ language_user1 ] = " "; + }; + String SbERR_DDE_USER_INTERRUPT & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Benutzer dr³ckte ESCAPE wõhrend der DDE-Operation : Benutzer drckte ESCAPE w§hrend der DDE-Operation */ + Text = "Benutzer drückte ESCAPE während der DDE-Operation" ; + Text [ ENGLISH ] = "User pressed Escape during DDE operation" ; + Text [ norwegian ] = "User pressed Escape during DDE operation" ; + Text [ italian ] = "L'utente ha premuto ESC durante l'operazione DDE" ; + Text [ portuguese_brazilian ] = "User pressed Escape during DDE operation" ; + Text [ portuguese ] = "O utilizador premiu ESCAPE durante a operação DDE" ; + Text [ french ] = "L'utilisateur a appuyé sur ÉCHAP pendant l'opération DDE" ; + Text [ dutch ] = "Gebruiker drukte Escape tijdens uitvoering DDE" ; + Text [ spanish ] = "El usuario presionó la tecla ESC durante la operación DDE" ; + Text [ danish ] = "Brugeren trykkede på ESCAPE under DDE-operationen" ; + Text [ swedish ] = "Användaren tryckte på ESCAPE under DDE-operationen" ; + Text [ finnish ] = "User pressed Escape during DDE operation" ; + Text [ english_us ] = "User pressed ESCAPE during DDE operation." ; + Text[ chinese_simplified ] = "ÔÚÖ´ÐÐ DDE ÔËËã¹ý³ÌÖÐʹÓÃÕß°´»÷ÁË ESCAPE ¼ü"; + Text[ russian ] = "Ïîëüçîâàòåëü íàæàë ESCAPE âî âðåìÿ îïåðàöèè DDE"; + Text[ polish ] = "U¿ytkownik u¿y³ przycisku ESCAPE podczas operacji DDE"; + Text[ japanese ] = "DDE‚̵ÍßÚ°¼®Ý‚ÌÅ’†‚É Õ°»Þ°‚ªESCAPEÎÞÀÝ‚ð‰Ÿ‚µ‚Ü‚µ‚½"; + Text[ language_user1 ] = " "; + Text[ chinese_traditional ] = "¦b°õ¦æ DDE ¹Bºâ¹Lµ{¤¤¨Ï¥ÎªÌ«öÀ»¤F ESCAPE Áä"; + Text[ arabic ] = "ÖÛØ ÇáãÓÊÎÏã Úáì ãÝÊÇÍ ÇáåÑæÈ ÃËäÇÁ ÚãáíÉ DDE"; + Text[ dutch ] = "Gebruiker drukte Escape tijdens uitvoering DDE"; + Text[ chinese_simplified ] = "ÔÚÖ´ÐÐ DDE ÔËËã¹ý³ÌÖÐʹÓÃÕß°´»÷ÁË ESCAPE ¼ü"; + Text[ greek ] = "Ï ÷ñÞóôçò ðÜôçóå ESCAPE êáôÜ ôç äéÜñêåéá ôçò ëåéôïõñãßáò DDE."; + Text[ korean ] = "DDE ÀÛµ¿»çÀÌ¿¡ Escape ÀÌ ´·¯Á³À½."; + Text[ turkish ] = "DDE iþlemi sýrasýnda ESCAPE tuþuna basýldý"; + }; + String SbERR_DDE_BUSY & ERRCODE_RES_MASK + { + Text = "Fremdapplikation ist nicht bereit" ; + Text [ ENGLISH ] = "Destination application is busy" ; + Text [ norwegian ] = "Destination application is busy" ; + Text [ italian ] = "L'applicazione esterna non è pronta" ; + Text [ portuguese_brazilian ] = "Destination application is busy" ; + Text [ portuguese ] = "A aplicação externa está ocupada" ; + Text [ french ] = "L'application externe est occupée" ; + Text [ dutch ] = "Doelapplicatie is niet bereid" ; + Text [ spanish ] = "La aplicación externa no está lista" ; + Text [ danish ] = "Den eksterne applikation er ikke klar" ; + Text [ swedish ] = "Extern applikation upptagen" ; + Text [ finnish ] = "Destination application is busy" ; + Text [ english_us ] = "External application busy" ; + Text[ chinese_simplified ] = "ÍⲿӦÓóÌÐòæµ"; + Text[ russian ] = "Âíåøíåå ïðèëîæåíèå íå ãîòîâî"; + Text[ polish ] = "Obca aplikacja nie jest gotowa"; + Text[ japanese ] = "ŠO•”±Ìߨ¹°¼®Ý‚ÍËÞ¼Þ¨ó‘Ô‚Å‚·"; + Text[ chinese_traditional ] = "¥~³¡À³¥Îµ{¦¡¦£¸L"; + Text[ arabic ] = "ÇáÊØÈíÞ ÇáÎÇÑÌí ÛíÑ ÌÇåÒ"; + Text[ dutch ] = "Doelapplicatie is niet bereid"; + Text[ chinese_simplified ] = "ÍⲿӦÓóÌÐòæµ"; + Text[ greek ] = "Ç åîùôåñéêÞ åöáñìïãÞ äåí åßíáé Ýôïéìç."; + Text[ korean ] = "³»ºÎ ÀÀ¿ëÇÁ·Î±×·¥ÀÌ Áغñ°¡ ¾ÈµÇ¾ú½À´Ï´Ù."; + Text[ turkish ] = "Harici uygulama hazýr deðil"; + Text[ language_user1 ] = " "; + }; + String SbERR_DDE_NO_DATA & ERRCODE_RES_MASK + { + Text = "DDE-Operation ohne Daten" ; + Text [ ENGLISH ] = "Data not provided in DDE operation" ; + Text [ norwegian ] = "Data not provided in DDE operation" ; + Text [ italian ] = "Operazione DDE senza dati" ; + Text [ portuguese_brazilian ] = "Data not provided in DDE operation" ; + Text [ portuguese ] = "A operação DDE não tem dados" ; + Text [ french ] = "Données non fournies dans l'opération DDE" ; + Text [ dutch ] = "DDE-operatie zonder gegevens" ; + Text [ spanish ] = "Operación DDE sin datos" ; + Text [ danish ] = "DDE-operation uden data" ; + Text [ swedish ] = "DDE-operation utan data" ; + Text [ finnish ] = "Data not provided in DDE operation" ; + Text [ english_us ] = "DDE operation without data" ; + Text[ chinese_simplified ] = "ûÓÐÊý¾ÝµÄ DDE ÔËËã"; + Text[ russian ] = "Îïåðàöèÿ DDE áåç äàííûõ"; + Text[ polish ] = "Operacja DDE bez danych"; + Text[ japanese ] = "ÃÞ°À‚È‚µ‚ÌDDEµÍßÚ°¼®Ý"; + Text[ chinese_traditional ] = "¨S¦³¸ê®Æªº DDE ¹Bºâ"; + Text[ arabic ] = "ÈÏæä ÈíÇäÇÊ DDE ÚãáíÉ"; + Text[ dutch ] = "DDE-operatie zonder gegevens"; + Text[ chinese_simplified ] = "ûÓÐÊý¾ÝµÄ DDE ÔËËã"; + Text[ greek ] = "Ëåéôïõñãßá DDE ÷ùñßò äåäïìÝíá"; + Text[ korean ] = "µ¥ÀÌÅÍ ¾ø´Â DDE ÀÛµ¿"; + Text[ turkish ] = "Verisiz DDE iþlemi"; + Text[ language_user1 ] = " "; + }; + String SbERR_DDE_WRONG_DATA_FORMAT & ERRCODE_RES_MASK + { + Text = "Daten sind im falschen Format" ; + Text [ ENGLISH ] = "Data in wrong format" ; + Text [ norwegian ] = "Data in wrong format" ; + Text [ italian ] = "I dati hanno un formato errato" ; + Text [ portuguese_brazilian ] = "Data in wrong format" ; + Text [ portuguese ] = "Formato dos dados incorrecto" ; + Text [ french ] = "Le format des données est incorrect" ; + Text [ dutch ] = "Gegevens hebben foutief formaat" ; + Text [ spanish ] = "Los datos están en un formato falso" ; + Text [ danish ] = "Data er i forkert format" ; + Text [ swedish ] = "Data har fel format" ; + Text [ finnish ] = "Data in wrong format" ; + Text [ english_us ] = "Data are in wrong format" ; + Text[ chinese_simplified ] = "Êý¾Ý¸ñʽ´íÎó"; + Text[ russian ] = "Äàííûå íàõîäÿòñÿ â íåïðàâèëüíîì ôîðìàòå"; + Text[ polish ] = "Pliki s¹ Ÿle sformatowane"; + Text[ japanese ] = "ÃÞ°À‚Í‘Ž®‚ª³‚µ‚‚ ‚è‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "¸ê®Æ®æ¦¡¿ù»~"; + Text[ arabic ] = "ÊäÓíÞ ÇáÈíÇäÇÊ ÛíÑ ÕÍíÍ"; + Text[ dutch ] = "Gegevens hebben foutief formaat"; + Text[ chinese_simplified ] = "Êý¾Ý¸ñʽ´íÎó"; + Text[ greek ] = "ËÜèïò ìïñöÞ äåäïìÝíùí"; + Text[ korean ] = "À߸øµÈ Æ÷¸ËÀÇ µ¥ÀÌÅÍ"; + Text[ turkish ] = "Verilerin formatý yanlýþ"; + Text[ language_user1 ] = " "; + }; + String SbERR_DDE_PARTNER_QUIT & ERRCODE_RES_MASK + { + Text = "Fremdapplikation ist beendet worden" ; + Text [ ENGLISH ] = "Foreign application quit" ; + Text [ norwegian ] = "Foreign application quit" ; + Text [ italian ] = "L'applicazione esterna è terminata" ; + Text [ portuguese_brazilian ] = "Foreign application quit" ; + Text [ portuguese ] = "Cancelada a aplicação externa" ; + Text [ french ] = "L'application externe a été quittée" ; + Text [ dutch ] = "Externe applicatie werd beëindigd" ; + Text [ spanish ] = "La aplicación externa se ha cancelado" ; + Text [ danish ] = "Den eksterne applikation er blevet afsluttet" ; + Text [ swedish ] = "Den externa applikationen är avslutad" ; + Text [ finnish ] = "Foreign application quit" ; + Text [ english_us ] = "External application has been terminated" ; + Text[ chinese_simplified ] = "ÍⲿӦÓóÌÐòÒѾ½áÊø"; + Text[ russian ] = "Âíåøíèå ïðèëîæåíèÿ çàêîí÷åíû"; + Text[ polish ] = "Obca aplikacja zosta³a zakoñczona"; + Text[ japanese ] = "ŠO•”±Ìߨ¹°¼®Ý‚ÍI—¹‚µ‚Ä‚¢‚Ü‚·"; + Text[ chinese_traditional ] = "¥~³¡À³¥Îµ{¦¡¤w¸gµ²§ô"; + Text[ arabic ] = "Êã ÅäåÇÁ ÇáÊØÈíÞ ÇáÎÇÑÌí"; + Text[ dutch ] = "Externe applicatie werd beëindigd"; + Text[ chinese_simplified ] = "ÍⲿӦÓóÌÐòÒѾ½áÊø"; + Text[ greek ] = "Ç åîùôåñéêÞ åöáñìïãÞ ôåñìáôßóôçêå."; + Text[ korean ] = "¿ÜºÎ ÀÀ¿ëÇÁ·Î±×·¥ÀÌ Á¦°ÅµÇ¾ú½À´Ï´Ù."; + Text[ turkish ] = "Harici uygulamadan çýkýldý"; + Text[ language_user1 ] = " "; + }; + String SbERR_DDE_CONV_CLOSED & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? DDE-Verbindung ist unterbrochen oder geõndert worden : DDE-Verbindung ist unterbrochen oder ge§ndert worden */ + Text = "DDE-Verbindung ist unterbrochen oder geändert worden" ; + Text [ ENGLISH ] = "DDE conversation closed or changed" ; + Text [ norwegian ] = "DDE conversation closed or changed" ; + Text [ italian ] = "Collegamento DEE interrotto o modificato" ; + Text [ portuguese_brazilian ] = "DDE conversation closed or changed" ; + Text [ portuguese ] = "A ligação DDE foi interrompida ou modificada" ; + Text [ french ] = "La connexion DDE a été interrompue ou modifiée" ; + Text [ dutch ] = "DDE-verbinding verbroken of veranderd" ; + Text [ spanish ] = "La conexión DDE se ha interrumpido o modificado" ; + Text [ danish ] = "DDE-forbindelsen er blevet afbrudt eller modificeret" ; + Text [ swedish ] = "DDE-förbindelsen är avbruten eller förändrad" ; + Text [ finnish ] = "DDE conversation closed or changed" ; + Text [ english_us ] = "DDE connection interrupted or modified" ; + Text[ chinese_simplified ] = "DDEÁ¬½ÓÒѾÖжϻòÕßÒѾ¸ü¸Ä"; + Text[ russian ] = "Ñîåäèíåíèå DDE ïðåðâàíî èëè èçìåíåíî"; + Text[ polish ] = "Po³¹czenie DDE zosta³o przerwane lub zmodyfikowane."; + Text[ japanese ] = "DDEÚ‘±‚ª’†’f‚µ‚½‚©‚Ü‚½‚Í•ÏX‚³‚ê‚Ä‚¢‚Ü‚·"; + Text[ chinese_traditional ] = "DDE³sµ²¤w¸g¤¤Â_©ÎªÌ¤w¸gÅܧó"; + Text[ arabic ] = "DDE Êã ãÞÇØÚÉ Ãæ ÊÛííÑ ÇÊÕÇá"; + Text[ dutch ] = "DDE-verbinding verbroken of veranderd"; + Text[ chinese_simplified ] = "DDEÁ¬½ÓÒѾÖжϻòÕßÒѾ¸ü¸Ä"; + Text[ greek ] = "Ç óýíäåóç DDE äéáêüðçêå Þ Üëëáîå"; + Text[ korean ] = "DDE Á¢¼ÓÀÌ ÀÎÅÍ·´Æ®µÇ°Å³ª ¼öÁ¤µÇ¾ú½À´Ï´Ù."; + Text[ turkish ] = "DDE baðlantýsý kesildi ya da deðiþtirildi"; + Text[ language_user1 ] = " "; + }; + String SbERR_DDE_NO_CHANNEL & ERRCODE_RES_MASK + { + Text = "DDE-Methode ohne offenen DDE-Kanal gerufen" ; + Text [ ENGLISH ] = "DDE method invoked with no channel open" ; + Text [ norwegian ] = "DDE method invoked with no channel open" ; + Text [ italian ] = "Metodo DDE richiamato senza canale DDE aperto" ; + Text [ portuguese_brazilian ] = "DDE method invoked with no channel open" ; + Text [ portuguese ] = "Método DDE foi chamado sem canal aberto" ; + Text [ french ] = "Méthode DDE appelée sans avoir ouvert un canal DDE" ; + Text [ dutch ] = "DDE-methode zonder open kanaal opgeroepen" ; + Text [ spanish ] = "Se llamó al método DDE sin un canal DDE abierto" ; + Text [ danish ] = "DDE-metode blev kaldt uden åben DDE-kanal" ; + Text [ swedish ] = "DDE-metod anropad utan öppen DDE-kanal" ; + Text [ finnish ] = "DDE method invoked with no channel open" ; + Text [ english_us ] = "DDE method invoked with no channel open" ; + Text[ chinese_simplified ] = "ÔÚûÓдò¿ªDDEÐŵÀʱµ÷ÓÃDDE·½·¨"; + Text[ russian ] = "Ìåòîä DDE âûçâàí áåç îòêðûòîãî êàíàëà DDE"; + Text[ polish ] = "Metoda DDE wywo³ana bez otwartego kana³u DDE"; + Text[ japanese ] = "DDEÁ¬ÝÈÙ‚ªŠJ‚©‚ê‚Ä‚¢‚È‚¢ó‘Ô‚ÅDDEÒ¿¯ÄÞ‚ªŒÄ‚Ño‚³‚ê‚Ä‚¢‚Ü‚·"; + Text[ chinese_traditional ] = "¦b¨S¦³¶}±ÒDDE«H¹D®É½Õ¥ÎDDE ¤èªk"; + Text[ arabic ] = "DDE ÈÏæä ÝÊÍ ÞäÇÉ DDE Êã ÇÓÊÏÚÇÁ ÃÓáæÈ"; + Text[ dutch ] = "DDE-methode zonder open kanaal opgeroepen"; + Text[ chinese_simplified ] = "ÔÚûÓдò¿ªDDEÐŵÀʱµ÷ÓÃDDE·½·¨"; + Text[ greek ] = "ÌÝèïäïò DDE êëÞèçêå ÷ùñßò áíïé÷ôü êáíÜëé DDE"; + Text[ korean ] = "DDE ä³ÎÀ» ¿Áö¾Ê°í DDE ¸Þ¼Òµå¸¦ È£Ãâ"; + Text[ turkish ] = "Açýk DDE kanalý olmadan DDE yöntemi çaðrýsý"; + Text[ language_user1 ] = " "; + }; + String SbERR_DDE_INVALID_LINK & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Ung³ltiges DDE-Linkformat : Ungltiges DDE-Linkformat */ + Text = "Ungültiges DDE-Linkformat" ; + Text [ ENGLISH ] = "Invalid DDE Link format" ; + Text [ norwegian ] = "Invalid DDE Link format" ; + Text [ italian ] = "Formato link DDE non valido" ; + Text [ portuguese_brazilian ] = "Invalid DDE Link format" ; + Text [ portuguese ] = "Formato de ligação DDE não válido" ; + Text [ french ] = "Format de lien DDE incorrect" ; + Text [ dutch ] = "Foutief DDE-link-formaat" ; + Text [ spanish ] = "Formato del vínculo DDE incorrecto" ; + Text [ danish ] = "Ugyldigt DDE-linkformat" ; + Text [ swedish ] = "Ogiltigt DDE- linkformat" ; + Text [ finnish ] = "Invalid DDE Link format" ; + Text [ english_us ] = "Invalid DDE link format" ; + Text[ chinese_simplified ] = "ÎÞЧµÄ DDE Á´½Ó¸ñʽ"; + Text[ russian ] = "Íåäåéñòâèòåëüíûé ôîðìàò ñâÿçè DDE"; + Text[ polish ] = "Nieprawid³owy format ³¹cza DDE"; + Text[ japanese ] = "–³Œø‚È DDE ØÝ¸‘Ž®"; + Text[ chinese_traditional ] = "µL®ÄªºDDE³sµ²®æ¦¡"; + Text[ arabic ] = "ÛíÑ ÕÇáÍ DDE ÊäÓíÞ ÇÑÊÈÇØ"; + Text[ dutch ] = "Foutief DDE-link-formaat"; + Text[ chinese_simplified ] = "ÎÞЧµÄ DDE Á´½Ó¸ñʽ"; + Text[ greek ] = "Ìç Ýãêõñç ìïñöÞ óýíäåóçò DDE"; + Text[ korean ] = "À¯È¿ÇÏÁö ¾ÊÀº DDE ¿¬°á ¼½Ä"; + Text[ turkish ] = "Geçersiz DDE baðlantý formatý"; + Text[ language_user1 ] = " "; + }; + String SbERR_DDE_QUEUE_OVERFLOW & ERRCODE_RES_MASK + { + Text = "DDE-Message ist verlorengegangen" ; + Text [ ENGLISH ] = "Message queue filled; DDE Message lost" ; + Text [ norwegian ] = "Message queue filled; DDE Message lost" ; + Text [ italian ] = "Il messaggio DDE è andato perduto" ; + Text [ portuguese_brazilian ] = "Message queue filled; DDE Message lost" ; + Text [ portuguese ] = "A mensagem DDE perdeu-se" ; + Text [ french ] = "Le message DDE a été perdu" ; + Text [ dutch ] = "DDE-message verloren gegaan" ; + Text [ spanish ] = "El mensaje DDE se ha perdido" ; + Text [ danish ] = "DDE-meddelelse er gået tabt" ; + Text [ swedish ] = "DDE-meddelandet är borttappat" ; + Text [ finnish ] = "Message queue filled; DDE Message lost" ; + Text [ english_us ] = "DDE message has been lost" ; + Text[ chinese_simplified ] = "DDE ÐÅÏ¢ÒÅʧ"; + Text[ russian ] = "Ñîîáùåíèå DDE ïîòåðÿíî"; + Text[ polish ] = "Wiadomoœæ DDE zaginê³a"; + Text[ japanese ] = "DDEÒ¯¾°¼Þ‚ÍŽ¸‚í‚ê‚Ü‚µ‚½"; + Text[ chinese_traditional ] = "DDE°T®§¿ò¥¢"; + Text[ arabic ] = "DDE Êã ÝÞÏÇä ÑÓÇáÉ"; + Text[ dutch ] = "DDE-message verloren gegaan"; + Text[ chinese_simplified ] = "DDE ÐÅÏ¢ÒÅʧ"; + Text[ greek ] = "Ôï ìÞíõìá ôïõ DDE ÷Üèçêå"; + Text[ korean ] = "DDE ¸Þ¼¼Áö°¡ »ç¶óÁ³À½"; + Text[ turkish ] = "DDE iletisi kayboldu"; + Text[ language_user1 ] = " "; + }; + String SbERR_DDE_LINK_ALREADY_EST & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Paste Link bereits durchgef³hrt : Paste Link bereits durchgefhrt */ + Text = "Paste Link bereits durchgeführt" ; + Text [ ENGLISH ] = "Paste link already performed" ; + Text [ norwegian ] = "Paste link already performed" ; + Text [ italian ] = "Paste link già eseguito" ; + Text [ portuguese_brazilian ] = "Paste link already performed" ; + Text [ portuguese ] = "\"Paste link\" já executado" ; + Text [ french ] = "Le paste link a déjà été exécuté" ; + Text [ dutch ] = "Paste link reeds uitgevoerd" ; + Text [ spanish ] = "Pegar vínculo ya ejecutado" ; + Text [ danish ] = "Paste link er allerede udført" ; + Text [ swedish ] = "Paste link är redan genomfört" ; + Text [ finnish ] = "Paste link already performed" ; + Text [ english_us ] = "Paste link already performed" ; + Text[ chinese_simplified ] = "Õ³ÌùÁ´½ÓÒѾÍê³É"; + Text[ russian ] = "Âñòàâêà ññûëêè óæå âûïîëíåíà"; + Text[ polish ] = "Polecenie Wklej ³¹cze zosta³o ju¿ wykonane"; + Text[ japanese ] = "ØÝ¸‚Ì“\\‚è•t‚¯‚Í‚·‚łɎÀs‚³‚ê‚Ä‚¢‚Ü‚·"; + Text[ language_user1 ] = " "; + Text[ chinese_traditional ] = "Öß¶K³sµ²¤w¸g§¹¦¨"; + Text[ arabic ] = "ãÓÈÞÇð Paste link Êã ÃÏÇÁ "; + Text[ dutch ] = "Paste link reeds uitgevoerd"; + Text[ chinese_simplified ] = "Õ³ÌùÁ´½ÓÒѾÍê³É"; + Text[ greek ] = "Ôï 'Paste link' åêôåëÝóôçêå Þäç"; + Text[ korean ] = "¿¬°á ºÙ¿©³Ö±â´Â ÀÌ¹Ì ¼öÇàµÇ¾ú½À´Ï´Ù."; + Text[ turkish ] = "Paste Link iþlemi yürütüldü"; + }; + String SbERR_DDE_LINK_INV_TOPIC & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? LinkMode kann wegen ung³ltigen Link-Topics nicht gesetzt werden : LinkMode kann wegen ungltigen Link-Topics nicht gesetzt werden */ + Text = "LinkMode kann wegen ungültigen Link-Topics nicht gesetzt werden" ; + Text [ ENGLISH ] = "Cant set LinkMode; invalid Link Topic" ; + Text [ norwegian ] = "Cant set LinkMode; invalid Link Topic" ; + Text [ italian ] = "Link topic non valido; impossibile impostare il modo link" ; + Text [ portuguese_brazilian ] = "Cant set LinkMode; invalid Link Topic" ; + Text [ portuguese ] = "Impossível configurar o LinkMode devido a LinkTopic não válido" ; + Text [ french ] = "Impossible de définir le LinkMode à cause d'un Link-Topic incorrect" ; + Text [ dutch ] = "Ongeldig Link Topic; LinkMode kan niet worden gezet" ; + Text [ spanish ] = "No se puede establecer el LinkMode debido a un Link Topic incorrecto" ; + Text [ danish ] = "Linktilstand kan ikke indstilles på grund af ugyldige linktopics." ; + Text [ swedish ] = "LinkMode kan inte ställas in på grund av ogiltiga Link-Topics" ; + Text [ finnish ] = "Cant set LinkMode; invalid Link Topic" ; + Text [ english_us ] = "Link mode cannot be set due to invalid link topic" ; + Text[ chinese_simplified ] = "ÓÉÓÚÎÞЧµÄÁ´½Ó±êÌâ¶øÎÞ·¨É趨Á´½Ó±êÌâ"; + Text[ russian ] = "Èç-çà íåäåéñòâèòåëüíîãî Link-Topic LinkMode óñòàíîâèòü íåâîçìîæíî"; + Text[ polish ] = "Nie mo¿na skonfigurowaæ LinkMode z powodu niewa¿nych Link-Topics"; + Text[ japanese ] = "ØÝ¸ Ó°ÄÞ‚ÍØÝ¸ ÄË߯¸‚ª–³Œø‚Å‚ ‚邽‚ßAÝ’è‚Å‚«‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "¦]¬°µL®Äªº±¶®|¼ÐÃD¦ÓµLªk³]©w±¶®|¼ÐÃD"; + Text[ arabic ] = "ÛíÑ ÕÇáÍÉ Link-Topics áÃä LinkMode áÇ íãßä ÊÚííä"; + Text[ dutch ] = "Ongeldig Link Topic; LinkMode kan niet worden gezet"; + Text[ chinese_simplified ] = "ÓÉÓÚÎÞЧµÄÁ´½Ó±êÌâ¶øÎÞ·¨É趨Á´½Ó±êÌâ"; + Text[ greek ] = "Äåí åßíáé äõíáôüí íá ïñéóôåß ôï LinkMode åîáéôßáò ìç Ýãêõñùí Link-Topics."; + Text[ korean ] = "À¯È¿ÇÏÁö ¾ÊÀº ¿¬°á ÅäÇÈÀ¸·Î ÀÎÇÏ¿© ¿¬°á À¯ÇüÀÌ ¼³Á¤µÉ¼ö ¾ø½À´Ï´Ù."; + Text[ turkish ] = "LinkMode, geçersiz Link-Topics nedeniyle belirlenemez"; + Text[ language_user1 ] = " "; + }; + String SbERR_DDE_DLL_NOT_FOUND & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? F³r DDE wird DDEML.DLL ben÷tigt : Fr DDE wird DDEML.DLL ben”tigt */ + Text = "Für DDE wird DDEML.DLL benötigt" ; + Text [ ENGLISH ] = "DDE requires DDEML.DLL" ; + Text [ norwegian ] = "DDE requires DDEML.DLL" ; + Text [ italian ] = "DDE necessita del DDEML.DLL" ; + Text [ portuguese_brazilian ] = "DDE requires DDEML.DLL" ; + Text [ portuguese ] = "DDE requere DDEML.DLL" ; + Text [ french ] = "Le DDE requiert DDEML.DLL" ; + Text [ dutch ] = "DDE benodigt DDEML.DLL" ; + Text [ spanish ] = "Para el DDE se requiere DDEML.DLL" ; + Text [ danish ] = "DDE kræver DDEML.DLL" ; + Text [ swedish ] = "DDE kräver DDEML.DLL" ; + Text [ finnish ] = "DDE requires DDEML.DLL" ; + Text [ english_us ] = "DDE requires the DDEML.DLL file" ; + Text[ chinese_simplified ] = "DDE ÒªÇó DDEML.DLL"; + Text[ russian ] = "Äëÿ DDE íåîáõîäèì DDEML.DLL"; + Text[ polish ] = "Dla DDE jest wymagane DDEML.DLL"; + Text[ japanese ] = "DDE‚Ì‚½‚ß‚ÉDDEML.DLL‚ª•K—v‚Å‚·"; + Text[ chinese_traditional ] = "DDEn¨DDDEML.DLL"; + Text[ arabic ] = "DDEML.DLL íÍÊÇÌ Åáì ãáÝ DDE"; + Text[ dutch ] = "DDE benodigt DDEML.DLL"; + Text[ chinese_simplified ] = "DDE ÒªÇó DDEML.DLL"; + Text[ greek ] = "Ãéá ôï DDE áðáéôåßôáé ôï áñ÷åßï DDEML.DLL"; + Text[ korean ] = "DDE ´Â DDEML.DLL ÆÄÀÏÀ» ÇÊ¿ä·ÎÇÕ´Ï´Ù."; + Text[ turkish ] = "DDE için DDEML.DLL gerekli"; + Text[ language_user1 ] = " "; + }; + String SbERR_CANNOT_LOAD & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Das Modul kann nicht geladen werden, ung³ltiges Format : Das Modul kann nicht geladen werden, ungltiges Format */ + Text = "Das Modul kann nicht geladen werden, ungültiges Format" ; + Text [ ENGLISH ] = "Can't load module, invalid format" ; + Text [ norwegian ] = "Can't load module, invalid format" ; + Text [ italian ] = "Formato non valido; impossibile caricare il modulo" ; + Text [ portuguese_brazilian ] = "Can't load module, invalid format" ; + Text [ portuguese ] = "Impossível carregar módulo; formato não válido" ; + Text [ french ] = "Impossible de charger le module à cause d'une erreur de format" ; + Text [ dutch ] = "De module kan niet worden geladen, ongeldig formaat" ; + Text [ spanish ] = "No se puede cargar el módulo ya que el formato es incorrecto" ; + Text [ danish ] = "Det er ikke muligt at indlæse modulet; ugyldigt format" ; + Text [ swedish ] = "Modulen kan inte laddas, ogiltigt format" ; + Text [ finnish ] = "Can't load module, invalid format" ; + Text [ english_us ] = "Module cannot be loaded; invalid format" ; + Text[ chinese_simplified ] = "¸ñʽÎÞЧ£¬Òò¶øÎÞ·¨×°ÔØÄ£¿é"; + Text[ russian ] = "Çàãðóçèòü ìîäóëü íåâîçìîæíî, íåäåéñòâèòåëüíûé ôîðìàò"; + Text[ polish ] = "Modu³u nie mo¿na za³adowaæ, nieprawid³owy format"; + Text[ japanese ] = "Ó¼Þ°Ù‚ª“ǂݞ‚߂܂¹‚ñB–³Œø‚È‘Ž®‚Å‚·B"; + Text[ chinese_traditional ] = "®æ¦¡µL®Ä¡M¦]¦ÓµLªk¸Ë¸ü¼Ò¶ô"; + Text[ arabic ] = "áÇ íãßä ÊÍãíá ÇáæÍÏÉ ÇáäãØíÉ º ÊäÓíÞ ÛíÑ ÕÇáÍ"; + Text[ dutch ] = "De module kan niet worden geladen, ongeldig formaat"; + Text[ chinese_simplified ] = "¸ñʽÎÞЧ£¬Òò¶øÎÞ·¨×°ÔØÄ£¿é"; + Text[ greek ] = "Äåí Þôáí äõíáôüí íá öïñôùèåß ç ëåéôïõñãéêÞ ìïíÜäá, ìç Ýãêõñç ìïñöÞ"; + Text[ korean ] = "¸ðµâÀÌ ·ÎµåµÇÁö ¾Ê¾Ò½À´Ï´Ù. ; À߸øµÈ Æ÷¸Ë"; + Text[ turkish ] = "Modül yüklenemiyor; geçersiz format"; + Text[ language_user1 ] = " "; + }; + String SbERR_BAD_INDEX & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Ung³ltiger Objektindex : Ungltiger Objektindex */ + Text = "Ungültiger Objektindex" ; + Text [ ENGLISH ] = "Invalid object index" ; + Text [ norwegian ] = "Invalid object index" ; + Text [ italian ] = "Indice di oggetto non valido" ; + Text [ portuguese_brazilian ] = "Invalid object index" ; + Text [ portuguese ] = "Índice de objectos não válido" ; + Text [ french ] = "Index d'objets incorrect" ; + Text [ dutch ] = "Ongeldige objectindex" ; + Text [ spanish ] = "Índice incorrecto del objeto" ; + Text [ danish ] = "Ugyldigt objektindeks" ; + Text [ swedish ] = "Ogiltigt objektindex" ; + Text [ finnish ] = "Invalid object index" ; + Text [ english_us ] = "Invalid object index" ; + Text[ chinese_simplified ] = "ÎÞЧµÄ¶ÔÏóË÷Òý"; + Text[ russian ] = "Íåäåéñòâèòåëüíûé èíäåêñ îáúåêòà"; + Text[ polish ] = "Nieprawid³owy indeks obiektów"; + Text[ japanese ] = "–³Œø‚ȵÌÞ¼Þª¸Ä ²ÝÃÞ¯¸½"; + Text[ chinese_traditional ] = "µL®Äªºª«¥ó¯Á¤Þ"; + Text[ arabic ] = "ÝåÑÓ ßÇÆä ÛíÑ ÕÇáÍ"; + Text[ dutch ] = "Ongeldige objectindex"; + Text[ chinese_simplified ] = "ÎÞЧµÄ¶ÔÏóË÷Òý"; + Text[ greek ] = "Ìç Ýãêõñï åõñåôÞñéï áíôéêåéìÝíùí"; + Text[ korean ] = "À¯È¿ÇÏÁö ¾ÊÀº °³Ã¼ À妽º"; + Text[ turkish ] = "Geçersiz nesne dizini"; + Text[ language_user1 ] = " "; + }; + String SbERR_NO_ACTIVE_OBJECT & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Objekt ist nicht verf³gbar : Objekt ist nicht verfgbar */ + Text = "Objekt ist nicht verfügbar" ; + Text [ ENGLISH ] = "Object is not available" ; + Text [ norwegian ] = "Object is not available" ; + Text [ italian ] = "Oggetto non disponibile" ; + Text [ portuguese_brazilian ] = "Object is not available" ; + Text [ portuguese ] = "Objecto não disponível" ; + Text [ french ] = "L'objet n'est pas disponible" ; + Text [ dutch ] = "Object niet beschikbaar" ; + Text [ spanish ] = "El objeto no está disponible" ; + Text [ danish ] = "Objektet er ikke tilgængeligt" ; + Text [ swedish ] = "Objektet är inte tillgängligt" ; + Text [ finnish ] = "Object is not available" ; + Text [ english_us ] = "Object is not available" ; + Text[ chinese_simplified ] = "¶ÔÏó²»´æÔÚ"; + Text[ russian ] = "Îáúåêò íåäîñòóïåí"; + Text[ polish ] = "Obiekt jest niedostêpny"; + Text[ japanese ] = "µÌÞ¼Þª¸Ä‚ª‚ ‚è‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "ª«¥ó¤£¦s¦b"; + Text[ arabic ] = "ÇáßÇÆä ÛíÑ ãÊÇÍ"; + Text[ dutch ] = "Object niet beschikbaar"; + Text[ chinese_simplified ] = "¶ÔÏó²»´æÔÚ"; + Text[ greek ] = "Ôï áíôéêåßìåíï äåí åßíáé äéáèÝóéìï"; + Text[ korean ] = "°³Ã¼°¡ À¯È¿ÇÏÁö ¾È½À´Ï´Ù."; + Text[ turkish ] = "Nesne mevcut deðil"; + Text[ language_user1 ] = " "; + }; + String SbERR_BAD_PROP_VALUE & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Falscher Wert f³r Eigenschaft : Falscher Wert fr Eigenschaft */ + Text = "Falscher Wert für Eigenschaft" ; + Text [ ENGLISH ] = "Bad property value" ; + Text [ norwegian ] = "Bad property value" ; + Text [ italian ] = "Valore per la proprietà errato" ; + Text [ portuguese_brazilian ] = "Bad property value" ; + Text [ portuguese ] = "Valor de propriedade incorrecto" ; + Text [ french ] = "Valeur de propriété incorrecte" ; + Text [ dutch ] = "Foutieve waarde voor eigenschap" ; + Text [ spanish ] = "Valor no válido para la propiedad" ; + Text [ danish ] = "Forkert egenskabsværdi" ; + Text [ swedish ] = "Felaktigt värde för egenskap" ; + Text [ finnish ] = "Bad property value" ; + Text [ english_us ] = "Incorrect property value" ; + Text[ chinese_simplified ] = "´íÎóµÄÊôÐÔÊýÖµ"; + Text[ russian ] = "Íåïðàâèëüíîå çíà÷åíèå ñâîéñòâà"; + Text[ polish ] = "Niepoprawna wartoœæ w³aœciwoœci"; + Text[ japanese ] = "ÌßÛÊßè’l‚ª³‚µ‚‚ ‚è‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "¿ù»~ªºÄݩʼÆÈ"; + Text[ arabic ] = "ÞíãÉ ÛíÑ ÕÍíÍÉ ááÎÇÕíÉ"; + Text[ dutch ] = "Foutieve waarde voor eigenschap"; + Text[ chinese_simplified ] = "´íÎóµÄÊôÐÔÊýÖµ"; + Text[ greek ] = "Ìç Ýãêõñç ôéìÞ ãéá éäéüôçôá"; + Text[ korean ] = "À߸øµÈ ÇÁ·ÎÆÛƼ °ª"; + Text[ turkish ] = "Yanlýþ özellik deðeri"; + Text[ language_user1 ] = " "; + }; + String SbERR_PROP_READONLY & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Eigenschaft ist schreibgesch³tzt : Eigenschaft ist schreibgeschtzt */ + Text = "Eigenschaft ist schreibgeschützt" ; + Text [ ENGLISH ] = "Property is read only" ; + Text [ norwegian ] = "Property is read only" ; + Text [ italian ] = "La proprietà è a sola lettura" ; + Text [ portuguese_brazilian ] = "Property is read only" ; + Text [ portuguese ] = "A propriedade é só leitura" ; + Text [ french ] = "La propriété est en lecture seule" ; + Text [ dutch ] = "Eigenschap is schrijfbeveiligd" ; + Text [ spanish ] = "Propiedad es solo lectura" ; + Text [ danish ] = "Egenskaben er skrivebeskyttet" ; + Text [ swedish ] = "Egenskapen är skrivskyddad" ; + Text [ finnish ] = "Property is read only" ; + Text [ english_us ] = "This property is read only" ; + Text[ chinese_simplified ] = "·À¸²Ð´µÄÊôÐÔ"; + Text[ russian ] = "Ñâîéñòâî âîçìîæíî òîëüêî ïðî÷èòàòü"; + Text[ polish ] = "W³aœciwoœæ tylko do odczytu"; + Text[ japanese ] = "ÌßÛÊßè‚Í‘‚«ž‚ݕی삳‚ê‚Ä‚¢‚Ü‚·"; + Text[ chinese_traditional ] = "°ßŪªºÄÝ©Ê"; + Text[ arabic ] = "åÐå ÇáÎÇÕíÉ ãÍãíÉ ÖÏ ÇáßÊÇÈÉ"; + Text[ dutch ] = "Eigenschap is schrijfbeveiligd"; + Text[ chinese_simplified ] = "·À¸²Ð´µÄÊôÐÔ"; + Text[ greek ] = "Ç éäéüôçôá åßíáé ìüíï ãéá áíÜãíùóç"; + Text[ korean ] = "ÀÌ ÇÁ·ÎÆÛƼ´Â Àбâ Àü¿ëÀÔ´Ï´Ù."; + Text[ turkish ] = "Özellik yazma korumalý"; + Text[ language_user1 ] = " "; + }; + String SbERR_PROP_WRITEONLY & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Eigenschaft ist lesegesch³tzt : Eigenschaft ist lesegeschtzt */ + Text = "Eigenschaft ist lesegeschützt" ; + Text [ ENGLISH ] = "Property is write only" ; + Text [ norwegian ] = "Property is write only" ; + Text [ italian ] = "La proprietà è a sola scrittura" ; + Text [ portuguese_brazilian ] = "Property is write only" ; + Text [ portuguese ] = "A propriedade é só escrita" ; + Text [ french ] = "La propriété est en écriture seule" ; + Text [ dutch ] = "Eigenschap is leesbeveiligd" ; + Text [ spanish ] = "Propiedad es solo escritura" ; + Text [ danish ] = "Egenskaben er læsebeskyttet" ; + Text [ swedish ] = "Egenskapen är lässkyddad" ; + Text [ finnish ] = "Property is write only" ; + Text [ english_us ] = "This property is write only" ; + Text[ chinese_simplified ] = "·À¶ÁÈ¡µÄÊôÐÔ"; + Text[ russian ] = "Ñâîéñòâî âîçìîæíî òîëüêî çàïèñàòü"; + Text[ polish ] = "W³aœciwoœæ tylko do zapisu"; + Text[ japanese ] = "ÌßÛÊßè‚͓ǂݎæ‚è•ی삳‚ê‚Ä‚¢‚Ü‚·"; + Text[ chinese_traditional ] = "¨¾Åª¨úªºÄÝ©Ê"; + Text[ arabic ] = "åÐå ÇáÎÇÕíÉ ãÍãíÉ ÖÏ ÇáÞÑÇÁÉ"; + Text[ dutch ] = "Eigenschap is leesbeveiligd"; + Text[ chinese_simplified ] = "·À¶ÁÈ¡µÄÊôÐÔ"; + Text[ greek ] = "Ç éäéüôçôá åßíáé ìüíï ãéá åããñáöÞ"; + Text[ korean ] = "ÀÌ ÇÁ·ÎÆÛƼ´Â ¾²±â Àü¿ëÀÔ´Ï´Ù."; + Text[ turkish ] = "Özellik okuma korumalý"; + Text[ language_user1 ] = " "; + }; + String SbERR_INVALID_OBJECT & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Ung³ltige Objektreferenz : Ungltige Objektreferenz */ + Text = "Ungültige Objektreferenz" ; + Text [ ENGLISH ] = "Invalid object reference" ; + Text [ norwegian ] = "Invalid object reference" ; + Text [ italian ] = "Riferimento ad oggetto non valido" ; + Text [ portuguese_brazilian ] = "Invalid object reference" ; + Text [ portuguese ] = "Referência do objecto não-válida" ; + Text [ french ] = "Référence d'objet incorrecte" ; + Text [ dutch ] = "Ongeldige objectverwijzing" ; + Text [ spanish ] = "Referencia al objeto no válida" ; + Text [ danish ] = "Ugyldig objektreference" ; + Text [ swedish ] = "Ogiltig objektreferens" ; + Text [ finnish ] = "Invalid object reference" ; + Text [ english_us ] = "Invalid object reference" ; + Text[ chinese_simplified ] = "ÎÞЧµÄ¶ÔÏóÒýÓÃ"; + Text[ russian ] = "Íåïðàâèëüíàÿ ññûëêà îáúåêòà"; + Text[ polish ] = "Niewa¿ne odwo³anie obiektu"; + Text[ japanese ] = "–³Œø‚ȵÌÞ¼Þª¸ÄŽQÆ"; + Text[ chinese_traditional ] = "µL®Äªºª«¥ó°Ñ·Ó"; + Text[ arabic ] = "ãÑÌÚ ÇáßÇÆä ÛíÑ ÕÇáÍ"; + Text[ dutch ] = "Ongeldige objectverwijzing"; + Text[ chinese_simplified ] = "ÎÞЧµÄ¶ÔÏóÒýÓÃ"; + Text[ greek ] = "Ìç Ýãêõñç áíáöïñÜ áíôéêåéìÝíïõ"; + Text[ korean ] = "À߸øµÈ °³Ã¼ ÂüÁ¶"; + Text[ turkish ] = "Geçersiz nesne referansý"; + Text[ language_user1 ] = " "; + }; + String SbERR_NO_METHOD & ERRCODE_RES_MASK + { + Text = "Eigenschaft oder Methode nicht gefunden" ; + Text [ ENGLISH ] = "Property or method not found" ; + Text [ norwegian ] = "Property or method not found" ; + Text [ italian ] = "Proprietà o metodo non trovati" ; + Text [ portuguese_brazilian ] = "Property or method not found" ; + Text [ portuguese ] = "Propriedade ou método não encontrados" ; + Text [ french ] = "Propriété ou méthode introuvable" ; + Text [ dutch ] = "Eigenschap of methode niet gevonden" ; + Text [ spanish ] = "No se encontró la propiedad o el método" ; + Text [ danish ] = "Egenskab eller metode blev ikke fundet" ; + Text [ swedish ] = "Egenskap eller metod hittades inte" ; + Text [ finnish ] = "Property or method not found" ; + Text [ english_us ] = "Property or method not found" ; + Text[ chinese_simplified ] = "ûÓÐÕÒµ½ÊôÐÔ»ò·½·¨"; + Text[ russian ] = "Ñâîéñòâî èëè ìåòîä íå íàéäåíû"; + Text[ polish ] = "Nie znaleziono w³aœciwoœci lub metody"; + Text[ japanese ] = "ÌßÛÊßè‚Ü‚½‚ÍÒ¿¯ÄÞ‚ªŒ©‚‚©‚è‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "¨S¦³§ä¨ìÄݩʩΤèªk"; + Text[ arabic ] = "áã íÊã ÇáÚ辄 Úáì ÇáÎÇÕíÉ Ãæ ÇáÃÓáæÈ"; + Text[ dutch ] = "Eigenschap of methode niet gevonden"; + Text[ chinese_simplified ] = "ûÓÐÕÒµ½ÊôÐÔ»ò·½·¨"; + Text[ greek ] = "Äåí âñÝèçêå ç éäéüôçôá Þ ç ìÝèïäïò"; + Text[ korean ] = "ÇÁ·ÎÆÛƼ ¶Ç´Â ¸Þ¼Òµå°¡ ¹ß°ßµÇÁö ¾Ê½À´Ï´Ù."; + Text[ turkish ] = "Özellik ya da yöntem bulunamadý"; + Text[ language_user1 ] = " "; + }; + String SbERR_NEEDS_OBJECT & ERRCODE_RES_MASK + { + Text = "Objekt erforderlich" ; + Text [ ENGLISH ] = "Object required" ; + Text [ norwegian ] = "Object required" ; + Text [ italian ] = "È necessario un oggetto" ; + Text [ portuguese_brazilian ] = "Object required" ; + Text [ portuguese ] = "Necessário objecto" ; + Text [ french ] = "Objet requis" ; + Text [ dutch ] = "Object vereist" ; + Text [ spanish ] = "Se requiere un objeto" ; + Text [ danish ] = "Objekt kræves" ; + Text [ swedish ] = "Objekt krävs" ; + Text [ finnish ] = "Object required" ; + Text [ english_us ] = "Object required" ; + Text[ chinese_simplified ] = "ÒªÇó¶ÔÏó"; + Text[ russian ] = "Íåîáõîäèì îáúåêò"; + Text[ polish ] = "Wymagany obiekt"; + Text[ japanese ] = "µÌÞ¼Þª¸Ä‚ª•K—v‚Å‚·"; + Text[ chinese_traditional ] = "n¨Dª«¥ó"; + Text[ arabic ] = "ãØáæÈ ßÇÆä"; + Text[ dutch ] = "Object vereist"; + Text[ chinese_simplified ] = "ÒªÇó¶ÔÏó"; + Text[ greek ] = "Áðáéôåßôáé áíôéêåßìåíï"; + Text[ korean ] = "°³Ã¼°¡ ÇÊ¿äÇÕ´Ï´Ù."; + Text[ turkish ] = "Nesne gerekli"; + Text[ language_user1 ] = " "; + }; + String SbERR_INVALID_USAGE_OBJECT & ERRCODE_RES_MASK + { + Text = "Falsche Verwendung eines Objekts" ; + Text [ ENGLISH ] = "Invalid use of object" ; + Text [ norwegian ] = "Invalid use of object" ; + Text [ italian ] = "Utilizzo non valido di un oggetto" ; + Text [ portuguese_brazilian ] = "Invalid use of object" ; + Text [ portuguese ] = "Uso incorrecto de um objecto" ; + Text [ french ] = "Utilisation incorrecte d'un objet" ; + Text [ dutch ] = "Ongeldig gebruik van object" ; + Text [ spanish ] = "Uso erróneo de un objeto" ; + Text [ danish ] = "Ugyldig brug af et objekt" ; + Text [ swedish ] = "Felaktig användning av ett objekt" ; + Text [ finnish ] = "Invalid use of object" ; + Text [ english_us ] = "Invalid use of an object" ; + Text[ chinese_simplified ] = "´íÎóʹÓöÔÏó"; + Text[ russian ] = "Íåïðàâèëüíîå èñïîëüçîâàíèå îáúåêòà"; + Text[ polish ] = "Nieprawid³owe u¿ycie obiektu"; + Text[ japanese ] = "µÌÞ¼Þª¸Ä‚ÌŒë‚Á‚½Žg—p"; + Text[ chinese_traditional ] = "¿ù»~¨Ï¥Îª«¥ó"; + Text[ arabic ] = "ÇÓÊÎÏÇã ÎÇØÆ áßÇÆä"; + Text[ dutch ] = "Ongeldig gebruik van object"; + Text[ chinese_simplified ] = "´íÎóʹÓöÔÏó"; + Text[ greek ] = "ËáíèáóìÝíç ÷ñÞóç åíüò áíôéêåéìÝíïõ"; + Text[ korean ] = "°³Ã¼ÀÇ À߸øµÈ »ç¿ë"; + Text[ turkish ] = "Nesne kullanýmý yanlýþ"; + Text[ language_user1 ] = " "; + }; + String SbERR_NO_OLE & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? OLE-Automatisierung wird von diesem Objekt nicht unterst³tzt : OLE-Automatisierung wird von diesem Objekt nicht untersttzt */ + Text = "OLE-Automatisierung wird von diesem Objekt nicht unterstützt" ; + Text [ ENGLISH ] = "Object does not support OLE Automation" ; + Text [ norwegian ] = "Object does not support OLE Automation" ; + Text [ italian ] = "L'automatizzazione OLE non è supportata dall'oggetto" ; + Text [ portuguese_brazilian ] = "Object does not support OLE Automation" ; + Text [ portuguese ] = "Este objecto não suporta a automatação OLE" ; + Text [ french ] = "Cet objet ne supporte pas l'automatisation OLE" ; + Text [ dutch ] = "OLE-automatisering wordt niet ondersteund door het aangegeven object" ; + Text [ spanish ] = "Este objeto no apoya la automatización OLE" ; + Text [ danish ] = "OLE-automatiseringen understøttes ikke af dette objekt" ; + Text [ swedish ] = "OLE-automatiseringen stöds ej av detta objekt" ; + Text [ finnish ] = "Object does not support OLE Automation" ; + Text [ english_us ] = "OLE Automation is not supported by this object" ; + Text[ chinese_simplified ] = "Õâ¸ö¶ÔÏó²»Ö§³ÖOLE×Ô¶¯»¯"; + Text[ russian ] = "Àâòîìàòèçàöèÿ OLE ýòèì îáúåêòîì íå ïîääåðæèâàåòñÿ"; + Text[ polish ] = "Automatyzacja OLE nie jest obs³ugiwana przez ten obiekt"; + Text[ japanese ] = "OLE‚ÌŽ©“®‰»‚Í‚±‚̵ÌÞ¼Þª¸Ä‚©‚çŽx‰‡‚³‚ê‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "³oÓª«¥ó¤£¤ä´©OLE¦Û°Ê¤Æ"; + Text[ arabic ] = "áÇ íÏÚã åÐÇ ÇáßÇÆä ÚãáíÉ ÌÚá ÇáÜ OLE ÃæÊæãÇÊíßíÇð"; + Text[ dutch ] = "OLE-automatisering wordt niet ondersteund door het aangegeven object"; + Text[ chinese_simplified ] = "Õâ¸ö¶ÔÏó²»Ö§³ÖOLE×Ô¶¯»¯"; + Text[ greek ] = "Ç áõôïìáôïðïßçóç ôïõ OLE äåí õðïóôçñßæåôáé áðü áõôü ôï áíôéêåßìåíï"; + Text[ korean ] = "OLE ÀÚµ¿È´Â °³Ã¼¿¡¼ Áö¿øµÇÁö ¾Ê½À´Ï´Ù."; + Text[ turkish ] = "OLE otomasyonu bu nesne tarafýndan desteklenmiyor"; + Text[ language_user1 ] = " "; + }; + String SbERR_BAD_METHOD & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Objekt unterst³tzt diese Eigenschaft oder Methode nicht : Objekt untersttzt diese Eigenschaft oder Methode nicht */ + Text = "Objekt unterstützt diese Eigenschaft oder Methode nicht" ; + Text [ ENGLISH ] = "Object doesn't support property or method" ; + Text [ norwegian ] = "Object doesn't support property or method" ; + Text [ italian ] = "L'oggetto non supporta la proprietà o il metodo" ; + Text [ portuguese_brazilian ] = "Object doesn't support property or method" ; + Text [ portuguese ] = "Objecto não suporta nem a característica nem o método" ; + Text [ french ] = "L'objet ne supporte pas cette propriété ou méthode" ; + Text [ dutch ] = "Deze eigenschap of methode wordt niet ondersteund door het aangegeven object" ; + Text [ spanish ] = "El objeto no apoya esta propiedad o método" ; + Text [ danish ] = "Objektet understøtter ikke denne egenskab eller metode" ; + Text [ swedish ] = "Objektet understödjer inte denna egenskap eller metod" ; + Text [ finnish ] = "Object doesn't support property or method" ; + Text [ english_us ] = "This property or method is not supported by the object" ; + Text[ chinese_simplified ] = "¶ÔÏó²»Ö§³ÖÕâ¸öÊôÐÔ»ò·½·¨"; + Text[ russian ] = "Îáúåêò íå ïîääåðæèâàåò ýòî ñâîéñòâî èëè ìåòîä"; + Text[ polish ] = "Obiekt nie obs³uguje tej w³aœciwoœci lub metody"; + Text[ japanese ] = "µÌÞ¼Þª¸Ä‚Í‚±‚ÌÌßÛÊßè‚Ü‚½‚Í•û–@‚ðŽx‰‡‚Å‚«‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "ª«¥ó¤£¤ä«ù³oÓÄݩʩΤèªk"; + Text[ arabic ] = "áÇ íÏÚã ÇáßÇÆä åÐå ÇáÎÇÕíÉ Ãæ åÐÇ ÇáÃÓáæÈ"; + Text[ dutch ] = "Deze eigenschap of methode wordt niet ondersteund door het aangegeven object"; + Text[ chinese_simplified ] = "¶ÔÏó²»Ö§³ÖÕâ¸öÊôÐÔ»ò·½·¨"; + Text[ greek ] = "Ôï áíôéêåßìåíï äåí õðïóôçñßæåé áõôÞ ôçí éäéüôçôá Þ ìÝèïäï"; + Text[ korean ] = "ÀÌ ÇÁ·ÎÆÛƼ ¶Ç´Â ¸Þ¼Òµå´Â °³Ã¼¿¡¼ Áö¿øµÇÁö ¾Ê½À´Ï´Ù."; + Text[ turkish ] = "Nesne bu özelliði ya da yöntemi desteklemiyor"; + Text[ language_user1 ] = " "; + }; + String SbERR_OLE_ERROR & ERRCODE_RES_MASK + { + Text = "Fehler bei OLE-Automatisierung" ; + Text [ ENGLISH ] = "OLE Automation error" ; + Text [ norwegian ] = "OLE Automation error" ; + Text [ italian ] = "Errore nell'automatizzazione OLE" ; + Text [ portuguese_brazilian ] = "OLE Automation error" ; + Text [ portuguese ] = "Erro na automatação OLE" ; + Text [ french ] = "Erreur lors de l'automatisation OLE" ; + Text [ dutch ] = "Fout bij OLE-automatisering" ; + Text [ spanish ] = "Error en la automatización OLE" ; + Text [ danish ] = "Fejl ved OLE-automatisering" ; + Text [ swedish ] = "Fel vid OLE-automatisering" ; + Text [ finnish ] = "OLE Automation error" ; + Text [ english_us ] = "OLE Automation Error" ; + Text[ chinese_simplified ] = "OLE ×Ô¶¯»¯´íÎó"; + Text[ russian ] = "Îøèáêà ïðè àâòîìàòèçàöèè OLE"; + Text[ polish ] = "B³¹d przy automatyzacji OLE"; + Text[ japanese ] = "OLEŽ©“®‰»‚ÌÛ‚Ì´×°"; + Text[ chinese_traditional ] = "OLE¦Û°Ê¤Æ¿ù»~"; + Text[ arabic ] = "ÎØÃ ÃËäÇÁ ÚãáíÉ ÌÚá ÇáÜ OLE ÃæÊæãÇÊíßíÇð"; + Text[ dutch ] = "Fout bij OLE-automatisering"; + Text[ chinese_simplified ] = "OLE ×Ô¶¯»¯´íÎó"; + Text[ greek ] = "ÓöÜëìá êáôÜ ôçí áõôïìáôïðïßçóç OLE"; + Text[ korean ] = "OLE ÀÚµ¿È ¿À·ù"; + Text[ turkish ] = "OLE otomasyonunda hata"; + Text[ language_user1 ] = " "; + }; + String SbERR_BAD_ACTION & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Diese Aktion wird vom angegebenen Objekt nicht unterst³tzt : Diese Aktion wird vom angegebenen Objekt nicht untersttzt */ + Text = "Diese Aktion wird vom angegebenen Objekt nicht unterstützt" ; + Text [ ENGLISH ] = "Object doesn't support this action" ; + Text [ norwegian ] = "Object doesn't support this action" ; + Text [ italian ] = "Azione non supportata dall'oggetto specificato" ; + Text [ portuguese_brazilian ] = "Object doesn't support this action" ; + Text [ portuguese ] = "O objecto indicado não suporta esta acção" ; + Text [ french ] = "L'objet indiqué ne supporte pas cette action" ; + Text [ dutch ] = "Deze activiteit wordt niet ondersteund door het aangegeven object" ; + Text [ spanish ] = "Esta acción no es apoyada por el objeto dado" ; + Text [ danish ] = "Denne handling understøttes ikke at det angivne objekt." ; + Text [ swedish ] = "Denna åtgärd understöds inte av angivet objekt" ; + Text [ finnish ] = "Object doesn't support this action" ; + Text [ english_us ] = "This action is not supported by given object" ; + Text[ chinese_simplified ] = "¸ø¶¨µÄ¶ÔÏó²»Ö§³ÖÕâ¸ö²Ù×÷"; + Text[ russian ] = "Ýòà îïåðàöèÿ äàííûì îáúåêòîì íå ïîääåðæèâàåòñÿ"; + Text[ polish ] = "Ta akcja nie jest obs³ugiwana przez podany obiekt"; + Text[ japanese ] = "‚±‚̱¸¼®Ý‚ÍŽw’肳‚ꂽµÌÞ¼Þª¸Ä‚©‚çŽx‰‡‚³‚ê‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "«ü©wªºª«¥ó¤£¤ä´©³oÓ¾Þ§@"; + Text[ arabic ] = "ÇáßÇÆä ÇáãÚØì áÇ íÏÚã åÐå ÇáÚãáíÉ"; + Text[ dutch ] = "Deze activiteit wordt niet ondersteund door het aangegeven object"; + Text[ chinese_simplified ] = "¸ø¶¨µÄ¶ÔÏó²»Ö§³ÖÕâ¸ö²Ù×÷"; + Text[ greek ] = "Ç åíÝñãåéá áõôÞ äåí õðïóôçñßæåôáé áðü ôï äåäïìÝíï áíôéêåßìåíï"; + Text[ korean ] = "ÀÌ µ¿ÀÛÀº ÁÖ¾îÁø °³Ã¼¿¡ÀÇÇØ¼ Áö¿øµÇÁö ¾Ê½À´Ï´Ù."; + Text[ turkish ] = "Bu iþlem belirtilen nesne tarafýndan desteklenmiyor"; + Text[ language_user1 ] = " "; + }; + String SbERR_NO_NAMED_ARGS & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Benannte Argumente werden vom angegebenen Objekt nicht unterst³tzt : Benannte Argumente werden vom angegebenen Objekt nicht untersttzt */ + Text = "Benannte Argumente werden vom angegebenen Objekt nicht unterstützt" ; + Text [ ENGLISH ] = "Object doesn't support named args" ; + Text [ norwegian ] = "Object doesn't support named args" ; + Text [ italian ] = "Gli argomenti indicati non vengono supportati dall'oggetto specificato" ; + Text [ portuguese_brazilian ] = "Object doesn't support named args" ; + Text [ portuguese ] = "O objecto indicado não suporta os argumentos mencionados" ; + Text [ french ] = "L'objet indiqué ne supporte pas les arguments cités" ; + Text [ dutch ] = "Genoemde argumenten wordt niet ondersteund door het aangegeven object" ; + Text [ spanish ] = "El objeto indicado no apoya los argumentos nombrados" ; + Text [ danish ] = "Nævnte argumenter understøttes ikke af det angivne objekt" ; + Text [ swedish ] = "Angivna argument understöds ej av angivet objekt" ; + Text [ finnish ] = "Object doesn't support named args" ; + Text [ english_us ] = "Named arguments are not supported by given object" ; + Text[ chinese_simplified ] = "¸ø¶¨¶ÔÏó²»Ö§³ÖÖ¸¶¨µÄ×Ô±äÁ¿"; + Text[ russian ] = "Íàçâàííûå àðãóìåíòû äàííûì îáúåêòîì íå ïîääåðæèâàþòñÿ"; + Text[ polish ] = "Nazwane argumenty nie s¹ obs³ugiwane przez podany obiekt"; + Text[ japanese ] = "Žw–¼‚³‚ꂽˆø”‚ÍŽw’肳‚ꂽµÌÞ¼Þª¸Ä‚©‚çŽx‰‡‚³‚ê‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "«ü©wªº¦ÛÅܶq¤£¨ü«ü©wª«¥óªº¤ä´©"; + Text[ arabic ] = "ÇáßÇÆä ÇáãÏÑÌ áÇ íÏÚã ÇáæÓÇÆØ ÇáãÓãÇÉ"; + Text[ dutch ] = "Genoemde argumenten wordt niet ondersteund door het aangegeven object"; + Text[ chinese_simplified ] = "¸ø¶¨¶ÔÏó²»Ö§³ÖÖ¸¶¨µÄ×Ô±äÁ¿"; + Text[ greek ] = "Ôá ïíïìáæüìåíá ïñßóìáôá äåí õðïóôçñßæïíôáé áðü ôï äåäïìÝíï áíôéêåßìåíï"; + Text[ korean ] = "ÁöÁ¤µÈ µ¶¸³ º¯¼ö´Â ÁÖ¾îÁø °³Ã¼ÀÇ Áö¿øÀ» ¹ÞÁö ¾Ê½À´Ï´Ù."; + Text[ turkish ] = "Adlandýrýlmýþ argümanlar, belirtilen nesne tarafýndan desteklenmiyor"; + Text[ language_user1 ] = " "; + }; + String SbERR_BAD_LOCALE & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Das aktuelle Gebietsschema wird vom angegebenen Objekt nicht unterst³tzt : Das aktuelle Gebietsschema wird vom angegebenen Objekt nicht untersttzt */ + Text = "Das aktuelle Gebietsschema wird vom angegebenen Objekt nicht unterstützt" ; + Text [ ENGLISH ] = "Object doesn't support current locale setting" ; + Text [ norwegian ] = "Object doesn't support current locale setting" ; + Text [ italian ] = "L'oggetto indicato non supporta l'attuale schema regionale" ; + Text [ portuguese_brazilian ] = "Object doesn't support current locale setting" ; + Text [ portuguese ] = "O objecto indicado não suporta a configuração local actual" ; + Text [ french ] = "L'objet indiqué ne supporte pas les paramètres régionaux sélectionnés" ; + Text [ dutch ] = "Dit actuele gebiedschema wordt niet ondersteund door het aangegeven object" ; + Text [ spanish ] = "La configuración local actual no es apoyada por el objeto dado" ; + Text [ danish ] = "Det aktuelle områdeskema understøttes ikke af det angivne objekt" ; + Text [ swedish ] = "De aktuella lokala inställningarna understöds inte av angivet objekt" ; + Text [ finnish ] = "Object doesn't support current locale setting" ; + Text [ english_us ] = "The current locale setting is not supported by the given object" ; + Text[ chinese_simplified ] = "µ±Ç°µÄ¾Ö²¿É趨²»Êܸø¶¨¶ÔÏóµÄÖ§³Ö"; + Text[ russian ] = "Òåêóùàÿ ëîêàëüíàÿ óñòàíîâêà äàííûì îáúåêòîì íå ïîääåðæèâàåòñÿ"; + Text[ polish ] = "Bie¿¹ce ustawienie lokalne nie jest obs³ugiwane przez podany obiekt"; + Text[ japanese ] = "Œ»Ý‚ÌÛ°¶ÙÝ’è‚ÍŽw’肵‚½µÌÞ¼Þª¸Ä‚©‚çŽx‰‡‚³‚ê‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "·í«eªº§½³¡³]©w¤£¨ü«ü©wª«¥óªº¤ä´©"; + Text[ arabic ] = "ÇáßÇÆä ÇáãÚØì áÇ íÏÚã ÇáÅÚÏÇÏ ÇáãÍáí ÇáÍÇáí"; + Text[ dutch ] = "Dit actuele gebiedschema wordt niet ondersteund door het aangegeven object"; + Text[ chinese_simplified ] = "µ±Ç°µÄ¾Ö²¿É趨²»Êܸø¶¨¶ÔÏóµÄÖ§³Ö"; + Text[ greek ] = "Ïé ôñÝ÷ïõóåò ôïðéêÝò ñõèìßóåéò äåí õðïóôçñßæïíôáé áðü ôï äåäïìÝíï áíôéêåßìåíï"; + Text[ korean ] = "ÇöÀçÀÇ ·ÎÄà ¼³Á¤Àº ÁÖ¾îÁø °³Ã¼¿¡ÀÇÇØ¼ Áö¿øµÇÁö ¾Ê½À´Ï´Ù."; + Text[ turkish ] = "Yürülükteki yerel ayarlar, belirtilen nesne tarafýndan desteklenmiyor"; + Text[ language_user1 ] = " "; + }; + String SbERR_NAMED_NOT_FOUND & ERRCODE_RES_MASK + { + Text = "Benanntes Argument nicht gefunden" ; + Text [ ENGLISH ] = "Named argument not found" ; + Text [ norwegian ] = "Named argument not found" ; + Text [ italian ] = "L'argomento indicato non è stato trovato" ; + Text [ portuguese_brazilian ] = "Named argument not found" ; + Text [ portuguese ] = "Impossível encontrar o argumento mencionado" ; + Text [ french ] = "L'argument cité est introuvable" ; + Text [ dutch ] = "Genoemd argument niet gevonden" ; + Text [ spanish ] = "No se encontró el argumento nombrado" ; + Text [ danish ] = "Det nævnte argument blev ikke fundet" ; + Text [ swedish ] = "Angivet argument hittades inte" ; + Text [ finnish ] = "Named argument not found" ; + Text [ english_us ] = "Named argument not found" ; + Text[ chinese_simplified ] = "ûÓÐÕÒµ½Ö¸¶¨µÄ×Ô±äÁ¿"; + Text[ russian ] = "Íàéäåííûé àðãóìåíò íå íàéäåí"; + Text[ polish ] = "Nazwanego argumentu nie znaleziono"; + Text[ japanese ] = "Žw–¼‚µ‚½ˆø”‚ÍŒ©‚‚©‚è‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "¨S¦³§ä¨ì«ü©wªº¦ÛÅܶq"; + Text[ arabic ] = "áã íñÚËÑ Úáì ÇáæÓíØÉ ÇáãÓãÇÉ"; + Text[ dutch ] = "Genoemd argument niet gevonden"; + Text[ chinese_simplified ] = "ûÓÐÕÒµ½Ö¸¶¨µÄ×Ô±äÁ¿"; + Text[ greek ] = "Ôï ïíïìáæüìåíï üñéóìá äåí âñÝèçêå"; + Text[ korean ] = "ÁöÁ¤µÈ µ¶¸³ º¯¼ö°¡ ¹ß°ßµÇÁö ¾Ê½À´Ï´Ù."; + Text[ turkish ] = "Adlandýrýlan argüman bulunamadý"; + Text[ language_user1 ] = " "; + }; + String SbERR_NOT_OPTIONAL & ERRCODE_RES_MASK + { + Text = "Argument ist nicht optional" ; + Text [ ENGLISH ] = "Argument not optional" ; + Text [ norwegian ] = "Argument not optional" ; + Text [ italian ] = "L'argomento non è opzionale" ; + Text [ portuguese_brazilian ] = "Argument not optional" ; + Text [ portuguese ] = "Argumento não é opcional" ; + Text [ french ] = "L'argument n'est pas facultatif" ; + Text [ dutch ] = "Argument niet optioneel" ; + Text [ spanish ] = "El argumento no es opcional" ; + Text [ danish ] = "Argumentet er ikke valgfrit" ; + Text [ swedish ] = "Argumentet är inte valfritt" ; + Text [ finnish ] = "Argument not optional" ; + Text [ english_us ] = "Argument is not optional" ; + Text[ chinese_simplified ] = "·Ç¿ÉÑ¡µÄ×Ô±äÁ¿"; + Text[ russian ] = "Àðãóìåíò íå îáÿçàòåëåí"; + Text[ polish ] = "Argument nie jest opcjonalny"; + Text[ japanese ] = "ˆø”‚͵Ìß¼®Ý‚ł͂ ‚è‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "«D¥i¿ïªº¦ÛÅܶq"; + Text[ arabic ] = "ÇáæÓíØÉ ÛíÑ ÇÎÊíÇÑíÉ"; + Text[ dutch ] = "Argument niet optioneel"; + Text[ chinese_simplified ] = "·Ç¿ÉÑ¡µÄ×Ô±äÁ¿"; + Text[ greek ] = "Ôï üñéóìá äåí åßíáé ðñïáéñåôéêü"; + Text[ korean ] = "µ¶¸³ º¯¼ö´Â ¿É¼ÇÀÌ ¾Æ´Õ´Ï´Ù."; + Text[ turkish ] = "Argüman isteðe baðlý deðil"; + Text[ language_user1 ] = " "; + }; + String SbERR_WRONG_ARGS & ERRCODE_RES_MASK + { + Text = "Falsche Anzahl an Argumenten" ; + Text [ ENGLISH ] = "Wrong number of arguments" ; + Text [ norwegian ] = "Wrong number of arguments" ; + Text [ italian ] = "Numero di argomenti errato" ; + Text [ portuguese_brazilian ] = "Wrong number of arguments" ; + Text [ portuguese ] = "Número de argumentos incorrecto" ; + Text [ french ] = "Nombre d'arguments incorrect" ; + Text [ dutch ] = "Foutief aantal argumenten" ; + Text [ spanish ] = "Número erróneo de argumentos" ; + Text [ danish ] = "Forkert antal argumenter" ; + Text [ swedish ] = "Felaktigt antal argument" ; + Text [ finnish ] = "Wrong number of arguments" ; + Text [ english_us ] = "Invalid number of arguments" ; + Text[ chinese_simplified ] = "ÎÞЧµÄ×Ô±äÁ¿ÊýÄ¿"; + Text[ russian ] = "Íåïðàâèëüíîå ÷èñëî àðãóìåíòîâ"; + Text[ polish ] = "Nieprawid³owa iloœæ argumentów"; + Text[ japanese ] = "ˆø”‚Ì”‚ª³‚µ‚‚ ‚è‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "µL®Äªº¦ÛÅܶq¼Æ¥Ø"; + Text[ arabic ] = "ÚÏÏ ÇáæÓÇÆØ ÛíÑ ÕÇáÍ"; + Text[ dutch ] = "Foutief aantal argumenten"; + Text[ chinese_simplified ] = "ÎÞЧµÄ×Ô±äÁ¿ÊýÄ¿"; + Text[ greek ] = "ËÜèïò ðëÞèïò ïñéóìÜôùí"; + Text[ korean ] = "µ¶¸³º¯¼ö °³¼ö°¡ Ʋ¸²"; + Text[ turkish ] = "Argüman sayýsý yanlýþ"; + Text[ language_user1 ] = " "; + }; + String SbERR_NOT_A_COLL & ERRCODE_RES_MASK + { + Text = "Objekt ist keine Auflistung" ; + Text [ ENGLISH ] = "Object not a collection" ; + Text [ norwegian ] = "Object not a collection" ; + Text [ italian ] = "L'oggetto non è un elenco" ; + Text [ portuguese_brazilian ] = "Object not a collection" ; + Text [ portuguese ] = "O objecto não é uma lista" ; + Text [ french ] = "L'objet n'est pas une liste" ; + Text [ dutch ] = "Object is geen lijst" ; + Text [ spanish ] = "El objeto no es una lista" ; + Text [ danish ] = "Objektet er ingen liste" ; + Text [ swedish ] = "Objektet är ingen lista" ; + Text [ finnish ] = "Object not a collection" ; + Text [ english_us ] = "Object is not a list" ; + Text[ chinese_simplified ] = "¶ÔÏó²»ÊÇÒ»¸öÁе¥"; + Text[ russian ] = "Îáúåêò íå ÿâëÿåòñÿ ñïèñêîì"; + Text[ polish ] = "Obiekt nie jest list¹"; + Text[ japanese ] = "µÌÞ¼Þª¸Ä‚ÍØ½Ä‚ł͂ ‚è‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "ª«¥ó¤£¬O¤@Ó²M³æ"; + Text[ arabic ] = "åÐÇ ÇáßÇÆä áíÓ ÞÇÆãÉ"; + Text[ dutch ] = "Object is geen lijst"; + Text[ chinese_simplified ] = "¶ÔÏó²»ÊÇÒ»¸öÁе¥"; + Text[ greek ] = "Ôï áíôéêåßìåíï äåí åßíáé ëßóôá"; + Text[ korean ] = "°³Ã¼°¡ µî·ÏµÇÁö ¾Ê¾Ò½À´Ï´Ù."; + Text[ turkish ] = "Nesne bir liste deðil"; + Text[ language_user1 ] = " "; + }; + String SbERR_BAD_ORDINAL & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Ordnungszahl ung³ltig : Ordnungszahl ungltig */ + Text = "Ordnungszahl ungültig" ; + Text [ ENGLISH ] = "Invalid ordinal" ; + Text [ norwegian ] = "Invalid ordinal" ; + Text [ italian ] = "Numero ordinale non valido" ; + Text [ portuguese_brazilian ] = "Invalid ordinal" ; + Text [ portuguese ] = "Ordinal incorrecto" ; + Text [ french ] = "Nombre ordinal non valable" ; + Text [ dutch ] = "Ongeldig ranggetal" ; + Text [ spanish ] = "Número ordinal no válido" ; + Text [ danish ] = "Ugyldigt ordenstal" ; + Text [ swedish ] = "Ogiltigt ordningstal" ; + Text [ finnish ] = "Invalid ordinal" ; + Text [ english_us ] = "Invalid ordinal number" ; + Text[ chinese_simplified ] = "ÐòºÅÎÞЧ"; + Text[ russian ] = "Ïîðÿäêîâîå ÷èñëî íåäåéñòâèòåëüíî"; + Text[ polish ] = "Nieprawid³owa liczba porz¹dkowa"; + Text[ japanese ] = "˜”‚Í–³Œø‚Å‚·"; + Text[ chinese_traditional ] = "§Ç¸¹µL®Ä"; + Text[ arabic ] = "ÚÏÏ ÊÑÊíÈí ÛíÑ ÕÇáÍ"; + Text[ dutch ] = "Ongeldig ranggetal"; + Text[ chinese_simplified ] = "ÐòºÅÎÞЧ"; + Text[ greek ] = "Ìç Ýãêõñïò áñéèìüò ôÜîçò"; + Text[ korean ] = "À߸øµÈ ¼¼ö"; + Text[ turkish ] = "Sýra sayýsý geçersiz"; + Text[ language_user1 ] = " "; + }; + String SbERR_DLLPROC_NOT_FOUND & ERRCODE_RES_MASK + { + Text = "Angegebene DLL-Funktion nicht gefunden" ; + Text [ ENGLISH ] = "Specified DLL function not found" ; + Text [ norwegian ] = "Specified DLL function not found" ; + Text [ italian ] = "Impossibile trovare la funzione DLL specificata" ; + Text [ portuguese_brazilian ] = "Specified DLL function not found" ; + Text [ portuguese ] = "Função DLL especificada não foi encontrada" ; + Text [ french ] = "La fonction DLL indiquée est introuvable" ; + Text [ dutch ] = "Aangegeven DLL- functie niet gevonden" ; + Text [ spanish ] = "No se encontró la función DLL especificada" ; + Text [ danish ] = "Den angivne DDL-funktion blev ikke fundet" ; + Text [ swedish ] = "Angiven DLL-funktion hittades inte" ; + Text [ finnish ] = "Specified DLL function not found" ; + Text [ english_us ] = "Specified DLL function not found" ; + Text[ chinese_simplified ] = "ûÓÐÕÒµ½Ö¸¶¨µÄ DLL ¹¦ÄÜ"; + Text[ russian ] = "Äàííàÿ ôóíêöèÿ DLL íå íàéäåíà"; + Text[ polish ] = "Podanej funkcji DLL nie znaleziono"; + Text[ japanese ] = "Žw’肳‚ꂽDLL‹@”\\‚ÍŒ©‚‚©‚è‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "¨S¦³§ä¨ì«ü©wªºDLL¥\\¯à"; + Text[ arabic ] = "ÇáãÍÏÏÉ ÛíÑ ãæÌæÏÉ DLL ÏÇáÉ"; + Text[ dutch ] = "Aangegeven DLL- functie niet gevonden"; + Text[ chinese_simplified ] = "ûÓÐÕÒµ½Ö¸¶¨µÄ DLL ¹¦ÄÜ"; + Text[ greek ] = "Äåí âñÝèçêå ç áíáöåñüìåíç ëåéôïõñãßá DLL"; + Text[ korean ] = "¸í±âµÈ DLL ÇÔ¼ö°¡ ¹ß°ßµÇÁö ¾Ê¾Ò½À´Ï´Ù."; + Text[ turkish ] = "Belirtilen DLL iþlevi bulunamadý"; + Text[ language_user1 ] = " "; + }; + String SbERR_BAD_CLIPBD_FORMAT & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Ung³ltiges Clipboard-Format : Ungltiges Clipboard-Format */ + Text = "Ungültiges Clipboard-Format" ; + Text [ ENGLISH ] = "Invalid clipboard format" ; + Text [ norwegian ] = "Invalid clipboard format" ; + Text [ italian ] = "Formato clipboard non valido" ; + Text [ portuguese_brazilian ] = "Invalid clipboard format" ; + Text [ portuguese ] = "Formato da área de transferência não válido" ; + Text [ french ] = "Le format de presse-papiers souhaité est incorrect." ; + Text [ dutch ] = "Ongeldig Clipboard- formaat" ; + Text [ spanish ] = "Formato de portapapeles no válido" ; + Text [ danish ] = "Ugyldigt udklipsholderformat" ; + Text [ swedish ] = "Ogiltigt urklippsformat" ; + Text [ finnish ] = "Invalid clipboard format" ; + Text [ english_us ] = "Invalid clipboard format" ; + Text[ chinese_simplified ] = "ÎÞЧµÄ¼ôÌù°å¸ñʽ"; + Text[ russian ] = "Íåäåéñòâèòåëüíûé ôîðìàò áóôåðà îáìåíà"; + Text[ polish ] = "Nieprawid³owy format schowka"; + Text[ japanese ] = "¸Ø¯ÌßÎÞ°ÄÞ‘Ž®‚ª–³Œø‚Å‚·"; + Text[ chinese_traditional ] = "µL®Äªº°Å¶Kï®æ¦¡"; + Text[ arabic ] = "ÊäÓíÞ ÍÇÝÙÉ ÛíÑ ÕÇáÍ"; + Text[ dutch ] = "Ongeldig Clipboard- formaat"; + Text[ chinese_simplified ] = "ÎÞЧµÄ¼ôÌù°å¸ñʽ"; + Text[ greek ] = "Ìç Ýãêõñç ìïñöÞ ðñï÷åßñïõ"; + Text[ korean ] = "À¯È¿ÇÏÁö ¾ÊÀº Ŭ¸³º¸µå Æ÷¸Ë"; + Text[ turkish ] = "Geçersiz pano formatý"; + Text[ language_user1 ] = " "; + }; + String SbERR_PROPERTY_NOT_FOUND & ERRCODE_RES_MASK + { + Text = "Objekt hat diese Eigenschaft nicht" ; + Text [ ENGLISH ] = "Object does not have property" ; + Text [ norwegian ] = "Object does not have property" ; + Text [ italian ] = "L'oggetto non dispone di questa proprietà" ; + Text [ portuguese_brazilian ] = "Object does not have property" ; + Text [ portuguese ] = "O objecto não tem esta propriedade" ; + Text [ french ] = "L'objet ne possède pas cette propriété" ; + Text [ dutch ] = "Object heeft deze eigenschap niet" ; + Text [ spanish ] = "El objeto no tiene esta propiedad" ; + Text [ danish ] = "Objektet har ikke denne egenskab" ; + Text [ swedish ] = "Objektet har inte denna egenskap" ; + Text [ finnish ] = "Object does not have property" ; + Text [ english_us ] = "Object does not have this property" ; + Text[ chinese_simplified ] = "¶ÔÏ󲻾߱¸Õâ¸öÊôÐÔ"; + Text[ russian ] = "Ó îáúåêòà íåò ýòîãî ñâîéñòâà"; + Text[ polish ] = "Obiekt nie ma tej w³aœciwoœci"; + Text[ japanese ] = "µÌÞ¼Þª¸Ä‚É‚±‚Ì‘®«‚Í‚ ‚è‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "ª«¥ó¤£¨ã³Æ³oÓÄÝ©Ê"; + Text[ arabic ] = "áíÓ ááßÇÆä åÐå ÇáÎÇÕíÉ"; + Text[ dutch ] = "Object heeft deze eigenschap niet"; + Text[ chinese_simplified ] = "¶ÔÏ󲻾߱¸Õâ¸öÊôÐÔ"; + Text[ greek ] = "Ôï áíôéêåßìåíï äåí Ý÷åé áõôÞ ôçí éäéüôçôá"; + Text[ korean ] = "°³Ã¼°¡ ÀÌ ÇÁ·ÎÆÛƼ¸¦ °¡Áö°í ÀÖÁö ¾Ê½À´Ï´Ù."; + Text[ turkish ] = "Nesne bu özelliðe sahip deðil"; + Text[ language_user1 ] = " "; + }; + String SbERR_METHOD_NOT_FOUND & ERRCODE_RES_MASK + { + Text = "Objekt hat diese Methode nicht" ; + Text [ ENGLISH ] = "Object does not have method" ; + Text [ norwegian ] = "Object does not have method" ; + Text [ italian ] = "L'oggetto non dispone di questo metodo" ; + Text [ portuguese_brazilian ] = "Object does not have method" ; + Text [ portuguese ] = "O objecto não dispõe deste método" ; + Text [ french ] = "L'objet ne possède pas cette méthode" ; + Text [ dutch ] = "Object kent deze methode niet" ; + Text [ spanish ] = "El objeto no tiene este método" ; + Text [ danish ] = "Objekt har ikke denne metode" ; + Text [ swedish ] = "Objektet har inte denna metod" ; + Text [ finnish ] = "Object does not have method" ; + Text [ english_us ] = "Object does not have this method" ; + Text[ chinese_simplified ] = "¶ÔÏ󲻾߱¸Õâ¸ö·½·¨"; + Text[ russian ] = "Ó îáúåêòà íåò ýòîãî ìåòîäà"; + Text[ polish ] = "Obiekt nie ma tej metody"; + Text[ japanese ] = "µÌÞ¼Þª¸Ä‚É‚±‚ÌÒ¿¯ÄÞ‚Í‚ ‚è‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "ª«¥ó¤£¨ã³Æ³oÓ¤èªk"; + Text[ arabic ] = "áíÓ ááßÇÆä åÐÇ ÇáÃÓáæÈ"; + Text[ dutch ] = "Object kent deze methode niet"; + Text[ chinese_simplified ] = "¶ÔÏ󲻾߱¸Õâ¸ö·½·¨"; + Text[ greek ] = "Ôï áíôéêåßìåíï äåí Ý÷åé áõôÞ ôç ìÝèïäï"; + Text[ korean ] = "°³Ã¼°¡ ÀÌ ¸Þ¼Òµå¸¦ °¡Áö°í ÀÖÁö ¾Ê½À´Ï´Ù."; + Text[ turkish ] = "Nesne bu yönteme sahip deðil"; + Text[ language_user1 ] = " "; + }; + String SbERR_ARG_MISSING & ERRCODE_RES_MASK + { + Text = "Erforderliches Argument fehlt" ; + Text [ ENGLISH ] = "Missing required argument" ; + Text [ norwegian ] = "Missing required argument" ; + Text [ italian ] = "L'argomento richiesto manca" ; + Text [ portuguese_brazilian ] = "Missing required argument" ; + Text [ portuguese ] = "Falta o argumento necessário" ; + Text [ french ] = "L'argument requis fait défaut" ; + Text [ dutch ] = "Noordzakelijk argument ontbreekt" ; + Text [ spanish ] = "Falta el argumento requerido" ; + Text [ danish ] = "Påkrævet argument mangler" ; + Text [ swedish ] = "Nödvändigt argument saknas" ; + Text [ finnish ] = "Missing required argument" ; + Text [ english_us ] = "Required argument lacking" ; + Text[ chinese_simplified ] = "ȱÉÙ±ØÒªµÄ×Ô±äÁ¿"; + Text[ russian ] = "Íåõâàòêà íåîáõîäèìîãî àðãóìåíòà"; + Text[ polish ] = "Brakuje wymaganego argumentu"; + Text[ japanese ] = "•K—v‚Ȉø”‚ª‘«‚è‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "¯Ê¤Ö¥²nªº¦ÛÅܶq"; + Text[ arabic ] = "ÇáæÓíØÉ ÇáãØáæÈÉ ÛíÑ ãÊÇÍÉ"; + Text[ dutch ] = "Noordzakelijk argument ontbreekt"; + Text[ chinese_simplified ] = "ȱÉÙ±ØÒªµÄ×Ô±äÁ¿"; + Text[ greek ] = "Ëåßðåé áðáéôïýìåíï üñéóìá"; + Text[ korean ] = "¿äûµÈ µ¶¸³º¯¼ö°¡ ¾ø½À´Ï´Ù"; + Text[ turkish ] = "Gerekli argüman eksik"; + Text[ language_user1 ] = " "; + }; + String SbERR_BAD_NUMBER_OF_ARGS & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Ung³ltige Anzahl von Argumenten : Ungltige Anzahl von Argumenten */ + Text = "Ungültige Anzahl von Argumenten" ; + Text [ ENGLISH ] = "Invalid number of arguments" ; + Text [ norwegian ] = "Invalid number of arguments" ; + Text [ italian ] = "Numero di argomenti non valido" ; + Text [ portuguese_brazilian ] = "Invalid number of arguments" ; + Text [ portuguese ] = "Número de argumentos incorrecto" ; + Text [ french ] = "Nombre d'arguments incorrect" ; + Text [ dutch ] = "Ongeldig aantal argumenten" ; + Text [ spanish ] = "Número de argumentos no válido" ; + Text [ danish ] = "Ugyldigt antal argumenter" ; + Text [ swedish ] = "Ogiltigt antal argument" ; + Text [ finnish ] = "Invalid number of arguments" ; + Text [ english_us ] = "Invalid number of arguments" ; + Text[ chinese_simplified ] = "ÎÞЧµÄ×Ô±äÁ¿ÊýÄ¿"; + Text[ russian ] = "Íåïðàâèëüíîå êîëè÷åñòâî àðãóìåíòîâ"; + Text[ polish ] = "Nieprawid³owa iloœæ argumentów"; + Text[ japanese ] = "ˆø”‚Ì”‚É–â‘肪‚ ‚è‚Ü‚·"; + Text[ chinese_traditional ] = "¦ÛÅܶq¼Æ¥ØµL®Ä"; + Text[ arabic ] = "ÚÏÏ æÓÇÆØ ÛíÑ ÕÇáÍ"; + Text[ dutch ] = "Ongeldig aantal argumenten"; + Text[ chinese_simplified ] = "ÎÞЧµÄ×Ô±äÁ¿ÊýÄ¿"; + Text[ greek ] = "ËÜèïò ðëÞèïò ïñéóìÜôùí"; + Text[ korean ] = "µ¶¸³º¯¼ö °³¼ö°¡ À¯È¿ÇÏÁö ¾ÊÀ½"; + Text[ turkish ] = "Argüman sayýsý geçersiz"; + Text[ language_user1 ] = " "; + }; + String SbERR_METHOD_FAILED & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Fehler in Ausf³hrung einer Methode : Fehler in Ausfhrung einer Methode */ + Text = "Fehler in Ausführung einer Methode" ; + Text [ ENGLISH ] = "Method failed" ; + Text [ norwegian ] = "Method failed" ; + Text [ italian ] = "Errore nell'esecuzione di un metodo" ; + Text [ portuguese_brazilian ] = "Method failed" ; + Text [ portuguese ] = "Erro ao executar método" ; + Text [ french ] = "Erreur dans l'exécution d'une méthode" ; + Text [ dutch ] = "Fout in uitvoering van een methode" ; + Text [ spanish ] = "Error al ejecutar un método" ; + Text [ danish ] = "Fejl ved udførelsen af en metode" ; + Text [ swedish ] = "Fel vid utförandet av en metod" ; + Text [ finnish ] = "Method failed" ; + Text [ english_us ] = "Error executing a method" ; + Text[ chinese_simplified ] = "ÔËÐз½·¨Ê±·¢Éú´íÎó"; + Text[ russian ] = "Îøèáêà â âûïîëíåíèè ìåòîäà"; + Text[ polish ] = "B³¹d w wykonywaniu metody"; + Text[ japanese ] = "Ò¿¯ÄÞŽÀs’†‚Ì´×°"; + Text[ chinese_traditional ] = "¹B¦æ¤èªk®Éµo¥Í¿ù»~"; + Text[ arabic ] = "ÎØÃ Ýí ÊäÝíÐ ÇáÃÓáæÈ"; + Text[ dutch ] = "Fout in uitvoering van een methode"; + Text[ chinese_simplified ] = "ÔËÐз½·¨Ê±·¢Éú´íÎó"; + Text[ greek ] = "ÓöÜëìá êáôÜ ôçí åöáñìïãÞ ìéáò ìåèüäïõ"; + Text[ korean ] = "¸Þ¼Òµå ½ÇÇà ¿À·ù"; + Text[ turkish ] = "Yöntemin yürütülmesinde hata"; + Text[ language_user1 ] = " "; + }; + String SbERR_SETPROP_FAILED & ERRCODE_RES_MASK + { + Text = "Eigenschaft konnte nicht festgelegt werden" ; + Text [ ENGLISH ] = "Unable to set property" ; + Text [ norwegian ] = "Unable to set property" ; + Text [ italian ] = "Impossibile impostare la proprietà" ; + Text [ portuguese_brazilian ] = "Unable to set property" ; + Text [ portuguese ] = "Foi impossível definir propriedade" ; + Text [ french ] = "Impossible de définir la propriété" ; + Text [ dutch ] = "Eigenschap kon niet worden gedefinieerd" ; + Text [ spanish ] = "No se pudo determinar la propiedad" ; + Text [ danish ] = "Det var ikke muligt at definere egenskaben" ; + Text [ swedish ] = "Egenskap kunde inte definieras" ; + Text [ finnish ] = "Unable to set property" ; + Text [ english_us ] = "Unable to set property" ; + Text[ chinese_simplified ] = "ÎÞ·¨È·¶¨ÊôÐÔ"; + Text[ russian ] = "Ñâîéñòâî óñòàíîâèòü íåâîçìîæíî"; + Text[ polish ] = "W³aœciwoœæ nie mog³a zostaæ zdefiniowana"; + Text[ japanese ] = "‘®«‚ÍŽw’è‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½"; + Text[ chinese_traditional ] = "µLªk½T©wÄÝ©Ê"; + Text[ arabic ] = "ÊÚÐÑ ÊÚííä ÇáÎÇÕíÉ"; + Text[ dutch ] = "Eigenschap kon niet worden gedefinieerd"; + Text[ chinese_simplified ] = "ÎÞ·¨È·¶¨ÊôÐÔ"; + Text[ greek ] = "Äåí Þôáí äõíáôüí íá ïñéóôåß áõôÞ ç éäéüôçôá"; + Text[ korean ] = "ÇÁ·ÎÆÛƼ ¼³Á¤À» ÇÒ¼ö ¾ø½À´Ï´Ù."; + Text[ turkish ] = "Özellik tanýmlanamadý"; + Text[ language_user1 ] = " "; + }; + String SbERR_GETPROP_FAILED & ERRCODE_RES_MASK + { + Text = "Eigenschaft konnte nicht ermittelt werden" ; + Text [ ENGLISH ] = "Unable to get property" ; + Text [ norwegian ] = "Unable to get property" ; + Text [ italian ] = "Impossibile individuare la proprietà" ; + Text [ portuguese_brazilian ] = "Unable to get property" ; + Text [ portuguese ] = "Foi impossível determinar a propriedade" ; + Text [ french ] = "Impossible de déterminer la propriété" ; + Text [ dutch ] = "Eigenschap kon niet worden vastgesteld" ; + Text [ spanish ] = "No se pudo determinar la propiedad" ; + Text [ danish ] = "Det var ikke muligt at bestemme egenskaben" ; + Text [ swedish ] = "Egenskaperna kunde inte bestämmas" ; + Text [ finnish ] = "Unable to get property" ; + Text [ english_us ] = "Unable to determine property" ; + Text[ chinese_simplified ] = "ÎÞ·¨¶Á³öÊôÐÔ"; + Text[ russian ] = "Ñâîéñòâî îïðåäåëèòü íåâîçìîæíî"; + Text[ polish ] = "W³aœciwoœæ nie mog³a zostaæ zdefiniowana"; + Text[ japanese ] = "‘®«‚ÍŠm‚©‚߂邱‚Æ‚ª‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½"; + Text[ chinese_traditional ] = "µLªkŪ¥XÄÝ©Ê"; + Text[ arabic ] = "ÊÚÐÑ ÊÍÏíÏ ÇáÎÇÕíÉ"; + Text[ dutch ] = "Eigenschap kon niet worden vastgesteld"; + Text[ chinese_simplified ] = "ÎÞ·¨¶Á³öÊôÐÔ"; + Text[ greek ] = "Äåí Þôáí äõíáôüí íá åîáêñéâùèåß ç éäéüôçôá"; + Text[ korean ] = "ÇÁ·ÎÆÛƼ °áÁ¤À» ÇÒ¼ö ¾ø½À´Ï´Ù."; + Text[ turkish ] = "Özellik belirlenemedi"; + Text[ language_user1 ] = " "; + }; + // Compiler errors. These are not runtime errors. + String SbERR_UNEXPECTED & ERRCODE_RES_MASK + { + Text = "Unerwartetes Symbol: $(ARG1)" ; + Text [ ENGLISH ] = "Unexpected symbol: $(ARG1)" ; + Text [ norwegian ] = "Unexpected symbol: $(ARG1)" ; + Text [ italian ] = "Simbolo inatteso: $(ARG1)" ; + Text [ portuguese_brazilian ] = "Unexpected symbol: $(ARG1)" ; + Text [ portuguese ] = "Símbolo inesperado: $(ARG1)" ; + Text [ french ] = "Symbole imprévu : $(ARG1)" ; + Text [ dutch ] = "Onverwacht symbool: $(ARG1)" ; + Text [ spanish ] = "Símbolo inesperado: $(ARG1)" ; + Text [ danish ] = "Uventet symbol: $(ARG1)" ; + Text [ swedish ] = "Oväntad symbol: $(ARG1)" ; + Text [ finnish ] = "Unexpected symbol: $(ARG1)" ; + Text [ english_us ] = "Unexpected symbol: $(ARG1)" ; + Text[ chinese_simplified ] = "ÒâÍâµÄͼ±ê£º$(ARG1)"; + Text[ russian ] = "Íåïðåäâèäåííûé ñèìâîë: $(ARG1)"; + Text[ polish ] = "Nieoczekiwany symbol: $(ARG1)"; + Text[ japanese ] = "•s“K“–‚ȼÝÎÞÙ: $(ARG1)"; + Text[ chinese_traditional ] = "·N¥~ªº¹Ï¥Ü¡G$(ARG1)"; + Text[ arabic ] = "$(ARG1) :ÑãÒ ÛíÑ ãÊæÞÚ"; + Text[ dutch ] = "Onverwacht symbool: $(ARG1)"; + Text[ chinese_simplified ] = "ÒâÍâµÄͼ±ê£º$(ARG1)"; + Text[ greek ] = "Ìç áíáìåíüìåíï óýìâïëï: $(ARG1)"; + Text[ korean ] = "¿¹ÃøµÇÁö ¾ÊÀº ±âÈ£ : $(ARG1)"; + Text[ turkish ] = "Beklenmeyen simge: $(ARG1)"; + Text[ language_user1 ] = " "; + }; + String SbERR_EXPECTED & ERRCODE_RES_MASK + { + Text = "Erwartet: $(ARG1)" ; + Text [ ENGLISH ] = "Expected: $(ARG1)" ; + Text [ norwegian ] = "Expected: $(ARG1)" ; + Text [ italian ] = "Atteso: $(ARG1)" ; + Text [ portuguese_brazilian ] = "Expected: $(ARG1)" ; + Text [ portuguese ] = "Esperado: $(ARG1)" ; + Text [ french ] = "Requis : $(ARG1)" ; + Text [ dutch ] = "Verwacht: $(ARG1)" ; + Text [ spanish ] = "Se espera: $(ARG1)" ; + Text [ danish ] = "Forventet: $(ARG1)" ; + Text [ swedish ] = "Förväntad: $(ARG1)" ; + Text [ finnish ] = "Expected: $(ARG1)" ; + Text [ english_us ] = "Expected: $(ARG1)" ; + Text[ chinese_simplified ] = "µÈ´ý£º$(ARG1)"; + Text[ russian ] = "Ïðåäâèäèòñÿ: $(ARG1)"; + Text[ polish ] = "Oczekiwany: $(ARG1)"; + Text[ japanese ] = "•K—v€–Ú: $(ARG1)"; + Text[ chinese_traditional ] = "µ¥«Ý¡G$(ARG1)"; + Text[ arabic ] = "$(ARG1) :ãÊæÞÚ"; + Text[ dutch ] = "Verwacht: $(ARG1)"; + Text[ chinese_simplified ] = "µÈ´ý£º$(ARG1)"; + Text[ greek ] = "ÁíáìÝíåôáé: $(ARG1)"; + Text[ korean ] = "¿¹ÃøµÈ: $(ARG1)"; + Text[ turkish ] = "Beklenen: $(ARG1)"; + Text[ language_user1 ] = " "; + }; + String SbERR_SYMBOL_EXPECTED & ERRCODE_RES_MASK + { + Text = "Symbol erwartet" ; + Text [ ENGLISH ] = "Symbol expected" ; + Text [ norwegian ] = "Symbol expected" ; + Text [ italian ] = "Simbolo atteso" ; + Text [ portuguese_brazilian ] = "Symbol expected" ; + Text [ portuguese ] = "Símbolo esperado" ; + Text [ french ] = "Symbole requis" ; + Text [ dutch ] = "Symbool verwacht" ; + Text [ spanish ] = "Símbolo esperado" ; + Text [ danish ] = "Symbol forventes" ; + Text [ swedish ] = "Symbol förväntad" ; + Text [ finnish ] = "Symbol expected" ; + Text [ english_us ] = "Symbol expected" ; + Text[ chinese_simplified ] = "µÈ´ýͼ±ê"; + Text[ russian ] = "Ïðåäâèäåííûé ñèìâîë"; + Text[ polish ] = "Oczekiwany symbol"; + Text[ japanese ] = "¼ÝÎÞÙ‚ª•K—v‚Å‚·"; + Text[ chinese_traditional ] = "µ¥«Ý¹Ï¥Ü"; + Text[ arabic ] = "ãÊæÞÚ ÑãÒ"; + Text[ dutch ] = "Symbool verwacht"; + Text[ chinese_simplified ] = "µÈ´ýͼ±ê"; + Text[ greek ] = "ÁíáìÝíåôáé óýìâïëï"; + Text[ korean ] = "¿¹ÃøµÈ ±âÈ£"; + Text[ turkish ] = "Simge bekleniyor"; + Text[ language_user1 ] = " "; + }; + String SbERR_VAR_EXPECTED & ERRCODE_RES_MASK + { + Text = "Variable erwartet" ; + Text [ ENGLISH ] = "Variable expected" ; + Text [ norwegian ] = "Variable expected" ; + Text [ italian ] = "Variabile attesa" ; + Text [ portuguese_brazilian ] = "Variable expected" ; + Text [ portuguese ] = "Variável esperada" ; + Text [ french ] = "Variable requise" ; + Text [ dutch ] = "Variabele verwacht" ; + Text [ spanish ] = "Se requiere una variable" ; + Text [ danish ] = "Variabel forventes" ; + Text [ swedish ] = "Variabel förväntad" ; + Text [ finnish ] = "Variable expected" ; + Text [ english_us ] = "Variable expected" ; + Text[ chinese_simplified ] = "µÈ´ý±äÁ¿"; + Text[ russian ] = "Ïðåäâèäåííàÿ ïåðåìåííàÿ"; + Text[ polish ] = "Zmienna oczekiwana"; + Text[ japanese ] = "•Ï”‚ª•K—v‚Å‚·"; + Text[ chinese_traditional ] = "µ¥«ÝÅܶq"; + Text[ arabic ] = "ãÊæÞÚ ãÊÛíÑÉ"; + Text[ dutch ] = "Variabele verwacht"; + Text[ chinese_simplified ] = "µÈ´ý±äÁ¿"; + Text[ greek ] = "ÁíáìÝíåôáé ìåôáâëçôÞ"; + Text[ korean ] = "¿¹ÃøµÈ º¯¼ö"; + Text[ turkish ] = "Deðiþken bekleniyor"; + Text[ language_user1 ] = " "; + }; + String SbERR_LABEL_EXPECTED & ERRCODE_RES_MASK + { + Text = "Label erwartet" ; + Text [ ENGLISH ] = "Label expected" ; + Text [ norwegian ] = "Label expected" ; + Text [ italian ] = "Label attesa" ; + Text [ portuguese_brazilian ] = "Label expected" ; + Text [ portuguese ] = "Etiqueta esperada" ; + Text [ french ] = "Étiquette requise" ; + Text [ dutch ] = "Label verwacht" ; + Text [ spanish ] = "Se requiere una etiqueta" ; + Text [ danish ] = "Etiket forventes" ; + Text [ swedish ] = "Etikett förväntad" ; + Text [ finnish ] = "Label expected" ; + Text [ english_us ] = "Label expected" ; + Text[ chinese_simplified ] = "µÈ´ý±êºÅ"; + Text[ russian ] = "Îæèäàåòñÿ ýòèêåòà"; + Text[ polish ] = "Oczekiwana etykieta"; + Text[ japanese ] = "×ÍÞÙ‚ª•K—v‚Å‚·"; + Text[ chinese_traditional ] = "µ¥«Ý¼Ð¸¹"; + Text[ arabic ] = "ãÊæÞÚ ÈØÇÞÉ ÚäæäÉ"; + Text[ dutch ] = "Label verwacht"; + Text[ chinese_simplified ] = "µÈ´ý±êºÅ"; + Text[ greek ] = "Áðáéôåßôáé åðéãñáöÞ"; + Text[ korean ] = "¿¹ÃøµÈ ¶óº§"; + Text[ turkish ] = "Etiket bekleniyor"; + Text[ language_user1 ] = " "; + }; + String SbERR_LVALUE_EXPECTED & ERRCODE_RES_MASK + { + Text = "Wert kann nicht zugewiesen werden" ; + Text [ ENGLISH ] = "Cannot set value" ; + Text [ norwegian ] = "Cannot set value" ; + Text [ italian ] = "Impossibile attribuitre il valore" ; + Text [ portuguese_brazilian ] = "Cannot set value" ; + Text [ portuguese ] = "Impossível atribuir o valor" ; + Text [ french ] = "Impossible d'attribuer la valeur" ; + Text [ dutch ] = "Waarde kan niet worden toegewezen" ; + Text [ spanish ] = "No se puede asignar el valor" ; + Text [ danish ] = "Værdien kan ikke tildeles" ; + Text [ swedish ] = "Värdet kan inte tilldelas" ; + Text [ finnish ] = "Cannot set value" ; + Text [ english_us ] = "Value cannot be applied" ; + Text[ chinese_simplified ] = "ÎÞ·¨Ö¸¶¨ÊýÖµ"; + Text[ russian ] = "Ïðèìåíèòü çííà÷åíèå íåâîçìîæíî"; + Text[ polish ] = "Nie mo¿na zastosowaæ wartoœci"; + Text[ japanese ] = "”’l‚ÍŠ„‚è“–‚Ä‚ç‚ê‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "µLªk«ü©w¼ÆÈ"; + Text[ arabic ] = "áÇ íãßä ÊØÈíÞ ÇáÞíãÉ"; + Text[ dutch ] = "Waarde kan niet worden toegewezen"; + Text[ chinese_simplified ] = "ÎÞ·¨Ö¸¶¨ÊýÖµ"; + Text[ greek ] = "Äåí åßíáé äõíáôüí íá ãßíåé åöáñìïãÞ ôçò ôéìÞò"; + Text[ korean ] = "°ªÀÌ Àû¿ëµÉ ¼ö ¾ø½À´Ï´Ù."; + Text[ turkish ] = "Deðer atanamýyor"; + Text[ language_user1 ] = " "; + }; + String SbERR_VAR_DEFINED & ERRCODE_RES_MASK + { + Text = "Variable $(ARG1) bereits definiert" ; + Text [ ENGLISH ] = "Variable $(ARG1) already defined" ; + Text [ norwegian ] = "Variable $(ARG1) already defined" ; + Text [ italian ] = "Variabile $(ARG1) già definita" ; + Text [ portuguese_brazilian ] = "Variable $(ARG1) already defined" ; + Text [ portuguese ] = "Variável $(ARG1) já definida" ; + Text [ french ] = "La variable $(ARG1) est déjà définie" ; + Text [ dutch ] = "Variabele $(ARG1) reeds gedefinieerd" ; + Text [ spanish ] = "La variable $(ARG1) ya se ha definido" ; + Text [ danish ] = "Variabel $(ARG1) er allerede defineret" ; + Text [ swedish ] = "Variabeln $(ARG1) är redan definierad" ; + Text [ finnish ] = "Variable $(ARG1) already defined" ; + Text [ english_us ] = "Variable $(ARG1) already defined" ; + Text[ chinese_simplified ] = "ÒѾ¶¨ÒåÁ˱äÁ¿ $(ARG1)"; + Text[ russian ] = "Ïåðåìåííàÿ $(ARG1) óæå îïðåäåëåíà"; + Text[ polish ] = "Zmienna $(ARG1) ju¿ zdefiniowana"; + Text[ japanese ] = "•Ï”$(ARG1)‚Í‚·‚łɒè‹`‚³‚ê‚Ä‚¢‚Ü‚·"; + Text[ chinese_traditional ] = "¤w¸g©w¸q¤FÅܶq $(ARG1)"; + Text[ arabic ] = "ÇáãÊÛíÑÉ $(ARG1) ãÚÑøÝÉ ãÓÈÞÇð"; + Text[ dutch ] = "Variabele $(ARG1) reeds gedefinieerd"; + Text[ chinese_simplified ] = "ÒѾ¶¨ÒåÁ˱äÁ¿ $(ARG1)"; + Text[ greek ] = "Ç ìåôáâëçôÞ $(ARG1) Ý÷åé Þäç ïñéóôåß"; + Text[ korean ] = "º¯¼ö$(ARG1)´Â ÀÌ¹Ì Á¤ÀǵǾîÀÖ½À´Ï´Ù."; + Text[ turkish ] = "Deðiþken $(ARG1) tanýmlanmýþ durumda"; + Text[ language_user1 ] = " "; + }; + String SbERR_PROC_DEFINED & ERRCODE_RES_MASK + { + Text = "Sub- oder Function-Prozedur $(ARG1) bereits definiert" ; + Text [ ENGLISH ] = "Procedure $(ARG1) already defined" ; + Text [ norwegian ] = "Procedure $(ARG1) already defined" ; + Text [ italian ] = "Procedura subordinata o di funzione $(ARG1) già definita" ; + Text [ portuguese_brazilian ] = "Procedure $(ARG1) already defined" ; + Text [ portuguese ] = "Procedimento subordinado ou de função $(ARG1) já definidos" ; + Text [ french ] = "La sous-procédure ou procédure fonctionnelle $(ARG1) est déjà définie" ; + Text [ dutch ] = "Sub- of functieprocedure $(ARG1) reeds gedefinieerd" ; + Text [ spanish ] = "El procedimiento de función o subordinado $(ARG1) ya está definido" ; + Text [ danish ] = "Under- eller funktionsprocedure $(ARG1) er allerede defineret" ; + Text [ swedish ] = "Sub- eller funktionsproceduren $(ARG1) är redan definierad" ; + Text [ finnish ] = "Procedure $(ARG1) already defined" ; + Text [ english_us ] = "Sub procedure or function procedure $(ARG1) already defined" ; + Text[ chinese_simplified ] = "ÒѾ¶¨ÒåÁË·Ö¹ý³Ì»òº¯Êý¹ý³Ì $(ARG1)"; + Text[ russian ] = "Ïîäïðîöåäóðà èëè ïðîöåäóðà ôóíêöèè $(ARG1) óæå îïðåäåëåíà"; + Text[ polish ] = "Procedura podrzêdna lub funkcyjna ju¿ zosta³a zdefiniowana $(ARG1)"; + Text[ japanese ] = "Sub‚Ü‚½‚ÍFunctionÌßÛ¼°¼Þ¬$(ARG1)‚Í‚·‚łɒè‹`‚³‚ê‚Ä‚¢‚Ü‚·"; + Text[ chinese_traditional ] = "¤w¸g©w¸q¤F¤À¹Lµ{©Î¨ç¼Æ¹Lµ{$(ARG1)"; + Text[ arabic ] = "ãÚÑøÝ ãÓÈÞÇð $(ARG1) ÅÌÑÇÁ ÇáÏÇáÉ Ãæ ÇáÅÌÑÇÁ ÇáÝÑÚí"; + Text[ dutch ] = "Sub- of functieprocedure $(ARG1) reeds gedefinieerd"; + Text[ chinese_simplified ] = "ÒѾ¶¨ÒåÁË·Ö¹ý³Ì»òº¯Êý¹ý³Ì $(ARG1)"; + Text[ greek ] = "Ç äéáäéêáóßá õðü (Sub) Þ ëåéôïõñãßáò (Function) $(ARG1) ïñßóôçêå Þäç"; + Text[ korean ] = "¼ºê ¶Ç´Â ÇÔ¼ö ÇÁ·Î½ÃÁ® $(ARG1) °¡ ÀÌ¹Ì Á¤ÀÇ µÇ¾îÀÖ½À´Ï´Ù"; + Text[ turkish ] = "Alt yordam ya da iþlev yordamý $(ARG1) tanýmlanmýþ durumda"; + Text[ language_user1 ] = " "; + }; + String SbERR_LABEL_DEFINED & ERRCODE_RES_MASK + { + Text = "Label $(ARG1) bereits definiert" ; + Text [ ENGLISH ] = "Label $(ARG1) already defined" ; + Text [ norwegian ] = "Label $(ARG1) already defined" ; + Text [ italian ] = "Label $(ARG1) già definita" ; + Text [ portuguese_brazilian ] = "Label $(ARG1) already defined" ; + Text [ portuguese ] = "Etiqueta $(ARG1) já foi definida" ; + Text [ french ] = "L'étiquette $(ARG1) est déjà définie" ; + Text [ dutch ] = "Label $(ARG1) reeds gedefinieerd" ; + Text [ spanish ] = "La etiqueta $(ARG1) ya está definida" ; + Text [ danish ] = "Etiket $(ARG1) er allerede defineret" ; + Text [ swedish ] = "Etiketten $(ARG1) är redan definierad" ; + Text [ finnish ] = "Label $(ARG1) already defined" ; + Text [ english_us ] = "Label $(ARG1) already defined" ; + Text[ chinese_simplified ] = "ÒѾ¶¨ÒåÁ˱ê¼Ç $(ARG1)"; + Text[ russian ] = "Ýòèêåòà $(ARG1) óæå îïðåäåëåíà"; + Text[ polish ] = "Etykieta $(ARG1) zosta³a ju¿ zdefiniowana"; + Text[ japanese ] = "×ÍÞÙ$(ARG1)‚Í‚·‚łɒè‹`‚³‚ê‚Ä‚¢‚Ü‚·"; + Text[ chinese_traditional ] = "¤w¸g©w¸q¤F¼Ð°O$(ARG1)"; + Text[ arabic ] = "ãÚÑøÝÉ ãÓÈÞÇð $(ARG1) ÇáÚäæäÉ"; + Text[ dutch ] = "Label $(ARG1) reeds gedefinieerd"; + Text[ chinese_simplified ] = "ÒѾ¶¨ÒåÁ˱ê¼Ç $(ARG1)"; + Text[ greek ] = "Ç åðéãñáöÞ $(ARG1) ïñßóôçêå Þäç"; + Text[ korean ] = "¶óº§ $(ARG1) ÀÌ ÀÌ¹Ì Á¤ÀÇ µÇ¾îÀÖ½À´Ï´Ù."; + Text[ turkish ] = "Etiket $(ARG1) tanýmlanmýþ durumda"; + Text[ language_user1 ] = " "; + }; + String SbERR_UNDEF_VAR & ERRCODE_RES_MASK + { + Text = "Variable $(ARG1) nicht gefunden" ; + Text [ ENGLISH ] = "Variable $(ARG1) not found" ; + Text [ norwegian ] = "Variable $(ARG1) not found" ; + Text [ italian ] = "Variabile $(ARG1) non trovata" ; + Text [ portuguese_brazilian ] = "Variable $(ARG1) not found" ; + Text [ portuguese ] = "Variável $(ARG1) não encontrada" ; + Text [ french ] = "Variable $(ARG1) introuvable" ; + Text [ dutch ] = "Variabele $(ARG1) niet gevonden" ; + Text [ spanish ] = "No se encontró la variable $(ARG1)" ; + Text [ danish ] = "Variabel $(ARG1) blev ikke fundet" ; + Text [ swedish ] = "Variabeln $(ARG1) hittades inte" ; + Text [ finnish ] = "Variable $(ARG1) not found" ; + Text [ english_us ] = "Variable $(ARG1) not found" ; + Text[ chinese_simplified ] = "ûÓÐÕÒµ½±äÁ¿ $(ARG1)"; + Text[ russian ] = "Ïåðåìåííàÿ $(ARG1) íå íàéäåíà"; + Text[ polish ] = "Zmiennej $(ARG1) nie znaleziono"; + Text[ japanese ] = "•Ï”$(ARG1)‚ÍŒ©‚‚©‚è‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "¨S¦³§ä¨ìÅܶq$(ARG1)"; + Text[ arabic ] = "áã íÊã ÇáÚ辄 Úáì ÇáãÊÛííÑÉ$(ARG1) "; + Text[ dutch ] = "Variabele $(ARG1) niet gevonden"; + Text[ chinese_simplified ] = "ûÓÐÕÒµ½±äÁ¿ $(ARG1)"; + Text[ greek ] = "Ç ìåôáâëçôÞ $(ARG1) äåí âñÝèçêå"; + Text[ korean ] = "º¯¼ö $(ARG1) °¡ ¹ß°ßµÇÁö ¾Ê¾Ò½À´Ï´Ù."; + Text[ turkish ] = "Deðiþken $(ARG1) bulunamadý"; + Text[ language_user1 ] = " "; + }; + String SbERR_UNDEF_ARRAY & ERRCODE_RES_MASK + { + Text = "Array oder Prozedur $(ARG1) nicht gefunden" ; + Text [ ENGLISH ] = "Array or function $(ARG1) not found" ; + Text [ norwegian ] = "Array or function $(ARG1) not found" ; + Text [ italian ] = "Array o procedura $(ARG1) non trovata" ; + Text [ portuguese_brazilian ] = "Array or function $(ARG1) not found" ; + Text [ portuguese ] = "Matriz ou função $(ARG1) não encontrados" ; + Text [ french ] = "Array ou procédure $(ARG1) introuvable" ; + Text [ dutch ] = "Array of procedure $(ARG1) niet gevonden" ; + Text [ spanish ] = "No se encontró la matriz o procedimiento $(ARG1)" ; + Text [ danish ] = "Array eller procedure $(ARG1) blev ikke fundet" ; + Text [ swedish ] = "Array eller procedur $(ARG1) hittades inte" ; + Text [ finnish ] = "Array or function $(ARG1) not found" ; + Text [ english_us ] = "Array or procedure $(ARG1) not found" ; + Text[ chinese_simplified ] = "ûÓÐÕÒµ½Êý×é»ò¹ý³Ì $(ARG1)"; + Text[ russian ] = "Ìàññèâ èëè ïðîöåäóðà $(ARG1) íå íàéäåíû"; + Text[ polish ] = "Tablicy lub procedury $(ARG1) nie znaleziono"; + Text[ japanese ] = "”z—ñ‚Ü‚½‚ÍÌßÛ¼°¼Þ¬$(ARG1)‚ÍŒ©‚‚©‚è‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "¨S¦³§ä¨ì¦æ¦C©Î¹Lµ{$(ARG1)"; + Text[ arabic ] = "$(ARG1) áã íÊã ÇáÚ辄 Úáì ÇáÕÝíÝ Ãæ ÇáÅÌÑÇÁ"; + Text[ dutch ] = "Array of procedure $(ARG1) niet gevonden"; + Text[ chinese_simplified ] = "ûÓÐÕÒµ½Êý×é»ò¹ý³Ì $(ARG1)"; + Text[ greek ] = "Äåí âñÝèçêå ç ìÞôñá Þ ç äéáäéêáóßá $(ARG1)"; + Text[ korean ] = "¹è¿ ¶Ç´Â ÇÔ¼ö $(ARG1) °¡ ¹ß°ßµÇÁö ¾Ê¾Ò½À´Ï´Ù. "; + Text[ turkish ] = "Dizi ya da yordam $(ARG1) bulunamadý"; + Text[ language_user1 ] = " "; + }; + String SbERR_UNDEF_PROC & ERRCODE_RES_MASK + { + Text = "Procedure $(ARG1) nicht gefunden" ; + Text [ ENGLISH ] = "Procedure $(ARG1) not found" ; + Text [ norwegian ] = "Procedure $(ARG1) not found" ; + Text [ italian ] = "Procedura $(ARG1) non trovata" ; + Text [ portuguese_brazilian ] = "Procedure $(ARG1) not found" ; + Text [ portuguese ] = "Procedimento $(ARG1) não encontrado" ; + Text [ french ] = "Procédure $(ARG1) introuvable" ; + Text [ dutch ] = "Procedure $(ARG1) niet gevonden" ; + Text [ spanish ] = "No se encontró el procedimiento $(ARG1)" ; + Text [ danish ] = "Procedure $(ARG1) blev ikke fundet" ; + Text [ swedish ] = "Proceduren $(ARG1) hittades inte" ; + Text [ finnish ] = "Procedure $(ARG1) not found" ; + Text [ english_us ] = "Procedure $(ARG1) not found" ; + Text[ chinese_simplified ] = "ûÓÐÕÒµ½¹ý³Ì $(ARG1)"; + Text[ russian ] = "Ïðîöåäóðà $(ARG1) íå íàéäåíà"; + Text[ polish ] = "Procedury $(ARG1) nie znaleziono"; + Text[ japanese ] = "ÌßÛ¼°¼Þ¬$(ARG1)‚ÍŒ©‚‚©‚è‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "¨S¦³§ä¨ì¹Lµ{$(ARG1)"; + Text[ arabic ] = "$(ARG1) áã íÊã ÇáÚ辄 Úáì ÇáÅÌÑÇÁ"; + Text[ dutch ] = "Procedure $(ARG1) niet gevonden"; + Text[ chinese_simplified ] = "ûÓÐÕÒµ½¹ý³Ì $(ARG1)"; + Text[ greek ] = "Ç äéáäéêáóßá $(ARG1) äåí âñÝèçêå"; + Text[ korean ] = "ÇÁ·Î½ÃÀú $(ARG1) °¡ ¹ß°ßµÇÁö ¾Ê¾Ò½À´Ï´Ù."; + Text[ turkish ] = "Yordam $(ARG1) bulunamadý"; + Text[ language_user1 ] = " "; + }; + String SbERR_UNDEF_LABEL & ERRCODE_RES_MASK + { + Text = "Label $(ARG1) undefiniert" ; + Text [ ENGLISH ] = "Label $(ARG1) undefined" ; + Text [ norwegian ] = "Label $(ARG1) undefined" ; + Text [ italian ] = "Label $(ARG1) non definita" ; + Text [ portuguese_brazilian ] = "Label $(ARG1) undefined" ; + Text [ portuguese ] = "Rótulo $(ARG1) indefinido" ; + Text [ french ] = "L'étiquette $(ARG1) n'est pas définie" ; + Text [ dutch ] = "Label $(ARG1) ongedefinieerd" ; + Text [ spanish ] = "La etiqueta $(ARG1) no está definida" ; + Text [ danish ] = "Etket $(ARG1) er udefineret" ; + Text [ swedish ] = "Etiketten $(ARG1) är odefinierad" ; + Text [ finnish ] = "Label $(ARG1) undefined" ; + Text [ english_us ] = "Label $(ARG1) undefined" ; + Text[ chinese_simplified ] = "ÉÐ䶨Òå±ê¼Ç $(ARG1)"; + Text[ russian ] = "Ýòèêåòà $(ARG1) íåîïðåäåëåíà"; + Text[ polish ] = "Etykieta $(ARG1) nie jest zdefionowana"; + Text[ japanese ] = "×ÍÞÙ$(ARG1)‚Í’è‹`‚³‚ê‚Ä‚¢‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "©|¥¼©w¸q¼Ð°O$(ARG1)"; + Text[ arabic ] = "ÛíÑ ãÚÑÝÉ $(ARG1) ÇáÚäæäÉ"; + Text[ dutch ] = "Label $(ARG1) ongedefinieerd"; + Text[ chinese_simplified ] = "ÉÐ䶨Òå±ê¼Ç $(ARG1)"; + Text[ greek ] = "Äåí ïñßóôçêå ç åðéãñáöÞ $(ARG1)"; + Text[ korean ] = "¶óº§ $(ARG1) ÀÌ Á¤ÀǵÇÁö ¾Ê¾Ò½À´Ï´Ù."; + Text[ turkish ] = "Etiket $(ARG1) tanýmlanmadý"; + Text[ language_user1 ] = " "; + }; + String SbERR_UNDEF_TYPE & ERRCODE_RES_MASK + { + Text = "Unbekannter Datentyp $(ARG1)" ; + Text [ ENGLISH ] = "Unknown data type $(ARG1)" ; + Text [ norwegian ] = "Unknown data type $(ARG1)" ; + Text [ italian ] = "Tipo di dati $(ARG1) sconosciuto" ; + Text [ portuguese_brazilian ] = "Unknown data type $(ARG1)" ; + Text [ portuguese ] = "Tipo de dados $(ARG1) desconhecido" ; + Text [ french ] = "Type de données $(ARG1) inconnu" ; + Text [ dutch ] = "Onbekend gegevenstype $(ARG1)" ; + Text [ spanish ] = "Tipo de datos $(ARG1) desconocido" ; + Text [ danish ] = "Ukendt datatype $(ARG1)" ; + Text [ swedish ] = "Okänd datatyp $(ARG1)" ; + Text [ finnish ] = "Unknown data type $(ARG1)" ; + Text [ english_us ] = "Unknown data type $(ARG1)" ; + Text[ chinese_simplified ] = "²»Ã÷µÄÊý¾ÝÀàÐÍ $(ARG1)"; + Text[ russian ] = "Íåèçâåñòíûé òèï äàííûõ $(ARG1)"; + Text[ polish ] = "Nieznany typ danych $(ARG1)"; + Text[ japanese ] = "•s–¾‚ÈÃÞ°À‚ÌŽí—Þ$(ARG1)"; + Text[ chinese_traditional ] = "¤£©úªº¸ê®ÆÃþ«¬ $(ARG1)"; + Text[ arabic ] = "$(ARG1) äãØ ÈíÇäÇÊ ÛíÑ ãÚÑæÝ"; + Text[ dutch ] = "Onbekend gegevenstype $(ARG1)"; + Text[ chinese_simplified ] = "²»Ã÷µÄÊý¾ÝÀàÐÍ $(ARG1)"; + Text[ greek ] = "¢ãíùóôïò ôýðïò äåäïìÝíùí $(ARG1)"; + Text[ korean ] = "¾Ë·ÁÁöÁö ¾ÊÀº µ¥ÀÌÅÍ Å¸ÀÔ $(ARG1)"; + Text[ turkish ] = "Bilinmeyen veri tipi $(ARG1)"; + Text[ language_user1 ] = " "; + }; + String SbERR_BAD_EXIT & ERRCODE_RES_MASK + { + Text = "Exit $(ARG1) erwartet" ; + Text [ ENGLISH ] = "Exit $(ARG1) erwartet" ; + Text [ norwegian ] = "Exit $(ARG1) erwartet" ; + Text [ italian ] = "Exit $(ARG1) atteso" ; + Text [ portuguese_brazilian ] = "Exit $(ARG1) erwartet" ; + Text [ portuguese ] = "Saída de $(ARG1) esperada" ; + Text [ french ] = "Exit $(ARG1) requis" ; + Text [ dutch ] = "Exit $(ARG1) verwacht" ; + Text [ spanish ] = "Se requiere salida $(ARG1)" ; + Text [ danish ] = "Exit $(ARG1) forventes" ; + Text [ swedish ] = "Exit $(ARG1) förväntat" ; + Text [ finnish ] = "Exit $(ARG1) erwartet" ; + Text [ english_us ] = "Exit $(ARG1) expected" ; + Text[ chinese_simplified ] = "µÈºòÍ˳ö $(ARG1)"; + Text[ russian ] = "Îæèäàåòñÿ âûõîä $(ARG1)"; + Text[ polish ] = "Oczekiwany koniec $(ARG1)"; + Text[ japanese ] = "$(ARG1)‚ÌI—¹‚ª•K—v‚Å‚·"; + Text[ chinese_traditional ] = "µ¥Ô°h¥X$(ARG1)"; + Text[ arabic ] = "ãÊæÞÚ ÇáÎÑæÌ ãä $(ARG1)"; + Text[ dutch ] = "Exit $(ARG1) verwacht"; + Text[ chinese_simplified ] = "µÈºòÍ˳ö $(ARG1)"; + Text[ greek ] = "ÁíáìÝíåôáé Exit $(ARG1)"; + Text[ korean ] = "¿¹ÃøµÈ Á¾·á$(ARG1)"; + Text[ turkish ] = "Çýkýþ $(ARG1) bekleniyor"; + Text[ language_user1 ] = " "; + }; + String SbERR_BAD_BLOCK & ERRCODE_RES_MASK + { + Text = "Noch offener Anweisungsblock: $(ARG1) fehlt" ; + Text [ ENGLISH ] = "Unterminated statement block: missing $(ARG1)" ; + Text [ norwegian ] = "Unterminated statement block: missing $(ARG1)" ; + Text [ italian ] = "Blocco di comandi ancora aperto: manca $(ARG1)" ; + Text [ portuguese_brazilian ] = "Unterminated statement block: missing $(ARG1)" ; + Text [ portuguese ] = "Bloco de instruções ainda incompleto: falta $(ARG1)" ; + Text [ french ] = "Bloc d'instructions encore ouvert : $(ARG1) fait défaut" ; + Text [ dutch ] = "Nog open aanwijzingenblok $(ARG1) ontbreekt" ; + Text [ spanish ] = "Bloque de instrucciones incompleto: falta $(ARG1) " ; + Text [ danish ] = "Endnu åben instruktionsblok: $(ARG1) mangler" ; + Text [ swedish ] = "Icke avslutat statementblock: $(ARG1) saknas" ; + Text [ finnish ] = "Unterminated statement block: missing $(ARG1)" ; + Text [ english_us ] = "Statement block still open: $(ARG1) missing" ; + Text[ chinese_simplified ] = "»¹È±ÉÙδ½áÊøµÄ·Ö³ÌÐò¿é£º$(ARG1)"; + Text[ russian ] = "Îòñóòñòâóåò åùå îòêðûòûé áëîê èíñòðóêöèé: $(ARG1)"; + Text[ polish ] = "Jeszcze otwarty blok instrukcji: brak $(ARG1)"; + Text[ japanese ] = "‚Ü‚¾ŠJ‚¢‚½‚܂܂̎wަÌÞÛ¯¸: $(ARG1)‚ª‘«‚è‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "Áٯʤ֥¼µ²§ôªº¤Àµ{§Ç¶ô¡G$(ARG1)"; + Text[ arabic ] = "ÞÇáÈ ÇáÃæÇãÑ ÇáÛíÑ ãäÊåí: $(ARG1) ãÝÞæÏ"; + Text[ dutch ] = "Nog open aanwijzingenblok $(ARG1) ontbreekt"; + Text[ chinese_simplified ] = "»¹È±ÉÙδ½áÊøµÄ·Ö³ÌÐò¿é£º$(ARG1)"; + Text[ greek ] = "Ëåßðåé ôìÞìá ïñßóìáôïò: $(ARG1) ôï ïðïßï ðáñáìÝíåé áíïé÷ôü."; + Text[ korean ] = "¹®ÀåÀÌ ¾ÆÁ÷ ¿·ÁÀÖ½À´Ï´Ù. :$(ARG1) °¡ ¾ø½À´Ï´Ù."; + Text[ turkish ] = "Açýk deyim bloku: $(ARG1) eksik"; + Text[ language_user1 ] = " "; + }; + String SbERR_BAD_BRACKETS & ERRCODE_RES_MASK + { + Text = "Fehler in Klammerschachtelung" ; + Text [ ENGLISH ] = "Parentheses do not match" ; + Text [ norwegian ] = "Parentheses do not match" ; + Text [ italian ] = "Errore nelle parentesi impostate" ; + Text [ portuguese_brazilian ] = "Parentheses do not match" ; + Text [ portuguese ] = "Erro nos parênteses" ; + Text [ french ] = "Erreur de parenthèses" ; + Text [ dutch ] = "Fout in het plaatsen van haakjes" ; + Text [ spanish ] = "Los paréntesis no coinciden" ; + Text [ danish ] = "Fejl i parentesstrukturen" ; + Text [ swedish ] = "Parentesfel" ; + Text [ finnish ] = "Parentheses do not match" ; + Text [ english_us ] = "Parentheses do not match" ; + Text[ chinese_simplified ] = "À¨ºÅ×é´íÎó"; + Text[ russian ] = "Êðóãëûå ñêîáêè íå ñîîòâåòñòâóþò"; + Text[ polish ] = "B³¹d w ustawianiu nawiasów"; + Text[ japanese ] = "ЇŒÊ•t‚¯‚Ì´×°"; + Text[ chinese_traditional ] = "¬A¸¹²Õ¿ù»~"; + Text[ arabic ] = "ÎØÃ Ýí ÇáÃÞæÇÓ"; + Text[ dutch ] = "Fout in het plaatsen van haakjes"; + Text[ chinese_simplified ] = "À¨ºÅ×é´íÎó"; + Text[ greek ] = "ÓöÜëìá ðáñåíèÝóåùí"; + Text[ korean ] = "°ýÈ£°¡ ¸ÂÁö ¾Ê½À´Ï´Ù."; + Text[ turkish ] = "Ayraçlar uyumsuz"; + Text[ language_user1 ] = " "; + }; + String SbERR_BAD_DECLARATION & ERRCODE_RES_MASK + { + Text = "Symbol $(ARG1) bereits anders definiert" ; + Text [ ENGLISH ] = "Symbol $(ARG1) defined differently" ; + Text [ norwegian ] = "Symbol $(ARG1) defined differently" ; + Text [ italian ] = "Simbolo $(ARG1) già definito diversamente" ; + Text [ portuguese_brazilian ] = "Symbol $(ARG1) defined differently" ; + Text [ portuguese ] = "O símbolo $(ARG1) já tem outra definição" ; + Text [ french ] = "Le symbole $(ARG1) a déjà reçu une autre définition" ; + Text [ dutch ] = "Symbool $(ARG1) reeds anders gedefinieerd" ; + Text [ spanish ] = "El símbolo $(ARG1) ya se definió de otra manera" ; + Text [ danish ] = "Symbolet $(ARG1) er allerede defineret anderledes" ; + Text [ swedish ] = "Symbolen $(ARG1) är redan annorlunda definierad" ; + Text [ finnish ] = "Symbol $(ARG1) defined differently" ; + Text [ english_us ] = "Symbol $(ARG1) already defined differently" ; + Text[ chinese_simplified ] = "ÒѾÁíÐж¨ÒåÁËͼ±ê $(ARG1)"; + Text[ russian ] = "Ñèìâîë $(ARG1) óæå îïðåäåëåí ïî-äðóãîìó"; + Text[ polish ] = "Symbol $(ARG1) zosta³ ju¿ inaczej zdefiniowany"; + Text[ japanese ] = "¼ÝÎÞÙ$(ARG1)‚Í‚·‚łɕʂɒè‹`‚³‚ê‚Ä‚¢‚Ü‚·"; + Text[ chinese_traditional ] = "¤w¸g¥t¦æ©w¸q¤F¹Ï¥Ü$(ARG1)"; + Text[ arabic ] = "ãÚÑøÝ ãÓÈÞÇð ÈÔßá ÃÎÑ $(ARG1) ÇáÑãÒ"; + Text[ dutch ] = "Symbool $(ARG1) reeds anders gedefinieerd"; + Text[ chinese_simplified ] = "ÒѾÁíÐж¨ÒåÁËͼ±ê $(ARG1)"; + Text[ greek ] = "Ôï óýìâïëï $(ARG1) ïñßóôçêå Þäç ìå äéáöïñåôéêü ôñüðï"; + Text[ korean ] = "±âÈ£$(ARG1) °¡ ÀÌ¹Ì ´Ù¸£°Ô Á¤ÀǵǾî ÀÖ½À´Ï´Ù."; + Text[ turkish ] = "Simge $(ARG1) farklý bir biçimde tanýmlanmýþ durumda"; + Text[ language_user1 ] = " "; + }; + String SbERR_BAD_PARAMETERS & ERRCODE_RES_MASK + { + Text = "Parameter passen nicht zu Prozedur" ; + Text [ ENGLISH ] = "Parameters do not match" ; + Text [ norwegian ] = "Parameters do not match" ; + Text [ italian ] = "Le parentesi non corrispondono alla procedura" ; + Text [ portuguese_brazilian ] = "Parameters do not match" ; + Text [ portuguese ] = "Os parâmetros não correspondem ao procedimento" ; + Text [ french ] = "Les paramètres ne correspondent pas à la procédure" ; + Text [ dutch ] = "Parameters passen niet bij procedure" ; + Text [ spanish ] = "Los parámetros no coinciden con el procedimiento" ; + Text [ danish ] = "Parametrene svarer ikke til proceduren" ; + Text [ swedish ] = "Parametern passar inte till proceduren" ; + Text [ finnish ] = "Parameters do not match" ; + Text [ english_us ] = "Parameters do not correspond to procedure" ; + Text[ chinese_simplified ] = "Öú±äÁ¿ºÍ¹ý³Ì²»Æ¥Åä"; + Text[ russian ] = "Ïàðàìåòðû íå ñîîòâåòñòâóþò ïðîöåäóðå"; + Text[ polish ] = "Parametry nie odpowiadaj¹ procedurze"; + Text[ japanese ] = "Êß×Ò°À‚ÍÌßÛ¼°¼Þ¬‚ɇ‚¢‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "§UÅܶq©M¹Lµ{¤£¤Ç°t"; + Text[ arabic ] = "áÇ ÊÊæÇÝÞ ÇáãÚáãÇÊ ãÚ ÇáÅÌÑÇÁ"; + Text[ dutch ] = "Parameters passen niet bij procedure"; + Text[ chinese_simplified ] = "Öú±äÁ¿ºÍ¹ý³Ì²»Æ¥Åä"; + Text[ greek ] = "Ïé ðáñÜìåôñïé äåí ôáéñéÜæïõí óôç äéáäéêáóßá"; + Text[ korean ] = "ÆÄ¶ó¹ÌÅͰ¡ ÇÁ·Î½ÃÀú¿¡ ¸ÂÁö ¾Ê½À´Ï´Ù."; + Text[ turkish ] = "Parametreler yordama uymuyor"; + Text[ language_user1 ] = " "; + }; + String SbERR_BAD_CHAR_IN_NUMBER & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Ung³ltiges Zeichen in Zahl : Ungltiges Zeichen in Zahl */ + Text = "Ungültiges Zeichen in Zahl" ; + Text [ ENGLISH ] = "Bad character in number" ; + Text [ norwegian ] = "Bad character in number" ; + Text [ italian ] = "Carattere non valido nel numero" ; + Text [ portuguese_brazilian ] = "Bad character in number" ; + Text [ portuguese ] = "Caracter incorrecto no número" ; + Text [ french ] = "Le nombre contient un caractère incorrect" ; + Text [ dutch ] = "Ongeldig teken in getal" ; + Text [ spanish ] = "Carácter incorrecto en el número" ; + Text [ danish ] = "Ugyldigt tegn i tallet" ; + Text [ swedish ] = "Ogiltigt tecken i talet" ; + Text [ finnish ] = "Bad character in number" ; + Text [ english_us ] = "Invalid character in number" ; + Text[ chinese_simplified ] = "Êý×ÖÄÚº¬ÓÐÎÞЧµÄ×Ö·û"; + Text[ russian ] = "Íåäåéñòâèòåëüíûé çíàê â ÷èñëå"; + Text[ polish ] = "Nieprawid³owy znak w liczbie"; + Text[ japanese ] = "”‚É–³Œø‚È•¶Žš"; + Text[ chinese_traditional ] = "¦b¼Æ¦r¤º§t¦³µL®Äªº¦r¤¸"; + Text[ arabic ] = "ÍÑÝ ÛíÑ ÕÇáÍ Ýí ÇáÑÞã"; + Text[ dutch ] = "Ongeldig teken in getal"; + Text[ chinese_simplified ] = "Êý×ÖÄÚº¬ÓÐÎÞЧµÄ×Ö·û"; + Text[ greek ] = "Ìç Ýãêõñïò ÷áñáêôÞñáò óôïí áñèéìü"; + Text[ korean ] = "¼ýÀÚ¿¡ À¯È¿ÇÏÁö ¾ÊÀº ¹®ÀÚ"; + Text[ turkish ] = "Numara geçersiz bir karakter içeriyor"; + Text[ language_user1 ] = " "; + }; + String SbERR_MUST_HAVE_DIMS & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Array mu˜ dimensioniert werden : Array muÿ dimensioniert werden */ + Text = "Array muss dimensioniert werden" ; + Text [ ENGLISH ] = "Array needs dimensioning" ; + Text [ norwegian ] = "Array needs dimensioning" ; + Text [ italian ] = "L'array deve essere dimensionato" ; + Text [ portuguese_brazilian ] = "Array needs dimensioning" ; + Text [ portuguese ] = "Necessário dimensionar matriz" ; + Text [ french ] = "Vous devez dimensionner l'Array" ; + Text [ dutch ] = "Array moet worden gedimensioneerd" ; + Text [ spanish ] = "Hay que dimensionar el array" ; + Text [ danish ] = "Array skal dimensioneres" ; + Text [ swedish ] = "Array måste dimensioneras" ; + Text [ finnish ] = "Array needs dimensioning" ; + Text [ english_us ] = "Array must be dimensioned" ; + Text[ chinese_simplified ] = "±ØÐëΪÊý×鶨³ß¶È"; + Text[ russian ] = "Íåîáõîäèìî çàäàòü ðàçìåðíîñòü ìàññèâà"; + Text[ polish ] = "Macierz nale¿y zwymiarowaæ"; + Text[ japanese ] = "”z—ñ‚ÍŽŸŒ³‰»‚³‚ê‚È‚¯‚ê‚΂Ȃè‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "¦æ¦C¥²¶·©w¤Ø«×"; + Text[ arabic ] = "íÌÈ ÊÚííä ÃÈÚÇÏ ÇáÕÝíÝ"; + Text[ dutch ] = "Array moet worden gedimensioneerd"; + Text[ chinese_simplified ] = "±ØÐëΪÊý×鶨³ß¶È"; + Text[ greek ] = "ÐñÝðåé íá ïñéóôïýí ïé äéáóôÜóåéò ôçò ìÞôñáò"; + Text[ korean ] = "¹è¿Àº ¹Ýµå½Ã ¼öÄ¡°¡ ÀÖ¾î¾ßÇÑ´Ù."; + Text[ turkish ] = "Dizinin boyutlandýrýlmasý gerekir"; + Text[ language_user1 ] = " "; + }; + String SbERR_NO_IF & ERRCODE_RES_MASK + { + Text = "Else/Endif ohne If" ; + Text [ ENGLISH ] = "Else/Endif without If" ; + Text [ norwegian ] = "Else/Endif without If" ; + Text [ italian ] = "Else/Endif senza If" ; + Text [ portuguese_brazilian ] = "Else/Endif without If" ; + Text [ portuguese ] = "Else/Endif sem If" ; + Text [ french ] = "Else/Endif sans If" ; + Text [ dutch ] = "Else/Endif zonder If" ; + Text [ spanish ] = "Else/Endif sin If" ; + Text [ danish ] = "Else/Endif uden If" ; + Text [ swedish ] = "Else/Endif utan If" ; + Text [ finnish ] = "Else/Endif without If" ; + Text [ english_us ] = "Else/Endif without If" ; + Text[ chinese_simplified ] = "Else/Endif ²»´ø If"; + Text[ russian ] = "Else/Endif áåç If"; + Text[ polish ] = "Else/Endif bez If"; + Text[ japanese ] = "Else/Endif without If"; + Text[ chinese_traditional ] = "Else/Endif ¤£±a If"; + Text[ arabic ] = "If ÈÏæä Else/Endif"; + Text[ dutch ] = "Else/Endif zonder If"; + Text[ chinese_simplified ] = "Else/Endif ²»´ø If"; + Text[ greek ] = "Else/Endif ÷ùñßò If"; + Text[ korean ] = "IF ¾ø´Â ELSE/ELSEIF"; + Text[ turkish ] = "If olmadan Else/Endif"; + Text[ language_user1 ] = " "; + }; + String SbERR_NOT_IN_SUBR & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? $(ARG1) innerhalb einer Prozedur unzulõssig : $(ARG1) innerhalb einer Prozedur unzul§ssig */ + Text = "$(ARG1) innerhalb einer Prozedur unzulässig" ; + Text [ ENGLISH ] = "$(ARG1) not allowed within a procedure" ; + Text [ norwegian ] = "$(ARG1) not allowed within a procedure" ; + Text [ italian ] = "$(ARG1) non ammesso all'interno di una procedura" ; + Text [ portuguese_brazilian ] = "$(ARG1) not allowed within a procedure" ; + Text [ portuguese ] = "$(ARG1) não é permitido dentro de um procedimento" ; + Text [ french ] = "$(ARG1) interdit dans une procédure" ; + Text [ dutch ] = "$(ARG1) binnen een procedure niet toegestaan" ; + Text [ spanish ] = "$(ARG1) no está permitido dentro de un proceso" ; + Text [ danish ] = "$(ARG1) er ikke tilladt indenfor en procedure" ; + Text [ swedish ] = "$(ARG1) inte tillåtet inuti en procedur" ; + Text [ finnish ] = "$(ARG1) not allowed within a procedure" ; + Text [ english_us ] = "$(ARG1) not allowed within a procedure" ; + Text[ chinese_simplified ] = "ÔÚÒ»¸ö¹ý³ÌÄÚ²¿²»ÔÊÐí $(ARG1)"; + Text[ russian ] = "$(ARG1) âíóòðè ïðîöåäóðû íåäîïóñòèì"; + Text[ polish ] = "$(ARG1) niedopuszczalny w procedurze"; + Text[ japanese ] = "$(ARG1)ÌßÛ¼°¼Þ¬“à‚ł͋–‰Â‚³‚ê‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "¦b¤@Ó¹Lµ{¤º³¡¤£¤¹³\\$(ARG1)"; + Text[ arabic ] = "ÛíÑ ãÓãæÍ Èå ÏÇÎá ÇáÅÌÑÇÁ $(ARG1)"; + Text[ dutch ] = "$(ARG1) binnen een procedure niet toegestaan"; + Text[ chinese_simplified ] = "ÔÚÒ»¸ö¹ý³ÌÄÚ²¿²»ÔÊÐí $(ARG1)"; + Text[ greek ] = "$(ARG1) äåí åðéôñÝðåôáé åíôüò ìéáò äéáäéêáóßáò"; + Text[ korean ] = "$(ARG1) ´Â ÇÁ·Î½ÃÀú »çÀÌ¿¡ Çã¿ëµÇÁö ¾Ê½À´Ï´Ù."; + Text[ turkish ] = "Yordamda $(ARG1) geçerli deðil"; + Text[ language_user1 ] = " "; + }; + String SbERR_NOT_IN_MAIN & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? $(ARG1) au˜erhalb einer Prozedur unzulõssig : $(ARG1) auÿerhalb einer Prozedur unzul§ssig */ + Text = "$(ARG1) außerhalb einer Prozedur unzulässig" ; + Text [ ENGLISH ] = "$(ARG1) not allowed outside a procedure" ; + Text [ norwegian ] = "$(ARG1) not allowed outside a procedure" ; + Text [ italian ] = "$(ARG1) non permesso al di fuori di una procedura" ; + Text [ portuguese_brazilian ] = "$(ARG1) not allowed outside a procedure" ; + Text [ portuguese ] = "$(ARG1) não é permitido fora de um procedimento" ; + Text [ french ] = "$(ARG1) interdit en dehors d'une procédure" ; + Text [ dutch ] = "$(ARG1) buiten een procedure niet toegestaan" ; + Text [ spanish ] = "$(ARG1) no está permitido fuera de un proceso" ; + Text [ danish ] = "$(ARG1) er ikke tilladt udenfor en procedure" ; + Text [ swedish ] = "$(ARG1) inte tillåtet utanför en procedur" ; + Text [ finnish ] = "$(ARG1) not allowed outside a procedure" ; + Text [ english_us ] = "$(ARG1) not allowed outside a procedure" ; + Text[ chinese_simplified ] = "ÔÚÒ»¸ö¹ý³ÌÍâ²»ÔÊÐí $(ARG1)"; + Text[ russian ] = "$(ARG1) âíå ïðîöåäóðû íåäîïóñòèì"; + Text[ polish ] = "$(ARG1) niedopuszczalny poza procedur¹"; + Text[ japanese ] = "$(ARG1)ÌßÛ¼°¼Þ¬ŠO‚ł͋–‰Â‚³‚ê‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "¦b¤@Ó¹Lµ{¥~¤£¤¹³\\$(ARG1)"; + Text[ arabic ] = "ÛíÑ ãÓãæÍ Èå ÎÇÑÌ ÇáÅÌÑÇÁ $(ARG1)"; + Text[ dutch ] = "$(ARG1) buiten een procedure niet toegestaan"; + Text[ chinese_simplified ] = "ÔÚÒ»¸ö¹ý³ÌÍâ²»ÔÊÐí $(ARG1)"; + Text[ greek ] = "$(ARG1) äåí åðéôñÝðåôáé åêôüò ìéáò äéáäéêáóßáò"; + Text[ korean ] = "$(ARG1) ´Â ÇÁ·Î½ÃÀú¹Û¿¡¼ Çã¿ëµÇÁö ¾Ê½À´Ï´Ù."; + Text[ turkish ] = "Yordam dýþýnda $(ARG1) geçerli deðil"; + Text[ language_user1 ] = " "; + }; + String SbERR_WRONG_DIMS & ERRCODE_RES_MASK + { + Text = "Dimensionsangaben passen nicht zueinander" ; + Text [ ENGLISH ] = "Dimensions do not match" ; + Text [ norwegian ] = "Dimensions do not match" ; + Text [ italian ] = "I dati sulle dimensioni non sono compatibili tra loro" ; + Text [ portuguese_brazilian ] = "Dimensions do not match" ; + Text [ portuguese ] = "As dimensões indicadas não combinam" ; + Text [ french ] = "Les dimensions indiquées ne concordent pas" ; + Text [ dutch ] = "Aangegeven afmetingen passen niet bij elkaar" ; + Text [ spanish ] = "Las dimensiones no coinciden" ; + Text [ danish ] = "Dimensionsangivelserne svarer ikke til hinanden" ; + Text [ swedish ] = "Dimensionsspecificeringarna stämmer inte överens" ; + Text [ finnish ] = "Dimensions do not match" ; + Text [ english_us ] = "Dimension specifications do not match" ; + Text[ chinese_simplified ] = "¶¨³ß¶ÈµÄÉ趨²»Æ¥Åä"; + Text[ russian ] = "Ñïåöèôèêàöèè ðàçìåðíîñòè íå ñîîòâåòñòâóþò äðóã äðóãó"; + Text[ polish ] = "Dane wymiarowe nie s¹ zgodne"; + Text[ japanese ] = "ŽŸŒ³‚ÌŽw’è‚͇‚Á‚Ä‚¢‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "©w¤Ø«×ªº³]©w¤£¤Ç°t"; + Text[ arabic ] = "ÈíÇäÇÊ ÇáÃÈÚÇÏ áÇ ÊÊãÇÔì ãÚ ÈÚÖåÇ"; + Text[ dutch ] = "Aangegeven afmetingen passen niet bij elkaar"; + Text[ chinese_simplified ] = "¶¨³ß¶ÈµÄÉ趨²»Æ¥Åä"; + Text[ greek ] = "Ïé äéáóôÜóåéò ðïõ ïñßóôçêáí äåí óõíäõÜæïíôáé."; + Text[ korean ] = "¿µ¿ªÀÇ Á¤Àǰ¡ ¸ÂÁö ¾Ê½À´Ï´Ù."; + Text[ turkish ] = "Boyut verileri arasýnda uyuþmazlýk"; + Text[ language_user1 ] = " "; + }; + String SbERR_BAD_OPTION & ERRCODE_RES_MASK + { + Text = "Unbekannte Option: $(ARG1)" ; + Text [ ENGLISH ] = "Unknown option: $(ARG1)" ; + Text [ norwegian ] = "Unknown option: $(ARG1)" ; + Text [ italian ] = "Opzione sconosciuta: $(ARG1)" ; + Text [ portuguese_brazilian ] = "Unknown option: $(ARG1)" ; + Text [ portuguese ] = "Opção desconhecida: $(ARG1)" ; + Text [ french ] = "Option inconnue : $(ARG1)" ; + Text [ dutch ] = "Onbekende optie: $(ARG1)" ; + Text [ spanish ] = "Opción desconocida: $(ARG1)" ; + Text [ danish ] = "Ukendt alternativ: $(ARG1)" ; + Text [ swedish ] = "Obekant alternativ: $(ARG1)" ; + Text [ finnish ] = "Unknown option: $(ARG1)" ; + Text [ english_us ] = "Unknown option: $(ARG1)" ; + Text[ chinese_simplified ] = "²»Ã÷µÄÑ¡Ï$(ARG1)"; + Text[ russian ] = "Íåèçâåñòíàÿ îïöèÿ: $(ARG1)"; + Text[ polish ] = "Nieznana opcja: $(ARG1)"; + Text[ japanese ] = "•s–¾‚ȵÌß¼®Ý: $(ARG1)"; + Text[ chinese_traditional ] = "¤£©úªº¿ï¶µ¡G$(ARG1)"; + Text[ arabic ] = "$(ARG1) :ÎíÇÑ ÛíÑ ãÚÑæÝ"; + Text[ dutch ] = "Onbekende optie: $(ARG1)"; + Text[ chinese_simplified ] = "²»Ã÷µÄÑ¡Ï$(ARG1)"; + Text[ greek ] = "¢ãíùóôç åðéëïãÞ: $(ARG1)"; + Text[ korean ] = "¾Ë·ÁÁöÁö ¾ÊÀº ¿É¼Ç:$(ARG1)"; + Text[ turkish ] = "Bilinmeyen seçenek: $(ARG1)"; + Text[ language_user1 ] = " "; + }; + String SbERR_CONSTANT_REDECLARED & ERRCODE_RES_MASK + { + Text = "Konstante $(ARG1) neu definiert" ; + Text [ ENGLISH ] = "Constant $(ARG1) redeclared" ; + Text [ norwegian ] = "Constant $(ARG1) redeclared" ; + Text [ italian ] = "Costante $(ARG1) ridefinita" ; + Text [ portuguese_brazilian ] = "Constant $(ARG1) redeclared" ; + Text [ portuguese ] = "Constante $(ARG1) redefinida" ; + Text [ french ] = "La constante $(ARG1) a été redéfinie" ; + Text [ dutch ] = "Constante $(ARG1) opnieuw gedefinieerd" ; + Text [ spanish ] = "Constante $(ARG1) redefinida" ; + Text [ danish ] = "Konstanten $(ARG1) er nydefineret" ; + Text [ swedish ] = "Konstanten $(ARG1) är nydefinierad" ; + Text [ finnish ] = "Constant $(ARG1) redeclared" ; + Text [ english_us ] = "Constant $(ARG1) redefined" ; + Text[ chinese_simplified ] = "ÖØÐ¶¨Òå³£Êý $(ARG1)"; + Text[ russian ] = "Êîíñòàíòà $(ARG1) îïðåäåëåíà çàíîâî"; + Text[ polish ] = "Sta³a $(ARG1) ponownie zdefiniowana"; + Text[ japanese ] = "’è”$(ARG1)‚ÍÄ’è‹`‚³‚ê‚Ü‚·"; + Text[ chinese_traditional ] = "«·s©w¸q±`¼Æ$(ARG1)"; + Text[ arabic ] = "$(ARG1) ÅÚÇÏÉ ÊÚÑíÝ ÇáËÇÈÊ"; + Text[ dutch ] = "Constante $(ARG1) opnieuw gedefinieerd"; + Text[ chinese_simplified ] = "ÖØÐ¶¨Òå³£Êý $(ARG1)"; + Text[ greek ] = "Ïñéóìüò åê íÝïõ ôçò óôáèåñÜò $(ARG1)"; + Text[ korean ] = "Àç Á¤ÀÇµÈ »ó¼ö $(ARG1)"; + Text[ turkish ] = "Sabit $(ARG1) yeniden tanýmlandý"; + Text[ language_user1 ] = " "; + }; + String SbERR_PROG_TOO_LARGE & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Programm ist zu gro˜ : Programm ist zu groÿ */ + Text = "Programm ist zu groß" ; + Text [ ENGLISH ] = "Program is too large" ; + Text [ norwegian ] = "Program is too large" ; + Text [ italian ] = "Il programma è troppo esteso" ; + Text [ portuguese_brazilian ] = "Program is too large" ; + Text [ portuguese ] = "O programa é demasiado extenso" ; + Text [ french ] = "Le programme est trop volumineux" ; + Text [ dutch ] = "Programma is te groot" ; + Text [ spanish ] = "El programa es demasiado grande" ; + Text [ danish ] = "Programmet er for stort" ; + Text [ swedish ] = "Programmet är för stort" ; + Text [ finnish ] = "Program is too large" ; + Text [ english_us ] = "Program too large" ; + Text[ chinese_simplified ] = "³ÌÐòÌ«´ó"; + Text[ russian ] = "Ïðîãðàììà ñëèøêîì áîëüøàÿ"; + Text[ polish ] = "Program jest za du¿y"; + Text[ japanese ] = "ÌßÛ¸Þ×т͑傫‚·‚¬‚Ü‚·"; + Text[ chinese_traditional ] = "µ{¦¡¤Ó¤j"; + Text[ arabic ] = "ÇáÈÑäÇãÌ ßÈíÑ ÌÏÇð"; + Text[ dutch ] = "Programma is te groot"; + Text[ chinese_simplified ] = "³ÌÐòÌ«´ó"; + Text[ greek ] = "Ôï ðñüãñáììá åßíáé õðåñâïëéêÜ ìåãÜëï"; + Text[ korean ] = "ÇÁ·Î±×·¥À̳ʹ« Å®´Ï´Ù."; + Text[ turkish ] = "Program çok büyük"; + Text[ language_user1 ] = " "; + }; + String SbERR_NO_STRINGS_ARRAYS & ERRCODE_RES_MASK + { + /* ### ACHTUNG: Neuer Text in Resource? Strings oder Arrays unzulõssig : Strings oder Arrays unzul§ssig */ + Text = "Strings oder Arrays unzulässig" ; + Text [ ENGLISH ] = "Sorry, no strings or arrays allowed" ; + Text [ norwegian ] = "Sorry, no strings or arrays allowed" ; + Text [ italian ] = "String o array non validi" ; + Text [ portuguese_brazilian ] = "Sorry, no strings or arrays allowed" ; + Text [ portuguese ] = "Séries de caracteres ou matrizes não permitidas" ; + Text [ french ] = "Strings ou Arrays inadmissibles" ; + Text [ dutch ] = "Strings of arrays niet toegestaan" ; + Text [ spanish ] = "No están permitidos strings o arrays" ; + Text [ danish ] = "Strenge eller arrays er ikke tilladte" ; + Text [ swedish ] = "Strings eller arrays ej tillåtna" ; + Text [ finnish ] = "Sorry, no strings or arrays allowed" ; + Text [ english_us ] = "Strings or arrays not permitted" ; + Text[ chinese_simplified ] = "²»ÔÊÐí×Ö´®»òÊý×é"; + Text[ russian ] = "Ñòðîêè çíàêîâ èëè ìàññèâû íåäîïóñòèìû"; + Text[ polish ] = "Ciagi znaków lub macierze niedopuszczalne"; + Text[ japanese ] = "•¶Žš—ñ‚Ü‚½‚Í”z—ñ‚Í‹–‰Â‚³‚ê‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "¤£¤¹³\\¦r¦ê©Î¦æ¦C"; + Text[ arabic ] = "ÛíÑ ãÓãæÍ ÈåÐå ÇáÓáÇÓá Ãæ ÇáÕÝÇÆÝ"; + Text[ dutch ] = "Strings of arrays niet toegestaan"; + Text[ chinese_simplified ] = "²»ÔÊÐí×Ö´®»òÊý×é"; + Text[ greek ] = "Äåí åðéôñÝðïíôáé áêïëïõèßåò ÷áñáêôÞñùí Þ ìÞôñåò"; + Text[ korean ] = "¹®ÀÚ ¶Ç´Â ¹è¿ÀÌ Çã¿ëµÇÁö ¾Ê¾Ò½À´Ï´Ù."; + Text[ turkish ] = "Dizilimler ya da diziler geçerli deðil"; + Text[ language_user1 ] = " "; + }; +#ifdef VBSCRIPT_TEST + String ERRCODE_BASIC_NOT_IN_VBSCRIPT & ERRCODE_RES_MASK + { + Text = "In VBScript nicht enthalten" ; + Text [ ENGLISH ] = "Not implemented in VBScript" ; + Text [ norwegian ] = "Not implemented in VBScript" ; + Text [ italian ] = "Non contenuto nello script VB" ; + Text [ portuguese_brazilian ] = "Not implemented in VBScript" ; + Text [ portuguese ] = "Não contido no Script VB" ; + Text [ french ] = "Pas contenu dans le VBScript" ; + Text [ dutch ] = "Bevindt zich niet in VBScript" ; + Text [ spanish ] = "No está contenido en el script VB" ; + Text [ danish ] = "Ikke indeholdt i VB-script" ; + Text [ swedish ] = "Innefattas inte i VBScript" ; + Text [ finnish ] = "Not implemented in VBScript" ; + Text [ english_us ] = "Not contained in VB script" ; + Text[ chinese_simplified ] = "ûÓаüº¬ÔÚ VB script ÄÚ"; + Text[ russian ] = " VBScript íå ñîäåðæèòñÿ"; + Text[ polish ] = "Nie zawarte w VBScript"; + Text[ japanese ] = "VBScript‚Ɋ܂܂ê‚Ä‚¢‚Ü‚¹‚ñ"; + Text[ chinese_traditional ] = "¨S¦³¥]§t¦bVB script¤§¤º"; + Text[ arabic ] = "VB script áÇ íÔÊãá ÚáíåÇ"; + Text[ dutch ] = "Bevindt zich niet in VBScript"; + Text[ chinese_simplified ] = "ûÓаüº¬ÔÚ VB script ÄÚ"; + Text[ greek ] = "Äåí ðåñéÝ÷åôáé óôï VB script"; + Text[ korean ] = "VB ½ºÅ©¸³Æ®¸¦ Æ÷ÇÔÇÏÁö ¾Ê½À´Ï´Ù."; + Text[ turkish ] = "VBScript'te mevcut deðil"; + Text[ language_user1 ] = " "; + }; +#endif +}; + // Hinweis: IDS_SBERR_TERMINATED = IDS_SBERR_START+2000. +String IDS_SBERR_TERMINATED +{ + Text = "Das laufende Makro wurde unterbrochen" ; + Text [ ENGLISH ] = "Stopped currently running macro" ; + Text [ norwegian ] = "Stopped currently running macro" ; + Text [ italian ] = "La macro in corso è stata interrotta" ; + Text [ portuguese_brazilian ] = "Stopped currently running macro" ; + Text [ portuguese ] = "A macro em execução foi cancelada" ; + Text [ french ] = "La macro en cours a été interrompue" ; + Text [ dutch ] = "Actuele macro werd onderbroken" ; + Text [ spanish ] = "Se ha interrumpido la macro activa" ; + Text [ danish ] = "Den aktuelle makro blev afbrudt" ; + Text [ swedish ] = "Det aktuella makrot avbröts" ; + Text [ finnish ] = "Stopped currently running macro" ; + Text [ english_us ] = "The macro running has been interrupted" ; + Text[ chinese_simplified ] = "ÖжÏÔËÐкꡣ"; + Text[ russian ] = "Âûïîëíåíèå ìàêðîñà ïðåðâàíî"; + Text[ polish ] = "Wykonywane makro zosta³o przerwane"; + Text[ japanese ] = "ϸÛì‹Æ‚ª’†’f‚³‚ê‚Ü‚µ‚½"; + Text[ chinese_traditional ] = "¤¤Â_¹B¦æ¥¨¶°¡C"; + Text[ arabic ] = "ÊãÊ ãÞÇØÚÉ ÇáãÇßÑæ ÇáãÓÊÎÏã ÍÇáíÇð"; + Text[ dutch ] = "Actuele macro werd onderbroken"; + Text[ chinese_simplified ] = "ÖжÏÔËÐкꡣ"; + Text[ greek ] = "Ç ìáêñïåíôïëÞ äéáêüðçêå óôç äéÜñêåéá ôçò åêôÝëåóçò"; + Text[ korean ] = "¸ÅÅ©·Î ½ÇÇàÀÌ ÁߴܵǾîÁ³½À´Ï´Ù."; + Text[ turkish ] = "Yürütülen makro kesildi"; + Text[ language_user1 ] = " "; +}; +String IDS_SBERR_STOREREF +{ + Text = "Referenz wird nicht gespeichert: "; + Text [ italian ] = "Il riferimento non viene salvato: "; + Text [ portuguese_brazilian ] = "reference will not be saved: "; + Text [ portuguese ] = "A referência não será guardada: "; + Text [ danish ] = "Referencen bliver ikke gemt: "; + Text [ french ] = "Impossible d'enregistrer la référence : "; + Text [ swedish ] = "Referens sparas inte: "; + Text [ dutch ] = "Verwijzing wordt niet opgeslagen: "; + Text [ spanish ] = "No se guardará la referencia: "; + Text [ english_us ] = "Reference will not be saved: "; + Text[ chinese_simplified ] = "²»´æÅÌÒýÓÃ: "; + Text[ language_user1 ] = " "; + Text[ russian ] = "Ññûëêà ñîõðàíåíà íå áóäåò: "; + Text[ polish ] = "Odwo³anie nie zosta³o zapisane: "; + Text[ japanese ] = "ŽQƂ͕ۑ¶‚³‚ê‚Ü‚¹‚ñ: "; + Text[ chinese_traditional ] = "¤£Àx¦s°Ñ·Ó¡G "; + Text[ arabic ] = ":áä íÊã ÍÝÙ ÇáãÑÌÚ"; + Text[ dutch ] = "Verwijzing wordt niet opgeslagen: "; + Text[ chinese_simplified ] = "²»´æÅÌÒýÓÃ: "; + Text[ greek ] = "Ç áíáöïñÜ äåí èá áðïèçêåõôåß: "; + Text[ korean ] = "ÂüÁ¶°¡ ÀúÀåµÇÁö ¾Ê¾Ò½À´Ï´Ù. "; + Text[ turkish ] = "Referans kaydedilmeyecek: "; +#if defined( MAC ) || defined( OS2 ) + Text = "Referenz wird nicht gesichert: " ; +#else + Text = "Referenz wird nicht gespeichert: " ; +#endif + Text [ ENGLISH ] = "reference will not be saved: " ; + Text [ norwegian ] = "reference will not be saved: " ; + Text [ italian ] = "Il riferimento non viene salvato: " ; + Text [ portuguese_brazilian ] = "reference will not be saved: " ; + Text [ portuguese ] = "A referÛncia nÒo serß guardada: " ; + Text [ french ] = "RÚfÚrence non enregistrÚe : " ; + Text [ dutch ] = "Verwijzing wordt niet opgeslagen: " ; + Text [ spanish ] = "No se guardarß la referencia: " ; + Text [ danish ] = "Referencen bliver ikke gemt: " ; + Text [ swedish ] = "Referens sparas inte: " ; + Text [ finnish ] = "reference will not be saved: " ; + Text [ english_us ] = "Reference will not be saved: " ; + Text = "Referenz wird nicht gespeichert: " ; +}; +String ERRCODE_BASMGR_LIBLOAD & ERRCODE_RES_MASK +{ + /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Laden der Bibliothek '$(ARG1)' : Fehler beim Laden der Bibliothek ''$(ARG1)'' */ + /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Laden der Bibliothek '$(ARG1)' : Fehler beim Laden der Bibliothek ''$(ARG1) */ + /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Laden der Bibliothek '$(ARG1)' : Fehler beim Laden der Bibliothek ''$(ARG1) */ + /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Laden der Bibliothek '$(ARG1)' : Fehler beim Laden der Bibliothek ''$(ARG1)'' */ + Text = "Fehler beim Laden der Bibliothek '$(ARG1)'" ; + Text [ ENGLISH ] = "Fehler beim Laden der Bibliothek '$(ARG1)'" ; + Text [ english_us ] = "Error loading library '$(ARG1)'" ; + Text [ italian ] = "Errore nel caricare la library '$(ARG1)'" ; + Text [ spanish ] = "Error al cargar la biblioteca '$(ARG1)'" ; + Text [ french ] = "Erreur lors du chargement de la bibliothèque '$(ARG1)'" ; + Text [ dutch ] = "Fout bij laden van bibliotheek '$(ARG1)'" ; + Text [ swedish ] = "Fel vid laddning av bibliotek '$(ARG1)'" ; + Text [ danish ] = "Fejl ved indlæsning af biblioteket '$(ARG1)'" ; + Text [ portuguese_brazilian ] = "Fehler beim Laden der Bibliothek '$(ARG1)" ; + Text [ portuguese ] = "Erro ao carregar a biblioteca '$(ARG1)" ; + Text[ chinese_simplified ] = "×°ÔØ¿âʱ·¢Éú´íÎó'$(ARG1)'"; + Text[ russian ] = "Îøèáêà ïðè çàãðóçêå áèáëèîòåêè '$(ARG1)'"; + Text[ polish ] = "B³¹d przy ³adowaniu biblioteki '$(ARG1)'"; + Text[ japanese ] = "ײÌÞר'$(ARG1)'‚̓ǂݞ‚Ý‚ÌÛ‚Ì´×°"; + Text[ chinese_traditional ] = "¸Ë¸üµ{¦¡®w®Éµo¥Í¿ù»~'$(ARG1)'"; + Text[ arabic ] = "'$(ARG1)' ÎØÃ ÃËäÇÁ ÊÍãíá ÇáãßÊÈÉ"; + Text[ dutch ] = "Fout bij laden van bibliotheek '$(ARG1)'"; + Text[ chinese_simplified ] = "×°ÔØ¿âʱ·¢Éú´íÎó'$(ARG1)'"; + Text[ greek ] = "ÓöÜëìá êáôÜ ôç öüñôùóç ôçò âéâëéïèÞêçò '$(ARG1)'"; + Text[ korean ] = "¶óÀ̺귯¸® $(ARG1) ·Îµù ¿À·ù"; + Text[ turkish ] = "Kitaplýðý yükleme sýrasýnda hata '$(ARG1)'"; + Text[ language_user1 ] = " "; +}; +String ERRCODE_BASMGR_LIBSAVE & ERRCODE_RES_MASK +{ + /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Speichern der Bibliothek: '$(ARG1)' : Fehler beim Speichern der Bibliothek: ''$(ARG1)'' */ + /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Speichern der Bibliothek: '$(ARG1)' : Fehler beim Speichern der Bibliothek: ''$(ARG1) */ + /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Speichern der Bibliothek: '$(ARG1)' : Fehler beim Speichern der Bibliothek: ''$(ARG1) */ + /* ### ACHTUNG: Neuer Text in Resource? Fehler beim Speichern der Bibliothek: '$(ARG1)' : Fehler beim Speichern der Bibliothek: ''$(ARG1)'' */ + Text = "Fehler beim Speichern der Bibliothek: '$(ARG1)'" ; + Text [ ENGLISH ] = "Fehler beim Speichern der Bibliothek: '$(ARG1)'" ; + Text [ dutch ] = "Fout bij het opslaan van bibliotheek: '$(ARG1)'" ; + Text [ english_us ] = "Error saving library: '$(ARG1)'" ; + Text [ italian ] = "Errore nel salvare la library: '$(ARG1)'" ; + Text [ spanish ] = "Error al guardar la biblioteca: '$(ARG1)'" ; + Text [ french ] = "Erreur lors de l'enregistrement de la bibliothèque : '$(ARG1)'" ; + Text [ swedish ] = "Fel vid sparandet av bibliotek: '$(ARG1)'" ; + Text [ danish ] = "Fejl under forsøg på at gemme biblioteket: '$(ARG1)'" ; + Text [ portuguese ] = "Erro ao guardar a biblioteca: '$(ARG1)" ; + Text [ portuguese_brazilian ] = "Fehler beim Speichern der Bibliothek: '$(ARG1)" ; + Text[ chinese_simplified ] = "´æÅÌ¿âʱ·¢Éú´íÎó '$(ARG1)'"; + Text[ russian ] = "Îøèáêà ïðè çàãðóçêå áèáëèîòåêè: '$(ARG1)'"; + Text[ polish ] = "B³¹d przy zapisie biblioteki '$(ARG1)'"; + Text[ japanese ] = "ײÌÞר‚̕ۑ¶‚ÌÛ‚Ì´×°: '$(ARG1)'"; + Text[ chinese_traditional ] = "Àx¦sµ{¦¡®w®Éµo¥Í¿ù»~'$(ARG1)'"; + Text[ arabic ] = "'$(ARG1)' :ÎØÃ ÃËäÇÁ ÍÝÙ ÇáãßÊÈÉ"; + Text[ dutch ] = "Fout bij het opslaan van bibliotheek: '$(ARG1)'"; + Text[ chinese_simplified ] = "´æÅÌ¿âʱ·¢Éú´íÎó '$(ARG1)'"; + Text[ greek ] = "ÓöÜëìá êáôÜ ôçí áðïèÞêåõóç ôçò âéâëéïèÞêçò: '$(ARG1)'"; + Text[ korean ] = "¶óÀ̺귯¸® $(ARG1) ÀúÀå ¿À·ù"; + Text[ turkish ] = "Kitaplýðý kaydetme sýrasýnda hata: '$(ARG1)'"; + Text[ language_user1 ] = " "; +}; +String ERRCODE_BASMGR_MGROPEN & ERRCODE_RES_MASK +{ + /* ### ACHTUNG: Neuer Text in Resource? Das BASIC aus der Datei '$(ARG1)' konnte nicht initialisiert werden : Das BASIC aus der Datei ''$(ARG1)'' konnte nicht initialisiert werden */ + /* ### ACHTUNG: Neuer Text in Resource? Das BASIC aus der Datei '$(ARG1)' konnte nicht initialisiert werden : Das BASIC aus der Datei ''$(ARG1)'' konnte nicht initialisiert werden */ + /* ### ACHTUNG: Neuer Text in Resource? Das BASIC aus der Datei '$(ARG1)' konnte nicht initialisiert werden : Das BASIC aus der Datei ''$(ARG1)'' konnte nicht initialisiert werden */ + /* ### ACHTUNG: Neuer Text in Resource? Das BASIC aus der Datei '$(ARG1)' konnte nicht initialisiert werden : Das BASIC aus der Datei ''$(ARG1)'' konnte nicht initialisiert werden */ + Text = "Das BASIC aus der Datei '$(ARG1)' konnte nicht initialisiert werden" ; + Text [ english ] = "The BASIC from the file '$(ARG1)' could not be initialized" ; + Text [ dutch ] = "BASIC in bestand '$(ARG1)' kon niet worden geïnitialiseerd" ; + Text [ english_us ] = "The BASIC from the file '$(ARG1)' could not be initialized" ; + Text [ italian ] = "Impossibile inizializzare il BASIC dal file '$(ARG1)'" ; + Text [ spanish ] = "No se pudo inicializar el Basic del archivo '$(ARG1)'" ; + Text [ french ] = "Impossible d'initialiser BASIC à partir du fichier '$(ARG1)'" ; + Text [ swedish ] = "BASIC från filen '$(ARG1)' kunde inte initialiseras" ; + Text [ danish ] = "Det var ikke muligt at initialisere BASIC fra filen '$(ARG1)'" ; + Text [ portuguese ] = "Impossível inicializar BASIC do ficheiro '$(ARG1)'" ; + Text [ portuguese_brazilian ] = "Das BASIC aus der Datei '$(ARG1)' konnte nicht initialisiert werden" ; + Text[ chinese_simplified ] = "ÎÞ·¨´ÓÎļþ'$(ARG1)' ³õʼ»¯ BASIC"; + Text[ russian ] = "Èíèöèàëèçèðîâàòü BASIC èç ôàéëà '$(ARG1)' íåâîçìîæíî"; + Text[ polish ] = "BASIC z pliku '$(ARG1)' nie móg³ zostaæ zainicjowany"; + Text[ japanese ] = "̧²Ù '$(ARG1)'‚©‚ç‚ÌBASIC‚͉Šú‰»‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½"; + Text[ chinese_traditional ] = "µLªk±qÀÉ®×'$(ARG1)'ªì©l¤ÆBASIC"; + Text[ arabic ] = "'$(ARG1)' ãä ÇáãáÝ BASIC ÊÚÐÑ ÊåíÆÉ"; + Text[ dutch ] = "BASIC in bestand '$(ARG1)' kon niet worden geïnitialiseerd"; + Text[ chinese_simplified ] = "ÎÞ·¨´ÓÎļþ'$(ARG1)' ³õʼ»¯ BASIC"; + Text[ greek ] = "Äåí Þôáí äõíáôüí íá ãßíåé áíáãíþñéóç ôïõ BASIC áðü ôï áñ÷åßï '$(ARG1)'."; + Text[ korean ] = "ÆÄÀÏ $(ARG1) ·Î ºÎÅÍÀÇ BASICÀº ÃʱâÈ µÇÁö¾Ê¾Ò½À´Ï´Ù."; + Text[ turkish ] = "'$(ARG1)' dosyasýndan BASIC kurulamadý"; + Text[ language_user1 ] = " "; +}; +String ERRCODE_BASMGR_MGRSAVE & ERRCODE_RES_MASK +{ + Text = "Fehler beim Speichern des BASIC's: '$(ARG1)'" ; + Text [ english ] = "Error saving BASIC: '$(ARG1)'" ; + Text [ dutch ] = "Fout bij het opslaan van BASIC: '$(ARG1)'" ; + Text [ english_us ] = "Error saving BASIC: '$(ARG1)'" ; + Text [ italian ] = "Errore nel salvare il BASIC: '$(ARG1)'" ; + Text [ spanish ] = "Error al guardar BASIC: '$(ARG1)'" ; + Text [ french ] = "Erreur lors de l'enregistrement de la macro BASIC : '$(ARG1)'" ; + Text [ swedish ] = "Fel vid sparandet av BASIC: '$(ARG1)'" ; + Text [ danish ] = "Fejl under forsøg på at gemme BASIC: '$(ARG1)'" ; + Text [ portuguese ] = "Erro ao guardar BASIC: '$(ARG1)'" ; + Text [ portuguese_brazilian ] = "Fehler beim Speichern des Basics: '$(ARG1)" ; + Text[ chinese_simplified ] = "´æÅÌBASICʱ·¢Éú´íÎó£º'$(ARG1)'"; + Text[ russian ] = "Îøèáêà ïðè ñîõðàíåíèè BASICà: '$(ARG1)'"; + Text[ polish ] = "B³¹d przy zapisie biblioteki BASIC: '$(ARG1)'"; + Text[ japanese ] = "BASIC‚̕ۑ¶‚ÌÛ‚Ì´×°: '$(ARG1)'"; + Text[ chinese_traditional ] = "Àx¦sBASIC®Éµo¥Í¿ù»~¡G'$(ARG1)'"; + Text[ arabic ] = "'$(ARG1)' :BASIC ÎØÃ ÃËäÇÁ ÍÝÙ"; + Text[ dutch ] = "Fout bij het opslaan van BASIC: '$(ARG1)'"; + Text[ chinese_simplified ] = "´æÅÌBASICʱ·¢Éú´íÎó£º'$(ARG1)'"; + Text[ greek ] = "ÓöÜëìá êáôÜ ôçí áðïèÞêåõóç ôïõ BASIC: '$(ARG1)'"; + Text[ korean ] = "BASIC ÀúÀå ¿À·ù :$(ARG1)"; + Text[ turkish ] = "BASIC'i kaydetme sýrasýnda hata: '$(ARG1)'"; + Text[ language_user1 ] = " "; +}; +String ERRCODE_BASMGR_REMOVELIB & ERRCODE_RES_MASK +{ + Text = "Fehler beim entfernen der Bibliothek" ; + Text [ ENGLISH ] = "Fehler beim entfernen der Bibliothek" ; + Text [ dutch ] = "Fout bij verwijderen van bibliotheek" ; + Text [ english_us ] = "Error removing library" ; + Text [ italian ] = "Errore nell'eliminare la library" ; + Text [ spanish ] = "Error al eliminar la biblioteca" ; + Text [ french ] = "Erreur lors de la suppression de la bibliothèque" ; + Text [ swedish ] = "Fel vid borttagande av bibliotek" ; + Text [ danish ] = "Fejl under sletning af biblioteket" ; + Text [ portuguese ] = "Erro ao eliminar a biblioteca" ; + Text [ portuguese_brazilian ] = "Fehler beim entfernen der Bibliothek" ; + Text[ chinese_simplified ] = "ɾ³ý¿âʱ·¢Éú´íÎó"; + Text[ russian ] = "Îøèáêà ïðè óäàëåíèè áèáëèîòåêè"; + Text[ polish ] = "B³¹d przy usuwaniu biblioteki"; + Text[ japanese ] = "ײÌÞר‚Ì휂ÌÛ‚Ì´×°"; + Text[ chinese_traditional ] = "§R°£µ{¦¡®w®Éµo¥Í¿ù»~"; + Text[ arabic ] = "ÎØÃ ÃËäÇÁ ÍÐÝ ÇáãßÊÈÉ"; + Text[ dutch ] = "Fout bij verwijderen van bibliotheek"; + Text[ chinese_simplified ] = "ɾ³ý¿âʱ·¢Éú´íÎó"; + Text[ greek ] = "ÓöÜëìá êáôÜ ôç äéáãñáöÞ âéâëéïèÞêçò"; + Text[ korean ] = "¶óÀ̺귯¸® »èÁ¦ ¿À·ù"; + Text[ turkish ] = "Kitaplýðý kaldýrma sýrasýnda hata"; + Text[ language_user1 ] = " "; +}; +String ERRCODE_BASMGR_UNLOADLIB & ERRCODE_RES_MASK +{ + Text = "Die Bibliothek konnte nicht aus dem Speicher entfernt werden." ; + Text [ ENGLISH ] = "Die Bibliothek konnte nicht aus dem Speicher entfernt werden." ; + Text [ dutch ] = "De bibliotheek kon niet uit het geheugen worden verwijderd." ; + Text [ english_us ] = "The library could not be removed from memory." ; + Text [ italian ] = "Impossibile eliminare la library dalla memoria." ; + Text [ spanish ] = "No se pudo eliminar la biblioteca de la memoria." ; + Text [ french ] = "Impossible de supprimer la bibliothèque de la mémoire." ; + Text [ swedish ] = "Biblioteket kunde inte tas bort från minnet." ; + Text [ danish ] = "Det var ikke muligt at slette biblioteket fra hukommelsen." ; + Text [ portuguese ] = "Foi impossível remover a biblioteca da memória." ; + Text [ portuguese_brazilian ] = "Die Bibliothek konnte nicht aus dem Speicher entfernt werden." ; + Text[ chinese_simplified ] = "ÎÞ·¨´ÓÄÚ´æÇå³ý³ÌÐò¿â"; + Text[ russian ] = "Óäàëèòü áèáëèîòåêó èç ïàìÿòè íåâîçìîæíî."; + Text[ polish ] = "Biblioteki nie mo¿na by³o usun¹æ z pamiêci."; + Text[ japanese ] = "ײÌÞר‚ÍÒÓØ‚©‚ç휂ł«‚Ü‚¹‚ñ‚Å‚µ‚½B"; + Text[ chinese_traditional ] = "µ{¦¡®wµLªk±q°O¾ÐÅ餺²M°£¡C"; + Text[ arabic ] = ".ÊÚÐÑ ÍÐÝ ÇáãßÊÈÉ ãä ÇáÐÇßÑÉ"; + Text[ dutch ] = "De bibliotheek kon niet uit het geheugen worden verwijderd."; + Text[ chinese_simplified ] = "ÎÞ·¨´ÓÄÚ´æÇå³ý³ÌÐò¿â"; + Text[ greek ] = "Äåí Þôáí äõíáôüí íá ãßíåé äéáãñáöÞ ôçò âéâëéïèÞêçò áðü ôç ìíÞìç"; + Text[ korean ] = "¶óÀ̺귯¸®°¡ ¸Þ¸ð¸®·Î ºÎÅÍ »èÁ¦µÉ ¼ö ¾ø½À´Ï´Ù."; + Text[ turkish ] = "Kitaplýk bellekten silinemedi."; + Text[ language_user1 ] = " "; +}; diff --git a/basic/source/classes/sbintern.cxx b/basic/source/classes/sbintern.cxx new file mode 100644 index 000000000000..2a94af758ece --- /dev/null +++ b/basic/source/classes/sbintern.cxx @@ -0,0 +1,109 @@ +/************************************************************************* + * + * $RCSfile: sbintern.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SHL_HXX //autogen +#include <tools/shl.hxx> +#endif +#include "sbintern.hxx" +#include "sbunoobj.hxx" +#include "token.hxx" // Tokenizer +#include "symtbl.hxx" // Symbolverwaltung +#include "parser.hxx" // Parser +#include "codegen.hxx" // Code-Generator +#pragma hdrstop + +SV_IMPL_PTRARR(SbErrorStack, SbErrorStackEntry*) + +SbiGlobals* GetSbData() +{ + SbiGlobals** pp = (SbiGlobals**) ::GetAppData( SHL_SBC ); + SbiGlobals* p = *pp; + if( !p ) + p = *pp = new SbiGlobals; + return p; +} + +SbiGlobals::SbiGlobals() +{ + pInst = NULL; + pMod = NULL; + pSbFac= NULL; + pUnoFac = NULL; + pCompMod = NULL; // JSM + nInst = 0; + nCode = 0; + nLine = 0; + nCol1 = nCol2 = 0; + bCompiler = FALSE; + bCompWait = FALSE; + bGlobalInitErr = FALSE; + bRunInit = FALSE; + eLanguageMode = SB_LANG_BASIC; + pErrStack = NULL; +} + +SbiGlobals::~SbiGlobals() +{ + delete pErrStack; + delete pSbFac; + delete pUnoFac; +} + diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx new file mode 100644 index 000000000000..799ffc0054a5 --- /dev/null +++ b/basic/source/classes/sbunoobj.cxx @@ -0,0 +1,2500 @@ +/************************************************************************* + * + * $RCSfile: sbunoobj.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +//#include <stl_queue.h> + +#ifndef _VOS_MUTEX_HXX_ //autogen +#include <vos/mutex.hxx> +#endif +#ifndef _SV_SVAPP_HXX //autogen +#include <vcl/svapp.hxx> +#endif +#ifndef _TOOLERR_HXX //autogen +#include <tools/errcode.hxx> +#endif +#ifndef _SFXHINT_HXX //autogen +#include <svtools/hint.hxx> +#endif +#ifndef _SBXCLASS_HXX //autogen +#include <svtools/sbx.hxx> +#endif + +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <cppuhelper/extract.hxx> + +#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_ +#include <unotools/processfactory.hxx> +#endif + +#include <rtl/ustrbuf.hxx> +#include <rtl/strbuf.hxx> + + +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/beans/PropertyConcept.hpp> +#include <com/sun/star/beans/MethodConcept.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/script/XAllListener.hpp> +#include <com/sun/star/script/XInvocationAdapterFactory.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XHierarchicalNameAccess.hpp> +#include <com/sun/star/reflection/XIdlArray.hpp> +#include <com/sun/star/reflection/XIdlReflection.hpp> +#include <com/sun/star/reflection/XIdlClassProvider.hpp> + +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::reflection; +using namespace com::sun::star::beans; +using namespace com::sun::star::script; +using namespace com::sun::star::container; +using namespace cppu; +using namespace rtl; + + +#include<sbstar.hxx> +#include<sbuno.hxx> +#include<sberrors.hxx> +#include<sbunoobj.hxx> +#include"sbjsmod.hxx" +#include<basmgr.hxx> +#include<sbintern.hxx> +#include<runtime.hxx> + +TYPEINIT1(SbUnoMethod,SbxMethod) +TYPEINIT1(SbUnoProperty,SbxProperty) +TYPEINIT1(SbUnoObject,SbxObject) +TYPEINIT1(SbUnoClass,SbxObject) + +//#define U2S(Str) String( OUStringToOString( Str, RTL_TEXTENCODING_ASCII_US ) ) +//#define S2U(Str) OStringToOUString( OString( (Str).GetStr() ), RTL_TEXTENCODING_ASCII_US ) + +typedef WeakImplHelper1< XAllListener > BasicAllListenerHelper; + +// Flag, um immer ueber Invocation zu gehen +//#define INVOCATION_ONLY + + +// Identifier fuer die dbg_-Properies als Strings anlegen +static String ID_DBG_SUPPORTEDINTERFACES( RTL_CONSTASCII_USTRINGPARAM("Dbg_SupportedInterfaces") ); +static String ID_DBG_PROPERTIES( RTL_CONSTASCII_USTRINGPARAM("Dbg_Properties") ); +static String ID_DBG_METHODS( RTL_CONSTASCII_USTRINGPARAM("Dbg_Methods") ); + + +// CoreReflection statisch speichern +Reference< XIdlReflection > getCoreReflection_Impl( void ) +{ + static Reference< XIdlReflection > xCoreReflection; + + // Haben wir schon CoreReflection, sonst besorgen + if( !xCoreReflection.is() ) + { + Reference< XMultiServiceFactory > xFactory = utl::getProcessServiceFactory(); + if ( xFactory.is() ) + { + Reference< XInterface > xI = xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.reflection.CoreReflection") ); + //if (xI.is()) + //{ + xCoreReflection = Reference<XIdlReflection>::query( xI ); + //xI->queryInterface( XIdlReflection::getSmartUik(), xCoreReflection ); + //} + } + } + return xCoreReflection; +} + +// TODO: Spaeter auslagern +Reference<XIdlClass> TypeToIdlClass( const Type& rType ) +{ + // void als Default-Klasse eintragen + Reference<XIdlClass> xRetClass; + typelib_TypeDescription * pTD = 0; + rType.getDescription( &pTD ); + if( pTD ) + { + OUString sOWName( pTD->pTypeName ); + Reference< XIdlReflection > xRefl = getCoreReflection_Impl(); + xRetClass = xRefl->forName( sOWName ); + } + return xRetClass; +} + +// Fehlermeldungs-Message bei Exception zusammenbauen +String implGetExceptionMsg( Exception& e1 ) +{ + // TODO: NAME??? + static String aBaseMsg( RTL_CONSTASCII_USTRINGPARAM("\nException " ) ); + String aMsg = aBaseMsg; + aMsg.AppendAscii( ": " ); + aMsg += String( e1.Message ); + //aMsg += ": " + U2S( ((Exception&)e1).Message ); + return aMsg; +} + +// Error-Message fuer WrappedTargetExceptions +String implGetWrappedMsg( WrappedTargetException& e1 ) +{ + Any aWrappedAny = e1.TargetException; + + // Haben wir wirklich eine gewrappte Exception? + if( aWrappedAny.getValueType().getTypeClass() == TypeClass_EXCEPTION ) + { + RuntimeException& e = *( (RuntimeException*)aWrappedAny.getValue() ); + return implGetExceptionMsg( e ); + } + // Sonst WrappedTargetException selbst liefern + else + { + return implGetExceptionMsg( e1 ); + } +} + +// Von Uno nach Sbx wandeln +SbxDataType unoToSbxType( const Reference< XIdlClass >& xIdlClass ) +{ + SbxDataType eRetType = SbxVOID; + + if( xIdlClass.is() ) + { + TypeClass eType = xIdlClass->getTypeClass(); + switch( eType ) + { + case TypeClass_INTERFACE: + case TypeClass_TYPE: + case TypeClass_STRUCT: eRetType = SbxOBJECT; break; + + /* folgende Typen lassen wir erstmal weg + case TypeClass_SERVICE: break; + case TypeClass_CLASS: break; + case TypeClass_TYPEDEF: break; + case TypeClass_UNION: break; + case TypeClass_EXCEPTION: break; + case TypeClass_ARRAY: break; + */ + case TypeClass_ENUM: eRetType = SbxLONG; break; + case TypeClass_SEQUENCE: + eRetType = (SbxDataType) ( SbxOBJECT | SbxARRAY ); + break; + + /* + case TypeClass_VOID: break; + case TypeClass_UNKNOWN: break; + */ + + case TypeClass_ANY: eRetType = SbxVARIANT; break; + case TypeClass_BOOLEAN: eRetType = SbxBOOL; break; + case TypeClass_CHAR: eRetType = SbxCHAR; break; + case TypeClass_STRING: eRetType = SbxSTRING; break; + case TypeClass_FLOAT: eRetType = SbxSINGLE; break; + case TypeClass_DOUBLE: eRetType = SbxDOUBLE; break; + //case TypeClass_OCTET: break; + case TypeClass_BYTE: eRetType = SbxBYTE; break; + //case TypeClass_INT: eRetType = SbxINT; break; + case TypeClass_SHORT: eRetType = SbxINTEGER; break; + case TypeClass_LONG: eRetType = SbxLONG; break; + //case TypeClass_HYPER: break; + //case TypeClass_UNSIGNED_OCTET: break; + case TypeClass_UNSIGNED_SHORT: eRetType = SbxUSHORT; break; + case TypeClass_UNSIGNED_LONG: eRetType = SbxULONG; break; + //case TypeClass_UNSIGNED_HYPER: break; + //case TypeClass_UNSIGNED_INT: eRetType = SbxUINT; break; + //case TypeClass_UNSIGNED_BYTE: eRetType = SbxUSHORT; break; + } + } + return eRetType; +} + +void unoToSbxValue( SbxVariable* pVar, const Any& aValue ) +{ + Type aType = aValue.getValueType(); + TypeClass eTypeClass = aType.getTypeClass(); + switch( eTypeClass ) + { + case TypeClass_TYPE: + { + // Map Type to IdlClass + Type aType; + aValue >>= aType; + Reference<XIdlClass> xClass = TypeToIdlClass( aType ); + Any aClassAny; + aClassAny <<= xClass; + + // SbUnoObject instanzieren + String aName; + SbUnoObject* pSbUnoObject = new SbUnoObject( aName, aClassAny ); + SbxObjectRef xWrapper = (SbxObject*)pSbUnoObject; + + // #51475 Wenn das Objekt ungueltig ist null liefern + if( pSbUnoObject->getUnoAny().getValueType().getTypeClass() == TypeClass_VOID ) + { + pVar->PutObject( NULL ); + } + else + { + pVar->PutObject( xWrapper ); + } + } + break; + + // Interfaces und Structs muessen in ein SbUnoObject gewrappt werden + case TypeClass_INTERFACE: + case TypeClass_STRUCT: + { + // SbUnoObject instanzieren + String aName; + SbUnoObject* pSbUnoObject = new SbUnoObject( aName, aValue ); + SbxObjectRef xWrapper = (SbxObject*)pSbUnoObject; + + // #51475 Wenn das Objekt ungueltig ist null liefern + if( pSbUnoObject->getUnoAny().getValueType().getTypeClass() == TypeClass_VOID ) + { + pVar->PutObject( NULL ); + } + else + { + pVar->PutObject( xWrapper ); + } + } + break; + + /* folgende Typen lassen wir erstmal weg + case TypeClass_SERVICE: break; + case TypeClass_CLASS: break; + case TypeClass_TYPEDEF: break; + case TypeClass_UNION: break; + case TypeClass_ENUM: break; + case TypeClass_EXCEPTION: break; + case TypeClass_ARRAY: break; + */ + + case TypeClass_ENUM: + { + sal_Int32 nEnum = 0; + enum2int( nEnum, aValue ); + pVar->PutLong( nEnum ); + } + break; + + case TypeClass_SEQUENCE: + { + Reference< XIdlClass > xIdlTargetClass = TypeToIdlClass( aType ); + Reference< XIdlArray > xIdlArray = xIdlTargetClass->getArray(); + sal_Int32 i, nLen = xIdlArray->getLen( aValue ); + // In Basic Array anlegen + SbxDimArrayRef xArray = new SbxDimArray( SbxVARIANT ); + if( nLen >= 0 ) + xArray->unoAddDim( 0, nLen - 1 ); + + // Elemente als Variablen eintragen + for( i = 0 ; i < nLen ; i++ ) + { + // Elemente wandeln + Any aElementAny = xIdlArray->get( aValue, (UINT32)i ); + //Any aElementAny = pSeqReflection->get( aValue, (UINT32)i ); + SbxVariableRef xVar = new SbxVariable( SbxVARIANT ); + unoToSbxValue( (SbxVariable*)xVar, aElementAny ); + + // Ins Array braten + short nIndex = (short)i; + xArray->Put( (SbxVariable*)xVar, &nIndex ); + } + + // Array zurueckliefern + USHORT nFlags = pVar->GetFlags(); + pVar->ResetFlag( SBX_FIXED ); + pVar->PutObject( (SbxDimArray*)xArray ); + pVar->SetFlags( nFlags ); + + // #54548, Die Parameter duerfen hier nicht weggehauen werden + //pVar->SetParameters( NULL ); + } + break; + + /* + case TypeClass_SEQUENCE: break; + case TypeClass_VOID: break; + case TypeClass_UNKNOWN: break; + + case TypeClass_ANY: + { + // Any rausholen und konvertieren + //Any* pAny = (Any*)aValue.get(); + //if( pAny ) + //unoToSbxValue( pVar, *pAny ); + } + break; + */ + + case TypeClass_BOOLEAN: pVar->PutBool( *(sal_Bool*)aValue.getValue() ); break; + case TypeClass_CHAR: { sal_Unicode val; aValue >>= val; pVar->PutChar( val ); } break; + case TypeClass_STRING: { OUString val; aValue >>= val; pVar->PutString( String( val ) ); } break; + case TypeClass_FLOAT: { float val; aValue >>= val; pVar->PutSingle( val ); } break; + case TypeClass_DOUBLE: { double val; aValue >>= val; pVar->PutDouble( val ); } break; + //case TypeClass_OCTET: break; + case TypeClass_BYTE: { sal_Int8 val; aValue >>= val; pVar->PutByte( val ); } break; + //case TypeClass_INT: break; + case TypeClass_SHORT: { sal_Int16 val; aValue >>= val; pVar->PutInteger( val ); } break; + case TypeClass_LONG: { sal_Int32 val; aValue >>= val; pVar->PutLong( val ); } break; + //case TypeClass_HYPER: break; + //case TypeClass_UNSIGNED_OCTET:break; + case TypeClass_UNSIGNED_SHORT: { sal_uInt16 val; aValue >>= val; pVar->PutUShort( val ); } break; + case TypeClass_UNSIGNED_LONG: { sal_uInt32 val; aValue >>= val; pVar->PutULong( val ); } break; + //case TypeClass_UNSIGNED_HYPER:break; + //case TypeClass_UNSIGNED_INT: break; + //case TypeClass_UNSIGNED_BYTE: break; + default: pVar->PutEmpty(); break; + } +} + +// Reflection fuer Sbx-Typen liefern +Type getUnoTypeForSbxBaseType( SbxDataType eType ) +{ + Type aRetType = getCppuVoidType(); + switch( eType ) + { + //case SbxEMPTY: eRet = TypeClass_VOID; break; + case SbxNULL: aRetType = ::getCppuType( (const Reference< XInterface > *)0 ); break; + case SbxINTEGER: aRetType = ::getCppuType( (sal_Int16*)0 ); break; + case SbxLONG: aRetType = ::getCppuType( (sal_Int32*)0 ); break; + case SbxSINGLE: aRetType = ::getCppuType( (float*)0 ); break; + case SbxDOUBLE: aRetType = ::getCppuType( (double*)0 ); break; + //case SbxCURRENCY: break; + case SbxDATE: aRetType = ::getCppuType( (double*)0 ); break; + case SbxSTRING: aRetType = ::getCppuType( (OUString*)0 ); break; + //case SbxOBJECT: break; + //case SbxERROR: break; + case SbxBOOL: aRetType = ::getCppuType( (sal_Bool*)0 ); break; + case SbxVARIANT: aRetType = ::getCppuType( (Any*)0 ); break; + //case SbxDATAOBJECT: break; + case SbxCHAR: aRetType = ::getCppuType( (sal_Unicode*)0 ); break; + case SbxBYTE: aRetType = ::getCppuType( (sal_Int8*)0 ); break; + case SbxUSHORT: aRetType = ::getCppuType( (sal_uInt16*)0 ); break; + case SbxULONG: aRetType = ::getCppuType( (sal_uInt32*)0 ); break; + //case SbxLONG64: break; + //case SbxULONG64: break; + // Maschinenabhaengige zur Sicherheit auf Hyper abbilden + case SbxINT: aRetType = ::getCppuType( (sal_Int32*)0 ); break; + case SbxUINT: aRetType = ::getCppuType( (sal_uInt32*)0 ); break; + //case SbxVOID: break; + //case SbxHRESULT: break; + //case SbxPOINTER: break; + //case SbxDIMARRAY: break; + //case SbxCARRAY: break; + //case SbxUSERDEF: break; + //case SbxLPSTR: break; + //case SbxLPWSTR: break; + //case SbxCoreSTRING: break; + } + return aRetType; +} + +// Konvertierung von Sbx nach Uno ohne bekannte Zielklasse fuer TypeClass_ANY +Type getUnoTypeForSbxValue( SbxValue* pVal ) +{ + Type aRetType = getCppuVoidType(); + if( !pVal ) + return aRetType; + + // SbxType nach Uno wandeln + SbxDataType eBaseType = pVal->SbxValue::GetType(); + if( eBaseType == SbxOBJECT ) + { + SbxBaseRef xObj = (SbxBase*)pVal->GetObject(); + if( !xObj ) + { + StarBASIC::Error( SbERR_INVALID_OBJECT ); + return aRetType; + } + + if( xObj->ISA(SbxDimArray) ) + { + SbxBase* pObj = (SbxBase*)xObj; + SbxDimArray* pArray = (SbxDimArray*)pObj; + + // es muss ein eindimensionales Array sein + short nLower, nUpper; + if( pArray->GetDims() == 1 && pArray->GetDim( 1, nLower, nUpper ) ) + { + INT32 nSize = nUpper - nLower + 1; + Type aElementType; + if( nSize == 0 ) + { + aElementType = getUnoTypeForSbxBaseType( (SbxDataType)(pArray->GetType() & 0xfff) ); + } + else + { + // Wenn alle Elemente des Arrays vom gleichen Typ sind, wird + // der genommen, sonst wird das ganze als Any-Sequence betrachtet + sal_Bool bInit = sal_False; + + short nIdx = nLower; + for( UINT32 i = 0 ; i < nSize ; i++,nIdx++ ) + { + SbxVariableRef xVar = pArray->Get( &nIdx ); + Type aType = getUnoTypeForSbxValue( (SbxVariable*)xVar ); + if( !bInit ) + { + aElementType = aType; + bInit = sal_True; + } + else if( aElementType != aType ) + { + // Verschiedene Typen -> AnySequence + aElementType = getCppuType( (Any*)0 ); + break; + } + } + } + + OUString aSeqTypeName( RTL_CONSTASCII_USTRINGPARAM("[]") ); + aSeqTypeName += aElementType.getTypeName(); + aRetType = Type( TypeClass_SEQUENCE, aSeqTypeName ); + } + // Ein Array mit Dim > 1 wird nicht konvertiert -> default==void liefern + } + // Kein Array, sondern... + else if( xObj->ISA(SbUnoObject) ) + { + aRetType = ((SbUnoObject*)(SbxBase*)xObj)->getUnoAny().getValueType(); + } + // Sonst ist es ein Nicht-Uno-Basic-Objekt -> default==void liefern + } + // Kein Objekt, Basistyp konvertieren + else + { + aRetType = getUnoTypeForSbxBaseType( eBaseType ); + } + return aRetType; +} + +// Deklaration Konvertierung von Sbx nach Uno mit bekannter Zielklasse +Any sbxToUnoValue( SbxVariable* pVar, const Reference< XIdlClass >& xIdlTargetClass ); + +// Konvertierung von Sbx nach Uno ohne bekannte Zielklasse fuer TypeClass_ANY +Any sbxToUnoValue( SbxVariable* pVar ) +{ + Type aType = getUnoTypeForSbxValue( pVar ); + return sbxToUnoValue( pVar, TypeToIdlClass( aType ) ); +} + +// Konvertierung von Sbx nach Uno mit bekannter Zielklasse +Any sbxToUnoValue( SbxVariable* pVar, const Reference< XIdlClass >& xIdlTargetClass ) +{ + Any aRetVal; + //aRetVal.setVoid(); + + TypeClass eType = xIdlTargetClass->getTypeClass(); + switch( eType ) + { + case TypeClass_INTERFACE: + case TypeClass_STRUCT: + { + // Null-Referenz? + if( pVar->IsNull() && eType == TypeClass_INTERFACE ) + { + Reference< XInterface > xRef; + OUString aClassName = xIdlTargetClass->getName(); + Type aClassType( xIdlTargetClass->getTypeClass(), aClassName.getStr() ); + aRetVal <<= aClassType; + } + else + { + SbxBaseRef pObj = (SbxBase*)pVar->GetObject(); + if( pObj && pObj->ISA(SbUnoObject) ) + aRetVal = ((SbUnoObject*)(SbxBase*)pObj)->getUnoAny(); + } + } + break; + + /* folgende Typen lassen wir erstmal weg + case TypeClass_SERVICE: break; + case TypeClass_CLASS: break; + case TypeClass_TYPEDEF: break; + case TypeClass_UNION: break; + case TypeClass_ENUM: break; + case TypeClass_EXCEPTION: break; + case TypeClass_ARRAY: break; + */ + + // Array -> Sequence + case TypeClass_ENUM: + { + OUString aClassName = xIdlTargetClass->getName(); + Type aEnumType( xIdlTargetClass->getTypeClass(), aClassName.getStr() ); + aRetVal = int2enum( pVar->GetLong(), aEnumType ); + } + break; + + case TypeClass_SEQUENCE: + { + SbxBaseRef xObj = (SbxBase*)pVar->GetObject(); + if( xObj && xObj->ISA(SbxDimArray) ) + { + SbxBase* pObj = (SbxBase*)xObj; + SbxDimArray* pArray = (SbxDimArray*)pObj; + + // Instanz der geforderten Sequence erzeugen + xIdlTargetClass->createObject( aRetVal ); + + // es muss ein eindimensionales Array sein + short nLower, nUpper; + if( pArray->GetDims() == 1 && pArray->GetDim( 1, nLower, nUpper ) ) + { + INT32 nSeqSize = nUpper - nLower + 1; + + Reference< XIdlArray > xArray = xIdlTargetClass->getArray(); + xArray->realloc( aRetVal, nSeqSize ); + + // Element-Type + OUString aClassName = xIdlTargetClass->getName(); + typelib_TypeDescription * pSeqTD = 0; + typelib_typedescription_getByName( &pSeqTD, aClassName.pData ); + OSL_ASSERT( pSeqTD ); +#if SUPD > 600 + Type aElemType( ((typelib_IndirectTypeDescription *)pSeqTD)->pType ); +#else + typelib_TypeDescription * pElementTD = + ((typelib_IndirectTypeDescription *)pSeqTD)->pType; + Type aElemType( pElementTD->pWeakRef ); +#endif + Reference< XIdlClass > xElementClass = TypeToIdlClass( aElemType ); + + // Alle Array-Member umwandeln und eintragen + short nIdx = nLower; + for( sal_Int32 i = 0 ; i < nSeqSize ; i++,nIdx++ ) + { + SbxVariableRef xVar = pArray->Get( &nIdx ); + + // Wert von Sbx nach Uno wandeln + Any aAnyValue = sbxToUnoValue( (SbxVariable*)xVar, xElementClass ); + + try + { + // In die Sequence uebernehmen + xArray->set( aRetVal, i, aAnyValue ); + } + catch( IllegalArgumentException& e1 ) + { + StarBASIC::Error( SbERR_INTERNAL_ERROR, implGetExceptionMsg( e1 ) ); + } + catch (IndexOutOfBoundsException& e2) + { + StarBASIC::Error( SbERR_OUT_OF_RANGE ); + } + } + } + } + } + break; + + /* + case TypeClass_VOID: break; + case TypeClass_UNKNOWN: break; + */ + + // Bei Any die Klassen-unabhaengige Konvertierungs-Routine nutzen + case TypeClass_ANY: + { + aRetVal = sbxToUnoValue( pVar ); + } + break; + + case TypeClass_BOOLEAN: aRetVal <<= (sal_Bool)( pVar->GetBool() ); break; + case TypeClass_CHAR: aRetVal <<= (sal_Unicode)( pVar->GetChar() ); break; + case TypeClass_STRING: aRetVal <<= OUString( pVar->GetString() ); break; + case TypeClass_FLOAT: aRetVal <<= pVar->GetSingle(); break; + case TypeClass_DOUBLE: aRetVal <<= pVar->GetDouble(); break; + //case TypeClass_OCTET: break; + case TypeClass_BYTE: aRetVal <<= (sal_Int8)( pVar->GetByte() ); break; + //case TypeClass_INT: break; + case TypeClass_SHORT: aRetVal <<= (sal_Int16)( pVar->GetInteger() ); break; + case TypeClass_LONG: aRetVal <<= (sal_Int32)( pVar->GetLong() ); break; + //case TypeClass_HYPER: break; + //case TypeClass_UNSIGNED_OCTET:break; + case TypeClass_UNSIGNED_SHORT: aRetVal <<= (sal_uInt16)( pVar->GetUShort() ); break; + case TypeClass_UNSIGNED_LONG: aRetVal <<= (sal_uInt32)( pVar->GetULong() ); break; + //case TypeClass_UNSIGNED_HYPER:break; + //case TypeClass_UNSIGNED_INT: break; + //case TypeClass_UNSIGNED_BYTE: break; + } + + return aRetVal; +} + +// Dbg-Hilfsmethode zum Auslesen der in einem Object implementierten Interfaces +String Impl_GetInterfaceInfo( const Reference< XInterface >& x, const Reference< XIdlClass >& xClass, USHORT nRekLevel ) +{ + Type aIfaceType = ::getCppuType( (const Reference< XInterface > *)0 ); + static Reference< XIdlClass > xIfaceClass = TypeToIdlClass( aIfaceType ); + + String aRetStr; + for( USHORT i = 0 ; i < nRekLevel ; i++ ) + aRetStr.AppendAscii( " " ); + aRetStr += String( xClass->getName() ); + OUString aClassName = xClass->getName(); + Type aClassType( xClass->getTypeClass(), aClassName.getStr() ); + + // Pruefen, ob das Interface wirklich unterstuetzt wird + if( !x->queryInterface( aClassType ).hasValue() ) + { + aRetStr.AppendAscii( " (ERROR: Not really supported!)\n" ); + } + // Gibt es Super-Interfaces + else + { + aRetStr.AppendAscii( "\n" ); + + // Super-Interfaces holen + Sequence< Reference< XIdlClass > > aSuperClassSeq = xClass->getSuperclasses(); + const Reference< XIdlClass >* pClasses = aSuperClassSeq.getConstArray(); + UINT32 nSuperIfaceCount = aSuperClassSeq.getLength(); + for( UINT32 j = 0 ; j < nSuperIfaceCount ; j++ ) + { + const Reference< XIdlClass >& rxIfaceClass = pClasses[j]; + if( !rxIfaceClass->equals( xIfaceClass ) ) + aRetStr += Impl_GetInterfaceInfo( x, rxIfaceClass, nRekLevel + 1 ); + } + } + return aRetStr; +} + +// Dbg-Hilfsmethode zum Auslesen der in einem Object implementierten Interfaces +String Impl_GetSupportedInterfaces( const String& rName, const Any& aToInspectObj ) +{ + //static Reference< XIdlClass > xUsrObjectClass = UsrObject::getUsrObjectIdlClass(); + + // #54898: Nur TypeClass Interface zulasssen + TypeClass eType = aToInspectObj.getValueType().getTypeClass(); + String aRet; + if( eType != TypeClass_INTERFACE ) + { + aRet += ID_DBG_SUPPORTEDINTERFACES; + aRet.AppendAscii( " not available for \"" ); + aRet += rName; + aRet.AppendAscii( "\"\n(TypeClass is not TypeClass_INTERFACE)" ); + } + else + { + // Interface aus dem Any besorgen + const Reference< XInterface > x = *(Reference< XInterface >*)aToInspectObj.getValue(); + + // XIdlClassProvider-Interface ansprechen + Reference< XIdlClassProvider > xClassProvider( x, UNO_QUERY ); + Reference< XTypeProvider > xTypeProvider( x, UNO_QUERY ); + + aRet.AssignAscii( "Supported interfaces by object " ); + if( xTypeProvider.is() ) + aRet.AppendAscii( "(using XTypeProvider) " ); + if( rName.Len() > 20 ) + aRet.AppendAscii( "\n" ); + aRet.AppendAscii( "(Type \"" ); + aRet += rName; + aRet.AppendAscii( "\"):\n" ); + if( xTypeProvider.is() ) + { + // Interfaces der Implementation holen + Sequence< Type > aTypeSeq = xTypeProvider->getTypes(); + //Sequence< Reference< XIdlClass > > aClassSeq = xTypeProvider->getTypes(); + const Type* pTypeArray = aTypeSeq.getConstArray(); + UINT32 nIfaceCount = aTypeSeq.getLength(); + for( UINT32 j = 0 ; j < nIfaceCount ; j++ ) + { + const Type& rType = pTypeArray[j]; + aRet += Impl_GetInterfaceInfo( x, TypeToIdlClass( rType ), 1 ); + } + } + else if( xClassProvider.is() ) + { + + DBG_ERROR( "XClassProvider not supported in UNO3" ); + } + } + return aRet; +} + + + +// Dbg-Hilfsmethode SbxDataType -> String +String Dbg_SbxDataType2String( SbxDataType eType ) +{ + String aRet( RTL_CONSTASCII_USTRINGPARAM("Unknown Sbx-Type!") ); + switch( eType ) + { + case SbxEMPTY: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxEMPTY") ); break; + case SbxNULL: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxNULL") ); break; + case SbxINTEGER: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxINTEGER") ); break; + case SbxLONG: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxLONG") ); break; + case SbxSINGLE: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxSINGLE") ); break; + case SbxDOUBLE: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxDOUBLE") ); break; + case SbxCURRENCY: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxCURRENCY") ); break; + case SbxDATE: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxDATE") ); break; + case SbxSTRING: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxSTRING") ); break; + case SbxOBJECT: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxOBJECT") ); break; + case SbxERROR: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxERROR") ); break; + case SbxBOOL: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxBOOL") ); break; + case SbxVARIANT: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxVARIANT") ); break; + case SbxDATAOBJECT: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxDATAOBJECT") ); break; + case SbxCHAR: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxCHAR") ); break; + case SbxBYTE: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxBYTE") ); break; + case SbxUSHORT: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxUSHORT") ); break; + case SbxULONG: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxULONG") ); break; + case SbxLONG64: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxLONG64") ); break; + case SbxULONG64: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxULONG64") ); break; + case SbxINT: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxINT") ); break; + case SbxUINT: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxUINT") ); break; + case SbxVOID: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxVOID") ); break; + case SbxHRESULT: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxHRESULT") ); break; + case SbxPOINTER: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxPOINTER") ); break; + case SbxDIMARRAY: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxDIMARRAY") ); break; + case SbxCARRAY: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxCARRAY") ); break; + case SbxUSERDEF: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxUSERDEF") ); break; + case SbxLPSTR: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxLPSTR") ); break; + case SbxLPWSTR: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxLPWSTR") ); break; + case SbxCoreSTRING: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxCoreSTRING" ) ); break; + case SbxOBJECT | SbxARRAY: aRet = String( RTL_CONSTASCII_USTRINGPARAM("SbxARRAY") ); break; + } + return aRet; +} + +// Dbg-Hilfsmethode zum Anzeigen der Properties eines SbUnoObjects +String Impl_DumpProperties( const String& rName, SbUnoObject* pUnoObj ) +{ + String aRet( RTL_CONSTASCII_USTRINGPARAM("Properties of object ") ); + if( rName.Len() > 20 ) + aRet.AppendAscii( "\n" ); + aRet.AppendAscii( "(Type \"" ); + aRet += rName; + aRet.AppendAscii( "\"):" ); + + // Uno-Infos auswerten, um Arrays zu erkennen + Reference< XIntrospectionAccess > xAccess = pUnoObj->getIntrospectionAccess(); + if( !xAccess.is() ) + { + Reference< XInvocation > xInvok = pUnoObj->getInvocation(); + if( xInvok.is() ) + xAccess = xInvok->getIntrospection(); + } + if( !xAccess.is() ) + { + aRet.AppendAscii( "\nUnknown, no introspection available" ); + return aRet; + } + + Sequence<Property> props = xAccess->getProperties( PropertyConcept::ALL - PropertyConcept::DANGEROUS ); + UINT32 nUnoPropCount = props.getLength(); + const Property* pUnoProps = props.getConstArray(); + + SbxArray* pProps = pUnoObj->GetProperties(); + USHORT nPropCount = pProps->Count(); + USHORT nPropsPerLine = 1 + nPropCount / 30; + for( USHORT i = 0; i < nPropCount; i++ ) + { + SbxVariable* pVar = pProps->Get( i ); + if( pVar ) + { + String aPropStr; + if( (i % nPropsPerLine) == 0 ) + aPropStr.AppendAscii( "\n" ); + + // Typ und Namen ausgeben + // Ist es in Uno eine Sequence? + SbxDataType eType = pVar->GetFullType(); + + BOOL bMaybeVoid = FALSE; + if( i < nUnoPropCount ) + { + const Property& rProp = pUnoProps[ i ]; + + // #63133: Bei MAYBEVOID Typ aus Uno neu konvertieren, + // damit nicht immer nur SbxEMPTY ausgegben wird. + if( rProp.Attributes & PropertyAttribute::MAYBEVOID ) + { + eType = unoToSbxType( TypeToIdlClass( rProp.Type ) ); + bMaybeVoid = TRUE; + } + if( eType == SbxOBJECT ) + { + Type aType = rProp.Type; + if( aType.getTypeClass() == TypeClass_SEQUENCE ) + eType = (SbxDataType) ( SbxOBJECT | SbxARRAY ); + } + } + aPropStr += Dbg_SbxDataType2String( eType ); + if( bMaybeVoid ) + aPropStr.AppendAscii( "/void" ); + aPropStr.AppendAscii( " " ); + aPropStr += pVar->GetName(); + + if( i == nPropCount - 1 ) + aPropStr.AppendAscii( "\n" ); + else + aPropStr.AppendAscii( "; " ); + + aRet += aPropStr; + } + } + return aRet; +} + +// Dbg-Hilfsmethode zum Anzeigen der Methoden eines SbUnoObjects +String Impl_DumpMethods( const String& rName, SbUnoObject* pUnoObj ) +{ + String aRet( RTL_CONSTASCII_USTRINGPARAM("Methods of object ") ); + if( rName.Len() > 20 ) + aRet.AppendAscii( "\n" ); + aRet.AppendAscii( "(Type \"" ); + aRet += rName; + aRet.AppendAscii( "\"):" ); + + // XIntrospectionAccess, um die Typen der Parameter auch ausgeben zu koennen + Reference< XIntrospectionAccess > xAccess = pUnoObj->getIntrospectionAccess(); + if( !xAccess.is() ) + { + Reference< XInvocation > xInvok = pUnoObj->getInvocation(); + if( xInvok.is() ) + xAccess = xInvok->getIntrospection(); + } + if( !xAccess.is() ) + { + aRet.AppendAscii( "\nUnknown, no introspection available" ); + return aRet; + } + Sequence< Reference< XIdlMethod > > methods = xAccess->getMethods + ( MethodConcept::ALL - MethodConcept::DANGEROUS ); + const Reference< XIdlMethod >* pUnoMethods = methods.getConstArray(); + + SbxArray* pMethods = pUnoObj->GetMethods(); + USHORT nMethodCount = pMethods->Count(); + USHORT nPropsPerLine = 1 + nMethodCount / 30; + for( USHORT i = 0; i < nMethodCount; i++ ) + { + SbxVariable* pVar = pMethods->Get( i ); + if( pVar ) + { + String aPropStr; + if( (i % nPropsPerLine) == 0 ) + aPropStr.AppendAscii( "\n" ); + + // Methode ansprechen + const Reference< XIdlMethod >& rxMethod = pUnoMethods[i]; + + // Ist es in Uno eine Sequence? + SbxDataType eType = pVar->GetFullType(); + if( eType == SbxOBJECT ) + { + Reference< XIdlClass > xClass = rxMethod->getReturnType(); + if( xClass.is() && xClass->getTypeClass() == TypeClass_SEQUENCE ) + eType = (SbxDataType) ( SbxOBJECT | SbxARRAY ); + } + // Name und Typ ausgeben + aPropStr += Dbg_SbxDataType2String( eType ); + aPropStr.AppendAscii( " " ); + aPropStr += pVar->GetName(); + aPropStr.AppendAscii( " ( " ); + + // get-Methode darf keinen Parameter haben + Sequence< Reference< XIdlClass > > aParamsSeq = rxMethod->getParameterTypes(); + UINT32 nParamCount = aParamsSeq.getLength(); + const Reference< XIdlClass >* pParams = aParamsSeq.getConstArray(); + + if( nParamCount > 0 ) + { + for( USHORT j = 0; j < nParamCount; j++ ) + { + String aTypeStr = Dbg_SbxDataType2String( unoToSbxType( pParams[ j ] ) ); + aPropStr += aTypeStr; + + if( j < nParamCount - 1 ) + aPropStr.AppendAscii( ", " ); + } + } + else + aPropStr.AppendAscii( "void" ); + + aPropStr.AppendAscii( " ) " ); + + if( i == nMethodCount - 1 ) + aPropStr.AppendAscii( "\n" ); + else + aPropStr.AppendAscii( "; " ); + + aRet += aPropStr; + } + } + return aRet; +} + +// Implementation SbUnoObject +void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ) +{ + if( bNeedIntrospection ) doIntrospection(); + + const SbxHint* pHint = PTR_CAST(SbxHint,&rHint); + if( pHint ) + { + SbxVariable* pVar = pHint->GetVar(); + SbxArray* pParams = pVar->GetParameters(); + SbUnoProperty* pProp = PTR_CAST(SbUnoProperty,pVar); + SbUnoMethod* pMeth = PTR_CAST(SbUnoMethod,pVar); + if( pProp ) + { + if( pHint->GetId() == SBX_HINT_DATAWANTED ) + { + // Test-Properties + INT32 nId = (INT32)pProp->nId; + if( nId < 0 ) + { + // Id == -1: Implementierte Interfaces gemaess ClassProvider anzeigen + if( nId == -1 ) // Property ID_DBG_SUPPORTEDINTERFACES" + { + String aRetStr = Impl_GetSupportedInterfaces( GetClassName(), getUnoAny() ); + pVar->PutString( aRetStr ); + } + // Id == -2: Properties ausgeben + else if( nId == -2 ) // Property ID_DBG_PROPERTIES + { + // Jetzt muessen alle Properties angelegt werden + implCreateAll(); + String aRetStr = Impl_DumpProperties( GetClassName(), this ); + pVar->PutString( aRetStr ); + } + // Id == -3: Methoden ausgeben + else if( nId == -3 ) // Property ID_DBG_METHODS + { + // Jetzt muessen alle Properties angelegt werden + implCreateAll(); + String aRetStr = Impl_DumpMethods( GetClassName(), this ); + pVar->PutString( aRetStr ); + } + return; + } + + if( mxUnoAccess.is() ) + { + try + { + // Wert holen + Reference< XPropertySet > xPropSet( mxUnoAccess->queryAdapter( ::getCppuType( (const Reference< XPropertySet > *)0 ) ), UNO_QUERY ); + Any aRetAny = xPropSet->getPropertyValue( pProp->GetName() ); + // Die Nutzung von getPropertyValue (statt ueber den Index zu gehen) ist + // nicht optimal, aber die Umstellung auf XInvocation steht ja ohnehin an + // Ansonsten kann auch FastPropertySet genutzt werden + + // Wert von Uno nach Sbx uebernehmen + unoToSbxValue( pVar, aRetAny ); + } + catch( WrappedTargetException& e1 ) + { + StarBASIC::Error( SbERR_INTERNAL_ERROR, implGetWrappedMsg( e1 ) ); + } + catch( RuntimeException& e2 ) + { + StarBASIC::Error( SbERR_INTERNAL_ERROR, implGetExceptionMsg( e2 ) ); + } + catch( Exception& e3 ) + { + StarBASIC::Error( SbERR_INTERNAL_ERROR, implGetExceptionMsg( e3 ) ); + } + } + else if( mxInvocation.is() ) + { + try + { + // Wert holen + Any aRetAny = mxInvocation->getValue( pProp->GetName() ); + + // Wert von Uno nach Sbx uebernehmen + unoToSbxValue( pVar, aRetAny ); + } + catch( WrappedTargetException& e1 ) + { + StarBASIC::Error( SbERR_INTERNAL_ERROR, implGetWrappedMsg( e1 ) ); + } + catch( RuntimeException& e2 ) + { + StarBASIC::Error( SbERR_INTERNAL_ERROR, implGetExceptionMsg( e2 ) ); + } + catch( Exception& e3 ) + { + StarBASIC::Error( SbERR_INTERNAL_ERROR, implGetExceptionMsg( e3 ) ); + } + } + } + else if( pHint->GetId() == SBX_HINT_DATACHANGED ) + { + if( mxUnoAccess.is() ) + { + if( pProp->aUnoProp.Attributes & PropertyAttribute::READONLY ) + { + StarBASIC::Error( SbERR_PROP_READONLY ); + return; + } + + // Wert von Uno nach Sbx uebernehmen + Any aAnyValue = sbxToUnoValue( pVar, TypeToIdlClass( pProp->aUnoProp.Type ) ); + try + { + // Wert setzen + Reference< XPropertySet > xPropSet( mxUnoAccess->queryAdapter( ::getCppuType( (const Reference< XPropertySet > *)0 ) ), UNO_QUERY ); + xPropSet->setPropertyValue( pProp->GetName(), aAnyValue ); + // Die Nutzung von getPropertyValue (statt ueber den Index zu gehen) ist + // nicht optimal, aber die Umstellung auf XInvocation steht ja ohnehin an + // Ansonsten kann auch FastPropertySet genutzt werden + } + catch( WrappedTargetException& e1 ) + { + StarBASIC::Error( SbERR_INTERNAL_ERROR, implGetWrappedMsg( e1 ) ); + } + catch( IllegalArgumentException& e2 ) + { + StarBASIC::Error( SbERR_INTERNAL_ERROR, implGetExceptionMsg( e2 ) ); + } + catch( RuntimeException& e3 ) + { + StarBASIC::Error( SbERR_INTERNAL_ERROR, implGetExceptionMsg( e3 ) ); + } + catch( Exception& e4 ) + { + StarBASIC::Error( SbERR_INTERNAL_ERROR, implGetExceptionMsg( e4 ) ); + } + } + else if( mxInvocation.is() ) + { + // Wert von Uno nach Sbx uebernehmen + Any aAnyValue = sbxToUnoValue( pVar ); + try + { + // Wert setzen + mxInvocation->setValue( pProp->GetName(), aAnyValue ); + } + catch( WrappedTargetException& e1 ) + { + StarBASIC::Error( SbERR_INTERNAL_ERROR, implGetWrappedMsg( e1 ) ); + } + catch( RuntimeException& e2 ) + { + StarBASIC::Error( SbERR_INTERNAL_ERROR, implGetExceptionMsg( e2 ) ); + } + catch( Exception& e3 ) + { + StarBASIC::Error( SbERR_INTERNAL_ERROR, implGetExceptionMsg( e3 ) ); + } + } + } + } + else if( pMeth ) + { + if( pHint->GetId() == SBX_HINT_DATAWANTED ) + { + UINT32 nParamCount = 0; + Sequence<Any> args; + BOOL bOutParams = FALSE; + UINT32 i; + if( pParams ) + { + // Anzahl Parameter -1 wegen Param0 == this + nParamCount = (UINT32)pParams->Count() - 1; + args.realloc( nParamCount ); + Any* pAnyArgs = args.getArray(); + + if( mxUnoAccess.is() ) + { + // Infos holen + const Sequence<ParamInfo>& rInfoSeq = pMeth->getParamInfos(); + const ParamInfo* pParamInfos = rInfoSeq.getConstArray(); + UINT32 nUnoParamCount = rInfoSeq.getLength(); + + // Ueberschuessige Parameter ignorieren, Alternative: Error schmeissen + if( nParamCount > nUnoParamCount ) + nParamCount = nUnoParamCount; + + for( i = 0 ; i < nParamCount ; i++ ) + { + const ParamInfo& rInfo = pParamInfos[i]; + const Reference< XIdlClass >& rxClass = rInfo.aType; + //const XIdlClassRef& rxClass = pUnoParams[i]; + + // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen! + pAnyArgs[i] = sbxToUnoValue( pParams->Get( (USHORT)(i+1) ), rxClass ); + + // Wenn es nicht schon feststeht pruefen, ob Out-Parameter vorliegen + if( !bOutParams ) + { + ParamMode aParamMode = rInfo.aMode; + if( aParamMode != ParamMode_IN ) + bOutParams = TRUE; + } + } + } + else if( mxInvocation.is() ) + { + for( i = 0 ; i < nParamCount ; i++ ) + { + // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen! + pAnyArgs[i] = sbxToUnoValue( pParams->Get( (USHORT)(i+1) ) ); + } + } + } + + // Methode callen + try + { + if( mxUnoAccess.is() ) + { + Any aRetAny = pMeth->m_xUnoMethod->invoke( getUnoAny(), args ); + + // Wert von Uno nach Sbx uebernehmen + unoToSbxValue( pVar, aRetAny ); + + // Muessen wir Out-Parameter zurueckkopieren? + if( bOutParams ) + { + const Any* pAnyArgs = args.getConstArray(); + + // Infos holen + const Sequence<ParamInfo>& rInfoSeq = pMeth->getParamInfos(); + const ParamInfo* pParamInfos = rInfoSeq.getConstArray(); + + UINT32 i; + for( i = 0 ; i < nParamCount ; i++ ) + { + const ParamInfo& rInfo = pParamInfos[i]; + ParamMode aParamMode = rInfo.aMode; + if( aParamMode != ParamMode_IN ) + unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(i+1) ), pAnyArgs[ i ] ); + } + } + } + else if( mxInvocation.is() ) + { + Sequence< INT16 > OutParamIndex; + Sequence< Any > OutParam; + Any aRetAny = mxInvocation->invoke( pMeth->GetName(), args, OutParamIndex, OutParam ); + + // Wert von Uno nach Sbx uebernehmen + unoToSbxValue( pVar, aRetAny ); + + const INT16* pIndices = OutParamIndex.getConstArray(); + UINT32 nLen = OutParamIndex.getLength(); + if( nLen ) + { + const Any* pNewValues = OutParam.getConstArray(); + for( UINT32 i = 0 ; i < nLen ; i++ ) + { + INT16 iTarget = pIndices[ i ]; + if( iTarget >= nParamCount ) + break; + unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(i+1) ), pNewValues[ i ] ); + } + } + } + + // #55460, Parameter hier weghauen, da das in unoToSbxValue() + // bei Arrays wegen #54548 nicht mehr gemacht wird + if( pParams ) + pVar->SetParameters( NULL ); + } + catch( WrappedTargetException& e1 ) + { + StarBASIC::Error( SbERR_INTERNAL_ERROR, implGetWrappedMsg( e1 ) ); + } + catch( RuntimeException& e2 ) + { + StarBASIC::Error( SbERR_INTERNAL_ERROR, implGetExceptionMsg( e2 ) ); + } + catch( Exception& e3 ) + { + StarBASIC::Error( SbERR_INTERNAL_ERROR, implGetExceptionMsg( e3 ) ); + } + /* + catch( NullPointerException& e1 ) + { + } + catch( InvocationTargetException& e2 ) + { + } + catch( IllegalArgumentException& e3) + { + } + */ + } + } + else + SbxObject::SFX_NOTIFY( rBC, rBCType, rHint, rHintType ); + } +} + + +#ifdef INVOCATION_ONLY +// Aus USR +Reference< XInvocation > createDynamicInvocationFor( const Any& aAny ); +#endif + +SbUnoObject::SbUnoObject( const String& aName, const Any& aUnoObj_ ) + : SbxObject( aName ) +{ + static Reference< XIntrospection > xIntrospection; + + // Default-Properties von Sbx wieder rauspruegeln + Remove( XubString( RTL_CONSTASCII_USTRINGPARAM("Name") ), SbxCLASS_DONTCARE ); + Remove( XubString( RTL_CONSTASCII_USTRINGPARAM("Parent") ), SbxCLASS_DONTCARE ); + + // Typ des Objekts pruefen + TypeClass eType = aUnoObj_.getValueType().getTypeClass(); + Reference< XInterface > x; + if( eType == TypeClass_INTERFACE ) + { + // Interface aus dem Any besorgen + x = *(Reference< XInterface >*)aUnoObj_.getValue(); + if( !x.is() ) + return; + } + +#ifdef INVOCATION_ONLY + // Invocation besorgen + mxInvocation = createDynamicInvocationFor( aUnoObj_ ); +#else + // Hat das Object selbst eine Invocation? + mxInvocation = Reference< XInvocation >( x, UNO_QUERY ); +#endif + + if( mxInvocation.is() ) + { + // MaterialHolder holen + mxMaterialHolder = Reference< XMaterialHolder >::query( mxInvocation ); + + // ExactName holen + mxExactName = Reference< XExactName >::query( mxInvocation ); + + // Rest bezieht sich nur auf Introspection + bNeedIntrospection = FALSE; + return; + } + + // Introspection-Flag + bNeedIntrospection = TRUE; + maTmpUnoObj = aUnoObj_; + + + //*** Namen bestimmen *** + BOOL bFatalError = TRUE; + + // Ist es ein Interface oder eine struct? + BOOL bSetClassName = FALSE; + String aClassName; + if( eType == TypeClass_STRUCT ) + { + // Struct ist Ok + bFatalError = FALSE; + + // #67173 Echten Klassen-Namen eintragen + if( aName.Len() == 0 ) + { + aClassName = String( aUnoObj_.getValueType().getTypeName() ); + bSetClassName = TRUE; + } + } + else if( eType == TypeClass_INTERFACE ) + { + // #70197 Interface geht immer durch Typ im Any + bFatalError = FALSE; + + // Nach XIdlClassProvider-Interface fragen + Reference< XIdlClassProvider > xClassProvider( x, UNO_QUERY ); + if( xClassProvider.is() ) + { + // #67173 Echten Klassen-Namen eintragen + if( aName.Len() == 0 ) + { + Sequence< Reference< XIdlClass > > szClasses = xClassProvider->getIdlClasses(); + UINT32 nLen = szClasses.getLength(); + if( nLen ) + { + const Reference< XIdlClass > xImplClass = szClasses.getConstArray()[ 0 ]; + if( xImplClass.is() ) + { + aClassName = String( xImplClass->getName() ); + bSetClassName = TRUE; + } + } + } + } + } + if( bSetClassName ) + SetClassName( aClassName ); + + // Weder Interface noch Struct -> FatalError + if( bFatalError ) + { + StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); + return; + } + + // #67781 Introspection erst on demand durchfuehren +} + +SbUnoObject::~SbUnoObject() +{} + + +// #76470 Introspection on Demand durchfuehren +void SbUnoObject::doIntrospection( void ) +{ + static Reference< XIntrospection > xIntrospection; + + if( !bNeedIntrospection ) + return; + bNeedIntrospection = FALSE; + + if( !xIntrospection.is() ) + { + // Introspection-Service holen + Reference< XMultiServiceFactory > xFactory( utl::getProcessServiceFactory() ); + if ( xFactory.is() ) + { + Reference< XInterface > xI = xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.beans.Introspection") ); + if (xI.is()) + xIntrospection = Reference< XIntrospection >::query( xI ); + //xI->queryInterface( ::getCppuType( (const Reference< XIntrospection > *)0 ), xIntrospection ); + } + } + if( !xIntrospection.is() ) + { + StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); + return; + } + + // Introspection durchfuehren + try + { + mxUnoAccess = xIntrospection->inspect( maTmpUnoObj ); + } + catch( RuntimeException& e ) + { + String aMsg = implGetExceptionMsg( e ); + } + + if( !mxUnoAccess.is() ) + { + // #51475 Ungueltiges Objekt kennzeichnen (kein mxMaterialHolder) + return; + } + + // MaterialHolder vom Access holen + mxMaterialHolder = Reference< XMaterialHolder >::query( mxUnoAccess ); + + // ExactName vom Access holen + mxExactName = Reference< XExactName >::query( mxUnoAccess ); +} + + + + +// #67781 Start einer Liste aller SbUnoMethod-Instanzen +static SbUnoMethod* pFirst = NULL; + +void clearUnoMethods( void ) +{ + SbUnoMethod* pMeth = pFirst; + while( pMeth ) + { + pMeth->SbxValue::Clear(); + pMeth = pMeth->pNext; + } +} + + +SbUnoMethod::SbUnoMethod +( + const String& aName, + SbxDataType eSbxType, + Reference< XIdlMethod > xUnoMethod_ +) + : SbxMethod( aName, eSbxType ) +{ + m_xUnoMethod = xUnoMethod_; + pParamInfoSeq = NULL; + + // #67781 Methode in Liste eintragen + pNext = pFirst; + pPrev = NULL; + pFirst = this; + if( pNext ) + pNext->pPrev = this; +} + +SbUnoMethod::~SbUnoMethod() +{ + delete pParamInfoSeq; + + if( this == pFirst ) + pFirst = pNext; + else if( pPrev ) + pPrev->pNext = pNext; + if( pNext ) + pNext->pPrev = pPrev; +} + +const Sequence<ParamInfo>& SbUnoMethod::getParamInfos( void ) +{ + if( !pParamInfoSeq ) + { + Sequence<ParamInfo> aTmp = m_xUnoMethod->getParameterInfos() ; + pParamInfoSeq = new Sequence<ParamInfo>( aTmp ); + //pParamInfoSeq = new Sequence<ParamInfo>( m_xUnoMethod->getParameterInfos() ); + } + return *pParamInfoSeq; +} + +SbUnoProperty::SbUnoProperty +( + const String& aName, + SbxDataType eSbxType, + const Property& aUnoProp_, + UINT32 nId_ +) + : SbxProperty( aName, eSbxType ) +{ + aUnoProp = aUnoProp_; + nId = nId_; + + // #54548, bei bedarf Dummy-Array einsetzen, damit SbiRuntime::CheckArray() geht + static SbxArrayRef xDummyArray = new SbxArray( SbxVARIANT ); + if( eSbxType & SbxARRAY ) + PutObject( xDummyArray ); +} + +SbUnoProperty::~SbUnoProperty() +{} + + +// #72732 Spezielle SbxVariable, die beim put/get prueft, +// ob der Kontext fuer eine UnoClass sinnvoll ist. Sonst +// liegt eventuell ein Schreibfehler im Basic-Source vor. +BOOL UnoClassMemberVariable::Get( SbxValues& rRes ) const +{ + // Zugriff auf den Member einer UnoClass mit Parametern ist unsinnig + if( GetParameters() ) + { + if( mpRuntime ) + mpRuntime->Error( SbERR_NO_METHOD ); + } + return SbxVariable::Get( rRes ); +} + +BOOL UnoClassMemberVariable::Put( const SbxValues& rRes ) +{ + if( bInternalUse ) + { + return SbxVariable::Put( rRes ); + } + // Schreibzugriff auf den Member einer UnoClass ist immer falsch + mpRuntime->Error( SbERR_NO_METHOD ); + return FALSE; +} + +TYPEINIT1(UnoClassMemberVariable,SbxVariable) + + +SbxVariable* SbUnoObject::Find( const XubString& rName, SbxClassType t ) +{ + static Reference< XIdlMethod > xDummyMethod; + static Property aDummyProp; + + SbxVariable* pRes = SbxObject::Find( rName, t ); + + if( bNeedIntrospection ) doIntrospection(); + + // Neu 4.3.1999: Properties on Demand anlegen, daher jetzt perIntrospectionAccess + // suchen, ob doch eine Property oder Methode des geforderten Namens existiert + if( !pRes && mxExactName.is() ) + { + OUString aUNonCaseName( rName ); + OUString aUName = mxExactName->getExactName( aUNonCaseName ); + if( mxUnoAccess.is() ) + { + if( aUName.len() ) + { + if( mxUnoAccess->hasProperty( aUName, PropertyConcept::ALL - PropertyConcept::DANGEROUS ) ) + { + const Property& rProp = mxUnoAccess-> + getProperty( aUName, PropertyConcept::ALL - PropertyConcept::DANGEROUS ); + + // #58455 Wenn die Property void sein kann, muss als Typ Variant gesetzt werden + SbxDataType eSbxType; + if( rProp.Attributes & PropertyAttribute::MAYBEVOID ) + eSbxType = SbxVARIANT; + else + eSbxType = unoToSbxType( TypeToIdlClass( rProp.Type ) ); + + // Property anlegen und reinbraten + SbxVariableRef xVarRef = new SbUnoProperty( rProp.Name, eSbxType, rProp, 0 ); + QuickInsert( (SbxVariable*)xVarRef ); + pRes = xVarRef; + } + else if( mxUnoAccess->hasMethod( aUName, + MethodConcept::ALL - MethodConcept::DANGEROUS ) ) + { + // Methode ansprechen + const Reference< XIdlMethod >& rxMethod = mxUnoAccess-> + getMethod( aUName, MethodConcept::ALL - MethodConcept::DANGEROUS ); + + // SbUnoMethode anlegen und reinbraten + SbxVariableRef xMethRef = new SbUnoMethod + ( rxMethod->getName(), unoToSbxType( rxMethod->getReturnType() ), rxMethod ); + QuickInsert( (SbxVariable*)xMethRef ); + pRes = xMethRef; + } + } + + // Wenn immer noch nichts gefunden wurde, muss geprueft werden, ob NameAccess vorliegt + if( !pRes ) + { + try + { + Reference< XNameAccess > xNameAccess( mxUnoAccess->queryAdapter( ::getCppuType( (const Reference< XPropertySet > *)0 ) ), UNO_QUERY ); + OUString aUName( rName ); + + if( xNameAccess.is() && xNameAccess->hasByName( aUName ) ) + { + Any aAny = xNameAccess->getByName( aUName ); + + // ACHTUNG: Die hier erzeugte Variable darf wegen bei XNameAccess + // nicht als feste Property in das Object aufgenommen werden und + // wird daher nirgendwo gehalten. + // Wenn das Probleme gibt, muss das kuenstlich gemacht werden oder + // es muss eine Klasse SbUnoNameAccessProperty geschaffen werden, + // bei der die Existenz staendig neu ueberprueft und die ggf. weg- + // geworfen wird, wenn der Name nicht mehr gefunden wird. + pRes = new SbxVariable( SbxVARIANT ); + unoToSbxValue( pRes, aAny ); + } + } + catch( WrappedTargetException& e1 ) + { + // Anlegen, damit der Exception-Fehler nicht ueberschrieben wird + if( !pRes ) + pRes = new SbxVariable( SbxVARIANT ); + + StarBASIC::Error( SbERR_INTERNAL_ERROR, implGetWrappedMsg( e1 ) ); + } + catch( RuntimeException& e2 ) + { + // Anlegen, damit der Exception-Fehler nicht ueberschrieben wird + if( !pRes ) + pRes = new SbxVariable( SbxVARIANT ); + + StarBASIC::Error( SbERR_INTERNAL_ERROR, implGetExceptionMsg( e2 ) ); + } + } + } + else if( mxInvocation.is() ) + { + if( aUName.len() ) + { + if( mxInvocation->hasProperty( aUName ) ) + { + // Property anlegen und reinbraten + SbxVariableRef xVarRef = new SbUnoProperty( aUName, SbxVARIANT, aDummyProp, 0 ); + QuickInsert( (SbxVariable*)xVarRef ); + pRes = xVarRef; + } + else if( mxInvocation->hasMethod( aUName ) ) + { + // SbUnoMethode anlegen und reinbraten + SbxVariableRef xMethRef = new SbUnoMethod( aUName, SbxVARIANT, xDummyMethod ); + QuickInsert( (SbxVariable*)xMethRef ); + pRes = xMethRef; + } + } + } + } + + // Ganz am Schluss noch pruefen, ob die Dbg_-Properties gemeint sind + + if( !pRes ) + { + if( rName.EqualsIgnoreCaseAscii( ID_DBG_SUPPORTEDINTERFACES ) || + rName.EqualsIgnoreCaseAscii( ID_DBG_PROPERTIES ) || + rName.EqualsIgnoreCaseAscii( ID_DBG_METHODS ) ) + { + // Anlegen + implCreateDbgProperties(); + + // Jetzt muessen sie regulaer gefunden werden + pRes = SbxObject::Find( rName, SbxCLASS_DONTCARE ); + } + } + return pRes; +} + +// Hilfs-Methode zum Anlegen der dbg_-Properties +void SbUnoObject::implCreateDbgProperties( void ) +{ + Property aProp; + + // Id == -1: Implementierte Interfaces gemaess ClassProvider anzeigen + SbxVariableRef xVarRef = new SbUnoProperty( ID_DBG_SUPPORTEDINTERFACES, SbxSTRING, aProp, -1 ); + QuickInsert( (SbxVariable*)xVarRef ); + + // Id == -2: Properties ausgeben + xVarRef = new SbUnoProperty( ID_DBG_PROPERTIES, SbxSTRING, aProp, -2 ); + QuickInsert( (SbxVariable*)xVarRef ); + + // Id == -3: Methoden ausgeben + xVarRef = new SbUnoProperty( ID_DBG_METHODS, SbxSTRING, aProp, -3 ); + QuickInsert( (SbxVariable*)xVarRef ); +} + +void SbUnoObject::implCreateAll( void ) +{ + // Bestehende Methoden und Properties alle wieder wegwerfen + pMethods = new SbxArray; + pProps = new SbxArray; + + if( bNeedIntrospection ) doIntrospection(); + + // Instrospection besorgen + Reference< XIntrospectionAccess > xAccess = mxUnoAccess; + if( !xAccess.is() ) + { + if( mxInvocation.is() ) + xAccess = mxInvocation->getIntrospection(); + } + if( !xAccess.is() ) + return; + + // Properties anlegen + Sequence<Property> props = xAccess->getProperties( PropertyConcept::ALL - PropertyConcept::DANGEROUS ); + UINT32 nPropCount = props.getLength(); + const Property* pProps = props.getConstArray(); + + UINT32 i; + for( i = 0 ; i < nPropCount ; i++ ) + { + const Property& rProp = pProps[ i ]; + + // #58455 Wenn die Property void sein kann, muss als Typ Variant gesetzt werden + SbxDataType eSbxType; + if( rProp.Attributes & PropertyAttribute::MAYBEVOID ) + eSbxType = SbxVARIANT; + else + eSbxType = unoToSbxType( TypeToIdlClass( rProp.Type ) ); + + // Property anlegen und reinbraten + SbxVariableRef xVarRef = new SbUnoProperty( rProp.Name, eSbxType, rProp, i ); + QuickInsert( (SbxVariable*)xVarRef ); + } + + // Dbg_-Properties anlegen + implCreateDbgProperties(); + + // Methoden anlegen + Sequence< Reference< XIdlMethod > > aMethodSeq = xAccess->getMethods + ( MethodConcept::ALL - MethodConcept::DANGEROUS ); + UINT32 nMethCount = aMethodSeq.getLength(); + const Reference< XIdlMethod >* pMethods = aMethodSeq.getConstArray(); + for( i = 0 ; i < nMethCount ; i++ ) + { + // Methode ansprechen + const Reference< XIdlMethod >& rxMethod = pMethods[i]; + + // SbUnoMethode anlegen und reinbraten + SbxVariableRef xMethRef = new SbUnoMethod + ( rxMethod->getName(), unoToSbxType( rxMethod->getReturnType() ), rxMethod ); + QuickInsert( (SbxVariable*)xMethRef ); + } +} + + +// Wert rausgeben +Any SbUnoObject::getUnoAny( void ) +{ + Any aRetAny; + if( bNeedIntrospection ) doIntrospection(); + if( mxMaterialHolder.is() ) + aRetAny = mxMaterialHolder->getMaterial(); + else if( mxInvocation.is() ) + aRetAny <<= mxInvocation; + return aRetAny; +} + +// Hilfsmethode zum Anlegen einer Uno-Struct per CoreReflection +SbUnoObject* Impl_CreateUnoStruct( const String& aClassName ) +{ + // CoreReflection holen + Reference< XIdlReflection > xCoreReflection = getCoreReflection_Impl(); + if( !xCoreReflection.is() ) + return NULL; + + // Klasse suchen + Reference< XIdlClass > xClass = xCoreReflection->forName( aClassName ); + if( !xClass.is() ) + return NULL; + + // Ist es ueberhaupt ein struct? + TypeClass eType = xClass->getTypeClass(); + if( eType != TypeClass_STRUCT ) + return NULL; + + // Instanz erzeugen + Any aNewAny; + xClass->createObject( aNewAny ); + + // SbUnoObject daraus basteln + SbUnoObject* pUnoObj = new SbUnoObject( aClassName, aNewAny ); + return pUnoObj; +} + + +// Factory-Klasse fuer das Anlegen von Uno-Structs per DIM AS NEW +SbxBase* SbUnoFactory::Create( UINT16 nSbxId, UINT32 ) +{ + // Ueber SbxId laeuft in Uno nix + return NULL; +} + +SbxObject* SbUnoFactory::CreateObject( const String& rClassName ) +{ + return Impl_CreateUnoStruct( rClassName ); +} + + +// Provisorische Schnittstelle fuer UNO-Anbindung +// Liefert ein SbxObject, das ein Uno-Interface wrappt +SbxObjectRef GetSbUnoObject( const String& aName, const Any& aUnoObj_ ) +{ + return new SbUnoObject( aName, aUnoObj_ ); +} + +void RTL_Impl_CreateUnoStruct( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) +{ + // Wir brauchen mindestens 1 Parameter + if ( rPar.Count() < 2 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + // Klassen-Name der struct holen + String aClassName = rPar.Get(1)->GetString(); + + // Versuchen, gleichnamige Struct zu erzeugen + SbUnoObjectRef xUnoObj = Impl_CreateUnoStruct( aClassName ); + if( !xUnoObj ) + return; + + // Objekt zurueckliefern + SbxVariableRef refVar = rPar.Get(0); + refVar->PutObject( (SbUnoObject*)xUnoObj ); +} + +void RTL_Impl_CreateUnoService( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) +{ + // Wir brauchen mindestens 1 Parameter + if ( rPar.Count() < 2 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + // Klassen-Name der struct holen + String aServiceName = rPar.Get(1)->GetString(); + + // Service suchen und instanzieren + Reference< XMultiServiceFactory > xFactory( utl::getProcessServiceFactory() ); + Reference< XInterface > xInterface; + if ( xFactory.is() ) + { + try + { + xInterface = xFactory->createInstance( aServiceName ); + } + catch( WrappedTargetException& e1 ) + { + StarBASIC::Error( SbERR_INTERNAL_ERROR, implGetWrappedMsg( e1 ) ); + } + catch( RuntimeException& e2 ) + { + StarBASIC::Error( SbERR_INTERNAL_ERROR, implGetExceptionMsg( e2 ) ); + } + } + + SbxVariableRef refVar = rPar.Get(0); + if( xInterface.is() ) + { + Any aAny; + aAny <<= xInterface; + + // SbUnoObject daraus basteln und zurueckliefern + SbUnoObjectRef xUnoObj = new SbUnoObject( aServiceName, aAny ); + if( xUnoObj->getUnoAny().getValueType().getTypeClass() != TypeClass_VOID ) + { + // Objekt zurueckliefern + refVar->PutObject( (SbUnoObject*)xUnoObj ); + } + else + { + refVar->PutObject( NULL ); + } + } + else + { + refVar->PutObject( NULL ); + } +} + +void RTL_Impl_GetProcessServiceManager( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) +{ + SbxVariableRef refVar = rPar.Get(0); + + // Globalen Service-Manager holen + Reference< XMultiServiceFactory > xFactory( utl::getProcessServiceFactory() ); + if( xFactory.is() ) + { + Any aAny; + aAny <<= xFactory; + + // SbUnoObject daraus basteln und zurueckliefern + SbUnoObjectRef xUnoObj = new SbUnoObject( String( RTL_CONSTASCII_USTRINGPARAM("ProcessServiceManager") ), aAny ); + refVar->PutObject( (SbUnoObject*)xUnoObj ); + } + else + { + refVar->PutObject( NULL ); + } +} + +void RTL_Impl_HasInterfaces( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) +{ + // Wir brauchen mindestens 2 Parameter + USHORT nParCount = rPar.Count(); + if( nParCount < 3 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + // Variable fuer Rueckgabewert + SbxVariableRef refVar = rPar.Get(0); + refVar->PutBool( FALSE ); + + // Uno-Objekt holen + SbxBaseRef pObj = (SbxBase*)rPar.Get( 1 )->GetObject(); + if( !(pObj && pObj->ISA(SbUnoObject)) ) + return; + Any aAny = ((SbUnoObject*)(SbxBase*)pObj)->getUnoAny(); + TypeClass eType = aAny.getValueType().getTypeClass(); + if( eType != TypeClass_INTERFACE ) + return; + + // Interface aus dem Any besorgen + Reference< XInterface > x = *(Reference< XInterface >*)aAny.getValue(); + + // CoreReflection holen + Reference< XIdlReflection > xCoreReflection = getCoreReflection_Impl(); + if( !xCoreReflection.is() ) + return; + + for( USHORT i = 2 ; i < nParCount ; i++ ) + { + // Interface-Name der struct holen + String aIfaceName = rPar.Get( i )->GetString(); + + // Klasse suchen + Reference< XIdlClass > xClass = xCoreReflection->forName( aIfaceName ); + if( !xClass.is() ) + return; + + // Pruefen, ob das Interface unterstuetzt wird + OUString aClassName = xClass->getName(); + Type aClassType( xClass->getTypeClass(), aClassName.getStr() ); + if( !x->queryInterface( aClassType ).hasValue() ) + return; + } + + // Alles hat geklappt, dann TRUE liefern + refVar->PutBool( TRUE ); +} + +void RTL_Impl_IsUnoStruct( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) +{ + // Wir brauchen mindestens 1 Parameter + if ( rPar.Count() < 2 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + // Variable fuer Rueckgabewert + SbxVariableRef refVar = rPar.Get(0); + refVar->PutBool( FALSE ); + + // Uno-Objekt holen + SbxVariableRef xParam = rPar.Get( 1 ); + if( !xParam->IsObject() ) + return; + SbxBaseRef pObj = (SbxBase*)rPar.Get( 1 )->GetObject(); + if( !(pObj && pObj->ISA(SbUnoObject)) ) + return; + Any aAny = ((SbUnoObject*)(SbxBase*)pObj)->getUnoAny(); + TypeClass eType = aAny.getValueType().getTypeClass(); + if( eType == TypeClass_STRUCT ) + refVar->PutBool( TRUE ); +} + + +void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) +{ + if ( rPar.Count() < 3 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + // Variable fuer Rueckgabewert + SbxVariableRef refVar = rPar.Get(0); + refVar->PutBool( FALSE ); + + // Uno-Objekte holen + SbxVariableRef xParam1 = rPar.Get( 1 ); + if( !xParam1->IsObject() ) + return; + SbxBaseRef pObj1 = (SbxBase*)xParam1->GetObject(); + if( !(pObj1 && pObj1->ISA(SbUnoObject)) ) + return; + Any aAny1 = ((SbUnoObject*)(SbxBase*)pObj1)->getUnoAny(); + TypeClass eType1 = aAny1.getValueType().getTypeClass(); + if( eType1 != TypeClass_INTERFACE ) + return; + Reference< XInterface > x1; + aAny1 >>= x1; + //XInterfaceRef x1 = *(XInterfaceRef*)aAny1.get(); + + SbxVariableRef xParam2 = rPar.Get( 2 ); + if( !xParam2->IsObject() ) + return; + SbxBaseRef pObj2 = (SbxBase*)xParam2->GetObject(); + if( !(pObj2 && pObj2->ISA(SbUnoObject)) ) + return; + Any aAny2 = ((SbUnoObject*)(SbxBase*)pObj2)->getUnoAny(); + TypeClass eType2 = aAny2.getValueType().getTypeClass(); + if( eType2 != TypeClass_INTERFACE ) + return; + Reference< XInterface > x2; + aAny2 >>= x2; + //XInterfaceRef x2 = *(XInterfaceRef*)aAny2.get(); + + if( x1 == x2 ) + refVar->PutBool( TRUE ); +} + +// Funktion, um einen globalen Bezeichner im +// UnoScope zu suchen und fuer Sbx zu wrappen +SbxVariable* findUnoClass( const String& rName ) +{ + // CoreReflection holen + Reference< XIdlReflection > xCoreReflection = getCoreReflection_Impl(); + if( !xCoreReflection.is() ) + return NULL; + + // Klasse suchen + Reference< XIdlClass > xClass = xCoreReflection->forName( rName ); + + // #72382 Klasse wird jetzt immer angelegt, da Module unbekannt sind + SbUnoClass* pUnoClass = new SbUnoClass( rName, xClass ); + return pUnoClass; +} + +SbxVariable* SbUnoClass::Find( const XubString& rName, SbxClassType t ) +{ + SbxVariable* pRes = SbxObject::Find( rName, t ); + + // Wenn nichts gefunden wird, ist das Sub-Modul noch nicht bekannt + if( !pRes ) + { + // Wenn es schon eine Klasse ist, nach einen Feld fragen + if( m_xClass.is() ) + { + // Ist es ein Field + OUString aUStr( rName ); + Reference< XIdlField > xField = m_xClass->getField( aUStr ); + Reference< XIdlClass > xClass; + if( xField.is() ) + { + try + { + Any aAny; + aAny = xField->get( aAny ); + + // Nach Sbx wandeln + pRes = new SbxVariable( SbxVARIANT ); + pRes->SetName( rName ); + unoToSbxValue( pRes, aAny ); + } + catch( WrappedTargetException& e1 ) + { + StarBASIC::Error( SbERR_INTERNAL_ERROR, implGetWrappedMsg( e1 ) ); + } + catch( RuntimeException& e2 ) + { + StarBASIC::Error( SbERR_INTERNAL_ERROR, implGetExceptionMsg( e2 ) ); + } + } + } + else + { + // Vollqualifizierten Namen erweitern + String aNewName = GetName(); + aNewName.AppendAscii( "." ); + aNewName += rName; + + // CoreReflection holen + Reference< XIdlReflection > xCoreReflection = getCoreReflection_Impl(); + if( xCoreReflection.is() ) + { + // Ist es eine Konstante? + Reference< XHierarchicalNameAccess > xHarryName( xCoreReflection, UNO_QUERY ); + if( xHarryName.is() ) + { + try + { + Any aValue = xHarryName->getByHierarchicalName( aNewName ); + TypeClass eType = aValue.getValueType().getTypeClass(); + + // Interface gefunden? Dann ist es eine Klasse + if( eType == TypeClass_INTERFACE ) + { + Reference< XInterface > xIface = *(Reference< XInterface >*)aValue.getValue(); + Reference< XIdlClass > xClass( xIface, UNO_QUERY ); + if( xClass.is() ) + { + pRes = new SbxVariable( SbxVARIANT ); + SbxObjectRef xWrapper = (SbxObject*)new SbUnoClass( aNewName, xClass ); + pRes->PutObject( xWrapper ); + + } + } + else + { + pRes = new SbxVariable( SbxVARIANT ); + unoToSbxValue( pRes, aValue ); + } + } + catch( NoSuchElementException& e1 ) + { + String aMsg = implGetExceptionMsg( e1 ); + } + } + + // Sonst wieder als Klasse annehmen + if( !pRes ) + { + // neue Klasse erzeugen + Reference< XIdlClass > xClass; + pRes = new SbxVariable( SbxVARIANT ); + SbxObjectRef xWrapper = (SbxObject*)new SbUnoClass( aNewName, xClass ); + pRes->PutObject( xWrapper ); + } + } + } + + if( pRes ) + { + pRes->SetName( rName ); + + // Variable einfuegen, damit sie spaeter im Find gefunden wird + QuickInsert( pRes ); + + // Uns selbst gleich wieder als Listener rausnehmen, + // die Werte sind alle konstant + if( pRes->IsBroadcaster() ) + EndListening( pRes->GetBroadcaster(), TRUE ); + } + } + return pRes; +} + + +//======================================================================== +//======================================================================== +//======================================================================== + +// Implementation eines EventAttacher-bezogenen AllListeners, der +// nur einzelne Events an einen allgemeinen AllListener weiterleitet +class BasicAllListener_Impl : public BasicAllListenerHelper +{ + virtual void firing_impl(const AllEventObject& Event, Any* pRet); + +public: + SbxObjectRef xSbxObj; + OUString aPrefixName; + + BasicAllListener_Impl( const OUString& aPrefixName ); + ~BasicAllListener_Impl(); + + // Methoden von XInterface + //virtual BOOL queryInterface( Uik aUik, Reference< XInterface > & rOut ); + + // Methoden von XAllListener + virtual void SAL_CALL firing(const AllEventObject& Event) throw ( RuntimeException ); + virtual Any SAL_CALL approveFiring(const AllEventObject& Event) throw ( RuntimeException ); + + // Methoden von XEventListener + virtual void SAL_CALL disposing(const EventObject& Source) throw ( RuntimeException ); +}; + + +//======================================================================== +BasicAllListener_Impl::BasicAllListener_Impl +( + const OUString & aPrefixName_ +) + : aPrefixName( aPrefixName_ ) +{ +} + +//======================================================================== +BasicAllListener_Impl::~BasicAllListener_Impl() +{ +} + +//======================================================================== + +void BasicAllListener_Impl::firing_impl( const AllEventObject& Event, Any* pRet ) +{ + NAMESPACE_VOS(OGuard) guard( Application::GetSolarMutex() ); + + if( xSbxObj.Is() ) + { + OUString aMethodName = aPrefixName; + aMethodName = aMethodName + Event.MethodName; + + SbxVariable * pP = xSbxObj; + while( pP->GetParent() ) + { + pP = pP->GetParent(); + StarBASIC * pLib = PTR_CAST(StarBASIC,pP); + if( pLib ) + { + // In Basic Array anlegen + SbxArrayRef xSbxArray = new SbxArray( SbxVARIANT ); + const Any * pArgs = Event.Arguments.getConstArray(); + INT32 nCount = Event.Arguments.getLength(); + for( INT32 i = 0; i < nCount; i++ ) + { + // Elemente wandeln + SbxVariableRef xVar = new SbxVariable( SbxVARIANT ); + unoToSbxValue( (SbxVariable*)xVar, pArgs[i] ); + xSbxArray->Put( xVar, i +1 ); + } + + pLib->Call( aMethodName, xSbxArray ); + + // Return-Wert aus dem Param-Array holen, wenn verlangt + if( pRet ) + { + SbxVariable* pVar = xSbxArray->Get( 0 ); + if( pVar ) + *pRet = sbxToUnoValue( pVar ); + } + break; + } + } + } +} + + +// Methoden von XAllListener +void BasicAllListener_Impl::firing( const AllEventObject& Event ) throw ( RuntimeException ) +{ + firing_impl( Event, NULL ); +} + +Any BasicAllListener_Impl::approveFiring( const AllEventObject& Event ) throw ( RuntimeException ) +{ + Any aRetAny; + firing_impl( Event, &aRetAny ); + return aRetAny; +} + +//======================================================================== +// Methoden von XEventListener +void BasicAllListener_Impl ::disposing(const EventObject& ) throw ( RuntimeException ) +{ + NAMESPACE_VOS(OGuard) guard( Application::GetSolarMutex() ); + + xSbxObj.Clear(); +} + + + +//************************************************************************* +// class InvocationToAllListenerMapper +// helper class to map XInvocation to XAllListener (also in project eventattacher!) +//************************************************************************* +class InvocationToAllListenerMapper : public WeakImplHelper1< XInvocation > +{ +public: + InvocationToAllListenerMapper( const Reference< XIdlClass >& ListenerType, + const Reference< XAllListener >& AllListener, const Any& Helper ); + + // XInvocation + virtual Reference< XIntrospectionAccess > SAL_CALL getIntrospection(void) throw( RuntimeException ); + virtual Any SAL_CALL invoke(const OUString& FunctionName, const Sequence< Any >& Params, Sequence< sal_Int16 >& OutParamIndex, Sequence< Any >& OutParam) + throw( IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException ); + virtual void SAL_CALL setValue(const OUString& PropertyName, const Any& Value) + throw( UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException ); + virtual Any SAL_CALL getValue(const OUString& PropertyName) throw( UnknownPropertyException, RuntimeException ); + virtual sal_Bool SAL_CALL hasMethod(const OUString& Name) throw( RuntimeException ); + virtual sal_Bool SAL_CALL hasProperty(const OUString& Name) throw( RuntimeException ); + +private: + Reference< XIdlReflection > m_xCoreReflection; + Reference< XAllListener > m_xAllListener; + Reference< XIdlClass > m_xListenerType; + Any m_Helper; +}; + + +// Function to replace AllListenerAdapterService::createAllListerAdapter +Reference< XInterface > createAllListenerAdapter +( + const Reference< XInvocationAdapterFactory >& xInvocationAdapterFactory, + const Reference< XIdlClass >& xListenerType, + const Reference< XAllListener >& xListener, + const Any& Helper +) +{ + Reference< XInterface > xAdapter; + if( xInvocationAdapterFactory.is() && xListenerType.is() && xListener.is() ) + { + Reference< XInvocation > xInvocationToAllListenerMapper = + (XInvocation*)new InvocationToAllListenerMapper( xListenerType, xListener, Helper ); + Type aListenerType( xListenerType->getTypeClass(), xListenerType->getName() ); + xAdapter = xInvocationAdapterFactory->createAdapter( xInvocationToAllListenerMapper, aListenerType ); + } + return xAdapter; +} + + +//-------------------------------------------------------------------------------------------------- +// InvocationToAllListenerMapper +InvocationToAllListenerMapper::InvocationToAllListenerMapper + ( const Reference< XIdlClass >& ListenerType, const Reference< XAllListener >& AllListener, const Any& Helper ) + : m_xAllListener( AllListener ) + , m_Helper( Helper ) + , m_xListenerType( ListenerType ) +{ +} + +//************************************************************************* +Reference< XIntrospectionAccess > SAL_CALL InvocationToAllListenerMapper::getIntrospection(void) + throw( RuntimeException ) +{ + return Reference< XIntrospectionAccess >(); +} + +//************************************************************************* +Any SAL_CALL InvocationToAllListenerMapper::invoke(const OUString& FunctionName, const Sequence< Any >& Params, + Sequence< sal_Int16 >& OutParamIndex, Sequence< Any >& OutParam) + throw( IllegalArgumentException, CannotConvertException, + InvocationTargetException, RuntimeException ) +{ + Any aRet; + + // Check if to firing or approveFiring has to be called + Reference< XIdlMethod > xMethod = m_xListenerType->getMethod( FunctionName ); + sal_Bool bApproveFiring = sal_False; + if( !xMethod.is() ) + return aRet; + Reference< XIdlClass > xReturnType = xMethod->getReturnType(); + Sequence< Reference< XIdlClass > > aExceptionSeq = xMethod->getExceptionTypes(); + if( ( xReturnType.is() && xReturnType->getTypeClass() != TypeClass_VOID ) || + aExceptionSeq.getLength() > 0 ) + { + bApproveFiring = sal_True; + } + else + { + Sequence< ParamInfo > aParamSeq = xMethod->getParameterInfos(); + sal_uInt32 nParamCount = aParamSeq.getLength(); + if( nParamCount > 1 ) + { + const ParamInfo* pInfos = aParamSeq.getConstArray(); + for( sal_uInt32 i = 0 ; i < nParamCount ; i++ ) + { + if( pInfos[ i ].aMode != ParamMode_IN ) + { + bApproveFiring = sal_True; + break; + } + } + } + } + + AllEventObject aAllEvent; + aAllEvent.Source = (OWeakObject*) this; + aAllEvent.Helper = m_Helper; + aAllEvent.ListenerType = Type(m_xListenerType->getTypeClass(), m_xListenerType->getName() ); + aAllEvent.MethodName = FunctionName; + aAllEvent.Arguments = Params; + if( bApproveFiring ) + aRet = m_xAllListener->approveFiring( aAllEvent ); + else + m_xAllListener->firing( aAllEvent ); + return aRet; +} + +//************************************************************************* +void SAL_CALL InvocationToAllListenerMapper::setValue(const OUString& PropertyName, const Any& Value) + throw( UnknownPropertyException, CannotConvertException, + InvocationTargetException, RuntimeException ) +{ +} + +//************************************************************************* +Any SAL_CALL InvocationToAllListenerMapper::getValue(const OUString& PropertyName) + throw( UnknownPropertyException, RuntimeException ) +{ + return Any(); +} + +//************************************************************************* +sal_Bool SAL_CALL InvocationToAllListenerMapper::hasMethod(const OUString& Name) + throw( RuntimeException ) +{ + Reference< XIdlMethod > xMethod = m_xListenerType->getMethod( Name ); + return xMethod.is(); +} + +//************************************************************************* +sal_Bool SAL_CALL InvocationToAllListenerMapper::hasProperty(const OUString& Name) + throw( RuntimeException ) +{ + Reference< XIdlField > xField = m_xListenerType->getField( Name ); + return xField.is(); +} + +//======================================================================== +// Uno-Service erzeugen +// 1. Parameter == Prefix-Name der Makros +// 2. Parameter == voll qualifizierter Name des Listeners +void SbRtl_CreateUnoListener( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) +//RTLFUNC(CreateUnoListener) +{ + // Wir brauchen mindestens 1 Parameter + if ( rPar.Count() != 3 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + // Klassen-Name der struct holen + String aPrefixName = rPar.Get(1)->GetString(); + String aListenerClassName = rPar.Get(2)->GetString(); + + // CoreReflection holen + Reference< XIdlReflection > xCoreReflection = getCoreReflection_Impl(); + if( !xCoreReflection.is() ) + return; + + // AllListenerAdapterService holen + Reference< XMultiServiceFactory > xFactory( utl::getProcessServiceFactory() ); + if( !xFactory.is() ) + return; + + // Klasse suchen + Reference< XIdlClass > xClass = xCoreReflection->forName( aListenerClassName ); + if( !xClass.is() ) + return; + + // AB, 30.11.1999 InvocationAdapterFactory holen + Reference< XInvocationAdapterFactory > xInvocationAdapterFactory = Reference< XInvocationAdapterFactory >( + xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.script.InvocationAdapterFactory") ), UNO_QUERY ); + + BasicAllListener_Impl * p; + Reference< XAllListener > xAllLst = p = new BasicAllListener_Impl( aPrefixName ); + Any aTmp; + Reference< XInterface > xLst = createAllListenerAdapter( xInvocationAdapterFactory, xClass, xAllLst, aTmp ); + if( !xLst.is() ) + return; + + OUString aClassName = xClass->getName(); + Type aClassType( xClass->getTypeClass(), aClassName.getStr() ); + aTmp = xLst->queryInterface( aClassType ); + if( !aTmp.hasValue() ) + return; + + p->xSbxObj = new SbUnoObject( aListenerClassName, aTmp ); + p->xSbxObj->SetParent( pBasic ); + + // Objekt zurueckliefern + SbxVariableRef refVar = rPar.Get(0); + refVar->PutObject( p->xSbxObj ); +} + + + diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx new file mode 100644 index 000000000000..187a5b45280c --- /dev/null +++ b/basic/source/classes/sbxmod.cxx @@ -0,0 +1,1984 @@ +/************************************************************************* + * + * $RCSfile: sbxmod.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#if STLPORT_VERSION < 321 +#include <tools/presys.h> +#include <list> +#include <tools/postsys.h> +#else +#include <list> +#endif + +#include <vos/macros.hxx> +#include <vcl/svapp.hxx> + +#ifndef _STREAM_HXX //autogen +#include <tools/stream.hxx> +#endif +#ifndef _SFXBRDCST_HXX //autogen +#include <svtools/brdcst.hxx> +#endif +#ifndef _SHL_HXX //autogen +#include <tools/shl.hxx> +#endif +#pragma hdrstop +#include <svtools/sbx.hxx> +#include "sb.hxx" +#include <sbjsmeth.hxx> +#include "sbjsmod.hxx" +#include "sbintern.hxx" +#include "image.hxx" +#include "opcodes.hxx" +#include "runtime.hxx" +#include "token.hxx" +#include "sbunoobj.hxx" +#include <hilight.hxx> +#include <basrdll.hxx> + + +// for the bsearch +#ifdef WNT +#define CDECL _cdecl +#endif +#ifdef OS2 +#define CDECL _Optlink +#endif +#if defined(UNX) || defined(MAC) +#define CDECL +#endif + + +// TEST +#include <stdio.h> + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBASIC, SBASIC_CODE ) + +TYPEINIT1(SbModule,SbxObject) +TYPEINIT1(SbMethod,SbxMethod) +TYPEINIT1(SbProperty,SbxProperty) +TYPEINIT1(SbJScriptModule,SbModule) +TYPEINIT1(SbJScriptMethod,SbMethod) + +SV_DECL_VARARR(SbiBreakpoints,USHORT,4,4) +SV_IMPL_VARARR(SbiBreakpoints,USHORT) + + +SV_IMPL_VARARR(HighlightPortions, HighlightPortion) + +// ########################################################################## +// ACHTUNG!!! Alle Woerter dieser Tabelle müssen KLEIN geschrieben werden!!! +// ########################################################################## +static char* strListBasicKeyWords[] = { + "access", + "alias", + "and", + "any", + "append", + "as", + "base", + "binary", + "boolean", + "byval", + "call", + "case", + "cdecl", + "close", + "compare", + "const", + "currency", + "date", + "declare", + "defbool", + "defcur", + "defdate", + "defdbl", + "deferr", + "defint", + "deflng", + "defobj", + "defsng", + "defstr", + "defvar", + "dim", + "do", + "double", + "each", + "else", + "elseif", + "end", + "end function", + "end if", + "end select", + "end sub", + "end type", + "endif", + "eqv", + "erase", + "error", + "exit", + "explicit", + "for", + "function", + "global", + "gosub", + "goto", + "if", + "imp", + "in", + "input", + "integer", + "is", + "let", + "lib" + "line", + "line input", + "local", + "lock", + "long", + "loop", + "lprint", + "lset", + "mod", + "name", + "new", + "next", + "not", + "object", + "on", + "open", + "option", + "optional", + "or", + "output", + "preserve", + "print", + "private", + "public", + "random", + "read", + "redim", + "rem", + "resume", + "return", + "rset", + "select", + "set", + "shared", + "single", + "static", + "step", + "stop", + "string", + "sub", + "system", + "text", + "then", + "to", + "type", + "until", + "variant", + "wend", + "while", + "with", + "write", + "xor" +}; + +int CDECL compare_strings( const void *arg1, const void *arg2 ) +{ + char* pCh = *(char**)arg2; + return strcmp( (char *)arg1, *(char **)arg2 ); +} + + + +///////////////////////////////////////////////////////////////////////////// + +// Ein BASIC-Modul hat EXTSEARCH gesetzt, damit die im Modul enthaltenen +// Elemente von anderen Modulen aus gefunden werden koennen. + +SbModule::SbModule( const String& rName ) + : SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("StarBASICModule") ) ), + pImage( NULL ), pBreaks( NULL ) +{ + SetName( rName ); + SetFlag( SBX_EXTSEARCH | SBX_GBLSEARCH ); +} + +SbModule::~SbModule() +{ + if( pImage ) + delete pImage; + if( pBreaks ) + delete pBreaks; +} + +BOOL SbModule::IsCompiled() const +{ + return BOOL( pImage != 0 ); +} + +// Aus dem Codegenerator: Loeschen des Images und Invalidieren der Entries + +void SbModule::StartDefinitions() +{ + delete pImage; pImage = NULL; + // Methoden und Properties bleiben erhalten, sind jedoch ungueltig + // schliesslich sind ja u.U. die Infos belegt + USHORT i; + for( i = 0; i < pMethods->Count(); i++ ) + { + SbMethod* p = PTR_CAST(SbMethod,pMethods->Get( i ) ); + if( p ) + p->bInvalid = TRUE; + } + for( i = 0; i < pProps->Count(); ) + { + SbProperty* p = PTR_CAST(SbProperty,pProps->Get( i ) ); + if( p ) + pProps->Remove( i ); + else + i++; + } +} + +// Methode anfordern/anlegen + +SbMethod* SbModule::GetMethod( const String& rName, SbxDataType t ) +{ + SbxVariable* p = pMethods->Find( rName, SbxCLASS_METHOD ); + SbMethod* pMeth = p ? PTR_CAST(SbMethod,p) : NULL; + if( p && !pMeth ) + pMethods->Remove( p ); + if( !pMeth ) + { + pMeth = new SbMethod( rName, t, this ); + pMeth->SetParent( this ); + pMeth->SetFlags( SBX_READ ); + pMethods->Put( pMeth, pMethods->Count() ); + StartListening( pMeth->GetBroadcaster(), TRUE ); + } + // Per Default ist die Methode GUELTIG, da sie auch vom Compiler + // (Codegenerator) erzeugt werden kann + pMeth->bInvalid = FALSE; + pMeth->ResetFlag( SBX_FIXED ); + pMeth->SetFlag( SBX_WRITE ); + pMeth->SetType( t ); + pMeth->ResetFlag( SBX_WRITE ); + if( t != SbxVARIANT ) + pMeth->SetFlag( SBX_FIXED ); + return pMeth; +} + +// Property anfordern/anlegen + +SbProperty* SbModule::GetProperty( const String& rName, SbxDataType t ) +{ + SbxVariable* p = pProps->Find( rName, SbxCLASS_PROPERTY ); + SbProperty* pProp = p ? PTR_CAST(SbProperty,p) : NULL; + if( p && !pProp ) + pProps->Remove( p ); + if( !pProp ) + { + pProp = new SbProperty( rName, t, this ); + pProp->SetFlag( SBX_READWRITE ); + pProp->SetParent( this ); + pProps->Put( pProp, pProps->Count() ); + StartListening( pProp->GetBroadcaster(), TRUE ); + } + return pProp; +} + +// Aus dem Codegenerator: Ungueltige Eintraege entfernen + +void SbModule::EndDefinitions( BOOL bNewState ) +{ + for( USHORT i = 0; i < pMethods->Count(); ) + { + SbMethod* p = PTR_CAST(SbMethod,pMethods->Get( i ) ); + if( p ) + { + if( p->bInvalid ) + pMethods->Remove( p ); + else + { + p->bInvalid = bNewState; + i++; + } + } + } + SetModified( TRUE ); +} + +void SbModule::Clear() +{ + delete pImage; pImage = NULL; + SbxObject::Clear(); +} + +const String& SbModule::GetSource() const +{ + return aSource; +} + +// Parent und BASIC sind eins! + +void SbModule::SetParent( SbxObject* p ) +{ + DBG_ASSERT( !p || p->IsA( TYPE(StarBASIC) ), "SbModules nur in BASIC eintragen" ); + pParent = p; +} + +void SbModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ) +{ + const SbxHint* pHint = PTR_CAST(SbxHint,&rHint); + if( pHint ) + { + SbxVariable* pVar = pHint->GetVar(); + SbProperty* pProp = PTR_CAST(SbProperty,pVar); + SbMethod* pMeth = PTR_CAST(SbMethod,pVar); + if( pProp ) + { + if( pProp->GetModule() != this ) + SetError( SbxERR_BAD_ACTION ); + } + else if( pMeth ) + { + if( pHint->GetId() == SBX_HINT_DATAWANTED ) + { + if( pMeth->bInvalid && !Compile() ) + // Auto-Compile hat nicht geklappt! + StarBASIC::Error( SbERR_BAD_PROP_VALUE ); + else + { + // Aufruf eines Unterprogramms + SbModule* pOld = pMOD; + pMOD = this; + Run( (SbMethod*) pVar ); + pMOD = pOld; + } + } + } + else + SbxObject::SFX_NOTIFY( rBC, rBCType, rHint, rHintType ); + } +} + +// Das Setzen der Source macht das Image ungueltig +// und scant die Methoden-Definitionen neu ein + +void SbModule::SetSource( const String& r ) +{ + aSource = r; + StartDefinitions(); + SbiTokenizer aTok( r ); + while( !aTok.IsEof() ) + { + SbiToken eEndTok = NIL; + + // Suchen nach SUB oder FUNCTION + SbiToken eLastTok = NIL; + while( !aTok.IsEof() ) + { + // #32385: Nicht bei declare + SbiToken eCurTok = aTok.Next(); + if( eLastTok != DECLARE ) + { + if( eCurTok == SUB ) + { + eEndTok = ENDSUB; break; + } + if( eCurTok == FUNCTION ) + { + eEndTok = ENDFUNC; break; + } + } + eLastTok = eCurTok; + } + // Definition der Methode + SbMethod* pMeth; + if( eEndTok != NIL ) + { + USHORT nLine1 = aTok.GetLine(); + if( aTok.Next() == SYMBOL ) + { + String aName( aTok.GetSym() ); + SbxDataType t = aTok.GetType(); + if( t == SbxVARIANT && eEndTok == ENDSUB ) + t = SbxVOID; + pMeth = GetMethod( aName, t ); + pMeth->nLine1 = pMeth->nLine2 = nLine1; + // Die Methode ist erst mal GUELTIG + pMeth->bInvalid = FALSE; + } + else + eEndTok = NIL; + } + // Skip bis END SUB/END FUNCTION + if( eEndTok != NIL ) + { + while( !aTok.IsEof() ) + { + if( aTok.Next() == eEndTok ) + { + pMeth->nLine2 = aTok.GetLine(); + break; + } + } + if( aTok.IsEof() ) + pMeth->nLine2 = aTok.GetLine(); + } + } + EndDefinitions( TRUE ); +} + +void SbModule::SetComment( const String& r ) +{ + aComment = r; + SetModified( TRUE ); +} + +SbMethod* SbModule::GetFunctionForLine( USHORT nLine ) +{ + for( USHORT i = 0; i < pMethods->Count(); i++ ) + { + SbMethod* p = (SbMethod*) pMethods->Get( i ); + if( p->GetSbxId() == SBXID_BASICMETHOD ) + { + if( nLine >= p->nLine1 && nLine <= p->nLine2 ) + return p; + } + } + return NULL; +} + +// Ausstrahlen eines Hints an alle Basics + +static void _SendHint( SbxObject* pObj, ULONG nId, SbMethod* p ) +{ + // Selbst ein BASIC? + if( pObj->IsA( TYPE(StarBASIC) ) && pObj->IsBroadcaster() ) + pObj->GetBroadcaster().Broadcast( SbxHint( nId, p ) ); + // Dann die Unterobjekte fragen + SbxArray* pObjs = pObj->GetObjects(); + for( USHORT i = 0; i < pObjs->Count(); i++ ) + { + SbxVariable* pVar = pObjs->Get( i ); + if( pVar->IsA( TYPE(SbxObject) ) ) + _SendHint( PTR_CAST(SbxObject,pVar), nId, p ); + } +} + +static void SendHint( SbxObject* pObj, ULONG nId, SbMethod* p ) +{ + while( pObj->GetParent() ) + pObj = pObj->GetParent(); + _SendHint( pObj, nId, p ); +} + +// #57841 Uno-Objekte, die in RTL-Funktionen gehalten werden, +// beim Programm-Ende freigeben, damit nichts gehalten wird. +void ClearUnoObjectsInRTL_Impl_Rek( StarBASIC* pBasic ) +{ + // return-Wert von CreateUnoService loeschen + static String aName( RTL_CONSTASCII_USTRINGPARAM("CreateUnoService") ); + SbxVariable* pVar = pBasic->GetRtl()->Find( aName, SbxCLASS_METHOD ); + if( pVar ) + pVar->SbxValue::Clear(); + + // Ueber alle Sub-Basics gehen + SbxArray* pObjs = pBasic->GetObjects(); + USHORT nCount = pObjs->Count(); + for( USHORT i = 0 ; i < nCount ; i++ ) + { + SbxVariable* pObjVar = pObjs->Get( i ); + StarBASIC* pSubBasic = PTR_CAST( StarBASIC, pObjVar ); + if( pSubBasic ) + ClearUnoObjectsInRTL_Impl_Rek( pSubBasic ); + } +} + +void ClearUnoObjectsInRTL_Impl( StarBASIC* pBasic ) +{ + // #67781 Rueckgabewerte der Uno-Methoden loeschen + clearUnoMethods(); + + // Oberstes Basic suchen + SbxObject* p = pBasic; + while( p->GetParent() ) + p = p->GetParent(); + + // Rekursiven Loeschvorgang ausloesen + ClearUnoObjectsInRTL_Impl_Rek( (StarBASIC*)p ); +} + +// Ausfuehren eines BASIC-Unterprogramms +USHORT SbModule::Run( SbMethod* pMeth ) +{ + USHORT nRes = 0; + BOOL bDelInst = BOOL( pINST == NULL ); + StarBASICRef xBasic; + if( bDelInst ) + { + // #32779: Basic waehrend der Ausfuehrung festhalten + xBasic = (StarBASIC*) GetParent(); + + pINST = new SbiInstance( (StarBASIC*) GetParent() ); + + // Error-Stack loeschen + SbErrorStack*& rErrStack = GetSbData()->pErrStack; + delete rErrStack; + rErrStack = NULL; + } + // Rekursion zu tief? + if( ++pINST->nCallLvl <= MAXRECURSION ) + { + // Globale Variable in allen Mods definieren + GlobalRunInit( /* bBasicStart = */ bDelInst ); + + // Trat ein Compiler-Fehler auf? Dann starten wir nicht + if( GetSbData()->bGlobalInitErr == FALSE ) + { + if( bDelInst ) + { + SendHint( GetParent(), SBX_HINT_BASICSTART, pMeth ); + + // 16.10.96: #31460 Neues Konzept fuer StepInto/Over/Out + // Erklaerung siehe runtime.cxx bei SbiInstance::CalcBreakCallLevel() + // BreakCallLevel ermitteln + pINST->CalcBreakCallLevel( pMeth->GetDebugFlags() ); + } + + SbModule* pOldMod = pMOD; + pMOD = this; + SbiRuntime* pRt = new SbiRuntime( this, pMeth, pMeth->nStart ); + pRt->pNext = pINST->pRun; + pINST->pRun = pRt; + while( pRt->Step() ) {} + + // #63710 Durch ein anderes Thread-Handling bei Events kann es passieren, + // dass show-Aufruf an einem Dialog zurueckkehrt (durch schliessen des + // Dialogs per UI), BEVOR ein per Event ausgeloester weitergehender Call, + // der in Basic weiter oben im Stack steht und auf einen Basic-Breakpoint + // gelaufen ist, zurueckkehrt. Dann wird unten die Instanz zerstoert und + // wenn das noch im Call stehende Basic weiterlaeuft, gibt es einen GPF. + // Daher muss hier gewartet werden, bis andere Call zurueckkehrt. + if( bDelInst ) + { + // Hier mit 1 statt 0 vergleichen, da vor nCallLvl-- + while( pINST->nCallLvl != 1 ) + GetpApp()->Yield(); + } + + nRes = TRUE; + pINST->pRun = pRt->pNext; + pINST->nCallLvl--; // Call-Level wieder runter + + // Gibt es eine uebergeordnete Runtime-Instanz? + // Dann SbDEBUG_BREAK uebernehmen, wenn gesetzt + SbiRuntime* pRtNext = pRt->pNext; + if( pRtNext && (pRt->GetDebugFlags() & SbDEBUG_BREAK) ) + pRtNext->SetDebugFlags( SbDEBUG_BREAK ); + + delete pRt; + pMOD = pOldMod; + if( bDelInst ) + { + // #57841 Uno-Objekte, die in RTL-Funktionen gehalten werden, + // beim Programm-Ende freigeben, damit nichts gehalten wird. + ClearUnoObjectsInRTL_Impl( xBasic ); + + DBG_ASSERT(pINST->nCallLvl==0,"BASIC-Call-Level > 0") + delete pINST, pINST = NULL, bDelInst = FALSE; + SendHint( GetParent(), SBX_HINT_BASICSTOP, pMeth ); + } + } + } + else + StarBASIC::FatalError( SbERR_STACK_OVERFLOW ); + if( bDelInst ) + { + // #57841 Uno-Objekte, die in RTL-Funktionen gehalten werden, + // beim Programm-Ende freigeben, damit nichts gehalten wird. + ClearUnoObjectsInRTL_Impl( xBasic ); + + delete pINST; + pINST = NULL; + } + return nRes; +} + +// Ausfuehren der Init-Methode eines Moduls nach dem Laden +// oder der Compilation + +void SbModule::RunInit() +{ + if( pImage + && !pImage->bInit + && pImage->GetFlag( SBIMG_INITCODE ) ) + { + // Flag setzen, dass RunInit aktiv ist (Testtool) + GetSbData()->bRunInit = TRUE; + + // BOOL bDelInst = BOOL( pINST == NULL ); + // if( bDelInst ) + // pINST = new SbiInstance( (StarBASIC*) GetParent() ); + SbModule* pOldMod = pMOD; + pMOD = this; + // Der Init-Code beginnt immer hier + SbiRuntime* pRt = new SbiRuntime( this, NULL, 0 ); + pRt->pNext = pINST->pRun; + pINST->pRun = pRt; + while( pRt->Step() ) {} + pINST->pRun = pRt->pNext; + delete pRt; + pMOD = pOldMod; + // if( bDelInst ) + // delete pINST, pINST = NULL; + pImage->bInit = TRUE; + + // RunInit ist nicht mehr aktiv + GetSbData()->bRunInit = FALSE; + } +} + +// Mit private/dim deklarierte Variablen loeschen +void SbModule::ClearPrivateVars() +{ + for( int i = 0 ; i < pProps->Count() ; i++ ) + { + SbProperty* p = PTR_CAST(SbProperty,pProps->Get( i ) ); + if( p ) + { + // Arrays nicht loeschen, sondern nur deren Inhalt + if( p->GetType() & SbxARRAY ) + { + SbxArray* pArray = PTR_CAST(SbxArray,p->GetObject()); + if( pArray ) + { + for( int j = 0 ; j < pArray->Count() ; j++ ) + { + SbxVariable* pj = PTR_CAST(SbxVariable,pArray->Get( j )); + pj->SbxValue::Clear(); + /* + USHORT nFlags = pj->GetFlags(); + pj->SetFlags( (nFlags | SBX_WRITE) & (~SBX_FIXED) ); + pj->PutEmpty(); + pj->SetFlags( nFlags ); + */ + } + } + } + else + { + p->SbxValue::Clear(); + /* + USHORT nFlags = p->GetFlags(); + p->SetFlags( (nFlags | SBX_WRITE) & (~SBX_FIXED) ); + p->PutEmpty(); + p->SetFlags( nFlags ); + */ + } + } + } +} + +// Zunaechst in dieses Modul, um 358-faehig zu bleiben +// (Branch in sb.cxx vermeiden) +void StarBASIC::ClearAllModuleVars( void ) +{ + // Eigene Module initialisieren + for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ ) + { + SbModule* pModule = (SbModule*)pModules->Get( nMod ); + // Nur initialisieren, wenn der Startcode schon ausgefuehrt wurde + if( pModule->pImage && pModule->pImage->bInit ) + pModule->ClearPrivateVars(); + } + // Alle Objekte ueberpruefen, ob es sich um ein Basic handelt + // Wenn ja, auch dort initialisieren + for ( USHORT nObj = 0; nObj < pObjs->Count(); nObj++ ) + { + SbxVariable* pVar = pObjs->Get( nObj ); + StarBASIC* pBasic = PTR_CAST(StarBASIC,pVar); + if( pBasic ) + pBasic->ClearAllModuleVars(); + } + +} + +// Ausfuehren des Init-Codes aller Module +void SbModule::GlobalRunInit( BOOL bBasicStart ) +{ + // Wenn kein Basic-Start, nur initialisieren, wenn Modul uninitialisiert + if( !bBasicStart ) + if( !(pImage && !pImage->bInit) ) + return; + + // GlobalInitErr-Flag fuer Compiler-Error initialisieren + // Anhand dieses Flags kann in SbModule::Run() nach dem Aufruf + // von GlobalRunInit festgestellt werden, ob beim initialisieren + // der Module ein Fehler auftrat. Dann wird nicht gestartet. + GetSbData()->bGlobalInitErr = FALSE; + + // Parent vom Modul ist ein Basic + StarBASIC *pBasic = PTR_CAST(StarBASIC,GetParent()); + if( pBasic ) + { + pBasic->InitAllModules(); + + SbxObject* pParent = pBasic->GetParent(); + if( pParent ) + pBasic = PTR_CAST(StarBASIC,pParent); + if( pBasic ) + pBasic->InitAllModules(); + } +} + +// Suche nach dem naechsten STMNT-Befehl im Code. Wird vom STMNT- +// Opcode verwendet, um die Endspalte zu setzen. + +const BYTE* SbModule::FindNextStmnt( const BYTE* p, USHORT& nLine, USHORT& nCol ) const +{ + USHORT nPC = (USHORT) ( p - (const BYTE*) pImage->GetCode() ); + while( nPC < pImage->GetCodeSize() ) + { + SbiOpcode eOp = (SbiOpcode ) ( *p++ ); + nPC++; + if( eOp >= SbOP1_START && eOp <= SbOP1_END ) + p += 2, nPC += 2; + else if( eOp == _STMNT ) + { + USHORT nl, nc; + nl = *p++; nl |= *p++ << 8; + nc = *p++; nc |= *p++ << 8; + nLine = nl; nCol = nc; + return p; + } + else if( eOp >= SbOP2_START && eOp <= SbOP2_END ) + p += 4, nPC += 4; + else if( !( eOp >= SbOP0_START && eOp <= SbOP0_END ) ) + { + StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); + break; + } + } + return NULL; +} + +// Testen, ob eine Zeile STMNT-Opcodes enthaelt + +BOOL SbModule::IsBreakable( USHORT nLine ) const +{ + if( !pImage ) + return FALSE; + const BYTE* p = (const BYTE* ) pImage->GetCode(); + USHORT nl, nc; + while( ( p = FindNextStmnt( p, nl, nc ) ) != NULL ) + if( nl == nLine ) + return TRUE; + return FALSE; +} + +USHORT SbModule::GetBPCount() const +{ + return pBreaks ? pBreaks->Count() : 0; +} + +USHORT SbModule::GetBP( USHORT n ) const +{ + if( pBreaks && n < pBreaks->Count() ) + return pBreaks->GetObject( n ); + else + return 0; +} + +BOOL SbModule::IsBP( USHORT nLine ) const +{ + if( pBreaks ) + { + const USHORT* p = pBreaks->GetData(); + USHORT n = pBreaks->Count(); + for( USHORT i = 0; i < n; i++, p++ ) + { + USHORT b = *p; + if( b == nLine ) + return TRUE; + if( b < nLine ) + break; + } + } + return FALSE; +} + +BOOL SbModule::SetBP( USHORT nLine ) +{ + if( !IsBreakable( nLine ) ) + return FALSE; + if( !pBreaks ) + pBreaks = new SbiBreakpoints; + const USHORT* p = pBreaks->GetData(); + USHORT n = pBreaks->Count(); + USHORT i; + for( i = 0; i < n; i++, p++ ) + { + USHORT b = *p; + if( b == nLine ) + return TRUE; + if( b < nLine ) + break; + } + pBreaks->Insert( &nLine, 1, i ); + + // #38568: Zur Laufzeit auch hier SbDEBUG_BREAK setzen + if( pINST && pINST->pRun ) + pINST->pRun->SetDebugFlags( SbDEBUG_BREAK ); + + return IsBreakable( nLine ); +} + +BOOL SbModule::ClearBP( USHORT nLine ) +{ + BOOL bRes = FALSE; + if( pBreaks ) + { + const USHORT* p = pBreaks->GetData(); + USHORT n = pBreaks->Count(); + for( USHORT i = 0; i < n; i++, p++ ) + { + USHORT b = *p; + if( b == nLine ) + { + pBreaks->Remove( i, 1 ); bRes = TRUE; break; + } + if( b < nLine ) + break; + } + if( !pBreaks->Count() ) + delete pBreaks, pBreaks = NULL; + } + return bRes; +} + +void SbModule::ClearAllBP() +{ + delete pBreaks; pBreaks = NULL; +} + +BOOL SbModule::LoadData( SvStream& rStrm, USHORT nVer ) +{ + Clear(); + if( !SbxObject::LoadData( rStrm, 1 ) ) + return FALSE; + // Sicherheitshalber... + SetFlag( SBX_EXTSEARCH | SBX_GBLSEARCH ); + BYTE bImage; + rStrm >> bImage; + if( bImage ) + { + SbiImage* p = new SbiImage; + if( !p->Load( rStrm ) ) + { + delete p; + return FALSE; + } + aComment = p->aComment; + SetName( p->aName ); + // Ist Code vorhanden? + if( p->GetCodeSize() ) + { + aSource = p->aSource; + // Alte Version: Image weg + if( nVer == 1 ) + { + SetSource( p->aSource ); + delete p; + } + else + pImage = p; + } + else + { + SetSource( p->aSource ); + delete p; + } + } + return TRUE; +} + +BOOL SbModule::StoreData( SvStream& rStrm ) const +{ + if( !SbxObject::StoreData( rStrm ) ) + return FALSE; + if( pImage ) + { + pImage->aSource = aSource; + pImage->aComment = aComment; + pImage->aName = GetName(); + rStrm << (BYTE) 1; + return pImage->Save( rStrm ); + } + else + { + SbiImage aImg; + aImg.aSource = aSource; + aImg.aComment = aComment; + aImg.aName = GetName(); + rStrm << (BYTE) 1; + return aImg.Save( rStrm ); + } +} + +BOOL SbModule::LoadCompleted() +{ + SbxArray* p = GetMethods(); + USHORT i; + for( i = 0; i < p->Count(); i++ ) + { + SbMethod* q = PTR_CAST(SbMethod,p->Get( i ) ); + if( q ) + q->pMod = this; + } + p = GetProperties(); + for( i = 0; i < p->Count(); i++ ) + { + SbProperty* q = PTR_CAST(SbProperty,p->Get( i ) ); + if( q ) + q->pMod = this; + } + return TRUE; +} + + +///////////////////////////////////////////////////////////////////////// +// Hilfsklasse zur Untersuchung von JavaScript-Modulen, zunaechst zum +// Heraussuchen der Funktionen, spaeter auch zum Syntax-Highlighting verwenden + +// Flags fuer Zeichen-Eigenschaften +#define CHAR_START_IDENTIFIER 0x0001 +#define CHAR_IN_IDENTIFIER 0x0002 +#define CHAR_START_NUMBER 0x0004 +#define CHAR_IN_NUMBER 0x0008 +#define CHAR_IN_HEX_NUMBER 0x0010 +#define CHAR_IN_OCT_NUMBER 0x0020 +#define CHAR_START_STRING 0x0040 +#define CHAR_OPERATOR 0x0080 +#define CHAR_SPACE 0x0100 +#define CHAR_EOL 0x0200 + +#define CHAR_EOF 0x00 + + +// Token-Typen TT_... + +//enum TokenType +//{ +// TT_UNKNOWN, +// TT_IDENTIFIER, +// TT_WHITESPACE, +// TT_NUMBER, +// TT_STRING, +//// TT_HTMLSTRING, +//// TT_LONG, +//// TT_DOUBLE, +//// TT_BOOLEAN, +//// TT_NULLOBJECT, +//// TT_CHAR, +// TT_EOL, +//// TT_LONG2DOUBLE, +// TT_COMMENT, +//// TT_SKIP, +// TT_ERROR, +// TT_OPERATOR, +// TT_KEYWORD +//}; + + +class SimpleTokenizer_Impl +{ + // Zeichen-Info-Tabelle + USHORT aCharTypeTab[256]; + + const char* mpStringBegin; + const char* mpActualPos; + + // Zeile und Spalte + UINT32 nLine; + UINT32 nCol; + + char peekChar( void ) { return *mpActualPos; } + char getChar( void ) { nCol++; return *mpActualPos++; } + + // Hilfsfunktion: Zeichen-Flag Testen + BOOL testCharFlags( unsigned char c, USHORT nTestFlags ); + + // Neues Token holen, Leerstring == nix mehr da + BOOL getNextToken( /*out*/TokenTypes& reType, + /*out*/const char*& rpStartPos, /*out*/const char*& rpEndPos ); + + String getTokStr( /*out*/const char* pStartPos, /*out*/const char* pEndPos ); + + // TEST: Token ausgeben + String getFullTokenStr( /*out*/TokenTypes eType, + /*out*/const char* pStartPos, /*out*/const char* pEndPos ); + + BOOL isBeginComment( UINT32 nLine ); + void setCommentState(UINT32 nLine, BOOL bCommentBegin, BOOL bCommentEnd); + + NAMESPACE_STD(list)<BOOL>* pCommentsBegin; + NAMESPACE_STD(list)<BOOL>* pCommentsEnd; + + char** ppListKeyWords; + UINT16 nKeyWordCount; + BOOL bStarScriptMode; + + BOOL bLineHasCommentBegin; + BOOL bLineHasCommentEnd; + +public: + SimpleTokenizer_Impl( void ); + ~SimpleTokenizer_Impl( void ); + + UINT16 parseLine( UINT32 nLine, const String* aSource ); + void getHighlightPortions( UINT32 nParseLine, const String& rLine, + /*out*/HighlightPortions& portions ); + void addLines(UINT32 nLine, INT32 nCount); + void outCommentList(); + void setKeyWords( char** ppKeyWords, UINT16 nCount ); +}; + +// Hilfsfunktion: Zeichen-Flag Testen +BOOL SimpleTokenizer_Impl::testCharFlags( unsigned char c, USHORT nTestFlags ) +{ + if( c != 0 ) + return ( (aCharTypeTab[c] & nTestFlags) != 0 ); + return FALSE; +} + +void SimpleTokenizer_Impl::setKeyWords( char** ppKeyWords, UINT16 nCount ) +{ + ppListKeyWords = ppKeyWords; + nKeyWordCount = nCount; +} + +// Neues Token holen +BOOL SimpleTokenizer_Impl::getNextToken( /*out*/TokenTypes& reType, + /*out*/const char*& rpStartPos, /*out*/const char*& rpEndPos ) +{ + reType = TT_UNKNOWN; + + // Position merken + rpStartPos = mpActualPos; + + // Zeichen untersuchen + char c = peekChar(); + if( c == CHAR_EOF ) + return FALSE; + + // Zeichen lesen + getChar(); + + //*** Alle Moeglichkeiten durchgehen *** + // Spce? + if ( (testCharFlags( c, CHAR_SPACE ) == TRUE) && (!bLineHasCommentBegin) ) + { + while( testCharFlags( peekChar(), CHAR_SPACE ) == TRUE ) + getChar(); + + reType = TT_WHITESPACE; + } + + // Identifier? + else if ( (testCharFlags( c, CHAR_START_IDENTIFIER ) == TRUE) && (!bLineHasCommentBegin) ) + { + BOOL bIdentifierChar; + int nPos = 0; + do + { + // Naechstes Zeichen holen + c = peekChar(); + bIdentifierChar = testCharFlags( c, CHAR_IN_IDENTIFIER ); + if( bIdentifierChar ) + getChar(); + } + while( bIdentifierChar ); + + reType = TT_IDENTIFIER; + + // Schluesselwort-Tabelle + if (ppListKeyWords != NULL) + { + ByteString aByteStr(rpStartPos, mpActualPos-rpStartPos); + if ( !bStarScriptMode ) + aByteStr.ToLowerAscii(); + + if ( bsearch( aByteStr.GetBuffer(), ppListKeyWords, nKeyWordCount, sizeof( char* ), + compare_strings ) ) + { + reType = TT_KEYWORD; + + if ( (!bStarScriptMode) && (aByteStr.Equals( "rem" )) ) + { + // Alle Zeichen bis Zeilen-Ende oder EOF entfernen + char cPeek = peekChar(); + while( cPeek != CHAR_EOF && testCharFlags( cPeek, CHAR_EOL ) == FALSE ) + { + c = getChar(); + cPeek = peekChar(); + } + + reType = TT_COMMENT; + } + } + } + } + + // Operator? + else if ( (testCharFlags( c, CHAR_OPERATOR ) == TRUE) || bLineHasCommentBegin + || ((!bStarScriptMode) && (c == '\'')) ) + { + // Kommentar ? + if ( (( c == '/' ) || bLineHasCommentBegin) || ((!bStarScriptMode) && (c == '\'')) ) + { + char cNext = peekChar(); + if ( cNext == '/' || ( bStarScriptMode && (cNext == '*' || bLineHasCommentBegin)) + || ((!bStarScriptMode) && (c == '\'')) ) // Kommentar + { + if ((c == '*') && (cNext == '/')) // Kommentarende am Zeilenanfang + { + getChar(); // Zeichen entfernen + + bLineHasCommentEnd = TRUE; + bLineHasCommentBegin = FALSE; + + reType = TT_COMMENT; + } + else if ( (cNext == '/' && (!bStarScriptMode || !bLineHasCommentBegin)) + || ((!bStarScriptMode) && (c == '\'')) )// C++ - Kommentar + { + c = getChar(); // '/' entfernen + + // Alle Zeichen bis Zeilen-Ende oder EOF entfernen + char cPeek = peekChar(); + while( cPeek != CHAR_EOF && testCharFlags( cPeek, CHAR_EOL ) == FALSE ) + { + c = getChar(); + cPeek = peekChar(); + + if (c == '*' && cPeek == '/') + { + bLineHasCommentEnd = TRUE; + } + } + + reType = TT_COMMENT; + } + else if (( cNext == '*' ) || bLineHasCommentBegin) // C -Kommentar + { + bLineHasCommentBegin = !bLineHasCommentBegin; + + // Alle Zeichen bis */ entfernen + do + { + c = getChar(); + cNext = peekChar(); + + // Zeilennummer auch im Kommentar pflegen + if( testCharFlags( c, CHAR_EOL ) == TRUE ) + { + // Doppelt-EOL rausschmeissen (CR/LF) + if( cNext != c && testCharFlags( cNext, CHAR_EOL ) == TRUE ) + { + c = getChar(); + cNext = peekChar(); + } + + setCommentState(nLine, bLineHasCommentBegin, bLineHasCommentEnd); + bLineHasCommentBegin = FALSE; + bLineHasCommentEnd = FALSE; + + // Positions-Daten auf Zeilen-Beginn setzen + nCol = 0; + nLine++; + } + else if (c == '*' && cNext == '/') // am Kommentarende + { + if (bLineHasCommentBegin) // das Ende ist in der gleichen Zeile + { // wie der Anfang des Kommentars + bLineHasCommentBegin = FALSE; // also zurücksetzen + } + else + { + bLineHasCommentEnd = TRUE; + } + } + } + while( cNext != CHAR_EOF && ( c != '*' || cNext != '/' ) ); + + // Alles ausser EOF lesen + if( cNext != CHAR_EOF ) + getChar(); + + reType = TT_COMMENT; + } + } + } + // HTML-Kommentar + else if( c == '<' ) + { + char cNext = peekChar(); + if( cNext == '!' ) + { + getChar(); // '!' ist verloren, wenn nicht wirklich Tag + + cNext = peekChar(); + if( cNext == '-' ) + { + getChar(); // '-' ist verloren, wenn nicht wirklich Tag + + cNext = peekChar(); + if( cNext == '-' ) + { + getChar(); + + // HTML-Kommentar: Alle Zeichen bis Zeilen-Ende oder EOF entfernen + char cPeek = peekChar(); + while( cPeek != CHAR_EOF && testCharFlags( cPeek, CHAR_EOL ) == FALSE ) + { + c = getChar(); + cPeek = peekChar(); + } + + reType = TT_COMMENT; + } + else + { + // Verlorene Zeichen nachliefern + mpActualPos -= 2; + } + } + else + { + // Verlorenes Zeichen nachliefern + mpActualPos--; + } + } + } + + // Echter Operator, kann hier einfach behandelt werden, + // da nicht der wirkliche Operator, wie z.B. += interessiert, + // sondern nur die Tatsache, dass es sich um einen handelt. + if( reType != TT_COMMENT ) + { + reType = TT_OPERATOR; + } + } + + // Objekt-Trenner? Muss vor Number abgehandelt werden + else if( c == '.' && ( peekChar() < '0' || peekChar() > '9' ) ) + { + reType = TT_OPERATOR; + } + + // Zahl? + else if( testCharFlags( c, CHAR_START_NUMBER ) == TRUE ) + { + // Buffer-Position initialisieren + int nPos = 0; + + // Zahlensystem, 10 = normal, wird bei Oct/Hex geaendert + int nRadix = 10; + + // Ist es eine Hex- oder Oct-Zahl? + if( c == '0' ) + { + // Octal? + // Java-Script geht von einem Octal-Wert aus, wenn nach 0 eine + // Ziffer im oktalen Ziffernbereich folgt + if( testCharFlags( peekChar(), CHAR_IN_OCT_NUMBER ) ) + { + nRadix = 8; // Octal-Basis + + // Alle Ziffern einlesen + while( testCharFlags( peekChar(), CHAR_IN_OCT_NUMBER ) ) + c = getChar(); + } + + // Dementsprechend wird bei 0x Hex geparsed + else if( peekChar() == 'x' || peekChar() == 'X' ) + { + // x entfernen + getChar(); + nRadix = 16; // Hex-Basis + + // Alle Ziffern einlesen und puffern + while( testCharFlags( peekChar(), CHAR_IN_HEX_NUMBER ) ) + c = getChar(); + } + } + + // Wenn nicht Oct oder Hex als double ansehen + if( nRadix == 10 ) + { + // Flag, ob das letzte Zeichen ein Exponent war + BOOL bAfterExpChar = FALSE; + + // Alle Ziffern einlesen + while( testCharFlags( peekChar(), CHAR_IN_NUMBER ) || + (bAfterExpChar && peekChar() == '+' ) || + (bAfterExpChar && peekChar() == '-' ) ) + // Nach Exponent auch +/- OK + { + c = getChar(); // Zeichen lesen + bAfterExpChar = ( c == 'e' || c == 'E' ); + } + } + + reType = TT_NUMBER; + } + + // String? + else if( testCharFlags( c, CHAR_START_STRING ) == TRUE ) + { + // Merken, welches Zeichen den String eroeffnet hat + char cEndString = c; + + // Alle Ziffern einlesen und puffern + while( peekChar() != cEndString ) + { + // #58846 EOF vor getChar() abfangen, damit EOF micht verloren geht + if( peekChar() == CHAR_EOF ) + { + // ERROR: unterminated string literal + reType = TT_ERROR; + break; + } + c = getChar(); + if( testCharFlags( c, CHAR_EOL ) == TRUE ) + { + // ERROR: unterminated string literal + reType = TT_ERROR; + break; + } + // Escape-Character untersuchen + else if ( (c == '\\') && (bStarScriptMode) ) + { + // Kann hier ganz einfach gehandelt werden: + // Einfach ein weiteres Zeichen lesen + char cNext = getChar(); + } + } + + // Zeichen lesen + if( reType != TT_ERROR ) + { + getChar(); + reType = TT_STRING; + } + } + + // Zeilenende? + else if( testCharFlags( c, CHAR_EOL ) == TRUE ) + { + // Falls ein weiteres anderes EOL-Char folgt, weg damit + char cNext = peekChar(); + if( cNext != c && testCharFlags( cNext, CHAR_EOL ) == TRUE ) + getChar(); + + setCommentState(nLine, bLineHasCommentBegin, bLineHasCommentEnd); + bLineHasCommentBegin = FALSE; + bLineHasCommentEnd = FALSE; + + // Positions-Daten auf Zeilen-Beginn setzen + nCol = 0; + nLine++; + + reType = TT_EOL; + } + + // Alles andere bleibt TT_UNKNOWN + + + // End-Position eintragen + rpEndPos = mpActualPos; + return TRUE; +} + +void SimpleTokenizer_Impl::setCommentState(UINT32 nLine, BOOL bCommentBegin, BOOL bCommentEnd) +{ + while (pCommentsBegin->size() <= nLine) + pCommentsBegin->push_back(FALSE); + + while (pCommentsEnd->size() <= nLine) + pCommentsEnd->push_back(FALSE); + + NAMESPACE_STD(list)<BOOL>::iterator posBegins, posEnds; + UINT32 nCounter = 0; + + posBegins = pCommentsBegin->begin(); + posEnds = pCommentsEnd->begin(); + + while (nCounter < nLine) + { + posBegins++; + posEnds++; + nCounter++; + } + + *posBegins = bCommentBegin; + *posEnds = bCommentEnd; +} + +void SimpleTokenizer_Impl::addLines(UINT32 nLine, INT32 nCount) +{ + NAMESPACE_STD(list)<BOOL>::iterator posBegins, posEnds; + UINT32 nCounter = 0; + + if (!pCommentsBegin->empty()) + { + posBegins = pCommentsBegin->begin(); + posEnds = pCommentsEnd->begin(); + + while (nCounter < nLine) + { + posBegins++; + posEnds++; + nCounter++; + } + + INT32 nDiff = nCount; + while (nDiff != 0) + { + if (nDiff > 0) + { + pCommentsBegin->insert(posBegins, FALSE); + pCommentsEnd->insert(posEnds, FALSE); + nDiff--; + } + else + { + pCommentsBegin->erase(posBegins++); + pCommentsEnd->erase(posEnds++); + UINT16 dummy = pCommentsBegin->size(); + + nDiff++; + } + } + } + else if (nCount > 0) + { + INT32 nDiff = nCount; + while (nDiff != 0) + { + pCommentsBegin->push_back(FALSE); + pCommentsEnd->push_back(FALSE); + nDiff--; + } + } +} + +String SimpleTokenizer_Impl::getTokStr + ( /*out*/const char* pStartPos, /*out*/const char* pEndPos ) +{ + return String( pStartPos, (USHORT)( pEndPos - pStartPos ) ); +} + +// TEST: Token ausgeben +String SimpleTokenizer_Impl::getFullTokenStr( /*out*/TokenTypes eType, + /*out*/const char* pStartPos, /*out*/const char* pEndPos ) +{ + String aOut; + switch( eType ) + { + case TT_UNKNOWN: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_UNKNOWN:") ); break; + case TT_IDENTIFIER: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_IDENTIFIER:") ); break; + case TT_WHITESPACE: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_WHITESPACE:") ); break; + case TT_NUMBER: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_NUMBER:") ); break; + case TT_STRING: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_STRING:") ); break; + case TT_EOL: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_EOL:") ); break; + case TT_COMMENT: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_COMMENT:") ); break; + case TT_ERROR: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_ERROR:") ); break; + case TT_OPERATOR: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_OPERATOR:") ); break; + case TT_KEYWORD: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_KEYWORD:") ); break; + } + if( eType != TT_EOL ) + { + aOut += String( pStartPos, (USHORT)( pEndPos - pStartPos ) ); + } + aOut += String( RTL_CONSTASCII_USTRINGPARAM("\n") ); + return aOut; +} + +SimpleTokenizer_Impl::SimpleTokenizer_Impl( void ) +{ + memset( aCharTypeTab, 0, sizeof( aCharTypeTab ) ); + + // Zeichen-Tabelle fuellen + USHORT i; + + // Zulaessige Zeichen fuer Identifier + USHORT nHelpMask = (USHORT)( CHAR_START_IDENTIFIER | CHAR_IN_IDENTIFIER ); + for( i = 'a' ; i <= 'z' ; i++ ) + aCharTypeTab[i] |= nHelpMask; + for( i = 'A' ; i <= 'Z' ; i++ ) + aCharTypeTab[i] |= nHelpMask; + // '_' extra eintragen + aCharTypeTab['_'] |= nHelpMask; + // AB 23.6.97: '$' ist auch erlaubt + aCharTypeTab['$'] |= nHelpMask; + + // Ziffern (Identifier und Number ist moeglich) + nHelpMask = (USHORT)( CHAR_IN_IDENTIFIER | CHAR_START_NUMBER | + CHAR_IN_NUMBER | CHAR_IN_HEX_NUMBER ); + for( i = '0' ; i <= '9' ; i++ ) + aCharTypeTab[i] |= nHelpMask; + + // e und E sowie . von Hand ergaenzen + aCharTypeTab['e'] |= CHAR_IN_NUMBER; + aCharTypeTab['E'] |= CHAR_IN_NUMBER; + aCharTypeTab['.'] |= (USHORT)( CHAR_IN_NUMBER | CHAR_START_NUMBER ); + + // Hex-Ziffern + for( i = 'a' ; i <= 'f' ; i++ ) + aCharTypeTab[i] |= CHAR_IN_HEX_NUMBER; + for( i = 'A' ; i <= 'F' ; i++ ) + aCharTypeTab[i] |= CHAR_IN_HEX_NUMBER; + + // Oct-Ziffern + for( i = '0' ; i <= '7' ; i++ ) + aCharTypeTab[i] |= CHAR_IN_OCT_NUMBER; + + // String-Beginn/End-Zeichen + aCharTypeTab['\''] |= CHAR_START_STRING; + aCharTypeTab['\"'] |= CHAR_START_STRING; + + // Operator-Zeichen + aCharTypeTab['!'] |= CHAR_OPERATOR; + aCharTypeTab['%'] |= CHAR_OPERATOR; + aCharTypeTab['&'] |= CHAR_OPERATOR; + aCharTypeTab['('] |= CHAR_OPERATOR; + aCharTypeTab[')'] |= CHAR_OPERATOR; + aCharTypeTab['*'] |= CHAR_OPERATOR; + aCharTypeTab['+'] |= CHAR_OPERATOR; + aCharTypeTab[','] |= CHAR_OPERATOR; + aCharTypeTab['-'] |= CHAR_OPERATOR; + aCharTypeTab['/'] |= CHAR_OPERATOR; + aCharTypeTab[':'] |= CHAR_OPERATOR; + aCharTypeTab['<'] |= CHAR_OPERATOR; + aCharTypeTab['='] |= CHAR_OPERATOR; + aCharTypeTab['>'] |= CHAR_OPERATOR; + aCharTypeTab['?'] |= CHAR_OPERATOR; + aCharTypeTab['^'] |= CHAR_OPERATOR; + aCharTypeTab['|'] |= CHAR_OPERATOR; + aCharTypeTab['~'] |= CHAR_OPERATOR; + aCharTypeTab['{'] |= CHAR_OPERATOR; + aCharTypeTab['}'] |= CHAR_OPERATOR; + aCharTypeTab['['] |= CHAR_OPERATOR; + aCharTypeTab[']'] |= CHAR_OPERATOR; + aCharTypeTab[';'] |= CHAR_OPERATOR; + + // Space + aCharTypeTab[' ' ] |= CHAR_SPACE; + aCharTypeTab['\t'] |= CHAR_SPACE; + + // Zeilen-Ende-Zeichen + aCharTypeTab['\r'] |= CHAR_EOL; + aCharTypeTab['\n'] |= CHAR_EOL; + + // fuer Syntax Highlighting + pCommentsBegin = new NAMESPACE_STD(list)<BOOL>(); + pCommentsEnd = new NAMESPACE_STD(list)<BOOL>(); + + bStarScriptMode = FALSE; + ppListKeyWords = NULL; +} + +SimpleTokenizer_Impl::~SimpleTokenizer_Impl( void ) +{ + delete(pCommentsBegin); + delete(pCommentsEnd); +} + +SimpleTokenizer_Impl* getSimpleTokenizer( void ) +{ + static SimpleTokenizer_Impl* pSimpleTokenizer = NULL; + if( !pSimpleTokenizer ) + pSimpleTokenizer = new SimpleTokenizer_Impl(); + return pSimpleTokenizer; +} + +// Heraussuchen der jeweils naechsten Funktion aus einem JavaScript-Modul +UINT16 SimpleTokenizer_Impl::parseLine( UINT32 nParseLine, const String* aSource ) +{ + ByteString aByteSource( *aSource, gsl_getSystemTextEncoding() ); + + // Position auf den Anfang des Source-Strings setzen + mpStringBegin = mpActualPos = aByteSource.GetBuffer(); + bLineHasCommentBegin = isBeginComment( nParseLine ); + bLineHasCommentEnd = FALSE; + + // Zeile und Spalte initialisieren + nLine = nParseLine; + nCol = 0L; + + // Variablen fuer die Out-Parameter + TokenTypes eType; + const char* pStartPos; + const char* pEndPos; + + // Schleife ueber alle Tokens + UINT16 nTokenCount = 0; + while( getNextToken( eType, pStartPos, pEndPos ) ) + nTokenCount++; + + // die Endzustaende der Zeilen in die Listen eintragen + setCommentState(nParseLine, bLineHasCommentBegin, bLineHasCommentEnd); + + return nTokenCount; +} + +void SimpleTokenizer_Impl::getHighlightPortions( UINT32 nParseLine, const String& rLine, + /*out*/HighlightPortions& portions ) +{ + ByteString aByteLine( rLine, gsl_getSystemTextEncoding() ); + + // Position auf den Anfang des Source-Strings setzen + mpStringBegin = mpActualPos = aByteLine.GetBuffer(); + bLineHasCommentBegin = isBeginComment( nParseLine ); + bLineHasCommentEnd = FALSE; + + // Zeile und Spalte initialisieren + nLine = nParseLine; + nCol = 0L; + + // Variablen fuer die Out-Parameter + TokenTypes eType; + const char* pStartPos; + const char* pEndPos; + + // Schleife ueber alle Tokens + while( getNextToken( eType, pStartPos, pEndPos ) ) + { + HighlightPortion portion; + + portion.nBegin = (UINT16)(pStartPos - mpStringBegin); + portion.nEnd = (UINT16)(pEndPos - mpStringBegin); + portion.tokenType = eType; + + portions.Insert(portion, portions.Count()); + } +} + +BOOL SimpleTokenizer_Impl::isBeginComment( UINT32 nLine ) +{ + NAMESPACE_STD(list)<BOOL>::const_iterator posBegin, posEnd; + BOOL bCommentStart = FALSE; + + UINT32 i = 0; + posBegin=pCommentsBegin->begin(); + posEnd=pCommentsEnd->begin(); + + while ((i < nLine) && (posBegin != pCommentsBegin->end()) && (posEnd != pCommentsEnd->end())) + { + if (bCommentStart && *posEnd) + bCommentStart = FALSE; + if ((!bCommentStart) && *posBegin) + bCommentStart = TRUE; + + posBegin++; + posEnd++; + i++; + } + + return bCommentStart; +} + +void SimpleTokenizer_Impl::outCommentList() +{ + NAMESPACE_STD(list)<BOOL>::const_iterator posBegin, posEnd; + BOOL bCommentStart = FALSE; + + UINT32 i = 0; + posBegin=pCommentsBegin->begin(); + posEnd=pCommentsEnd->begin(); + + printf("\nComments:\n"); + while (posBegin != pCommentsBegin->end()) + { + printf("line: %2d beginComment: %d endComment: %d\n", i, *posBegin, *posEnd); + + posBegin++; + posEnd++; + i++; + } + +} + +////////////////////////////////////////////////////////////////////////// +// Implementierung des SyntaxHighlighter + +SyntaxHighlighter::SyntaxHighlighter() +{ + m_pSimpleTokenizer = new SimpleTokenizer_Impl(); + m_pKeyWords = NULL; + m_nKeyWordCount = 0; +} + +SyntaxHighlighter::~SyntaxHighlighter() +{ + delete(m_pSimpleTokenizer); + delete(m_pKeyWords); +} + +void SyntaxHighlighter::initialize( HighlighterLanguage eLanguage_ ) +{ + eLanguage = eLanguage_; + delete(m_pSimpleTokenizer); + m_pSimpleTokenizer = new SimpleTokenizer_Impl(); + + if (eLanguage == HIGHLIGHT_BASIC) + { + m_pSimpleTokenizer->setKeyWords( strListBasicKeyWords, + sizeof( strListBasicKeyWords ) / sizeof( char* )); + } + else + { + m_pSimpleTokenizer->setKeyWords( NULL, 0 ); + } +} + +const Range SyntaxHighlighter::notifyChange( UINT32 nLine, INT32 nLineCountDifference, + const String* pChangedLines, UINT32 nArrayLength) +{ + if (nLineCountDifference != 0) + m_pSimpleTokenizer->addLines(nLine, nLineCountDifference); + + for (INT32 i=0; i<nArrayLength; i++) + m_pSimpleTokenizer->parseLine(nLine+i, &pChangedLines[i]); + + return Range(nLine, nLine+nArrayLength-1); +} + +void SyntaxHighlighter::getHighlightPortions( UINT32 nLine, const String& rLine, + /*out*/HighlightPortions& portions ) +{ + m_pSimpleTokenizer->getHighlightPortions( nLine, rLine, portions ); +} + + +///////////////////////////////////////////////////////////////////////// +// Implementation SbJScriptModule (Basic-Modul fuer JavaScript-Sourcen) +SbJScriptModule::SbJScriptModule( const String& rName ) + :SbModule( rName ) +{ +} + +BOOL SbJScriptModule::LoadData( SvStream& rStrm, USHORT nVer ) +{ + Clear(); + if( !SbxObject::LoadData( rStrm, 1 ) ) + return FALSE; + + // Source-String holen + rStrm.ReadByteString( aSource, gsl_getSystemTextEncoding() ); + //rStrm >> aSource; + return TRUE; +} + +BOOL SbJScriptModule::StoreData( SvStream& rStrm ) const +{ + if( !SbxObject::StoreData( rStrm ) ) + return FALSE; + + // Source-String schreiben + rStrm.WriteByteString( aSource, gsl_getSystemTextEncoding() ); + //rStrm << aSource; + return TRUE; +} + + +///////////////////////////////////////////////////////////////////////// + +SbMethod::SbMethod( const String& r, SbxDataType t, SbModule* p ) + : SbxMethod( r, t ), pMod( p ) +{ + bInvalid = TRUE; + nStart = + nDebugFlags = + nLine1 = + nLine2 = 0; + // AB: 2.7.1996: HACK wegen 'Referenz kann nicht gesichert werden' + SetFlag( SBX_NO_MODIFY ); +} + +SbMethod::~SbMethod() +{} + +SbxArray* SbMethod::GetLocals() +{ + if( pINST ) + return pINST->GetLocals( this ); + else + return NULL; +} + +SbxArray* SbMethod::GetStatics() +{ + DBG_ERROR( "SbMethod::GetStatics() invalid, AB fragen" ) + return NULL; +} + +BOOL SbMethod::LoadData( SvStream& rStrm, USHORT nVer ) +{ + if( !SbxMethod::LoadData( rStrm, 1 ) ) + return FALSE; + INT16 n; + rStrm >> n; + // nDebugFlags = n; // AB 16.1.96: Nicht mehr uebernehmen + if( nVer == 2 ) + rStrm >> nLine1 >> nLine2 >> nStart >> bInvalid; + // AB: 2.7.1996: HACK wegen 'Referenz kann nicht gesichert werden' + SetFlag( SBX_NO_MODIFY ); + return TRUE; +} + +BOOL SbMethod::StoreData( SvStream& rStrm ) const +{ + if( !SbxMethod::StoreData( rStrm ) ) + return FALSE; + rStrm << (INT16) nDebugFlags + << (INT16) nLine1 + << (INT16) nLine2 + << (INT16) nStart + << (BYTE) bInvalid; + return TRUE; +} + +void SbMethod::GetLineRange( USHORT& l1, USHORT& l2 ) +{ + l1 = nLine1; l2 = nLine2; +} + +// Kann spaeter mal weg + +SbxInfo* SbMethod::GetInfo() +{ + return pInfo; +} + +// Schnittstelle zum Ausfuehren einer Methode aus den Applikationen +// #34191# Mit speziellem RefCounting, damit das Basic nicht durch CloseDocument() +// abgeschossen werden kann. Rueckgabewert wird als String geliefert. +ErrCode SbMethod::Call( SbxValue* pRet ) +{ + // RefCount vom Modul hochzaehlen + SbModule* pMod = (SbModule*)GetParent(); + pMod->AddRef(); + + // RefCount vom Basic hochzaehlen + StarBASIC* pBasic = (StarBASIC*)pMod->GetParent(); + pBasic->AddRef(); + + // Values anlegen, um Return-Wert zu erhalten + SbxValues aVals; + aVals.eType = SbxVARIANT; + Get( aVals ); + if ( pRet ) + pRet->Put( aVals ); + + // Gab es einen Error + ErrCode nErr = SbxBase::GetError(); + SbxBase::ResetError(); + + // Objekte freigeben + pMod->ReleaseRef(); + pBasic->ReleaseRef(); + + return nErr; +} + +///////////////////////////////////////////////////////////////////////// + +// Implementation SbJScriptMethod (Method-Klasse als Wrapper fuer JavaScript-Funktionen) + +SbJScriptMethod::SbJScriptMethod( const String& r, SbxDataType t, SbModule* p ) + : SbMethod( r, t, p ) +{ +} + +SbJScriptMethod::~SbJScriptMethod() +{} + + +///////////////////////////////////////////////////////////////////////// + +SbProperty::SbProperty( const String& r, SbxDataType t, SbModule* p ) + : SbxProperty( r, t ), pMod( p ) +{ + bInvalid = FALSE; +} + +SbProperty::~SbProperty() +{} + + diff --git a/basic/source/comp/buffer.cxx b/basic/source/comp/buffer.cxx new file mode 100644 index 000000000000..7fc27bb233cc --- /dev/null +++ b/basic/source/comp/buffer.cxx @@ -0,0 +1,253 @@ +/************************************************************************* + * + * $RCSfile: buffer.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include "sbcomp.hxx" +#pragma hdrstop +#include "buffer.hxx" +#include <string.h> + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBCOMP, SBCOMP_CODE ) + +// Der SbiBuffer wird in Inkrements von mindestens 16 Bytes erweitert. +// Dies ist notwendig, da viele Klassen von einer Pufferlaenge +// von x*16 Bytes ausgehen. + +SbiBuffer::SbiBuffer( SbiParser* p, short n ) +{ + pParser = p; + n = ( (n + 15 ) / 16 ) * 16; + if( !n ) n = 16; + pBuf = NULL; + pCur = NULL; + nInc = n; + nSize = + nOff = 0; +} + +SbiBuffer::~SbiBuffer() +{ + delete pBuf; +} + +// Rausreichen des Puffers +// Dies fuehrt zur Loeschung des Puffers! + +char* SbiBuffer::GetBuffer() +{ + char* p = pBuf; + pBuf = NULL; + pCur = NULL; + return p; +} + +// Test, ob der Puffer n Bytes aufnehmen kann. +// Im Zweifelsfall wird er vergroessert + +BOOL SbiBuffer::Check( USHORT n ) +{ + if( !n ) return TRUE; + if( ((long) nOff + n ) > (long) nSize ) + { + USHORT nn = 0; + while( nn < n ) nn += nInc; + char* p; + if( ((long) nSize + nn ) > 0xFF00L ) p = NULL; + else p = new char [nSize + nn]; + if( !p ) + { + pParser->Error( SbERR_PROG_TOO_LARGE ); + nInc = 0; + delete pBuf; pBuf = NULL; + return FALSE; + } + else + { + if( nSize ) memcpy( p, pBuf, nSize ); + delete pBuf; + pBuf = p; + pCur = pBuf + nOff; + nSize += nn; + } + } + return TRUE; +} + +// Angleich des Puffers auf die uebergebene Byte-Grenze + +void SbiBuffer::Align( short n ) +{ + if( nOff % n ) { + USHORT nn =( ( nOff + n ) / n ) * n; + if( nn <= 0xFF00 ) + { + nn -= nOff; + if( Check( nn ) ) + { + memset( pCur, 0, nn ); + pCur += nn; + nOff += nn; + } + } + } +} + +// Patch einer Location + +void SbiBuffer::Patch( USHORT off, UINT16 val ) +{ + if( ( off + sizeof( UINT16 ) ) < nOff ) + { + BYTE* p = (BYTE*) pBuf + off; + *p++ = (char) ( val & 0xFF ); + *p = (char) ( val >> 8 ); + } +} + +// Forward References auf Labels und Prozeduren +// bauen eine Kette auf. Der Anfang der Kette ist beim uebergebenen +// Parameter, das Ende der Kette ist 0. + +void SbiBuffer::Chain( USHORT off ) +{ + if( off && pBuf ) + { + BYTE *ip; + USHORT i = off; + USHORT val = nOff; + do + { + ip = (BYTE*) pBuf + i; + i = ( *ip ) | ( *(ip+1) << 8 ); + if( i >= nOff ) + { + pParser->Error( SbERR_INTERNAL_ERROR, "BACKCHAIN" ); + break; + } + *ip++ = (char) ( val & 0xFF ); + *ip = (char) ( val >> 8 ); + } while( i ); + } +} + +BOOL SbiBuffer::operator +=( INT8 n ) +{ + if( Check( 1 ) ) + { + *pCur++ = (char) n; nOff++; return TRUE; + } else return FALSE; +} + +BOOL SbiBuffer::operator +=( UINT8 n ) +{ + if( Check( 1 ) ) + { + *pCur++ = (char) n; nOff++; return TRUE; + } else return FALSE; +} + +BOOL SbiBuffer::operator +=( INT16 n ) +{ + if( Check( 2 ) ) + { + *pCur++ = (char) ( n & 0xFF ); + *pCur++ = (char) ( n >> 8 ); + nOff += 2; return TRUE; + } else return FALSE; +} + +BOOL SbiBuffer::operator +=( UINT16 n ) +{ + if( Check( 2 ) ) + { + *pCur++ = (char) ( n & 0xFF ); + *pCur++ = (char) ( n >> 8 ); + nOff += 2; return TRUE; + } else return FALSE; +} + +BOOL SbiBuffer::operator +=( const String& n ) +{ + USHORT l = n.Len() + 1; + if( Check( l ) ) + { + ByteString aByteStr( n, gsl_getSystemTextEncoding() ); + memcpy( pCur, aByteStr.GetBuffer(), l ); + pCur += l; + nOff += l; + return TRUE; + } + else return FALSE; +} + +BOOL SbiBuffer::Add( const void* p, USHORT len ) +{ + if( Check( len ) ) + { + memcpy( pCur, p, len ); + pCur += len; + nOff += len; + return TRUE; + } else return FALSE; +} + + + diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx new file mode 100644 index 000000000000..a81b0c02422d --- /dev/null +++ b/basic/source/comp/codegen.cxx @@ -0,0 +1,241 @@ +/************************************************************************* + * + * $RCSfile: codegen.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <svtools/sbx.hxx> +#include "sbcomp.hxx" +#pragma hdrstop +#include "image.hxx" + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBCOMP, SBCOMP_CODE ) + +// nInc ist die Inkrementgroesse der Puffer + +SbiCodeGen::SbiCodeGen( SbModule& r, SbiParser* p, short nInc ) + : rMod( r ), aCode( p, nInc ) +{ + pParser = p; + bStmnt = FALSE; + nLine = 0; + nCol = 0; + nForLevel = 0; +} + +USHORT SbiCodeGen::GetPC() +{ + return aCode.GetSize(); +} + +// Statement merken + +void SbiCodeGen::Statement() +{ + bStmnt = TRUE; + + nLine = pParser->GetLine(); + nCol = pParser->GetCol1(); + + // #29955 Information der for-Schleifen-Ebene + // in oberen Byte der Spalte speichern + nCol = (nCol & 0xff) + 0x100 * nForLevel; +} + +// Anfang eines Statements markieren + +void SbiCodeGen::GenStmnt() +{ + if( bStmnt ) + { + bStmnt = FALSE; + Gen( _STMNT, nLine, nCol ); + } +} + +// Die Gen-Routinen returnen den Offset des 1. Operanden, +// damit Jumps dort ihr Backchain versenken koennen + +USHORT SbiCodeGen::Gen( SbiOpcode eOpcode ) +{ +#ifndef PRODUCT + if( eOpcode < SbOP0_START || eOpcode > SbOP0_END ) + pParser->Error( SbERR_INTERNAL_ERROR, "OPCODE1" ); +#endif + GenStmnt(); + aCode += (UINT8) eOpcode; + return GetPC(); +} + +USHORT SbiCodeGen::Gen( SbiOpcode eOpcode, UINT16 nOpnd ) +{ +#ifndef PRODUCT + if( eOpcode < SbOP1_START || eOpcode > SbOP1_END ) + pParser->Error( SbERR_INTERNAL_ERROR, "OPCODE2" ); +#endif + GenStmnt(); + aCode += (UINT8) eOpcode; + USHORT n = GetPC(); + aCode += nOpnd; + return n; +} + +USHORT SbiCodeGen::Gen( SbiOpcode eOpcode, UINT16 nOpnd1, UINT16 nOpnd2 ) +{ +#ifndef PRODUCT + if( eOpcode < SbOP2_START || eOpcode > SbOP2_END ) + pParser->Error( SbERR_INTERNAL_ERROR, "OPCODE3" ); +#endif + GenStmnt(); + aCode += (UINT8) eOpcode; + USHORT n = GetPC(); + aCode += nOpnd1; + aCode += nOpnd2; + return n; +} + +// Abspeichern des erzeugten Images im Modul + +void SbiCodeGen::Save() +{ + SbiImage* p = new SbiImage; + if( !p ) + { + SbERR_NO_MEMORY; return; + } + rMod.StartDefinitions(); + // OPTION BASE-Wert: + p->nDimBase = pParser->nBase; + // OPTION EXPLICIT-Flag uebernehmen + if( pParser->bExplicit ) + p->SetFlag( SBIMG_EXPLICIT ); + if( pParser->bText ) + p->SetFlag( SBIMG_COMPARETEXT ); + // GlobalCode-Flag + if( pParser->HasGlobalCode() ) + p->SetFlag( SBIMG_INITCODE ); + // Die Entrypoints: + for( SbiSymDef* pDef = pParser->aPublics.First(); pDef; + pDef = pParser->aPublics.Next() ) + { + SbiProcDef* pProc = pDef->GetProcDef(); + if( pProc && pProc->IsPublic() && pProc->IsDefined() ) + { + SbMethod* pMeth = rMod.GetMethod( pProc->GetName(), pProc->GetType() ); + pMeth->nStart = pProc->GetAddr(); + pMeth->nLine1 = pProc->GetLine1(); + pMeth->nLine2 = pProc->GetLine2(); + // Die Parameter: + SbxInfo* pInfo = pMeth->GetInfo(); + String aHelpFile, aComment; + ULONG nHelpId = 0; + if( pInfo ) + { + // Die Zusatzdaten retten + aHelpFile = pInfo->GetHelpFile(); + aComment = pInfo->GetComment(); + nHelpId = pInfo->GetHelpId(); + } + // Und die Parameterliste neu aufbauen + pInfo = new SbxInfo( aHelpFile, nHelpId ); + pInfo->SetComment( aComment ); + SbiSymPool* pPool = &pProc->GetParams(); + // Das erste Element ist immer der Funktionswert! + for( USHORT i = 1; i < pPool->GetSize(); i++ ) + { + SbiSymDef* pPar = pPool->Get( i ); + SbxDataType t = pPar->GetType(); + if( !pPar->IsByVal() ) + t = (SbxDataType) ( t | SbxBYREF ); + if( pPar->GetDims() ) + t = (SbxDataType) ( t | SbxARRAY ); + // #33677 Optional-Info durchreichen + USHORT nFlags = SBX_READ; + if( pPar->IsOptional() ) + nFlags |= SBX_OPTIONAL; + pInfo->AddParam( pPar->GetName(), t, nFlags ); + } + pMeth->SetInfo( pInfo ); + } + } + // Der Code + p->AddCode( aCode.GetBuffer(), aCode.GetSize() ); + + // Der globale StringPool. 0 ist nicht belegt. + SbiStringPool* pPool = &pParser->aGblStrings; + USHORT nSize = pPool->GetSize(); + p->MakeStrings( nSize ); + USHORT i; + for( i = 1; i <= nSize; i++ ) + p->AddString( pPool->Find( i ) ); + + // Typen einfuegen + + USHORT nCount = pParser->rTypeArray->Count(); + for (i = 0; i < nCount; i++) + p->AddType((SbxObject *)pParser->rTypeArray->Get(i)); + + if( !p->IsError() ) + rMod.pImage = p; + else + delete p; + + rMod.EndDefinitions(); +} + diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx new file mode 100644 index 000000000000..233342c0499c --- /dev/null +++ b/basic/source/comp/dim.cxx @@ -0,0 +1,792 @@ +/************************************************************************* + * + * $RCSfile: dim.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <svtools/sbx.hxx> +#include "sbcomp.hxx" +#pragma hdrstop + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBCOMP, SBCOMP_CODE ) + +// Deklaration einer Variablen +// Bei Fehlern wird bis zum Komma oder Newline geparst. +// Returnwert: eine neue Instanz, die eingefuegt und dann geloescht wird. +// Array-Indexe werden als SbiDimList zurueckgegeben + +SbiSymDef* SbiParser::VarDecl( SbiDimList** ppDim, BOOL bStatic, BOOL bConst ) +{ + if( !TestSymbol() ) return NULL; + SbxDataType t = eScanType; + SbiSymDef* pDef = bConst ? new SbiConstDef( aSym ) : new SbiSymDef( aSym ); + SbiDimList* pDim = NULL; + // Klammern? + if( Peek() == LPAREN ) + pDim = new SbiDimList( this ); + pDef->SetType( t ); + if( bStatic ) + pDef->SetStatic(); + TypeDecl( *pDef ); + if( !ppDim && pDim ) + { + if(pDim->GetDims() ) + Error( SbERR_EXPECTED, "()" ); + delete pDim; + } + else if( ppDim ) + *ppDim = pDim; + return pDef; +} + +// Aufloesen einer AS-Typdeklaration +// Der Datentyp wird in die uebergebene Variable eingetragen + +void SbiParser::TypeDecl( SbiSymDef& rDef ) +{ + SbxDataType eType = rDef.GetType(); + short nSize = 0; + if( Peek() == AS ) + { +#ifdef VBSCRIPT_TEST + Error( ERRCODE_BASIC_NOT_IN_VBSCRIPT ); +#endif + Next(); + rDef.SetDefinedAs(); + String aType; + SbiToken eTok = Next(); + if( eTok == NEW ) + { + rDef.SetNew(); + eTok = Next(); + } + switch( eTok ) + { + case ANY: + if( rDef.IsNew() ) + Error( SbERR_SYNTAX ); + eType = SbxVARIANT; break; + case TINTEGER: + case TLONG: + case TSINGLE: + case TDOUBLE: + case TCURRENCY: + case TDATE: + case TSTRING: + case TOBJECT: + case _ERROR_: + case TBOOLEAN: + case TVARIANT: + if( rDef.IsNew() ) + Error( SbERR_SYNTAX ); + eType = SbxDataType( eTok - TINTEGER + SbxINTEGER ); + if( eType == SbxSTRING ) + { + // STRING*n ? + if( Peek() == MUL ) + { // fixed size! + Next(); + SbiConstExpression aSize( this ); + nSize = aSize.GetShortValue(); + if( nSize < 0 ) + Error( SbERR_OUT_OF_RANGE ); + } + } + break; + case SYMBOL: // kann nur ein TYPE oder eine Objektklasse sein! + if( eScanType != SbxVARIANT ) + Error( SbERR_SYNTAX ); + else + { + String aCompleteName = aSym; + + // #52709 DIM AS NEW fuer Uno mit voll-qualifizierten Namen + if( Peek() == DOT ) + { + String aDotStr( '.' ); + while( Peek() == DOT ) + { + aCompleteName += aDotStr; + Next(); + if( Peek() == SYMBOL ) + { + Next(); + aCompleteName += aSym; + } + else + { + Next(); + Error( SbERR_UNEXPECTED, SYMBOL ); + break; + } + } + } + + // In den String-Pool uebernehmen + rDef.SetTypeId( aGblStrings.Add( aCompleteName ) ); + } + eType = SbxOBJECT; + break; + default: + Error( SbERR_UNEXPECTED, eTok ); + Next(); + } + // Die Variable koennte mit Suffix deklariert sein + if( rDef.GetType() != SbxVARIANT ) + { + if( rDef.GetType() != eType ) + Error( SbERR_VAR_DEFINED, rDef.GetName() ); + else if( eType == SbxSTRING && rDef.GetLen() != nSize ) + Error( SbERR_VAR_DEFINED, rDef.GetName() ); + } + rDef.SetType( eType ); + rDef.SetLen( nSize ); + } +} + +// Hier werden Variable, Arrays und Strukturen definiert. +// DIM/PRIVATE/PUBLIC/GLOBAL + +void SbiParser::Dim() +{ + DefVar( _DIM, FALSE ); +} + +void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic ) +{ + SbiSymPool* pOldPool = pPool; + BOOL bSwitchPool = FALSE; + if( pProc && ( eCurTok == GLOBAL || eCurTok == PUBLIC || eCurTok == PRIVATE ) ) + Error( SbERR_NOT_IN_SUBR, eCurTok ); + if( eCurTok == PUBLIC || eCurTok == GLOBAL ) + bSwitchPool = TRUE; // im richtigen Moment auf globalen Pool schalten + //pPool = &aGlobals; + // PRIVATE ist Synonym fuer DIM + // _CONST_? + BOOL bConst = FALSE; + if( eCurTok == _CONST_ ) + bConst = TRUE; + else if( Peek() == _CONST_ ) + Next(), bConst = TRUE; +#ifdef SHARED +#define tmpSHARED +#undef SHARED +#endif + // SHARED wird ignoriert + if( Peek() == SHARED ) Next(); +#ifdef tmpSHARED +#define SHARED +#undef tmpSHARED +#endif + // PRESERVE nur bei REDIM + if( Peek() == PRESERVE ) + { + Next(); + if( eOp == _REDIM ) + eOp = _REDIMP; + else + Error( SbERR_UNEXPECTED, eCurTok ); + } + SbiSymDef* pDef; + SbiDimList* pDim; + + // AB 9.7.97, #40689, Statics -> Modul-Initialisierung, in Sub ueberspringen + USHORT nEndOfStaticLbl; + if( bStatic ) + { + nEndOfStaticLbl = aGen.Gen( _JUMP, 0 ); + aGen.Statement(); // bei static hier nachholen + } + + BOOL bDefined = FALSE; + while( ( pDef = VarDecl( &pDim, bStatic, bConst ) ) != NULL ) + { + EnableErrors(); + // Variable suchen: + if( bSwitchPool ) + pPool = &aGlobals; + SbiSymDef* pOld = pPool->Find( pDef->GetName() ); + // AB 31.3.1996, #25651#, auch in Runtime-Library suchen + BOOL bRtlSym = FALSE; + if( !pOld ) + { + pOld = CheckRTLForSym( pDef->GetName(), SbxVARIANT ); + if( pOld ) + bRtlSym = TRUE; + } + if( pOld ) + { + bDefined = TRUE; + // Bei RTL-Symbol immer Fehler + if( !bRtlSym && (eOp == _REDIM || eOp == _REDIMP) ) + { + // Bei REDIM die Attribute vergleichen + if( pOld->IsStatic() || pOld->GetType() != pDef->GetType() ) + Error( SbERR_VAR_DEFINED, pDef->GetName() ); + } + else + Error( SbERR_VAR_DEFINED, pDef->GetName() ); + delete pDef; pDef = pOld; + } + else + pPool->Add( pDef ); + + // #36374: Variable vor Unterscheidung IsNew() anlegen + // Sonst Error bei Dim Identifier As New Type und option explicit + if( !bDefined && ( !bConst || pDef->GetScope() == SbGLOBAL ) ) + { + // Variable oder globale Konstante deklarieren + SbiOpcode eOp; + switch ( pDef->GetScope() ) + { + case SbGLOBAL: eOp = _GLOBAL; goto global; + case SbPUBLIC: eOp = _PUBLIC; + // AB 9.7.97, #40689, kein eigener Opcode mehr + /* + if( bStatic ) + { + eOp = _STATIC; + break; + } + */ + global: aGen.BackChain( nGblChain ); + nGblChain = 0; + bGblDefs = bNewGblDefs = TRUE; + break; + default: eOp = _LOCAL; + } + aGen.Gen( eOp, pDef->GetId(), pDef->GetType() ); + } + + // Initialisierung fuer selbstdefinierte Datentypen + // und per NEW angelegte Variable + if( pDef->GetType() == SbxOBJECT + && pDef->GetTypeId() + && pDef->IsNew() ) +// && ( pDef->IsNew() || pDef->HabIchAlsTypeDefiniert() ) ) + { + if( bConst ) + { + Error( SbERR_SYNTAX ); + } + + if( pDim ) + { + pDef->SetDims( pDim->GetDims() ); + SbiExpression aExpr( this, *pDef, pDim ); + aExpr.Gen(); + aGen.Gen( _DCREATE, pDef->GetId(), pDef->GetTypeId() ); + } + else + { + SbiExpression aExpr( this, *pDef ); + aExpr.Gen(); + SbiOpcode eOp = pDef->IsNew() ? _CREATE : _TCREATE; + aGen.Gen( eOp, pDef->GetId(), pDef->GetTypeId() ); + aGen.Gen( _SET ); + } + } + else + { + if( bConst ) + { + // Konstanten-Definition + if( pDim ) + { + Error( SbERR_SYNTAX ); + delete pDim; + } + SbiExpression aVar( this, *pDef ); + if( !TestToken( EQ ) ) + goto MyBreak; // AB 24.6.1996 (s.u.) + SbiConstExpression aExpr( this ); + if( !bDefined && aExpr.IsValid() ) + { + if( pDef->GetScope() == SbGLOBAL ) + { + // Nur Code fuer globale Konstante erzeugen! + aVar.Gen(); + aExpr.Gen(); + aGen.Gen( _PUTC ); + } + SbiConstDef* pConst = pDef->GetConstDef(); + if( aExpr.GetType() == SbxSTRING ) + pConst->Set( aExpr.GetString() ); + else + pConst->Set( aExpr.GetValue(), aExpr.GetType() ); + } + } + else if( pDim ) + { + // Die Variable dimensionieren + // Bei REDIM die Var vorher loeschen + if( eOp == _REDIM ) + { + SbiExpression aExpr( this, *pDef, NULL ); + aExpr.Gen(); + aGen.Gen( _ERASE ); + } + pDef->SetDims( pDim->GetDims() ); + SbiExpression aExpr( this, *pDef, pDim ); + aExpr.Gen(); + aGen.Gen( (eOp == _STATIC) ? _DIM : eOp ); + } + } + if( !TestComma() ) + goto MyBreak; // AB 24.6.1996 (s.u.) + + // #27963# AB, 24.6.1996 + // Einfuehrung bSwitchPool (s.o.): pPool darf beim VarDecl-Aufruf + // noch nicht auf &aGlobals gesetzt sein. + // Ansonsten soll das Verhalten aber absolut identisch bleiben, + // d.h. pPool muss immer am Schleifen-Ende zurueckgesetzt werden. + // auch bei break + pPool = pOldPool; + continue; // MyBreak überspingen + MyBreak: + pPool = pOldPool; + break; + } + + // AB 9.7.97, #40689, Sprung ueber Statics-Deklaration abschliessen + if( bStatic ) + { + // globalen Chain pflegen + nGblChain = aGen.Gen( _JUMP, 0 ); + bGblDefs = bNewGblDefs = TRUE; + + // fuer Sub Sprung auf Ende der statics eintragen + aGen.BackChain( nEndOfStaticLbl ); + } + + //pPool = pOldPool; +} + +// Hier werden Arrays redimensioniert. + +void SbiParser::ReDim() +{ + DefVar( _REDIM, FALSE ); +} + +// ERASE array, ... + +void SbiParser::Erase() +{ + while( !bAbort ) + { + if( !TestSymbol() ) return; + String aName( aSym ); + SbxDataType eType = eScanType; + SbiSymDef* pDef = pPool->Find( aName ); + if( !pDef ) + { + if( bExplicit ) + Error( SbERR_UNDEF_VAR, aName ); + pDef = pPool->AddSym( aName ); + pDef->SetType( eType ); + } + SbiExpression aExpr( this, *pDef ); + aExpr.Gen(); + aGen.Gen( _ERASE ); + if( !TestComma() ) break; + } +} + +// Deklaration eines Datentyps + +void SbiParser::Type() +{ + // Neues Token lesen, es muss ein Symbol sein + if (!TestSymbol()) + return; + + if (rTypeArray->Find(aSym,SbxCLASS_OBJECT)) + { + Error( SbERR_VAR_DEFINED, aSym ); + return; + } + + SbxObject *pType = new SbxObject(aSym); + + SbiSymDef* pElem; + SbiDimList* pDim; + BOOL bDone = FALSE; + + while( !bDone && !IsEof() ) + { + switch (Next()) + { + case ENDTYPE : + pElem = NULL; + bDone = TRUE; + break; + + case EOLN : + pElem = NULL; + break; + + default: + pDim = NULL; + pElem = VarDecl(&pDim,FALSE,FALSE); + if( pDim ) + { + // HOT FIX, to be updated + delete pDim; + Error( SbERR_NO_STRINGS_ARRAYS ); + } + + } + if( pElem ) + { + SbxArray *pTypeMembers = pType -> GetProperties(); + if (pTypeMembers -> Find (pElem->GetName(),SbxCLASS_DONTCARE)) + Error (SbERR_VAR_DEFINED); + else + { + SbxProperty *pTypeElem = new SbxProperty (pElem->GetName(),pElem->GetType()); + pTypeMembers -> Insert (pTypeElem,pTypeMembers->Count()); + } + delete pElem; + } + } + rTypeArray->Insert (pType,rTypeArray->Count()); +} +/********************************************************** + // Variablennamen einlesen: + if( !TestSymbol() ) return; + String aName( aSym ); + if( pDEFS->Find( aName ) ) + { + Error( SbERR_VAR_DEFINED, aName ); return; + } + SbTypeDef* pDef = pDEFS->AddTypeDef( aName ); + TestEoln(); + + // Deklarationen parsen: + SbiSymDef* pElem; + SbiDimList* pDim; + BOOL bDone = FALSE; + while( !IsEof() && !bDone ) + { + switch( Next() ) + { + case SUB: + case FUNCTION: + pElem = ProcDecl( TRUE ); break; + case END: + pElem = NULL; + bDone = TRUE; + if( Next() != TYPE ) + Error( SbERR_EXPECTED, TYPE ); + break; + default: + pElem = VarDecl( &pDim ); + if( pDim ) + { + // HOT FIX, to be updated + delete pDim; + Error( SbERR_NO_STRINGS_ARRAYS ); + } + } + if( pElem ) + pDef->GetPool().Add( *pElem ); + delete pElem; + } +} +************************************************/ + +// Prozedur-Deklaration +// das erste Token ist bereits eingelesen (SUB/FUNCTION) +// xxx Name [LIB "name"[ALIAS "name"]][(Parameter)][AS TYPE] + +SbiProcDef* SbiParser::ProcDecl( BOOL bDecl ) +{ + BOOL bFunc = BOOL( eCurTok == FUNCTION ); + if( !TestSymbol() ) return NULL; + String aName( aSym ); + SbxDataType eType = eScanType; + SbiProcDef* pDef = new SbiProcDef( this, aName ); + pDef->SetType( eType ); + if( Peek() == _CDECL_ ) + { + Next(); pDef->SetCdecl(); + } + if( Peek() == LIB ) + { + Next(); + if( Next() == FIXSTRING ) + pDef->GetLib() = aSym; + else + Error( SbERR_SYNTAX ); + } + if( Peek() == ALIAS ) + { + Next(); + if( Next() == FIXSTRING ) + pDef->GetAlias() = aSym; + else + Error( SbERR_SYNTAX ); + } + if( !bDecl ) + { + // CDECL, LIB und ALIAS sind unzulaessig + if( pDef->GetLib().Len() ) + Error( SbERR_UNEXPECTED, LIB ); + if( pDef->GetAlias().Len() ) + Error( SbERR_UNEXPECTED, ALIAS ); + if( pDef->IsCdecl() ) + Error( SbERR_UNEXPECTED, _CDECL_ ); + pDef->SetCdecl( FALSE ); + pDef->GetLib().Erase(); + pDef->GetAlias().Erase(); + } + else if( !pDef->GetLib().Len() ) + { + // ALIAS und CDECL nur zusammen mit LIB + if( pDef->GetAlias().Len() ) + Error( SbERR_UNEXPECTED, ALIAS ); + if( pDef->IsCdecl() ) + Error( SbERR_UNEXPECTED, _CDECL_ ); + pDef->SetCdecl( FALSE ); + pDef->GetAlias().Erase(); + } + // Klammern? + if( Peek() == LPAREN ) + { + Next(); + if( Peek() == RPAREN ) + Next(); + else + for(;;) { + BOOL bByVal = FALSE; + BOOL bOptional = FALSE; + while( Peek() == BYVAL || Peek() == _OPTIONAL_ ) + { + if ( Peek() == BYVAL ) Next(), bByVal = TRUE; + else if ( Peek() == _OPTIONAL_ ) Next(), bOptional = TRUE; + } + SbiSymDef* pPar = VarDecl( NULL, FALSE, FALSE ); + if( !pPar ) + break; + if( bByVal ) + pPar->SetByVal(); + if( bOptional ) + pPar->SetOptional(); + pDef->GetParams().Add( pPar ); + SbiToken eTok = Next(); + if( eTok != COMMA && eTok != RPAREN ) + { + Error( SbERR_EXPECTED, RPAREN ); + break; + } + if( eTok == RPAREN ) + break; + } + } + TypeDecl( *pDef ); + if( eType != SbxVARIANT && pDef->GetType() != eType ) + Error( SbERR_BAD_DECLARATION, aName ); +// if( pDef->GetType() == SbxOBJECT ) +// pDef->SetType( SbxVARIANT ), +// Error( SbERR_SYNTAX ); + if( pDef->GetType() == SbxVARIANT && !bFunc ) + pDef->SetType( SbxEMPTY ); + return pDef; +} + +// DECLARE + +void SbiParser::Declare() +{ + Next(); + if( eCurTok != SUB && eCurTok != FUNCTION ) + Error( SbERR_UNEXPECTED, eCurTok ); + else + { + SbiProcDef* pDef = ProcDecl( TRUE ); + if( pDef ) + { + if( !pDef->GetLib().Len() ) + Error( SbERR_EXPECTED, LIB ); + // gibts den schon? + SbiSymDef* pOld = aPublics.Find( pDef->GetName() ); + if( pOld ) + { + SbiProcDef* p = pOld->GetProcDef(); + if( !p ) + { + // Als Variable deklariert + Error( SbERR_BAD_DECLARATION, pDef->GetName() ); + delete pDef; + } + else + pDef->Match( p ); + } + else + aPublics.Add( pDef ); + } + } +} + +// Aufruf einer SUB oder FUNCTION + +void SbiParser::Call() +{ + String aName( aSym ); + SbiExpression aVar( this, SbSYMBOL ); + aVar.Gen(); + aGen.Gen( _GET ); +} + +// SUB/FUNCTION + +void SbiParser::SubFunc() +{ + DefProc( FALSE ); +} + +// Einlesen einer Prozedur + +void SbiParser::DefProc( BOOL bStatic ) +{ + USHORT l1 = nLine, l2 = nLine; + BOOL bSub = BOOL( eCurTok == SUB ); + SbiToken eExit = eCurTok; + SbiProcDef* pDef = ProcDecl( FALSE ); + if( !pDef ) + return; + + // Ist die Proc bereits deklariert? + SbiSymDef* pOld = aPublics.Find( pDef->GetName() ); + if( pOld ) + { + pProc = pOld->GetProcDef(); + if( !pProc ) + { + // Als Variable deklariert + Error( SbERR_BAD_DECLARATION, pDef->GetName() ); + delete pDef; + pProc = NULL; + } + else + { + pDef->Match( pProc ); + pProc = pDef; + } + } + else + aPublics.Add( pDef ), pProc = pDef; + + if( !pProc ) + return; + + // Nun setzen wir die Suchhierarchie fuer Symbole sowie die aktuelle + // Prozedur. + aPublics.SetProcId( pProc->GetId() ); + pProc->GetParams().SetParent( &aPublics ); + if( !bStatic ) + { + // Normalfall: Lokale Variable->Parameter->Globale Variable + pProc->GetLocals().SetParent( &pProc->GetParams() ); + pPool = &pProc->GetLocals(); + } + else + { + Error( SbERR_NOT_IMPLEMENTED ); // STATIC SUB ... + } + + pProc->Define(); + OpenBlock( eExit ); + StmntBlock( bSub ? ENDSUB : ENDFUNC ); + l2 = nLine; + pProc->SetLine1( l1 ); + pProc->SetLine2( l2 ); + pPool = &aPublics; + aPublics.SetProcId( 0 ); + // Offene Labels? + pProc->GetLabels().CheckRefs(); + CloseBlock(); + aGen.Gen( _LEAVE ); + pProc = NULL; +} + +// STATIC variable|procedure + +void SbiParser::Static() +{ + switch( Peek() ) + { + case SUB: + case FUNCTION: + Next(); + DefProc( TRUE ); + break; + default: { + if( !pProc ) + Error( SbERR_NOT_IN_SUBR ); + // Pool umsetzen, damit STATIC-Deklarationen im globalen + // Pool landen + SbiSymPool* p = pPool; pPool = &aPublics; + DefVar( _STATIC, TRUE ); + pPool = p; + } break; + } +} + diff --git a/basic/source/comp/exprgen.cxx b/basic/source/comp/exprgen.cxx new file mode 100644 index 000000000000..0d1783a1c155 --- /dev/null +++ b/basic/source/comp/exprgen.cxx @@ -0,0 +1,273 @@ +/************************************************************************* + * + * $RCSfile: exprgen.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include "sbcomp.hxx" +#pragma hdrstop +#include "expr.hxx" + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBCEXPR, SBCOMP_CODE ) + +// Umsetztabelle fuer Token-Operatoren und Opcodes + +typedef struct { + SbiToken eTok; // Token + SbiOpcode eOp; // Opcode +} OpTable; + +static OpTable aOpTable [] = { + { EXPON,_EXP }, + { MUL, _MUL }, + { DIV, _DIV }, + { IDIV, _IDIV }, + { MOD, _MOD }, + { PLUS, _PLUS }, + { MINUS,_MINUS }, + { EQ, _EQ }, + { NE, _NE }, + { LE, _LE }, + { GE, _GE }, + { LT, _LT }, + { GT, _GT }, + { AND, _AND }, + { OR, _OR }, + { XOR, _XOR }, + { EQV, _EQV }, + { IMP, _IMP }, + { NOT, _NOT }, + { NEG, _NEG }, + { CAT, _CAT }, + { LIKE, _LIKE }, + { IS, _IS }, + { NIL, _NOP }}; + +// Ausgabe eines Elements + +void SbiExprNode::Gen() +{ + if( IsConstant() ) + { + switch( GetType() ) + { + case SbxEMPTY: pGen->Gen( _EMPTY ); break; + case SbxINTEGER: pGen->Gen( _CONST, (short) nVal ); break; + case SbxSTRING: pGen->Gen( _SCONST, nStringId ); break; + default: + nStringId = pGen->GetParser()->aGblStrings.Add( nVal, eType ); + pGen->Gen( _NUMBER, nStringId ); + } + } + else if( IsOperand() ) + { + SbiOpcode eOp; + if( aVar.pDef->GetScope() == SbPARAM ) + eOp = _PARAM; + // AB: 17.12.1995, Spezialbehandlung fuer WITH + else if( IsPartOfWith() ) + { + eOp = _ELEM; // .-Ausdruck in WITH + } + else + { + SbiProcDef* pProc = aVar.pDef->GetProcDef(); + // per DECLARE definiert? + if( pProc && pProc->GetLib().Len() ) + eOp = pProc->IsCdecl() ? _CALLC : _CALL; + else + eOp = ( aVar.pDef->GetScope() == SbRTL ) ? _RTL : _FIND; + } + + for( SbiExprNode* p = this; p; p = p->aVar.pNext ) + { + if( p->IsPartOfWith() ) + pGen->GetParser()->GetWithVar()->Gen(); + p->GenElement( eOp ); + eOp = _ELEM; + } + } + else + { + pLeft->Gen(); + if( pRight ) + pRight->Gen(); + for( OpTable* p = aOpTable; p->eTok != NIL; p++ ) + { + if( p->eTok == eTok ) + { + pGen->Gen( p->eOp ); break; + } + } + } +} + +// Ausgabe eines Operanden-Elements + +void SbiExprNode::GenElement( SbiOpcode eOp ) +{ +#ifndef PRODUCT + if( eOp < _RTL || eOp > _CALLC ) + pGen->GetParser()->Error( SbERR_INTERNAL_ERROR, "Opcode" ); +#endif + SbiSymDef* pDef = aVar.pDef; + // Das ID ist entweder die Position oder das String-ID + // Falls das Bit 0x8000 gesetzt ist, hat die Variable + // eine Parameterliste. + USHORT nId = ( eOp == _PARAM ) ? pDef->GetPos() : pDef->GetId(); + // Parameterliste aufbauen + if( aVar.pPar && aVar.pPar->GetSize() ) + { + nId |= 0x8000; + aVar.pPar->Gen(); + } + SbiProcDef* pProc = aVar.pDef->GetProcDef(); + // per DECLARE definiert? + if( pProc ) + { + // Dann evtl. einen LIB-Befehl erzeugen + if( pProc->GetLib().Len() ) + pGen->Gen( _LIB, pGen->GetParser()->aGblStrings.Add( pProc->GetLib() ) ); + // und den Aliasnamen nehmen + if( pProc->GetAlias().Len() ) + nId = ( nId & 0x8000 ) | pGen->GetParser()->aGblStrings.Add( pProc->GetAlias() ); + } + pGen->Gen( eOp, nId, GetType() ); +} + +// Erzeugen einer Argv-Tabelle +// Das erste Element bleibt immer frei fuer Returnwerte etc. +// Siehe auch SbiProcDef::SbiProcDef() in symtbl.cxx + +void SbiExprList::Gen() +{ + if( pFirst ) + { + pParser->aGen.Gen( _ARGC ); + // AB 10.1.96: Typ-Anpassung bei DECLARE + USHORT nCount = 1, nParAnz = 0; + SbiSymPool* pPool; + if( pProc ) + { + pPool = &pProc->GetParams(); + nParAnz = pPool->GetSize(); + } + for( SbiExpression* pExpr = pFirst; pExpr; pExpr = pExpr->pNext,nCount++ ) + { + pExpr->Gen(); + if( pExpr->GetName().Len() ) + { + // named arg + USHORT nSid = pParser->aGblStrings.Add( pExpr->GetName() ); + pParser->aGen.Gen( _ARGN, nSid ); + + // AB 10.1.96: Typanpassung bei named -> passenden Parameter suchen + if( pProc ) + { + // Vorerst: Error ausloesen + pParser->Error( SbERR_NO_NAMED_ARGS ); + + // Spaeter, wenn Named Args bei DECLARE moeglich + /* + for( USHORT i = 1 ; i < nParAnz ; i++ ) + { + SbiSymDef* pDef = pPool->Get( i ); + const String& rName = pDef->GetName(); + if( rName.Len() ) + { + if( pExpr->GetName().ICompare( rName ) + == COMPARE_EQUAL ) + { + pParser->aGen.Gen( _ARGTYP, pDef->GetType() ); + break; + } + } + } + */ + } + } + else + { + pParser->aGen.Gen( _ARGV ); + + // Funktion mit DECLARE -> Typ-Anpassung + if( pProc && nCount < nParAnz ) + { + SbiSymDef* pDef = pPool->Get( nCount ); + USHORT nTyp = pDef->GetType(); + // Zusätzliches Flag für BYVAL einbauen + if( pDef->IsByVal() ) + nTyp |= 0x8000; + pParser->aGen.Gen( _ARGTYP, nTyp ); + } + } + } + } +} + +void SbiExpression::Gen() +{ + // AB: 17.12.1995, Spezialbehandlung fuer WITH + // Wenn pExpr == .-Ausdruck in With, zunaechst Gen fuer Basis-Objekt + pExpr->Gen(); + if( bBased ) + pParser->aGen.Gen( _BASED, pParser->nBase ), + pParser->aGen.Gen( _ARGV ); +} + diff --git a/basic/source/comp/exprnode.cxx b/basic/source/comp/exprnode.cxx new file mode 100644 index 000000000000..818bfb5aa10b --- /dev/null +++ b/basic/source/comp/exprnode.cxx @@ -0,0 +1,497 @@ +/************************************************************************* + * + * $RCSfile: exprnode.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#define _NTSDK // wg. HUGE_VAL MH +#define HUGE_VAL HUGE +#include <math.h> + +#include "sbcomp.hxx" +#pragma hdrstop +#include "expr.hxx" + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBCEXPR, SBCOMP_CODE ) + +////////////////////////////////////////////////////////////////////////// + +SbiExprNode::SbiExprNode( SbiParser* p, SbiExprNode* l, SbiToken t, SbiExprNode* r ) +{ + BaseInit( p ); + + pLeft = l; + pRight = r; + eTok = t; + nVal = 0; + eType = SbxVARIANT; // Nodes sind immer Variant + eNodeType = SbxNODE; + bComposite= TRUE; +} + +SbiExprNode::SbiExprNode( SbiParser* p, double n, SbxDataType t ) +{ + BaseInit( p ); + + eType = t; + eNodeType = SbxNUMVAL; + nVal = n; +} + +SbiExprNode::SbiExprNode( SbiParser* p, const String& rVal ) +{ + BaseInit( p ); + + eType = SbxSTRING; + eNodeType = SbxSTRVAL; + nStringId = p->aGblStrings.Add( rVal, TRUE ); +} + +SbiExprNode::SbiExprNode( SbiParser* p, const SbiSymDef& r, SbxDataType t, SbiExprList* l ) +{ + BaseInit( p ); + + eType = ( t == SbxVARIANT ) ? r.GetType() : t; + eNodeType = SbxVARVAL; + aVar.pDef = (SbiSymDef*) &r; + aVar.pPar = l; + aVar.pNext= NULL; + + // Funktionsergebnisse sind nie starr + bComposite= BOOL( aVar.pDef->GetProcDef() != NULL ); +} + +// AB: 17.12.95, Hilfsfunktion fuer Ctor fuer einheitliche Initialisierung +void SbiExprNode::BaseInit( SbiParser* p ) +{ + pGen = &p->aGen; + eTok = NIL; + pLeft = NULL; + pRight = NULL; + bComposite = FALSE; + bPartOfWith = FALSE; + bError = FALSE; +} + +SbiExprNode::~SbiExprNode() +{ + delete pLeft; + delete pRight; + if( IsVariable() ) + { + delete aVar.pPar; + delete aVar.pNext; + } +} + +SbiSymDef* SbiExprNode::GetVar() +{ + if( eNodeType == SbxVARVAL ) + return aVar.pDef; + else + return NULL; +} + +SbiSymDef* SbiExprNode::GetRealVar() +{ + SbiExprNode* p = GetRealNode(); + if( p ) + return p->GetVar(); + else + return NULL; +} + +// AB: 18.12.95 +SbiExprNode* SbiExprNode::GetRealNode() +{ + if( eNodeType == SbxVARVAL ) + { + SbiExprNode* p = this; + while( p->aVar.pNext ) + p = p->aVar.pNext; + return p; + } + else + return NULL; +} + +BOOL SbiExprNode::IsOperand() +{ + return BOOL( eNodeType != SbxNODE ); +} + +BOOL SbiExprNode::IsConstant() +{ + return BOOL( eNodeType == SbxSTRVAL || eNodeType == SbxNUMVAL ); +} + +// Diese Methode setzt den Typ um, falls er in den Integer-Bereich hineinpasst + +BOOL SbiExprNode::IsIntConst() +{ + if( eNodeType == SbxNUMVAL ) + { + if( eType >= SbxINTEGER && eType <= SbxDOUBLE ) + { +#if defined(MAC) && !defined(__powerc) + long double n; +#else + double n; +#endif + if( nVal >= SbxMININT && nVal <= SbxMAXINT && modf( nVal, &n ) == 0 ) + { + nVal = (double) (short) nVal; + eType = SbxINTEGER; + return TRUE; + } + } + } + return FALSE; +} + +BOOL SbiExprNode::IsNumber() +{ + return BOOL( eNodeType == SbxNUMVAL ); +} + +BOOL SbiExprNode::IsString() +{ + return BOOL( eNodeType == SbxSTRVAL ); +} + +BOOL SbiExprNode::IsVariable() +{ + return BOOL( eNodeType == SbxVARVAL ); +} + +BOOL SbiExprNode::IsLvalue() +{ + return IsVariable(); +} + +// Ermitteln der Tiefe eines Baumes + +short SbiExprNode::GetDepth() +{ + if( IsOperand() ) return 0; + else + { + SbiExprNode* p = (SbiExprNode*) this; + short d1 = pLeft->GetDepth(); + short d2 = pRight->GetDepth(); + return( (d1 < d2 ) ? d2 : d1 ) + 1; + } +} + +const String& SbiExprNode::GetString() +{ + USHORT n = ( eType == SbxSTRING ) ? nStringId : 0; + return pGen->GetParser()->aGblStrings.Find( n ); +} + +// Abgleich eines Baumes: +// 1. Constant Folding +// 2. Typabgleich +// 3. Umwandlung der Operanden in Strings +// 4. Hochziehen der Composite- und Error-Bits + +void SbiExprNode::Optimize() +{ + FoldConstants(); + CollectBits(); +} + +// Hochziehen der Composite- und Fehlerbits + +void SbiExprNode::CollectBits() +{ + if( pLeft ) + { + pLeft->CollectBits(); + bError |= pLeft->bError; + bComposite |= pLeft->bComposite; + } + if( pRight ) + { + pRight->CollectBits(); + bError |= pRight->bError; + bComposite |= pRight->bComposite; + } +} + +// Kann ein Zweig umgeformt werden, wird TRUE zurueckgeliefert. In diesem +// Fall ist das Ergebnis im linken Zweig. + +void SbiExprNode::FoldConstants() +{ + if( IsOperand() ) return; + pLeft->FoldConstants(); + if( pRight ) + { + pRight->FoldConstants(); + if( pLeft->IsConstant() && pRight->IsConstant() + && pLeft->eNodeType == pRight->eNodeType ) + { + CollectBits(); + if( eTok == CAT ) + // CAT verbindet auch zwei Zahlen miteinander! + eType = SbxSTRING; + if( pLeft->eType == SbxSTRING ) + // Kein Type Mismatch! + eType = SbxSTRING; + if( eType == SbxSTRING ) + { + String rl( pLeft->GetString() ); + String rr( pRight->GetString() ); + delete pLeft; pLeft = NULL; + delete pRight; pRight = NULL; + eType = SbxDOUBLE; + eNodeType = SbxNUMVAL; + bComposite = FALSE; + StringCompare eRes = rr.CompareTo( rl ); + //StringCompare eRes = rl.Compare( rr ); + String s; + switch( eTok ) + { + case PLUS: + case CAT: + eTok = CAT; + // Verkettung: + s = rl; + s += rr; + nStringId = pGen->GetParser()->aGblStrings.Add( s, TRUE ); + eType = SbxSTRING; + eNodeType = SbxSTRVAL; + break; + case EQ: + nVal = ( eRes == COMPARE_EQUAL ) ? SbxTRUE : SbxFALSE; + break; + case NE: + nVal = ( eRes != COMPARE_EQUAL ) ? SbxTRUE : SbxFALSE; + break; + case LT: + nVal = ( eRes == COMPARE_LESS ) ? SbxTRUE : SbxFALSE; + break; + case GT: + nVal = ( eRes == COMPARE_GREATER ) ? SbxTRUE : SbxFALSE; + break; + case LE: + nVal = ( eRes != COMPARE_GREATER ) ? SbxTRUE : SbxFALSE; + break; + case GE: + nVal = ( eRes != COMPARE_LESS ) ? SbxTRUE : SbxFALSE; + break; + default: + pGen->GetParser()->Error( SbERR_CONVERSION ); + bError = TRUE; + } + } + else + { + double nl = pLeft->nVal; + double nr = pRight->nVal; + long ll, lr; + if( ( eTok >= AND && eTok <= EQV ) + || eTok == IDIV || eTok == MOD ) + { + // Integer-Operationen + BOOL err = FALSE; + if( nl > SbxMAXLNG ) err = TRUE, nl = SbxMAXLNG; + else + if( nl < SbxMINLNG ) err = TRUE, nl = SbxMINLNG; + if( nr > SbxMAXLNG ) err = TRUE, nr = SbxMAXLNG; + else + if( nr < SbxMINLNG ) err = TRUE, nr = SbxMINLNG; + ll = (long) nl; lr = (long) nr; + if( err ) + { + pGen->GetParser()->Error( SbERR_MATH_OVERFLOW ); + bError = TRUE; + } + } + BOOL bBothInt = BOOL( pLeft->eType < SbxSINGLE + && pRight->eType < SbxSINGLE ); + delete pLeft; pLeft = NULL; + delete pRight; pRight = NULL; + nVal = 0; + eType = SbxDOUBLE; + eNodeType = SbxNUMVAL; + bComposite = FALSE; + BOOL bCheckType = FALSE; + switch( eTok ) + { + case EXPON: + nVal = pow( nl, nr ); break; + case MUL: + bCheckType = TRUE; + nVal = nl * nr; break; + case DIV: + if( !nr ) + { + pGen->GetParser()->Error( SbERR_ZERODIV ); nVal = HUGE_VAL; + bError = TRUE; + } else nVal = nl / nr; + break; + case PLUS: + bCheckType = TRUE; + nVal = nl + nr; break; + case MINUS: + bCheckType = TRUE; + nVal = nl - nr; break; + case EQ: + nVal = ( nl == nr ) ? SbxTRUE : SbxFALSE; + eType = SbxINTEGER; break; + case NE: + nVal = ( nl != nr ) ? SbxTRUE : SbxFALSE; + eType = SbxINTEGER; break; + case LT: + nVal = ( nl < nr ) ? SbxTRUE : SbxFALSE; + eType = SbxINTEGER; break; + case GT: + nVal = ( nl > nr ) ? SbxTRUE : SbxFALSE; + eType = SbxINTEGER; break; + case LE: + nVal = ( nl <= nr ) ? SbxTRUE : SbxFALSE; + eType = SbxINTEGER; break; + case GE: + nVal = ( nl >= nr ) ? SbxTRUE : SbxFALSE; + eType = SbxINTEGER; break; + case IDIV: + if( !lr ) + { + pGen->GetParser()->Error( SbERR_ZERODIV ); nVal = HUGE_VAL; + bError = TRUE; + } else nVal = ll / lr; + eType = SbxLONG; break; + case MOD: + if( !lr ) + { + pGen->GetParser()->Error( SbERR_ZERODIV ); nVal = HUGE_VAL; + bError = TRUE; + } else nVal = ll % lr; + eType = SbxLONG; break; + case AND: + nVal = (double) ( ll & lr ); eType = SbxLONG; break; + case OR: + nVal = (double) ( ll | lr ); eType = SbxLONG; break; + case XOR: + nVal = (double) ( ll ^ lr ); eType = SbxLONG; break; + case EQV: + nVal = (double) ( ~ll ^ lr ); eType = SbxLONG; break; + case IMP: + nVal = (double) ( ~ll | lr ); eType = SbxLONG; break; + } + // Den Datentyp wiederherstellen, um Rundungsfehler + // zu killen + if( bCheckType && bBothInt + && nVal >= SbxMINLNG && nVal <= SbxMAXLNG ) + { + // NK-Stellen weg + long n = (long) nVal; + nVal = n; + eType = ( n >= SbxMININT && n <= SbxMAXINT ) + ? SbxINTEGER : SbxLONG; + } + } + } + } + else if( pLeft->IsNumber() ) + { + nVal = pLeft->nVal; + delete pLeft; + pLeft = NULL; + eType = SbxDOUBLE; + eNodeType = SbxNUMVAL; + bComposite = FALSE; + switch( eTok ) + { + case NEG: + nVal = -nVal; break; + case NOT: { + // Integer-Operation! + BOOL err = FALSE; + if( nVal > SbxMAXLNG ) err = TRUE, nVal = SbxMAXLNG; + else + if( nVal < SbxMINLNG ) err = TRUE, nVal = SbxMINLNG; + if( err ) + { + pGen->GetParser()->Error( SbERR_MATH_OVERFLOW ); + bError = TRUE; + } + nVal = (double) ~((long) nVal); + eType = SbxLONG; + } break; + } + } + if( eNodeType == SbxNUMVAL ) + { + // Evtl auf INTEGER falten (wg. besserem Opcode)? + if( eType == SbxSINGLE || eType == SbxDOUBLE ) + { + double x; + if( nVal >= SbxMINLNG && nVal <= SbxMAXLNG + && !modf( nVal, &x ) ) + eType = SbxLONG; + } + if( eType == SbxLONG && nVal >= SbxMININT && nVal <= SbxMAXINT ) + eType = SbxINTEGER; + } +} + + diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx new file mode 100644 index 000000000000..1ed4e54a2db8 --- /dev/null +++ b/basic/source/comp/exprtree.cxx @@ -0,0 +1,971 @@ +/************************************************************************* + * + * $RCSfile: exprtree.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include "sbcomp.hxx" +#pragma hdrstop +#include <svtools/sbx.hxx> // w.g. ...IMPL_REF(...sbxvariable) +#include "expr.hxx" + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBCEXPR, SBCOMP_CODE ) + +/*************************************************************************** +|* +|* SbiExpression +|* +***************************************************************************/ + +SbiExpression::SbiExpression( SbiParser* p, SbiExprType t ) +{ + pParser = p; + bError = bByVal = bBased = FALSE; + eCurExpr = t; + pNext = NULL; + pExpr = (t != SbSTDEXPR ) ? Term() : Boolean(); + if( t != SbSYMBOL ) + pExpr->Optimize(); + if( t == SbLVALUE && !pExpr->IsLvalue() ) + p->Error( SbERR_LVALUE_EXPECTED ); + if( t == SbOPERAND && !IsVariable() ) + p->Error( SbERR_VAR_EXPECTED ); +} + +SbiExpression::SbiExpression( SbiParser* p, double n, SbxDataType t ) +{ + pParser = p; + eCurExpr = SbOPERAND; + pNext = NULL; + bError = bByVal = bBased = FALSE; + pExpr = new SbiExprNode( pParser, n, t ); + pExpr->Optimize(); +} + +SbiExpression::SbiExpression( SbiParser* p, const String& r ) +{ + pParser = p; + pNext = NULL; + bError = bByVal = bBased = FALSE; + eCurExpr = SbOPERAND; + pExpr = new SbiExprNode( pParser, r ); +} + +SbiExpression::SbiExpression( SbiParser* p, const SbiSymDef& r, SbiExprList* pPar ) +{ + pParser = p; + pNext = NULL; + bError = bByVal = bBased = FALSE; + eCurExpr = SbOPERAND; + pExpr = new SbiExprNode( pParser, r, SbxVARIANT, pPar ); +} + +SbiExpression::SbiExpression( SbiParser* p, SbiToken t ) +{ + pParser = p; + pNext = NULL; + bError = bByVal = bBased = FALSE; + eCurExpr = SbOPERAND; + pExpr = new SbiExprNode( pParser, NULL, t, NULL ); +} + +SbiExpression::~SbiExpression() +{ + delete pExpr; +} + +// Einlesen eines kompletten Bezeichners +// Ein Bezeichner hat folgende Form: +// name[(Parameter)][.Name[(parameter)]]... +// Strukturelemente werden ueber das Element pNext verkoppelt, +// damit sie nicht im Baum stehen. + +// Folgen Parameter ohne Klammer? Dies kann eine Zahl, ein String, +// ein Symbol oder auch ein Komma sein (wenn der 1. Parameter fehlt) + +static BOOL DoParametersFollow( SbiParser* p, SbiExprType eCurExpr, SbiToken eTok ) +{ + if( eTok == LPAREN ) + return TRUE; + // Aber nur, wenn CALL-aehnlich! + if( !p->WhiteSpace() || eCurExpr != SbSYMBOL ) + return FALSE; + return BOOL( + eTok == NUMBER || eTok == FIXSTRING + || eTok == SYMBOL || eTok == COMMA || eTok == DOT ); +} + +// Definition eines neuen Symbols + +static SbiSymDef* AddSym + ( SbiToken eTok, SbiSymPool& rPool, SbiExprType eCurExpr, + const String& rName, SbxDataType eType, SbiParameters* pPar ) +{ + SbiSymDef* pDef; + // A= ist keine Prozedur + BOOL bHasType = BOOL( eTok == EQ || eTok == DOT ); + if( ( !bHasType && eCurExpr == SbSYMBOL ) || pPar ) + { + // Dies ist also eine Prozedur + // da suche man doch den richtigen Pool raus, da Procs + // immer in einem Public-Pool landen muessen + SbiSymPool* pPool = &rPool; + if( pPool->GetScope() != SbPUBLIC ) + pPool = &rPool.GetParser()->aPublics; + SbiProcDef* pProc = pPool->AddProc( rName ); + + // Sonderbehandlung fuer Colls wie Documents(1) + if( eCurExpr == SbSTDEXPR ) + bHasType = TRUE; + + pDef = pProc; + pDef->SetType( bHasType ? eType : SbxEMPTY ); + if( pPar ) + { + // Dummy-Parameter generieren + USHORT n = 1; + for( short i = 0; i < pPar->GetSize(); i++ ) + { + String aPar = String::CreateFromAscii( "PAR" ); + aPar += ++n; + pProc->GetParams().AddSym( aPar ); + } + } + } + else + { + // oder ein normales Symbol + pDef = rPool.AddSym( rName ); + pDef->SetType( eType ); + } + return pDef; +} + +// Zur Zeit sind sogar Keywords zugelassen (wg. gleichnamiger Dflt-Properties) + +SbiExprNode* SbiExpression::Term() +{ + if( pParser->Peek() == DOT ) + { + // eine WITH-Variable + SbiExprNode* pWithVar = pParser->GetWithVar(); + // #26608: Ans Ende der Node-Kette gehen, um richtiges Objekt zu uebergeben + SbiSymDef* pDef = pWithVar ? pWithVar->GetRealVar() : NULL; + SbiExprNode* pNd = NULL; + if( !pDef ) + { + pParser->Next(); + } + else + { + pNd = ObjTerm( *pDef ); + if( pNd ) + pNd->SetPartOfWith( TRUE ); + } + if( !pNd ) + { + pParser->Error( SbERR_UNEXPECTED, DOT ); + pNd = new SbiExprNode( pParser, 1.0, SbxDOUBLE ); + } + return pNd; + } + + SbiToken eTok = pParser->Next(); + // Anfang des Parsings merken + pParser->LockColumn(); + String aSym( pParser->GetSym() ); + SbxDataType eType = pParser->GetType(); + SbiParameters* pPar = NULL; + // Folgen Parameter? + SbiToken eNextTok = pParser->Peek(); + // Ist es ein benannter Parameter? + // Dann einfach eine Stringkonstante erzeugen. Diese wird + // im SbiParameters-ctor erkannt und weiterverarbeitet + if( eNextTok == ASSIGN ) + { + pParser->UnlockColumn(); + return new SbiExprNode( pParser, aSym ); + } + // ab hier sind keine Keywords zugelassen! + if( pParser->IsKwd( eTok ) ) + { + pParser->Error( SbERR_SYNTAX ); + bError = TRUE; + } + + if( DoParametersFollow( pParser, eCurExpr, eTok = eNextTok ) ) + { + pPar = new SbiParameters( pParser ); + bError |= !pPar->IsValid(); + eTok = pParser->Peek(); + } + // Es koennte ein Objektteil sein, wenn . oder ! folgt + // Bei . muss aber die Variable bereits definiert sein; wenn pDef + // nach der Suche NULL ist, isses ein Objekt! + BOOL bObj = BOOL( ( eTok == DOT || eTok == EXCLAM ) + && !pParser->WhiteSpace() ); + if( bObj ) + { + if( eType == SbxVARIANT ) + eType = SbxOBJECT; + else + { + // Name%. geht wirklich nicht! + pParser->Error( SbERR_BAD_DECLARATION, aSym ); + bError = TRUE; + } + } + // Suche: + SbiSymDef* pDef = pParser->pPool->Find( aSym ); + if( !pDef ) + { + // Teil der Runtime-Library? + // AB 31.3.1996: In Parser-Methode ausgelagert + // (wird auch in SbiParser::DefVar() in DIM.CXX benoetigt) + pDef = pParser->CheckRTLForSym( aSym, eType ); + } + if( !pDef ) + { + // Falls ein Punkt angegeben war, isses Teil eines Objekts, + // also muss der Returnwert ein Objekt sein + if( bObj ) + eType = SbxOBJECT; + pDef = AddSym( eTok, *pParser->pPool, eCurExpr, aSym, eType, pPar ); + } + else + { + + // Symbol ist bereits definiert. + // Ist es eine Konstante? + SbiConstDef* pConst = pDef->GetConstDef(); + if( pConst ) + { + if( pConst->GetType() == SbxSTRING ) + return new SbiExprNode( pParser, pConst->GetString() ); + else + return new SbiExprNode( pParser, pConst->GetValue(), pConst->GetType() ); + } + // Hat es Dimensionen, + // und sind auch Parameter angegeben? + // (Wobei 0 Parameter () entsprechen) + if( pDef->GetDims() ) + { + if( !pPar + || ( pPar->GetSize() && pPar->GetSize() != pDef->GetDims() ) ) + pParser->Error( SbERR_WRONG_DIMS ); + } + if( pDef->IsDefinedAs() ) + { + if( eType >= SbxINTEGER && eType <= SbxSTRING ) + { + // Wie? Erst mit AS definieren und dann einen Suffix nehmen? + pParser->Error( SbERR_BAD_DECLARATION, aSym ); + bError = TRUE; + } + else if ( eType == SbxVARIANT ) + // Falls nix angegeben, den Typ des Eintrags nehmen + // aber nur, wenn die Var nicht mit AS XXX definiert ist + // damit erwischen wir n% = 5 : print n + eType = pDef->GetType(); + } + // Funktion? + if( pDef->GetProcDef() ) + { + SbiProcDef* pProc = pDef->GetProcDef(); + if( pPar && pProc->GetLib().Len() ) // DECLARE benutzt? + pPar->SetProc( pProc ); + // Wenn keine Pars, vorerst nichts machen + // Pruefung auf Typ-Anzahl waere denkbar + } + // Typcheck bei Variablen: + // ist explizit im Scanner etwas anderes angegeben? + // Bei Methoden ist dies OK! + if( eType != SbxVARIANT && // Variant nimmt alles + eType != pDef->GetType() && + !pDef->GetProcDef() ) + { + // Es kann sein, dass pDef ein Objekt beschreibt, das bisher + // nur als SbxVARIANT erkannt wurde, dann Typ von pDef aendern + // AB, 16.12.95 (Vielleicht noch aehnliche Faelle moeglich ?!?) + if( eType == SbxOBJECT && pDef->GetType() == SbxVARIANT ) + { + pDef->SetType( SbxOBJECT ); + } + else + { + pParser->Error( SbERR_BAD_DECLARATION, aSym ); + bError = TRUE; + } + } + } + SbiExprNode* pNd = new SbiExprNode( pParser, *pDef, eType ); + if( !pPar ) + pPar = new SbiParameters( pParser,FALSE,FALSE ); + pNd->aVar.pPar = pPar; + if( bObj ) + { + // AB, 8.1.95: Objekt kann auch vom Typ SbxVARIANT sein + if( pDef->GetType() == SbxVARIANT ) + pDef->SetType( SbxOBJECT ); + // Falls wir etwas mit Punkt einscannen, muss der + // Typ SbxOBJECT sein + if( pDef->GetType() != SbxOBJECT && pDef->GetType() != SbxVARIANT ) + { + pParser->Error( SbERR_BAD_DECLARATION, aSym ); + bError = TRUE; + } + if( !bError ) + pNd->aVar.pNext = ObjTerm( *pDef ); + } + // Merken der Spalte 1 wieder freigeben + pParser->UnlockColumn(); + return pNd; +} + +// Aufbau eines Objekt-Terms. Ein derartiger Term ist Teil +// eines Ausdrucks, der mit einer Objektvariablen beginnt. + +SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj ) +{ + pParser->Next(); + SbiToken eTok = pParser->Next(); + if( eTok != SYMBOL && !pParser->IsKwd( eTok ) && !pParser->IsExtra( eTok ) ) + { + // #66745 Einige Operatoren koennen in diesem Kontext auch + // als Identifier zugelassen werden, wichtig fuer StarOne + if( eTok != MOD && eTok != NOT && eTok != AND && eTok != OR && + eTok != XOR && eTok != EQV && eTok != IMP && eTok != IS ) + { + pParser->Error( SbERR_VAR_EXPECTED ); + bError = TRUE; + } + } + else + { + if( pParser->GetType() != SbxVARIANT ) + pParser->Error( SbERR_SYNTAX ), bError = TRUE; + } + if( bError ) + return NULL; + + String aSym( pParser->GetSym() ); + SbxDataType eType = pParser->GetType(); + SbiParameters* pPar = NULL; + eTok = pParser->Peek(); + // Parameter? + if( DoParametersFollow( pParser, eCurExpr, eTok ) ) + { + pPar = new SbiParameters( pParser ); + bError |= !pPar->IsValid(); + eTok = pParser->Peek(); + } + BOOL bObj = BOOL( ( eTok == DOT || eTok == EXCLAM ) && !pParser->WhiteSpace() ); + if( bObj ) + { + if( eType == SbxVARIANT ) + eType = SbxOBJECT; + else + { + // Name%. geht wirklich nicht! + pParser->Error( SbERR_BAD_DECLARATION, aSym ); + bError = TRUE; + } + } + + // Der Symbol-Pool eines Objekts ist immer PUBLIC + SbiSymPool& rPool = rObj.GetPool(); + rPool.SetScope( SbPUBLIC ); + SbiSymDef* pDef = rPool.Find( aSym ); + if( !pDef ) + { + pDef = AddSym( eTok, rPool, eCurExpr, aSym, eType, pPar ); + pDef->SetType( eType ); + } + + SbiExprNode* pNd = new SbiExprNode( pParser, *pDef, eType ); + pNd->aVar.pPar = pPar; + if( bObj ) + { + // Falls wir etwas mit Punkt einscannen, muss der + // Typ SbxOBJECT sein + + // AB, 3.1.96 + // Es kann sein, dass pDef ein Objekt beschreibt, das bisher + // nur als SbxVARIANT erkannt wurde, dann Typ von pDef aendern + if( pDef->GetType() == SbxVARIANT ) + pDef->SetType( SbxOBJECT ); + + if( pDef->GetType() != SbxOBJECT ) + { + pParser->Error( SbERR_BAD_DECLARATION, aSym ); + bError = TRUE; + } + if( !bError ) + { + pNd->aVar.pNext = ObjTerm( *pDef ); + pNd->eType = eType; + } + } + return pNd; +} + +// Als Operanden kommen in Betracht: +// Konstante +// skalare Variable +// Strukturelemente +// Array-Elemente +// Funktionen +// geklammerte Ausdruecke + +SbiExprNode* SbiExpression::Operand() +{ + SbiExprNode *pRes; + SbiToken eTok; + + // Operand testen: + switch( eTok = pParser->Peek() ) + { + case SYMBOL: + case DOT: // .with + pRes = Term(); break; + case NUMBER: + pParser->Next(); + pRes = new SbiExprNode( pParser, pParser->GetDbl(), pParser->GetType() ); + break; + case FIXSTRING: + pParser->Next(); + pRes = new SbiExprNode( pParser, pParser->GetSym() ); break; + case LPAREN: + pParser->Next(); + pRes = Boolean(); + if( pParser->Peek() != RPAREN ) + pParser->Error( SbERR_BAD_BRACKETS ); + else pParser->Next(); + pRes->bComposite = TRUE; + break; + default: + // Zur Zeit sind Keywords hier OK! + if( pParser->IsKwd( eTok ) ) + pRes = Term(); + else + { + pParser->Next(); + pRes = new SbiExprNode( pParser, 1.0, SbxDOUBLE ); // bei Fehlern + pParser->Error( SbERR_UNEXPECTED, eTok ); + } + } + return pRes; +} + +SbiExprNode* SbiExpression::Unary() +{ + SbiExprNode* pNd; + SbiToken eTok = pParser->Peek(); + switch( eTok ) + { + case MINUS: + eTok = NEG; + case NOT: + pParser->Next(); + pNd = new SbiExprNode( pParser, Unary(), eTok, NULL ); + break; + case PLUS: + pParser->Next(); + pNd = Unary(); + break; + default: + pNd = Operand(); + } + return pNd; +} + +SbiExprNode* SbiExpression::Exp() +{ + SbiExprNode* pNd = Unary(); + while( pParser->Peek() == EXPON ) { + SbiToken eTok = pParser->Next(); + pNd = new SbiExprNode( pParser, pNd, eTok, Unary() ); + } + return pNd; +} + +SbiExprNode* SbiExpression::MulDiv() +{ + SbiExprNode* pNd = Exp(); + for( ;; ) + { + SbiToken eTok = pParser->Peek(); + if( eTok != MUL && eTok != DIV ) + break; + eTok = pParser->Next(); + pNd = new SbiExprNode( pParser, pNd, eTok, Exp() ); + } + return pNd; +} + +SbiExprNode* SbiExpression::IntDiv() +{ + SbiExprNode* pNd = MulDiv(); + while( pParser->Peek() == IDIV ) { + SbiToken eTok = pParser->Next(); + pNd = new SbiExprNode( pParser, pNd, eTok, MulDiv() ); + } + return pNd; +} + +SbiExprNode* SbiExpression::Mod() +{ + SbiExprNode* pNd = IntDiv(); + while( pParser->Peek() == MOD ) { + SbiToken eTok = pParser->Next(); + pNd = new SbiExprNode( pParser, pNd, eTok, IntDiv() ); + } + return pNd; +} + +SbiExprNode* SbiExpression::AddSub() +{ + SbiExprNode* pNd = Mod(); + for( ;; ) + { + SbiToken eTok = pParser->Peek(); + if( eTok != PLUS && eTok != MINUS ) + break; + eTok = pParser->Next(); + pNd = new SbiExprNode( pParser, pNd, eTok, Mod() ); + } + return pNd; +} + +SbiExprNode* SbiExpression::Cat() +{ + SbiExprNode* pNd = AddSub(); + for( ;; ) + { + SbiToken eTok = pParser->Peek(); + if( eTok != CAT ) + break; + eTok = pParser->Next(); + pNd = new SbiExprNode( pParser, pNd, eTok, AddSub() ); + } + return pNd; +} + +SbiExprNode* SbiExpression::Comp() +{ + SbiExprNode* pNd = Cat(); + short nCount = 0; + for( ;; ) + { + SbiToken eTok = pParser->Peek(); + if( eTok != EQ && eTok != NE && eTok != LT + && eTok != GT && eTok != LE && eTok != GE ) + break; + eTok = pParser->Next(); + pNd = new SbiExprNode( pParser, pNd, eTok, Cat() ); + nCount++; + } + // Mehrere Operatoren hintereinander gehen nicht + if( nCount > 1 ) + { + pParser->Error( SbERR_SYNTAX ); + bError = TRUE; + } + return pNd; +} + +SbiExprNode* SbiExpression::Like() +{ + SbiExprNode* pNd = Comp(); + short nCount = 0; + while( pParser->Peek() == LIKE ) { + SbiToken eTok = pParser->Next(); + pNd = new SbiExprNode( pParser, pNd, eTok, Comp() ), nCount++; + } + // Mehrere Operatoren hintereinander gehen nicht + if( nCount > 1 ) + { + pParser->Error( SbERR_SYNTAX ); + bError = TRUE; + } + return pNd; +} + +SbiExprNode* SbiExpression::Boolean() +{ + SbiExprNode* pNd = Like(); + for( ;; ) + { + SbiToken eTok = pParser->Peek(); + if( eTok != AND && eTok != OR && eTok != XOR + && eTok != EQV && eTok != IMP && eTok != IS ) + break; + eTok = pParser->Next(); + pNd = new SbiExprNode( pParser, pNd, eTok, Like() ); + } + return pNd; +} + +/*************************************************************************** +|* +|* SbiConstExpression +|* +***************************************************************************/ + +// Parsing einer Expression, die sich zu einer numerischen +// Konstanten verarbeiten laesst. + +SbiConstExpression::SbiConstExpression( SbiParser* p ) : SbiExpression( p ) +{ + if( pExpr->IsConstant() ) + { + eType = pExpr->GetType(); + if( pExpr->IsNumber() ) + nVal = pExpr->nVal; + else + nVal = 0, aVal = pParser->aGblStrings.Find( pExpr->nStringId ); + } + else + { + // #40204 Spezialbehandlung fuer BOOL-Konstanten + BOOL bIsBool = FALSE; + if( pExpr->eNodeType == SbxVARVAL ) + { + SbiSymDef* pVarDef = pExpr->GetVar(); + + // Ist es eine BOOL-Konstante? + BOOL bBoolVal; + if( pVarDef->GetName().EqualsIgnoreCaseAscii( "true" ) ) + //if( pVarDef->GetName().ICompare( "true" ) == COMPARE_EQUAL ) + { + bIsBool = TRUE; + bBoolVal = TRUE; + } + else if( pVarDef->GetName().EqualsIgnoreCaseAscii( "false" ) ) + //else if( pVarDef->GetName().ICompare( "false" ) == COMPARE_EQUAL ) + { + bIsBool = TRUE; + bBoolVal = FALSE; + } + + // Wenn es ein BOOL ist, Node austauschen + if( bIsBool ) + { + delete pExpr; + pExpr = new SbiExprNode( pParser, (bBoolVal ? SbxTRUE : SbxFALSE), SbxINTEGER ); + eType = pExpr->GetType(); + nVal = pExpr->nVal; + } + } + + if( !bIsBool ) + { + pParser->Error( SbERR_SYNTAX ); + eType = SbxDOUBLE; + nVal = 0; + } + } +} + +short SbiConstExpression::GetShortValue() +{ + if( eType == SbxSTRING ) + { + SbxVariableRef refConv = new SbxVariable; + refConv->PutString( aVal ); + return refConv->GetInteger(); + } + else + { + double n = nVal; + if( n > 0 ) n += .5; else n -= .5; + if( n > SbxMAXINT ) n = SbxMAXINT, pParser->Error( SbERR_OUT_OF_RANGE ); + else + if( n < SbxMININT ) n = SbxMININT, pParser->Error( SbERR_OUT_OF_RANGE ); + return (short) n; + } +} + + +/*************************************************************************** +|* +|* SbiExprList +|* +***************************************************************************/ + +SbiExprList::SbiExprList( SbiParser* p ) +{ + pParser = p; + pFirst = NULL; + pProc = NULL; + nExpr = + nDim = 0; + bError = + bBracket = FALSE; +} + +SbiExprList::~SbiExprList() +{ + SbiExpression* p = pFirst; + while( p ) + { + SbiExpression* q = p->pNext; + delete p; + p = q; + } +} + +// Parameter anfordern (ab 0) + +SbiExpression* SbiExprList::Get( short n ) +{ + SbiExpression* p = pFirst; + while( n-- && p ) + p = p->pNext; + return p; +} + +/*************************************************************************** +|* +|* SbiParameters +|* +***************************************************************************/ + +// Parsender Konstruktor: +// Die Parameterliste wird komplett geparst. +// "Prozedurname()" ist OK. +// Dann handelt es sich um eine Funktion ohne Parameter +// respektive um die Angabe eines Arrays als Prozedurparameter. + +SbiParameters::SbiParameters( SbiParser* p, BOOL bConst, BOOL bPar) : + SbiExprList( p ) +{ + if (bPar) + { + SbiExpression *pExpr; + SbiToken eTok = pParser->Peek(); + + // evtl. Klammer auf weg: + if( eTok == LPAREN ) + { + bBracket = TRUE; pParser->Next(); eTok = pParser->Peek(); + } + + // Ende-Test + if( ( bBracket && eTok == RPAREN ) || pParser->IsEoln( eTok ) ) + { + if( eTok == RPAREN ) + pParser->Next(); + return; + } + // Parametertabelle einlesen und in richtiger Folge ablegen! + SbiExpression* pLast = NULL; + String aName; + while( !bError ) + { + aName.Erase(); + // Fehlendes Argument + if( eTok == COMMA ) + { + pExpr = new SbiExpression( pParser, 0, SbxEMPTY ); + if( bConst ) + pParser->Error( SbERR_SYNTAX ), bError = TRUE; + } + // Benannte Argumente: entweder .name= oder name:= + else + { + if( eTok == DOT ) + { + // VB mode: .name= + pParser->Next(); + pParser->TestSymbol( TRUE ); // Keywords sind OK + aName = pParser->GetSym(); + pParser->TestToken( EQ ); + pExpr = bConst ? new SbiConstExpression( pParser ) + : new SbiExpression( pParser ); + } + else + { + pExpr = bConst ? new SbiConstExpression( pParser ) + : new SbiExpression( pParser ); + if( pParser->Peek() == ASSIGN ) + { + // VBA mode: name:= + // SbiExpression::Term() hat einen String daraus gemacht + aName = pExpr->GetString(); + delete pExpr; + pParser->Next(); + pExpr = new SbiExpression( pParser ); + if( bConst ) + pParser->Error( SbERR_SYNTAX ), bError = TRUE; + } + } + pExpr->GetName() = aName; + } + pExpr->pNext = NULL; + if( !pLast ) + pFirst = pLast = pExpr; + else + pLast->pNext = pExpr, pLast = pExpr; + nExpr++; + bError |= !pExpr->IsValid(); + // Naechstes Element? + eTok = pParser->Peek(); + if( eTok != COMMA ) + { + if( ( bBracket && eTok == RPAREN ) || pParser->IsEoln( eTok ) ) + break; + pParser->Error( bBracket + ? SbERR_BAD_BRACKETS + : SbERR_EXPECTED, COMMA ); + bError = TRUE; + } + else + { + pParser->Next(); + eTok = pParser->Peek(); + if( ( bBracket && eTok == RPAREN ) || pParser->IsEoln( eTok ) ) + break; + } + } + // Schliessende Klammer + if( eTok == RPAREN ) + { + pParser->Next(); + pParser->Peek(); + if( !bBracket ) + { + pParser->Error( SbERR_BAD_BRACKETS ); + bError = TRUE; + } + } + nDim = nExpr; + } +} + +/*************************************************************************** +|* +|* SbiDimList +|* +***************************************************************************/ + +// Parsender Konstruktor: +// Eine Liste von Array-Dimensionen wird geparst. Die Ausdruecke werden +// auf numerisch getestet. Das bCONST-Bit wird gesetzt, wenn alle Ausdruecke +// Integer-Konstanten sind. + +SbiDimList::SbiDimList( SbiParser* p ) : SbiExprList( p ) +{ + bConst = TRUE; + + if( pParser->Next() != LPAREN ) + { + pParser->Error( SbERR_EXPECTED, LPAREN ); + bError = TRUE; return; + } + + if( pParser->Peek() != RPAREN ) + { + SbiExpression *pExpr1, *pExpr2, *pLast = NULL; + SbiToken eTok; + for( ;; ) + { + pExpr1 = new SbiExpression( pParser ); + eTok = pParser->Next(); + if( eTok == TO ) + { + pExpr2 = new SbiExpression( pParser ); + eTok = pParser->Next(); + bConst &= pExpr1->IsIntConstant() & pExpr2->IsIntConstant(); + bError |= !pExpr1->IsValid(); + bError |= !pExpr2->IsValid(); + pExpr1->pNext = pExpr2; + if( !pLast ) + pFirst = pExpr1; + else + pLast->pNext = pExpr1; + pLast = pExpr2; + nExpr += 2; + } + else + { + // Nur eine Dim-Angabe + pExpr1->SetBased(); + pExpr1->pNext = NULL; + bConst &= pExpr1->IsIntConstant(); + bError |= !pExpr1->IsValid(); + if( !pLast ) + pFirst = pLast = pExpr1; + else + pLast->pNext = pExpr1, pLast = pExpr1; + nExpr++; + } + nDim++; + if( eTok == RPAREN ) break; + if( eTok != COMMA ) + { + pParser->Error( SbERR_BAD_BRACKETS ); + pParser->Next(); + break; + } + } + } + else pParser->Next(); +} + diff --git a/basic/source/comp/io.cxx b/basic/source/comp/io.cxx new file mode 100644 index 000000000000..de71e2474463 --- /dev/null +++ b/basic/source/comp/io.cxx @@ -0,0 +1,353 @@ +/************************************************************************* + * + * $RCSfile: io.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef _STREAM_HXX //autogen +#include <tools/stream.hxx> +#endif +#include "sbcomp.hxx" +#pragma hdrstop +#include "iosys.hxx" + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBCOMP, SBCOMP_CODE ) + +// Test, ob ein I/O-Channel angegeben wurde + +BOOL SbiParser::Channel( BOOL bAlways ) +{ + BOOL bRes = FALSE; + Peek(); + if( IsHash() ) + { + SbiExpression aExpr( this ); + if( Peek() == COMMA ) Next(); + aExpr.Gen(); + aGen.Gen( _CHANNEL ); + bRes = TRUE; + } + else if( bAlways ) + Error( SbERR_EXPECTED, "#" ); + return bRes; +} + +// Fuer PRINT und WRITE wird bei Objektvariablen versucht, +// die Default-Property anzusprechen. + +// PRINT + +void SbiParser::Print() +{ + BOOL bChan = Channel(); + // Die Ausdruecke zum Drucken: + while( !bAbort ) + { + if( !IsEoln( Peek() ) ) + { + SbiExpression* pExpr = new SbiExpression( this ); + pExpr->Gen(); + delete pExpr; + Peek(); + aGen.Gen( eCurTok == COMMA ? _PRINTF : _BPRINT ); + } + if( eCurTok == COMMA || eCurTok == SEMICOLON ) + { + Next(); + if( IsEoln( Peek() ) ) break; + } + else + { + aGen.Gen( _PRCHAR, '\n' ); + break; + } + } + if( bChan ) + aGen.Gen( _CHAN0 ); +} + +// WRITE #chan, expr, ... + +void SbiParser::Write() +{ + BOOL bChan = Channel(); + // Die Ausdruecke zum Drucken: + while( !bAbort ) + { + SbiExpression* pExpr = new SbiExpression( this ); + pExpr->Gen(); + delete pExpr; + aGen.Gen( _BWRITE ); + if( Peek() == COMMA ) + { + aGen.Gen( _PRCHAR, ',' ); + Next(); + if( IsEoln( Peek() ) ) break; + } + else + { + aGen.Gen( _PRCHAR, '\n' ); + break; + } + } + if( bChan ) + aGen.Gen( _CHAN0 ); +} + +// LINE INPUT [prompt], var$ + +void SbiParser::LineInput() +{ + Channel( TRUE ); + // BOOL bChan = Channel( TRUE ); + SbiExpression* pExpr = new SbiExpression( this, SbOPERAND ); + /* AB 15.1.96: Keinen allgemeinen Ausdruck mehr zulassen + SbiExpression* pExpr = new SbiExpression( this ); + if( !pExpr->IsVariable() ) + { + SbiToken eTok = Peek(); + if( eTok == COMMA || eTok == SEMICOLON ) Next(); + else Error( SbERR_EXPECTED, COMMA ); + // mit Prompt + if( !bChan ) + { + pExpr->Gen(); + aGen.Gen( _PROMPT ); + } + else + Error( SbERR_VAR_EXPECTED ); + delete pExpr; + pExpr = new SbiExpression( this, SbOPERAND ); + } + */ + if( !pExpr->IsVariable() ) + Error( SbERR_VAR_EXPECTED ); + if( pExpr->GetType() != SbxVARIANT && pExpr->GetType() != SbxSTRING ) + Error( SbERR_CONVERSION ); + pExpr->Gen(); + aGen.Gen( _LINPUT ); + delete pExpr; + aGen.Gen( _CHAN0 ); // ResetChannel() nicht mehr in StepLINPUT() +} + +// INPUT + +void SbiParser::Input() +{ + aGen.Gen( _RESTART ); + Channel( TRUE ); + // BOOL bChan = Channel( TRUE ); + SbiExpression* pExpr = new SbiExpression( this, SbOPERAND ); + /* ALT: Jetzt keinen allgemeinen Ausdruck mehr zulassen + SbiExpression* pExpr = new SbiExpression( this ); + ... + siehe LineInput + */ + while( !bAbort ) + { + if( !pExpr->IsVariable() ) + Error( SbERR_VAR_EXPECTED ); + pExpr->Gen(); + aGen.Gen( _INPUT ); + if( Peek() == COMMA ) + { + Next(); + delete pExpr; + pExpr = new SbiExpression( this, SbOPERAND ); + } + else break; + } + delete pExpr; + aGen.Gen( _CHAN0 ); // ResetChannel() nicht mehr in StepINPUT() +} + +// OPEN stringexpr FOR mode ACCCESS access mode AS Channel [Len=n] + +void SbiParser::Open() +{ + SbiExpression aFileName( this ); + SbiToken eTok; + TestToken( FOR ); + short nMode = 0; + short nFlags = 0; + switch( Next() ) + { + case INPUT: + nMode = STREAM_READ; nFlags |= SBSTRM_INPUT; break; + case OUTPUT: + nMode = STREAM_WRITE | STREAM_TRUNC; nFlags |= SBSTRM_OUTPUT; break; + case APPEND: + nMode = STREAM_WRITE; nFlags |= SBSTRM_APPEND; break; + case RANDOM: + nMode = STREAM_READ | STREAM_WRITE; nFlags |= SBSTRM_RANDOM; break; + case BINARY: + nMode = STREAM_READ | STREAM_WRITE; nFlags |= SBSTRM_BINARY; break; + default: + Error( SbERR_SYNTAX ); + } + if( Peek() == ACCESS ) + { + Next(); + eTok = Next(); + // #27964# Nur STREAM_READ,STREAM_WRITE-Flags in nMode beeinflussen + nMode &= ~(STREAM_READ | STREAM_WRITE); // loeschen + if( eTok == READ ) + { + if( Peek() == WRITE ) + { + Next(); + nMode |= (STREAM_READ | STREAM_WRITE); + } + else + nMode |= STREAM_READ; + } + else if( eTok == WRITE ) + nMode |= STREAM_WRITE; + else + Error( SbERR_SYNTAX ); + } + switch( Peek() ) + { +#ifdef SHARED +#undef SHARED +#define tmpSHARED +#endif + case SHARED: + Next(); nMode |= STREAM_SHARE_DENYNONE; break; +#ifdef tmpSHARED +#define SHARED +#undef tmpSHARED +#endif + case LOCK: + Next(); + eTok = Next(); + if( eTok == READ ) + { + if( Peek() == WRITE ) Next(), nMode |= STREAM_SHARE_DENYALL; + else nMode |= STREAM_SHARE_DENYREAD; + } + else if( eTok == WRITE ) + nMode |= STREAM_SHARE_DENYWRITE; + else + Error( SbERR_SYNTAX ); + break; + } + TestToken( AS ); + // Die Kanalnummer + SbiExpression* pChan = new SbiExpression( this ); + if( !pChan ) + Error( SbERR_SYNTAX ); + SbiExpression* pLen = NULL; + if( Peek() == SYMBOL ) + { + Next(); + String aLen( aSym ); + if( aLen.EqualsIgnoreCaseAscii( "LEN" ) ) + { + TestToken( EQ ); + pLen = new SbiExpression( this ); + } + } + if( !pLen ) pLen = new SbiExpression( this, 128, SbxINTEGER ); + // Der Stack fuer den OPEN-Befehl sieht wie folgt aus: + // Blocklaenge + // Kanalnummer + // Dateiname + pLen->Gen(); + if( pChan ) + pChan->Gen(); + aFileName.Gen(); + aGen.Gen( _OPEN, nMode, nFlags ); + delete pLen; + delete pChan; +} + +// NAME file AS file + +void SbiParser::Name() +{ + SbiExpression aExpr1( this ); + TestToken( AS ); + SbiExpression aExpr2( this ); + aExpr1.Gen(); + aExpr2.Gen(); + aGen.Gen( _RENAME ); +} + +// CLOSE [n,...] + +void SbiParser::Close() +{ + Peek(); + if( IsEoln( eCurTok ) ) + aGen.Gen( _CLOSE, 0 ); + else + for( ;; ) + { + if( Channel( TRUE ) ) + aGen.Gen( _CLOSE, 1 ); + else + break; + if( IsEoln( Peek() ) ) + break; + } +} + + diff --git a/basic/source/comp/loops.cxx b/basic/source/comp/loops.cxx new file mode 100644 index 000000000000..64c4001ee14a --- /dev/null +++ b/basic/source/comp/loops.cxx @@ -0,0 +1,561 @@ +/************************************************************************* + * + * $RCSfile: loops.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include "sbcomp.hxx" +#pragma hdrstop + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBCOMP, SBCOMP_CODE ) + +// Single-line IF und Multiline IF + +void SbiParser::If() +{ + USHORT nEndLbl; + SbiToken eTok; + // Ende-Tokens ignorieren: + SbiExpression aCond( this ); + aCond.Gen(); + TestToken( THEN ); + if( IsEoln( Next() ) ) + { + // AB 13.5.1996: #27720# Am Ende jeden Blocks muss ein Jump zu ENDIF + // eingefuegt werden, damit bei ELSEIF nicht erneut die Bedingung + // ausgewertet wird. Die Tabelle nimmt alle Absprungstellen auf. +#define JMP_TABLE_SIZE 100 + USHORT pnJmpToEndLbl[JMP_TABLE_SIZE]; // 100 ELSEIFs zulaessig + USHORT iJmp = 0; // aktueller Tabellen-Index + + // multiline IF + nEndLbl = aGen.Gen( _JUMPF, 0 ); + while( !bAbort && Parse() ) + { + eTok = Peek(); + if( eTok == ELSEIF || eTok == ELSE || eTok == ENDIF ) + break; + if( IsEof() ) + { + Error( SbERR_BAD_BLOCK, IF ); bAbort = TRUE; return; + } + } + // ELSEIF? + while( eTok == ELSEIF ) + { + // #27720# Bei erfolgreichem IF/ELSEIF auf ENDIF springen + if( iJmp >= JMP_TABLE_SIZE ) + { + Error( SbERR_PROG_TOO_LARGE ); bAbort = TRUE; return; + } + pnJmpToEndLbl[iJmp++] = aGen.Gen( _JUMP, 0 ); + + Next(); + aGen.BackChain( nEndLbl ); + SbiExpression* pCond = new SbiExpression( this ); + pCond->Gen(); + nEndLbl = aGen.Gen( _JUMPF, 0 ); + delete pCond; + TestToken( THEN ); + while( !bAbort && Parse() ) + { + eTok = Peek(); + if( eTok == ELSEIF || eTok == ELSE || eTok == ENDIF ) + break; + if( IsEof() ) + { + Error( SbERR_BAD_BLOCK, ELSEIF ); bAbort = TRUE; return; + } + } + } + if( eTok == ELSE ) + { + Next(); + USHORT nElseLbl = nEndLbl; + nEndLbl = aGen.Gen( _JUMP, 0 ); + aGen.BackChain( nElseLbl ); + StmntBlock( ENDIF ); + } + else if( eTok == ENDIF ) + Next(); + + // #27720# Jmp-Tabelle abarbeiten + while( iJmp > 0 ) + { + iJmp--; + aGen.BackChain( pnJmpToEndLbl[iJmp] ); + } + } + else + { + // single line IF + bSingleLineIf = TRUE; + nEndLbl = aGen.Gen( _JUMPF, 0 ); + Push( eCurTok ); + while( !bAbort ) + { + if( !Parse() ) break; + eTok = Peek(); + if( eTok == ELSE || eTok == EOLN || eTok == REM ) + break; + } + if( eTok == ELSE ) + { + Next(); + USHORT nElseLbl = nEndLbl; + nEndLbl = aGen.Gen( _JUMP, 0 ); + aGen.BackChain( nElseLbl ); + while( !bAbort ) + { + if( !Parse() ) break; + eTok = Peek(); + if( eTok == EOLN ) + break; + } + } + bSingleLineIf = FALSE; + } + aGen.BackChain( nEndLbl ); +} + +// ELSE/ELSEIF/ENDIF ohne IF + +void SbiParser::NoIf() +{ + Error( SbERR_NO_IF ); + StmntBlock( ENDIF ); +} + +// DO WHILE...LOOP +// DO ... LOOP WHILE + +void SbiParser::DoLoop() +{ + USHORT nStartLbl = aGen.GetPC(); + USHORT nEndChain = 0; + OpenBlock( DO ); + SbiToken eTok = Next(); + if( IsEoln( eTok ) ) + { + // DO ... LOOP [WHILE|UNTIL expr] + StmntBlock( LOOP ); + eTok = Next(); + if( eTok == UNTIL || eTok == WHILE ) + { + SbiExpression aExpr( this ); + aExpr.Gen(); + aGen.Gen( eTok == UNTIL ? _JUMPF : _JUMPT, nStartLbl ); + } else + if (eTok == EOLN || eTok == REM) + aGen.Gen (_JUMP, nStartLbl); + else + Error( SbERR_EXPECTED, WHILE ); + } + else + { + // DO [WHILE|UNTIL expr] ... LOOP + if( eTok == UNTIL || eTok == WHILE ) + { + SbiExpression aCond( this ); + aCond.Gen(); + } + USHORT nEndLbl = aGen.Gen( eTok == UNTIL ? _JUMPT : _JUMPF, 0 ); + StmntBlock( LOOP ); + TestEoln(); + aGen.Gen( _JUMP, nStartLbl ); + aGen.BackChain( nEndLbl ); + } + CloseBlock(); +} + +// WHILE ... WEND + +void SbiParser::While() +{ + SbiExpression aCond( this ); + USHORT nStartLbl = aGen.GetPC(); + aCond.Gen(); + USHORT nEndLbl = aGen.Gen( _JUMPF, 0 ); + StmntBlock( WEND ); + aGen.Gen( _JUMP, nStartLbl ); + aGen.BackChain( nEndLbl ); +} + +// FOR var = expr TO expr STEP + +void SbiParser::For() +{ + SbiExpression aLvalue( this, SbOPERAND ); + aLvalue.Gen(); // Variable auf dem Stack + TestToken( EQ ); + SbiExpression aStartExpr( this ); + aStartExpr.Gen(); // Startausdruck auf dem Stack + TestToken( TO ); + SbiExpression aStopExpr( this ); + aStopExpr.Gen(); // Endausdruck auf dem Stack + if( Peek() == STEP ) + { + Next(); + SbiExpression aStepExpr( this ); + aStepExpr.Gen(); + } + else + { + SbiExpression aOne( this, 1, SbxINTEGER ); + aOne.Gen(); + } + TestEoln(); + // Der Stack hat jetzt 4 Elemente: Variable, Start, Ende, Inkrement + // Startwert binden + aGen.Gen( _INITFOR ); + USHORT nLoop = aGen.GetPC(); + // Test durchfuehren, evtl. Stack freigeben + USHORT nEndTarget = aGen.Gen( _TESTFOR, 0 ); + OpenBlock( FOR ); + StmntBlock( NEXT ); + aGen.Gen( _NEXT ); + aGen.Gen( _JUMP, nLoop ); + // Kommen Variable nach NEXT? + if( Peek() == SYMBOL ) + { + SbiExpression aVar( this, SbOPERAND ); + if( aVar.GetRealVar() != aLvalue.GetRealVar() ) + Error( SbERR_EXPECTED, aVar.GetRealVar()->GetName() ); + } + aGen.BackChain( nEndTarget ); + CloseBlock(); +} + +// WITH .. END WITH + +void SbiParser::With() +{ + SbiExpression aVar( this, SbOPERAND ); + + // Letzten Knoten in der Objekt-Kette ueberpruefen + SbiExprNode *pNode = aVar.GetExprNode()->GetRealNode(); + SbiSymDef* pDef = pNode->GetVar(); + // Variant, AB 27.6.1997, #41090: bzw. empty -> muß Object sein + if( pDef->GetType() == SbxVARIANT || pDef->GetType() == SbxEMPTY ) + pDef->SetType( SbxOBJECT ); + else if( pDef->GetType() != SbxOBJECT ) + Error( SbERR_NEEDS_OBJECT ); + + // Knoten auch auf SbxOBJECT setzen, damit spaeter Gen() klappt + pNode->SetType( SbxOBJECT ); + + OpenBlock( NIL, aVar.GetExprNode() ); + StmntBlock( ENDWITH ); + CloseBlock(); +} + +// LOOP/NEXT/WEND ohne Konstrukt + +void SbiParser::BadBlock() +{ + if( eEndTok ) + Error( SbERR_BAD_BLOCK, eEndTok ); + else + Error( SbERR_BAD_BLOCK, "Loop/Next/Wend" ); +} + +// On expr Goto/Gosub n,n,n... + +void SbiParser::OnGoto() +{ + SbiExpression aCond( this ); + aCond.Gen(); + USHORT nLabelsTarget = aGen.Gen( _ONJUMP, 0 ); + SbiToken eTok = Next(); + if( eTok != GOTO && eTok != GOSUB ) + { + Error( SbERR_EXPECTED, "GoTo/GoSub" ); + eTok = GOTO; + } + // Label-Tabelle einlesen: + short nLbl = 0; + do + { + SbiToken eTok2 = Next(); // Label holen + if( MayBeLabel() ) + { + USHORT nOff = pProc->GetLabels().Reference( aSym ); + aGen.Gen( _JUMP, nOff ); + nLbl++; + } + else Error( SbERR_LABEL_EXPECTED ); + } + while( !bAbort && TestComma() ); + if( eTok == GOSUB ) + nLbl |= 0x8000; + aGen.Patch( nLabelsTarget, nLbl ); +} + +// GOTO/GOSUB + +void SbiParser::Goto() +{ + SbiOpcode eOp = eCurTok == GOTO ? _JUMP : _GOSUB; + Next(); + if( MayBeLabel() ) + { + USHORT nOff = pProc->GetLabels().Reference( aSym ); + aGen.Gen( eOp, nOff ); + } + else Error( SbERR_LABEL_EXPECTED ); +} + +// RETURN [label] + +void SbiParser::Return() +{ + Next(); + if( MayBeLabel() ) + { + USHORT nOff = pProc->GetLabels().Reference( aSym ); + aGen.Gen( _RETURN, nOff ); + } + else aGen.Gen( _RETURN, 0 ); +} + +// SELECT CASE + +void SbiParser::Select() +{ + TestToken( CASE ); + SbiExpression aCase( this ); + SbiToken eTok; + aCase.Gen(); + aGen.Gen( _CASE ); + TestEoln(); + USHORT nNextTarget = 0; + USHORT nDoneTarget = 0; + BOOL bElse = FALSE; + // Die Cases einlesen: + while( !bAbort ) + { + eTok = Next(); + if( eTok == CASE ) + { + if( nNextTarget ) + aGen.BackChain( nNextTarget ), nNextTarget = 0; + aGen.Statement(); + // Jeden Case einlesen + BOOL bDone = FALSE; + USHORT nTrueTarget = 0; + if( Peek() == ELSE ) + { + // CASE ELSE + Next(); + bElse = TRUE; + } + else while( !bDone ) + { + if( bElse ) + Error( SbERR_SYNTAX ); + SbiToken eTok = Peek(); + if( eTok == IS || ( eTok >= EQ && eTok <= GE ) ) + { // CASE [IS] operator expr + if( eTok == IS ) + Next(); + eTok = Peek(); + if( eTok < EQ || eTok > GE ) + Error( SbERR_SYNTAX ); + else Next(); + SbiExpression aCompare( this ); + aCompare.Gen(); + nTrueTarget = aGen.Gen( _CASEIS, nTrueTarget, + SbxEQ + ( eTok - EQ ) ); + } + else + { // CASE expr | expr TO expr + SbiExpression aCase1( this ); + aCase1.Gen(); + if( Peek() == TO ) + { + // CASE a TO b + Next(); + SbiExpression aCase2( this ); + aCase2.Gen(); + nTrueTarget = aGen.Gen( _CASETO, nTrueTarget ); + } + else + // CASE a + nTrueTarget = aGen.Gen( _CASEIS, nTrueTarget, SbxEQ ); + + } + if( Peek() == COMMA ) Next(); + else TestEoln(), bDone = TRUE; + } + // Alle Cases abgearbeitet + if( !bElse ) + { + nNextTarget = aGen.Gen( _JUMP, nNextTarget ); + aGen.BackChain( nTrueTarget ); + } + // den Statement-Rumpf bauen + while( !bAbort ) + { + eTok = Peek(); + if( eTok == CASE || eTok == ENDSELECT ) + break; + if( !Parse() ) goto done; + eTok = Peek(); + if( eTok == CASE || eTok == ENDSELECT ) + break; + } + if( !bElse ) + nDoneTarget = aGen.Gen( _JUMP, nDoneTarget ); + } + else if( !IsEoln( eTok ) ) + break; + } +done: + if( eTok != ENDSELECT ) + Error( SbERR_EXPECTED, ENDSELECT ); + if( nNextTarget ) + aGen.BackChain( nNextTarget ); + aGen.BackChain( nDoneTarget ); + aGen.Gen( _ENDCASE ); +} + +// ON Error/Variable + +#ifdef _MSC_VER +#pragma optimize("",off) +#endif + +void SbiParser::On() +{ + SbiToken eTok = Peek(); + String aString = SbiTokenizer::Symbol(eTok); + if (aString.EqualsIgnoreCaseAscii("ERROR")) + //if (!aString.ICompare("ERROR")) + eTok = _ERROR_; // Error kommt als SYMBOL + if( eTok != _ERROR_ && eTok != LOCAL ) OnGoto(); + else + { + if( eTok == LOCAL ) Next(); + Next (); // Kein TestToken mehr, da es sonst einen Fehler gibt + + Next(); // Token nach Error holen + if( eCurTok == GOTO ) + { + // ON ERROR GOTO label|0 + Next(); + if( MayBeLabel() ) + { + if( eCurTok == NUMBER && !nVal ) + aGen.Gen( _STDERROR ); + else + { + USHORT nOff = pProc->GetLabels().Reference( aSym ); + aGen.Gen( _ERRHDL, nOff ); + } + } + else Error( SbERR_LABEL_EXPECTED ); + } + else if( eCurTok == RESUME ) + { + TestToken( NEXT ); + aGen.Gen( _NOERROR ); + } + else Error( SbERR_EXPECTED, "GoTo/Resume" ); + } +} + +#ifdef _MSC_VER +#pragma optimize("",off) +#endif + +// RESUME [0]|NEXT|label + +void SbiParser::Resume() +{ + USHORT nLbl; + + switch( Next() ) + { + case EOS: + case EOLN: + aGen.Gen( _RESUME, 0 ); + break; + case NEXT: + aGen.Gen( _RESUME, 1 ); + Next(); + break; + case NUMBER: + if( !nVal ) + { + aGen.Gen( _RESUME, 0 ); + break; + } // fall thru + case SYMBOL: + if( MayBeLabel() ) + { + nLbl = pProc->GetLabels().Reference( aSym ); + aGen.Gen( _RESUME, nLbl ); + Next(); + break; + } // fall thru + default: + Error( SbERR_LABEL_EXPECTED ); + } +} + diff --git a/basic/source/comp/makefile.mk b/basic/source/comp/makefile.mk new file mode 100644 index 000000000000..c34e9b947d84 --- /dev/null +++ b/basic/source/comp/makefile.mk @@ -0,0 +1,106 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=BASIC +TARGET=comp + +# --- Settings ------------------------------------------------------------ + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +CXXFILES= \ + sbcomp.cxx \ + dim.cxx \ + exprtree.cxx \ + exprnode.cxx \ + exprgen.cxx \ + codegen.cxx \ + io.cxx \ + loops.cxx \ + parser.cxx \ + scanner.cxx \ + token.cxx \ + symtbl.cxx \ + buffer.cxx + +SLOFILES= \ + $(SLO)$/sbcomp.obj \ + $(SLO)$/dim.obj \ + $(SLO)$/exprtree.obj \ + $(SLO)$/exprnode.obj \ + $(SLO)$/exprgen.obj \ + $(SLO)$/codegen.obj \ + $(SLO)$/io.obj \ + $(SLO)$/loops.obj \ + $(SLO)$/parser.obj \ + $(SLO)$/scanner.obj \ + $(SLO)$/token.obj \ + $(SLO)$/symtbl.obj \ + $(SLO)$/buffer.obj + +# --- Targets -------------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx new file mode 100644 index 000000000000..0c3d82ce3f20 --- /dev/null +++ b/basic/source/comp/parser.cxx @@ -0,0 +1,774 @@ +/************************************************************************* + * + * $RCSfile: parser.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#if SUPD >= 375 +#ifndef _SBXCLASS_HXX //autogen +#include <svtools/sbx.hxx> +#endif +#else +#include <svmem.hxx> +#include <sbx.hxx> +#endif +#include "sbcomp.hxx" +#pragma hdrstop + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBCOMP, SBCOMP_CODE ) + +struct SbiParseStack { // "Stack" fuer Statement-Blocks + SbiParseStack* pNext; // Chain + SbiExprNode* pWithVar; // Variable fuer WITH + SbiToken eExitTok; // Exit-Token + USHORT nChain; // JUMP-Chain +}; + +struct SbiStatement { + SbiToken eTok; + void( SbiParser::*Func )(); // Verarbeitungsroutine + BOOL bMain; // TRUE: ausserhalb SUBs OK + BOOL bSubr; // TRUE: in SUBs OK + BOOL bVBScript; // TRUE: in OK +}; + +#define Y TRUE +#define N FALSE + +static SbiStatement StmntTable [] = { +{ CALL, &SbiParser::Call, N, Y, Y, }, // CALL +{ CLOSE, &SbiParser::Close, N, Y, Y, }, // CLOSE +{ _CONST_, &SbiParser::Dim, Y, Y, Y, }, // CONST +{ DECLARE, &SbiParser::Declare, Y, N, N, }, // DECLARE +{ DEFBOOL, &SbiParser::DefXXX, Y, N, N, }, // DEFBOOL +{ DEFCUR, &SbiParser::DefXXX, Y, N, N, }, // DEFCUR +{ DEFDATE, &SbiParser::DefXXX, Y, N, N, }, // DEFDATE +{ DEFDBL, &SbiParser::DefXXX, Y, N, N, }, // DEFDBL +{ DEFERR, &SbiParser::DefXXX, Y, N, N, }, // DEFERR +{ DEFINT, &SbiParser::DefXXX, Y, N, N, }, // DEFINT +{ DEFLNG, &SbiParser::DefXXX, Y, N, N, }, // DEFLNG +{ DEFOBJ, &SbiParser::DefXXX, Y, N, N, }, // DEFOBJ +{ DEFSNG, &SbiParser::DefXXX, Y, N, N, }, // DEFSNG +{ DEFSTR, &SbiParser::DefXXX, Y, N, N, }, // DEFSTR +{ DEFVAR, &SbiParser::DefXXX, Y, N, N, }, // DEFVAR +{ DIM, &SbiParser::Dim, Y, Y, Y, }, // DIM +{ DO, &SbiParser::DoLoop, N, Y, Y, }, // DO +{ ELSE, &SbiParser::NoIf, N, Y, Y, }, // ELSE +{ ELSEIF, &SbiParser::NoIf, N, Y, Y, }, // ELSEIF +{ ENDIF, &SbiParser::NoIf, N, Y, Y, }, // ENDIF +{ END, &SbiParser::Stop, N, Y, N, }, // END +{ ERASE, &SbiParser::Erase, N, Y, Y, }, // ERASE +{ _ERROR_, &SbiParser::ErrorStmnt, N, Y, Y, }, // ERROR +{ EXIT, &SbiParser::Exit, N, Y, N, }, // EXIT +{ FOR, &SbiParser::For, N, Y, Y, }, // FOR +{ FUNCTION, &SbiParser::SubFunc, Y, N, Y, }, // FUNCTION +{ GOSUB, &SbiParser::Goto, N, Y, N, }, // GOSUB +{ GLOBAL, &SbiParser::Dim, Y, N, Y, }, // GLOBAL +{ GOTO, &SbiParser::Goto, N, Y, N, }, // GOTO +{ IF, &SbiParser::If, N, Y, Y, }, // IF +{ INPUT, &SbiParser::Input, N, Y, Y, }, // INPUT +{ LET, &SbiParser::Assign, N, Y, Y, }, // LET +{ LINEINPUT,&SbiParser::LineInput, N, Y, Y, }, // LINE INPUT +{ LOOP, &SbiParser::BadBlock, N, Y, Y, }, // LOOP +{ LSET, &SbiParser::LSet, N, Y, N, }, // LSET +{ NAME, &SbiParser::Name, N, Y, Y, }, // NAME +{ NEXT, &SbiParser::BadBlock, N, Y, Y, }, // NEXT +{ ON, &SbiParser::On, N, Y, N, }, // ON +{ OPEN, &SbiParser::Open, N, Y, Y, }, // OPEN +{ OPTION, &SbiParser::Option, Y, N, N, }, // OPTION +{ PRINT, &SbiParser::Print, N, Y, Y, }, // PRINT +{ PRIVATE, &SbiParser::Dim, Y, N, Y, }, // PRIVATE +{ PUBLIC, &SbiParser::Dim, Y, N, Y, }, // PUBLIC +{ REDIM, &SbiParser::ReDim, N, Y, Y, }, // DIM +{ RESUME, &SbiParser::Resume, N, Y, N, }, // RESUME +{ RETURN, &SbiParser::Return, N, Y, N, }, // RETURN +{ RSET, &SbiParser::RSet, N, Y, N, }, // RSET +{ SELECT, &SbiParser::Select, N, Y, N, }, // SELECT +{ SET, &SbiParser::Set, N, Y, Y, }, // SET +{ STATIC, &SbiParser::Static, Y, Y, Y, }, // STATIC +{ STOP, &SbiParser::Stop, N, Y, N, }, // STOP +{ SUB, &SbiParser::SubFunc, Y, N, Y, }, // SUB +{ TYPE, &SbiParser::Type, Y, N, Y, }, // TYPE +{ UNTIL, &SbiParser::BadBlock, N, Y, Y, }, // UNTIL +{ WHILE, &SbiParser::While, N, Y, Y, }, // WHILE +{ WEND, &SbiParser::BadBlock, N, Y, Y, }, // WEND +{ WITH, &SbiParser::With, N, Y, N, }, // WITH +{ WRITE, &SbiParser::Write, N, Y, Y, }, // WRITE + +{ NIL } +}; + + +#ifdef MSC +// 'this' : used in base member initializer list +#pragma warning( disable: 4355 ) +#endif + +SbiParser::SbiParser( StarBASIC* pb, SbModule* pm ) + : SbiTokenizer( pm->GetSource(), pb ), + aGblStrings( this ), + aLclStrings( this ), + aPublics( aGblStrings, SbPUBLIC ), + aGlobals( aGblStrings, SbGLOBAL ), + aRtlSyms( aGblStrings, SbRTL ), + aGen( *pm, this, 1024 ) +{ + pBasic = pb; + eCurExpr = SbSYMBOL; + eEndTok = NIL; + pProc = NULL; + pStack = NULL; + pWithVar = NULL; + nBase = 0; + bText = + bGblDefs = + bNewGblDefs = + bSingleLineIf = + bExplicit = FALSE; + pPool = &aPublics; + for( short i = 0; i < 26; i++ ) + eDefTypes[ i ] = SbxVARIANT; // Kein expliziter Defaulttyp + + aPublics.SetParent( &aGlobals ); + aGlobals.SetParent( &aRtlSyms ); + + // Die globale Chainkette faengt bei Adresse 0 an: + nGblChain = aGen.Gen( _JUMP, 0 ); + + rTypeArray = new SbxArray; // Array fuer Benutzerdefinierte Typen +} + + +// Ist Teil der Runtime-Library? +SbiSymDef* SbiParser::CheckRTLForSym( const String& rSym, SbxDataType eType ) +{ + SbxVariable* pVar = GetBasic()->GetRtl()->Find( rSym, SbxCLASS_DONTCARE ); + SbiSymDef* pDef = NULL; + if( pVar ) + { + if( pVar->IsA( TYPE(SbxMethod) ) ) + { + SbiProcDef* pProc = aRtlSyms.AddProc( rSym ); + pProc->SetType( pVar->GetType() ); + pDef = pProc; + } + else + { + pDef = aRtlSyms.AddSym( rSym ); + pDef->SetType( eType ); + } + } + return pDef; +} + +// Globale Chainkette schliessen + +BOOL SbiParser::HasGlobalCode() +{ + if( bGblDefs && nGblChain ) + { + aGen.BackChain( nGblChain ); + aGen.Gen( _LEAVE ); + // aGen.Gen( _STOP ); + nGblChain = 0; + } + return bGblDefs; +} + +void SbiParser::OpenBlock( SbiToken eTok, SbiExprNode* pVar ) +{ + SbiParseStack* p = new SbiParseStack; + p->eExitTok = eTok; + p->nChain = 0; + p->pWithVar = pWithVar; + p->pNext = pStack; + pStack = p; + pWithVar = pVar; + + // #29955 for-Schleifen-Ebene pflegen + if( eTok == FOR ) + aGen.IncForLevel(); +} + +void SbiParser::CloseBlock() +{ + if( pStack ) + { + SbiParseStack* p = pStack; + + // #29955 for-Schleifen-Ebene pflegen + if( p->eExitTok == FOR ) + aGen.DecForLevel(); + + aGen.BackChain( p->nChain ); + pStack = p->pNext; + pWithVar = p->pWithVar; + delete p; + } +} + +// EXIT ... + +void SbiParser::Exit() +{ + SbiToken eTok = Next(); + for( SbiParseStack* p = pStack; p; p = p->pNext ) + { + if( eTok == p->eExitTok ) + { + p->nChain = aGen.Gen( _JUMP, p->nChain ); + return; + } + } + if( pStack ) + Error( SbERR_EXPECTED, pStack->eExitTok ); + else + Error( SbERR_BAD_EXIT ); +} + +BOOL SbiParser::TestSymbol( BOOL bKwdOk ) +{ + Peek(); + if( eCurTok == SYMBOL || ( bKwdOk && IsKwd( eCurTok ) ) ) + { + Next(); return TRUE; + } + Error( SbERR_SYMBOL_EXPECTED ); + return FALSE; +} + +// Testen auf ein bestimmtes Token + +BOOL SbiParser::TestToken( SbiToken t ) +{ + if( Peek() == t ) + { + Next(); return TRUE; + } + else + { + Error( SbERR_EXPECTED, t ); + return FALSE; + } +} + +// Testen auf Komma oder EOLN + +BOOL SbiParser::TestComma() +{ + SbiToken eTok = Peek(); + if( IsEoln( eTok ) ) + { + Next(); + return FALSE; + } + else if( eTok != COMMA ) + { + Error( SbERR_EXPECTED, COMMA ); + return FALSE; + } + Next(); + return TRUE; +} + +// Testen, ob EOLN vorliegt + +void SbiParser::TestEoln() +{ + if( !IsEoln( Next() ) ) + { + Error( SbERR_EXPECTED, EOLN ); + while( !IsEoln( Next() ) ) {} + } +} + +// Parsing eines Statement-Blocks +// Das Parsing laeuft bis zum Ende-Token. + +void SbiParser::StmntBlock( SbiToken eEnd ) +{ + SbiToken xe = eEndTok; + eEndTok = eEnd; + while( !bAbort && Parse() ) {} + eEndTok = xe; + if( IsEof() ) + { + Error( SbERR_BAD_BLOCK, eEnd ); + bAbort = TRUE; + } +} + +// Die Hauptroutine. Durch wiederholten Aufrufs dieser Routine wird +// die Quelle geparst. Returnwert FALSE bei Ende/Fehlern. + +BOOL SbiParser::Parse() +{ + if( bAbort ) return FALSE; + + EnableErrors(); + + Peek(); + // Dateiende? + if( IsEof() ) + { + // AB #33133: Falls keine Sub angelegt wurde, muss hier + // der globale Chain abgeschlossen werden! + // AB #40689: Durch die neue static-Behandlung kann noch + // ein nGblChain vorhanden sein, daher vorher abfragen + if( bNewGblDefs && nGblChain == 0 ) + nGblChain = aGen.Gen( _JUMP, 0 ); + return FALSE; + } + + // Leerstatement? + if( IsEoln( eCurTok ) ) + { + Next(); return TRUE; + } + + if( !bSingleLineIf && MayBeLabel( TRUE ) ) + { + // Ist ein Label + if( !pProc ) + Error( SbERR_NOT_IN_MAIN, aSym ); + else + pProc->GetLabels().Define( aSym ); + Next(); Peek(); + // Leerstatement? + if( IsEoln( eCurTok ) ) + { + Next(); return TRUE; + } + } + + // Ende des Parsings? + if( eCurTok == eEndTok ) + { + Next(); + if( eCurTok != NIL ) + aGen.Statement(); + return FALSE; + } + + // Kommentar? + if( eCurTok == REM ) + { + Next(); return TRUE; + } + + // Kommt ein Symbol, ist es entweder eine Variable( LET ) + // oder eine SUB-Prozedur( CALL ohne Klammern ) + // DOT fuer Zuweisungen im WITH-Block: .A=5 + if( eCurTok == SYMBOL || eCurTok == DOT ) + { +#ifndef VBSCRIPT_TEST + if( !pProc ) + Error( SbERR_EXPECTED, SUB ); + else +#endif + { + // Damit Zeile & Spalte stimmen... + Next(); + Push( eCurTok ); + aGen.Statement(); + Symbol(); + } + } + else + { + Next(); + + // Hier folgen nun die Statement-Parser. + + SbiStatement* p; + for( p = StmntTable; p->eTok != NIL; p++ ) + if( p->eTok == eCurTok ) + break; + if( p->eTok != NIL ) + { +#ifdef VBSCRIPT_TEST + if( !p->bVBScript ) + Error( ERRCODE_BASIC_NOT_IN_VBSCRIPT ); + else +#endif +#ifndef VBSCRIPT_TEST + if( !pProc && !p->bMain ) + Error( SbERR_NOT_IN_MAIN, eCurTok ); + else +#endif + if( pProc && !p->bSubr ) + Error( SbERR_NOT_IN_SUBR, eCurTok ); + else + { + // globalen Chain pflegen + // AB #41606/#40689: Durch die neue static-Behandlung kann noch + // ein nGblChain vorhanden sein, daher vorher abfragen + if( bNewGblDefs && ( eCurTok == SUB || eCurTok == FUNCTION ) && nGblChain == 0 ) + { + nGblChain = aGen.Gen( _JUMP, 0 ); + bNewGblDefs = FALSE; + } + // Statement-Opcode bitte auch am Anfang einer Sub + if( ( p->bSubr && (eCurTok != STATIC || Peek() == SUB || Peek() == FUNCTION ) ) || + eCurTok == SUB || eCurTok == FUNCTION ) + aGen.Statement(); + (this->*( p->Func ) )(); + SbxError nSbxErr = SbxBase::GetError(); + if( nSbxErr ) + SbxBase::ResetError(), Error( (SbError)nSbxErr ); + } + } + else + Error( SbERR_UNEXPECTED, eCurTok ); + } + + // Test auf Ende des Statements: + // Kann auch ein ELSE sein, da vor dem ELSE kein : stehen muss! + + if( !IsEos() ) + { + Peek(); + if( !IsEos() && eCurTok != ELSE ) + { + // falls das Parsing abgebrochen wurde, bis zum ":" vorgehen: + Error( SbERR_UNEXPECTED, eCurTok ); + while( !IsEos() ) Next(); + } + } + // Der Parser bricht am Ende ab, das naechste Token ist noch nicht + // geholt! + return TRUE; +} + +// Innerste With-Variable liefern +SbiExprNode* SbiParser::GetWithVar() +{ + if( pWithVar ) + return pWithVar; + + // Sonst im Stack suchen + SbiParseStack* p = pStack; + while( p ) + { + // LoopVar kann zur Zeit nur fuer with sein + if( p->pWithVar ) + return p->pWithVar; + p = p->pNext; + } + return NULL; +} + + +// Zuweisung oder Subroutine Call + +void SbiParser::Symbol() +{ + SbiExpression aVar( this, SbSYMBOL ); + aVar.Gen(); + if( Peek() != EQ ) + { + aGen.Gen( _GET ); + } + else + { + // Dann muss es eine Zuweisung sein. Was anderes gibts nicht! + if( !aVar.IsLvalue() ) + Error( SbERR_LVALUE_EXPECTED ); + TestToken( EQ ); + SbiExpression aExpr( this ); + aExpr.Gen(); + SbiOpcode eOp = _PUT; + SbiSymDef* pDef = aVar.GetRealVar(); + if( pDef ) + { + if( pDef->GetConstDef() ) + Error( SbERR_DUPLICATE_DEF, pDef->GetName() ); + if( pDef->GetType() == SbxOBJECT ) + { + eOp = _SET; + if( pDef->GetTypeId() ) +// if( pDef->GetTypeId() && !pDef->HabIchAlsTypeDefiniert() ) + aGen.Gen( _CLASS, pDef->GetTypeId() ); + // x = Objektfunktion (ohne Set) is nich drin +// Error( SbERR_SYNTAX ); + } + } + aGen.Gen( eOp ); + } +} + +// Zuweisungen + +void SbiParser::Assign() +{ + SbiExpression aLvalue( this, SbLVALUE ); + TestToken( EQ ); + SbiExpression aExpr( this ); + aLvalue.Gen(); + aExpr.Gen(); + USHORT nLen = 0; + SbiSymDef* pDef = aLvalue.GetRealVar(); + { + if( pDef->GetConstDef() ) + Error( SbERR_DUPLICATE_DEF, pDef->GetName() ); + nLen = aLvalue.GetRealVar()->GetLen(); + } + if( nLen ) + aGen.Gen( _PAD, nLen ); + aGen.Gen( _PUT ); +} + +// Zuweisungen einer Objektvariablen + +void SbiParser::Set() +{ + SbiExpression aLvalue( this, SbLVALUE ); + if( aLvalue.GetType() != SbxOBJECT ) + Error( SbERR_INVALID_OBJECT ); + TestToken( EQ ); + SbiSymDef* pDef = aLvalue.GetRealVar(); + if( pDef && pDef->GetConstDef() ) + Error( SbERR_DUPLICATE_DEF, pDef->GetName() ); + SbiExpression aExpr( this ); + aLvalue.Gen(); + aExpr.Gen(); + if( pDef->GetTypeId() ) +// if( pDef->GetTypeId() && !pDef->HabIchAlsTypeDefiniert() ) + aGen.Gen( _CLASS, pDef->GetTypeId() ); + aGen.Gen( _SET ); +} + +// JSM 07.10.95 +void SbiParser::LSet() +{ + SbiExpression aLvalue( this, SbLVALUE ); + if( aLvalue.GetType() != SbxSTRING ) + Error( SbERR_INVALID_OBJECT ); + TestToken( EQ ); + SbiSymDef* pDef = aLvalue.GetRealVar(); + if( pDef && pDef->GetConstDef() ) + Error( SbERR_DUPLICATE_DEF, pDef->GetName() ); + SbiExpression aExpr( this ); + aLvalue.Gen(); + aExpr.Gen(); + aGen.Gen( _LSET ); +} + +// JSM 07.10.95 +void SbiParser::RSet() +{ + SbiExpression aLvalue( this, SbLVALUE ); + if( aLvalue.GetType() != SbxSTRING ) + Error( SbERR_INVALID_OBJECT ); + TestToken( EQ ); + SbiSymDef* pDef = aLvalue.GetRealVar(); + if( pDef && pDef->GetConstDef() ) + Error( SbERR_DUPLICATE_DEF, pDef->GetName() ); + SbiExpression aExpr( this ); + aLvalue.Gen(); + aExpr.Gen(); + aGen.Gen( _RSET ); +} + +// DEFINT, DEFLNG, DEFSNG, DEFDBL, DEFSTR und so weiter + +void SbiParser::DefXXX() +{ + sal_Unicode ch1, ch2; + SbxDataType t = SbxDataType( eCurTok - DEFINT + SbxINTEGER ); + + while( !bAbort ) + { + if( Next() != SYMBOL ) break; + ch1 = aSym.ToUpperAscii().GetBuffer()[0]; + ch2 = 0; + if( Peek() == MINUS ) + { + Next(); + if( Next() != SYMBOL ) Error( SbERR_SYMBOL_EXPECTED ); + else + { + ch2 = aSym.ToUpperAscii().GetBuffer()[0]; + //ch2 = aSym.Upper(); + if( ch2 < ch1 ) Error( SbERR_SYNTAX ), ch2 = 0; + } + } + if (!ch2) ch2 = ch1; + ch1 -= 'A'; ch2 -= 'A'; + for (; ch1 <= ch2; ch1++) eDefTypes[ ch1 ] = t; + if( !TestComma() ) break; + } +} + +// STOP/SYSTEM + +void SbiParser::Stop() +{ + aGen.Gen( _STOP ); + Peek(); // #35694: Nur Peek(), damit EOL in Single-Line-If erkannt wird +} + +// OPTION + +void SbiParser::Option() +{ + switch( Next() ) + { + case EXPLICIT: + bExplicit = TRUE; break; + case BASE: + if( Next() == NUMBER ) + { + if( nVal == 0 || nVal == 1 ) + { + nBase = (short) nVal; + break; + } + } + Error( SbERR_EXPECTED, "0/1" ); + break; + case PRIVATE: + { + String aString = SbiTokenizer::Symbol(Next()); + if( !aString.EqualsIgnoreCaseAscii("Module") ) + Error( SbERR_EXPECTED, "Module" ); + break; + } + case COMPARE: + switch( Next() ) + { + case TEXT: bText = TRUE; return; + case BINARY: bText = FALSE; return; + default:; + } // Fall thru! + default: + Error( SbERR_BAD_OPTION, eCurTok ); + } +} + +// ERROR n + +void SbiParser::ErrorStmnt() +{ + SbiExpression aPar( this ); + aPar.Gen(); + aGen.Gen( _ERROR ); +} + + +// AB 22.5.1996 +// JavaScript-Parsing zunaechst provisorisch hier implementiert +void SbiParser::OpenJavaBlock( SbiToken, SbiExprNode* ) +{ +} + +void SbiParser::CloseJavaBlock() +{ +} + +void SbiParser::JavaStmntBlock( SbiToken ) +{ +} + +void SbiParser::JavaBreak() +{ +} + +void SbiParser::JavaContinue() +{ +} + +void SbiParser::JavaFor() +{ +} + +void SbiParser::JavaFunction() +{ +} + +void SbiParser::JavaIf() +{ +} + +void SbiParser::JavaNew() +{ +} + +void SbiParser::JavaReturn() +{ +} + +void SbiParser::JavaThis() +{ +} + +void SbiParser::JavaVar() +{ +} + +void SbiParser::JavaWhile() +{ +} + +void SbiParser::JavaWith() +{ +} + + + diff --git a/basic/source/comp/sbcomp.cxx b/basic/source/comp/sbcomp.cxx new file mode 100644 index 000000000000..b83f3c60b58d --- /dev/null +++ b/basic/source/comp/sbcomp.cxx @@ -0,0 +1,138 @@ +/************************************************************************* + * + * $RCSfile: sbcomp.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SV_SVAPP_HXX //autogen +#include <vcl/svapp.hxx> +#endif +#pragma hdrstop +#include <svtools/sbx.hxx> +#include "sbcomp.hxx" +#include "image.hxx" + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBCOMP, SBCOMP_CODE ) + +// Diese Routine ist hier definiert, damit der Compiler als eigenes Segment +// geladen werden kann. + +BOOL SbModule::Compile() +{ + if( pImage ) + return TRUE; + StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent()); + if( !pBasic ) + return FALSE; + SbxBase::ResetError(); + // Aktuelles Modul! + SbModule* pOld = pCMOD; + pCMOD = this; + + // #45741# Anderes Wait-Cursor-Handling + GetSbData()->bCompWait = BOOL( aSource.Len() > 2048 ); + if( GetSbData()->bCompWait ) + Application::EnterWait(); + + SbiParser* pParser = new SbiParser( (StarBASIC*) GetParent(), this ); + while( pParser->Parse() ) {} + if( !pParser->GetErrors() ) + pParser->aGen.Save(); + delete pParser; + // fuer den Disassembler + if( pImage ) + pImage->aSource = aSource; + + // #45741# Falls der Wait-Cursor gesetzt ist, jetzt zuruecksetzen + if( GetSbData()->bCompWait ) + { + Application::LeaveWait(); + GetSbData()->bCompWait = FALSE; + } + + pCMOD = pOld; + + // Beim Compilieren eines Moduls werden die Modul-globalen + // Variablen aller Module ungueltig + BOOL bRet = IsCompiled(); + if( bRet ) + { + pBasic->ClearAllModuleVars(); + + SbxObject* pParent = pBasic->GetParent(); + if( pParent ) + pBasic = PTR_CAST(StarBASIC,pParent); + if( pBasic ) + pBasic->ClearAllModuleVars(); + } + return bRet; +} + +/************************************************************************** +* +* Syntax-Highlighting +* +**************************************************************************/ + +void StarBASIC::Highlight( const String& rSrc, SbTextPortions& rList ) +{ + SbiTokenizer aTok( rSrc ); + aTok.Hilite( rList ); +} + diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx new file mode 100644 index 000000000000..68b6a7028f76 --- /dev/null +++ b/basic/source/comp/scanner.cxx @@ -0,0 +1,501 @@ +/************************************************************************* + * + * $RCSfile: scanner.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include "sbcomp.hxx" +#pragma hdrstop +#include <ctype.h> +#include <stdio.h> // sprintf() +#include <string.h> +#if defined (ICC) || defined (WTC) || defined(__powerc) || defined ( MAC ) || defined UNX +#include <stdlib.h> +#else +#include <math.h> // atof() +#endif +#ifndef _SOLMATH_HXX //autogen wg. SolarMath +#include <tools/solmath.hxx> +#endif +#ifndef _TOOLS_INTN_HXX +#include <tools/intn.hxx> +#endif + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBCOMP, SBCOMP_CODE ) + +SbiScanner::SbiScanner( const String& rBuf, StarBASIC* p ) : aBuf( rBuf ) +{ + pBasic = p; + pLine = NULL; + nVal = 0; + eScanType = SbxVARIANT; + nErrors = + nBufPos = + nCurCol1 = + nSavedCol1 = + nColLock = + nLine = + nCol1 = + nCol2 = + nCol = 0; + bError = + bAbort = + bSpaces = + bNumber = + bSymbol = + bUsedForHilite = FALSE; + bHash = + bErrors = TRUE; +} + +SbiScanner::~SbiScanner() +{} + +void SbiScanner::LockColumn() +{ + if( !nColLock++ ) + nSavedCol1 = nCol1; +} + +void SbiScanner::UnlockColumn() +{ + if( nColLock ) + nColLock--; +} + +void SbiScanner::GenError( SbError code ) +{ + if( !bError && bErrors ) + { + BOOL bRes = TRUE; + // Nur einen Fehler pro Statement reporten + bError = TRUE; + if( pBasic ) + { + // Falls EXPECTED oder UNEXPECTED kommen sollte, bezieht es sich + // immer auf das letzte Token, also die Col1 uebernehmen + USHORT nc = nColLock ? nSavedCol1 : nCol1; + switch( code ) + { + case SbERR_EXPECTED: + case SbERR_UNEXPECTED: + case SbERR_SYMBOL_EXPECTED: + case SbERR_LABEL_EXPECTED: + nc = nCol1; + if( nc > nCol2 ) nCol2 = nc; + break; + } + bRes = pBasic->CError( code, aError, nLine, nc, nCol2 ); + } + bAbort |= !bRes | + ( code == SbERR_NO_MEMORY || code == SbERR_PROG_TOO_LARGE ); + } + if( bErrors ) + nErrors++; +} + +// Falls sofort ein Doppelpunkt folgt, wird TRUE zurueckgeliefert. +// Wird von SbiTokenizer::MayBeLabel() verwendet, um einen Label zu erkennen + +BOOL SbiScanner::DoesColonFollow() +{ + if( pLine && *pLine == ':' ) + { + pLine++; nCol++; return TRUE; + } + else return FALSE; +} + +// Testen auf ein legales Suffix + +static SbxDataType GetSuffixType( sal_Unicode c ) +{ + static String aSuffixesStr = String::CreateFromAscii( "%&!#@ $" ); + if( c ) + { + sal_uInt32 n = aSuffixesStr.Search( c ); + if( STRING_NOTFOUND != n && c != ' ' ) + return SbxDataType( (USHORT) n + SbxINTEGER ); + } + return SbxVARIANT; +} + +// Einlesen des naechsten Symbols in die Variablen aSym, nVal und eType +// Returnwert ist FALSE bei EOF oder Fehlern +#define BUF_SIZE 80 + +BOOL SbiScanner::NextSym() +{ + static International aEnglischIntn( LANGUAGE_ENGLISH_US, LANGUAGE_ENGLISH_US ); + + // Fuer den EOLN-Fall merken + USHORT nOldLine = nLine; + USHORT nOldCol1 = nCol1; + USHORT nOldCol2 = nCol2; + sal_Unicode buf[ BUF_SIZE ], *p = buf; + bHash = FALSE; + + eScanType = SbxVARIANT; + aSym.Erase(); + bSymbol = + bNumber = bSpaces = FALSE; + + // Zeile einlesen? + if( !pLine ) + { + USHORT n = nBufPos; + USHORT nLen = aBuf.Len(); + if( nBufPos >= nLen ) + return FALSE; + const sal_Unicode* p = aBuf.GetBuffer(); + p += n; + while( ( n < nLen ) && ( *p != '\n' ) && ( *p != '\r' ) ) + p++, n++; + aLine = aBuf.Copy( nBufPos, n - nBufPos ); + if( ( n < nLen ) && *p == '\r' && *( p+1 ) == '\n' ) + n += 2; + else + n++; + nBufPos = n; + pLine = aLine.GetBuffer(); + nOldLine = ++nLine; + nCol = nCol1 = nCol2 = nOldCol1 = nOldCol2 = 0; + nColLock = 0; + } + + // Leerstellen weg: + while( *pLine && ( *pLine == ' ' ) || ( *pLine == '\t' ) || ( *pLine == '\f' ) ) + pLine++, nCol++, bSpaces = TRUE; + + nCol1 = nCol; + + // nur Leerzeile? + if( !*pLine ) goto eoln; + + if( *pLine == '#' ) pLine++, nCol++, bHash = TRUE; + + // Symbol? Dann Zeichen kopieren. + if( isalpha( *pLine & 0xFF ) || *pLine == '_' ) + { + // Wenn nach '_' nichts kommt, ist es ein Zeilenabschluss! + if( *pLine == '_' && !*(pLine+1) ) + { pLine++; + goto eoln; } + bSymbol = TRUE; + short n = nCol; + for ( ; (isalnum( *pLine & 0xFF ) || ( *pLine == '_' ) ); pLine++ ) + nCol++; + aSym = aLine.Copy( n, nCol - n ); + // Abschliessendes '_' durch Space ersetzen, wenn Zeilenende folgt + // (sonst falsche Zeilenfortsetzung) + if( !bUsedForHilite && !*pLine && *(pLine-1) == '_' ) + *((sal_Unicode*)(pLine-1)) = ' '; // cast wegen const + // Typkennung? + // Das Ausrufezeichen bitte nicht testen, wenn + // danach noch ein Symbol anschliesst + else if( *pLine != '!' || !isalpha( pLine[ 1 ] & 0xFF ) ) + { + SbxDataType t = GetSuffixType( *pLine ); + if( t != SbxVARIANT ) + { + eScanType = t; + pLine++; + nCol++; +#ifdef VBSCRIPT_TEST + nCol2 = nCol; + GenError( ERRCODE_BASIC_NOT_IN_VBSCRIPT ); +#endif + } + } + } + + // Zahl? Dann einlesen und konvertieren. + else if( isdigit( *pLine & 0xFF ) + || ( *pLine == '.' && isdigit( *(pLine+1) & 0xFF ) ) ) + { + short exp = 0; + short comma = 0; + short ndig = 0; + short ncdig = 0; + eScanType = SbxDOUBLE; + BOOL bBufOverflow = FALSE; + while( strchr( "0123456789.DEde", *pLine ) && *pLine ) + { + // AB 4.1.1996: Buffer voll? -> leer weiter scannen + if( (p-buf) == (BUF_SIZE-1) ) + { + bBufOverflow = TRUE; + pLine++, nCol++; + continue; + } + // Komma oder Exponent? + if( *pLine == '.' ) + { + if( ++comma > 1 ) + { + pLine++; nCol++; continue; + } + else *p++ = *pLine++, nCol++; + } + else if( strchr( "DdEe", *pLine ) ) + { + if (++exp > 1) + { + pLine++; nCol++; continue; + } +// if( toupper( *pLine ) == 'D' ) +// eScanType = SbxDOUBLE; + *p++ = 'E'; pLine++; nCol++; + // Vorzeichen hinter Exponent? + if( *pLine == '+' ) + pLine++, nCol++; + else + if( *pLine == '-' ) + *p++ = *pLine++, nCol++; + } + else + { + *p++ = *pLine++, nCol++; + if( comma && !exp ) ncdig++; + } + if (!exp) ndig++; + } + *p = 0; + aSym = p; bNumber = TRUE; + // Komma, Exponent mehrfach vorhanden? + if( comma > 1 || exp > 1 ) + { aError = '.'; + GenError( SbERR_BAD_CHAR_IN_NUMBER ); } + + // #57844 Lokalisierte Funktion benutzen + int nErrno; + nVal = SolarMath::StringToDouble( buf, aEnglischIntn, nErrno ); + // ATL: nVal = atof( buf ); + + ndig -= comma; + if( !comma && !exp ) + { + if( nVal >= SbxMININT && nVal <= SbxMAXINT ) + eScanType = SbxINTEGER; + else + if( nVal >= SbxMINLNG && nVal <= SbxMAXLNG ) + eScanType = SbxLONG; + } + if( bBufOverflow ) + GenError( SbERR_MATH_OVERFLOW ); + // zu viele Zahlen fuer SINGLE? +// if (ndig > 15 || ncdig > 6) +// eScanType = SbxDOUBLE; +// else +// if( nVal > SbxMAXSNG || nVal < SbxMINSNG ) +// eScanType = SbxDOUBLE; + + // Typkennung? + SbxDataType t = GetSuffixType( *pLine ); + if( t != SbxVARIANT ) + { + eScanType = t; + pLine++; + nCol++; +#ifdef VBSCRIPT_TEST + nCol2 = nCol; + GenError( ERRCODE_BASIC_NOT_IN_VBSCRIPT ); +#endif + } + } + + // Hex/Oktalzahl? Einlesen und konvertieren: + else if( *pLine == '&' ) + { + pLine++; nCol++; + sal_Unicode cmp1[] = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' }; + sal_Unicode cmp2[] = { '0', '1', '2', '3', '4', '5', '6', '7' }; + sal_Unicode *cmp = cmp1; + //char *cmp = "0123456789ABCDEF"; + sal_Unicode base = 16; + sal_Unicode ndig = 8; + sal_Unicode xch = *pLine++ & 0xFF; nCol++; + switch( toupper( xch ) ) + { + case 'O': + cmp = cmp2; base = 8; ndig = 11; break; + //cmp = "01234567"; base = 8; ndig = 11; break; + case 'H': + break; + default : + // Wird als Operator angesehen + pLine--; nCol--; nCol1 = nCol-1; aSym = '&'; return SYMBOL; + } + bNumber = TRUE; + long l = 0; + int i; + BOOL bBufOverflow = FALSE; + while( isalnum( *pLine & 0xFF ) ) + { + sal_Unicode ch = toupper( *pLine & 0xFF ); + pLine++; nCol++; + // AB 4.1.1996: Buffer voll, leer weiter scannen + if( (p-buf) == (BUF_SIZE-1) ) + bBufOverflow = TRUE; + else if( String( cmp ).Search( ch ) != STRING_NOTFOUND ) + //else if( strchr( cmp, ch ) ) + *p++ = ch; + else + { + aError = ch; + GenError( SbERR_BAD_CHAR_IN_NUMBER ); + } + } + *p = 0; + for( p = buf; *p; p++ ) + { + i = (*p & 0xFF) - '0'; + if( i > 9 ) i -= 7; + l = ( l * base ) + i; + if( !ndig-- ) + { + GenError( SbERR_MATH_OVERFLOW ); break; + } + } + if( *pLine == '&' ) pLine++, nCol++; + nVal = (double) l; + eScanType = ( l >= SbxMININT && l <= SbxMAXINT ) ? SbxINTEGER : SbxLONG; + if( bBufOverflow ) + GenError( SbERR_MATH_OVERFLOW ); + } + + // Strings: + else if( *pLine == '"' || *pLine == '[' ) + { + sal_Unicode cSep = *pLine; + if( cSep == '[' ) + bSymbol = TRUE, cSep = ']'; + short n = nCol+1; + while( *pLine ) + { + do pLine++, nCol++; + while( *pLine && ( *pLine != cSep ) ); + if( *pLine == cSep ) + { + pLine++; nCol++; + if( *pLine != cSep || cSep == ']' ) break; + } else aError = cSep, GenError( SbERR_EXPECTED ); + } + aSym = aLine.Copy( n, nCol - n - 1 ); + // Doppelte Stringbegrenzer raus + String s( cSep ); + s += cSep; + USHORT nIdx; + do { + nIdx = aSym.Search( s ); + aSym.Erase( nIdx, 1 ); + } while( nIdx != STRING_NOTFOUND ); + if( cSep != ']' ) + eScanType = ( cSep == '#' ) ? SbxDATE : SbxSTRING; + } + // ungueltige Zeichen: + else if( ( *pLine & 0xFF ) >= 0x7F ) + { + GenError( SbERR_SYNTAX ); pLine++; nCol++; + } + // andere Gruppen: + else + { + short n = 1; + switch( *pLine++ ) + { + case '<': if( *pLine == '>' || *pLine == '=' ) n = 2; break; + case '>': if( *pLine == '=' ) n = 2; break; + case ':': if( *pLine == '=' ) n = 2; break; + } + aSym = aLine.Copy( nCol, n ); + pLine += n-1; nCol += n; + } + + nCol2 = nCol-1; + + // Kommentar? + if( eScanType != SbxSTRING && + ( aSym.GetBuffer()[0] == '\'' || aSym.EqualsIgnoreCaseAscii( "REM" ) ) ) + { + aSym = String::CreateFromAscii( "REM" ); + nCol2 += String( pLine ).Len(); + pLine = NULL; + } + return TRUE; + + // Sonst Zeilen-Ende: aber bitte auf '_' testen, ob die + // Zeile nicht weitergeht! +eoln: + if( nCol && *--pLine == '_' ) + { + pLine = NULL; return NextSym(); + } + else + { + pLine = NULL; + nLine = nOldLine; + nCol1 = nOldCol1; + nCol2 = nOldCol2; + aSym = '\n'; + nColLock = 0; + return TRUE; + } +} + diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx new file mode 100644 index 000000000000..1e5f7d714f9e --- /dev/null +++ b/basic/source/comp/symtbl.cxx @@ -0,0 +1,528 @@ +/************************************************************************* + * + * $RCSfile: symtbl.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include "sbcomp.hxx" +#pragma hdrstop +#include <stdio.h> +#include <string.h> +#include <ctype.h> + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBCOMP, SBCOMP_CODE ) + +SV_IMPL_PTRARR(SbiStrings,String*) +SV_IMPL_PTRARR(SbiSymbols,SbiSymDef*) + +// Alle Symbolnamen werden im Stringpool des Symbol-Pools abgelegt, damit +// alle Symbole im gleichen Case verarbeitet werden. Beim Speichern des +// Code-Images wird der globale Stringpool mit den entsprechenden Sympools +// gespeichert. Der lokale Stringpool nimmt alle Symbole auf, die nicht +// ins Image wandern (Labels, Konstantennamen etc). + +/*************************************************************************** +|* +|* SbiStringPool +|* +***************************************************************************/ + +SbiStringPool::SbiStringPool( SbiParser* p ) +{ + pParser = p; +} + +SbiStringPool::~SbiStringPool() +{} + +// Suchen + +const String& SbiStringPool::Find( USHORT n ) const +{ + if( !n || n > aData.Count() ) + return aEmpty; + else + return *aData.GetObject( n-1 ); +} + +// Hinzufuegen eines Strings. Der String wird Case-Insensitiv +// verglichen. + +short SbiStringPool::Add( const String& rVal, BOOL bNoCase ) +{ + USHORT n = aData.Count(); + for( USHORT i = 0; i < n; i++ ) + { + String* p = aData.GetObject( i ); + if( ( bNoCase && p->Equals( rVal ) ) + || ( !bNoCase && p->EqualsIgnoreCaseAscii( rVal ) ) ) + return i+1; + } + const String* pNew = new String( rVal ); + aData.Insert( pNew, n++ ); + return (short) n; +} + +short SbiStringPool::Add( double n, SbxDataType t ) +{ + char buf[ 40 ]; + switch( t ) + { + case SbxINTEGER: sprintf( buf, "%d", (short) n ); break; + case SbxLONG: sprintf( buf, "%ld", (long) n ); break; + case SbxSINGLE: sprintf( buf, "%.6g", (float) n ); break; + case SbxDOUBLE: sprintf( buf, "%.16g", n ); break; + } + return Add( String::CreateFromAscii( buf ) ); +} + +/*************************************************************************** +|* +|* SbiSymPool +|* +***************************************************************************/ + +SbiSymPool::SbiSymPool( SbiStringPool& r, SbiSymScope s ) : rStrings( r ) +{ + pParser = r.GetParser(); + eScope = s; + pParent = NULL; + nCur = + nProcId = 0; +} + +SbiSymPool::~SbiSymPool() +{} + +// Inhalt loeschen + +void SbiSymPool::Clear() +{ + aData.DeleteAndDestroy( 0, aData.Count() ); +} + +SbiSymDef* SbiSymPool::First() +{ + nCur = (USHORT) -1; + return Next(); +} + +SbiSymDef* SbiSymPool::Next() +{ + if( ++nCur >= aData.Count() ) + return NULL; + else + return aData.GetObject( nCur ); +} + +// Hinzufuegen eines Symbols + +SbiSymDef* SbiSymPool::AddSym( const String& rName ) +{ + SbiSymDef* p = new SbiSymDef( rName ); + p->nPos = aData.Count(); + p->nId = rStrings.Add( rName ); + p->nProcId = nProcId; + p->pIn = this; + const SbiSymDef* q = p; + aData.Insert( q, q->nPos ); + return p; +} + +SbiProcDef* SbiSymPool::AddProc( const String& rName ) +{ + SbiProcDef* p = new SbiProcDef( pParser, rName ); + p->nPos = aData.Count(); + p->nId = rStrings.Add( rName ); + // Procs sind immer global + p->nProcId = 0; + p->pIn = this; + const SbiSymDef* q = p; + aData.Insert( q, q->nPos ); + return p; +} + +// Hinzufuegen einer extern aufgebauten Symboldefinition + +void SbiSymPool::Add( SbiSymDef* pDef ) +{ + if( pDef && pDef->pIn != this ) + { + if( pDef->pIn ) + { +#ifndef PRODUCT + // schon in einem anderen Pool drin! + pParser->Error( SbERR_INTERNAL_ERROR, "Dbl Pool" ); +#endif + return; + } + + pDef->nPos = aData.Count(); + if( !pDef->nId ) + { + // Bei statischen Variablen muss ein eindeutiger Name + // im Stringpool erzeugt werden (Form ProcName:VarName) + String aName( pDef->aName ); + if( pDef->IsStatic() ) + { + aName = pParser->aGblStrings.Find( nProcId ); + aName += ':'; + aName += pDef->aName; + } + pDef->nId = rStrings.Add( aName ); + } + // Procs sind immer global + if( !pDef->GetProcDef() ) + pDef->nProcId = nProcId; + pDef->pIn = this; + const SbiSymDef* q = pDef; + aData.Insert( q, q->nPos ); + } +} + +// Suchen eines Eintrags ueber den Namen. Es wird auch im Parent gesucht. + +SbiSymDef* SbiSymPool::Find( const String& rName ) const +{ + for( USHORT i = 0; i < aData.Count(); i++ ) + { + SbiSymDef* p = aData.GetObject( i ); + if( ( !p->nProcId || ( p->nProcId == nProcId ) ) + && ( p->aName.EqualsIgnoreCaseAscii( rName ) ) ) + return p; + } + if( pParent ) + return pParent->Find( rName ); + else + return NULL; +} + +// Suchen ueber ID-Nummer + +SbiSymDef* SbiSymPool::FindId( USHORT n ) const +{ + for( USHORT i = 0; i < aData.Count(); i++ ) + { + SbiSymDef* p = aData.GetObject( i ); + if( p->nId == n && ( !p->nProcId || ( p->nProcId == nProcId ) ) ) + return p; + } + if( pParent ) + return pParent->FindId( n ); + else + return NULL; +} + +// Suchen ueber Position (ab 0) + +SbiSymDef* SbiSymPool::Get( USHORT n ) const +{ + if( n >= aData.Count() ) + return NULL; + else + return aData.GetObject( n ); +} + +USHORT SbiSymPool::Define( const String& rName ) +{ + SbiSymDef* p = Find( rName ); + if( p ) + { if( p->IsDefined() ) + pParser->Error( SbERR_LABEL_DEFINED, rName ); + } + else + p = AddSym( rName ); + return p->Define(); +} + +USHORT SbiSymPool::Reference( const String& rName ) +{ + SbiSymDef* p = Find( rName ); + if( !p ) + p = AddSym( rName ); + //Sicherheitshalber + pParser->aGen.GenStmnt(); + return p->Reference(); +} + +// Alle offenen Referenzen anmaulen + +void SbiSymPool::CheckRefs() +{ + for( USHORT i = 0; i < aData.Count(); i++ ) + { + SbiSymDef* p = aData.GetObject( i ); + if( !p->IsDefined() ) + pParser->Error( SbERR_UNDEF_LABEL, p->GetName() ); + } +} + +/*************************************************************************** +|* +|* Symbol-Definitionen +|* +***************************************************************************/ + +SbiSymDef::SbiSymDef( const String& rName ) : aName( rName ) +{ + eType = SbxEMPTY; + nDims = + nTypeId = + nProcId = + nId = + nPos = + nLen = + nChain = 0; + bAs = + bNew = + bStatic = + bOpt = + bByVal = + bChained = FALSE; + pIn = + pPool = NULL; +} + +SbiSymDef::~SbiSymDef() +{ + delete pPool; +} + +SbiProcDef* SbiSymDef::GetProcDef() +{ + return NULL; +} + +SbiConstDef* SbiSymDef::GetConstDef() +{ + return NULL; +} + +// Wenn der Name benoetigt wird, den aktuellen Namen +// aus dem Stringpool nehmen + +const String& SbiSymDef::GetName() +{ + if( pIn ) + aName = pIn->rStrings.Find( nId ); + return aName; +} + +// Eintragen eines Datentyps + +void SbiSymDef::SetType( SbxDataType t ) +{ + if( t == SbxVARIANT && pIn ) + { + char ch = (char)aName.GetBuffer()[0]; + if( ch == '_' ) ch = 'Z'; + ch = toupper( ch ); + t = pIn->pParser->eDefTypes[ ch - 'A' ]; + } + eType = t; +} + +// Aufbau einer Backchain, falls noch nicht definiert +// Es wird der Wert zurueckgeliefert, der als Operand gespeichert +// werden soll. + +USHORT SbiSymDef::Reference() +{ + if( !bChained ) + { + USHORT n = nChain; + nChain = pIn->pParser->aGen.GetOffset(); + return n; + } + else return nChain; +} + +// Definition eines Symbols. +// Hier wird der Backchain aufgeloest, falls vorhanden + +USHORT SbiSymDef::Define() +{ + USHORT n = pIn->pParser->aGen.GetPC(); + pIn->pParser->aGen.GenStmnt(); + if( nChain ) pIn->pParser->aGen.BackChain( nChain ); + nChain = n; + bChained = TRUE; + return nChain; +} + +// Eine Symboldefinition kann einen eigenen Pool haben. Dies ist +// der Fall bei Objekten und Prozeduren (lokale Variable) + +SbiSymPool& SbiSymDef::GetPool() +{ + if( !pPool ) + pPool = new SbiSymPool( pIn->pParser->aGblStrings, SbLOCAL ); // wird gedumpt + return *pPool; +} + +SbiSymScope SbiSymDef::GetScope() const +{ + return pIn ? pIn->GetScope() : SbLOCAL; +} + +//////////////////////////////////////////////////////////////////////////// + +// Die Prozedur-Definition hat drei Pools: +// 1) aParams: wird durch die Definition gefuellt. Enthaelt die Namen +// der Parameter, wie sie innerhalb des Rumpfes verwendet werden. +// Das erste Element ist der Returnwert. +// 2) pPool: saemtliche lokale Variable +// 3) aLabels: Labels + +SbiProcDef::SbiProcDef( SbiParser* pParser, const String& rName ) + : SbiSymDef( rName ), + aParams( pParser->aGblStrings, SbPARAM ), // wird gedumpt + aLabels( pParser->aLclStrings, SbLOCAL ) // wird nicht gedumpt +{ + aParams.SetParent( &pParser->aPublics ); + pPool = new SbiSymPool( pParser->aGblStrings, SbLOCAL ); // Locals + pPool->SetParent( &aParams ); + nLine1 = + nLine2 = 0; + bPublic = TRUE; + bCdecl = FALSE; + // Fuer Returnwerte ist das erste Element der Parameterliste + // immer mit dem Namen und dem Typ der Proc definiert + aParams.AddSym( aName ); +} + +SbiProcDef::~SbiProcDef() +{} + +SbiProcDef* SbiProcDef::GetProcDef() +{ + return this; +} + +void SbiProcDef::SetType( SbxDataType t ) +{ + SbiSymDef::SetType( t ); + aParams.Get( 0 )->SetType( eType ); +} + +// Match mit einer Forward-Deklaration +// Falls der Match OK ist, wird pOld durch this im Pool ersetzt +// pOld wird immer geloescht! + +void SbiProcDef::Match( SbiProcDef* pOld ) +{ + SbiSymDef* po, *pn; + // Parameter 0 ist der Funktionsname + USHORT i; + for( i = 1; i < aParams.GetSize(); i++ ) + { + po = pOld->aParams.Get( i ); + pn = aParams.Get( i ); + // Kein Typabgleich; das wird beim Laufen erledigt + // aber ist sie evtl. mit zu wenigen Parametern aufgerufen + // worden? + if( !po && !pn->IsOptional() ) + break; + po = pOld->aParams.Next(); + } + // Wurden zu viele Parameter angegeben? + if( pn && i < aParams.GetSize() && pOld->pIn ) + { + // Die ganze Zeile markieren + pOld->pIn->GetParser()->SetCol1( 0 ); + pOld->pIn->GetParser()->Error( SbERR_BAD_DECLARATION, aName ); + } + if( !pIn && pOld->pIn ) + { + // Alten Eintrag durch neuen ersetzen + SbiSymDef** pData = (SbiSymDef**) pOld->pIn->aData.GetData(); + pData[ pOld->nPos ] = this; + nPos = pOld->nPos; + nId = pOld->nId; + pIn = pOld->pIn; + } + delete pOld; +} + +////////////////////////////////////////////////////////////////////////// + +SbiConstDef::SbiConstDef( const String& rName ) + : SbiSymDef( rName ) +{ + nVal = 0; eType = SbxINTEGER; +} + +void SbiConstDef::Set( double n, SbxDataType t ) +{ + aVal.Erase(); nVal = n; eType = t; +} + +void SbiConstDef::Set( const String& n ) +{ + aVal = n; nVal = 0; eType = SbxSTRING; +} + +SbiConstDef::~SbiConstDef() +{} + +SbiConstDef* SbiConstDef::GetConstDef() +{ + return this; +} + diff --git a/basic/source/comp/token.cxx b/basic/source/comp/token.cxx new file mode 100644 index 000000000000..38a2fc9f9986 --- /dev/null +++ b/basic/source/comp/token.cxx @@ -0,0 +1,689 @@ +/************************************************************************* + * + * $RCSfile: token.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <ctype.h> +#include "sbcomp.hxx" + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBCOMP, SBCOMP_CODE ) + +struct TokenTable { SbiToken t; const char *s; }; + +static short nToken; // Anzahl der Tokens + +static TokenTable* pTokTable; + +static TokenTable aTokTable_Basic [] = { // Token-Tabelle: + + { CAT, "&" }, + { MUL, "*" }, + { PLUS, "+" }, + { MINUS, "-" }, + { DIV, "/" }, + { EOS, ":" }, + { ASSIGN, ":=" }, + { LT, "<" }, + { LE, "<=" }, + { NE, "<>" }, + { EQ, "=" }, + { GT, ">" }, + { GE, ">=" }, + { ACCESS, "Access" }, + { ALIAS, "Alias" }, + { AND, "And" }, + { ANY, "Any" }, + { APPEND, "Append" }, + { AS, "As" }, + { BASE, "Base" }, + { BINARY, "Binary" }, + { TBOOLEAN, "Boolean" }, + { BYVAL, "ByVal", }, + { CALL, "Call" }, + { CASE, "Case" }, + { _CDECL_, "Cdecl" }, + { CLOSE, "Close" }, + { COMPARE, "Compare" }, + { _CONST_, "Const" }, + { TCURRENCY,"Currency" }, + { TDATE, "Date" }, + { DECLARE, "Declare" }, + { DEFBOOL, "DefBool" }, + { DEFCUR, "DefCur" }, + { DEFDATE, "DefDate" }, + { DEFDBL, "DefDbl" }, + { DEFERR, "DefErr" }, + { DEFINT, "DefInt" }, + { DEFLNG, "DefLng" }, + { DEFOBJ, "DefObj" }, + { DEFSNG, "DefSng" }, + { DEFSTR, "DefStr" }, + { DEFVAR, "DefVar" }, + { DIM, "Dim" }, + { DO, "Do" }, + { TDOUBLE, "Double" }, + { EACH, "Each" }, + { ELSE, "Else" }, + { ELSEIF, "ElseIf" }, + { END, "End" }, + { ENDFUNC, "End Function" }, + { ENDIF, "End If" }, + { ENDSELECT,"End Select" }, + { ENDSUB, "End Sub" }, + { ENDTYPE, "End Type" }, + { ENDIF, "EndIf" }, + { EQV, "Eqv" }, + { ERASE, "Erase" }, + { _ERROR_, "Error" }, + { EXIT, "Exit" }, + { EXPLICIT, "Explicit" }, + { FOR, "For" }, + { FUNCTION, "Function" }, + { GLOBAL, "Global" }, + { GOSUB, "GoSub" }, + { GOTO, "GoTo" }, + { IF, "If" }, + { IMP, "Imp" }, + { _IN_, "In" }, + { INPUT, "Input" }, // auch INPUT # + { TINTEGER, "Integer" }, + { IS, "Is" }, + { LET, "Let" }, + { LIB, "Lib" }, + { LINE, "Line" }, + { LINEINPUT,"Line Input" }, + { LOCAL, "Local" }, + { LOCK, "Lock" }, + { TLONG, "Long" }, + { LOOP, "Loop" }, + { LPRINT, "LPrint" }, + { LSET, "LSet" }, // JSM + { MOD, "Mod" }, + { NAME, "Name" }, + { NEW, "New" }, + { NEXT, "Next" }, + { NOT, "Not" }, + { TOBJECT, "Object" }, + { ON, "On" }, + { OPEN, "Open" }, + { OPTION, "Option" }, + { _OPTIONAL_, "Optional" }, + { OR, "Or" }, + { OUTPUT, "Output" }, + { PRESERVE, "Preserve" }, + { PRINT, "Print" }, + { PRIVATE, "Private" }, + { PUBLIC, "Public" }, + { RANDOM, "Random" }, + { READ, "Read" }, + { REDIM, "ReDim" }, + { REM, "Rem" }, + { RESUME, "Resume" }, + { RETURN, "Return" }, + { RSET, "RSet" }, // JSM + { SELECT, "Select" }, + { SET, "Set" }, +#ifdef SHARED +#undef SHARED +#define tmpSHARED +#endif + { SHARED, "Shared" }, +#ifdef tmpSHARED +#define SHARED +#undef tmpSHARED +#endif + { TSINGLE, "Single" }, + { STATIC, "Static" }, + { STEP, "Step" }, + { STOP, "Stop" }, + { TSTRING, "String" }, + { SUB, "Sub" }, + { STOP, "System" }, + { TEXT, "Text" }, + { THEN, "Then" }, + { TO, "To", }, + { TYPE, "Type" }, + { UNTIL, "Until" }, + { TVARIANT, "Variant" }, + { WEND, "Wend" }, + { WHILE, "While" }, + { WITH, "With" }, + { WRITE, "Write" }, // auch WRITE # + { XOR, "Xor" }, + { NIL } +}; + +/* +TokenTable aTokTable_Java [] = { // Token-Tabelle: + + { JS_LOG_NOT, "!" }, + { JS_NE, "!=" }, + { JS_MOD, "%" }, + { JS_ASS_MOD, "%=" }, + { JS_BIT_AND, "&" }, + { JS_LOG_AND, "&&" }, + { JS_ASS_AND, "&=" }, + { JS_LPAREN, "(" }, + { JS_RPAREN, ")" }, + { JS_MUL, "*" }, + { JS_ASS_MUL, "*=" }, + { JS_PLUS, "+" }, + { JS_INC, "++" }, + { JS_ASS_PLUS, "+=" }, + { JS_COMMA, "," }, + { JS_MINUS, "-" }, + { JS_DEC, "--" }, + { JS_ASS_MINUS, "-=" }, + { JS_DIV, "/" }, + { JS_ASS_DIV, "/=" }, + { JS_COND_SEL, ":" }, + { JS_LT, "<" }, + { JS_LSHIFT, "<<" }, + { JS_ASS_LSHIFT,"<<=" }, + { JS_LE, "<=" }, + { JS_NE, "<>" }, + { JS_ASSIGNMENT,"=" }, + { JS_EQ, "==" }, + { JS_GT, ">" }, + { JS_RSHIFT, ">>" }, + { JS_ASS_RSHIFT,">>=" }, + { JS_RSHIFT_Z, ">>>" }, + { JS_ASS_RSHIFT_Z,">>>=" }, + { JS_GE, ">=" }, + { JS_COND_QUEST,"?" }, + { ACCESS, "Access" }, + { ALIAS, "Alias" }, + { AND, "And" }, + { ANY, "Any" }, + { APPEND, "Append" }, + { AS, "As" }, + { BASE, "Base" }, + { BINARY, "Binary" }, + { TBOOLEAN, "Boolean" }, + { BYVAL, "ByVal", }, + { CALL, "Call" }, + { CASE, "Case" }, + { _CDECL_, "Cdecl" }, + { CLOSE, "Close" }, + { COMPARE, "Compare" }, + { _CONST_, "Const" }, + { TCURRENCY,"Currency" }, + { TDATE, "Date" }, + { DECLARE, "Declare" }, + { DEFBOOL, "DefBool" }, + { DEFCUR, "DefCur" }, + { DEFDATE, "DefDate" }, + { DEFDBL, "DefDbl" }, + { DEFERR, "DefErr" }, + { DEFINT, "DefInt" }, + { DEFLNG, "DefLng" }, + { DEFOBJ, "DefObj" }, + { DEFSNG, "DefSng" }, + { DEFSTR, "DefStr" }, + { DEFVAR, "DefVar" }, + { DIM, "Dim" }, + { DO, "Do" }, + { TDOUBLE, "Double" }, + { EACH, "Each" }, + { ELSE, "Else" }, + { ELSEIF, "ElseIf" }, + { END, "End" }, + { ENDFUNC, "End Function" }, + { ENDIF, "End If" }, + { ENDSELECT,"End Select" }, + { ENDSUB, "End Sub" }, + { ENDTYPE, "End Type" }, + { ENDIF, "EndIf" }, + { EQV, "Eqv" }, + { ERASE, "Erase" }, + { _ERROR_, "Error" }, + { EXIT, "Exit" }, + { EXPLICIT, "Explicit" }, + { FOR, "For" }, + { FUNCTION, "Function" }, + { GLOBAL, "Global" }, + { GOSUB, "GoSub" }, + { GOTO, "GoTo" }, + { IF, "If" }, + { IMP, "Imp" }, + { _IN_, "In" }, + { INPUT, "Input" }, // auch INPUT # + { TINTEGER, "Integer" }, + { IS, "Is" }, + { LET, "Let" }, + { LIB, "Lib" }, + { LINE, "Line" }, + { LINEINPUT,"Line Input" }, + { LOCAL, "Local" }, + { LOCK, "Lock" }, + { TLONG, "Long" }, + { LOOP, "Loop" }, + { LPRINT, "LPrint" }, + { LSET, "LSet" }, // JSM + { MOD, "Mod" }, + { NAME, "Name" }, + { NEW, "New" }, + { NEXT, "Next" }, + { NOT, "Not" }, + { TOBJECT, "Object" }, + { ON, "On" }, + { OPEN, "Open" }, + { OPTION, "Option" }, + { _OPTIONAL_, "Optional" }, + { OR, "Or" }, + { OUTPUT, "Output" }, + { PRESERVE, "Preserve" }, + { PRINT, "Print" }, + { PRIVATE, "Private" }, + { PUBLIC, "Public" }, + { RANDOM, "Random" }, + { READ, "Read" }, + { REDIM, "ReDim" }, + { REM, "Rem" }, + { RESUME, "Resume" }, + { RETURN, "Return" }, + { RSET, "RSet" }, // JSM + { SELECT, "Select" }, + { SET, "Set" }, + { SHARED, "Shared" }, + { TSINGLE, "Single" }, + { STATIC, "Static" }, + { STEP, "Step" }, + { STOP, "Stop" }, + { TSTRING, "String" }, + { SUB, "Sub" }, + { STOP, "System" }, + { TEXT, "Text" }, + { THEN, "Then" }, + { TO, "To", }, + { TYPE, "Type" }, + { UNTIL, "Until" }, + { TVARIANT, "Variant" }, + { WEND, "Wend" }, + { WHILE, "While" }, + { WITH, "With" }, + { WRITE, "Write" }, // auch WRITE # + { XOR, "Xor" }, + { JS_LINDEX, "[" }, + { JS_RINDEX, "]" }, + { JS_BIT_XOR, "^" }, + { JS_ASS_XOR, "^=" }, + { JS_BIT_OR, "|" }, + { JS_ASS_OR, "|=" }, + { JS_LOG_OR, "||" }, + { JS_BIT_NOT, "~" }, + { NIL } +}; +*/ + +// Der Konstruktor ermittelt die Laenge der Token-Tabelle. + +SbiTokenizer::SbiTokenizer( const String& rSrc, StarBASIC* pb ) + : SbiScanner( rSrc, pb ) +{ + pTokTable = aTokTable_Basic; + //if( StarBASIC::GetGlobalLanguageMode() == SB_LANG_JAVASCRIPT ) + // pTokTable = aTokTable_Java; + TokenTable *tp; + bEof = bAs = FALSE; + eCurTok = NIL; + ePush = NIL; + bEos = bKeywords = TRUE; + if( !nToken ) + for( nToken = 0, tp = pTokTable; tp->t; nToken++, tp++ ) {} +} + +SbiTokenizer::~SbiTokenizer() +{} + +// Wiederablage (Pushback) eines Tokens. (Bis zu 2 Tokens) + +void SbiTokenizer::Push( SbiToken t ) +{ + if( ePush != NIL ) + Error( SbERR_INTERNAL_ERROR, "PUSH" ); + else ePush = t; +} + +void SbiTokenizer::Error( SbError code, const char* pMsg ) +{ + aError = String::CreateFromAscii( pMsg ); + Error( code ); +} + +void SbiTokenizer::Error( SbError code, String aMsg ) +{ + aError = aMsg; + Error( code ); +} + +void SbiTokenizer::Error( SbError code, SbiToken tok ) +{ + aError = Symbol( tok ); + Error( code ); +} + +// Einlesen des naechsten Tokens, ohne dass das Token geschluckt wird + +SbiToken SbiTokenizer::Peek() +{ + if( ePush == NIL ) + { + USHORT nOldLine = nLine; + USHORT nOldCol1 = nCol1; + USHORT nOldCol2 = nCol2; + ePush = Next(); + nPLine = nLine; nLine = nOldLine; + nPCol1 = nCol1; nCol1 = nOldCol1; + nPCol2 = nCol2; nCol2 = nOldCol2; + } + return eCurTok = ePush; +} + +// Dies ist fuer die Decompilation. +// Zahlen und Symbole liefern einen Leerstring zurueck. + +const String& SbiTokenizer::Symbol( SbiToken t ) +{ + // Zeichen-Token? + if( t < FIRSTKWD ) + { + aSym = (char) t; + return aSym; + } + switch( t ) + { + case NEG : aSym = '-'; return aSym; + case EOS : aSym = String::CreateFromAscii( ":/CRLF" ); return aSym; + case EOLN : aSym = String::CreateFromAscii( "CRLF" ); return aSym; + } + TokenTable* tp = pTokTable; + for( short i = 0; i < nToken; i++, tp++ ) + { + if( tp->t == t ) + { + aSym = String::CreateFromAscii( tp->s ); + return aSym; + } + } + const sal_Unicode *p = aSym.GetBuffer(); + if (*p <= ' ') aSym = String::CreateFromAscii( "???" ); + return aSym; +} + +// Einlesen des naechsten Tokens und Ablage desselben +// Tokens, die nicht in der Token-Tabelle vorkommen, werden +// direkt als Zeichen zurueckgeliefert. +// Einige Worte werden gesondert behandelt. + +SbiToken SbiTokenizer::Next() +{ + if (bEof) return EOLN; + // Schon eines eingelesen? + if( ePush != NIL ) + { + eCurTok = ePush; + ePush = NIL; + nLine = nPLine; + nCol1 = nPCol1; + nCol2 = nPCol2; + bEos = IsEoln( eCurTok ); + return eCurTok; + } + TokenTable *tp; + + // Sonst einlesen: + if( !NextSym() ) + { + bEof = bEos = TRUE; + return eCurTok = EOLN; + } + // Zeilenende? + if( aSym.GetBuffer()[0] == '\n' ) + { + bEos = TRUE; return eCurTok = EOLN; + } + bEos = FALSE; + + // Zahl? + if( bNumber ) + return eCurTok = NUMBER; + + // String? + else if( ( eScanType == SbxDATE || eScanType == SbxSTRING ) && !bSymbol ) + return eCurTok = FIXSTRING; + // Sonderfaelle von Zeichen, die zwischen "Z" und "a" liegen. ICompare() + // wertet die Position dieser Zeichen unterschiedlich aus. + else if( aSym.GetBuffer()[0] == '^' ) + return eCurTok = EXPON; + else if( aSym.GetBuffer()[0] == '\\' ) + return eCurTok = IDIV; + else + { + // Mit Typkennung oder ein Symbol und keine Keyword-Erkennung? + // Dann kein Token-Test + if( eScanType != SbxVARIANT + || ( !bKeywords && bSymbol ) ) + return eCurTok = SYMBOL; + // Gueltiges Token? + short lb = 0; + short ub = nToken-1; + short delta; + do + { + delta = (ub - lb) >> 1; + tp = &pTokTable[ lb + delta ]; + StringCompare res = aSym.CompareIgnoreCaseToAscii( tp->s ); + // Gefunden? + if( res == COMPARE_EQUAL ) goto special; + // Groesser? Dann untere Haelfte + if( res == COMPARE_LESS ) + { + if ((ub - lb) == 2) ub = lb; + else ub -= delta; + } + // Kleiner? Dann obere Haelfte + else + { + if ((ub -lb) == 2) lb = ub; + else lb += delta; + } + } while( delta ); + // Symbol? Wenn nicht >= Token + sal_Unicode ch = aSym.GetBuffer()[0]; + if( !isalpha( ch ) && !bSymbol ) + return eCurTok = (SbiToken) (ch & 0x00FF); + return eCurTok = SYMBOL; + } +special: + // LINE INPUT + if( tp->t == LINE ) + { + short nC1 = nCol1; + eCurTok = Peek(); + if( eCurTok == INPUT ) + { + Next(); + nCol1 = nC1; + return eCurTok = LINEINPUT; + } + else + return eCurTok = LINE; + } + // END IF, CASE, SUB, DEF, FUNCTION, TYPE, CLASS, WITH + if( tp->t == END ) + { + // AB, 15.3.96, Spezialbehandlung fuer END, beim Peek() geht die + // aktuelle Zeile verloren, daher alles merken und danach restaurieren + USHORT nOldLine = nLine; + USHORT nOldCol = nCol; + USHORT nOldCol1 = nCol1; + USHORT nOldCol2 = nCol2; + String aOldSym = aSym; + SaveLine(); // pLine im Scanner sichern + + eCurTok = Peek(); + switch( eCurTok ) + { + case IF: Next(); eCurTok = ENDIF; break; + case SELECT: Next(); eCurTok = ENDSELECT; break; + case SUB: Next(); eCurTok = ENDSUB; break; + case FUNCTION: Next(); eCurTok = ENDFUNC; break; + case TYPE: Next(); eCurTok = ENDTYPE; break; + case WITH: Next(); eCurTok = ENDWITH; break; + default : eCurTok = END; + } + nCol1 = nOldCol1; + if( eCurTok == END ) + { + // Alles zuruecksetzen, damit Token nach END ganz neu gelesen wird + ePush = NIL; + nLine = nOldLine; + nCol = nOldCol; + nCol2 = nOldCol2; + aSym = aOldSym; + RestoreLine(); // pLine im Scanner restaurieren + } + return eCurTok; + } + // Sind Datentypen Keywords? + // Nur nach AS, sonst sind es Symbole! + // Es gibt ja ERROR(), DATA(), STRING() etc. + eCurTok = tp->t; + // AS: Datentypen sind Keywords + if( tp->t == AS ) + bAs = TRUE; + else + { + if( bAs ) + bAs = FALSE; + else if( eCurTok >= DATATYPE1 && eCurTok <= DATATYPE2 ) + eCurTok = SYMBOL; + } + bEos = IsEoln( eCurTok ); + return eCurTok; +} + +#ifdef _MSC_VER +#pragma optimize("",off) +#endif + +// Kann das aktuell eingelesene Token ein Label sein? + +BOOL SbiTokenizer::MayBeLabel( BOOL bNeedsColon ) +{ + if( eCurTok == SYMBOL ) + return bNeedsColon ? DoesColonFollow() : TRUE; + else + return BOOL( eCurTok == NUMBER + && eScanType == SbxINTEGER + && nVal >= 0 ); +} + +#ifdef _MSC_VER +#pragma optimize("",off) +#endif + + +void SbiTokenizer::Hilite( SbTextPortions& rList ) +{ + bErrors = FALSE; + bUsedForHilite = TRUE; + SbiToken eLastTok = NIL; + for( ;; ) + { + Next(); + if( IsEof() ) + break; + SbTextPortion aRes; + aRes.nLine = nLine; + aRes.nStart = nCol1; + aRes.nEnd = nCol2; + sal_Unicode ch = aSym.GetBuffer()[0]; + switch( eCurTok ) + { + case REM: + aRes.eType = SB_COMMENT; break; + case SYMBOL: + aRes.eType = SB_SYMBOL; break; + case FIXSTRING: + aRes.eType = SB_STRING; break; + case NUMBER: + aRes.eType = SB_NUMBER; break; + default: + if( ( eCurTok >= FIRSTKWD && eCurTok <= LASTKWD ) + || (eCurTok >= _CDECL_ ) ) + aRes.eType = SB_KEYWORD; + else + aRes.eType = SB_PUNCTUATION; + } + // Die Folge xxx.Keyword sollte nicht als Kwd geflagt werden + if( aRes.eType == SB_KEYWORD + && ( eLastTok == DOT|| eLastTok == EXCLAM ) ) + aRes.eType = SB_SYMBOL; + if( eCurTok != EOLN && aRes.nStart <= aRes.nEnd ) + rList.Insert( aRes, rList.Count() ); + if( aRes.eType == SB_COMMENT ) + break; + eLastTok = eCurTok; + } + bUsedForHilite = FALSE; +} + diff --git a/basic/source/inc/buffer.hxx b/basic/source/inc/buffer.hxx new file mode 100644 index 000000000000..4f806f218496 --- /dev/null +++ b/basic/source/inc/buffer.hxx @@ -0,0 +1,98 @@ +/************************************************************************* + * + * $RCSfile: buffer.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _BUFFER_HXX +#define _BUFFER_HXX + +#ifndef _SOLAR_H +#include <tools/solar.h> +#endif +#ifndef _STRING_HXX //autogen +#include <tools/string.hxx> +#endif + +class SbiParser; + +class SbiBuffer { // Code/Konstanten-Puffer: + SbiParser* pParser; // fuer Fehlermeldungen + char* pBuf; // Puffer-Pointer + char* pCur; // aktueller Puffer-Pointer + USHORT nOff; // aktuelles Offset + USHORT nSize; // aktuelle Groesse + short nInc; // Inkrement + BOOL Check( USHORT ); // Buffergroesse testen +public: + SbiBuffer( SbiParser*, short ); // Inkrement + ~SbiBuffer(); + void Patch( USHORT, USHORT ); // Patchen + void Chain( USHORT ); // Back-Chain + void Align( short ); // Alignment + BOOL Add( const void*, USHORT );// Element anfuegen + BOOL operator += (const String&);// Basic-String speichern + BOOL operator += (INT8); // Zeichen speichern + BOOL operator += (INT16); // Integer speichern + BOOL operator += (UINT8); // Zeichen speichern + BOOL operator += (UINT16); // Integer speichern + char* GetBuffer(); // Puffer rausgeben (selbst loeschen!) + USHORT GetSize() { return nOff; } +}; + +#endif diff --git a/basic/source/inc/codegen.hxx b/basic/source/inc/codegen.hxx new file mode 100644 index 000000000000..c748399b7b93 --- /dev/null +++ b/basic/source/inc/codegen.hxx @@ -0,0 +1,101 @@ +/************************************************************************* + * + * $RCSfile: codegen.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CODEGEN_HXX +#define _CODEGEN_HXX + +class SbiImage; +class SbiParser; +class SbModule; +#ifndef _OPCODES_HXX +#include "opcodes.hxx" +#endif +#ifndef _BUFFER_HXX +#include "buffer.hxx" +#endif + +class SbiCodeGen { // Code-Erzeugung: + SbiParser* pParser; // fuer Fehlermeldungen, Line, Column etc. + SbModule& rMod; // aktuelles Modul + SbiBuffer aCode; // Code-Puffer + short nLine, nCol; // Zeile, Spalte fuer Stmnt-Befehl + short nForLevel; // #29955 for-Schleifen-Ebene + BOOL bStmnt; // TRUE: Statement-Opcode liegt an +public: + SbiCodeGen( SbModule&, SbiParser*, short ); + SbiParser* GetParser() { return pParser; } + USHORT Gen( SbiOpcode ); + USHORT Gen( SbiOpcode, UINT16 ); + USHORT Gen( SbiOpcode, UINT16, UINT16 ); + void Patch( USHORT o, USHORT v ){ aCode.Patch( o, v ); } + void BackChain( USHORT off ) { aCode.Chain( off ); } + void Statement(); + void GenStmnt(); // evtl. Statement-Opcode erzeugen + USHORT GetPC(); + USHORT GetOffset() { return GetPC() + 1; } + void Save(); + + // #29955 for-Schleifen-Ebene pflegen + void IncForLevel( void ) { nForLevel++; } + void DecForLevel( void ) { nForLevel--; } +}; + +#endif diff --git a/basic/source/inc/collelem.hxx b/basic/source/inc/collelem.hxx new file mode 100644 index 000000000000..389b690479d4 --- /dev/null +++ b/basic/source/inc/collelem.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * $RCSfile: collelem.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SAMPLE_COLLELEM_HXX +#define _SAMPLE_COLLELEM_HXX + +#ifndef _SBX_SBXOBJECT_HXX //autogen +#include <svtools/sbxobj.hxx> +#endif + +// Das Sample-Element ist ein kleines Objekt, das die Properties +// Name und Value enth„lt sowie die Methode Say, die den bergebenen +// Text mit dem eigenen Namen verkoppelt. Der Name ist von aussen setzbar. +// Die Implementation arbeitet ausschliesslich mit dynamischen Elementen. + +class SampleElement : public SbxObject +{ + // Broadcaster Notification + virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ); +public: + SampleElement( const String& ); +}; + +#endif diff --git a/basic/source/inc/disas.hxx b/basic/source/inc/disas.hxx new file mode 100644 index 000000000000..dda0ee20f1a7 --- /dev/null +++ b/basic/source/inc/disas.hxx @@ -0,0 +1,106 @@ +/************************************************************************* + * + * $RCSfile: disas.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _DISAS_HXX +#define _DISAS_HXX + +#include "image.hxx" +#include "opcodes.hxx" + +class SvStream; + +class SbiDisas { + const SbiImage& rImg; + SbModule* pMod; + char cLabels[ 8192 ]; // Bitvektor fuer Labels + USHORT nOff; // aktuelle Position + USHORT nPC; // Position des Opcodes + SbiOpcode eOp; // Opcode + USHORT nOp1, nOp2; // Operanden + short nParts; // 1, 2 oder 3 + short nLine; // aktuelle Zeile + BOOL DisasLine( String& ); + BOOL Fetch(); // naechster Opcode +public: + SbiDisas( SbModule*, const SbiImage* ); + void Disas( SvStream& ); + void Disas( String& ); + // NICHT AUFRUFEN + void StrOp( String& ); + void Str2Op( String& ); + void ImmOp( String& ); + void OnOp( String& ); + void LblOp( String& ); + void ReturnOp( String& ); + void ResumeOp( String& ); + void PromptOp( String& ); + void CloseOp( String& ); + void CharOp( String& ); + void VarOp( String& ); + void VarDefOp( String& ); + void OffOp( String& ); + void TypeOp( String& ); + void CaseOp( String& ); + void StmntOp( String& ); + void StrmOp( String& ); +}; + +#endif diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx new file mode 100644 index 000000000000..0b41dbeb3b3e --- /dev/null +++ b/basic/source/inc/expr.hxx @@ -0,0 +1,255 @@ +/************************************************************************* + * + * $RCSfile: expr.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _EXPR_HXX +#define _EXPR_HXX + +#ifndef _OPCODES_HXX +#include "opcodes.hxx" +#endif +#ifndef _TOKEN_HXX +#include "token.hxx" +#endif + +class SbiExprNode; +class SbiExpression; +class SbiExprList; +class SbiDimList; +class SbiParameters; +class SbiParser; +class SbiCodeGen; +class SbiSymDef; +class SbiProcDef; + +struct SbVar { // Variablen-Element: + SbiExprNode* pNext; // Weiteres Element (bei Strukturen) + SbiSymDef* pDef; // Symboldefinition + SbiExprList* pPar; // optionale Parameter (wird geloescht) +}; + +enum SbiExprType { // Expression-Typen: + SbSTDEXPR, // normaler Ausdruck + SbLVALUE, // beliebiger lValue + SbSYMBOL, // beliebiges zusammengesetztes Symbol + SbOPERAND // Variable/Funktion +}; + +enum SbiNodeType { + SbxNUMVAL, // nVal = Wert + SbxSTRVAL, // nStringId = Wert + SbxVARVAL, // aVar = Wert + SbxNODE // Node +}; + +class SbiExprNode { // Operatoren (und Operanden) + friend class SbiExpression; + friend class SbiConstExpression; + union { + USHORT nStringId; // gepoolter String-ID + double nVal; // numerischer Wert + SbVar aVar; // oder Variable + }; + SbiExprNode* pLeft; // linker Zweig + SbiExprNode* pRight; // rechter Zweig (NULL bei unaeren Ops) + SbiCodeGen* pGen; // Code-Generator + SbiNodeType eNodeType; // Art des Nodes + SbxDataType eType; // aktueller Datentyp + SbiToken eTok; // Token des Operators + BOOL bComposite; // TRUE: Zusammengesetzter Ausdruck + BOOL bError; // TRUE: Fehlerhaft + BOOL bPartOfWith; // TRUE: .-Anweisung in with-Block + void FoldConstants(); // Constant Folding durchfuehren + void CollectBits(); // Umwandeln von Zahlen in Strings + BOOL IsOperand(); // TRUE, wenn Operand + BOOL IsNumber(); // TRUE bei Zahlen + BOOL IsString(); // TRUE bei Strings + BOOL IsLvalue(); // TRUE, falls als Lvalue verwendbar + void GenElement( SbiOpcode ); // Element + void BaseInit( SbiParser* p ); // Hilfsfunktion fuer Ctor, AB 17.12.95 +public: + SbiExprNode( SbiParser*, double, SbxDataType ); + SbiExprNode( SbiParser*, const String& ); + SbiExprNode( SbiParser*, const SbiSymDef&, SbxDataType, SbiExprList* = NULL ); + SbiExprNode( SbiParser*, SbiExprNode*, SbiToken, SbiExprNode* ); + virtual ~SbiExprNode(); + + BOOL IsValid() { return BOOL( !bError ); } + BOOL IsConstant(); // TRUE bei konstantem Operanden + BOOL IsIntConst(); // TRUE bei Integer-Konstanten + BOOL IsVariable(); // TRUE, wenn Variable + + BOOL IsPartOfWith() { return bPartOfWith; } + void SetPartOfWith( BOOL b ) { bPartOfWith = b; } + + SbxDataType GetType() { return eType; } + void SetType( SbxDataType eTp ) { eType = eTp; } + SbiNodeType GetNodeType() { return eNodeType; } + SbiSymDef* GetVar(); // Variable (falls vorhanden) + SbiSymDef* GetRealVar(); // letzte Variable in x.y.z + SbiExprNode* GetRealNode(); // letzter Knoten in x.y.z + short GetDepth(); // Tiefe eines Baumes berechnen + const String& GetString(); // String liefern + + void Optimize(); // Baumabgleich + + void Gen(); // Ausgabe eines Nodes +}; + +class SbiExpression { // der Ausdruck: + friend class SbiExprList; + friend class SbiParameters; + friend class SbiDimList; +protected: + String aArgName; // Name fuer bananntes Argument + SbiParser* pParser; // fuer Fehlermeldungen, Parsing + SbiExpression* pNext; // Link bei Parameterlisten + SbiExprNode* pExpr; // Der Expression-Baum + SbiExprType eCurExpr; // Art des Ausdrucks + BOOL bBased; // TRUE: einfacher DIM-Teil (+BASE) + BOOL bError; // TRUE: Fehler + BOOL bByVal; // TRUE: ByVal-Parameter + SbiExprNode* Term(); + SbiExprNode* ObjTerm( SbiSymDef& ); + SbiExprNode* Operand(); + SbiExprNode* Unary(); + SbiExprNode* Exp(); + SbiExprNode* MulDiv(); + SbiExprNode* IntDiv(); + SbiExprNode* Mod(); + SbiExprNode* AddSub(); + SbiExprNode* Cat(); + SbiExprNode* Like(); + SbiExprNode* Comp(); + SbiExprNode* Boolean(); +public: + SbiExpression( SbiParser*, SbiExprType = SbSTDEXPR ); // Parsender Ctor + SbiExpression( SbiParser*, const String& ); + SbiExpression( SbiParser*, double, SbxDataType = SbxDOUBLE ); + SbiExpression( SbiParser*, const SbiSymDef&, SbiExprList* = NULL ); + SbiExpression( SbiParser*, SbiToken ); // Spezial-Expr mit Spezial-Tokens + ~SbiExpression(); + String& GetName() { return aArgName; } + void SetBased() { bBased = TRUE; } + BOOL IsBased() { return bBased; } + void SetByVal() { bByVal = TRUE; } + BOOL IsByVal() { return bByVal; } + BOOL IsValid() { return pExpr->IsValid(); } + BOOL IsConstant() { return pExpr->IsConstant(); } + BOOL IsVariable() { return pExpr->IsVariable(); } + BOOL IsLvalue() { return pExpr->IsLvalue(); } + BOOL IsIntConstant() { return pExpr->IsIntConst(); } + const String& GetString() { return pExpr->GetString(); } + SbiSymDef* GetVar() { return pExpr->GetVar(); } + SbiSymDef* GetRealVar() { return pExpr->GetRealVar(); } + SbiExprNode* GetExprNode() { return pExpr; } + SbxDataType GetType() { return pExpr->GetType(); } + void SetType( SbxDataType eType){ pExpr->eType = eType; } + void Gen(); +}; + +class SbiConstExpression : public SbiExpression { + double nVal; + String aVal; + SbxDataType eType; +public: // numerische Konstante + SbiConstExpression( SbiParser* ); + SbxDataType GetType() { return eType; } + const String& GetString() { return aVal; } + double GetValue() { return nVal; } + short GetShortValue(); +}; + +class SbiExprList { // Basisklasse fuer Parameter und Dims +protected: + SbiParser* pParser; // Parser + SbiExpression* pFirst; // Expressions + SbiProcDef* pProc; // DECLARE-Funktion (Parameter-Anpassung) + short nExpr; // Anzahl Expressions + short nDim; // Anzahl Dimensionen + BOOL bError; // TRUE: Fehler + BOOL bBracket; // TRUE: Klammern +public: + SbiExprList( SbiParser* ); + virtual ~SbiExprList(); + BOOL IsBracket() { return bBracket; } + BOOL IsValid() { return BOOL( !bError ); } + short GetSize() { return nExpr; } + short GetDims() { return nDim; } + SbiExpression* Get( short ); + BOOL Test( const SbiProcDef& ); // Parameter-Checks + void Gen(); // Code-Erzeugung + // Setzen einer Funktionsdefinition zum Abgleich der Parameter + void SetProc( SbiProcDef* p ) { pProc = p; } +}; + +class SbiParameters : public SbiExprList { +public: + SbiParameters( SbiParser*, BOOL bConst = FALSE, BOOL bPar = TRUE);// parsender Ctor +}; + +class SbiDimList : public SbiExprList { + BOOL bConst; // TRUE: Alles sind Integer-Konstanten +public: + SbiDimList( SbiParser* ); // Parsender Ctor + BOOL IsConstant() { return bConst; } +}; + +#endif diff --git a/basic/source/inc/filefmt.hxx b/basic/source/inc/filefmt.hxx new file mode 100644 index 000000000000..777688a1935e --- /dev/null +++ b/basic/source/inc/filefmt.hxx @@ -0,0 +1,207 @@ +/************************************************************************* + * + * $RCSfile: filefmt.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SB_FILEFMT_HXX +#define _SB_FILEFMT_HXX + +#ifndef _SOLAR_H +#include <tools/solar.h> +#endif + +class SvStream; + +// Version 2: Datentyp des Returnwerts fuer Publics +// Version 3: neue Opcodes +// Version 4: neue Opcodes +// Version 5: Bug (Ansprung von STATIC-Variablen im Init-Code) +// Version 6: Neue Opcodes und Bug (Globals anlegen, ohne BASIC zu beenden) +// Version 7: Korrektur im WITH-Parsing +// Version 8: Korrektur im IF-Parsing +// Version 9: Init-Code auch mit LEAVE beenden, wenn keine SUB/FUNCTION folgt +// Version A: #36374 Bei DIM AS NEW... auch Variablen anlegen +// Version B: #40689 Static umgestellt +// Version C: #41606 Bug bei Static +// Version D: #42678 Bug bei RTL-Function spc +// Version E: #56204 DCREATE, um auch bei DIM AS NEW Arrays anzulegen +// Version F: #57844 Einfuehrung von SvNumberformat::StringToDouble +// Version 10: #29955 For-Schleifen-Level in Statement-PCodes generieren +// Version 11: #29955 Wegen Build-Inkonsistenzen Neu-Compilieren erzwingen + +#define B_CURVERSION 0x00000011L + +// Eine Datei enthaelt entweder einen Modul- oder einen Library-Record. +// Diese Records enthalten wiederum weitere Records. Jeder Record hat +// den folgenden Header: + +// UINT16 Kennung +// UINT32 Laenge des Records ohne Header +// UINT16 Anzahl Unterelemente + +// Alle Datei-Offsets in Records sind relativ zum Start des Moduls! + +#define B_LIBRARY 0x4C42 // BL Library Record +#define B_MODULE 0x4D42 // BM Module Record +#define B_NAME 0x4E4D // MN module name +#define B_COMMENT 0x434D // MC comment +#define B_SOURCE 0x4353 // SC source code +#define B_PCODE 0x4350 // PC p-code +#define B_OLDPUBLICS 0x7550 // Pu publics +#define B_PUBLICS 0x5550 // PU publics +#define B_POOLDIR 0x4450 // PD symbol pool directory +#define B_SYMPOOL 0x5953 // SY symbol pool +#define B_STRINGPOOL 0x5453 // ST symbol pool +#define B_LINERANGES 0x524C // LR line ranges for publics +#define B_MODEND 0x454D // ME module end +#define B_SBXOBJECTS 0x5853 // SX SBX objects + +// Ein Library Record enthaelt nur Module Records +// UINT16 Kennung BL +// UINT32 Laenge des Records +// UINT16 Anzahl Module + +// Ein Modul-Record enthaelt alle anderen Recordtypen +// UINT16 Kennung BM +// UINT32 Laenge des Records +// UINT16 1 +// Daten: +// UINT32 Versionsnummer +// UINT32 Zeichensatz +// UINT32 Startadresse Initialisierungscode +// UINT32 Startadresse Sub Main +// UINT32 Reserviert +// UINT32 Reserviert + +// Modulname, Kommentar und Quellcode: +// UINT16 Kennung MN, MC oder SC +// UINT32 Laenge des Records +// UINT16 1 +// Daten: +// String-Instanz + +// P-Code: +// UINT16 Kennung PC +// UINT32 Laenge des Records +// UINT16 1 +// Daten: +// Der P-Code als Bytesack + +// Alle Symbole und Strings werden in einem String-Pool gehalten. +// Verweise auf diese Strings sind in Form eines Indexes in diesen Pool. + +// Liste aller Publics: +// UINT16 Kennung PU oder Pu +// UINT32 Laenge des Records +// UINT16 Anzahl der Publics +// Daten fuer jeden Public-Eintrag: +// UINT16 String-Index +// UINT32 Startadresse im P-Code-Image (UINT16 fuer alte Publics) +// UINT16 Datentyp des Returnwertes (ab Version 2) + +// Verzeichnis der Symbol-Tabellen: +// UINT16 Kennung SP +// UINT32 Laenge des Records +// UINT16 Anzahl der Symboltabellen +// Daten fuer jede Symboltabelle: +// UINT16 Stringindex des Namens +// UINT16 Anzahl Symbole +// UINT16 Scope-Kennung + +// Symboltabelle: +// UINT16 Kennung SY +// UINT32 Laenge des Records +// UINT16 Anzahl der Symbole +// Daten: +// UINT16 Stringindex des Namens +// UINT16 Anzahl Symbole +// Daten fuer jedes Symbol: +// UINT16 Stringindex des Namens +// UINT16 Datentyp +// UINT16 Laenge bei STRING*n-Symbolen (0x8000: STATIC-Variable) + +// Stringpool: +// UINT16 Kennung ST +// UINT32 Laenge des Records +// UINT16 Anzahl der Strings +// Daten fuer jeden String: +// UINT32 Offset in den Block aller Strings +// Danach folgt der Block aller Strings, die dort als ASCIIZ-Strings liegen. + +// Line Ranges: +// UINT16 Kennung LR +// UINT32 Laenge des Records +// UINT16 Anzahl der Strings +// Daten fuer jedes Public: +// UINT16 1. Zeile (Sub XXX) +// UINT16 2. Zeile (End Sub) + +// SBX-Objekte: +// UINT16 Anzahl Objekte +// .... Objektdaten + +//////////////////////////////////////////////////////////////////////////// + +// Service-Routinen (in IMAGE.CXX) + +BOOL SbGood( SvStream& r ); +ULONG SbOpenRecord( SvStream&, UINT16 nSignature, UINT16 nElem ); +void SbCloseRecord( SvStream&, ULONG ); + +#endif diff --git a/basic/source/inc/image.hxx b/basic/source/inc/image.hxx new file mode 100644 index 000000000000..5573d97213c3 --- /dev/null +++ b/basic/source/inc/image.hxx @@ -0,0 +1,123 @@ +/************************************************************************* + * + * $RCSfile: image.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SBIMAGE_HXX +#define _SBIMAGE_HXX + +#include "sbintern.hxx" + +// Diese Klasse liest das vom Compiler erzeugte Image ein und verwaltet +// den Zugriff auf die einzelnen Elemente. + +struct SbPublicEntry; + +class SbiImage { + friend class SbiCodeGen; // Compiler-Klassen, die die private- + + SbxArrayRef rTypes; // + UINT16* pStringOff; // StringId-Offsets + sal_Unicode* pStrings; // StringPool + char* pCode; // Code-Image + BOOL bError; // TRUE: Fehler + USHORT nFlags; // Flags (s.u.) + short nStrings; // Anzahl Strings + UINT16 nStringSize; // Groesse des String-Puffers + UINT16 nCodeSize; // Groesse des Code-Blocks + UINT16 nDimBase; // OPTION BASE-Wert + rtl_TextEncoding eCharSet; // Zeichensatz fuer Strings + // temporaere Verwaltungs-Variable: + short nStringIdx; // aktueller String-Index + UINT16 nStringOff; // aktuelle Pos im Stringpuffer + // Routinen fuer Compiler: + void MakeStrings( short ); // StringPool einrichten + void AddString( const String& );// String zufuegen + void AddCode( char*, USHORT ); // Codeblock dazu + void AddType(SbxObject *); // User-Type mit aufnehmen + +public: + String aName; // Makroname + String aSource; // Quellcode + String aComment; // Kommentar + BOOL bInit; // TRUE: Init-Code ist gelaufen + SbiImage(); + ~SbiImage(); + void Clear(); // Inhalt loeschen + BOOL Load( SvStream& ); + BOOL Save( SvStream& ); + BOOL IsError() { return bError; } + + const char* GetCode() const { return pCode; } + USHORT GetCodeSize() const { return nCodeSize; } + String& GetSource() { return aSource; } + USHORT GetBase() const { return nDimBase; } + String GetString( short nId ) const; + //const char* GetString( short nId ) const; + const SbxObject* FindType (String aTypeName) const; + + void SetFlag( USHORT n ) { nFlags |= n; } + USHORT GetFlag( USHORT n ) const { return nFlags & n; } +}; + +#define SBIMG_EXPLICIT 0x0001 // OPTION EXPLICIT ist aktiv +#define SBIMG_COMPARETEXT 0x0002 // OPTION COMPARE TEXT ist aktiv +#define SBIMG_INITCODE 0x0004 // Init-Code vorhanden + +#endif diff --git a/basic/source/inc/iosys.hxx b/basic/source/inc/iosys.hxx new file mode 100644 index 000000000000..ff0a41e3ace5 --- /dev/null +++ b/basic/source/inc/iosys.hxx @@ -0,0 +1,149 @@ +/************************************************************************* + * + * $RCSfile: iosys.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SBIOSYS_HXX +#define _SBIOSYS_HXX + +#ifndef _STREAM_HXX //autogen +#include <tools/stream.hxx> +#endif +#ifndef _SBERRORS_HXX +#include "sberrors.hxx" +#endif + +class SvStream; + +// Zur Zeit sind globale Dateien (Kanalnummern 256 bis 511) +// nicht implementiert. + +#define CHANNELS 256 +#define CONSOLE 0 + +#define SBSTRM_INPUT 0x0001 // Input +#define SBSTRM_OUTPUT 0x0002 // Output +#define SBSTRM_RANDOM 0x0004 // Random +#define SBSTRM_APPEND 0x0008 // Append +#define SBSTRM_BINARY 0x0010 // Binary + +class SbiStream { + SvStream* pStrm; // der Stream + ULONG nExpandOnWriteTo; // bei Schreibzugriff, den Stream + // bis zu dieser Groesse aufblasen + ByteString aLine; // aktuelle Zeile + ULONG nLine; // aktuelle Zeilennummer + short nLen; // Pufferlaenge + short nMode; // Bits: + short nChan; // aktueller Kanal + SbError nError; // letzter Fehlercode + void MapError(); // Fehlercode mappen + +public: + SbiStream(); + ~SbiStream(); + SbError Open( short, const ByteString&, short, short, short ); + SbError Close(); + SbError Read( ByteString&, USHORT = 0 ); + SbError Read( char& ); + SbError Write( const ByteString&, USHORT = 0 ); + + BOOL IsText() const { return !(nMode & SBSTRM_BINARY); } + BOOL IsRandom() const { return (nMode & SBSTRM_RANDOM); } + BOOL IsBinary() const { return (nMode & SBSTRM_BINARY); } + BOOL IsSeq() const { return !(nMode & SBSTRM_RANDOM); } + BOOL IsAppend() const { return (nMode & SBSTRM_APPEND); } + short GetBlockLen() const { return nLen; } + short GetMode() const { return nMode; } + ULONG GetLine() const { return nLine; } + void SetExpandOnWriteTo( ULONG n ) { nExpandOnWriteTo = n; } + void ExpandFile(); + SvStream* GetStrm() { return pStrm; } +}; + +class SbiIoSystem { + SbiStream* pChan[ CHANNELS ]; + ByteString aPrompt; // Input-Prompt + ByteString aIn, aOut; // Console-Buffer + short nChan; // aktueller Kanal + SbError nError; // letzter Fehlercode + void ReadCon( ByteString& ); + void WriteCon( const ByteString& ); +public: + SbiIoSystem(); + ~SbiIoSystem(); + SbError GetError(); + void Shutdown(); + void SetPrompt( const ByteString& r ) { aPrompt = r; } + void SetChannel( short n ) { nChan = n; } + short GetChannel() const { return nChan;} + void ResetChannel() { nChan = 0; } + void Open( short, const ByteString&, short, short, short ); + void Close(); + void Read( ByteString&, short = 0 ); + char Read(); + void Write( const ByteString&, short = 0 ); + short NextChannel(); + // 0 == bad channel or no SvStream (nChannel=0..CHANNELS-1) + SbiStream* GetStream( short nChannel ) const; + void CloseAll(); // JSM +}; + +#endif + diff --git a/basic/source/inc/object.hxx b/basic/source/inc/object.hxx new file mode 100644 index 000000000000..e96d51dbe56f --- /dev/null +++ b/basic/source/inc/object.hxx @@ -0,0 +1,137 @@ +/************************************************************************* + * + * $RCSfile: object.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SAMPLE_OBJECT_HXX +#define _SAMPLE_OBJECT_HXX + +#ifndef __SBX_SBX_FACTORY_HXX //autogen +#include <svtools/sbxfac.hxx> +#endif +#ifndef __SBX_SBXVARIABLE_HXX //autogen +#include <svtools/sbxvar.hxx> +#endif +#ifndef _SBX_SBXOBJECT_HXX //autogen +#include <svtools/sbxobj.hxx> +#endif + +// 1) Properties: +// Name der Name, R/O +// Value ein double-Wert, R/W +// 2) Methoden: +// Display Ausgabe eines Textes +// Square Argument * Argument +// Event Aufruf eines Basic-Programms +// 3) Unterobjekte: +// eine Collection names "Elements". Der Zugriff ist sowohl als +// Property (fuer das gesamte Objekt) als auch als Methode (fuer +// einzelne Elemente, wird durchgereicht) implementiert. +// Diese Implementation ist ein Beispiel fuer eine tabellengesteuerte +// Version, die sehr viele Elemente enthalten kann. +// Die Collection findet sich in COLLECTN.*, die in der Collection +// enthaltenen Objekte in COLLELEM.* + +class SampleObject : public SbxObject +{ + // Definition eines Tabelleneintrags. Dies wird hier gemacht, + // da dadurch die Methoden und Properties als private deklariert + // werden koennen. +#if defined ( ICC ) || defined ( HPUX ) || defined ( C50 ) +public: +#endif + typedef void( SampleObject::*pMeth ) + ( SbxVariable* pThis, SbxArray* pArgs, BOOL bWrite ); +#if defined ( ICC ) || defined ( HPUX ) +private: +#endif + + struct Methods { + const char* pName; // Name des Eintrags + SbxDataType eType; // Datentyp + short nArgs; // Argumente und Flags + pMeth pFunc; // Function Pointer + }; + static Methods aMethods[]; // Methodentabelle + + // Methoden + void Display( SbxVariable*, SbxArray*, BOOL ); + void Event( SbxVariable*, SbxArray*, BOOL ); + void Square( SbxVariable*, SbxArray*, BOOL ); + void Create( SbxVariable*, SbxArray*, BOOL ); + // Infoblock auffuellen + SbxInfo* GetInfo( short nIdx ); + // Broadcaster Notification + virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ); +public: + SampleObject( const String& ); + // Suchen eines Elements + virtual SbxVariable* Find( const String&, SbxClassType ); +}; + +// Die dazugehoerige Factory: + +class SampleObjectFac : public SbxFactory +{ +public: + virtual SbxObject* CreateObject( const String& ); +}; + +#endif diff --git a/basic/source/inc/opcodes.hxx b/basic/source/inc/opcodes.hxx new file mode 100644 index 000000000000..21f3fa6caeb3 --- /dev/null +++ b/basic/source/inc/opcodes.hxx @@ -0,0 +1,191 @@ +/************************************************************************* + * + * $RCSfile: opcodes.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _OPCODES_HXX +#define _OPCODES_HXX + +#include "sbintern.hxx" + +#ifdef MTW +#undef _NUMBER +#endif + +// Ein Opcode ist entweder 1, 3 oder 5 Bytes lang, je nach numerischen +// Wert des Opcodes (s.u.). + +enum SbiOpcode { + // Alle Opcodes ohne Operanden + _NOP = 0, + + SbOP0_START = _NOP, + + // Operatoren + // die folgenden Operatoren sind genauso angeordnet + // wie der enum SbxVarOp + _EXP, _MUL, _DIV, _MOD, _PLUS, _MINUS, _NEG, + _EQ, _NE, _LT, _GT, _LE, _GE, + _IDIV, _AND, _OR, _XOR, _EQV, _IMP, _NOT, + _CAT, + // Ende enum SbxVarOp + _LIKE, _IS, + // Laden/speichern + _ARGC, // neuen Argv einrichten + _ARGV, // TOS ==> aktueller Argv + _INPUT, // Input ==> TOS + _LINPUT, // Line Input ==> TOS + _GET, // TOS anfassen + _SET, // Speichern Objekt TOS ==> TOS-1 + _PUT, // TOS ==> TOS-1 + _PUTC, // TOS ==> TOS-1, dann ReadOnly + _DIM, // DIM + _REDIM, // REDIM + _REDIMP, // REDIM PRESERVE + _ERASE, // TOS loeschen + // Verzweigen + _STOP, // Programmende + _INITFOR, // FOR-Variable initialisieren + _NEXT, // FOR-Variable inkrementieren + _CASE, // Anfang CASE + _ENDCASE, // Ende CASE + _STDERROR, // Standard-Fehlerbehandlung + _NOERROR, // keine Fehlerbehandlung + _LEAVE, // UP verlassen + // E/A + _CHANNEL, // TOS = Kanalnummer + _BPRINT, // print TOS + _PRINTF, // print TOS in field + _BWRITE, // write TOS + _RENAME, // Rename Tos+1 to Tos + _PROMPT, // TOS = Prompt for Input + _RESTART, // Restartpunkt definieren + _CHAN0, // I/O-Kanal 0 + // Sonstiges + _EMPTY, // Leeren Ausdruck auf Stack + _ERROR, // TOS = Fehlercode + _LSET, // Speichern Objekt TOS ==> TOS-1 + _RSET, // Speichern Objekt TOS ==> TOS-1 + SbOP0_END, + + // Alle Opcodes mit einem Operanden + + _NUMBER = 0x40, // Laden einer numerischen Konstanten (+ID) + + SbOP1_START = _NUMBER, + + _SCONST, // Laden einer Stringkonstanten (+ID) + _CONST, // Immediate Load (+Wert) + _ARGN, // Speichern eines named Args in Argv (+StringID) + _PAD, // String auf feste Laenge bringen (+Laenge) + // Verzweigungen + _JUMP, // Sprung (+Target) + _JUMPT, // TOS auswerten, bedingter Sprung (+Target) + _JUMPF, // TOS auswerten, bedingter Sprung (+Target) + _ONJUMP, // TOS auswerten, Sprung in JUMP-Tabelle (+MaxVal) + _GOSUB, // UP-Aufruf (+Target) + _RETURN, // UP-Return (+0 oder Target) + _TESTFOR, // FOR-Variable testen, inkrementieren (+Endlabel) + _CASETO, // Tos+1 <= Case <= Tos, 2xremove (+Target) + _ERRHDL, // Fehler-Handler (+Offset) + _RESUME, // Resume nach Fehlern (+0 or 1 or Label) + // E/A + _CLOSE, // (+Kanal/0) + _PRCHAR, // (+char) + // Verwaltung + _CLASS, // Klassennamen testen (+StringId) + _LIB, // Libnamen fuer Declare-Procs setzen (+StringId) + _BASED, // TOS wird um BASE erhoeht, BASE davor gepusht (+base) + // Typanpassung im Argv + _ARGTYP, // Letzten Parameter in Argv konvertieren (+Typ) + + SbOP1_END, + + // Alle Opcodes mit zwei Operanden + + _RTL = 0x80, // Laden aus RTL (+StringID+Typ) + + SbOP2_START = _RTL, + + _FIND, // Laden (+StringID+Typ) + _ELEM, // Laden Element (+StringID+Typ) + _PARAM, // Parameter (+Offset+Typ) + // Verzweigen + _CALL, // DECLARE-Methode rufen (+StringID+Typ) + _CALLC, // Cdecl-DECLARE-Methode rufen (+StringID+Typ) + _CASEIS, // Case-Test (+Test-Opcode+True-Target) + // Verwaltung + _STMNT, // Beginn eines Statements (+Line+Col) + // E/A + _OPEN, // (+SvStreamFlags+Flags) + // Objekte + _LOCAL, // Lokale Variable definieren (+StringID+Typ) + _PUBLIC, // Modulglobale Variable (+StringID+Typ) + _GLOBAL, // Globale Variable definieren (+StringID+Typ) + _CREATE, // Objekt kreieren (+StringId+StringID) + _STATIC, // Statische Variabl (+StringID+Typ) JSM + _TCREATE, // User Defined Objekt kreieren + _DCREATE, // Objekt-Array kreieren (+StringId+StringID) + SbOP2_END + +}; + + + +#endif diff --git a/basic/source/inc/parser.hxx b/basic/source/inc/parser.hxx new file mode 100644 index 000000000000..c99c587e55b7 --- /dev/null +++ b/basic/source/inc/parser.hxx @@ -0,0 +1,192 @@ +/************************************************************************* + * + * $RCSfile: parser.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _PARSER_HXX +#define _PARSER_HXX + +#ifndef _EXPR_HXX +#include "expr.hxx" +#endif +#ifndef _CODEGEN_HXX +#include "codegen.hxx" +#endif +#ifndef _SYMTBL_HXX +#include "symtbl.hxx" +#endif + + +struct SbiParseStack; + +class SbiParser : public SbiTokenizer +{ + SbiParseStack* pStack; // Block-Stack + SbiProcDef* pProc; // aktuelle Prozedur + SbiExprNode* pWithVar; // aktuelle With-Variable + SbiToken eEndTok; // das Ende-Token + USHORT nGblChain; // Chainkette fuer globale DIMs + BOOL bGblDefs; // TRUE globale Definitionen allgemein + BOOL bNewGblDefs; // TRUE globale Definitionen vor Sub + BOOL bSingleLineIf; // TRUE einzeiliges if-Statement + + SbiSymDef* VarDecl( SbiDimList**,BOOL,BOOL );// Variablen-Deklaration + SbiProcDef* ProcDecl(BOOL bDecl);// Prozedur-Deklaration + void DefProc( BOOL bStatic ); // Prozedur einlesen + void DefVar( SbiOpcode eOp, BOOL bStatic ); // DIM/REDIM einlesen + void TypeDecl( SbiSymDef& ); // AS-Deklaration + void OpenBlock( SbiToken, SbiExprNode* = NULL ); // Block oeffnen + void CloseBlock(); // Block aufloesen + BOOL Channel( BOOL=FALSE ); // Kanalnummer parsen + void StmntBlock( SbiToken ); // Statement-Block abarbeiten + +public: + SbxArrayRef rTypeArray; // das Type-Array + SbiStringPool aGblStrings; // der String-Pool + SbiStringPool aLclStrings; // der String-Pool + SbiSymPool aGlobals; // globale Variable + SbiSymPool aPublics; // modulglobale Variable + SbiSymPool aRtlSyms; // Runtime-Library + SbiCodeGen aGen; // Code-Generator + StarBASIC* pBasic; // StarBASIC-Instanz + SbiSymPool* pPool; // aktueller Pool + SbiExprType eCurExpr; // aktueller Expr-Typ + short nBase; // OPTION BASE-Wert + BOOL bText; // OPTION COMPARE TEXT + BOOL bExplicit; // TRUE: OPTION EXPLICIT + SbxDataType eDefTypes[26]; // DEFxxx-Datentypen + + SbiParser( StarBASIC*, SbModule* ); + BOOL Parse(); // die Aktion + SbiExprNode* GetWithVar(); // Innerste With-Variable liefern + + // AB 31.3.1996, Symbol in Runtime-Library suchen + SbiSymDef* CheckRTLForSym( const String& rSym, SbxDataType eType ); + + BOOL HasGlobalCode(); // Globaler Code definiert? + + BOOL TestToken( SbiToken ); // bestimmtes TOken? + BOOL TestSymbol( BOOL=FALSE ); // Symbol? + BOOL TestComma(); // Komma oder EOLN? + void TestEoln(); // EOLN? + + void Symbol(); // Let oder Call + void ErrorStmnt(); // ERROR n + void NotImp(); // nicht implementiert + void BadBlock(); // LOOP/WEND/NEXT + void BadSyntax(); // Falsches SbiToken + void NoIf(); // ELSE/ELSE IF ohne IF + void Assign(); // LET + void Call(); // CALL + void Close(); // CLOSE + void Declare(); // DECLARE + void DefXXX(); // DEFxxx + void Dim(); // DIM + void ReDim(); // ReDim(); + void Erase(); // ERASE + void Exit(); // EXIT + void For(); // FOR...NEXT + void Goto(); // GOTO / GOSUB + void If(); // IF + void Input(); // INPUT, INPUT # + void LineInput(); // LINE INPUT, LINE INPUT # + void LSet(); // LSET + void Name(); // NAME .. AS .. + void On(); // ON ERROR/variable + void OnGoto(); // ON...GOTO / GOSUB + void Open(); // OPEN + void Option(); // OPTION + void Print(); // PRINT, PRINT # + void SubFunc(); // SUB / FUNCTION + void Resume(); // RESUME + void Return(); // RETURN + void RSet(); // RSET + void DoLoop(); // DO...LOOP + void Select(); // SELECT ... CASE + void Set(); // SET + void Static(); // STATIC + void Stop(); // STOP/SYSTEM + void Type(); // TYPE...AS...END TYPE + void While(); // WHILE/WEND + void With(); // WITH + void Write(); // WRITE + + // JavaScript-Parsing + void OpenJavaBlock( SbiToken, SbiExprNode* = NULL ); // Block oeffnen + void CloseJavaBlock(); // Block aufloesen + void JavaStmntBlock( SbiToken ); // Statement-Block abarbeiten + void JavaBreak(); + void JavaContinue(); + void JavaFor(); + void JavaFunction(); + void JavaIf(); + void JavaNew(); + void JavaReturn(); + void JavaThis(); + void JavaVar(); + void JavaWhile(); + void JavaWith(); +}; + + + + + + +#endif diff --git a/basic/source/inc/propacc.hxx b/basic/source/inc/propacc.hxx new file mode 100644 index 000000000000..9833747cde30 --- /dev/null +++ b/basic/source/inc/propacc.hxx @@ -0,0 +1,235 @@ +/************************************************************************* + * + * $RCSfile: propacc.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:10 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _SFX_PROPBAG_HXX +#define _SFX_PROPBAG_HXX + +#ifndef _SVARRAY_HXX +#include <svtools/svarray.hxx> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HXX_ +#include <com/sun/star/beans/PropertyValue.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HXX_ +#include <com/sun/star/beans/XPropertySet.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HXX_ +#include <com/sun/star/beans/XPropertySetInfo.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYACCESS_HXX_ +#include <com/sun/star/beans/XPropertyAccess.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCONTAINER_HXX_ +#include <com/sun/star/beans/XPropertyContainer.hpp> +#endif + +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif +#ifndef _CPPUHELPER_IMPLBASE2_HXX_ +#include <cppuhelper/implbase2.hxx> +#endif + +#define NS_BEANS ::com::sun::star::beans +#define NS_LANG ::com::sun::star::lang +#define NS_UNO ::com::sun::star::uno + +typedef NS_BEANS::PropertyValue* SbPropertyValuePtr; +SV_DECL_PTRARR( SbPropertyValueArr_Impl, SbPropertyValuePtr, 4, 4 ); + +typedef ::cppu::WeakImplHelper2< NS_BEANS::XPropertySet, + NS_BEANS::XPropertyAccess > SbPropertyValuesHelper; + + +//========================================================================== + +class SbPropertyValues: public SbPropertyValuesHelper +{ + SbPropertyValueArr_Impl _aPropVals; + NS_UNO::Reference< ::com::sun::star::beans::XPropertySetInfo > _xInfo; + +private: + INT32 GetIndex_Impl( const ::rtl::OUString &rPropName ) const; + +public: + SbPropertyValues(); + virtual ~SbPropertyValues(); + + // XPropertySet + virtual NS_UNO::Reference< NS_BEANS::XPropertySetInfo > SAL_CALL + getPropertySetInfo(void) throw( NS_UNO::RuntimeException ); + virtual void SAL_CALL setPropertyValue( + const ::rtl::OUString& aPropertyName, + const NS_UNO::Any& aValue); + virtual NS_UNO::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) + throw( NS_BEANS::UnknownPropertyException, + NS_LANG::WrappedTargetException, + NS_UNO::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( + const ::rtl::OUString& aPropertyName, + const NS_UNO::Reference< NS_BEANS::XPropertyChangeListener >& ); + virtual void SAL_CALL removePropertyChangeListener( + const ::rtl::OUString& aPropertyName, + const NS_UNO::Reference< NS_BEANS::XPropertyChangeListener >& ); + virtual void SAL_CALL addVetoableChangeListener( + const ::rtl::OUString& aPropertyName, + const NS_UNO::Reference< NS_BEANS::XVetoableChangeListener >& ); + virtual void SAL_CALL removeVetoableChangeListener( + const ::rtl::OUString& aPropertyName, + const NS_UNO::Reference< NS_BEANS::XVetoableChangeListener >& ); + + // XPropertyAccess + virtual NS_UNO::Sequence< NS_BEANS::PropertyValue > SAL_CALL getPropertyValues(void); + virtual void SAL_CALL setPropertyValues(const NS_UNO::Sequence< NS_BEANS::PropertyValue >& PropertyValues_); +}; + +//========================================================================== + +typedef ::cppu::WeakImplHelper1< NS_BEANS::XPropertySetInfo > SbPropertySetInfoHelper; + +// AB 20.3.2000 Help Class for XPropertySetInfo implementation +class PropertySetInfoImpl +{ + friend class SbPropertySetInfo; + friend class SbPropertyContainer; + + NS_UNO::Sequence< NS_BEANS::Property > _aProps; + + sal_Int32 GetIndex_Impl( const ::rtl::OUString &rPropName ) const; + +public: + PropertySetInfoImpl(); + PropertySetInfoImpl( NS_UNO::Sequence< NS_BEANS::Property >& rProps ); + + // XPropertySetInfo + NS_UNO::Sequence< NS_BEANS::Property > SAL_CALL getProperties(void); + NS_BEANS::Property SAL_CALL getPropertyByName(const ::rtl::OUString& Name) + throw( NS_UNO::RuntimeException ); + sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& Name) + throw ( NS_UNO::RuntimeException ); +}; + +class SbPropertySetInfo: public SbPropertySetInfoHelper +{ + PropertySetInfoImpl aImpl; + +public: + SbPropertySetInfo(); + SbPropertySetInfo( const SbPropertyValueArr_Impl &rPropVals ); + virtual ~SbPropertySetInfo(); + + // XPropertySetInfo + virtual NS_UNO::Sequence< NS_BEANS::Property > SAL_CALL getProperties(void) + throw( NS_UNO::RuntimeException ); + virtual NS_BEANS::Property SAL_CALL getPropertyByName(const ::rtl::OUString& Name) + throw( NS_UNO::RuntimeException ); + virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& Name) + throw( NS_UNO::RuntimeException ); +}; + +//========================================================================== + +typedef ::cppu::WeakImplHelper2< NS_BEANS::XPropertySetInfo, NS_BEANS::XPropertyContainer > SbPropertyContainerHelper; + +class SbPropertyContainer: public SbPropertyContainerHelper +{ + PropertySetInfoImpl aImpl; + +public: + SbPropertyContainer(); + virtual ~SbPropertyContainer(); + + // XPropertyContainer + virtual void SAL_CALL addProperty( const ::rtl::OUString& Name, + INT16 Attributes, + const NS_UNO::Any& DefaultValue) + throw( NS_BEANS::PropertyExistException, NS_BEANS::IllegalTypeException, + NS_LANG::IllegalArgumentException, NS_UNO::RuntimeException ); + virtual void SAL_CALL removeProperty(const ::rtl::OUString& Name) + throw( NS_BEANS::UnknownPropertyException, NS_UNO::RuntimeException ); + + // XPropertySetInfo + virtual NS_UNO::Sequence< NS_BEANS::Property > SAL_CALL getProperties(void); + virtual NS_BEANS::Property SAL_CALL getPropertyByName(const ::rtl::OUString& Name) + throw( NS_UNO::RuntimeException ); + virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& Name) + throw( NS_UNO::RuntimeException ); + + // XPropertyAccess + virtual NS_UNO::Sequence< NS_BEANS::PropertyValue > SAL_CALL getPropertyValues(void); + virtual void SAL_CALL setPropertyValues(const NS_UNO::Sequence< NS_BEANS::PropertyValue >& PropertyValues_); +}; + +//========================================================================= + +class StarBASIC; +class SbxArray; + +void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); + + +#undef NS_BEANS +#undef NS_LANG +#undef NS_UNO + + + +#endif + diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx new file mode 100644 index 000000000000..904224620b83 --- /dev/null +++ b/basic/source/inc/runtime.hxx @@ -0,0 +1,473 @@ +/************************************************************************* + * + * $RCSfile: runtime.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SBRUNTIME_HXX +#define _SBRUNTIME_HXX + +#include "sb.hxx" + +// Define activates class UCBStream in iosys.cxx +#define _USE_UNO + +#ifdef _USE_UNO +#include <rtl/ustring> +#include <com/sun/star/uno/Sequence.hxx> + +using namespace rtl; +using namespace com::sun::star::uno; + + +//#include <sal/types.h> +//#include <rtl/byteseq.hxx> +//#include <rtl/ustring> + + +namespace basicEncoder +{ + +// TODO: Use exported functionality (code is copied from deamons2/ucb) +class AsciiEncoder +{ +public: + static ::rtl::OUString decodeUnoUrlParamValue(const rtl::OUString & rSource); + //static ::rtl::OUString encodeUnoUrlParamValue(const rtl::OUString & rSource); + //static ::rtl::ByteSequence decode(const ::rtl::OUString & string); + //static ::rtl::OUString encode(const ::rtl::ByteSequence & bytes); + //static void test(); +}; + +} + +#endif /* _USE_UNO */ + +class SbiInstance; // aktiver StarBASIC-Prozess +class SbiRuntime; // aktive StarBASIC-Prozedur-Instanz + +struct SbiArgvStack; // Argv stack element +struct SbiGosubStack; // GOSUB stack element +class SbiImage; // Code-Image +class SbiIoSystem; // Dateisystem +class SbiDdeControl; // DDE-Steuerung +class SbiDllMgr; // Aufrufe in DLLs +class SvNumberFormatter; // Zeit/Datumsfunktionen + +struct SbiForStack { // for/next stack: + SbiForStack* pNext; // Chain + SbxVariableRef refVar; // loop variable + SbxVariableRef refEnd; // end expression + SbxVariableRef refInc; // increment expression +}; + +#define MAXRECURSION 500 // max. 500 Rekursionen + +#define Sb_ATTR_NORMAL 0x0000 +#define Sb_ATTR_HIDDEN 0x0002 +#define Sb_ATTR_SYSTEM 0x0004 +#define Sb_ATTR_VOLUME 0x0008 +#define Sb_ATTR_DIRECTORY 0x0010 +#define Sb_ATTR_ARCHIVE 0x0020 + + +class Dir; + +class SbiRTLData +{ +public: + Dir* pDir; + INT16 nDirFlags; + USHORT nCurDirPos; +#ifdef _USE_UNO + Sequence< OUString > aDirSeq; +#endif /* _USE_UNO */ + + SbiRTLData(); + ~SbiRTLData(); +}; + +// Die Instanz entspricht einem laufenden StarBASIC. Mehrere gleichzeitig +// laufende BASICs werden ueber verkettete Instanzen verwaltet. Hier liegen +// alle Daten, die nur leben, wenn BASIC auch lebt, wie z.B. das I/O-System. + +class SbiInstance +{ + friend class SbiRuntime; + + SbiRTLData aRTLData; + + SbiIoSystem* pIosys; // Dateisystem + SbiDdeControl* pDdeCtrl; // DDE + SbiDllMgr* pDllMgr; // DLL-Calls (DECLARE) + StarBASIC* pBasic; + SvNumberFormatter* pNumberFormatter; + ULONG nStdDateIdx, nStdTimeIdx, nStdDateTimeIdx; + + SbError nErr; // aktueller Fehlercode + String aErrorMsg; // letzte Error-Message fuer $ARG + USHORT nErl; // aktuelle Fehlerzeile + BOOL bReschedule; // Flag: TRUE = Reschedule in Hauptschleife + +public: + SbiRuntime* pRun; // Call-Stack + SbiInstance* pNext; // Instanzen-Chain + + // #31460 Neues Konzept fuer StepInto/Over/Out, + // Erklaerung siehe runtime.cxx bei SbiInstance::CalcBreakCallLevel() + USHORT nCallLvl; // Call-Level (wg. Rekursion) + USHORT nBreakCallLvl; // Call-Level zum Anhalten + void CalcBreakCallLevel( USHORT nFlags ); // Gemaess Flags setzen + + SbiInstance( StarBASIC* ); + ~SbiInstance(); + + void Error( SbError ); // trappable Error + void Error( SbError, const String& rMsg ); // trappable Error mit Message + void FatalError( SbError ); // non-trappable Error + void Abort(); // Abbruch mit aktuellem Fehlercode + + void Stop(); + SbError GetErr() { return nErr; } + String GetErrorMsg() { return aErrorMsg; } + xub_StrLen GetErl() { return nErl; } + void EnableReschedule( BOOL bEnable ) { bReschedule = bEnable; } + BOOL IsReschedule( void ) { return bReschedule; } + + SbMethod* GetCaller( USHORT ); + SbModule* GetActiveModule(); + SbxArray* GetLocals( SbMethod* ); + + SbiIoSystem* GetIoSystem() { return pIosys; } + SbiDdeControl* GetDdeControl() { return pDdeCtrl; } + SbiDllMgr* GetDllMgr(); + SbiRTLData* GetRTLData() const { return (SbiRTLData*)&aRTLData; } + + SvNumberFormatter* GetNumberFormatter(); + ULONG GetStdDateIdx() const { return nStdDateIdx; } + ULONG GetStdTimeIdx() const { return nStdTimeIdx; } + ULONG GetStdDateTimeIdx() const { return nStdDateTimeIdx; } + + // #39629# NumberFormatter auch statisch anbieten + static void PrepareNumberFormatter( SvNumberFormatter*& rpNumberFormatter, + ULONG &rnStdDateIdx, ULONG &rnStdTimeIdx, ULONG &rnStdDateTimeIdx ); +}; + +SbiIoSystem* SbGetIoSystem(); // das aktuelle I/O-System + + +// Verkettbare Items, um Referenzen temporaer zu halten +struct RefSaveItem +{ + SbxVariableRef xRef; + RefSaveItem* pNext; + + RefSaveItem() { pNext = NULL; } +}; + +// #72488 Spezielle SbxVariable, die beim get das Verhalten +// einer nicht initialisierten Variable simuliert. Wenn als +// Typ SbxOBJECT verlangt wird, geht das jedoch nicht. +class UnoClassSbxVariable : public SbxVariable +{ + SbxDataType meOrgType; + BOOL mbOverWritten; + const SbiImage* mpImg; + SbiRuntime* mpRuntime; + +public: + UnoClassSbxVariable( SbxDataType eType, const SbiImage* pImg_, SbiRuntime* pRuntime_ ) + : SbxVariable( SbxVARIANT ), mpImg( pImg_ ), mpRuntime( pRuntime_ ) + { + meOrgType = eType; + mbOverWritten = FALSE; + } + UnoClassSbxVariable( const UnoClassSbxVariable& r ) + : SbxVariable( r ), meOrgType( r.meOrgType), mbOverWritten( r.mbOverWritten), + mpImg( r.mpImg ), mpRuntime( r.mpRuntime ) + {} + + virtual BOOL Get( SbxValues& ) const; + virtual BOOL Put( const SbxValues& ); + + TYPEINFO(); +}; + +// #72732 Spezielle SbxVariable, die beim put/get prueft, +// ob der Kontext fuer eine UnoClass sinnvoll ist. Sonst +// liegt eventuell ein Schreibfehler im Basic-Source vor. +class UnoClassMemberVariable : public SbxVariable +{ + SbiRuntime* mpRuntime; + BOOL bInternalUse; + +public: + UnoClassMemberVariable( SbiRuntime* pRuntime_, const SbxObjectRef& xWrapper ) + : SbxVariable( SbxVARIANT ), mpRuntime( pRuntime_ ) + { + bInternalUse = TRUE; + PutObject( xWrapper ); + bInternalUse = FALSE; + } + + virtual BOOL Get( SbxValues& ) const; + virtual BOOL Put( const SbxValues& ); + + TYPEINFO(); +}; + + +// Eine Instanz dieser Klasse wird fuer jedes ausgefuehrte Unterprogramm +// aufgesetzt. Diese Instanz ist das Herz der BASIC-Maschine und enthaelt +// nur lokale Daten. + +class SbiRuntime +{ + typedef void( SbiRuntime::*pStep0 )(); + typedef void( SbiRuntime::*pStep1 )( USHORT nOp1 ); + typedef void( SbiRuntime::*pStep2 )( USHORT nOp1, USHORT nOp2 ); + static pStep0 aStep0[]; // Opcode-Tabelle Gruppe 0 + static pStep1 aStep1[]; // Opcode-Tabelle Gruppe 1 + static pStep2 aStep2[]; // Opcode-Tabelle Gruppe 2 + + StarBASIC& rBasic; // StarBASIC-Instanz + SbiInstance* pInst; // aktiver Thread + SbModule* pMod; // aktuelles Modul + SbMethod* pMeth; // Methoden-Instanz + SbiIoSystem* pIosys; // I/O-System + const SbiImage* pImg; // Code-Image + SbxArrayRef refExprStk; // expression stack + SbxArrayRef refCaseStk; // CASE expression stack + SbxVariableRef xDummyVar; // Ersatz fuer nicht gefundene Variablen + SbiArgvStack* pArgvStk; // ARGV-Stack + SbiGosubStack* pGosubStk; // GOSUB stack + SbiForStack* pForStk; // FOR/NEXT-Stack + USHORT nExprLvl; // Tiefe des Expr-Stacks + USHORT nGosubLvl; // Zum Vermeiden von Tot-Rekursionen + const BYTE* pCode; // aktueller Code-Pointer + const BYTE* pStmnt; // Beginn des lezten Statements + const BYTE* pError; // Adresse des aktuellen Error-Handlers + const BYTE* pRestart; // Restart-Adresse + const BYTE* pErrCode; // Restart-Adresse RESUME NEXT + const BYTE* pErrStmnt; // Restart-Adresse RESUMT 0 + String aLibName; // Lib-Name fuer Declare-Call + SbxArrayRef refParams; // aktuelle Prozedur-Parameter + SbxArrayRef refLocals; // lokale Variable + SbxArrayRef refArgv; // aktueller Argv + // AB, 28.3.2000 #74254, Ein refSaveObj reicht nicht! Neu: pRefSaveList (s.u.) + //SbxVariableRef refSaveObj; // #56368 Bei StepElem Referenz sichern + short nArgc; // aktueller Argc + BOOL bRun; // TRUE: Programm ist aktiv + BOOL bError; // TRUE: Fehler behandeln + BOOL bInError; // TRUE: in einem Fehler-Handler + USHORT nFlags; // Debugging-Flags + SbError nError; // letzter Fehler + USHORT nOps; // Opcode-Zaehler + + RefSaveItem* pRefSaveList; // #74254 Temporaere Referenzen sichern + RefSaveItem* pItemStoreList; // Unbenutzte Items aufbewahren + void SaveRef( SbxVariable* pVar ) + { + RefSaveItem* pItem = pItemStoreList; + if( pItem ) + pItemStoreList = pItem->pNext; + else + pItem = new RefSaveItem(); + pItem->pNext = pRefSaveList; + pItem->xRef = pVar; + pRefSaveList = pItem; + } + void ClearRefs( void ) + { + while( pRefSaveList ) + { + RefSaveItem* pToClearItem = pRefSaveList; + pRefSaveList = pToClearItem->pNext; + pToClearItem->xRef = NULL; + pToClearItem->pNext = pItemStoreList; + pItemStoreList = pToClearItem; + } + } + + SbxVariable* FindElement + ( SbxObject* pObj, USHORT nOp1, USHORT nOp2, SbError, BOOL ); + void SetupArgs( SbxVariable*, USHORT ); + SbxVariable* CheckArray( SbxVariable* ); + + void PushVar( SbxVariable* ); // Variable push + SbxVariableRef PopVar(); // Variable pop + SbxVariable* GetTOS( short=0 ); // Variable vom TOS holen + void TOSMakeTemp(); // TOS in temp. Variable wandeln + BOOL ClearExprStack(); // Expr-Stack freigeben + + void PushGosub( const BYTE* ); // GOSUB-Element push + void PopGosub(); // GOSUB-Element pop + void ClearGosubStack(); // GOSUB-Stack freigeben + + void PushArgv(); // Argv-Element push + void PopArgv(); // Argv-Element pop + void ClearArgvStack(); // Argv-Stack freigeben + + void PushFor(); // For-Element push + void PopFor(); // For-Element pop + void ClearForStack(); // For-Stack freigeben + + void StepArith( SbxOperator ); // arithmetische Verknuepfungen + void StepUnary( SbxOperator ); // unaere Verknuepfungen + void StepCompare( SbxOperator );// Vergleiche + + void SetParameters( SbxArray* );// Parameter uebernehmen + + // MUSS NOCH IMPLEMENTIERT WERDEN + void DllCall( const String&, const String&, SbxArray*, SbxDataType, BOOL ); + + // #56204 DIM-Funktionalitaet in Hilfsmethode auslagern (step0.cxx) + void DimImpl( SbxVariableRef refVar ); + + // Die nachfolgenden Routinen werden vom Single Stepper + // gerufen und implementieren die einzelnen Opcodes + void StepNOP(), StepEXP(), StepMUL(), StepDIV(); + void StepMOD(), StepPLUS(), StepMINUS(), StepNEG(); + void StepEQ(), StepNE(), StepLT(), StepGT(); + void StepLE(), StepGE(), StepIDIV(), StepAND(); + void StepOR(), StepXOR(), StepEQV(), StepIMP(); + void StepNOT(), StepCAT(), StepLIKE(), StepIS(); + void StepCLONE(), StepOLDBASED(), StepARGC(); + void StepARGV(), StepINPUT(), StepLINPUT(), StepSTOP(); + void StepGET(), StepSET(), StepPUT(), StepPUTC(); + void StepDIM(), StepREDIM(), StepREDIMP(), StepERASE(); + void StepINITFOR(), StepNEXT(), StepERROR(); + void StepCASE(), StepENDCASE(), StepSTDERROR(); + void StepNOERROR(), StepCHANNEL(), StepCHANNEL0(), StepPRINT(); + void StepPRINTF(), StepWRITE(), StepRENAME(), StepPROMPT(); + void StepRESTART(), StepEMPTY(), StepLEAVE(); + void StepLSET(), StepRSET(); + // Alle Opcodes mit einem Operanden + void StepLOADNC( USHORT ), StepLOADSC( USHORT ), StepLOADI( USHORT ); + void StepARGN( USHORT ), StepBASED( USHORT ), StepPAD( USHORT ); + void StepJUMP( USHORT ), StepJUMPT( USHORT ); + void StepJUMPF( USHORT ), StepONJUMP( USHORT ); + void StepGOSUB( USHORT ), StepRETURN( USHORT ); + void StepTESTFOR( USHORT ), StepCASETO( USHORT ), StepERRHDL( USHORT ); + void StepRESUME( USHORT ), StepCLASS( USHORT ), StepLIB( USHORT ); + void StepCLOSE( USHORT ), StepPRCHAR( USHORT ), StepARGTYP( USHORT ); + // Alle Opcodes mit zwei Operanden + void StepRTL( USHORT, USHORT ), StepPUBLIC( USHORT, USHORT ); + void StepFIND( USHORT, USHORT ), StepELEM( USHORT, USHORT ); + void StepGLOBAL( USHORT, USHORT ), StepLOCAL( USHORT, USHORT ); + void StepPARAM( USHORT, USHORT), StepCREATE( USHORT, USHORT ); + void StepCALL( USHORT, USHORT ), StepCALLC( USHORT, USHORT ); + void StepCASEIS( USHORT, USHORT ), StepSTMNT( USHORT, USHORT ); + void StepOPEN( USHORT, USHORT ), StepSTATIC( USHORT, USHORT ); + void StepTCREATE(USHORT,USHORT), StepDCREATE(USHORT,USHORT); +public: + xub_StrLen nLine,nCol1,nCol2; // aktuelle Zeile, Spaltenbereich + SbiRuntime* pNext; // Stack-Chain + + SbiRuntime( SbModule*, SbMethod*, USHORT ); + ~SbiRuntime(); + void Error( SbError ); // Fehler setzen, falls != 0 + void FatalError( SbError ); // Fehlerbehandlung=Standard, Fehler setzen + BOOL Step(); // Einzelschritt (ein Opcode) + void Stop() { bRun = FALSE; } + SbMethod* GetMethod() { return pMeth; } + SbModule* GetModule() { return pMod; } + USHORT GetDebugFlags() { return nFlags; } + void SetDebugFlags( USHORT nFl ) { nFlags = nFl; } + SbMethod* GetCaller(); + SbxArray* GetLocals(); + SbxArray* GetParams(); + + SbxBase* FindElementExtern( const String& rName ); +}; + +// Hilfsfunktion, um aktives Basic zu finden +StarBASIC* GetCurrentBasic( StarBASIC* pRTBasic ); + +// Get information if security restrictions should be +// used (File IO based on UCB, no RTL function SHELL +// no DDE functionality, no DLLCALL) in basic because +// of portal "virtual" users (portal user != UNIX user) +// (Implemented in iosys.cxx) +BOOL needSecurityRestrictions( void ); + +// Returns TRUE if UNO is available, otherwise the old +// file system implementation has to be used +// (Implemented in iosys.cxx) +BOOL hasUno( void ); + +// Converts possibly relative paths to absolute paths +// according to the setting done by ChDir/ChDrive +// (Implemented in methods.cxx) +String getFullPath( const String& aRelPath ); + +// Sets (virtual) current path for UCB file access +void implChDir( const String& aDir ); + +// Sets (virtual) current drive for UCB file access +void implChDrive( const String& aDrive ); + +// Returns (virtual) current path for UCB file access +String implGetCurDir( void ); + +// Implementation of StepRENAME with UCB +// (Implemented in methods.cxx, so step0.cxx +// has not to be infected with UNO) +void implStepRenameUCB( const String& aSource, const String& aDest ); + +#endif diff --git a/basic/source/inc/sbcomp.hxx b/basic/source/inc/sbcomp.hxx new file mode 100644 index 000000000000..ede7182de510 --- /dev/null +++ b/basic/source/inc/sbcomp.hxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * $RCSfile: sbcomp.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SBCOMP_HXX +#define _SBCOMP_HXX + +// das folgende habe ich der neuen Datei von MD entnommen! (MT) +#include "sbintern.hxx" +#include "token.hxx" // Tokenizer +#include "symtbl.hxx" // Symbolverwaltung +#include "parser.hxx" // Parser +#include "codegen.hxx" // Code-Generator + +#endif diff --git a/basic/source/inc/sbintern.hxx b/basic/source/inc/sbintern.hxx new file mode 100644 index 000000000000..19ca73c6833c --- /dev/null +++ b/basic/source/inc/sbintern.hxx @@ -0,0 +1,131 @@ +/************************************************************************* + * + * $RCSfile: sbintern.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SB_INTERN_HXX +#define _SB_INTERN_HXX + +#include <svtools/sbxfac.hxx> +#include "sb.hxx" + +class SbUnoFactory; +class SbiInstance; +class SbModule; + + +class SbiFactory : public SbxFactory +{ +public: + virtual SbxBase* Create( UINT16 nSbxId, UINT32 = SBXCR_SBX ); + virtual SbxObject* CreateObject( const String& ); +}; + +// Stack fuer die im Fehlerfall abgebaute SbiRuntime Kette +class SbErrorStackEntry +{ +public: + SbErrorStackEntry(SbMethodRef aM, xub_StrLen nL, xub_StrLen nC1, xub_StrLen nC2) + : aMethod(aM), nLine(nL), nCol1(nC1), nCol2(nC2) {} + SbMethodRef aMethod; + xub_StrLen nLine; + xub_StrLen nCol1, nCol2; +}; + +SV_DECL_PTRARR_DEL(SbErrorStack, SbErrorStackEntry*, 1, 1) + + + +struct SbiGlobals +{ + SbiInstance* pInst; // alle aktiven Runtime-Instanzen + SbiFactory* pSbFac; // StarBASIC-Factory + SbUnoFactory* pUnoFac; // Factory fuer Uno-Structs bei DIM AS NEW + SbModule* pMod; // aktuell aktives Modul + SbModule* pCompMod; // aktuell compiliertes Modul + short nInst; // Anzahl BASICs + Link aErrHdl; // globaler Error-Handler + Link aBreakHdl; // globaler Break-Handler + SbError nCode; // aktueller Fehlercode + xub_StrLen nLine; // aktuelle Zeile + xub_StrLen nCol1,nCol2; // aktuelle Spalten (von,bis) + BOOL bCompiler; // Flag fuer Compiler-Error + BOOL bCompWait; // Flag, beim Compilieren WaitCursor eingeschaltet ist + BOOL bGlobalInitErr; // Beim GlobalInit trat ein Compiler-Fehler auf + BOOL bRunInit; // TRUE, wenn RunInit vom Basic aktiv ist + String aErrMsg; // Puffer fuer GetErrorText() + SbLanguageMode eLanguageMode; // Flag fuer Visual-Basic-Script-Modus + SbErrorStack* pErrStack; // Stack fuer die im Fehlerfall abgebaute SbiRuntime Kette + + SbiGlobals(); + ~SbiGlobals(); +}; + +// Utility-Makros und -Routinen + +SbiGlobals* GetSbData(); + +#define pINST GetSbData()->pInst +#define pMOD GetSbData()->pMod +#define pCMOD GetSbData()->pCompMod +#define pSBFAC GetSbData()->pSbFac +#define pUNOFAC GetSbData()->pUnoFac + +#endif + diff --git a/basic/source/inc/sbjsmeth.hxx b/basic/source/inc/sbjsmeth.hxx new file mode 100644 index 000000000000..1239aafd3fc5 --- /dev/null +++ b/basic/source/inc/sbjsmeth.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * $RCSfile: sbjsmeth.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef _SB_SBJSMETH_HXX +#define _SB_SBJSMETH_HXX + +#ifndef _SB_SBMETH_HXX +#include <sbmeth.hxx> +#endif + +// Basic-Modul fuer JavaScript-Sourcen. +// Alle Basic-spezifischen Methoden muessen virtuell ueberladen und deaktiviert +// werden. Die Unterscheidung von normalen Modulen erfolgt uebr RTTI. + +class SbJScriptMethod : public SbMethod +{ +public: + SbJScriptMethod( const String&, SbxDataType, SbModule* ); + virtual ~SbJScriptMethod(); + + SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_JSCRIPTMETH,2); + TYPEINFO(); +}; + +#ifndef __SB_SBJSCRIPTMETHODREF_HXX +#define __SB_SBJSCRIPTMETHODREF_HXX +SV_DECL_IMPL_REF(SbJScriptMethod) +#endif + +#endif diff --git a/basic/source/inc/sbjsmod.hxx b/basic/source/inc/sbjsmod.hxx new file mode 100644 index 000000000000..265f21e7bd96 --- /dev/null +++ b/basic/source/inc/sbjsmod.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * $RCSfile: sbjsmod.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SB_SBJSMOD_HXX +#define _SB_SBJSMOD_HXX + +#include <sbmod.hxx> + +// Basic-Modul fuer JavaScript-Sourcen. +// Alle Basic-spezifischen Methoden muessen virtuell ueberladen und deaktiviert +// werden. Die Unterscheidung von normalen Modulen erfolgt uebr RTTI. + +class SbJScriptModule : public SbModule +{ + virtual BOOL LoadData( SvStream&, USHORT ); + virtual BOOL StoreData( SvStream& ) const; +public: + SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_JSCRIPTMOD,1); + TYPEINFO(); + SbJScriptModule( const String& ); // DURCHREICHEN +}; + +#endif + + + diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx new file mode 100644 index 000000000000..1ec293c47448 --- /dev/null +++ b/basic/source/inc/sbunoobj.hxx @@ -0,0 +1,226 @@ +/************************************************************************* + * + * $RCSfile: sbunoobj.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef SB_UNO_OBJ +#define SB_UNO_OBJ + +#ifndef _SBX_SBXOBJECT_HXX //autogen +#include <svtools/sbxobj.hxx> +#endif +#ifndef __SBX_SBXMETHOD_HXX //autogen +#include <svtools/sbxmeth.hxx> +#endif +#ifndef __SBX_SBXPROPERTY_HXX //autogen +#include <svtools/sbxprop.hxx> +#endif +#ifndef __SBX_SBX_FACTORY_HXX //autogen +#include <svtools/sbxfac.hxx> +#endif + +#ifndef _COM_SUN_STAR_BEANS_XMATERIALHOLDER_HPP_ +#include <com/sun/star/beans/XMaterialHolder.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XEXACTNAME_HPP_ +#include <com/sun/star/beans/XExactName.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XINTROSPECTIONACCESS_HPP_ +#include <com/sun/star/beans/XIntrospectionAccess.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XINTROSPECTION_HPP_ +#include <com/sun/star/beans/XIntrospection.hpp> +#endif +#ifndef _COM_SUN_STAR_SCRIPT_XINVOCATION_HPP_ +#include <com/sun/star/script/XInvocation.hpp> +#endif +#ifndef _COM_SUN_STAR_REFLECTION_XIDLCLASS_HPP_ +#include <com/sun/star/reflection/XIdlClass.hpp> +#endif + +using namespace com::sun::star::uno; +using namespace com::sun::star::beans; +using namespace com::sun::star::script; +using namespace com::sun::star::reflection; + +class SbUnoObject: public SbxObject +{ + Reference< XIntrospectionAccess > mxUnoAccess; + Reference< XMaterialHolder > mxMaterialHolder; + Reference< XInvocation > mxInvocation; + Reference< XExactName > mxExactName; + BOOL bNeedIntrospection; + Any maTmpUnoObj; // Only to save obj for doIntrospection! + + // Hilfs-Methode zum Anlegen der dbg_-Properties + void implCreateDbgProperties( void ); + + // Hilfs-Methode zum Anlegen aller Properties und Methoden + // (Beim on-demand-Mechanismus erforderlich fuer die dbg_-Properties) + void implCreateAll( void ); + +public: + TYPEINFO(); + SbUnoObject( const String& aName, const Any& aUnoObj_ ); + ~SbUnoObject(); + + // #76470 Introspection on Demand durchfuehren + void doIntrospection( void ); + + // Find ueberladen, um z.B. NameAccess zu unterstuetzen + virtual SbxVariable* Find( const String&, SbxClassType ); + + // Wert rausgeben + Any getUnoAny( void ); + Reference< XIntrospectionAccess > getIntrospectionAccess( void ) { return mxUnoAccess; } + Reference< XInvocation > getInvocation( void ) { return mxInvocation; } + + void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& ); +}; +SV_DECL_IMPL_REF(SbUnoObject); + + +// #67781 Rueckgabewerte der Uno-Methoden loeschen +void clearUnoMethods( void ); + +class SbUnoMethod : public SbxMethod +{ + friend class SbUnoObject; + friend void clearUnoMethods( void ); + + Reference< XIdlMethod > m_xUnoMethod; + Sequence<ParamInfo>* pParamInfoSeq; + + // #67781 Verweis auf vorige und naechste Methode in der Methoden-Liste + SbUnoMethod* pPrev; + SbUnoMethod* pNext; + +public: + TYPEINFO(); + + SbUnoMethod( const String& aName, SbxDataType eSbxType, Reference< XIdlMethod > xUnoMethod_ ); + virtual ~SbUnoMethod(); + //virtual SbxInfo* GetInfo() { return NULL; } + + const Sequence<ParamInfo>& getParamInfos( void ); +}; + + +class SbUnoProperty : public SbxProperty +{ + friend class SbUnoObject; + + // Daten der Uno-Property + Property aUnoProp; + UINT32 nId; + + virtual ~SbUnoProperty(); +public: + TYPEINFO(); + SbUnoProperty( const String& aName, SbxDataType eSbxType, + const Property& aUnoProp_, UINT32 nId_ ); +}; + +// Factory-Klasse fuer das Anlegen von Uno-Structs per DIM AS NEW +class SbUnoFactory : public SbxFactory +{ +public: + virtual SbxBase* Create( UINT16 nSbxId, UINT32 = SBXCR_SBX ); + virtual SbxObject* CreateObject( const String& ); +}; + +// Wrapper fuer eine Uno-Klasse +class SbUnoClass: public SbxObject +{ + const Reference< XIdlClass > m_xClass; +public: + TYPEINFO(); + SbUnoClass( const String& aName, const Reference< XIdlClass >& xClass_ ) + : SbxObject( aName ), m_xClass( xClass_ ) {} + //~SbUnoClass(); + + // Find ueberladen, um Elemente on Demand anzulegen + virtual SbxVariable* Find( const String&, SbxClassType ); + + // Wert rausgeben + const Reference< XIdlClass >& getUnoClass( void ) { return m_xClass; } + + //void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& ); +}; +SV_DECL_IMPL_REF(SbUnoClass); + + +// Funktion, um einen globalen Bezeichner im +// UnoScope zu suchen und fuer Sbx zu wrappen +SbxVariable* findUnoClass( const String& rName ); + + +class StarBASIC; + +// Impl-Methoden fuer RTL +void RTL_Impl_CreateUnoStruct( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); +void RTL_Impl_CreateUnoService( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); +void RTL_Impl_GetProcessServiceManager( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); +void RTL_Impl_HasInterfaces( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); +void RTL_Impl_IsUnoStruct( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); +void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ); + +#endif + + diff --git a/basic/source/inc/scanner.hxx b/basic/source/inc/scanner.hxx new file mode 100644 index 000000000000..760f3f2ba238 --- /dev/null +++ b/basic/source/inc/scanner.hxx @@ -0,0 +1,136 @@ +/************************************************************************* + * + * $RCSfile: scanner.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SCANNER_HXX +#define _SCANNER_HXX + +#ifndef _STRING_HXX //autogen +#include <tools/string.hxx> +#endif +#ifndef _SBERRORS_HXX +#include "sberrors.hxx" +#endif + +// Der Scanner ist stand-alone, d.h. er kann von ueberallher verwendet +// werden. Eine BASIC-Instanz ist fuer Fehlermeldungen notwendig. Ohne +// BASIC werden die Fehler nur gezaehlt. Auch ist Basic notwendig, wenn +// eine erweiterte SBX-Variable zur Erkennung von Datentypen etc. verwendet +// werden soll. + +class StarBASIC; + +class SbiScanner +{ + String aBuf; // Input-Puffer + String aLine; // aktuelle Zeile + const sal_Unicode* pLine; // Pointer + const sal_Unicode* pSaveLine; // Merker fuer Line +protected: + String aSym; // Symbolpuffer + String aError; // Fehler-String + SbxDataType eScanType; // evtl. Datentyp + StarBASIC* pBasic; // Instanz fuer Fehler-Callbacks + double nVal; // numerischer Wert + short nCurCol1; // aktuelle Spalte 1 + short nSavedCol1; // gerettete Spalte 1 + short nCol; // aktuelle Spaltennummer + short nErrors; // Anzahl Fehler + short nColLock; // Lock-Zaehler fuer Col1 + USHORT nBufPos; // aktuelle Buffer-Pos + USHORT nLine; // aktuelle Zeile + USHORT nCol1, nCol2; // aktuelle 1. und 2. Spalte + BOOL bSymbol; // TRUE: Symbol gescannt + BOOL bNumber; // TRUE: Zahl gescannt + BOOL bSpaces; // TRUE: Whitespace vor Token + BOOL bErrors; // TRUE: Fehler generieren + BOOL bAbort; // TRUE: abbrechen + BOOL bHash; // TRUE: # eingelesen + BOOL bError; // TRUE: Fehler generieren + BOOL bUsedForHilite; // TRUE: Nutzung fuer Highlighting + + void GenError( SbError ); +public: + SbiScanner( const String&, StarBASIC* = NULL ); + ~SbiScanner(); + + void EnableErrors() { bError = FALSE; } + BOOL IsHash() { return bHash; } + BOOL WhiteSpace() { return bSpaces; } + short GetErrors() { return nErrors; } + short GetLine() { return nLine; } + short GetCol1() { return nCol1; } + short GetCol2() { return nCol2; } + void SetCol1( short n ) { nCol1 = n; } + StarBASIC* GetBasic() { return pBasic; } + void SaveLine(void) { pSaveLine = pLine; } + void RestoreLine(void) { pLine = pSaveLine; } + void LockColumn(); + void UnlockColumn(); + BOOL DoesColonFollow(); + + BOOL NextSym(); // naechstes Symbol lesen + const String& GetSym() { return aSym; } + SbxDataType GetType() { return eScanType; } + double GetDbl() { return nVal; } +}; + + +#endif diff --git a/basic/source/inc/stdobj.hxx b/basic/source/inc/stdobj.hxx new file mode 100644 index 000000000000..5313f108ef3f --- /dev/null +++ b/basic/source/inc/stdobj.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * $RCSfile: stdobj.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SBSTDOBJ_HXX +#define _SBSTDOBJ_HXX + +#ifndef _SBX_SBXOBJECT_HXX //autogen +#include <svtools/sbxobj.hxx> +#endif + +class StarBASIC; +class SbStdFactory; + +class SbiStdObject : public SbxObject +{ + SbStdFactory* pStdFactory; + + ~SbiStdObject(); + SbxInfo* GetInfo( short ); + virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ); +public: + SbiStdObject( const String&, StarBASIC* ); + virtual SbxVariable* Find( const String&, SbxClassType ); + virtual void SetModified( BOOL ); +}; + +#endif diff --git a/basic/source/inc/symtbl.hxx b/basic/source/inc/symtbl.hxx new file mode 100644 index 000000000000..76d0a9433708 --- /dev/null +++ b/basic/source/inc/symtbl.hxx @@ -0,0 +1,266 @@ +/************************************************************************* + * + * $RCSfile: symtbl.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SYMTBL_HXX +#define _SYMTBL_HXX + +#ifndef _SVARRAY_HXX //autogen +#include <svtools/svarray.hxx> +#endif +#ifndef _STRING_HXX //autogen +#include <tools/string.hxx> +#endif +#ifndef _SBXDEF_HXX //autogen +#include <svtools/sbxdef.hxx> +#endif + +class SbiSymDef; // Basisklasse +class SbiProcDef; // Prozedur +class SbiConstDef; // Konstante +class SbiSymPool; // Symbol-Pool +class SbiStringPool; // gepoolte Strings + +class SvStream; +class SbiParser; + +enum SbiSymScope { SbLOCAL, SbPARAM, SbPUBLIC, SbGLOBAL, SbRTL }; + +/////////////////////////////////////////////////////////////////////////// + +// Der String-Pool nimmt String-Eintraege auf und sorgt dafuer, +// dass sie nicht doppelt vorkommen. + +SV_DECL_PTRARR_DEL(SbiStrings,String*,5,5) + +class SbiStringPool { // String-Pool + SbiStrings aData; // Daten + String aEmpty; // for convenience + SbiParser* pParser; // der Parser +public: + SbiStringPool( SbiParser* ); + ~SbiStringPool(); + USHORT GetSize() const { return aData.Count(); } + // AB 8.4.1999, Default wegen #64236 auf TRUE geaendert + // Wenn der Bug sauber behoben ist, wieder auf FALSE aendern. + short Add( const String&, BOOL=TRUE ); + short Add( double, SbxDataType ); + const String& Find( USHORT ) const; + SbiParser* GetParser() { return pParser; } +}; + +/////////////////////////////////////////////////////////////////////////// + +SV_DECL_PTRARR_DEL(SbiSymbols,SbiSymDef*,5,5) + +class SbiSymPool { // Symbol-Pool + friend class SbiSymDef; + friend class SbiProcDef; +protected: + SbiStringPool& rStrings; // verwendeter Stringpool + SbiSymbols aData; // Daten + SbiSymPool* pParent; // uebergeordneter Symbol-Pool + SbiParser* pParser; // der Parser + SbiSymScope eScope; // Scope des Pools + USHORT nProcId; // aktuelles ProcId fuer STATIC-Variable + USHORT nCur; // Iterator +public: + SbiSymPool( SbiStringPool&, SbiSymScope ); + ~SbiSymPool(); + + void Clear(); + + void SetParent( SbiSymPool* p ) { pParent = p; } + void SetProcId( short n ) { nProcId = n; } + USHORT GetSize() const { return aData.Count(); } + SbiSymScope GetScope() const { return eScope; } + void SetScope( SbiSymScope s ) { eScope = s; } + SbiParser* GetParser() { return pParser; } + + SbiSymDef* AddSym( const String& ); // Symbol hinzufuegen + SbiProcDef* AddProc( const String& );// Prozedur hinzufuegen + void Add( SbiSymDef* ); // Symbol uebernehmen + SbiSymDef* Find( const String& ) const;// Variablenname + SbiSymDef* FindId( USHORT ) const; // Variable per ID suchen + SbiSymDef* Get( USHORT ) const; // Variable per Position suchen + SbiSymDef* First(), *Next(); // Iteratoren + + USHORT Define( const String& ); // Label definieren + USHORT Reference( const String& ); // Label referenzieren + void CheckRefs(); // offene Referenzen suchen +}; + +/////////////////////////////////////////////////////////////////////////// + +class SbiSymDef { // Allgemeiner Symboleintrag + friend class SbiSymPool; +protected: + String aName; // Name des Eintrags + SbxDataType eType; // Typ des Eintrags + SbiSymPool* pIn; // Parent-Pool + SbiSymPool* pPool; // Pool fuer Unterelemente + short nLen; // Stringlaenge bei STRING*n + short nDims; // Array-Dimensionen + USHORT nId; // Symbol-Nummer + USHORT nTypeId; // String-ID des Datentyps (Dim X AS Dytentyp) + USHORT nProcId; // aktuelles ProcId fuer STATIC-Variable + USHORT nPos; // Positions-Nummer + USHORT nChain; // Backchain-Kette + BOOL bNew : 1; // TRUE: Dim As New... + BOOL bChained : 1; // TRUE: Symbol ist in Code definiert + BOOL bByVal : 1; // TRUE: ByVal-Parameter + BOOL bOpt : 1; // TRUE: optionaler Parameter + BOOL bStatic : 1; // TRUE: STATIC-Variable + BOOL bAs : 1; // TRUE: Datentyp per AS XXX definiert +public: + SbiSymDef( const String& ); + virtual ~SbiSymDef(); + virtual SbiProcDef* GetProcDef(); + virtual SbiConstDef* GetConstDef(); + + SbxDataType GetType() const { return eType; } + virtual void SetType( SbxDataType ); + const String& GetName(); + SbiSymScope GetScope() const; + USHORT GetProcId() const{ return nProcId; } + USHORT GetAddr() const { return nChain; } + USHORT GetId() const { return nId; } + USHORT GetTypeId() const{ return nTypeId; } + void SetTypeId( USHORT n ) { nTypeId = n; eType = SbxOBJECT; } + USHORT GetPos() const { return nPos; } + void SetLen( short n ){ nLen = n; } + short GetLen() const { return nLen; } + void SetDims( short n ) { nDims = n; } + short GetDims() const { return nDims; } + BOOL IsDefined() const{ return bChained; } + void SetOptional() { bOpt = TRUE; } + void SetByVal() { bByVal = TRUE; } + void SetStatic() { bStatic = TRUE; } + void SetNew() { bNew = TRUE; } + void SetDefinedAs() { bAs = TRUE; } + BOOL IsOptional() const{ return bOpt; } + BOOL IsByVal() const { return bByVal; } + BOOL IsStatic() const { return bStatic; } + BOOL IsNew() const { return bNew; } + BOOL IsDefinedAs() const { return bAs; } + + SbiSymPool& GetPool(); + USHORT Define(); // Symbol in Code definieren + USHORT Reference(); // Symbol in Code referenzieren + +private: + SbiSymDef( const SbiSymDef& ); + +}; + +class SbiProcDef : public SbiSymDef { // Prozedur-Definition (aus Basic): + SbiSymPool aParams; // Parameter + SbiSymPool aLabels; // lokale Sprungziele + String aLibName; // LIB "name" + String aAlias; // ALIAS "name" + USHORT nLine1, nLine2; // Zeilenbereich + BOOL bCdecl : 1; // TRUE: CDECL angegeben + BOOL bPublic : 1; // TRUE: proc ist PUBLIC +public: + SbiProcDef( SbiParser*, const String& ); // Name + virtual ~SbiProcDef(); + virtual SbiProcDef* GetProcDef(); + virtual void SetType( SbxDataType ); + SbiSymPool& GetParams() { return aParams; } + SbiSymPool& GetLabels() { return aLabels; } + SbiSymPool& GetLocals() { return GetPool();} + String& GetLib() { return aLibName; } + String& GetAlias() { return aAlias; } + void SetPublic( BOOL b ) { bPublic = b; } + BOOL IsPublic() const { return bPublic; } + void SetCdecl( BOOL b = TRUE) { bCdecl = b; } + BOOL IsCdecl() const { return bCdecl; } + void SetLine1( USHORT n ) { nLine1 = n; } + USHORT GetLine1() const { return nLine1; } + void SetLine2( USHORT n ) { nLine2 = n; } + USHORT GetLine2() const { return nLine2; } + + // Match mit einer Forward-Deklaration. Die Parameternamen + // werden abgeglichen und die Forward-Deklaration wird + // durch this ersetzt + void Match( SbiProcDef* pForward ); + +private: + SbiProcDef( const SbiProcDef& ); + +}; + +class SbiConstDef : public SbiSymDef +{ + double nVal; + String aVal; +public: + SbiConstDef( const String& ); + virtual ~SbiConstDef(); + virtual SbiConstDef* GetConstDef(); + void Set( double, SbxDataType ); + void Set( const String& ); + double GetValue() { return nVal; } + const String& GetString() { return aVal; } +}; + + +#endif + diff --git a/basic/source/inc/token.hxx b/basic/source/inc/token.hxx new file mode 100644 index 000000000000..022f490895e1 --- /dev/null +++ b/basic/source/inc/token.hxx @@ -0,0 +1,199 @@ +/************************************************************************* + * + * $RCSfile: token.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOKEN_HXX +#define _TOKEN_HXX + +#ifndef _SCANNER_HXX +#include "scanner.hxx" +#endif +#ifndef _SBDEF_HXX +#include "sbdef.hxx" +#endif + +#if defined( SHARED ) +#define SbiTokenSHAREDTMPUNDEF +#undef SHARED +#endif + +// Der Tokenizer ist stand-alone, d.h. er kann von ueberallher verwendet +// werden. Eine BASIC-Instanz ist fuer Fehlermeldungen notwendig. Ohne +// BASIC werden die Fehler nur gezaehlt. Auch ist Basic notwendig, wenn +// eine erweiterte SBX-Variable zur Erkennung von Datentypen etc. verwendet +// werden soll. + +enum SbiToken { + NIL = 0, + // Token zwischen 0x20 und 0x3F sind Literale: + LPAREN = '(', RPAREN = ')', COMMA = ',', DOT = '.', EXCLAM = '!', + HASH = '#', SEMICOLON = ';', + + // Anweisungen: + FIRSTKWD = 0x40, + AS = FIRSTKWD, ALIAS, ASSIGN, + CALL, CASE, CLOSE, COMPARE, _CONST_, + DECLARE, DIM, DO, + + // in der Reihenfolge der Datentyp-Enums! + DEFINT, DEFLNG, DEFSNG, DEFDBL, DEFCUR, DEFDATE, DEFSTR, DEFOBJ, + DEFERR, DEFBOOL, DEFVAR, + // in der Reihenfolge der Datentyp-Enums! + DATATYPE1, + TINTEGER = DATATYPE1, + TLONG, TSINGLE, TDOUBLE, TCURRENCY, TDATE, TSTRING, TOBJECT, + _ERROR_, TBOOLEAN, TVARIANT, + DATATYPE2 = TVARIANT, + + EACH, ELSE, ELSEIF, END, ERASE, EXIT, + FOR, FUNCTION, + GLOBAL, GOSUB, GOTO, + IF, _IN_, INPUT, + LET, LINE, LINEINPUT, LOCAL, LOOP, LPRINT, LSET, + NAME, NEW, NEXT, + ON, OPEN, OPTION, + PRINT, PRIVATE, PUBLIC, + REDIM, REM, RESUME, RETURN, RSET, + SELECT, SET, SHARED, STATIC, STEP, STOP, SUB, + TEXT, THEN, TO, TYPE, + UNTIL, + WEND, WHILE, WITH, WRITE, + ENDIF, ENDFUNC, ENDSUB, ENDTYPE, ENDSELECT, ENDWITH, + // Ende aller Keywords + LASTKWD = ENDWITH, + // Statement-Ende + EOS, EOLN, + // Operatoren: + EXPON, NEG, MUL, + DIV, IDIV, MOD, PLUS, MINUS, + EQ, NE, LT, GT, LE, GE, + NOT, AND, OR, XOR, EQV, + IMP, CAT, LIKE, IS, + // Sonstiges: + FIRSTEXTRA, + NUMBER=FIRSTEXTRA, FIXSTRING, SYMBOL, _CDECL_, BYVAL, + OUTPUT, RANDOM, APPEND, BINARY, ACCESS, + LOCK, READ, PRESERVE, BASE, ANY, LIB, _OPTIONAL_, + EXPLICIT, + + // Ab hier kommen JavaScript-Tokens (gleiches enum, damit gleicher Typ) + FIRSTJAVA, + JS_BREAK=FIRSTJAVA, JS_CONTINUE, JS_FOR, JS_FUNCTION, JS_IF, JS_NEW, + JS_RETURN, JS_THIS, JS_VAR, JS_WHILE, JS_WITH, + + // JavaScript-Operatoren + // _ASS_ = Assignment + JS_COMMA, JS_ASSIGNMENT, JS_ASS_PLUS, JS_ASS_MINUS, JS_ASS_MUL, + JS_ASS_DIV, JS_ASS_MOD, JS_ASS_LSHIFT, JS_ASS_RSHIFT, JS_ASS_RSHIFT_Z, + JS_ASS_AND, JS_ASS_XOR, JS_ASS_OR, + JS_COND_QUEST, JS_COND_SEL, JS_LOG_OR, JS_LOG_AND, JS_BIT_OR, + JS_BIT_XOR, JS_BIT_AND, JS_EQ, JS_NE, JS_LT, JS_LE, + JS_GT, JS_GE, JS_LSHIFT, JS_RSHIFT, JS_RSHIFT_Z, + JS_PLUS, JS_MINUS, JS_MUL, JS_DIV, JS_MOD, JS_LOG_NOT, JS_BIT_NOT, + JS_INC, JS_DEC, JS_LPAREN, JS_RPAREN, JS_LINDEX, JS_RINDEX +}; + +#ifdef SbiTokenSHAREDTMPUNDEF +#define SHARED +#undef SbiTokenSHAREDTMPUNDEF +#endif + +class SbiTokenizer : public SbiScanner { +protected: + SbiToken eCurTok; // aktuelles Token + SbiToken ePush; // Pushback-Token + USHORT nPLine, nPCol1, nPCol2; // Pushback-Location + BOOL bEof; // TRUE bei Dateiende + BOOL bEos; // TRUE bei Statement-Ende + BOOL bKeywords; // TRUE, falls Keywords geparst werden + BOOL bAs; // letztes Keyword war AS +public: + SbiTokenizer( const String&, StarBASIC* = NULL ); + ~SbiTokenizer(); + + inline BOOL IsEof() { return bEof; } + inline BOOL IsEos() { return bEos; } + + void Push( SbiToken ); // Pushback eines Tokens + const String& Symbol( SbiToken );// Rueckumwandlung + + SbiToken Peek(); // das naechste Token lesen + SbiToken Next(); // Ein Token lesen + BOOL MayBeLabel( BOOL= FALSE ); // Kann es ein Label sein? + + void Hilite( SbTextPortions& ); // Syntax-Highlighting + + void Error( SbError c ) { GenError( c ); } + void Error( SbError, SbiToken ); + void Error( SbError, const char* ); + void Error( SbError, String ); + + void Keywords( BOOL b ) { bKeywords = b; } + + static BOOL IsEoln( SbiToken t ) + { return BOOL( t == EOS || t == EOLN || t == REM ); } + static BOOL IsKwd( SbiToken t ) + { return BOOL( t >= FIRSTKWD && t <= LASTKWD ); } + static BOOL IsExtra( SbiToken t ) + { return BOOL( t >= FIRSTEXTRA ); } +}; + + +#endif diff --git a/basic/source/runtime/basrdll.cxx b/basic/source/runtime/basrdll.cxx new file mode 100644 index 000000000000..01c7ed0922c4 --- /dev/null +++ b/basic/source/runtime/basrdll.cxx @@ -0,0 +1,141 @@ +/************************************************************************* + * + * $RCSfile: basrdll.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SHL_HXX //autogen +#include <tools/shl.hxx> +#endif +#ifndef _SV_SVAPP_HXX //autogen +#include <vcl/svapp.hxx> +#endif +#ifndef _SOLAR_HRC +#include <svtools/solar.hrc> +#endif +#ifndef _INTN_HXX //autogen +#include <tools/intn.hxx> +#endif +#ifndef _TOOLS_DEBUG_HXX //autogen +#include <tools/debug.hxx> +#endif +#ifndef _SV_MSGBOX_HXX //autogen +#include <vcl/msgbox.hxx> +#endif + +#include <sbstar.hxx> +#include <basrdll.hxx> +#include <basrid.hxx> +#include <sb.hrc> + +BasicResId::BasicResId( USHORT nId ): + ResId( nId, (*(BasicDLL**)GetAppData(SHL_BASIC))->GetResMgr() ) +{ +} + +BasicDLL::BasicDLL() +{ + *(BasicDLL**)GetAppData(SHL_BASIC) = this; + pResMgr = NULL; + bDebugMode = FALSE; + bBreakEnabled = TRUE; +} + +BasicDLL::~BasicDLL() +{ + delete pResMgr; +} + +void BasicDLL::EnableBreak( BOOL bEnable ) +{ + BasicDLL* pThis = *(BasicDLL**)GetAppData(SHL_BASIC); + DBG_ASSERT( pThis, "BasicDLL::EnableBreak: Noch keine Instanz!" ); + if ( pThis ) + pThis->bBreakEnabled = bEnable; +} + +void BasicDLL::SetDebugMode( BOOL bDebugMode ) +{ + BasicDLL* pThis = *(BasicDLL**)GetAppData(SHL_BASIC); + DBG_ASSERT( pThis, "BasicDLL::EnableBreak: Noch keine Instanz!" ); + if ( pThis ) + pThis->bDebugMode = bDebugMode; +} + + +void BasicDLL::BasicBreak() +{ + //bJustStopping: Wenn jemand wie wild x-mal STOP drueckt, aber das Basic + // nicht schnell genug anhaelt, kommt die Box ggf. oefters... + static BOOL bJustStopping = FALSE; + + BasicDLL* pThis = *(BasicDLL**)GetAppData(SHL_BASIC); + DBG_ASSERT( pThis, "BasicDLL::EnableBreak: Noch keine Instanz!" ); + if ( pThis ) + { + if ( StarBASIC::IsRunning() && !bJustStopping && ( pThis->bBreakEnabled || pThis->bDebugMode ) ) + { + bJustStopping = TRUE; + StarBASIC::Stop(); + String aMessageStr( BasicResId( IDS_SBERR_TERMINATED ) ); + InfoBox( 0, aMessageStr ).Execute(); + bJustStopping = FALSE; + } + } +} + diff --git a/basic/source/runtime/ddectrl.cxx b/basic/source/runtime/ddectrl.cxx new file mode 100644 index 000000000000..90dc5a53a00b --- /dev/null +++ b/basic/source/runtime/ddectrl.cxx @@ -0,0 +1,232 @@ +/************************************************************************* + * + * $RCSfile: ddectrl.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _ERRCODE_HXX //autogen +#include <tools/errcode.hxx> +#endif +#ifndef _SVDDE_HXX //autogen +#include <svtools/svdde.hxx> +#endif +#pragma hdrstop +#include "ddectrl.hxx" +#ifndef _SBERRORS_HXX +#include <sberrors.hxx> +#endif + +//#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBRUNTIME, SBRUNTIME_CODE ) + +#define DDE_FREECHANNEL ((DdeConnection*)0xffffffff) + +#define DDE_FIRSTERR 0x4000 +#define DDE_LASTERR 0x4011 + +static const SbError nDdeErrMap[] = +{ + /* DMLERR_ADVACKTIMEOUT */ 0x4000, SbERR_DDE_TIMEOUT, + /* DMLERR_BUSY */ 0x4001, SbERR_DDE_BUSY, + /* DMLERR_DATAACKTIMEOUT */ 0x4002, SbERR_DDE_TIMEOUT, + /* DMLERR_DLL_NOT_INITIALIZED */ 0x4003, SbERR_DDE_ERROR, + /* DMLERR_DLL_USAGE */ 0x4004, SbERR_DDE_ERROR, + /* DMLERR_EXECACKTIMEOUT */ 0x4005, SbERR_DDE_TIMEOUT, + /* DMLERR_INVALIDPARAMETER */ 0x4006, SbERR_DDE_ERROR, + /* DMLERR_LOW_MEMORY */ 0x4007, SbERR_DDE_ERROR, + /* DMLERR_MEMORY_ERROR */ 0x4008, SbERR_DDE_ERROR, + /* DMLERR_NOTPROCESSED */ 0x4009, SbERR_DDE_NOTPROCESSED, + /* DMLERR_NO_CONV_ESTABLISHED */ 0x400a, SbERR_DDE_NO_CHANNEL, + /* DMLERR_POKEACKTIMEOUT */ 0x400b, SbERR_DDE_TIMEOUT, + /* DMLERR_POSTMSG_FAILED */ 0x400c, SbERR_DDE_QUEUE_OVERFLOW, + /* DMLERR_REENTRANCY */ 0x400d, SbERR_DDE_ERROR, + /* DMLERR_SERVER_DIED */ 0x400e, SbERR_DDE_PARTNER_QUIT, + /* DMLERR_SYS_ERROR */ 0x400f, SbERR_DDE_ERROR, + /* DMLERR_UNADVACKTIMEOUT */ 0x4010, SbERR_DDE_TIMEOUT, + /* DMLERR_UNFOUND_QUEUE_ID */ 0x4011, SbERR_DDE_NO_CHANNEL +}; + +SbError SbiDdeControl::GetLastErr( DdeConnection* pConv ) +{ + if( !pConv ) + return 0; + long nErr = pConv->GetError(); + if( !nErr ) + return 0; + if( nErr < DDE_FIRSTERR || nErr > DDE_LASTERR ) + return SbERR_DDE_ERROR; + return nDdeErrMap[ 2*(nErr - DDE_FIRSTERR) + 1 ]; +} + +IMPL_LINK_INLINE( SbiDdeControl,Data , DdeData*, pData, +{ + aData = String::CreateFromAscii( (char*)(const void*)*pData ); + return 1; +} +) + +SbiDdeControl::SbiDdeControl() +{ + pConvList = new DdeConnections; + DdeConnection* pPtr = DDE_FREECHANNEL; + pConvList->Insert( pPtr ); +} + +SbiDdeControl::~SbiDdeControl() +{ + TerminateAll(); + delete pConvList; +} + +INT16 SbiDdeControl::GetFreeChannel() +{ + INT16 nListSize = (INT16)pConvList->Count(); + DdeConnection* pPtr = pConvList->First(); + pPtr = pConvList->Next(); // nullten eintrag ueberspringen + INT16 nChannel; + for( nChannel = 1; nChannel < nListSize; nChannel++ ) + { + if( pPtr == DDE_FREECHANNEL ) + return nChannel; + pPtr = pConvList->Next(); + } + pPtr = DDE_FREECHANNEL; + pConvList->Insert( pPtr, LIST_APPEND ); + return nChannel; +} + +SbError SbiDdeControl::Initiate( const String& rService, const String& rTopic, + INT16& rnHandle ) +{ + SbError nErr; + DdeConnection* pConv = new DdeConnection( rService, rTopic ); + nErr = GetLastErr( pConv ); + if( nErr ) + { + delete pConv; + rnHandle = 0; + } + else + { + INT16 nChannel = GetFreeChannel(); + pConvList->Replace( pConv, (ULONG)nChannel ); + rnHandle = nChannel; + } + return 0; +} + +SbError SbiDdeControl::Terminate( INT16 nChannel ) +{ + DdeConnection* pConv = pConvList->GetObject( (ULONG)nChannel ); + if( !nChannel || !pConv || pConv == DDE_FREECHANNEL ) + return SbERR_DDE_NO_CHANNEL; + pConvList->Replace( DDE_FREECHANNEL, (ULONG)nChannel ); + delete pConv; + return 0L; +} + +SbError SbiDdeControl::TerminateAll() +{ + INT16 nChannel = (INT16)pConvList->Count(); + while( nChannel ) + { + nChannel--; + Terminate( nChannel ); + } + + pConvList->Clear(); + DdeConnection* pPtr = DDE_FREECHANNEL; + pConvList->Insert( pPtr ); + + return 0; +} + +SbError SbiDdeControl::Request( INT16 nChannel, const String& rItem, String& rResult ) +{ + DdeConnection* pConv = pConvList->GetObject( (ULONG)nChannel ); + if( !nChannel || !pConv || pConv == DDE_FREECHANNEL ) + return SbERR_DDE_NO_CHANNEL; + + DdeRequest aRequest( *pConv, rItem, 30000 ); + aRequest.SetDataHdl( LINK( this, SbiDdeControl, Data ) ); + aRequest.Execute(); + rResult = aData; + return GetLastErr( pConv ); +} + +SbError SbiDdeControl::Execute( INT16 nChannel, const String& rCommand ) +{ + DdeConnection* pConv = pConvList->GetObject( (ULONG)nChannel ); + if( !nChannel || !pConv || pConv == DDE_FREECHANNEL ) + return SbERR_DDE_NO_CHANNEL; + DdeExecute aRequest( *pConv, rCommand, 30000 ); + aRequest.Execute(); + return GetLastErr( pConv ); +} + +SbError SbiDdeControl::Poke( INT16 nChannel, const String& rItem, const String& rData ) +{ + DdeConnection* pConv = pConvList->GetObject( (ULONG)nChannel ); + if( !nChannel || !pConv || pConv == DDE_FREECHANNEL ) + return SbERR_DDE_NO_CHANNEL; + DdePoke aRequest( *pConv, rItem, DdeData(rData), 30000 ); + aRequest.Execute(); + return GetLastErr( pConv ); +} + + diff --git a/basic/source/runtime/ddectrl.hxx b/basic/source/runtime/ddectrl.hxx new file mode 100644 index 000000000000..a69faeeeb4e8 --- /dev/null +++ b/basic/source/runtime/ddectrl.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * $RCSfile: ddectrl.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _DDECTRL_HXX +#define _DDECTRL_HXX + +#ifndef _LINK_HXX //autogen +#include <tools/link.hxx> +#endif +#ifndef _SBERRORS_HXX +#include "sberrors.hxx" +#endif +#ifndef _STRING_HXX //autogen +#include <tools/string.hxx> +#endif + +class DdeConnection; +class DdeConnections; +class DdeData; + +class SbiDdeControl +{ +private: + DECL_LINK( Data, DdeData* ); + SbError GetLastErr( DdeConnection* ); + INT16 GetFreeChannel(); + DdeConnections* pConvList; + String aData; + +public: + + SbiDdeControl(); + ~SbiDdeControl(); + + SbError Initiate( const String& rService, const String& rTopic, + INT16& rnHandle ); + SbError Terminate( INT16 nChannel ); + SbError TerminateAll(); + SbError Request( INT16 nChannel, const String& rItem, String& rResult ); + SbError Execute( INT16 nChannel, const String& rCommand ); + SbError Poke( INT16 nChannel, const String& rItem, const String& rData ); +}; + +#endif diff --git a/basic/source/runtime/dllmgr.cxx b/basic/source/runtime/dllmgr.cxx new file mode 100644 index 000000000000..76a608674351 --- /dev/null +++ b/basic/source/runtime/dllmgr.cxx @@ -0,0 +1,702 @@ +/************************************************************************* + * + * $RCSfile: dllmgr.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <stdlib.h> +#ifdef OS2 +#define INCL_DOSMODULEMGR +#include <tools/svpm.h> +#endif + +#if defined( WIN ) || defined( WNT ) +#ifndef _SVWIN_H +#include <tools/svwin.h> +#endif +#endif +#ifndef _TOOLS_DEBUG_HXX //autogen +#include <tools/debug.hxx> +#endif +#ifndef _STRING_HXX //autogen +#include <tools/string.hxx> +#endif +#ifndef _ERRCODE_HXX //autogen +#include <tools/errcode.hxx> +#endif +#ifndef _SBXVAR_HXX //autogen +#include <svtools/sbxvar.hxx> +#endif +#ifndef _SBXCLASS_HXX //autogen +#include <svtools/sbx.hxx> +#endif + +#if defined(WIN) +typedef HINSTANCE SbiDllHandle; +typedef FARPROC SbiDllProc; +#elif defined(WNT) +typedef HMODULE SbiDllHandle; +typedef int(*SbiDllProc)(); +#elif defined(OS2) +typedef HMODULE SbiDllHandle; +typedef PFN SbiDllProc; + +#else +typedef void* SbiDllHandle; +typedef void* SbiDllProc; +#endif + +#define _DLLMGR_CXX +#include "dllmgr.hxx" +#include <sberrors.hxx> + +#ifndef CDECL +#ifdef WNT +//#define CDECL __cdecl +#define CDECL +#else +#ifdef WTC +#define CDECL cdecl +#else +#if defined(ICC) && defined(OS2) +#define CDECL _System +#else +#define CDECL +#endif +#endif +#endif +#endif + +extern "C" { +#if defined(INTEL) && (defined(WIN) || defined(WNT) || defined(OS2)) + +extern INT16 CDECL CallINT( SbiDllProc, char *stack, short nstack); +extern INT32 CDECL CallLNG( SbiDllProc, char *stack, short nstack); +#ifndef WNT +extern float CDECL CallSNG( SbiDllProc, char *stack, short nstack); +#endif +extern double CDECL CallDBL( SbiDllProc, char *stack, short nstack); +extern char* CDECL CallSTR( SbiDllProc, char *stack, short nstack); +// extern CallFIX( SbiDllProc, char *stack, short nstack); + +#else + +INT16 CallINT( SbiDllProc, char *, short ) { return 0; } +INT32 CallLNG( SbiDllProc, char *, short ) { return 0; } +float CallSNG( SbiDllProc, char *, short ) { return 0; } +double CallDBL( SbiDllProc, char *, short) { return 0; } +char* CallSTR( SbiDllProc, char *, short ) { return 0; } +#endif +} + +SV_IMPL_OP_PTRARR_SORT(ImplDllArr,ByteStringPtr) + +/* mit Optimierung An stuerzt unter Win95 folgendes Makro ab: +declare Sub MessageBeep Lib "user32" (ByVal long) +sub main + MessageBeep( 1 ) +end sub +*/ +#if defined (WNT) && defined (MSC) +//#pragma optimize ("", off) +#endif + +// +// *********************************************************************** +// + +class ImplSbiProc : public ByteString +{ + SbiDllProc pProc; + ImplSbiProc(); + ImplSbiProc( const ImplSbiProc& ); + +public: + ImplSbiProc( const ByteString& rName, SbiDllProc pFunc ) + : ByteString( rName ) { pProc = pFunc; } + SbiDllProc GetProc() const { return pProc; } +}; + +// +// *********************************************************************** +// + +class ImplSbiDll : public ByteString +{ + ImplDllArr aProcArr; + SbiDllHandle hDLL; + + ImplSbiDll( const ImplSbiDll& ); +public: + ImplSbiDll( const ByteString& rName, SbiDllHandle hHandle ) + : ByteString( rName ) { hDLL = hHandle; } + ~ImplSbiDll(); + SbiDllHandle GetHandle() const { return hDLL; } + SbiDllProc GetProc( const ByteString& rName ) const; + void InsertProc( const ByteString& rName, SbiDllProc pProc ); +}; + +ImplSbiDll::~ImplSbiDll() +{ + USHORT nCount = aProcArr.Count(); + for( USHORT nCur = 0; nCur < nCount; nCur++ ) + { + ImplSbiProc* pProc = (ImplSbiProc*)aProcArr.GetObject( nCur ); + delete pProc; + } +} + +SbiDllProc ImplSbiDll::GetProc( const ByteString& rName ) const +{ + USHORT nPos; + BOOL bRet = aProcArr.Seek_Entry( (ByteStringPtr)&rName, &nPos ); + if( bRet ) + { + ImplSbiProc* pImplProc = (ImplSbiProc*)aProcArr.GetObject(nPos); + return pImplProc->GetProc(); + } + return (SbiDllProc)0; +} + +void ImplSbiDll::InsertProc( const ByteString& rName, SbiDllProc pProc ) +{ + DBG_ASSERT(aProcArr.Seek_Entry((ByteStringPtr)&rName,0)==0,"InsertProc: Already in table"); + ImplSbiProc* pImplProc = new ImplSbiProc( rName, pProc ); + aProcArr.Insert( (ByteStringPtr)pImplProc ); +} + + +// +// *********************************************************************** +// + +SbiDllMgr::SbiDllMgr( const SbiDllMgr& ) +{ +} + +SbiDllMgr::SbiDllMgr() +{ +} + +SbiDllMgr::~SbiDllMgr() +{ + USHORT nCount = aDllArr.Count(); + for( USHORT nCur = 0; nCur < nCount; nCur++ ) + { + ImplSbiDll* pDll = (ImplSbiDll*)aDllArr.GetObject( nCur ); + FreeDllHandle( pDll->GetHandle() ); + delete pDll; + } +} + +void SbiDllMgr::FreeDll( const ByteString& rDllName ) +{ + USHORT nPos; + BOOL bRet = aDllArr.Seek_Entry( (ByteStringPtr)&rDllName, &nPos ); + if( bRet ) + { + ImplSbiDll* pDll = (ImplSbiDll*)aDllArr.GetObject(nPos); + FreeDllHandle( pDll->GetHandle() ); + delete pDll; + aDllArr.Remove( nPos, 1 ); + } +} + + +ImplSbiDll* SbiDllMgr::GetDll( const ByteString& rDllName ) +{ + USHORT nPos; + ImplSbiDll* pDll = 0; + BOOL bRet = aDllArr.Seek_Entry( (ByteStringPtr)&rDllName, &nPos ); + if( bRet ) + pDll = (ImplSbiDll*)aDllArr.GetObject(nPos); + else + { + SbiDllHandle hDll = CreateDllHandle( rDllName ); + if( hDll ) + { + pDll = new ImplSbiDll( rDllName, hDll ); + aDllArr.Insert( (ByteStringPtr)pDll ); + } + } + return pDll; +} + +SbiDllProc SbiDllMgr::GetProc( ImplSbiDll* pDll, const ByteString& rProcName ) +{ + DBG_ASSERT(pDll,"GetProc: No dll-ptr"); + SbiDllProc pProc; + pProc = pDll->GetProc( rProcName ); + if( !pProc ) + { + pProc = GetProcAddr( pDll->GetHandle(), rProcName ); + if( pProc ) + pDll->InsertProc( rProcName, pProc ); + } + return pProc; +} + + +SbError SbiDllMgr::Call( const char* pProcName, const char* pDllName, + SbxArray* pArgs, SbxVariable& rResult, BOOL bCDecl ) +{ + DBG_ASSERT(pProcName&&pDllName,"Call: Bad parms"); + SbError nSbErr = 0; + ByteString aDllName( pDllName ); + CheckDllName( aDllName ); + ImplSbiDll* pDll = GetDll( aDllName ); + if( pDll ) + { + SbiDllProc pProc = GetProc( pDll, pProcName ); + if( pProc ) + { + if( bCDecl ) + nSbErr = CallProcC( pProc, pArgs, rResult ); + else + nSbErr = CallProc( pProc, pArgs, rResult ); + } + else + nSbErr = SbERR_PROC_UNDEFINED; + } + else + nSbErr = SbERR_BAD_DLL_LOAD; + return nSbErr; +} + +// *********************************************************************** +// ******************* abhaengige Implementationen *********************** +// *********************************************************************** + +void SbiDllMgr::CheckDllName( ByteString& rDllName ) +{ +#if defined(WIN) || defined(WNT) // || defined(OS2) + if( rDllName.Search('.') == STRING_NOTFOUND ) + rDllName += ".DLL"; +#endif +} + + +SbiDllHandle SbiDllMgr::CreateDllHandle( const ByteString& rDllName ) +{ +#if defined(MAC) || defined(UNX) + SbiDllHandle hLib=0; +#else + SbiDllHandle hLib; +#endif + +#if defined(WIN) + hLib = LoadLibrary( (const char*)rDllName ); + if( (ULONG)hLib < 32 ) + hLib = 0; + +#elif defined(WNT) + hLib = LoadLibrary( rDllName.GetBuffer() ); + if( !(ULONG)hLib ) + { +#ifdef DBG_UTIL + ULONG nLastErr = GetLastError(); +#endif + hLib = 0; + } + +#elif defined(OS2) + char cErr[ 100 ]; + if( DosLoadModule( (PSZ) cErr, 100, (const char*)rDllName, &hLib ) ) + hLib = 0; +#endif + return hLib; +} + +void SbiDllMgr::FreeDllHandle( SbiDllHandle hLib ) +{ +#if defined(WIN) || defined(WNT) + if( hLib ) + FreeLibrary ((HINSTANCE) hLib); +#elif defined(OS2) + if( hLib ) + DosFreeModule( (HMODULE) hLib ); +#endif +} + +SbiDllProc SbiDllMgr::GetProcAddr(SbiDllHandle hLib, const ByteString& rProcName) +{ + char buf1 [128]; + char buf2 [128]; + + SbiDllProc pProc = 0; + short nOrd = 0; + + // Ordinal? + if( rProcName.GetBuffer()[0] == '@' ) + nOrd = atoi( rProcName.GetBuffer()+1 ); + + // Moegliche Parameter weg: + strcpy( buf1, rProcName.GetBuffer() ); + char *p = strchr( buf1, '#' ); + if( p ) + *p = 0; + strcpy( buf2, "_" ); + strcat( buf2, buf1 ); + +#if defined(WIN) || defined(WNT) + if( nOrd > 0 ) + pProc = (SbiDllProc)GetProcAddress( hLib, (char*)(long) nOrd ); + else + { + // 2. mit Parametern: + pProc = (SbiDllProc)GetProcAddress ( hLib, rProcName.GetBuffer() ); + // 3. nur der Name: + if (!pProc) + pProc = (SbiDllProc)GetProcAddress( hLib, buf1 ); + // 4. der Name mit Underline vorweg: + if( !pProc ) + pProc = (SbiDllProc)GetProcAddress( hLib, buf2 ); + } + +#elif defined(OS2) + PSZ pp; + APIRET rc; + // 1. Ordinal oder mit Parametern: + rc = DosQueryProcAddr( hLib, nOrd, pp = (char*)rProcName.GetStr(), &pProc ); + // 2. nur der Name: + if( rc ) + rc = DosQueryProcAddr( hLib, 0, pp = (PSZ)buf1, &pProc ); + // 3. der Name mit Underline vorweg: + if( rc ) + rc = DosQueryProcAddr( hLib, 0, pp = (PSZ)buf2, &pProc ); + if( rc ) + pProc = NULL; + else + { + // 16-bit oder 32-bit? + ULONG nInfo = 0; + if( DosQueryProcType( hLib, nOrd, pp, &nInfo ) ) + nInfo = 0;; + } +#endif + return pProc; +} + +SbError SbiDllMgr::CallProc( SbiDllProc pProc, SbxArray* pArgs, + SbxVariable& rResult ) +{ +// ByteString aStr("Calling DLL at "); +// aStr += (ULONG)pProc; +// InfoBox( 0, aStr ).Execute(); + INT16 nInt16; int nInt; INT32 nInt32; float nSingle; double nDouble; + char* pStr; + + USHORT nSize; + char* pStack = (char*)CreateStack( pArgs, nSize ); + switch( rResult.GetType() ) + { + case SbxINTEGER: + nInt16 = CallINT(pProc, pStack, (short)nSize ); + rResult.PutInteger( nInt16 ); + break; + + case SbxUINT: + case SbxUSHORT: + nInt16 = (INT16)CallINT(pProc, pStack, (short)nSize ); + rResult.PutUShort( (USHORT)nInt16 ); + break; + + case SbxERROR: + nInt16 = (INT16)CallINT(pProc, pStack, (short)nSize ); + rResult.PutErr( (USHORT)nInt16 ); + break; + + case SbxINT: + nInt = CallINT(pProc, pStack, (short)nSize ); + rResult.PutInt( nInt ); + break; + + case SbxLONG: + nInt32 = CallLNG(pProc, pStack, (short)nSize ); + rResult.PutLong( nInt32 ); + break; + + case SbxULONG: + nInt32 = CallINT(pProc, pStack, (short)nSize ); + rResult.PutULong( (ULONG)nInt32 ); + break; + +#ifndef WNT + case SbxSINGLE: + nSingle = CallSNG(pProc, pStack, (short)nSize ); + rResult.PutSingle( nSingle ); + break; +#endif + + case SbxDOUBLE: +#ifdef WNT + case SbxSINGLE: +#endif + nDouble = CallDBL(pProc, pStack, (short)nSize ); + rResult.PutDouble( nDouble ); + break; + + case SbxDATE: + nDouble = CallDBL(pProc, pStack, (short)nSize ); + rResult.PutDate( nDouble ); + break; + + case SbxCHAR: + case SbxBYTE: + case SbxBOOL: + nInt16 = CallINT(pProc, pStack, (short)nSize ); + rResult.PutByte( (BYTE)nInt16 ); + break; + + case SbxSTRING: + case SbxLPSTR: + pStr = CallSTR(pProc, pStack, (short)nSize ); + rResult.PutString( String::CreateFromAscii( pStr ) ); + break; + + case SbxNULL: + case SbxEMPTY: + nInt16 = CallINT(pProc, pStack, (short)nSize ); + // Rueckgabe nur zulaessig, wenn variant! + if( !rResult.IsFixed() ) + rResult.PutInteger( nInt16 ); + break; + + case SbxCURRENCY: + case SbxOBJECT: + case SbxDATAOBJECT: + default: + CallINT(pProc, pStack, (short)nSize ); + break; + } + delete pStack; + + if( pArgs ) + { + // die Laengen aller uebergebenen Strings anpassen + USHORT nCount = pArgs->Count(); + for( USHORT nCur = 1; nCur < nCount; nCur++ ) + { + SbxVariable* pVar = pArgs->Get( nCur ); + BOOL bIsString = ( pVar->GetType() == SbxSTRING ) || + ( pVar->GetType() == SbxLPSTR ); + + if( pVar->GetFlags() & SBX_REFERENCE ) + { + pVar->ResetFlag( SBX_REFERENCE ); // Sbx moechte es so + if( bIsString ) + { + ByteString aByteStr( (char*)pVar->GetUserData() ); + String aStr( aByteStr, gsl_getSystemTextEncoding() ); + pVar->PutString( aStr ); + } + } + if( bIsString ) + { + delete (char*)(pVar->GetUserData()); + pVar->SetUserData( 0 ); + } + } + } + return 0; +} + +SbError SbiDllMgr::CallProcC( SbiDllProc pProc, SbxArray* pArgs, + SbxVariable& rResult ) +{ + DBG_ERROR("C calling convention not supported"); + return (USHORT)SbERR_BAD_ARGUMENT; +} + +void* SbiDllMgr::CreateStack( SbxArray* pArgs, USHORT& rSize ) +{ + if( !pArgs ) + { + rSize = 0; + return 0; + } + char* pStack = new char[ 2048 ]; + char* pTop = pStack; + USHORT nCount = pArgs->Count(); + // erstes Element ueberspringen +#ifndef WIN + for( USHORT nCur = 1; nCur < nCount; nCur++ ) +#else + // unter 16-Bit Windows anders rum (OS/2 ?????) + for( USHORT nCur = nCount-1; nCur >= 1; nCur-- ) +#endif + { + SbxVariable* pVar = pArgs->Get( nCur ); + // AB 22.1.1996, Referenz + if( pVar->GetFlags() & SBX_REFERENCE ) // Es ist eine Referenz + { + switch( pVar->GetType() ) + { + case SbxINTEGER: + case SbxUINT: + case SbxINT: + case SbxUSHORT: + case SbxLONG: + case SbxULONG: + case SbxSINGLE: + case SbxDOUBLE: + case SbxCHAR: + case SbxBYTE: + case SbxBOOL: + *((void**)pTop) = (void*)&(pVar->aData); + pTop += sizeof( void* ); + break; + + case SbxSTRING: + case SbxLPSTR: + { + USHORT nLen = 256; + ByteString rStr( pVar->GetString(), gsl_getSystemTextEncoding() ); + if( rStr.Len() > 255 ) + nLen = rStr.Len() + 1; + + char* pStr = new char[ nLen ]; + strcpy( pStr, rStr.GetBuffer() ); + // ist nicht so sauber, aber wir sparen ein Pointerarray + DBG_ASSERT(sizeof(UINT32)>=sizeof(char*),"Gleich krachts im Basic"); + pVar->SetUserData( (UINT32)pStr ); + *((const char**)pTop) = pStr; + pTop += sizeof( char* ); + } + break; + + case SbxNULL: + case SbxEMPTY: + case SbxERROR: + case SbxDATE: + case SbxCURRENCY: + case SbxOBJECT: + case SbxDATAOBJECT: + default: + break; + } + } + else + { + // ByVal + switch( pVar->GetType() ) + { + case SbxINTEGER: + case SbxUINT: + case SbxINT: + case SbxUSHORT: + *((INT16*)pTop) = pVar->GetInteger(); + pTop += sizeof( INT16 ); + break; + + case SbxLONG: + case SbxULONG: + *((INT32*)pTop) = pVar->GetLong(); + pTop += sizeof( INT32 ); + break; + + case SbxSINGLE: + *((float*)pTop) = pVar->GetSingle(); + pTop += sizeof( float ); + break; + + case SbxDOUBLE: + *((double*)pTop) = pVar->GetDouble(); + pTop += sizeof( double ); + break; + + case SbxSTRING: + case SbxLPSTR: + { + char* pStr = new char[ pVar->GetString().Len() + 1 ]; + ByteString aByteStr( pVar->GetString(), gsl_getSystemTextEncoding() ); + strcpy( pStr, aByteStr.GetBuffer() ); + // ist nicht so sauber, aber wir sparen ein Pointerarray + DBG_ASSERT(sizeof(UINT32)>=sizeof(char*),"Gleich krachts im Basic"); + pVar->SetUserData( (UINT32)pStr ); + *((const char**)pTop) = pStr; + pTop += sizeof( char* ); + } + break; + + case SbxCHAR: + case SbxBYTE: + case SbxBOOL: + *((BYTE*)pTop) = pVar->GetByte(); + pTop += sizeof( BYTE ); + break; + + case SbxNULL: + case SbxEMPTY: + case SbxERROR: + case SbxDATE: + case SbxCURRENCY: + case SbxOBJECT: + case SbxDATAOBJECT: + default: + break; + } + } + } + rSize = (USHORT)((ULONG)pTop - (ULONG)pStack); + return pStack; +} + + + + diff --git a/basic/source/runtime/dllmgr.hxx b/basic/source/runtime/dllmgr.hxx new file mode 100644 index 000000000000..dafe6942c518 --- /dev/null +++ b/basic/source/runtime/dllmgr.hxx @@ -0,0 +1,135 @@ +/************************************************************************* + * + * $RCSfile: dllmgr.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _DLLMGR_HXX +#define _DLLMGR_HXX + +#define _SVSTDARR_BYTESTRINGSSORT +#ifndef _SVARRAY_HXX //autogen +#include <svtools/svarray.hxx> +#endif +#ifndef _SVSTDARR_HXX //autogen +#include <svtools/svstdarr.hxx> +#endif + +// !!! nur zum debuggen fuer infoboxes !!! +//#ifndef _SV_HXX +//#include <sv.hxx> +//#endif + +//#ifndef _TOOLS_HXX +//#include <tools.hxx> +//#endif +#if SUPD > 340 +#define _SVSTDARR_STRINGS +//#ifndef _SVSTDARR_HXX +//#include <svstdarr.hxx> +//#endif +#else +//#include <svmem.hxx> +#endif +#ifndef _SBERRORS_HXX +#include <sberrors.hxx> +#endif + +class SbxArray; +class SbxVariable; + +class ImplSbiDll; +class ImplSbiProc; + +SV_DECL_PTRARR_SORT(ImplDllArr,ByteStringPtr,5,5) + +class SbiDllMgr +{ + ImplDllArr aDllArr; + + SbiDllMgr( const SbiDllMgr& ); + +#ifdef _DLLMGR_CXX + ImplSbiDll* GetDll( const ByteString& rDllName ); + SbiDllProc GetProc( ImplSbiDll*, const ByteString& rProcName ); + + SbiDllHandle CreateDllHandle( const ByteString& rDllName ); + void FreeDllHandle( SbiDllHandle ); + SbiDllProc GetProcAddr( SbiDllHandle, const ByteString& pProcName ); + SbError CallProc( SbiDllProc pProc, SbxArray* pArgs, + SbxVariable& rResult ); + SbError CallProcC( SbiDllProc pProc, SbxArray* pArgs, + SbxVariable& rResult ); + void* CreateStack( SbxArray* pArgs, USHORT& rSize ); + void CheckDllName( ByteString& rName ); +#endif + +public: + SbiDllMgr(); + ~SbiDllMgr(); + + SbError Call( const char* pFunc, const char* pDll, + SbxArray* pArgs, SbxVariable& rResult, + BOOL bCDecl ); + + void FreeDll( const ByteString& rDllName ); +}; + + + +#endif diff --git a/basic/source/runtime/inputbox.cxx b/basic/source/runtime/inputbox.cxx new file mode 100644 index 000000000000..236bf9e1e8a7 --- /dev/null +++ b/basic/source/runtime/inputbox.cxx @@ -0,0 +1,247 @@ +/************************************************************************* + * + * $RCSfile: inputbox.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef NOOLDSV //autogen +#include <vcl/system.hxx> +#endif +#ifndef _SV_BUTTON_HXX //autogen +#include <vcl/button.hxx> +#endif +#ifndef _SV_FIXED_HXX //autogen +#include <vcl/fixed.hxx> +#endif +#ifndef _SV_EDIT_HXX //autogen +#include <vcl/edit.hxx> +#endif +#ifndef _SV_DIALOG_HXX //autogen +#include <vcl/dialog.hxx> +#endif +#ifndef _SV_SVAPP_HXX +#include <vcl/svapp.hxx> +#endif +#include <svtools/sbx.hxx> +#include "runtime.hxx" +#pragma hdrstop +#include "stdobj.hxx" +#include "rtlproto.hxx" + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBRUNTIME, SBRUNTIME_CODE ) + + +class SvRTLInputBox : public ModalDialog +{ + Edit aEdit; + OKButton aOk; + CancelButton aCancel; + FixedText aPromptText; + String aText; + + void PositionDialog( long nXTwips, long nYTwips, const Size& rDlgSize ); + void InitButtons( const Size& rDlgSize ); + void PositionEdit( const Size& rDlgSize ); + void PositionPrompt( const String& rPrompt, const Size& rDlgSize ); + DECL_LINK( OkHdl, Button * ); + DECL_LINK( CancelHdl, Button * ); + +public: + SvRTLInputBox( Window* pParent, const String& rPrompt, const String& rTitle, + const String& rDefault, long nXTwips = -1, long nYTwips = -1 ); + String GetText() const { return aText; } +}; + +SvRTLInputBox::SvRTLInputBox( Window* pParent, const String& rPrompt, + const String& rTitle, const String& rDefault, + long nXTwips, long nYTwips ) : + ModalDialog( pParent,WB_SVLOOK | WB_MOVEABLE | WB_CLOSEABLE ), + aEdit( this, WB_LEFT | WB_BORDER ), + aOk( this ), aCancel( this ), aPromptText( this, WB_WORDBREAK ) +{ + SetMapMode( MapMode( MAP_APPFONT ) ); + Size aDlgSizeApp( 280, 80 ); + PositionDialog( nXTwips, nYTwips, aDlgSizeApp ); + InitButtons( aDlgSizeApp ); + PositionEdit( aDlgSizeApp ); + PositionPrompt( rPrompt, aDlgSizeApp ); + aOk.Show(); + aCancel.Show(); + aEdit.Show(); + aPromptText.Show(); + SetText( rTitle ); + Font aFont( GetFont()); + Color aColor( GetBackgroundBrush().GetFillColor()); + aFont.SetFillColor( aColor ); + aEdit.SetFont( aFont ); + aEdit.SetText( rDefault ); + aEdit.SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) ); +} + +void SvRTLInputBox::InitButtons( const Size& rDlgSize ) +{ + aOk.SetSizePixel( LogicToPixel( Size( 45, 15) )); + aCancel.SetSizePixel( LogicToPixel( Size( 45, 15) )); + Point aPos( rDlgSize.Width()-45-10, 5 ); + aOk.SetPosPixel( LogicToPixel( Point(aPos) )); + aPos.Y() += 16; + aCancel.SetPosPixel( LogicToPixel( Point(aPos) )); + aOk.SetClickHdl(LINK(this,SvRTLInputBox, OkHdl)); + aCancel.SetClickHdl(LINK(this,SvRTLInputBox,CancelHdl)); +} + +void SvRTLInputBox::PositionDialog(long nXTwips, long nYTwips, const Size& rDlgSize) +{ + Size aScreenSzApp(Window::GetOutputSizePixel()); + aScreenSzApp = PixelToLogic( aScreenSzApp ); + + Point aDlgPosApp( nXTwips, nYTwips ); + aDlgPosApp = LogicToPixel( aDlgPosApp, MAP_TWIP ); + aDlgPosApp = PixelToLogic( aDlgPosApp ); + if ( nXTwips == -1 || nYTwips == -1 || + aDlgPosApp.X() >= aScreenSzApp.Width() || + aDlgPosApp.Y() >= aScreenSzApp.Height() ) + { + aDlgPosApp.X() = ( aScreenSzApp.Width() - rDlgSize.Width() ) / 2; + aDlgPosApp.Y() = ( aScreenSzApp.Height() - rDlgSize.Height() ) / 2; + } + SetSizePixel( LogicToPixel(rDlgSize) ); + SetPosPixel( LogicToPixel(aDlgPosApp) ); +} + +void SvRTLInputBox::PositionEdit( const Size& rDlgSize ) +{ + aEdit.SetPosPixel( LogicToPixel( Point( 5,rDlgSize.Height()-35))); + aEdit.SetSizePixel( LogicToPixel( Size(rDlgSize.Width()-15,12))); +} + + +void SvRTLInputBox::PositionPrompt(const String& rPrompt,const Size& rDlgSize) +{ + if ( rPrompt.Len() == 0 ) + return; + String aText( rPrompt ); + aText.ConvertLineEnd( LINEEND_CR ); + aPromptText.SetPosPixel( LogicToPixel(Point(5,5))); + aPromptText.SetText( aText ); + Size aSize( rDlgSize ); + aSize.Width() -= 70; + aSize.Height() -= 50; + aPromptText.SetSizePixel( LogicToPixel(aSize)); +} + + +IMPL_LINK_INLINE_START( SvRTLInputBox, OkHdl, Button *, pButton ) +{ + aText = aEdit.GetText(); + EndDialog( 1 ); + return 0; +} +IMPL_LINK_INLINE_END( SvRTLInputBox, OkHdl, Button *, pButton ) + +IMPL_LINK_INLINE_START( SvRTLInputBox, CancelHdl, Button *, pButton ) +{ + aText.Erase(); + EndDialog( 0 ); + return 0; +} +IMPL_LINK_INLINE_END( SvRTLInputBox, CancelHdl, Button *, pButton ) + + +// ********************************************************************* +// ********************************************************************* +// ********************************************************************* + +// Syntax: String InputBox( Prompt, [Title], [Default] [, nXpos, nYpos ] ) + +RTLFUNC(InputBox) +{ + ULONG nArgCount = rPar.Count(); + if ( nArgCount < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + String aTitle; + String aDefault; + INT32 nX = -1, nY = -1; // zentrieren + const String& rPrompt = rPar.Get(1)->GetString(); + if ( nArgCount > 2 ) + aTitle = rPar.Get(2)->GetString(); + if ( nArgCount > 3 ) + aDefault = rPar.Get(3)->GetString(); + if ( nArgCount > 4 ) + { + if ( nArgCount != 6 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + nX = rPar.Get(4)->GetLong(); + nY = rPar.Get(5)->GetLong(); + } + SvRTLInputBox *pDlg=new SvRTLInputBox(GetpApp()->GetDefModalDialogParent(), + rPrompt,aTitle,aDefault,nX,nY); + pDlg->Execute(); + rPar.Get(0)->PutString( pDlg->GetText() ); + delete pDlg; + } +} + + + diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx new file mode 100644 index 000000000000..d2861c32ba13 --- /dev/null +++ b/basic/source/runtime/iosys.cxx @@ -0,0 +1,1257 @@ +/************************************************************************* + * + * $RCSfile: iosys.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SV_DIALOG_HXX //autogen +#include <vcl/dialog.hxx> +#endif +#ifndef _SV_EDIT_HXX //autogen +#include <vcl/edit.hxx> +#endif +#ifndef _SV_BUTTON_HXX //autogen +#include <vcl/button.hxx> +#endif +#ifndef _SV_MSGBOX_HXX //autogen +#include <vcl/msgbox.hxx> +#endif +#ifndef _SV_SVAPP_HXX //autogen +#include <vcl/svapp.hxx> +#endif +#include <osl/security.h> + +#include "runtime.hxx" + +#ifdef _USE_UNO + +// <-- encoding +#ifdef UNX +#include <alloca.h> +#endif +#ifdef WNT +#include <malloc.h> +#define alloca _alloca +#endif +#include <ctype.h> +#include <rtl/byteseq.hxx> +#ifndef _RTL_TEXTENC_H +#include <rtl/textenc.h> +#endif +#ifndef _RTL_USTRBUF_HXX_ +#include <rtl/ustrbuf.hxx> +#endif +#ifndef _RTL_TEXTENC_H +#include <rtl/textenc.h> +#endif +#ifndef _RTL_USTRBUF_HXX_ +#include <rtl/ustrbuf.hxx> +#endif +// encoding --> + +#include <unotools/processfactory.hxx> + +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/ucb/XSimpleFileAccess.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/io/XOutputStream.hpp> +#include <com/sun/star/io/XStream.hpp> +#include <com/sun/star/io/XSeekable.hpp> +#include <com/sun/star/bridge/XBridge.hpp> +#include <com/sun/star/bridge/XBridgeFactory.hpp> + +using namespace utl; +using namespace rtl; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::ucb; +using namespace com::sun::star::io; +using namespace com::sun::star::bridge; + +#endif /* _USE_UNO */ + +#pragma hdrstop +#include "iosys.hxx" +#include "sbintern.hxx" + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBRUNTIME, SBRUNTIME_CODE ) + +// Der Input-Dialog: + +class SbiInputDialog : public ModalDialog { + Edit aInput; + OKButton aOk; + CancelButton aCancel; + String aText; + DECL_LINK( Ok, Window * ); + DECL_LINK( Cancel, Window * ); +public: + SbiInputDialog( Window*, const String& ); + const String& GetInput() { return aText; } +}; + +SbiInputDialog::SbiInputDialog( Window* pParent, const String& rPrompt ) + :ModalDialog( pParent, WB_SVLOOK | WB_MOVEABLE | WB_CLOSEABLE ), + aInput( this, WB_SVLOOK | WB_LEFT | WB_BORDER ), + aOk( this ), aCancel( this ) +{ + SetText( rPrompt ); + aOk.SetClickHdl( LINK( this, SbiInputDialog, Ok ) ); + aCancel.SetClickHdl( LINK( this, SbiInputDialog, Cancel ) ); + SetMapMode( MapMode( MAP_APPFONT ) ); + + Point aPt = LogicToPixel( Point( 50, 50 ) ); + Size aSz = LogicToPixel( Size( 145, 65 ) ); + SetPosSizePixel( aPt, aSz ); + aPt = LogicToPixel( Point( 10, 10 ) ); + aSz = LogicToPixel( Size( 120, 12 ) ); + aInput.SetPosSizePixel( aPt, aSz ); + aPt = LogicToPixel( Point( 15, 30 ) ); + aSz = LogicToPixel( Size( 45, 15) ); + aOk.SetPosSizePixel( aPt, aSz ); + aPt = LogicToPixel( Point( 80, 30 ) ); + aSz = LogicToPixel( Size( 45, 15) ); + aCancel.SetPosSizePixel( aPt, aSz ); + + aInput.Show(); + aOk.Show(); + aCancel.Show(); +} + +IMPL_LINK_INLINE_START( SbiInputDialog, Ok, Window *, pWindow ) +{ + aText = aInput.GetText(); + EndDialog( 1 ); + return 0; +} +IMPL_LINK_INLINE_END( SbiInputDialog, Ok, Window *, pWindow ) + +IMPL_LINK_INLINE_START( SbiInputDialog, Cancel, Window *, pWindow ) +{ + EndDialog( 0 ); + return 0; +} +IMPL_LINK_INLINE_END( SbiInputDialog, Cancel, Window *, pWindow ) + +////////////////////////////////////////////////////////////////////////// + +SbiStream::SbiStream() + : pStrm( 0 ) +{ +} + +SbiStream::~SbiStream() +{ + delete pStrm; +} + +// Ummappen eines SvStream-Fehlers auf einen StarBASIC-Code + +void SbiStream::MapError() +{ + if( pStrm ) + switch( pStrm->GetError() ) + { + case SVSTREAM_OK: + nError = 0; break; + case SVSTREAM_FILE_NOT_FOUND: + nError = SbERR_FILE_NOT_FOUND; break; + case SVSTREAM_PATH_NOT_FOUND: + nError = SbERR_PATH_NOT_FOUND; break; + case SVSTREAM_TOO_MANY_OPEN_FILES: + nError = SbERR_TOO_MANY_FILES; break; + case SVSTREAM_ACCESS_DENIED: + nError = SbERR_ACCESS_DENIED; break; + case SVSTREAM_INVALID_PARAMETER: + nError = SbERR_BAD_ARGUMENT; break; + case SVSTREAM_OUTOFMEMORY: + nError = SbERR_NO_MEMORY; break; + default: + nError = SbERR_IO_ERROR; break; + } +} + +#ifdef _USE_UNO + +// TODO: Code is copied from daemons2/source/uno/asciiEncoder.cxx + +namespace basicEncoder +{ + enum EncodeMechanism + { + ENCODE_ALL, + WAS_ENCODED, + NOT_CANONIC + }; + + enum DecodeMechanism + { + NO_DECODE, + DECODE_TO_IURI, + DECODE_WITH_CHARSET + }; + + enum EscapeType + { + ESCAPE_NO, + ESCAPE_OCTET, + ESCAPE_UTF32 + }; + + inline bool isUSASCII(sal_uInt32 nChar) + { + return nChar <= 0x7F; + } + + inline bool isDigit(sal_uInt32 nChar) + { + return nChar >= '0' && nChar <= '9'; + } + + inline int getHexWeight(sal_uInt32 nChar) + { + return isDigit(nChar) ? int(nChar - '0') : + nChar >= 'A' && nChar <= 'F' ? int(nChar - 'A' + 10) : + nChar >= 'a' && nChar <= 'f' ? int(nChar - 'a' + 10) : -1; + } + + inline bool isHighSurrogate(sal_uInt32 nUTF16) + { + return nUTF16 >= 0xD800 && nUTF16 <= 0xDBFF; + } + + inline bool isLowSurrogate(sal_uInt32 nUTF16) + { + return nUTF16 >= 0xDC00 && nUTF16 <= 0xDFFF; + } + + sal_uInt32 getHexDigit(int nWeight) + { + OSL_ASSERT(nWeight >= 0 && nWeight < 16); + static sal_Char const aDigits[16] + = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', + 'D', 'E', 'F' }; + return aDigits[nWeight]; + } + + inline void appendEscape(rtl::OUStringBuffer & rTheText, + sal_Char cEscapePrefix, sal_uInt32 nOctet) + { + rTheText.append(sal_Unicode(cEscapePrefix)); + rTheText.append(sal_Unicode(getHexDigit(int(nOctet >> 4)))); + rTheText.append(sal_Unicode(getHexDigit(int(nOctet & 15)))); + } + + inline sal_uInt32 getUTF32Character(sal_Unicode const *& rBegin, + sal_Unicode const * pEnd) + { + OSL_ASSERT(rBegin && rBegin < pEnd); + if (rBegin + 1 < pEnd && rBegin[0] >= 0xD800 && rBegin[0] <= 0xDBFF + && rBegin[1] >= 0xDC00 && rBegin[1] <= 0xDFFF) + { + sal_uInt32 nUTF32 = sal_uInt32(*rBegin++ & 0x3FF) << 10; + return (nUTF32 | (*rBegin++ & 0x3FF)) + 0x10000; + } + else + return *rBegin++; + } + + sal_uInt32 getUTF32(sal_Unicode const *& rBegin, sal_Unicode const * pEnd, + bool bOctets, sal_Char cEscapePrefix, + EncodeMechanism eMechanism, rtl_TextEncoding eCharset, + EscapeType & rEscapeType) + { + OSL_ASSERT(rBegin < pEnd); + sal_uInt32 nUTF32 = bOctets ? *rBegin++ : getUTF32Character(rBegin, pEnd); + switch (eMechanism) + { + case ENCODE_ALL: + rEscapeType = ESCAPE_NO; + break; + + case WAS_ENCODED: + { + int nWeight1; + int nWeight2; + if (nUTF32 == cEscapePrefix && rBegin + 1 < pEnd + && (nWeight1 = getHexWeight(rBegin[0])) >= 0 + && (nWeight2 = getHexWeight(rBegin[1])) >= 0) + { + rBegin += 2; + nUTF32 = nWeight1 << 4 | nWeight2; + switch (eCharset) + { + default: + OSL_ASSERT(false); + case RTL_TEXTENCODING_ASCII_US: + rEscapeType + = isUSASCII(nUTF32) ? ESCAPE_UTF32 : ESCAPE_OCTET; + break; + + case RTL_TEXTENCODING_ISO_8859_1: + rEscapeType = ESCAPE_UTF32; + break; + + case RTL_TEXTENCODING_UTF8: + if (isUSASCII(nUTF32)) + rEscapeType = ESCAPE_UTF32; + else + { + if (nUTF32 >= 0xC0 && nUTF32 <= 0xF4) + { + sal_uInt32 nEncoded; + int nShift; + sal_uInt32 nMin; + if (nUTF32 <= 0xDF) + { + nEncoded = (nUTF32 & 0x1F) << 6; + nShift = 0; + nMin = 0x80; + } + else if (nUTF32 <= 0xEF) + { + nEncoded = (nUTF32 & 0x0F) << 12; + nShift = 6; + nMin = 0x800; + } + else + { + nEncoded = (nUTF32 & 0x07) << 18; + nShift = 12; + nMin = 0x10000; + } + sal_Unicode const * p = rBegin; + bool bUTF8 = true; + for (;;) + { + if (p + 2 >= pEnd || p[0] != cEscapePrefix + || (nWeight1 = getHexWeight(p[1])) < 0 + || (nWeight2 = getHexWeight(p[2])) < 0 + || nWeight1 < 8) + { + bUTF8 = false; + break; + } + p += 3; + nEncoded + |= ((nWeight1 & 3) << 4 | nWeight2) + << nShift; + if (nShift == 0) + break; + nShift -= 6; + } + if (bUTF8 && nEncoded >= nMin + && !isHighSurrogate(nEncoded) + && !isLowSurrogate(nEncoded) + && nEncoded <= 0x10FFFF) + { + rBegin = p; + nUTF32 = nEncoded; + rEscapeType = ESCAPE_UTF32; + break; + } + } + rEscapeType = ESCAPE_OCTET; + } + break; + } + } + else + rEscapeType = ESCAPE_NO; + break; + } + + case NOT_CANONIC: + { + int nWeight1; + int nWeight2; + if (nUTF32 == cEscapePrefix && rBegin + 1 < pEnd + && ((nWeight1 = getHexWeight(rBegin[0])) >= 0) + && ((nWeight2 = getHexWeight(rBegin[1])) >= 0)) + { + rBegin += 2; + nUTF32 = nWeight1 << 4 | nWeight2; + rEscapeType = ESCAPE_OCTET; + } + else + rEscapeType = ESCAPE_NO; + break; + } + } + return nUTF32; + } + + static rtl::OUString decodeImpl(sal_Unicode const * pBegin, + sal_Unicode const * pEnd, sal_Char cEscapePrefix, + DecodeMechanism eMechanism, + rtl_TextEncoding eCharset) + { + switch (eMechanism) + { + case NO_DECODE: + return rtl::OUString(pBegin, pEnd - pBegin); + + case DECODE_TO_IURI: + eCharset = RTL_TEXTENCODING_UTF8; + break; + } + rtl::OUStringBuffer aResult; + while (pBegin < pEnd) + { + EscapeType eEscapeType; + sal_uInt32 nUTF32 = getUTF32(pBegin, pEnd, false, cEscapePrefix, + WAS_ENCODED, eCharset, eEscapeType); + switch (eEscapeType) + { + case ESCAPE_NO: + aResult.append(sal_Unicode(nUTF32)); + break; + + case ESCAPE_OCTET: + appendEscape(aResult, cEscapePrefix, nUTF32); + break; + + case ESCAPE_UTF32: + if (eMechanism == DECODE_TO_IURI && isUSASCII(nUTF32)) + appendEscape(aResult, cEscapePrefix, nUTF32); + else + aResult.append(sal_Unicode(nUTF32)); + break; + } + } + return aResult.makeStringAndClear(); + } + + + OUString AsciiEncoder::decodeUnoUrlParamValue(rtl::OUString const & rSource) + { + return decodeImpl(rSource.getStr(), rSource.getStr() + rSource.getLength(), + '%', DECODE_WITH_CHARSET, RTL_TEXTENCODING_UTF8); + } + +} + + +OUString findUserInDescription( const OUString& aDescription ) +{ + OUString user; + + sal_Int32 index; + sal_Int32 lastIndex = 0; + +//#ifdef DEBUG + //OString tmp = OUStringToOString(aDescription, RTL_TEXTENCODING_ASCII_US); + //OSL_TRACE("Portal_XConnector %s\n", tmp.getStr()); +//#endif + + do + { + index = aDescription.indexOf((sal_Unicode) ',', lastIndex); + //OSL_TRACE("Portal_XConnector %d last_index %d\n", index, lastIndex); + OUString token = (index == -1) ? aDescription.copy(lastIndex) : aDescription.copy(lastIndex, index - lastIndex); + +//#ifdef DEBUG + //OString token_tmp = OUStringToOString(token, RTL_TEXTENCODING_ASCII_US); + //OSL_TRACE("Portal_XConnector - token %s\n", token_tmp.getStr()); +//#endif + + lastIndex = index + 1; + + sal_Int32 eindex = token.indexOf((sal_Unicode)'='); + OUString left = token.copy(0, eindex).toLowerCase().trim(); + OUString right = basicEncoder::AsciiEncoder::decodeUnoUrlParamValue(token.copy(eindex + 1).trim()); + +//#ifdef DEBUG + //OString left_tmp = OUStringToOString(left, RTL_TEXTENCODING_ASCII_US); + //OSL_TRACE("Portal_XConnector - left %s\n", left_tmp.getStr()); + //OString right_tmp = OUStringToOString(right, RTL_TEXTENCODING_ASCII_US); + //OSL_TRACE("Portal_XConnector - right %s\n", right_tmp.getStr()); +//#endif + + if(left.equals(OUString(RTL_CONSTASCII_USTRINGPARAM("user")))) + { + user = right; + break; + } + } + while(index != -1); + + return user; + + /* + ORef<IPortalConnector> connector; + + Reference<XConnection> xConnection; + + OUString protocol; + connector = getPortalConnector(protocol); + if(connector.isValid()) + { + ORef<IConnection> connection; + + OUString server; + if(host.getLength()) // let the server empty when there is no host + { + server += host; + server += OUString(RTL_CONSTASCII_USTRINGPARAM(":")); + server += port; + } + + RC state; + + if(user.getLength() && !ticket.getLength()) // if there is a user and no ticket + { + state = connector->connectToService(user, password, server, service, connection); + } + else + { + ByteSequence byteSequence_ticket = AsciiEncoder::decode(ticket); + + state = connector->connectToService(user, byteSequence_ticket, server, service, connection); + } + + if(state == E_None) + xConnection = new Portal_XConnection(connection); + else + throw ConnectionSetupException(OUString(RTL_CONSTASCII_USTRINGPARAM("Portal_XConnector::connect: could not connect")), Reference<XInterface>()); + } + else + throw ConnectionSetupException(OUString(RTL_CONSTASCII_USTRINGPARAM("Portal_XConnector::connect: couldn't get connector")), Reference<XInterface>()); + + return xConnection; + */ +} + +#endif + + + +BOOL needSecurityRestrictions( void ) +{ +#ifdef _USE_UNO + static BOOL bNeedInit = TRUE; + static BOOL bRetVal = TRUE; + + if( bNeedInit ) + { + bNeedInit = FALSE; + + // Get system user to compare to portal user + oslSecurity aSecurity = osl_getCurrentSecurity(); + OUString aSystemUser; + sal_Bool bRet = osl_getUserName( aSecurity, &aSystemUser.pData ); + if( !bRet ) + { + // No valid security! -> Secure mode! + return TRUE; + } + + Reference< XMultiServiceFactory > xSMgr = getProcessServiceFactory(); + if( !xSMgr.is() ) + return TRUE; + Reference< XBridgeFactory > xBridgeFac( xSMgr->createInstance + ( OUString::createFromAscii( "com.sun.star.bridge.BridgeFactory" ) ), UNO_QUERY ); + + Sequence< Reference< XBridge > > aBridgeSeq; + sal_Int32 nBridgeCount = 0; + if( xBridgeFac.is() ) + { + aBridgeSeq = xBridgeFac->getExistingBridges(); + nBridgeCount = aBridgeSeq.getLength(); + } + + if( nBridgeCount == 0 ) + { + // No bridges -> local + bRetVal = FALSE; + return bRetVal; + } + + // Iterate through all bridges to find (portal) user property + const Reference< XBridge >* pBridges = aBridgeSeq.getConstArray(); + bRetVal = FALSE; // Now only TRUE if user different from portal user is found + sal_Int32 i; + for( i = 0 ; i < nBridgeCount ; i++ ) + { + const Reference< XBridge >& rxBridge = pBridges[ i ]; + OUString aDescription = rxBridge->getDescription(); + OUString aPortalUser = findUserInDescription( aDescription ); + if( aPortalUser.getLength() > 0 ) + { + // User Found, compare to system user + if( aPortalUser == aSystemUser ) + { + // Same user -> system security is ok, bRetVal stays FALSE + break; + } + else + { + // Different user -> Secure mode! + bRetVal = TRUE; + break; + } + } + } + // No user found or PortalUser != SystemUser -> Secure mode! (Keep default value) + } + + return bRetVal; +#else + return FALSE; +#endif +} + +// Returns TRUE if UNO is available, otherwise the old +// file system implementation has to be used +// (Implemented in iosys.cxx) +BOOL hasUno( void ) +{ +#ifdef _USE_UNO + static BOOL bNeedInit = TRUE; + static BOOL bRetVal = TRUE; + + if( bNeedInit ) + { + bNeedInit = FALSE; + Reference< XMultiServiceFactory > xSMgr = getProcessServiceFactory(); + if( !xSMgr.is() ) + bRetVal = FALSE; + } + return bRetVal; +#else + return FALSE; +#endif +} + + +#ifdef _USE_UNO + +class UCBStream : public SvStream +{ + Reference< XInputStream > xIS; + Reference< XOutputStream > xOS; + Reference< XStream > xS; + Reference< XSeekable > xSeek; +public: + UCBStream( Reference< XInputStream > & xIS ); + UCBStream( Reference< XOutputStream > & xOS ); + UCBStream( Reference< XStream > & xS ); + ~UCBStream(); + virtual ULONG GetData( void* pData, ULONG nSize ); + virtual ULONG PutData( const void* pData, ULONG nSize ); + virtual ULONG SeekPos( ULONG nPos ); + virtual void FlushData(); + virtual void SetSize( ULONG nSize ); +}; + +/* +ULONG UCBErrorToSvStramError( ucb::IOErrorCode nError ) +{ + ULONG eReturn = ERRCODE_IO_GENERAL; + switch( nError ) + { + case ucb::IOErrorCode_ABORT: eReturn = SVSTREAM_GENERALERROR; break; + case ucb::IOErrorCode_NOT_EXISTING: eReturn = SVSTREAM_FILE_NOT_FOUND; break; + case ucb::IOErrorCode_NOT_EXISTING_PATH: eReturn = SVSTREAM_PATH_NOT_FOUND; break; + case ucb::IOErrorCode_OUT_OF_FILE_HANDLES: eReturn = SVSTREAM_TOO_MANY_OPEN_FILES; break; + case ucb::IOErrorCode_ACCESS_DENIED: eReturn = SVSTREAM_ACCESS_DENIED; break; + case ucb::IOErrorCode_LOCKING_VIOLATION: eReturn = SVSTREAM_SHARING_VIOLATION; break; + + case ucb::IOErrorCode_INVALID_ACCESS: eReturn = SVSTREAM_INVALID_ACCESS; break; + case ucb::IOErrorCode_CANT_CREATE: eReturn = SVSTREAM_CANNOT_MAKE; break; + case ucb::IOErrorCode_INVALID_PARAMETER: eReturn = SVSTREAM_INVALID_PARAMETER; break; + + case ucb::IOErrorCode_CANT_READ: eReturn = SVSTREAM_READ_ERROR; break; + case ucb::IOErrorCode_CANT_WRITE: eReturn = SVSTREAM_WRITE_ERROR; break; + case ucb::IOErrorCode_CANT_SEEK: eReturn = SVSTREAM_SEEK_ERROR; break; + case ucb::IOErrorCode_CANT_TELL: eReturn = SVSTREAM_TELL_ERROR; break; + + case ucb::IOErrorCode_OUT_OF_MEMORY: eReturn = SVSTREAM_OUTOFMEMORY; break; + + case SVSTREAM_FILEFORMAT_ERROR: eReturn = SVSTREAM_FILEFORMAT_ERROR; break; + case ucb::IOErrorCode_WRONG_VERSION: eReturn = SVSTREAM_WRONGVERSION; + case ucb::IOErrorCode_OUT_OF_DISK_SPACE: eReturn = SVSTREAM_DISK_FULL; break; + + case ucb::IOErrorCode_BAD_CRC: eReturn = ERRCODE_IO_BADCRC; break; + } + return eReturn; +} +*/ + +UCBStream::UCBStream( Reference< XInputStream > & rStm ) + : xIS( rStm ) + , xSeek( rStm, UNO_QUERY ) +{ +} + +UCBStream::UCBStream( Reference< XOutputStream > & rStm ) + : xOS( rStm ) + , xSeek( rStm, UNO_QUERY ) +{ +} + +UCBStream::UCBStream( Reference< XStream > & rStm ) + : xS( rStm ) + , xSeek( rStm, UNO_QUERY ) +{ +} + + +UCBStream::~UCBStream() +{ + try + { + if( xIS.is() ) + xIS->closeInput(); + else if( xOS.is() ) + xOS->closeOutput(); + else if( xS.is() ) + xS->closeStream(); + } + catch( Exception & ) + { + SetError( ERRCODE_IO_GENERAL ); + } +} + +ULONG UCBStream::GetData( void* pData, ULONG nSize ) +{ + try + { + if( xIS.is() ) + { + Sequence<sal_Int8> aData; + nSize = xIS->readBytes( aData, nSize ); + rtl_copyMemory( pData, aData.getConstArray(), nSize ); + return nSize; + } + else if( xS.is() ) + { + Sequence<sal_Int8> aData; + nSize = xS->readBytes( aData, nSize ); + rtl_copyMemory( pData, aData.getConstArray(), nSize ); + return nSize; + } + else + SetError( ERRCODE_IO_GENERAL ); + } + catch( Exception & ) + { + SetError( ERRCODE_IO_GENERAL ); + } + return 0; +} + +ULONG UCBStream::PutData( const void* pData, ULONG nSize ) +{ + try + { + if( xOS.is() ) + { + Sequence<sal_Int8> aData( (const sal_Int8 *)pData, nSize ); + xOS->writeBytes( aData ); + return nSize; + } + else if( xS.is() ) + { + Sequence<sal_Int8> aData( (const sal_Int8 *)pData, nSize ); + xS->writeBytes( aData ); + return nSize; + } + else + SetError( ERRCODE_IO_GENERAL ); + } + catch( Exception & ) + { + SetError( ERRCODE_IO_GENERAL ); + } + return 0; +} + +ULONG UCBStream::SeekPos( ULONG nPos ) +{ + if( !nPos ) + return 0; + try + { + if( xSeek.is() ) + { + sal_Int32 nLen = xSeek->getLength(); + if( nPos > nLen ) + nPos = nLen; + xSeek->seek( nPos ); + return nPos; + } + else + SetError( ERRCODE_IO_GENERAL ); + } + catch( Exception & ) + { + SetError( ERRCODE_IO_GENERAL ); + } + return 0; +} + +void UCBStream::FlushData() +{ + try + { + if( xOS.is() ) + xOS->flush(); + else if( xS.is() ) + xS->flush(); + else + SetError( ERRCODE_IO_GENERAL ); + } + catch( Exception & ) + { + SetError( ERRCODE_IO_GENERAL ); + } +} + +void UCBStream::SetSize( ULONG nSize ) +{ + DBG_ERROR( "not allowed to call from basic" ) + SetError( ERRCODE_IO_GENERAL ); +} + +#endif + +// Oeffnen eines Streams +SbError SbiStream::Open +( short nCh, const ByteString& rName, short nStrmMode, short nFlags, short nL ) +{ + nMode = nFlags; + nLen = nL; + nChan = nCh; + nLine = 0; + nExpandOnWriteTo = 0; + if( ( nStrmMode & ( STREAM_READ|STREAM_WRITE ) ) == STREAM_READ ) + nStrmMode |= STREAM_NOCREATE; + String aNameStr( rName, gsl_getSystemTextEncoding() ); +#ifdef _USE_UNO + if( hasUno() ) + { + Reference< XMultiServiceFactory > xSMgr = getProcessServiceFactory(); + if( xSMgr.is() ) + { + Reference< XSimpleFileAccess > + xSFI( xSMgr->createInstance( OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY ); + if( xSFI.is() ) + { + try + { + + if( (nStrmMode & (STREAM_READ | STREAM_WRITE)) == (STREAM_READ | STREAM_WRITE) ) + { + Reference< XStream > xIS = xSFI->openFileReadWrite( aNameStr ); + pStrm = new UCBStream( xIS ); + } + else if( nStrmMode & STREAM_WRITE ) + { + Reference< XStream > xIS = xSFI->openFileReadWrite( aNameStr ); + pStrm = new UCBStream( xIS ); + // Open for writing is not implemented in ucb yet!!! + //Reference< XOutputStream > xIS = xSFI->openFileWrite( aNameStr ); + //pStrm = new UCBStream( xIS ); + } + else //if( nStrmMode & STREAM_READ ) + { + Reference< XInputStream > xIS = xSFI->openFileRead( aNameStr ); + pStrm = new UCBStream( xIS ); + } + } + catch( Exception & ) + { + } + } + } + } + +#endif + if( !pStrm ) + pStrm = new SvFileStream( aNameStr, nStrmMode ); + if( IsAppend() ) + pStrm->Seek( STREAM_SEEK_TO_END ); + MapError(); + if( nError ) + delete pStrm, pStrm = NULL; + return nError; +} + +SbError SbiStream::Close() +{ + if( pStrm ) + { + if( !hasUno() ) + ((SvFileStream *)pStrm)->Close(); + MapError(); + delete pStrm; + pStrm = NULL; + } + nChan = 0; + return nError; +} + +SbError SbiStream::Read( ByteString& rBuf, USHORT n ) +{ + nExpandOnWriteTo = 0; + if( IsText() ) + { + pStrm->ReadLine( rBuf ); + nLine++; + } + else + { + if( !n ) n = nLen; + if( !n ) + return nError = SbERR_BAD_RECORD_LENGTH; + rBuf.Fill( n, ' ' ); + pStrm->Read( (void*)rBuf.GetBuffer(), n ); + } + MapError(); + if( !nError && pStrm->IsEof() ) + nError = SbERR_READ_PAST_EOF; + return nError; +} + +SbError SbiStream::Read( char& ch ) +{ + nExpandOnWriteTo = 0; + if( !aLine.Len() ) + { + Read( aLine, 0 ); + aLine += '\n'; + } + ch = aLine.GetBuffer()[0]; + aLine.Erase( 0, 1 ); + return nError; +} + +void SbiStream::ExpandFile() +{ + if ( nExpandOnWriteTo ) + { + ULONG nCur = pStrm->Seek(STREAM_SEEK_TO_END); + if( nCur < nExpandOnWriteTo ) + { + ULONG nDiff = nExpandOnWriteTo - nCur; + char c = 0; + while( nDiff-- ) + *pStrm << c; + } + else + { + pStrm->Seek( nExpandOnWriteTo ); + } + nExpandOnWriteTo = 0; + } +} + +SbError SbiStream::Write( const ByteString& rBuf, USHORT n ) +{ + ExpandFile(); + if( IsAppend() ) + pStrm->Seek( STREAM_SEEK_TO_END ); + + if( IsText() ) + { + aLine += rBuf; + // Raus damit, wenn das Ende ein LF ist, aber CRLF vorher + // strippen, da der SvStrm ein CRLF anfuegt! + USHORT n = aLine.Len(); + if( n && aLine.GetBuffer()[ --n ] == 0x0A ) + { + aLine.Erase( n ); + if( n && aLine.GetBuffer()[ --n ] == 0x0D ) + aLine.Erase( n ); + pStrm->WriteLines( aLine ); + aLine.Erase(); + } + } + else + { + if( !n ) n = nLen; + if( !n ) + return nError = SbERR_BAD_RECORD_LENGTH; + pStrm->Write( rBuf.GetBuffer(), n ); + MapError(); + } + return nError; +} + +////////////////////////////////////////////////////////////////////////// + +// Zugriff auf das aktuelle I/O-System: + +SbiIoSystem* SbGetIoSystem() +{ + SbiInstance* pInst = pINST; + return pInst ? pInst->GetIoSystem() : NULL; +} + +////////////////////////////////////////////////////////////////////////// + +SbiIoSystem::SbiIoSystem() +{ + for( short i = 0; i < CHANNELS; i++ ) + pChan[ i ] = NULL; + nChan = 0; + nError = 0; +} + +SbiIoSystem::~SbiIoSystem() +{ + Shutdown(); +} + +SbError SbiIoSystem::GetError() +{ + SbError n = nError; nError = 0; + return n; +} + +void SbiIoSystem::Open + ( short nCh, const ByteString& rName, short nMode, short nFlags, short nLen ) +{ + nError = 0; + if( nCh >= CHANNELS || !nCh ) + nError = SbERR_BAD_CHANNEL; + else if( pChan[ nCh ] ) + nError = SbERR_FILE_ALREADY_OPEN; + else + { + pChan[ nCh ] = new SbiStream; + nError = pChan[ nCh ]->Open( nCh, rName, nMode, nFlags, nLen ); + if( nError ) + delete pChan[ nCh ], pChan[ nCh ] = NULL; + } + nChan = 0; +} + +// Aktuellen Kanal schliessen + +void SbiIoSystem::Close() +{ + if( !nChan ) + nError = SbERR_BAD_CHANNEL; + else if( !pChan[ nChan ] ) + nError = SbERR_BAD_CHANNEL; + else + { + nError = pChan[ nChan ]->Close(); + delete pChan[ nChan ]; + pChan[ nChan ] = NULL; + } + nChan = 0; +} + +// Shutdown nach Programmlauf + +void SbiIoSystem::Shutdown() +{ + for( short i = 1; i < CHANNELS; i++ ) + { + if( pChan[ i ] ) + { + USHORT n = pChan[ i ]->Close(); + delete pChan[ i ]; + pChan[ i ] = NULL; + if( n && !nError ) + nError = n; + } + } + nChan = 0; + // Noch was zu PRINTen? + if( aOut.Len() ) + { + String aOutStr( aOut, gsl_getSystemTextEncoding() ); +#if defined GCC + Window* pParent = Application::GetDefModalDialogParent(); + MessBox( pParent, WinBits( WB_OK ), String(), aOutStr ).Execute(); +#else + MessBox( GetpApp()->GetDefModalDialogParent(), WinBits( WB_OK ), String(), aOutStr ).Execute(); +#endif + } + aOut.Erase(); +} + +// Aus aktuellem Kanal lesen + +void SbiIoSystem::Read( ByteString& rBuf, short n ) +{ + if( !nChan ) + ReadCon( rBuf ); + else if( !pChan[ nChan ] ) + nError = SbERR_BAD_CHANNEL; + else + nError = pChan[ nChan ]->Read( rBuf, n ); +} + +char SbiIoSystem::Read() +{ + char ch = ' '; + if( !nChan ) + { + if( !aIn.Len() ) + { + ReadCon( aIn ); + aIn += '\n'; + } + ch = aIn.GetBuffer()[0]; + aIn.Erase( 0, 1 ); + } + else if( !pChan[ nChan ] ) + nError = SbERR_BAD_CHANNEL; + else + nError = pChan[ nChan ]->Read( ch ); + return ch; +} + +void SbiIoSystem::Write( const ByteString& rBuf, short n ) +{ + if( !nChan ) + WriteCon( rBuf ); + else if( !pChan[ nChan ] ) + nError = SbERR_BAD_CHANNEL; + else + nError = pChan[ nChan ]->Write( rBuf, n ); +} + +short SbiIoSystem::NextChannel() +{ + for( short i = 1; i < CHANNELS; i++ ) + { + if( !pChan[ i ] ) + return i; + } + nError = SbERR_TOO_MANY_FILES; + return CHANNELS; +} + +// nChannel == 0..CHANNELS-1 + +SbiStream* SbiIoSystem::GetStream( short nChannel ) const +{ + SbiStream* pRet = 0; + if( nChannel >= 0 && nChannel < CHANNELS ) + pRet = pChan[ nChannel ]; + return pRet; +} + +void SbiIoSystem::CloseAll(void) +{ + for( short i = 1; i < CHANNELS; i++ ) + { + if( pChan[ i ] ) + { + USHORT n = pChan[ i ]->Close(); + delete pChan[ i ]; + pChan[ i ] = NULL; + if( n && !nError ) + nError = n; + } + } +} + +/*************************************************************************** +* +* Console Support +* +***************************************************************************/ + +// Einlesen einer Zeile von der Console + +void SbiIoSystem::ReadCon( ByteString& rIn ) +{ + String aPromptStr( aPrompt, gsl_getSystemTextEncoding() ); + SbiInputDialog aDlg( NULL, aPromptStr ); + if( aDlg.Execute() ) + rIn = ByteString( aDlg.GetInput(), gsl_getSystemTextEncoding() ); + else + nError = SbERR_USER_ABORT; + aPrompt.Erase(); +} + +// Ausgabe einer MessageBox, wenn im Console-Puffer ein CR ist + +void SbiIoSystem::WriteCon( const ByteString& rText ) +{ + aOut += rText; + USHORT n1 = aOut.Search( '\n' ); + USHORT n2 = aOut.Search( '\r' ); + if( n1 != STRING_NOTFOUND || n2 != STRING_NOTFOUND ) + { + if( n1 == STRING_NOTFOUND ) n1 = n2; + else + if( n2 == STRING_NOTFOUND ) n2 = n1; + if( n1 > n2 ) n1 = n2; + ByteString s( aOut.Copy( 0, n1 ) ); + aOut.Erase( 0, n1 ); + while( aOut.GetBuffer()[0] == '\n' || aOut.GetBuffer()[0] == '\r' ) + aOut.Erase( 0, 1 ); + String aStr( s, RTL_TEXTENCODING_ASCII_US ); + if( !MessBox( GetpApp()->GetDefModalDialogParent(), + WinBits( WB_OK_CANCEL | WB_DEF_OK ), + String(), aStr ).Execute() ) + nError = SbERR_USER_ABORT; + } +} + diff --git a/basic/source/runtime/makefile.mk b/basic/source/runtime/makefile.mk new file mode 100644 index 000000000000..24e9e1016f6d --- /dev/null +++ b/basic/source/runtime/makefile.mk @@ -0,0 +1,116 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=BASIC +TARGET=runtime + +# --- Settings ----------------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +.IF "$(GUI)" == "WNT" +ASM=masm386 +.ENDIF + + +# --- Allgemein ----------------------------------------------------------- + +SLOFILES= \ + $(SLO)$/basrdll.obj \ + $(SLO)$/inputbox.obj \ + $(SLO)$/runtime.obj \ + $(SLO)$/step0.obj \ + $(SLO)$/step1.obj \ + $(SLO)$/step2.obj \ + $(SLO)$/iosys.obj \ + $(SLO)$/stdobj.obj \ + $(SLO)$/stdobj1.obj \ + $(SLO)$/methods.obj \ + $(SLO)$/methods1.obj \ + $(SLO)$/props.obj \ + $(SLO)$/ddectrl.obj \ + $(SLO)$/dllmgr.obj + +.IF "$(GUI)$(CPU)" == "WINI" +SLOFILES+= $(SLO)$/win.obj +.ENDIF + +.IF "$(GUI)$(CPU)" == "WNTI" +SLOFILES+= $(SLO)$/wnt.obj +.ENDIF + +.IF "$(GUI)$(CPU)" == "OS2I" +SLOFILES+= $(SLO)$/os2.obj +.ENDIF + +EXCEPTIONSFILES=$(SLO)$/step0.obj \ + $(SLO)$/step2.obj \ + $(SLO)$/methods.obj \ + $(SLO)$/iosys.obj + +# --- Targets ------------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx new file mode 100644 index 000000000000..e3a47cba275c --- /dev/null +++ b/basic/source/runtime/methods.cxx @@ -0,0 +1,3228 @@ +/************************************************************************* + * + * $RCSfile: methods.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef _DATE_HXX //autogen +#include <tools/date.hxx> +#endif +#ifndef _SBXVAR_HXX +#include <svtools/sbxvar.hxx> +#endif +#ifndef _FSYS_HXX //autogen +#include <tools/fsys.hxx> +#endif +#ifndef _INTN_HXX //autogen +#include <tools/intn.hxx> +#endif +#ifndef _VOS_PROCESS_HXX +#include <vos/process.hxx> +#endif +#ifndef _SV_SVAPP_HXX //autogen +#include <vcl/svapp.hxx> +#endif +#ifndef _SV_SOUND_HXX //autogen +#include <vcl/sound.hxx> +#endif +#ifndef _SV_WINTYPES_HXX //autogen +#include <vcl/wintypes.hxx> +#endif +#ifndef _SV_MSGBOX_HXX //autogen +#include <vcl/msgbox.hxx> +#endif +#ifndef _SBXCLASS_HXX //autogen +#include <svtools/sbx.hxx> +#endif +#ifndef _ZFORLIST_HXX //autogen +#include <svtools/zforlist.hxx> +#endif +#ifndef _TOOLS_SOLMATH_HXX //autogen wg. SolarMath +#include <tools/solmath.hxx> +#endif +#include <tools/urlobj.hxx> +#include <osl/file.hxx> + +#ifdef OS2 +#define INCL_WINWINDOWMGR +#define INCL_DOS +#endif + +#if defined (WNT) +#ifndef _SVWIN_H +#include <tools/svwin.h> +#endif +#endif +#if defined (OS2) +#ifndef _SVPM_H +#include <tools/svpm.h> +#endif +#endif + +#pragma hdrstop +#include "runtime.hxx" + +#ifdef _USE_UNO +#include <unotools/processfactory.hxx> + +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/util/DateTime.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/ucb/XSimpleFileAccess.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/io/XOutputStream.hpp> +#include <com/sun/star/io/XStream.hpp> +#include <com/sun/star/io/XSeekable.hpp> + +using namespace utl; +using namespace rtl; +using namespace osl; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::ucb; +using namespace com::sun::star::io; + +#endif /* _USE_UNO */ + +#include "stdobj.hxx" +#include "stdobj1.hxx" +#include "rtlproto.hxx" +#include "basrid.hxx" +#include "sb.hrc" +#ifndef _SBIOSYS_HXX +#include "iosys.hxx" +#endif +#ifndef _DDECTRL_HXX +#include "ddectrl.hxx" +#endif +#include <sbintern.hxx> + +#include <stl/list> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <ctype.h> + +#if defined (WIN) || defined (WNT) || defined (OS2) +#include <direct.h> // _getdcwd get current work directory, _chdrive +#endif + +#ifdef WIN +#include <dos.h> // _dos_getfileattr +#include <errno.h> +#endif + +#ifdef UNX +#include <errno.h> +#include <unistd.h> +#endif + +#ifdef WNT +#include <io.h> +#endif + +#ifdef MAC +#include <mac_start.h> + +#ifndef __FILES__ + #include <Files.h> +#endif + +#ifndef __ERRORS__ + #include <Errors.h> +#endif + +#include <MAC_TOOLS.hxx> +#include <mac_end.h> +#endif + +//#include <numbers.hxx> + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBRUNTIME, SBRUNTIME_CODE ) + + +#if defined (OS2) && defined (__BORLANDC__) +#pragma option -w-par +#endif + +static void FilterWhiteSpace( String& rStr ) +{ + rStr.EraseAllChars( ' ' ); + rStr.EraseAllChars( '\t' ); + rStr.EraseAllChars( '\n' ); + rStr.EraseAllChars( '\r' ); +} + +static long GetDayDiff( const Date& rDate ) +{ + Date aRefDate( 1,1,1900 ); + long nDiffDays; + if ( aRefDate > rDate ) + { + nDiffDays = (long)(aRefDate - rDate); + nDiffDays *= -1; + } + else + nDiffDays = (long)(rDate - aRefDate); + nDiffDays += 2; // Anpassung VisualBasic: 1.Jan.1900 == 2 + return nDiffDays; +} + + +//*** UCB file access *** +// Converts possibly relative paths to absolute paths +// according to the setting done by ChDir/ChDrive +// (Implemented in methods.cxx) +String getFullPath( const String& aRelPath ) +{ + // TODO: Use CurDir to build full path + // First step: Return given path unchanged + return aRelPath; +} + +// Sets (virtual) current path for UCB file access +void implChDir( const String& aDir ) +{ + // TODO +} + +// Sets (virtual) current drive for UCB file access +void implChDrive( const String& aDrive ) +{ + // TODO +} + +// Returns (virtual) current path for UCB file access +String implGetCurDir( void ) +{ + String aRetStr; + + return aRetStr; +} + +// TODO: -> SbiGlobals +static Reference< XSimpleFileAccess > getFileAccess( void ) +{ + static Reference< XSimpleFileAccess > xSFI; + if( !xSFI.is() ) + { + Reference< XMultiServiceFactory > xSMgr = getProcessServiceFactory(); + if( xSMgr.is() ) + { + xSFI = Reference< XSimpleFileAccess >( xSMgr->createInstance + ( OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY ); + } + } + return xSFI; +} + + + + +// Properties und Methoden legen beim Get (bPut = FALSE) den Returnwert +// im Element 0 des Argv ab; beim Put (bPut = TRUE) wird der Wert aus +// Element 0 gespeichert. + +// CreateObject( class ) + +RTLFUNC(CreateObject) +{ + String aClass( rPar.Get( 1 )->GetString() ); + SbxObjectRef p = SbxBase::CreateObject( aClass ); + if( !p ) + StarBASIC::Error( SbERR_CANNOT_LOAD ); + else + { + // Convenience: BASIC als Parent eintragen + p->SetParent( pBasic ); + rPar.Get( 0 )->PutObject( p ); + } +} + +// Error( n ) + +RTLFUNC(Error) +{ + if( !pBasic ) + StarBASIC::Error( SbERR_INTERNAL_ERROR ); + else + { + String aErrorMsg; + SbError nErr = 0L; + if( rPar.Count() == 1 ) + { + nErr = StarBASIC::GetErr(); + aErrorMsg = StarBASIC::GetErrorMsg(); + } + else + { + INT32 nCode = rPar.Get( 1 )->GetLong(); + if( nCode > 65535L ) + StarBASIC::Error( SbERR_CONVERSION ); + else + nErr = StarBASIC::GetSfxFromVBError( (USHORT)nCode ); + } + pBasic->MakeErrorText( nErr, aErrorMsg ); + rPar.Get( 0 )->PutString( pBasic->GetErrorText() ); + } +} + +// Sinus + +RTLFUNC(Sin) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + SbxVariableRef pArg = rPar.Get( 1 ); + rPar.Get( 0 )->PutDouble( sin( pArg->GetDouble() ) ); + } +} + +// Cosinus + +RTLFUNC(Cos) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + SbxVariableRef pArg = rPar.Get( 1 ); + rPar.Get( 0 )->PutDouble( cos( pArg->GetDouble() ) ); + } +} + +// Atn + +RTLFUNC(Atn) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + SbxVariableRef pArg = rPar.Get( 1 ); + rPar.Get( 0 )->PutDouble( atan( pArg->GetDouble() ) ); + } +} + + + +RTLFUNC(Abs) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + SbxVariableRef pArg = rPar.Get( 1 ); + rPar.Get( 0 )->PutDouble( fabs( pArg->GetDouble() ) ); + } +} + + +RTLFUNC(Asc) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + SbxVariableRef pArg = rPar.Get( 1 ); + String aStr( pArg->GetString() ); + if ( aStr.Len() == 0 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + rPar.Get(0)->PutEmpty(); + } + else + { + sal_Unicode aCh = aStr.GetBuffer()[0]; + rPar.Get(0)->PutInteger( (INT16)aCh ); + } + } +} + +RTLFUNC(Chr) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + SbxVariableRef pArg = rPar.Get( 1 ); + char aCh = (char) pArg->GetInteger(); + String aStr; + aStr = aCh; + rPar.Get(0)->PutString( aStr ); + } +} + + +#ifdef UNX +#define _MAX_PATH 260 +#define _PATH_INCR 250 +#endif + +RTLFUNC(CurDir) +{ + // #57064 Obwohl diese Funktion nicht mit DirEntry arbeitet, ist sie von + // der Anpassung an virtuelle URLs nich betroffen, da bei Nutzung der + // DirEntry-Funktionalitaet keine Moeglichkeit besteht, das aktuelle so + // zu ermitteln, dass eine virtuelle URL geliefert werden koennte. + +// rPar.Get(0)->PutEmpty(); +#if defined (WIN) || defined (WNT) || (defined (OS2) && !defined( WTC )) + int nCurDir = 0; // Current dir // JSM + if ( rPar.Count() == 2 ) + { + String aDrive = rPar.Get(1)->GetString(); + if ( aDrive.Len() != 1 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + else + { + nCurDir = (int)aDrive.GetBuffer()[0]; + if ( !isalpha( nCurDir ) ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + else + nCurDir -= ( 'A' - 1 ); + } + } + char* pBuffer = new char[ _MAX_PATH ]; +#ifdef MTW + int old = _getdrive(); + _chdrive(nCurDir); + + if ( getcwd( pBuffer, _MAX_PATH ) != 0 ) + rPar.Get(0)->PutString( String::CreateFromAscii( pBuffer ) ); + else + StarBASIC::Error( SbERR_NO_DEVICE ); + delete pBuffer; + _chdrive(old); +#else +#ifdef OS2 + if( !nCurDir ) + nCurDir = _getdrive(); +#endif + if ( _getdcwd( nCurDir, pBuffer, _MAX_PATH ) != 0 ) + rPar.Get(0)->PutString( String::CreateFromAscii( pBuffer ) ); + else + StarBASIC::Error( SbERR_NO_DEVICE ); + delete pBuffer; +#endif + +#elif defined MAC + + Str255 aBuffer; + FSSpec aFileSpec; // Pseudofile + String aPar1; + OSErr nErr; + + // Erstmal aktuelle Pfad bestimmen + nErr = FSMakeFSSpec(0,0,"\p:X",&aFileSpec); + + PathNameFromDirID( aFileSpec.parID,aFileSpec.vRefNum, (char*) aBuffer); + String aPath((char*) &aBuffer[1],aBuffer[0]); + + if ( rPar.Count() == 2 ) + { + aPar1 = rPar.Get(1)->GetString(); + + // Wen kein ':' drin ist dann haengen wir (netterweise) einen an + if (aPar1.Search(':') == STRING_NOTFOUND) + aPar1 += ':'; + USHORT nFirstColon = aPar1.Search(':'); + if (!aPar1.Len() || + nFirstColon != (aPar1.Len() - 1)) + // Kein ':' am Ende oder mehr als ein ':' oder leerer String + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + // Is Param1 eventuelle das Volume des aktuellen Pfades ? + USHORT nMatchPoint = aPath.Match(aPar1); + if (nMatchPoint != (nFirstColon + 1)) + { + String aPseudoFile(aPar1); + aPseudoFile += 'X'; // Pseudodatei + + nErr = FSMakeFSSpec(0,0,aPseudoFile.GetPascalStr(),&aFileSpec); + + if(nErr == nsvErr) + { + StarBASIC::Error( SbERR_NO_DEVICE ); + return; + } + aPath = aPar1; + } + } + + rPar.Get(0)->PutString(aPath); + +#elif defined( UNX ) + + int nSize = _PATH_INCR; + char* pMem; + while( TRUE ) + { + pMem = new char[nSize]; + if( !pMem ) + { + StarBASIC::Error( SbERR_NO_MEMORY ); + return; + } + if( getcwd( pMem, nSize-1 ) != NULL ) + { + rPar.Get(0)->PutString( String::CreateFromAscii(pMem) ); + delete pMem; + return; + } + if( errno != ERANGE ) + { + StarBASIC::Error( SbERR_INTERNAL_ERROR ); + delete pMem; + return; + } + delete pMem; + nSize += _PATH_INCR; + }; + +#endif +} + +RTLFUNC(ChDir) // JSM +{ + rPar.Get(0)->PutEmpty(); + if (rPar.Count() == 2) + { + String aPath = rPar.Get(1)->GetString(); + BOOL bError = FALSE; +#ifdef WNT + // #55997 Laut MI hilft es bei File-URLs einen DirEntry zwischenzuschalten + // #40996 Harmoniert bei Verwendung der WIN32-Funktion nicht mit getdir + DirEntry aEntry( aPath ); + ByteString aFullPath( aEntry.GetFull(), gsl_getSystemTextEncoding() ); + if( chdir( aFullPath.GetBuffer()) ) + bError = TRUE; +#else + if (!DirEntry(aPath).SetCWD()) + bError = TRUE; +#endif + if( bError ) + StarBASIC::Error( SbERR_PATH_NOT_FOUND ); + } + else + StarBASIC::Error( SbERR_BAD_ARGUMENT ); +} + +RTLFUNC(ChDrive) // JSM +{ + rPar.Get(0)->PutEmpty(); + if (rPar.Count() == 2) + { + // Keine Laufwerke in Unix +#ifndef UNX + String aPar1 = rPar.Get(1)->GetString(); + +#if defined (WIN) || defined (WNT) || (defined (OS2) && !defined (WTC)) + if (aPar1.Len() > 0) + { + int nCurDrive = (int)aPar1.GetBuffer()[0]; ; + if ( !isalpha( nCurDrive ) ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + else + nCurDrive -= ( 'A' - 1 ); + if (_chdrive(nCurDrive)) + StarBASIC::Error( SbERR_NO_DEVICE ); + } +#elif defined MAC + // Wen kein ':' drin ist dann haengen wir (netterweise) einen an + if (aPar1.Search(':') == STRING_NOTFOUND) + aPar1 += ':'; + if (!aPar1.Len() || + aPar1.Search(':') != (aPar1.Len() - 1)) + // Kein ':' am Ende oder mehr als ein ':' oder leerer String + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + DirEntry aDrive(aPar1); + if (aDrive.SetCWD()) + return; + else + StarBASIC::Error( SbERR_NO_DEVICE ); +#endif + +#endif + // #ifndef UNX + } + else + StarBASIC::Error( SbERR_BAD_ARGUMENT ); +} + + +// Implementation of StepRENAME with UCB +void implStepRenameUCB( const String& aSource, const String& aDest ) +{ + Reference< XSimpleFileAccess > xSFI = getFileAccess(); + if( xSFI.is() ) + { + try + { + xSFI->move( getFullPath( aSource ), getFullPath( aDest ) ); + } + catch( Exception & ) + { + StarBASIC::Error( ERRCODE_IO_GENERAL ); + } + } +} + +RTLFUNC(FileCopy) // JSM +{ + rPar.Get(0)->PutEmpty(); + if (rPar.Count() == 3) + { + String aSource = rPar.Get(1)->GetString(); + String aDest = rPar.Get(2)->GetString(); + // <-- UCB + if( hasUno() ) + { + Reference< XSimpleFileAccess > xSFI = getFileAccess(); + if( xSFI.is() ) + { + try + { + xSFI->copy( getFullPath( aSource ), getFullPath( aDest ) ); + } + catch( Exception & ) + { + StarBASIC::Error( ERRCODE_IO_GENERAL ); + } + } + } + else + // --> UCB + { + DirEntry aSourceDirEntry(aSource); + if (aSourceDirEntry.Exists()) + { + if (aSourceDirEntry.CopyTo(DirEntry(aDest),FSYS_ACTION_COPYFILE) != FSYS_ERR_OK) + StarBASIC::Error( SbERR_PATH_NOT_FOUND ); + } + else + StarBASIC::Error( SbERR_PATH_NOT_FOUND ); + } + } + else + StarBASIC::Error( SbERR_BAD_ARGUMENT ); +} + +RTLFUNC(Kill) // JSM +{ + rPar.Get(0)->PutEmpty(); + if (rPar.Count() == 2) + { + String aFileSpec = rPar.Get(1)->GetString(); + + // <-- UCB + if( hasUno() ) + { + Reference< XSimpleFileAccess > xSFI = getFileAccess(); + if( xSFI.is() ) + { + try + { + xSFI->kill( getFullPath( aFileSpec ) ); + } + catch( Exception & ) + { + StarBASIC::Error( ERRCODE_IO_GENERAL ); + } + } + } + else + // --> UCB + { + if(DirEntry(aFileSpec).Kill() != FSYS_ERR_OK) + StarBASIC::Error( SbERR_PATH_NOT_FOUND ); + } + } + else + StarBASIC::Error( SbERR_BAD_ARGUMENT ); +} + +RTLFUNC(MkDir) // JSM +{ + rPar.Get(0)->PutEmpty(); + if (rPar.Count() == 2) + { + String aPath = rPar.Get(1)->GetString(); + + // <-- UCB + if( hasUno() ) + { + Reference< XSimpleFileAccess > xSFI = getFileAccess(); + if( xSFI.is() ) + { + try + { + xSFI->createFolder( getFullPath( aPath ) ); + } + catch( Exception & ) + { + StarBASIC::Error( ERRCODE_IO_GENERAL ); + } + } + } + else + // --> UCB + { + if (!DirEntry(aPath).MakeDir()) + StarBASIC::Error( SbERR_PATH_NOT_FOUND ); + } + } + else + StarBASIC::Error( SbERR_BAD_ARGUMENT ); +} + +RTLFUNC(RmDir) // JSM +{ + rPar.Get(0)->PutEmpty(); + if (rPar.Count() == 2) + { + String aPath = rPar.Get(1)->GetString(); + // <-- UCB + if( hasUno() ) + { + Reference< XSimpleFileAccess > xSFI = getFileAccess(); + if( xSFI.is() ) + { + try + { + xSFI->kill( getFullPath( aPath ) ); + } + catch( Exception & ) + { + StarBASIC::Error( ERRCODE_IO_GENERAL ); + } + } + } + else + // --> UCB + { + DirEntry aDirEntry(aPath); + if (aDirEntry.Kill() != FSYS_ERR_OK) + StarBASIC::Error( SbERR_PATH_NOT_FOUND ); + } + } + else + StarBASIC::Error( SbERR_BAD_ARGUMENT ); +} + +RTLFUNC(SendKeys) // JSM +{ + rPar.Get(0)->PutEmpty(); + StarBASIC::Error(SbERR_NOT_IMPLEMENTED); +} + +RTLFUNC(Exp) +{ + ULONG nArgCount = rPar.Count(); + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + double aDouble = rPar.Get( 1 )->GetDouble(); + aDouble = exp( aDouble ); + rPar.Get( 0 )->PutDouble( aDouble ); + } +} + +RTLFUNC(FileLen) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + SbxVariableRef pArg = rPar.Get( 1 ); + String aStr( pArg->GetString() ); + INT32 nLen = 0; + // <-- UCB + if( hasUno() ) + { + Reference< XSimpleFileAccess > xSFI = getFileAccess(); + if( xSFI.is() ) + { + try + { + nLen = xSFI->getSize( getFullPath( aStr ) ); + } + catch( Exception & ) + { + StarBASIC::Error( ERRCODE_IO_GENERAL ); + } + } + } + else + // --> UCB + { + FileStat aStat = DirEntry( aStr ); + nLen = aStat.GetSize(); + } + rPar.Get(0)->PutLong( (long)nLen ); + } +} + + +RTLFUNC(Hex) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + char aBuffer[16]; + SbxVariableRef pArg = rPar.Get( 1 ); + if ( pArg->IsInteger() ) + sprintf( aBuffer,"%X", pArg->GetInteger() ); + else + sprintf( aBuffer,"%lX", pArg->GetLong() ); + rPar.Get(0)->PutString( String::CreateFromAscii( aBuffer ) ); + } +} + +// InStr( [start],string,string,[compare] ) + +RTLFUNC(InStr) +{ + ULONG nArgCount = rPar.Count()-1; + if ( nArgCount < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + USHORT nStartPos = 1; + + USHORT nFirstStringPos = 1; + if ( nArgCount >= 3 ) + { + nStartPos = (USHORT)(rPar.Get(1)->GetInteger()); + if ( nStartPos == 0 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + nStartPos = 1; + } + nFirstStringPos++; + } + int bNotCaseSensitive = 1; // wird noch nicht ausgewertet + if ( nArgCount == 4 ) + bNotCaseSensitive = rPar.Get(4)->GetInteger(); + + USHORT nPos; + + if( !bNotCaseSensitive ) + { + const String& rStr1 = rPar.Get(nFirstStringPos)->GetString(); + const String& rToken = rPar.Get(nFirstStringPos+1)->GetString(); + + nPos = rStr1.Search( rToken, nStartPos-1 ); + if ( nPos == STRING_NOTFOUND ) + nPos = 0; + else + nPos++; + } + else + { + String aStr1 = rPar.Get(nFirstStringPos)->GetString(); + String aToken = rPar.Get(nFirstStringPos+1)->GetString(); + + aStr1.ToUpperAscii(); + aToken.ToUpperAscii(); + + nPos = aStr1.Search( aToken, nStartPos-1 ); + if ( nPos == STRING_NOTFOUND ) + nPos = 0; + else + nPos++; + } + rPar.Get(0)->PutInteger( (int)nPos ); + } +} + + +/* + Int( 2.8 ) = 2.0 + Int( -2.8 ) = -3.0 + Fix( 2.8 ) = 2.0 + Fix( -2.8 ) = -2.0 <- !! +*/ + +RTLFUNC(Int) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + SbxVariableRef pArg = rPar.Get( 1 ); + double aDouble= pArg->GetDouble(); + /* + floor( 2.8 ) = 2.0 + floor( -2.8 ) = -3.0 + */ + aDouble = floor( aDouble ); + rPar.Get(0)->PutDouble( aDouble ); + } +} + + + +RTLFUNC(Fix) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + SbxVariableRef pArg = rPar.Get( 1 ); + double aDouble = pArg->GetDouble(); + if ( aDouble >= 0.0 ) + aDouble = floor( aDouble ); + else + aDouble = ceil( aDouble ); + rPar.Get(0)->PutDouble( aDouble ); + } +} + + +RTLFUNC(LCase) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + const International& rInt = GetpApp()->GetAppInternational(); + String aStr( rPar.Get(1)->GetString() ); + rInt.ToLower( aStr ); + rPar.Get(0)->PutString( aStr ); + } +} + +RTLFUNC(Left) +{ + ULONG nArgCount = rPar.Count(); + if ( rPar.Count() < 3 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + String aStr( rPar.Get(1)->GetString() ); + short nCount = (USHORT)( rPar.Get(2)->GetLong() ); + if ( nCount < 0 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + aStr.Erase( (USHORT)nCount ); + rPar.Get(0)->PutString( aStr ); + } + } +} + +RTLFUNC(Log) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + double aArg = rPar.Get(1)->GetDouble(); + if ( aArg > 0 ) + rPar.Get( 0 )->PutDouble( log( aArg )); + else + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + } +} + +RTLFUNC(LTrim) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + String aStr( rPar.Get(1)->GetString() ); + aStr.EraseLeadingChars(); + rPar.Get(0)->PutString( aStr ); + } +} + + +// Mid( String, nStart, nLength ) + +RTLFUNC(Mid) +{ + ULONG nArgCount = rPar.Count()-1; + if ( nArgCount < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + // #23178: Funktionalitaet von Mid$ als Anweisung nachbilden, indem + // als weiterer (4.) Parameter ein Ersetzungsstring aufgenommen wird. + // Anders als im Original kann in dieser Variante der 3. Parameter + // nLength nicht weggelassen werden. Ist ueber bWrite schon vorgesehen. + if( nArgCount == 4 ) + bWrite = TRUE; + + String aArgStr = rPar.Get(1)->GetString(); + USHORT nStartPos = (USHORT)(rPar.Get(2)->GetLong() ); + if ( nStartPos == 0 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + nStartPos--; + USHORT nLen = 0xffff; + if ( nArgCount == 3 || bWrite ) + nLen = (USHORT)(rPar.Get(3)->GetLong() ); + String aResultStr; + if ( bWrite ) + { + aResultStr = aArgStr; + aResultStr.Erase( nStartPos, nLen ); + aResultStr.Insert(rPar.Get(4)->GetString(),0,nLen,nStartPos); + rPar.Get(1)->PutString( aResultStr ); + } + else + { + aResultStr = aArgStr.Copy( nStartPos, nLen ); + rPar.Get(0)->PutString( aResultStr ); + } + } + } +} + +RTLFUNC(Oct) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + char aBuffer[16]; + SbxVariableRef pArg = rPar.Get( 1 ); + if ( pArg->IsInteger() ) + sprintf( aBuffer,"%o", pArg->GetInteger() ); + else + sprintf( aBuffer,"%lo", pArg->GetLong() ); + rPar.Get(0)->PutString( String::CreateFromAscii( aBuffer ) ); + } +} + +RTLFUNC(Right) +{ + ULONG nArgCount = rPar.Count(); + if ( rPar.Count() < 3 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + const String& rStr = rPar.Get(1)->GetString(); + USHORT nResultLen = (USHORT)(rPar.Get(2)->GetLong() ); + USHORT nStrLen = rStr.Len(); + if ( nResultLen > nStrLen ) + nResultLen = nStrLen; + String aResultStr = rStr.Copy( nStrLen-nResultLen ); + rPar.Get(0)->PutString( aResultStr ); + } +} + +RTLFUNC(RTrim) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + String aStr( rPar.Get(1)->GetString() ); + aStr.EraseTrailingChars(); + rPar.Get(0)->PutString( aStr ); + } +} + +RTLFUNC(Sgn) +{ + ULONG nArgCount = rPar.Count(); + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + double aDouble = rPar.Get(1)->GetDouble(); + INT16 nResult = 0; + if ( aDouble > 0 ) + nResult = 1; + else if ( aDouble < 0 ) + nResult = -1; + rPar.Get(0)->PutInteger( nResult ); + } +} + +RTLFUNC(Space) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + String aStr; + aStr.Fill( (USHORT)(rPar.Get(1)->GetLong() )); + rPar.Get(0)->PutString( aStr ); + } +} + +RTLFUNC(Spc) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + String aStr; + aStr.Fill( (USHORT)(rPar.Get(1)->GetLong() )); + rPar.Get(0)->PutString( aStr ); + } +} + +RTLFUNC(Sqr) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + double aDouble = rPar.Get(1)->GetDouble(); + if ( aDouble >= 0 ) + rPar.Get(0)->PutDouble( sqrt( aDouble )); + else + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + } +} + +RTLFUNC(Str) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + String aStr; + rPar.Get( 1 )->Format( aStr ); + // Numbers start with a space + if( rPar.Get( 1 )->IsNumericRTL() ) + aStr.Insert( ' ', 0 ); + // Kommas durch Punkte ersetzen, damits symmetrisch zu Val ist! + aStr.SearchAndReplace( ',', '.' ); + rPar.Get(0)->PutString( aStr ); + } +} + +RTLFUNC(StrComp) +{ + + if ( rPar.Count() < 3 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + rPar.Get(0)->PutEmpty(); + return; + } + const String& rStr1 = rPar.Get(1)->GetString(); + const String& rStr2 = rPar.Get(2)->GetString(); + INT16 nNotCaseSensitive = TRUE; + if ( rPar.Count() == 4 ) + nNotCaseSensitive = rPar.Get(3)->GetInteger(); + + const International& aInternational = GetpApp()->GetAppInternational(); + StringCompare aResult; + if ( !nNotCaseSensitive ) + aResult = aInternational.Compare( rStr1, rStr2 ); + else + aResult = rStr1.CompareTo( rStr2 ); + int nRetValue = 0; + if ( aResult == COMPARE_LESS ) + nRetValue = -1; + else if ( aResult == COMPARE_GREATER ) + nRetValue = 1; + rPar.Get(0)->PutInteger( nRetValue ); +} + +RTLFUNC(String) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + String aStr; + sal_Unicode aFiller; + USHORT nCount = (USHORT)(rPar.Get(1)->GetLong()); + if( rPar.Get(2)->GetType() == SbxINTEGER ) + aFiller = (char)rPar.Get(2)->GetInteger(); + else + { + const String& rStr = rPar.Get(2)->GetString(); + aFiller = rStr.GetBuffer()[0]; + } + aStr.Fill( nCount, aFiller ); + rPar.Get(0)->PutString( aStr ); + } +} + +RTLFUNC(Tan) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + SbxVariableRef pArg = rPar.Get( 1 ); + rPar.Get( 0 )->PutDouble( tan( pArg->GetDouble() ) ); + } +} + +RTLFUNC(UCase) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + const International& rInt = GetpApp()->GetAppInternational(); + String aStr( rPar.Get(1)->GetString() ); + rInt.ToUpper( aStr ); + rPar.Get(0)->PutString( aStr ); + } +} + + +RTLFUNC(Val) +{ + static International aEnglischIntn( LANGUAGE_ENGLISH_US, LANGUAGE_ENGLISH_US ); + + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + double nResult; + char* pEndPtr; + + String aStr( rPar.Get(1)->GetString() ); +// lt. Mikkysoft bei Kommas abbrechen! +// for( USHORT n=0; n < aStr.Len(); n++ ) +// if( aStr[n] == ',' ) aStr[n] = '.'; + + FilterWhiteSpace( aStr ); + if ( aStr.GetBuffer()[0] == '&' && aStr.Len() > 1 ) + { + int nRadix = 10; + char aChar = aStr.GetBuffer()[1]; + if ( aChar == 'h' || aChar == 'H' ) + nRadix = 16; + else if ( aChar == 'o' || aChar == 'O' ) + nRadix = 8; + if ( nRadix != 10 ) + { + ByteString aByteStr( aStr, gsl_getSystemTextEncoding() ); + INT16 nlResult = (INT16)strtol( aByteStr.GetBuffer()+2, &pEndPtr, nRadix); + nResult = (double)nlResult; + } + } + else + { + // #57844 Lokalisierte Funktion benutzen + int nErrno; + nResult = SolarMath::StringToDouble( aStr.GetBuffer(), aEnglischIntn, nErrno ); + // ATL: nResult = strtod( aStr.GetStr(), &pEndPtr ); + } + + rPar.Get(0)->PutDouble( nResult ); + } +} + +RTLFUNC(DateSerial) +{ + if ( rPar.Count() < 4 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + INT16 nYear = rPar.Get(1)->GetInteger(); + INT16 nMonth = rPar.Get(2)->GetInteger(); + INT16 nDay = rPar.Get(3)->GetInteger(); + if ( nYear < 100 ) + nYear += 1900; + if ((nYear < 100 || nYear > 9999) || + (nMonth < 1 || nMonth > 12 ) || + (nDay < 1 || nDay > 31 )) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + Date aCurDate( nDay, nMonth, nYear ); + long nDiffDays = GetDayDiff( aCurDate ); + rPar.Get(0)->PutDate( (double)nDiffDays ); // JSM +} + +RTLFUNC(TimeSerial) +{ + if ( rPar.Count() < 4 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + INT16 nHour = rPar.Get(1)->GetInteger(); + if ( nHour == 24 ) + nHour = 0; // Wegen UNO DateTimes, die bis 24 Uhr gehen + INT16 nMinute = rPar.Get(2)->GetInteger(); + INT16 nSecond = rPar.Get(3)->GetInteger(); + if ((nHour < 0 || nHour > 23) || + (nMinute < 0 || nMinute > 59 ) || + (nSecond < 0 || nSecond > 59 )) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + INT32 nSeconds = nHour; + nSeconds *= 3600; + nSeconds += nMinute * 60; + nSeconds += nSecond; + double nDays = ((double)nSeconds) / (double)(86400.0); + rPar.Get(0)->PutDate( nDays ); // JSM +} + +RTLFUNC(DateValue) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + // #39629 pINST pruefen, kann aus URL-Zeile gerufen werden + SvNumberFormatter* pFormatter = NULL; + if( pINST ) + pFormatter = pINST->GetNumberFormatter(); + else + { + ULONG n; // Dummy + SbiInstance::PrepareNumberFormatter( pFormatter, n, n, n ); + } + + ULONG nIndex; + double fResult; + String aStr( rPar.Get(1)->GetString() ); + BOOL bSuccess = pFormatter->IsNumberFormat( aStr, nIndex, fResult ); + short nType = pFormatter->GetType( nIndex ); + if(bSuccess && (nType==NUMBERFORMAT_DATE || nType==NUMBERFORMAT_DATETIME)) + { + if ( nType == NUMBERFORMAT_DATETIME ) + { + // Zeit abschneiden + if ( fResult > 0.0 ) + fResult = floor( fResult ); + else + fResult = ceil( fResult ); + } + // fResult += 2.0; // Anpassung StarCalcFormatter + rPar.Get(0)->PutDate( fResult ); // JSM + } + else + StarBASIC::Error( SbERR_CONVERSION ); + + // #39629 pFormatter kann selbst angefordert sein + if( !pINST ) + delete pFormatter; + } +} + +RTLFUNC(TimeValue) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + // #39629 pINST pruefen, kann aus URL-Zeile gerufen werden + SvNumberFormatter* pFormatter = NULL; + if( pINST ) + pFormatter = pINST->GetNumberFormatter(); + else + { + ULONG n; // Dummy + SbiInstance::PrepareNumberFormatter( pFormatter, n, n, n ); + } + + ULONG nIndex; + double fResult; + BOOL bSuccess = pFormatter->IsNumberFormat( rPar.Get(1)->GetString(), + nIndex, fResult ); + short nType = pFormatter->GetType(nIndex); + if(bSuccess && (nType==NUMBERFORMAT_TIME||nType==NUMBERFORMAT_DATETIME)) + { + if ( nType == NUMBERFORMAT_DATETIME ) + // Tage abschneiden + fResult = fmod( fResult, 1 ); + rPar.Get(0)->PutDate( fResult ); // JSM + } + else + StarBASIC::Error( SbERR_CONVERSION ); + + // #39629 pFormatter kann selbst angefordert sein + if( !pINST ) + delete pFormatter; + } +} + +RTLFUNC(Day) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + SbxVariableRef pArg = rPar.Get( 1 ); + double aDouble = pArg->GetDate(); + aDouble -= 2.0; // normieren: 1.1.1900 => 0.0 + Date aRefDate( 1, 1, 1900 ); + // aDouble = Fix( aDouble ); + if ( aDouble >= 0.0 ) + { + aDouble = floor( aDouble ); + aRefDate += (ULONG)aDouble; + } + else + { + aDouble = ceil( aDouble ); + aRefDate -= (ULONG)(-1.0 * aDouble); + } + rPar.Get(0)->PutInteger( (INT16)(aRefDate.GetDay())); + } +} + +RTLFUNC(Weekday) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + Date aRefDate( 1,1,1900 ); + long nDays = (long) rPar.Get(1)->GetDate(); + nDays -= 2; // normieren: 1.1.1900 => 0 + aRefDate += nDays; + DayOfWeek aDay = aRefDate.GetDayOfWeek(); + INT16 nDay; + if ( aDay != SUNDAY ) + nDay = (INT16)aDay + 2; + else + nDay = 1; // 1==Sonntag + rPar.Get(0)->PutInteger( nDay ); + } +} + +RTLFUNC(Year) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + Date aRefDate( 1,1,1900 ); + long nDays = (long) rPar.Get(1)->GetDate(); + nDays -= 2; // normieren: 1.1.1900 => 0.0 + aRefDate += nDays; + rPar.Get(0)->PutInteger( (INT16)(aRefDate.GetYear()) ); + } +} + +RTLFUNC(Hour) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + double nArg = rPar.Get(1)->GetDate(); + if ( nArg < 0.0 ) + nArg *= -1.0; + double nFrac = nArg - floor( nArg ); + nFrac *= 86400.0; + INT32 nSeconds = (INT32)nFrac; + INT16 nHour = (INT16)(nSeconds / 3600); + rPar.Get(0)->PutInteger( nHour ); + } +} + + +RTLFUNC(Minute) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + double nArg = rPar.Get(1)->GetDate(); + if ( nArg < 0.0 ) + nArg *= -1.0; + double nFrac = nArg - floor( nArg ); + nFrac *= 86400.0; + INT32 nSeconds = (INT32)nFrac; + INT16 nTemp = (INT16)(nSeconds % 3600); + INT16 nMin = nTemp / 60; + rPar.Get(0)->PutInteger( nMin ); + } +} + +RTLFUNC(Month) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + Date aRefDate( 1,1,1900 ); + long nDays = (long) rPar.Get(1)->GetDate(); + nDays -= 2; // normieren: 1.1.1900 => 0.0 + aRefDate += nDays; + rPar.Get(0)->PutInteger( (INT16)(aRefDate.GetMonth()) ); + } +} + +RTLFUNC(Second) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + double nArg = rPar.Get(1)->GetDate(); + if ( nArg < 0.0 ) + nArg *= -1.0; + double nFrac = nArg - floor( nArg ); + nFrac *= 86400.0; + INT32 nSeconds = (INT32)nFrac; + INT16 nTemp = (INT16)(nSeconds / 3600); + nSeconds -= nTemp * 3600; + nTemp = (INT16)(nSeconds / 60); + nSeconds -= nTemp * 60; + rPar.Get(0)->PutInteger( (INT16)nSeconds ); + } +} + +// Date Now(void) + +RTLFUNC(Now) +{ + Date aDate; + Time aTime; + double aSerial = (double)GetDayDiff( aDate ); + long nSeconds = aTime.GetHour(); + nSeconds *= 3600; + nSeconds += aTime.GetMin() * 60; + nSeconds += aTime.GetSec(); + double nDays = ((double)nSeconds) / (double)(24.0*3600.0); + aSerial += nDays; + rPar.Get(0)->PutDate( aSerial ); +} + +// Date Time(void) + +RTLFUNC(Time) +{ + if ( !bWrite ) + { + Time aTime; + SbxVariable* pMeth = rPar.Get( 0 ); + String aRes; + if( pMeth->IsFixed() ) + { + // Time$: hh:mm:ss + char buf[ 20 ]; + sprintf( buf, "%02d:%02d:%02d", + aTime.GetHour(), aTime.GetMin(), aTime.GetSec() ); + aRes = String::CreateFromAscii( buf ); + } + else + { + // Time: system dependent + long nSeconds=aTime.GetHour(); + nSeconds *= 3600; + nSeconds += aTime.GetMin() * 60; + nSeconds += aTime.GetSec(); + double nDays = (double)nSeconds * ( 1.0 / (24.0*3600.0) ); + Color* pCol; + + // #39629 pINST pruefen, kann aus URL-Zeile gerufen werden + SvNumberFormatter* pFormatter = NULL; + ULONG nIndex; + if( pINST ) + { + pFormatter = pINST->GetNumberFormatter(); + nIndex = pINST->GetStdTimeIdx(); + } + else + { + ULONG n; // Dummy + SbiInstance::PrepareNumberFormatter( pFormatter, n, nIndex, n ); + } + + pFormatter->GetOutputString( nDays, nIndex, aRes, &pCol ); + + // #39629 pFormatter kann selbst angefordert sein + if( !pINST ) + delete pFormatter; + } + pMeth->PutString( aRes ); + } + else + { + StarBASIC::Error( SbERR_NOT_IMPLEMENTED ); + } +} + +RTLFUNC(Timer) +{ + Time aTime; + long nSeconds = aTime.GetHour(); + nSeconds *= 3600; + nSeconds += aTime.GetMin() * 60; + nSeconds += aTime.GetSec(); + rPar.Get(0)->PutDate( (double)nSeconds ); +} + + +RTLFUNC(Date) +{ + if ( !bWrite ) + { + Date aToday; + double nDays = (double)GetDayDiff( aToday ); + SbxVariable* pMeth = rPar.Get( 0 ); + if( pMeth->IsString() ) + { + String aRes; + Color* pCol; + + // #39629 pINST pruefen, kann aus URL-Zeile gerufen werden + SvNumberFormatter* pFormatter = NULL; + ULONG nIndex; + if( pINST ) + { + pFormatter = pINST->GetNumberFormatter(); + nIndex = pINST->GetStdDateIdx(); + } + else + { + ULONG n; // Dummy + SbiInstance::PrepareNumberFormatter( pFormatter, nIndex, n, n ); + } + + pFormatter->GetOutputString( nDays, nIndex, aRes, &pCol ); + pMeth->PutString( aRes ); + + // #39629 pFormatter kann selbst angefordert sein + if( !pINST ) + delete pFormatter; + } + else + pMeth->PutDate( nDays ); + } + else + { + StarBASIC::Error( SbERR_NOT_IMPLEMENTED ); + } +} + +RTLFUNC(IsArray) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + rPar.Get(0)->PutBool((rPar.Get(1)->GetType() & SbxARRAY) ? TRUE : FALSE ); +} + +RTLFUNC(IsObject) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + rPar.Get( 0 )->PutBool( rPar.Get(1)->IsObject() ); +} + +RTLFUNC(IsDate) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + // #46134 Nur String wird konvertiert, andere Typen ergeben FALSE + SbxVariableRef xArg = rPar.Get( 1 ); + SbxDataType eType = xArg->GetType(); + BOOL bDate = FALSE; + + if( eType == SbxDATE ) + { + bDate = TRUE; + } + else if( eType == SbxSTRING ) + { + // Error loeschen + SbxError nPrevError = SbxBase::GetError(); + SbxBase::ResetError(); + + // Konvertierung des Parameters nach SbxDATE erzwingen + xArg->SbxValue::GetDate(); + + // Bei Fehler ist es kein Date + bDate = !SbxBase::IsError(); + + // Error-Situation wiederherstellen + SbxBase::ResetError(); + SbxBase::SetError( nPrevError ); + } + rPar.Get( 0 )->PutBool( bDate ); + } +} + +RTLFUNC(IsEmpty) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + rPar.Get( 0 )->PutBool( rPar.Get(1)->IsEmpty() ); +} + +RTLFUNC(IsError) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + rPar.Get( 0 )->PutBool( rPar.Get(1)->IsErr() ); +} + +RTLFUNC(IsNull) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + // #51475 Wegen Uno-Objekten auch true liefern, + // wenn der pObj-Wert NULL ist + SbxVariableRef pArg = rPar.Get( 1 ); + BOOL bNull = rPar.Get(1)->IsNull(); + if( !bNull && pArg->GetType() == SbxOBJECT ) + { + SbxBase* pObj = pArg->GetObject(); + if( !pObj ) + bNull = TRUE; + } + rPar.Get( 0 )->PutBool( bNull ); + } +} + +RTLFUNC(IsNumeric) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + rPar.Get( 0 )->PutBool( rPar.Get( 1 )->IsNumericRTL() ); +} + +// Das machen wir auf die billige Tour + +RTLFUNC(IsMissing) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + // #57915 Missing wird durch Error angezeigt + rPar.Get( 0 )->PutBool( rPar.Get(1)->IsErr() ); +} + +// Dir( [Maske] [,Attrs] ) +// ToDo: Library-globaler Datenbereich fuer Dir-Objekt und Flags + +static String getFileNameFromURL( const String& aURL ); + +RTLFUNC(Dir) +{ + String aPath; + + USHORT nParCount = rPar.Count(); + if( nParCount > 3 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + SbiRTLData* pRTLData = pINST->GetRTLData(); + + // #34645: Kann auch von der URL-Zeile ueber 'macro: Dir' aufgerufen werden + // dann existiert kein pRTLData und die Methode muss verlassen werden + if( !pRTLData ) + return; + + // <-- UCB + if( hasUno() ) + { + Reference< XSimpleFileAccess > xSFI = getFileAccess(); + if( xSFI.is() ) + { + if ( nParCount >= 2 ) + { + String aStr = getFullPath( rPar.Get(1)->GetString() ); + OUString aUNCPath; + FileBase::normalizePath( aStr, aUNCPath ); + OUString aFileURLStr; + FileBase::getFileURLFromNormalizedPath( aUNCPath, aFileURLStr ); + + try + { + String aDirURLStr; + sal_Bool bFolder = sal_False; + try { bFolder = xSFI->isFolder( aFileURLStr ); } + catch( Exception & ) {} + //catch( ::ucb::ContentCreationException & e ) + //{ + //::ucb::ContentCreationException::Reason aReason = e.getReason(); + //} + + if( bFolder ) + { + aDirURLStr = aFileURLStr; + } + else + { + INetURLObject aFileURL( aFileURLStr ); + + // Not folder but exists? Return file! + sal_Bool bExists = sal_False; + try { bExists = xSFI->exists( aFileURLStr ); } + //catch( ::ucb::ContentCreationException & e ) + //{ + //::ucb::ContentCreationException::Reason aReason = e.getReason(); + //} + catch( Exception & ) {} + if( bExists ) + { + String aNameOnlyStr = aFileURL.getName( INetURLObject::LAST_SEGMENT, + true, INetURLObject::DECODE_WITH_CHARSET ); + rPar.Get(0)->PutString( aNameOnlyStr ); + return; + } + aDirURLStr = aFileURL.GetPath(); + } + + USHORT nFlags = 0; + if ( nParCount > 2 ) + pRTLData->nDirFlags = nFlags = rPar.Get(2)->GetInteger(); + else + pRTLData->nDirFlags = 0; + + // Read directory + sal_Bool bIncludeFolders = ((nFlags & Sb_ATTR_DIRECTORY) != 0); + pRTLData->aDirSeq = xSFI->getFolderContents( aDirURLStr, bIncludeFolders ); + pRTLData->nCurDirPos = 0; + } + catch( Exception & ) + { + //StarBASIC::Error( ERRCODE_IO_GENERAL ); + } + } + + + if( pRTLData->aDirSeq.getLength() > 0 ) + { + sal_Bool bOnlyFolders = ((pRTLData->nDirFlags & Sb_ATTR_DIRECTORY) != 0); + for( ;; ) + { + if( pRTLData->nCurDirPos >= pRTLData->aDirSeq.getLength() ) + { + pRTLData->aDirSeq.realloc( 0 ); + aPath.Erase(); + break; + } + else + { + OUString aFile = pRTLData->aDirSeq.getConstArray()[pRTLData->nCurDirPos++]; + + // Only directories? + if( bOnlyFolders ) + { + sal_Bool bFolder = sal_False; + try { bFolder = xSFI->isFolder( aFile ); } + catch( Exception & ) {} + if( !bFolder ) + continue; + } + + INetURLObject aURL( aFile ); + aPath = aURL.getName( INetURLObject::LAST_SEGMENT, true, + INetURLObject::DECODE_WITH_CHARSET ); + break; + } + } + } + rPar.Get(0)->PutString( aPath ); + } + } + else + // --> UCB + { + if ( nParCount >= 2 ) + { + delete pRTLData->pDir; + pRTLData->pDir = 0; // wg. Sonderbehandlung Sb_ATTR_VOLUME + DirEntry aEntry( rPar.Get(1)->GetString() ); + FileStat aStat( aEntry ); + if(!aStat.GetError() && (aStat.GetKind() & FSYS_KIND_FILE)) + { + // ah ja, ist nur ein dateiname + // Pfad abschneiden (wg. VB4) + rPar.Get(0)->PutString( aEntry.GetName() ); + return; + } + USHORT nFlags = 0; + if ( nParCount > 2 ) + pRTLData->nDirFlags = nFlags = rPar.Get(2)->GetInteger(); + else + pRTLData->nDirFlags = 0; + // Nur diese Bitmaske ist unter Windows erlaubt + #ifdef WIN + if( nFlags & ~0x1E ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ), pRTLData->nDirFlags = 0; + #endif + // Sb_ATTR_VOLUME wird getrennt gehandelt + if( pRTLData->nDirFlags & Sb_ATTR_VOLUME ) + aPath = aEntry.GetVolume(); + else + { + // Die richtige Auswahl treffen + USHORT nMode = FSYS_KIND_FILE; + if( nFlags & Sb_ATTR_DIRECTORY ) + nMode |= FSYS_KIND_DIR; + if( nFlags == Sb_ATTR_DIRECTORY ) + nMode = FSYS_KIND_DIR; + pRTLData->pDir = new Dir( aEntry, (DirEntryKind) nMode ); + pRTLData->nCurDirPos = 0; + } + } + + if( pRTLData->pDir ) + { + for( ;; ) + { + if( pRTLData->nCurDirPos >= pRTLData->pDir->Count() ) + { + delete pRTLData->pDir; + pRTLData->pDir = 0; + aPath.Erase(); + break; + } + DirEntry aNextEntry=(*(pRTLData->pDir))[pRTLData->nCurDirPos++]; + aPath = aNextEntry.GetName(); //Full(); + #ifdef WIN + aNextEntry.ToAbs(); + String sFull(aNextEntry.GetFull()); + unsigned nFlags; + + if (_dos_getfileattr( sFull.GetStr(), &nFlags )) + StarBASIC::Error( SbERR_FILE_NOT_FOUND ); + else + { + INT16 nCurFlags = pRTLData->nDirFlags; + if( (nCurFlags == Sb_ATTR_NORMAL) + && !(nFlags & ( _A_HIDDEN | _A_SYSTEM | _A_VOLID | _A_SUBDIR ) ) ) + break; + else if( (nCurFlags & Sb_ATTR_HIDDEN) && (nFlags & _A_HIDDEN) ) + break; + else if( (nCurFlags & Sb_ATTR_SYSTEM) && (nFlags & _A_SYSTEM) ) + break; + else if( (nCurFlags & Sb_ATTR_VOLUME) && (nFlags & _A_VOLID) ) + break; + else if( (nCurFlags & Sb_ATTR_DIRECTORY) && (nFlags & _A_SUBDIR) ) + break; + } + #else + break; + #endif + } + } + rPar.Get(0)->PutString( aPath ); + } + } +} + + +RTLFUNC(GetAttr) +{ + if ( rPar.Count() == 2 ) + { + INT16 nFlags = 0; + + // <-- UCB + if( hasUno() ) + { + Reference< XSimpleFileAccess > xSFI = getFileAccess(); + if( xSFI.is() ) + { + try + { + String aPath = getFullPath( rPar.Get(1)->GetString() ); + sal_Bool bExists = sal_False; + try { bExists = xSFI->exists( aPath ); } + catch( Exception & ) {} + if( !bExists ) + { + StarBASIC::Error( SbERR_FILE_NOT_FOUND ); + return; + } + + sal_Bool bReadOnly = xSFI->isReadOnly( aPath ); + sal_Bool bDirectory = xSFI->isFolder( aPath ); + if( bReadOnly ) + nFlags |= 0x0001; // ATTR_READONLY + if( bDirectory ) + nFlags |= 0x0010; // ATTR_DIRECTORY + } + catch( Exception & ) + { + StarBASIC::Error( ERRCODE_IO_GENERAL ); + } + } + } + else + // --> UCB + { + DirEntry aEntry( rPar.Get(1)->GetString() ); + aEntry.ToAbs(); + BOOL bUseFileStat = FALSE; + + // #57064 Bei virtuellen URLs den Real-Path extrahieren + String aFile = aEntry.GetFull(); + ByteString aByteStrFullPath( aEntry.GetFull(), gsl_getSystemTextEncoding() ); + #if defined( WIN ) + int nErr = _dos_getfileattr( aByteStrFullPath.GetBuffer(),(unsigned *) &nFlags ); + if ( nErr ) + StarBASIC::Error( SbERR_FILE_NOT_FOUND ); + #elif defined( WNT ) + DWORD nRealFlags = GetFileAttributes (aByteStrFullPath.GetBuffer()); + if (nRealFlags != 0xffffffff) + { + if (nRealFlags == FILE_ATTRIBUTE_NORMAL) + nRealFlags = 0; + nFlags = (INT16) (nRealFlags); + } + else + StarBASIC::Error( SbERR_FILE_NOT_FOUND ); + #elif defined( OS2 ) + FILESTATUS3 aFileStatus; + APIRET rc = DosQueryPathInfo(aByteStrFullPath.GetBuffer(),1, + &aFileStatus,sizeof(FILESTATUS3)); + if (!rc) + nFlags = (INT16) aFileStatus.attrFile; + else + StarBASIC::Error( SbERR_FILE_NOT_FOUND ); + #else + bUseFileStat = TRUE; + #endif + if( bUseFileStat ) + { + if( FileStat::GetReadOnlyFlag( aEntry ) ) + nFlags |= 0x0001; // ATTR_READONLY + FileStat aStat( aEntry ); + DirEntryKind eKind = aStat.GetKind(); + if( eKind & FSYS_KIND_DIR ) + nFlags |= 0x0010; // ATTR_DIRECTORY + if( aEntry.GetFlag() & FSYS_FLAG_VOLUME ) + nFlags |= 0x0008; // ATTR_VOLUME + } + } + rPar.Get(0)->PutInteger( nFlags ); + } + else + StarBASIC::Error( SbERR_BAD_ARGUMENT ); +} + + +RTLFUNC(FileDateTime) +{ + if ( rPar.Count() != 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + + // <-- UCB + String aPath = rPar.Get(1)->GetString(); + Time aTime; + Date aDate; + if( hasUno() ) + { + Reference< XSimpleFileAccess > xSFI = getFileAccess(); + if( xSFI.is() ) + { + try + { + com::sun::star::util::DateTime aUnoDT = xSFI->getDateTimeModified( aPath ); + aTime = Time( aUnoDT.Hours, aUnoDT.Minutes, aUnoDT.Seconds, aUnoDT.HundredthSeconds ); + aDate = Date( aUnoDT.Day, aUnoDT.Month, aUnoDT.Year ); + } + catch( Exception & ) + { + StarBASIC::Error( ERRCODE_IO_GENERAL ); + } + } + } + else + // --> UCB + { + DirEntry aEntry( aPath ); + FileStat aStat( aEntry ); + aTime = Time( aStat.TimeModified() ); + aDate = Date( aStat.DateModified() ); + } + + double fSerial = (double)GetDayDiff( aDate ); + long nSeconds = aTime.GetHour(); + nSeconds *= 3600; + nSeconds += aTime.GetMin() * 60; + nSeconds += aTime.GetSec(); + double nDays = ((double)nSeconds) / (double)(24.0*3600.0); + fSerial += nDays; + + Color* pCol; + + // #39629 pINST pruefen, kann aus URL-Zeile gerufen werden + SvNumberFormatter* pFormatter = NULL; + ULONG nIndex; + if( pINST ) + { + pFormatter = pINST->GetNumberFormatter(); + nIndex = pINST->GetStdDateTimeIdx(); + } + else + { + ULONG n; // Dummy + SbiInstance::PrepareNumberFormatter( pFormatter, n, n, nIndex ); + } + + String aRes; + pFormatter->GetOutputString( fSerial, nIndex, aRes, &pCol ); + rPar.Get(0)->PutString( aRes ); + + // #39629 pFormatter kann selbst angefordert sein + if( !pINST ) + delete pFormatter; + } +} + + +RTLFUNC(EOF) +{ + // AB 08/16/2000: No changes for UCB + if ( rPar.Count() != 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + INT16 nChannel = rPar.Get(1)->GetInteger(); + // nChannel--; // macht MD beim Oeffnen auch nicht + SbiIoSystem* pIO = pINST->GetIoSystem(); + SbiStream* pSbStrm = pIO->GetStream( nChannel ); + if ( !pSbStrm ) + { + StarBASIC::Error( SbERR_BAD_CHANNEL ); + return; + } + BOOL bIsEof; + SvStream* pSvStrm = pSbStrm->GetStrm(); + if ( pSbStrm->IsText() ) + { + char cBla; + (*pSvStrm) >> cBla; // koennen wir noch ein Zeichen lesen + bIsEof = pSvStrm->IsEof(); + if ( !bIsEof ) + pSvStrm->SeekRel( -1 ); + } + else + bIsEof = pSvStrm->IsEof(); // fuer binaerdateien! + rPar.Get(0)->PutBool( bIsEof ); + } +} + +RTLFUNC(FileAttr) +{ + // AB 08/16/2000: No changes for UCB + + // #57064 Obwohl diese Funktion nicht mit DirEntry arbeitet, ist sie von + // der Anpassung an virtuelle URLs nich betroffen, da sie nur auf bereits + // geoeffneten Dateien arbeitet und der Name hier keine Rolle spielt. + + if ( rPar.Count() != 3 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + INT16 nChannel = rPar.Get(1)->GetInteger(); +// nChannel--; + SbiIoSystem* pIO = pINST->GetIoSystem(); + SbiStream* pSbStrm = pIO->GetStream( nChannel ); + if ( !pSbStrm ) + { + StarBASIC::Error( SbERR_BAD_CHANNEL ); + return; + } + INT16 nRet; + if ( rPar.Get(2)->GetInteger() == 1 ) + nRet = (INT16)(pSbStrm->GetMode()); + else + nRet = 0; // System file handle not supported + + rPar.Get(0)->PutInteger( nRet ); + } +} +RTLFUNC(Loc) +{ + // AB 08/16/2000: No changes for UCB + if ( rPar.Count() != 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + INT16 nChannel = rPar.Get(1)->GetInteger(); + SbiIoSystem* pIO = pINST->GetIoSystem(); + SbiStream* pSbStrm = pIO->GetStream( nChannel ); + if ( !pSbStrm ) + { + StarBASIC::Error( SbERR_BAD_CHANNEL ); + return; + } + SvStream* pSvStrm = pSbStrm->GetStrm(); + ULONG nPos; + if( pSbStrm->IsRandom()) + { + short nBlockLen = pSbStrm->GetBlockLen(); + nPos = nBlockLen ? (pSvStrm->Tell() / nBlockLen) : 0; + nPos++; // Blockpositionen beginnen bei 1 + } + else if ( pSbStrm->IsText() ) + nPos = pSbStrm->GetLine(); + else if( pSbStrm->IsBinary() ) + nPos = pSvStrm->Tell(); + else if ( pSbStrm->IsSeq() ) + nPos = ( pSvStrm->Tell()+1 ) / 128; + else + nPos = pSvStrm->Tell(); + rPar.Get(0)->PutLong( (INT32)nPos ); + } +} + +RTLFUNC(Lof) +{ + // AB 08/16/2000: No changes for UCB + if ( rPar.Count() != 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + INT16 nChannel = rPar.Get(1)->GetInteger(); + SbiIoSystem* pIO = pINST->GetIoSystem(); + SbiStream* pSbStrm = pIO->GetStream( nChannel ); + if ( !pSbStrm ) + { + StarBASIC::Error( SbERR_BAD_CHANNEL ); + return; + } + SvStream* pSvStrm = pSbStrm->GetStrm(); + ULONG nOldPos = pSvStrm->Tell(); + ULONG nLen = pSvStrm->Seek( STREAM_SEEK_TO_END ); + pSvStrm->Seek( nOldPos ); + rPar.Get(0)->PutLong( (INT32)nLen ); + } +} + + +RTLFUNC(Seek) +{ + // AB 08/16/2000: No changes for UCB + int nArgs = (int)rPar.Count(); + if ( nArgs < 2 || nArgs > 3 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + INT16 nChannel = rPar.Get(1)->GetInteger(); +// nChannel--; + SbiIoSystem* pIO = pINST->GetIoSystem(); + SbiStream* pSbStrm = pIO->GetStream( nChannel ); + if ( !pSbStrm ) + { + StarBASIC::Error( SbERR_BAD_CHANNEL ); + return; + } + SvStream* pStrm = pSbStrm->GetStrm(); + + if ( nArgs == 2 ) // Seek-Function + { + ULONG nPos = pStrm->Tell(); + if( pSbStrm->IsRandom() ) + nPos = nPos / pSbStrm->GetBlockLen(); + nPos++; // Basic zaehlt ab 1 + rPar.Get(0)->PutLong( (INT32)nPos ); + } + else // Seek-Statement + { + INT32 nPos = rPar.Get(2)->GetLong(); + if ( nPos < 1 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + nPos--; // Basic zaehlt ab 1, SvStreams zaehlen ab 0 + pSbStrm->SetExpandOnWriteTo( 0 ); + if ( pSbStrm->IsRandom() ) + nPos *= pSbStrm->GetBlockLen(); + pStrm->Seek( (ULONG)nPos ); + pSbStrm->SetExpandOnWriteTo( nPos ); + } +} + +RTLFUNC(Format) +{ + USHORT nArgCount = (USHORT)rPar.Count(); + if ( nArgCount < 2 || nArgCount > 3 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + String aResult; + if( nArgCount == 2 ) + rPar.Get(1)->Format( aResult ); + else + { + String aFmt( rPar.Get(2)->GetString() ); + rPar.Get(1)->Format( aResult, &aFmt ); + } + rPar.Get(0)->PutString( aResult ); + } +} + +RTLFUNC(Randomize) +{ + if ( rPar.Count() > 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + INT16 nSeed; + if( rPar.Count() == 2 ) + nSeed = (INT16)rPar.Get(1)->GetInteger(); + else + nSeed = (INT16)rand(); + srand( nSeed ); +} + +RTLFUNC(Rnd) +{ + if ( rPar.Count() > 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + double nRand = (double)rand(); + nRand = ( nRand / (double)RAND_MAX ); + rPar.Get(0)->PutDouble( nRand ); + } +} + + +// +// Syntax: Shell("Path",[ Window-Style,[ "Params", [ bSync = FALSE ]]]) +// +// WindowStyles (VBA-kompatibel): +// 2 == Minimized +// 3 == Maximized +// 10 == Full-Screen (Textmodus-Anwendungen OS/2, WIN95, WNT) +// +// !!!HACK der WindowStyle wird im Creator an Application::StartApp +// uebergeben. Format: "xxxx2" +// + + +RTLFUNC(Shell) +{ + // No shell command for "virtual" portal users + if( needSecurityRestrictions() ) + { + StarBASIC::Error(SbERR_NOT_IMPLEMENTED); + return; + } + + if ( rPar.Count() < 2 || rPar.Count() > 5 ) + { + rPar.Get(0)->PutLong(0); + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + } + else + { + USHORT nOptions = NAMESPACE_VOS(OProcess)::TOption_SearchPath| + NAMESPACE_VOS(OProcess)::TOption_Detached; + String aCmdLine = rPar.Get(1)->GetString(); + // Zusaetzliche Parameter anhaengen, es muss eh alles geparsed werden + if( rPar.Count() >= 4 ) + { + aCmdLine.AppendAscii( " " ); + aCmdLine += rPar.Get(3)->GetString(); + } + else if( !aCmdLine.Len() ) + { + // Spezial-Behandlung (leere Liste) vermeiden + aCmdLine.AppendAscii( " " ); + } + USHORT nLen = aCmdLine.Len(); + + // #55735 Wenn Parameter dabei sind, muessen die abgetrennt werden + // #72471 Auch die einzelnen Parameter trennen + std::list<String> aTokenList; + String aToken; + USHORT i = 0; + char c; + while( i < nLen ) + { + // Spaces weg + while( ( c = aCmdLine.GetBuffer()[ i ] ) == ' ' || c == '\t' ) + i++; + + if( c == '\"' || c == '\'' ) + { + USHORT iFoundPos = aCmdLine.Search( c, i + 1 ); + + // Wenn nichts gefunden wurde, Rest kopieren + if( iFoundPos == STRING_NOTFOUND ) + { + aToken = aCmdLine.Copy( i, STRING_LEN ); + i = nLen; + } + else + { + aToken = aCmdLine.Copy( i + 1, (iFoundPos - i - 1) ); + i = iFoundPos + 1; + } + } + else + { + USHORT iFoundSpacePos = aCmdLine.Search( ' ', i ); + USHORT iFoundTabPos = aCmdLine.Search( '\t', i ); + USHORT iFoundPos = Min( iFoundSpacePos, iFoundTabPos ); + + // Wenn nichts gefunden wurde, Rest kopieren + if( iFoundPos == STRING_NOTFOUND ) + { + aToken = aCmdLine.Copy( i, STRING_LEN ); + i = nLen; + } + else + { + aToken = aCmdLine.Copy( i, (iFoundPos - i) ); + i = iFoundPos; + } + } + + // In die Liste uebernehmen + aTokenList.push_back( aToken ); + } + // #55735 / #72471 Ende + + INT16 nWinStyle = 0; + if( rPar.Count() >= 3 ) + { + nWinStyle = rPar.Get(2)->GetInteger(); + switch( nWinStyle ) + { + case 2: + nOptions |= NAMESPACE_VOS(OProcess)::TOption_Minimized; + break; + case 3: + nOptions |= NAMESPACE_VOS(OProcess)::TOption_Maximized; + break; + case 10: + nOptions |= NAMESPACE_VOS(OProcess)::TOption_FullScreen; + break; + } + } + NAMESPACE_VOS(OProcess)::TProcessOption eOptions = + (NAMESPACE_VOS(OProcess)::TProcessOption)nOptions; + + + // #72471 Parameter aufbereiten + std::list<String>::const_iterator iter = aTokenList.begin(); + const String& rStr = *iter; + NAMESPACE_RTL(OUString) aOUStrProg( rStr.GetBuffer(), rStr.Len() ); + iter++; + + USHORT nParamCount = aTokenList.size() - 1; + NAMESPACE_RTL(OUString)* pArgumentList = NULL; + //const char** pParamList = NULL; + if( nParamCount ) + { + pArgumentList = new NAMESPACE_RTL(OUString)[ nParamCount ]; + //pParamList = new const char*[ nParamCount ]; + USHORT iList = 0; + while( iter != aTokenList.end() ) + { + const String& rParamStr = (*iter); + pArgumentList[iList++] = NAMESPACE_RTL(OUString)( rParamStr.GetBuffer(), rParamStr.Len() ); + //pParamList[iList++] = (*iter).GetStr(); + iter++; + } + } + + //const char* pParams = aParams.Len() ? aParams.GetStr() : 0; + NAMESPACE_VOS(OProcess)* pApp; + pApp = new NAMESPACE_VOS(OProcess)( aOUStrProg ); + BOOL bSucc; + if( nParamCount == 0 ) + { + bSucc = pApp->execute( eOptions ) == NAMESPACE_VOS(OProcess)::E_None; + } + else + { + NAMESPACE_VOS(OArgumentList) aArgList( pArgumentList, nParamCount ); + bSucc = pApp->execute( eOptions, aArgList ) == NAMESPACE_VOS(OProcess)::E_None; + } + + /* + if( nParamCount == 0 ) + pApp = new NAMESPACE_VOS(OProcess)( pProg ); + else + pApp = new NAMESPACE_VOS(OProcess)( pProg, pParamList, nParamCount ); + BOOL bSucc = pApp->execute( eOptions ) == NAMESPACE_VOS(OProcess)::E_None; + */ + + delete pApp; + delete[] pArgumentList; + if( !bSucc ) + StarBASIC::Error( SbERR_FILE_NOT_FOUND ); + else + rPar.Get(0)->PutLong( 0 ); + } +} + +RTLFUNC(VarType) +{ + if ( rPar.Count() != 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + SbxDataType eType = rPar.Get(1)->GetType(); + rPar.Get(0)->PutInteger( (INT16)eType ); + } +} + +RTLFUNC(TypeName) +{ + static const char* pTypeNames[] = + { + "Empty", + "Null", + "Integer", + "Long", + "Single", + "Double", + "Currency", + "Date", + "String", + "Object", + "Error", + "Boolean", + "Variant", + "DataObject", + "Unknown Type", + "Unknown Type", + "Char", + "Byte", + "UShort", + "ULong", + "Long64", + "ULong64", + "Int", + "UInt", + "Void", + "HResult", + "Pointer", + "DimArray", + "CArray", + "Userdef", + "Lpstr", + "Lpwstr", + "Unknown Type", + }; + + if ( rPar.Count() != 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + SbxDataType eType = rPar.Get(1)->GetType(); + BOOL bIsArray = ( ( eType & SbxARRAY ) != 0 ); + int nPos = ((int)eType) & 0x0FFF; + USHORT nTypeNameCount = sizeof( pTypeNames ) / sizeof( char* ); + if ( nPos < 0 || nPos >= nTypeNameCount ) + nPos = nTypeNameCount - 1; + String aRetStr = String::CreateFromAscii( pTypeNames[nPos] ); + if( bIsArray ) + aRetStr.AppendAscii( "()" ); + rPar.Get(0)->PutString( aRetStr ); + } +} + +RTLFUNC(Len) +{ + if ( rPar.Count() != 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + const String& rStr = rPar.Get(1)->GetString(); + rPar.Get(0)->PutLong( (INT32)rStr.Len() ); + } +} + +RTLFUNC(DDEInitiate) +{ + // No DDE for "virtual" portal users + if( needSecurityRestrictions() ) + { + StarBASIC::Error(SbERR_NOT_IMPLEMENTED); + return; + } + + int nArgs = (int)rPar.Count(); + if ( nArgs != 3 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + const String& rApp = rPar.Get(1)->GetString(); + const String& rTopic = rPar.Get(2)->GetString(); + + SbiDdeControl* pDDE = pINST->GetDdeControl(); + INT16 nChannel; + SbError nDdeErr = pDDE->Initiate( rApp, rTopic, nChannel ); + if( nDdeErr ) + StarBASIC::Error( nDdeErr ); + else + rPar.Get(0)->PutInteger( nChannel ); +} + +RTLFUNC(DDETerminate) +{ + // No DDE for "virtual" portal users + if( needSecurityRestrictions() ) + { + StarBASIC::Error(SbERR_NOT_IMPLEMENTED); + return; + } + + rPar.Get(0)->PutEmpty(); + int nArgs = (int)rPar.Count(); + if ( nArgs != 2 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + INT16 nChannel = rPar.Get(1)->GetInteger(); + SbiDdeControl* pDDE = pINST->GetDdeControl(); + SbError nDdeErr = pDDE->Terminate( nChannel ); + if( nDdeErr ) + StarBASIC::Error( nDdeErr ); +} + +RTLFUNC(DDETerminateAll) +{ + // No DDE for "virtual" portal users + if( needSecurityRestrictions() ) + { + StarBASIC::Error(SbERR_NOT_IMPLEMENTED); + return; + } + + rPar.Get(0)->PutEmpty(); + int nArgs = (int)rPar.Count(); + if ( nArgs != 1 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + SbiDdeControl* pDDE = pINST->GetDdeControl(); + SbError nDdeErr = pDDE->TerminateAll(); + if( nDdeErr ) + StarBASIC::Error( nDdeErr ); + +} + +RTLFUNC(DDERequest) +{ + // No DDE for "virtual" portal users + if( needSecurityRestrictions() ) + { + StarBASIC::Error(SbERR_NOT_IMPLEMENTED); + return; + } + + int nArgs = (int)rPar.Count(); + if ( nArgs != 3 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + INT16 nChannel = rPar.Get(1)->GetInteger(); + const String& rItem = rPar.Get(2)->GetString(); + SbiDdeControl* pDDE = pINST->GetDdeControl(); + String aResult; + SbError nDdeErr = pDDE->Request( nChannel, rItem, aResult ); + if( nDdeErr ) + StarBASIC::Error( nDdeErr ); + else + rPar.Get(0)->PutString( aResult ); +} + +RTLFUNC(DDEExecute) +{ + // No DDE for "virtual" portal users + if( needSecurityRestrictions() ) + { + StarBASIC::Error(SbERR_NOT_IMPLEMENTED); + return; + } + + rPar.Get(0)->PutEmpty(); + int nArgs = (int)rPar.Count(); + if ( nArgs != 3 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + INT16 nChannel = rPar.Get(1)->GetInteger(); + const String& rCommand = rPar.Get(2)->GetString(); + SbiDdeControl* pDDE = pINST->GetDdeControl(); + SbError nDdeErr = pDDE->Execute( nChannel, rCommand ); + if( nDdeErr ) + StarBASIC::Error( nDdeErr ); +} + +RTLFUNC(DDEPoke) +{ + // No DDE for "virtual" portal users + if( needSecurityRestrictions() ) + { + StarBASIC::Error(SbERR_NOT_IMPLEMENTED); + return; + } + + rPar.Get(0)->PutEmpty(); + int nArgs = (int)rPar.Count(); + if ( nArgs != 4 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + INT16 nChannel = rPar.Get(1)->GetInteger(); + const String& rItem = rPar.Get(2)->GetString(); + const String& rData = rPar.Get(3)->GetString(); + SbiDdeControl* pDDE = pINST->GetDdeControl(); + SbError nDdeErr = pDDE->Poke( nChannel, rItem, rData ); + if( nDdeErr ) + StarBASIC::Error( nDdeErr ); +} + + +RTLFUNC(FreeFile) +{ + if ( rPar.Count() != 1 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + SbiIoSystem* pIO = pINST->GetIoSystem(); + short nChannel = 1; + while( nChannel < CHANNELS ) + { + SbiStream* pStrm = pIO->GetStream( nChannel ); + if( !pStrm ) + { + rPar.Get(0)->PutInteger( nChannel ); + return; + } + nChannel++; + } + StarBASIC::Error( SbERR_TOO_MANY_FILES ); +} + +RTLFUNC(LBound) +{ + USHORT nParCount = rPar.Count(); + if ( nParCount != 3 && nParCount != 2 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + SbxBase* pParObj = rPar.Get(1)->GetObject(); + SbxDimArray* pArr = PTR_CAST(SbxDimArray,pParObj); + if( pArr ) + { + short nLower, nUpper; + short nDim = (nParCount == 3) ? (short)rPar.Get(2)->GetInteger() : 1; + if( !pArr->GetDim( nDim, nLower, nUpper ) ) + StarBASIC::Error( SbERR_OUT_OF_RANGE ); + else + rPar.Get(0)->PutInteger( (INT16)nLower ); + } + else + StarBASIC::Error( SbERR_MUST_HAVE_DIMS ); +} + +RTLFUNC(UBound) +{ + USHORT nParCount = rPar.Count(); + if ( nParCount != 3 && nParCount != 2 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + SbxBase* pParObj = rPar.Get(1)->GetObject(); + SbxDimArray* pArr = PTR_CAST(SbxDimArray,pParObj); + if( pArr ) + { + short nLower, nUpper; + short nDim = (nParCount == 3) ? (short)rPar.Get(2)->GetInteger() : 1; + if( !pArr->GetDim( nDim, nLower, nUpper ) ) + StarBASIC::Error( SbERR_OUT_OF_RANGE ); + else + rPar.Get(0)->PutInteger( (INT16)nUpper ); + } + else + StarBASIC::Error( SbERR_MUST_HAVE_DIMS ); +} + +RTLFUNC(RGB) +{ + if ( rPar.Count() != 4 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + ULONG nRed = rPar.Get(1)->GetInteger() & 0xFF; + ULONG nGreen = rPar.Get(2)->GetInteger() & 0xFF; + ULONG nBlue = rPar.Get(3)->GetInteger() & 0xFF; + ULONG nRGB = (nRed << 16) | (nGreen << 8) | nBlue; + rPar.Get(0)->PutLong( nRGB ); +} + +RTLFUNC(QBColor) +{ + if ( rPar.Count() != 2 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + Color aCol( (ColorName)rPar.Get(1)->GetInteger() ); + + ULONG nRed = aCol.GetRed() >> 8; + ULONG nGreen = aCol.GetGreen() >> 8; + ULONG nBlue = aCol.GetBlue() >> 8; + ULONG nRGB = (nRed << 16) | (nGreen << 8) | nBlue; + rPar.Get(0)->PutLong( nRGB ); +} + + +RTLFUNC(StrConv) +{ + DBG_ASSERT(0,"StrConv:Not implemented"); +// if ( rPar.Count() != 3 ) +// { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); +// return; +// } +} + +RTLFUNC(Beep) +{ + if ( rPar.Count() != 1 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + Sound::Beep(); +} + +RTLFUNC(Load) +{ + if( rPar.Count() != 2 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + // Diesen Call einfach an das Object weiterreichen + SbxBase* pObj = (SbxObject*)rPar.Get(1)->GetObject(); + if( pObj && pObj->IsA( TYPE( SbxObject ) ) ) + { + SbxVariable* pVar = ((SbxObject*)pObj)-> + Find( String( RTL_CONSTASCII_USTRINGPARAM("Load") ), SbxCLASS_METHOD ); + if( pVar ) + pVar->GetInteger(); + } +} + +RTLFUNC(Unload) +{ + rPar.Get(0)->PutEmpty(); + if( rPar.Count() != 2 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + // Diesen Call einfach an das Object weitereichen + SbxBase* pObj = (SbxObject*)rPar.Get(1)->GetObject(); + if( pObj && pObj->IsA( TYPE( SbxObject ) ) ) + { + SbxVariable* pVar = ((SbxObject*)pObj)-> + Find( String( RTL_CONSTASCII_USTRINGPARAM("Unload") ), SbxCLASS_METHOD ); + if( pVar ) + pVar->GetInteger(); + } +} + +RTLFUNC(LoadPicture) +{ + if( rPar.Count() != 2 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + SbxObjectRef xRef = new SbStdPicture; + + SvFileStream aIStream( rPar.Get(1)->GetString(), STREAM_READ ); + Bitmap aBmp; + aIStream >> aBmp; + Graphic aGraphic( aBmp ); + ((SbStdPicture*)(SbxObject*)xRef)->SetGraphic( aGraphic ); + rPar.Get(0)->PutObject( xRef ); +} + +RTLFUNC(SavePicture) +{ + rPar.Get(0)->PutEmpty(); + if( rPar.Count() != 3 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + SbxBase* pObj = (SbxObject*)rPar.Get(1)->GetObject(); + if( pObj->IsA( TYPE( SbStdPicture ) ) ) + { + SvFileStream aOStream( rPar.Get(2)->GetString(), STREAM_WRITE | STREAM_TRUNC ); + Graphic aGraphic = ((SbStdPicture*)pObj)->GetGraphic(); + aOStream << aGraphic; + } +} + + +//----------------------------------------------------------------------------------------- +/* +class SbiAboutStarBasicDlg : public ModalDialog +{ + OKButton aOkButton; + Control aCtrl; + +public: + SbiAboutStarBasicDlg(); +}; + +SbiAboutStarBasicDlg::SbiAboutStarBasicDlg() : + ModalDialog( GetpApp()->GetAppWindow(), BasicResId( RID_BASIC_START ) ), + aOkButton( this, BasicResId( 1 ) ), + aCtrl( this, BasicResId( 1 ) ) +{ + FreeResource(); +} +*/ +//----------------------------------------------------------------------------------------- + +RTLFUNC(AboutStarBasic) +{ + /* + String aName; + if( rPar.Count() >= 2 ) + { + aName = rPar.Get(1)->GetString(); + } + + SbiAboutStarBasicDlg* pDlg = new SbiAboutStarBasicDlg; + pDlg->Execute(); + delete pDlg; + */ +} + +// MsgBox( msg [,type[,title]] ) + +RTLFUNC(MsgBox) +{ + static const WinBits nStyleMap[] = + { + WB_OK, // MB_OK + WB_OK_CANCEL, // MB_OKCANCEL + WB_RETRY_CANCEL, // MB_ABORTRETRYIGNORE + WB_YES_NO_CANCEL, // MB_YESNOCANCEL + WB_YES_NO, // MB_YESNO + WB_RETRY_CANCEL // MB_RETRYCANCEL + }; + static const INT16 nButtonMap[] = + { + 2, // #define RET_CANCEL FALSE + 1, // #define RET_OK TRUE + 6, // #define RET_YES 2 + 7, // #define RET_NO 3 + 4 // #define RET_RETRY 4 + }; + + + USHORT nArgCount = (USHORT)rPar.Count(); + if( nArgCount < 2 || nArgCount > 4 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + WinBits nWinBits; + WinBits nType = 0; // MB_OK + if( nArgCount >= 3 ) + nType = (WinBits)rPar.Get(2)->GetInteger(); + WinBits nStyle = nType; + nStyle &= 15; // Bits 4-16 loeschen + if( nStyle > 5 ) + nStyle = 0; + + nWinBits = nStyleMap[ nStyle ]; + if( nType & 4096 ) + nWinBits |= WB_SYSMODAL; + if( nType & 256 ) + { + if( nStyle == 5 || nStyle == 2) + nWinBits |= WB_DEF_CANCEL; + else + nWinBits |= (WB_DEF_CANCEL | WB_DEF_RETRY | WB_DEF_NO); + } + if( nType & 512 ) + nWinBits |= WB_DEF_CANCEL; + + String aMsg = rPar.Get(1)->GetString(); + String aTitle; + if( nArgCount == 4 ) + aTitle = rPar.Get(3)->GetString(); + else + aTitle = GetpApp()->GetAppName(); + + nType &= (16+32+64); + MessBox* pBox = 0; + Window* pParent = GetpApp()->GetDefModalDialogParent(); + switch( nType ) + { + case 16: + pBox = new ErrorBox( pParent, nWinBits, aMsg ); + break; + case 32: + pBox = new QueryBox( pParent, nWinBits, aMsg ); + break; + case 48: + pBox = new WarningBox( pParent, nWinBits, aMsg ); + break; + case 64: + pBox = new InfoBox( pParent, aMsg ); + break; + default: + pBox = new MessBox( pParent, nWinBits, aTitle, aMsg ); + } + pBox->SetText( aTitle ); + USHORT nRet = (USHORT)pBox->Execute(); + if( nRet == TRUE ) + nRet = 1; + rPar.Get(0)->PutInteger( nButtonMap[ nRet ] ); + delete pBox; +} + +RTLFUNC(SetAttr) // JSM +{ + rPar.Get(0)->PutEmpty(); + if ( rPar.Count() == 3 ) + { + String aStr = rPar.Get(1)->GetString(); + INT16 nFlags = rPar.Get(2)->GetInteger(); + + // <-- UCB + if( hasUno() ) + { + Reference< XSimpleFileAccess > xSFI = getFileAccess(); + if( xSFI.is() ) + { + try + { + sal_Bool bReadOnly = (nFlags & 0x0001) != 0; // ATTR_READONLY + xSFI->setReadOnly( aStr, bReadOnly ); + } + catch( Exception & ) + { + StarBASIC::Error( ERRCODE_IO_GENERAL ); + } + } + } + else + // --> UCB + { + // #57064 Bei virtuellen URLs den Real-Path extrahieren + DirEntry aEntry( aStr ); + String aFile = aEntry.GetFull(); + #ifdef WIN + int nErr = _dos_setfileattr( aFile.GetStr(),(unsigned ) nFlags ); + if ( nErr ) + { + if (errno == EACCES) + StarBASIC::Error( SbERR_ACCESS_DENIED ); + else + StarBASIC::Error( SbERR_FILE_NOT_FOUND ); + } + #endif + ByteString aByteFile( aFile, gsl_getSystemTextEncoding() ); + #ifdef WNT + if (!SetFileAttributes (aByteFile.GetBuffer(),(DWORD)nFlags)) + StarBASIC::Error(SbERR_FILE_NOT_FOUND); + #endif + #ifdef OS2 + FILESTATUS3 aFileStatus; + APIRET rc = DosQueryPathInfo(aByteFile.GetBuffer(),1, + &aFileStatus,sizeof(FILESTATUS3)); + if (!rc) + { + if (aFileStatus.attrFile != nFlags) + { + aFileStatus.attrFile = nFlags; + rc = DosSetPathInfo(aFile.GetStr(),1, + &aFileStatus,sizeof(FILESTATUS3),0); + if (rc) + StarBASIC::Error( SbERR_FILE_NOT_FOUND ); + } + } + else + StarBASIC::Error( SbERR_FILE_NOT_FOUND ); + #endif + } + } + else + StarBASIC::Error( SbERR_BAD_ARGUMENT ); +} + +RTLFUNC(Reset) // JSM +{ + SbiIoSystem* pIO = pINST->GetIoSystem(); + if (pIO) + pIO->CloseAll(); +} + +RTLFUNC(DumpAllObjects) +{ + USHORT nArgCount = (USHORT)rPar.Count(); + if( nArgCount < 2 || nArgCount > 3 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else if( !pBasic ) + StarBASIC::Error( SbERR_INTERNAL_ERROR ); + else + { + SbxObject* p = pBasic; + while( p->GetParent() ) + p = p->GetParent(); + SvFileStream aStrm( rPar.Get( 1 )->GetString(), + STREAM_WRITE | STREAM_TRUNC ); + p->Dump( aStrm, rPar.Get( 2 )->GetBool() ); + aStrm.Close(); + if( aStrm.GetError() != SVSTREAM_OK ) + StarBASIC::Error( SbERR_IO_ERROR ); + } +} + + +RTLFUNC(FileExists) +{ + if ( rPar.Count() == 2 ) + { + String aStr = rPar.Get(1)->GetString(); + BOOL bExists = FALSE; + + // <-- UCB + if( hasUno() ) + { + Reference< XSimpleFileAccess > xSFI = getFileAccess(); + if( xSFI.is() ) + { + try + { + bExists = xSFI->exists( aStr ); + } + catch( Exception & ) + { + StarBASIC::Error( ERRCODE_IO_GENERAL ); + } + } + } + else + // --> UCB + { + DirEntry aEntry( aStr ); + bExists = aEntry.Exists(); + } + rPar.Get(0)->PutBool( bExists ); + } + else + StarBASIC::Error( SbERR_BAD_ARGUMENT ); +} + diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx new file mode 100644 index 000000000000..5265ec824324 --- /dev/null +++ b/basic/source/runtime/methods1.cxx @@ -0,0 +1,1266 @@ +/************************************************************************* + * + * $RCSfile: methods1.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#if defined(WIN) +#include <string.h> +#else +#include <stdlib.h> // getenv +#endif + +#ifndef NOOLDSV //autogen +#include <vcl/system.hxx> +#endif +#ifndef _SV_SVAPP_HXX //autogen +#include <vcl/svapp.hxx> +#endif +#ifndef _SV_MAPMOD_HXX +#include <vcl/mapmod.hxx> +#endif +#ifndef _SV_WRKWIN_HXX +#include <vcl/wrkwin.hxx> +#endif +#ifndef _SBXVAR_HXX +#include <svtools/sbxvar.hxx> +#endif +#ifndef _SBX_HXX +#include <svtools/sbx.hxx> +#endif +#ifndef _FSYS_HXX +#include <tools/fsys.hxx> +#endif + +#ifdef OS2 +#define INCL_DOS +#define INCL_DOSPROCESS +#include <tools/svpm.h> +#include <vcl/sysdep.hxx> +#endif + +#if defined(WIN) +#ifndef _SVWIN_H +#include <tools/svwin.h> +#endif +#endif + +#ifndef OS2 +#include <time.h> +#endif + +#ifndef CLK_TCK +#define CLK_TCK CLOCKS_PER_SEC +#endif + +#ifdef VCL +#include <vcl/jobset.hxx> +#else +#include <vcl/jobset.hxx> +#endif + +#pragma hdrstop +#include "sbintern.hxx" +#include "runtime.hxx" +#include "stdobj.hxx" +#include "rtlproto.hxx" +#include "dllmgr.hxx" +#include <iosys.hxx> +#ifndef SB_UNO_OBJ +#include "sbunoobj.hxx" +#endif +#include "propacc.hxx" + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBRUNTIME, SBRUNTIME_CODE ) + + +#if defined (OS2) && defined (__BORLANDC__) +#pragma option -w-par +#endif + +static BOOL Convert (SbxDataType eType, + SbxValue &rSbxValue, + SbxVariable *pSbxVariable) +{ + return TRUE; +} + +RTLFUNC(CBool) // JSM +{ + BOOL bVal = FALSE; + if ( rPar.Count() == 2 ) + { + SbxVariable *pSbxVariable = rPar.Get(1); + bVal = pSbxVariable->GetBool(); + } + else + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + + rPar.Get(0)->PutBool(bVal); +} + +RTLFUNC(CByte) // JSM +{ + BYTE nByte = 0; + if ( rPar.Count() == 2 ) + { + SbxVariable *pSbxVariable = rPar.Get(1); + nByte = pSbxVariable->GetByte(); + } + else + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + + rPar.Get(0)->PutByte(nByte); +} + +RTLFUNC(CCur) // JSM +{ + rPar.Get(0)->PutEmpty(); + StarBASIC::Error(SbERR_NOT_IMPLEMENTED); +} + +RTLFUNC(CDate) // JSM +{ + double nVal = 0.0; + if ( rPar.Count() == 2 ) + { + SbxVariable *pSbxVariable = rPar.Get(1); + nVal = pSbxVariable->GetDate(); + } + else + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + + rPar.Get(0)->PutDate(nVal); +} + +RTLFUNC(CDbl) // JSM +{ + double nVal = 0.0; + if ( rPar.Count() == 2 ) + { + SbxVariable *pSbxVariable = rPar.Get(1); + if( pSbxVariable->GetType() == SbxSTRING ) + { + SbxError eOld = SbxBase::GetError(); + if( eOld != SbxERR_OK ) + SbxBase::ResetError(); + + // AB #42529 , zunaechst Wandlung in Date versuchen + // Wenn erfolgreich, ist das das Ergebnis + nVal = pSbxVariable->GetDate(); + if( SbxBase::GetError() != SbxERR_OK ) + { + SbxBase::ResetError(); + if( eOld != SbxERR_OK ) + SbxBase::SetError( eOld ); + + // AB #41690 , String holen + String aScanStr = pSbxVariable->GetString(); + SbError Error = SbxValue::ScanNumIntnl( aScanStr, nVal ); + if( Error != SbxERR_OK ) + StarBASIC::Error( Error ); + } + } + else + { + nVal = pSbxVariable->GetDouble(); + } + } + else + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + + rPar.Get(0)->PutDouble(nVal); +} + +RTLFUNC(CInt) // JSM +{ + INT16 nVal = 0; + if ( rPar.Count() == 2 ) + { + SbxVariable *pSbxVariable = rPar.Get(1); + nVal = pSbxVariable->GetInteger(); + } + else + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + + rPar.Get(0)->PutInteger(nVal); +} + +RTLFUNC(CLng) // JSM +{ + INT32 nVal = 0; + if ( rPar.Count() == 2 ) + { + SbxVariable *pSbxVariable = rPar.Get(1); + nVal = pSbxVariable->GetLong(); + } + else + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + + rPar.Get(0)->PutLong(nVal); +} + +RTLFUNC(CSng) // JSM +{ + float nVal = (float)0.0; + if ( rPar.Count() == 2 ) + { + SbxVariable *pSbxVariable = rPar.Get(1); + if( pSbxVariable->GetType() == SbxSTRING ) + { + SbxError eOld = SbxBase::GetError(); + if( eOld != SbxERR_OK ) + SbxBase::ResetError(); + + // AB #42529 , zunaechst Wandlung in Date versuchen + // Wenn erfolgreich, ist das das Ergebnis + double dVal = pSbxVariable->GetDate(); + if( SbxBase::GetError() != SbxERR_OK ) + { + SbxBase::ResetError(); + if( eOld != SbxERR_OK ) + SbxBase::SetError( eOld ); + + // AB #41690 , String holen + String aScanStr = pSbxVariable->GetString(); + SbError Error = SbxValue::ScanNumIntnl( aScanStr, dVal, /*bSingle=*/TRUE ); + if( SbxBase::GetError() == SbxERR_OK && Error != SbxERR_OK ) + StarBASIC::Error( Error ); + } + nVal = (float)dVal; + } + else + { + nVal = pSbxVariable->GetSingle(); + } + } + else + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + + rPar.Get(0)->PutSingle(nVal); +} + +RTLFUNC(CStr) // JSM +{ + String aString; + if ( rPar.Count() == 2 ) + { + SbxVariable *pSbxVariable = rPar.Get(1); + aString = pSbxVariable->GetString(); + } + else + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + + rPar.Get(0)->PutString(aString); +} + +RTLFUNC(CVar) // JSM +{ + rPar.Get(0)->PutEmpty(); + StarBASIC::Error(SbERR_NOT_IMPLEMENTED); +} + +RTLFUNC(CVErr) // JSM +{ + rPar.Get(0)->PutEmpty(); + StarBASIC::Error(SbERR_NOT_IMPLEMENTED); +} + +RTLFUNC(Iif) // JSM +{ + if ( rPar.Count() == 4 ) + { + if (rPar.Get(1)->GetBool()) + *rPar.Get(0) = *rPar.Get(2); + else + *rPar.Get(0) = *rPar.Get(3); + } + else + StarBASIC::Error( SbERR_BAD_ARGUMENT ); +} + +RTLFUNC(GetSystemType) +{ + if ( rPar.Count() != 1 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + // Removed for SRC595 + rPar.Get(0)->PutInteger( -1 ); +} + +RTLFUNC(GetGUIType) +{ + if ( rPar.Count() != 1 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + // 17.7.2000 Make simple solution for testtool / fat office +#if defined (WNT) || (defined (OS2) && !defined (WTC)) + rPar.Get(0)->PutInteger( 1 ); +#elif defined OS2 + rPar.Get(0)->PutInteger( 2 ); +#elif defined UNX + rPar.Get(0)->PutInteger( 4 ); +#elif + rPar.Get(0)->PutInteger( -1 ); +#endif + } +} + +RTLFUNC(Red) +{ + if ( rPar.Count() != 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + ULONG nRGB = (ULONG)rPar.Get(1)->GetLong(); + nRGB &= 0x00FF0000; + nRGB >>= 16; + rPar.Get(0)->PutInteger( (INT16)nRGB ); + } +} + +RTLFUNC(Green) +{ + if ( rPar.Count() != 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + ULONG nRGB = (ULONG)rPar.Get(1)->GetLong(); + nRGB &= 0x0000FF00; + nRGB >>= 8; + rPar.Get(0)->PutInteger( (INT16)nRGB ); + } +} + +RTLFUNC(Blue) +{ + if ( rPar.Count() != 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + ULONG nRGB = (ULONG)rPar.Get(1)->GetLong(); + nRGB &= 0x000000FF; + rPar.Get(0)->PutInteger( (INT16)nRGB ); + } +} + + +RTLFUNC(Switch) +{ + USHORT nCount = rPar.Count(); + if( !(nCount & 0x0001 )) + // Anzahl der Argumente muss ungerade sein + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + USHORT nCurExpr = 1; + while( nCurExpr < (nCount-1) ) + { + if( rPar.Get( nCurExpr )->GetBool()) + { + (*rPar.Get(0)) = *(rPar.Get(nCurExpr+1)); + return; + } + nCurExpr += 2; + } + rPar.Get(0)->PutNull(); +} + + +RTLFUNC(Wait) +{ + if( rPar.Count() != 2 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + long nWait = rPar.Get(1)->GetLong(); + if( nWait < 0 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } +#if defined(OS2) + ULONG nStart, nCur; + DosQuerySysInfo( QSV_MS_COUNT, QSV_MS_COUNT,&nStart,sizeof(ULONG) ); + // drucken wir gerade? + int bPrinting = Sysdepen::IsMultiThread() ? TRUE : FALSE; + do + { + Application::Reschedule(); + if( bPrinting ) + DosSleep( 50 ); // damit der Druck-Thread mehr CPU-Zeit bekommt + DosQuerySysInfo( QSV_MS_COUNT, QSV_MS_COUNT,&nCur,sizeof(ULONG) ); + } while( (nCur-nStart) < (ULONG)nWait ); +#else + long nSeconds = nWait / 1000; + if( !nSeconds ) nSeconds = 1; +#if defined(UNX) || defined(WIN) + // Unix hat kein clock() + time_t nStart = time( 0 ); + time_t nEnd; + do + { + Application::Reschedule(); + nEnd = time( 0 ); + } while( (nEnd-nStart) < nSeconds ); +#else + clock_t nStart = clock() / CLK_TCK; + clock_t nEnd; + do + { + Application::Reschedule(); + nEnd = clock() / CLK_TCK; + } while( (nEnd-nStart) < nSeconds ); +#endif + +#endif +} + +RTLFUNC(GetGUIVersion) +{ + if ( rPar.Count() != 1 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + // Removed for SRC595 + rPar.Get(0)->PutLong( -1 ); + } +} + +RTLFUNC(Choose) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + INT16 nIndex = rPar.Get(1)->GetInteger(); + USHORT nCount = rPar.Count(); + nCount--; + if( nCount == 1 || nIndex > (nCount-1) || nIndex < 1 ) + { + rPar.Get(0)->PutNull(); + return; + } + (*rPar.Get(0)) = *(rPar.Get(nIndex+1)); +} + + +RTLFUNC(Trim) +{ + if ( rPar.Count() < 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + String aStr( rPar.Get(1)->GetString() ); + aStr.EraseLeadingChars(); + aStr.EraseTrailingChars(); + rPar.Get(0)->PutString( aStr ); + } +} + +RTLFUNC(DateAdd) +{ +} + +RTLFUNC(DateDiff) +{ +} + +RTLFUNC(DatePart) +{ +} + + +RTLFUNC(GetSolarVersion) +{ + rPar.Get(0)->PutLong( (INT32)SUPD ); +} + +RTLFUNC(TwipsPerPixelX) +{ + Size aSize( 100,0 ); + MapMode aMap( MAP_TWIP ); + aSize = GetpApp()->GetAppWindow()->PixelToLogic( aSize, aMap ); + aSize.Width() /= 100; + rPar.Get(0)->PutLong( aSize.Width() ); +} + +RTLFUNC(TwipsPerPixelY) +{ + Size aSize( 0,100 ); + MapMode aMap( MAP_TWIP ); + aSize = GetpApp()->GetAppWindow()->PixelToLogic( aSize, aMap ); + aSize.Height() /= 100; + rPar.Get(0)->PutLong( aSize.Height() ); +} + + +RTLFUNC(FreeLibrary) +{ + if ( rPar.Count() != 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + ByteString aByteDLLName( rPar.Get(1)->GetString(), gsl_getSystemTextEncoding() ); + pINST->GetDllMgr()->FreeDll( aByteDLLName ); +} + +RTLFUNC(Array) +{ + SbxDimArray* pArray = new SbxDimArray( SbxVARIANT ); + USHORT nArraySize = rPar.Count() - 1; + + // Option Base zunaechst ignorieren (kennt leider nur der Compiler) + if( nArraySize ) + pArray->AddDim( 0, nArraySize-1 ); + + // Parameter ins Array uebernehmen + for( short i = 0 ; i < nArraySize ; i++ ) + pArray->Put( rPar.Get(i+1), &i ); + + // Array zurueckliefern + SbxVariableRef refVar = rPar.Get(0); + USHORT nFlags = refVar->GetFlags(); + refVar->ResetFlag( SBX_FIXED ); + refVar->PutObject( pArray ); + refVar->SetFlags( nFlags ); + refVar->SetParameters( NULL ); +} + + +// Featurewunsch #57868 +// Die Funktion liefert ein Variant-Array, wenn keine Parameter angegeben +// werden, wird ein leeres Array erzeugt (entsprechend dim a(), entspricht +// einer Sequence der Laenge 0 in Uno). +// Wenn Parameter angegeben sind, wird fuer jeden eine Dimension erzeugt +// DimArray( 2, 2, 4 ) entspricht DIM a( 2, 2, 4 ) +// Das Array ist immer vom Typ Variant +RTLFUNC(DimArray) +{ + SbxDimArray* pArray = new SbxDimArray( SbxVARIANT ); + USHORT nArrayDims = rPar.Count() - 1; + if( nArrayDims > 0 ) + { + for( USHORT i = 0; i < nArrayDims ; i++ ) + { + INT16 ub = rPar.Get(i+1)->GetInteger(); + if( ub < 0 ) + { + StarBASIC::Error( SbERR_OUT_OF_RANGE ); + ub = 0; + } + pArray->AddDim( 0, ub ); + } + } + // Array zurueckliefern + SbxVariableRef refVar = rPar.Get(0); + USHORT nFlags = refVar->GetFlags(); + refVar->ResetFlag( SBX_FIXED ); + refVar->PutObject( pArray ); + refVar->SetFlags( nFlags ); + refVar->SetParameters( NULL ); +} + +/* + * FindObject und FindPropertyObject ermoeglichen es, + * Objekte und Properties vom Typ Objekt zur Laufzeit + * ueber ihren Namen als String-Parameter anzusprechen. + * + * Bsp.: + * MyObj.Prop1.Bla = 5 + * + * entspricht: + * dim ObjVar as Object + * dim ObjProp as Object + * ObjName$ = "MyObj" + * ObjVar = FindObject( ObjName$ ) + * PropName$ = "Prop1" + * ObjProp = FindPropertyObject( ObjVar, PropName$ ) + * ObjProp.Bla = 5 + * + * Dabei koennen die Namen zur Laufzeit dynamisch + * erzeugt werden und, so dass z.B. ueber Controls + * "TextEdit1" bis "TextEdit5" in einem Dialog in + * einer Schleife iteriert werden kann. + */ + +// Objekt ueber den Namen ansprechen +// 1. Parameter = Name des Objekts als String +RTLFUNC(FindObject) +{ + // Wir brauchen einen Parameter + if ( rPar.Count() < 2 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + // 1. Parameter ist der Name + String aNameStr = rPar.Get(1)->GetString(); + + // Basic-Suchfunktion benutzen + SbxBase* pFind = StarBASIC::FindSBXInCurrentScope( aNameStr ); + SbxObject* pFindObj = NULL; + if( pFind ) + pFindObj = PTR_CAST(SbxObject,pFind); + /* + if( !pFindObj ) + { + StarBASIC::Error( SbERR_VAR_UNDEFINED ); + return; + } + */ + + // Objekt zurueckliefern + SbxVariableRef refVar = rPar.Get(0); + refVar->PutObject( pFindObj ); +} + +// Objekt-Property in einem Objekt ansprechen +// 1. Parameter = Objekt +// 2. Parameter = Name der Property als String +RTLFUNC(FindPropertyObject) +{ + // Wir brauchen 2 Parameter + if ( rPar.Count() < 3 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + // 1. Parameter holen, muss Objekt sein + SbxBase* pObjVar = (SbxObject*)rPar.Get(1)->GetObject(); + SbxObject* pObj = NULL; + if( pObjVar ) + pObj = PTR_CAST(SbxObject,pObjVar); + if( !pObj && pObjVar && pObjVar->ISA(SbxVariable) ) + { + SbxBase* pObjVarObj = ((SbxVariable*)pObjVar)->GetObject(); + pObj = PTR_CAST(SbxObject,pObjVarObj); + } + /* + if( !pObj ) + { + StarBASIC::Error( SbERR_VAR_UNDEFINED ); + return; + } + */ + + // 2. Parameter ist der Name + String aNameStr = rPar.Get(2)->GetString(); + + // Jetzt muss ein Objekt da sein, sonst Error + SbxObject* pFindObj = NULL; + if( pObj ) + { + // Im Objekt nach Objekt suchen + SbxVariable* pFindVar = pObj->Find( aNameStr, SbxCLASS_OBJECT ); + pFindObj = PTR_CAST(SbxObject,pFindVar); + } + else + StarBASIC::Error( SbERR_BAD_PARAMETER ); + + // Objekt zurueckliefern + SbxVariableRef refVar = rPar.Get(0); + refVar->PutObject( pFindObj ); +} + + + +BOOL lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm, + BOOL bBinary, short nBlockLen, BOOL bIsArray ) +{ + ULONG nFPos = pStrm->Tell(); + + BOOL bIsVariant = !rVar.IsFixed(); + SbxDataType eType = rVar.GetType(); + + switch( eType ) + { + case SbxBOOL: + case SbxCHAR: + case SbxBYTE: + if( bIsVariant ) + *pStrm << (USHORT)SbxBYTE; // VarType Id + *pStrm << rVar.GetByte(); + break; + + case SbxEMPTY: + case SbxNULL: + case SbxVOID: + case SbxINTEGER: + case SbxUSHORT: + case SbxINT: + case SbxUINT: + if( bIsVariant ) + *pStrm << (USHORT)SbxINTEGER; // VarType Id + *pStrm << rVar.GetInteger(); + break; + + case SbxLONG: + case SbxULONG: + case SbxLONG64: + case SbxULONG64: + if( bIsVariant ) + *pStrm << (USHORT)SbxLONG; // VarType Id + *pStrm << rVar.GetLong(); + break; + + case SbxSINGLE: + if( bIsVariant ) + *pStrm << (USHORT)eType; // VarType Id + *pStrm << rVar.GetSingle(); + break; + + case SbxDOUBLE: + case SbxCURRENCY: + case SbxDATE: + if( bIsVariant ) + *pStrm << (USHORT)eType; // VarType Id + *pStrm << rVar.GetDouble(); + break; + + case SbxSTRING: + case SbxLPSTR: + { + const String& rStr = rVar.GetString(); + if( !bBinary || bIsArray ) + { + if( bIsVariant ) + *pStrm << (USHORT)SbxSTRING; + pStrm->WriteByteString( rStr, gsl_getSystemTextEncoding() ); + //*pStrm << rStr; + } + else + { + // ohne Laengenangabe! ohne Endekennung! + // What does that mean for Unicode?! Choosing conversion to ByteString... + ByteString aByteStr( rStr, gsl_getSystemTextEncoding() ); + *pStrm << (const char*)aByteStr.GetBuffer(); + //*pStrm << (const char*)rStr.GetStr(); + } + } + break; + + default: + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return FALSE; + } + + if( nBlockLen ) + pStrm->Seek( nFPos + nBlockLen ); + return pStrm->GetErrorCode() ? FALSE : TRUE; +} + +BOOL lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm, + BOOL bBinary, short nBlockLen, BOOL bIsArray ) +{ + double aDouble; + + ULONG nFPos = pStrm->Tell(); + + BOOL bIsVariant = !rVar.IsFixed(); + SbxDataType eVarType = rVar.GetType(); + + SbxDataType eSrcType = eVarType; + if( bIsVariant ) + { + USHORT nTemp; + *pStrm >> nTemp; + eSrcType = (SbxDataType)nTemp; + } + + switch( eSrcType ) + { + case SbxBOOL: + case SbxCHAR: + case SbxBYTE: + { + BYTE aByte; + *pStrm >> aByte; + rVar.PutByte( aByte ); + } + break; + + case SbxEMPTY: + case SbxNULL: + case SbxVOID: + case SbxINTEGER: + case SbxUSHORT: + case SbxINT: + case SbxUINT: + { + INT16 aInt; + *pStrm >> aInt; + rVar.PutInteger( aInt ); + } + break; + + case SbxLONG: + case SbxULONG: + case SbxLONG64: + case SbxULONG64: + { + INT32 aInt; + *pStrm >> aInt; + rVar.PutLong( aInt ); + } + break; + + case SbxSINGLE: + { + float nS; + *pStrm >> nS; + rVar.PutSingle( nS ); + } + break; + + case SbxDOUBLE: + case SbxCURRENCY: + { + *pStrm >> aDouble; + rVar.PutDouble( aDouble ); + } + break; + + case SbxDATE: + { + *pStrm >> aDouble; + rVar.PutDate( aDouble ); + } + break; + + case SbxSTRING: + case SbxLPSTR: + { + String aStr; + pStrm->ReadByteString( aStr, gsl_getSystemTextEncoding() ); + rVar.PutString( aStr ); + } + break; + + default: + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return FALSE; + } + + if( nBlockLen ) + pStrm->Seek( nFPos + nBlockLen ); + return pStrm->GetErrorCode() ? FALSE : TRUE; +} + + +// nCurDim = 1...n +BOOL lcl_WriteReadSbxArray( SbxDimArray& rArr, SvStream* pStrm, + BOOL bBinary, short nCurDim, short* pOtherDims, BOOL bWrite ) +{ + DBG_ASSERT( nCurDim > 0,"Bad Dim"); + short nLower, nUpper; + if( !rArr.GetDim( nCurDim, nLower, nUpper ) ) + return FALSE; + for( short nCur = nLower; nCur <= nUpper; nCur++ ) + { + pOtherDims[ nCurDim-1 ] = nCur; + if( nCurDim != 1 ) + lcl_WriteReadSbxArray(rArr, pStrm, bBinary, nCurDim-1, pOtherDims, bWrite); + else + { + SbxVariable* pVar = rArr.Get( (const short*)pOtherDims ); + BOOL bRet; + if( bWrite ) + bRet = lcl_WriteSbxVariable(*pVar, pStrm, bBinary, 0, TRUE ); + else + bRet = lcl_ReadSbxVariable(*pVar, pStrm, bBinary, 0, TRUE ); + if( !bRet ) + return FALSE; + } + } + return TRUE; +} + +void PutGet( SbxArray& rPar, BOOL bPut ) +{ + // Wir brauchen 3 Parameter + if ( rPar.Count() != 4 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + INT16 nFileNo = rPar.Get(1)->GetInteger(); + SbxVariable* pVar2 = rPar.Get(2); + BOOL bHasRecordNo = (BOOL)(pVar2->GetType() != SbxEMPTY); + long nRecordNo = pVar2->GetLong(); + if ( nFileNo < 1 || ( bHasRecordNo && nRecordNo < 1 ) ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + nRecordNo--; // wir moegen's ab 0! + SbiIoSystem* pIO = pINST->GetIoSystem(); + SbiStream* pSbStrm = pIO->GetStream( nFileNo ); + // das File muss Random (feste Record-Laenge) oder Binary sein + if ( !pSbStrm || !(pSbStrm->GetMode() & (SBSTRM_BINARY | SBSTRM_RANDOM)) ) + { + StarBASIC::Error( SbERR_BAD_CHANNEL ); + return; + } + + SvStream* pStrm = pSbStrm->GetStrm(); + BOOL bRandom = pSbStrm->IsRandom(); + short nBlockLen = bRandom ? pSbStrm->GetBlockLen() : 0; + + if( bPut ) + { + // Datei aufplustern, falls jemand uebers Dateiende hinaus geseekt hat + pSbStrm->ExpandFile(); + } + + // auf die Startposition seeken + if( bHasRecordNo ) + { + ULONG nFilePos = bRandom ? (ULONG)(nBlockLen*nRecordNo) : (ULONG)nRecordNo; + pStrm->Seek( nFilePos ); + } + + SbxDimArray* pArr = 0; + SbxVariable* pVar = rPar.Get(3); + if( pVar->GetType() & SbxARRAY ) + { + SbxBase* pParObj = pVar->GetObject(); + pArr = PTR_CAST(SbxDimArray,pParObj); + } + + BOOL bRet; + + if( pArr ) + { + ULONG nFPos = pStrm->Tell(); + short nDims = pArr->GetDims(); + short* pDims = new short[ nDims ]; + bRet = lcl_WriteReadSbxArray(*pArr,pStrm,!bRandom,nDims,pDims,bPut); + delete pDims; + if( nBlockLen ) + pStrm->Seek( nFPos + nBlockLen ); + } + else + { + if( bPut ) + bRet = lcl_WriteSbxVariable(*pVar, pStrm, !bRandom, nBlockLen, FALSE); + else + bRet = lcl_ReadSbxVariable(*pVar, pStrm, !bRandom, nBlockLen, FALSE); + } + if( !bRet || pStrm->GetErrorCode() ) + StarBASIC::Error( SbERR_IO_ERROR ); +} + +RTLFUNC(Put) +{ + PutGet( rPar, TRUE ); +} + +RTLFUNC(Get) +{ + PutGet( rPar, FALSE ); +} + +RTLFUNC(Environ) +{ + if ( rPar.Count() != 2 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + String aResult; + // sollte ANSI sein, aber unter Win16 in DLL nicht moeglich +#if defined(WIN) + LPSTR lpszEnv = GetDOSEnvironment(); + String aCompareStr( rPar.Get(1)->GetString() ); + aCompareStr += '='; + const char* pCompare = aCompareStr.GetStr(); + int nCompareLen = aCompareStr.Len(); + while ( *lpszEnv ) + { + // Es werden alle EnvString in der Form ENV=VAL 0-terminiert + // aneinander gehaengt. + + if ( strnicmp( pCompare, lpszEnv, nCompareLen ) == 0 ) + { + aResult = (const char*)(lpszEnv+nCompareLen); + rPar.Get(0)->PutString( aResult ); + return; + } + lpszEnv += lstrlen( lpszEnv ) + 1; // Next Enviroment-String + } +#else + ByteString aByteStr( rPar.Get(1)->GetString(), gsl_getSystemTextEncoding() ); + const char* pEnvStr = getenv( aByteStr.GetBuffer() ); + if ( pEnvStr ) + aResult = String::CreateFromAscii( pEnvStr ); +#endif + rPar.Get(0)->PutString( aResult ); +} + +static double GetDialogZoomFactor( BOOL bX, long nValue ) +{ + Size aRefSize( nValue, nValue ); +#ifndef WIN + Fraction aFracX( 1, 26 ); +#else + Fraction aFracX( 1, 23 ); +#endif + Fraction aFracY( 1, 24 ); + MapMode aMap( MAP_APPFONT, Point(), aFracX, aFracY ); + Window* pWin = GetpApp()->GetAppWindow(); + Size aScaledSize = pWin->LogicToPixel( aRefSize, aMap ); + aRefSize = pWin->LogicToPixel( aRefSize, MapMode(MAP_TWIP) ); + double nRef, nScaled, nResult; + if( bX ) + { + nRef = aRefSize.Width(); + nScaled = aScaledSize.Width(); + } + else + { + nRef = aRefSize.Height(); + nScaled = aScaledSize.Height(); + } + nResult = nScaled / nRef; + return nResult; +} + + +RTLFUNC(GetDialogZoomFactorX) +{ + if ( rPar.Count() != 2 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + rPar.Get(0)->PutDouble( GetDialogZoomFactor( TRUE, rPar.Get(1)->GetLong() )); +} + +RTLFUNC(GetDialogZoomFactorY) +{ + if ( rPar.Count() != 2 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + rPar.Get(0)->PutDouble( GetDialogZoomFactor( FALSE, rPar.Get(1)->GetLong())); +} + + +RTLFUNC(EnableReschedule) +{ + rPar.Get(0)->PutEmpty(); + if ( rPar.Count() != 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + if( pINST ) + pINST->EnableReschedule( rPar.Get(1)->GetBool() ); +} + +RTLFUNC(GetSystemTicks) +{ + if ( rPar.Count() != 1 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + rPar.Get(0)->PutLong( Time::GetSystemTicks() ); +} + +RTLFUNC(GetPathSeparator) +{ + if ( rPar.Count() != 1 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + rPar.Get(0)->PutString( DirEntry::GetAccessDelimiter() ); +} + +RTLFUNC(ResolvePath) +{ + if ( rPar.Count() == 2 ) + { + String aStr = rPar.Get(1)->GetString(); + DirEntry aEntry( aStr ); + //if( aEntry.IsVirtual() ) + //aStr = aEntry.GetRealPathFromVirtualURL(); + rPar.Get(0)->PutString( aStr ); + } + else + StarBASIC::Error( SbERR_BAD_ARGUMENT ); +} + +RTLFUNC(TypeLen) +{ + if ( rPar.Count() != 2 ) + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + else + { + SbxDataType eType = rPar.Get(1)->GetType(); + INT16 nLen = 0; + switch( eType ) + { + case SbxEMPTY: + case SbxNULL: + case SbxVECTOR: + case SbxARRAY: + case SbxBYREF: + case SbxVOID: + case SbxHRESULT: + case SbxPOINTER: + case SbxDIMARRAY: + case SbxCARRAY: + case SbxUSERDEF: + nLen = 0; + break; + + case SbxINTEGER: + case SbxERROR: + case SbxUSHORT: + case SbxINT: + case SbxUINT: + nLen = 2; + break; + + case SbxLONG: + case SbxSINGLE: + case SbxULONG: + nLen = 4; + break; + + case SbxDOUBLE: + case SbxCURRENCY: + case SbxDATE: + case SbxLONG64: + case SbxULONG64: + nLen = 8; + break; + + case SbxOBJECT: + case SbxVARIANT: + case SbxDATAOBJECT: + nLen = 0; + break; + + case SbxCHAR: + case SbxBYTE: + case SbxBOOL: + nLen = 1; + break; + + case SbxLPSTR: + case SbxLPWSTR: + case SbxCoreSTRING: + case SbxSTRING: + nLen = (INT16)rPar.Get(1)->GetString().Len(); + break; + + default: + nLen = 0; + } + rPar.Get(0)->PutInteger( nLen ); + } +} + + +// Uno-Struct eines beliebigen Typs erzeugen +// 1. Parameter == Klassename, weitere Parameter zur Initialisierung +RTLFUNC(CreateUnoStruct) +{ + RTL_Impl_CreateUnoStruct( pBasic, rPar, bWrite ); +} + +// Uno-Service erzeugen +// 1. Parameter == Service-Name +RTLFUNC(CreateUnoService) +{ + RTL_Impl_CreateUnoService( pBasic, rPar, bWrite ); +} + +// ServiceManager liefern (keine Parameter) +RTLFUNC(GetProcessServiceManager) +{ + RTL_Impl_GetProcessServiceManager( pBasic, rPar, bWrite ); +} + +// PropertySet erzeugen +// 1. Parameter == Sequence<PropertyValue> +RTLFUNC(CreatePropertySet) +{ + RTL_Impl_CreatePropertySet( pBasic, rPar, bWrite ); +} + +// Abfragen, ob ein Interface unterstuetzt wird +// Mehrere Interface-Namen als Parameter +RTLFUNC(HasUnoInterfaces) +{ + RTL_Impl_HasInterfaces( pBasic, rPar, bWrite ); +} + +// Abfragen, ob ein Basic-Objekt ein Uno-Struct repraesentiert +RTLFUNC(IsUnoStruct) +{ + RTL_Impl_IsUnoStruct( pBasic, rPar, bWrite ); +} + +// Abfragen, ob zwei Uno-Objekte identisch sind +RTLFUNC(EqualUnoObjects) +{ + RTL_Impl_EqualUnoObjects( pBasic, rPar, bWrite ); +} + diff --git a/basic/source/runtime/os2.asm b/basic/source/runtime/os2.asm new file mode 100644 index 000000000000..c50f2233ec87 --- /dev/null +++ b/basic/source/runtime/os2.asm @@ -0,0 +1,89 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; OS2.ASM +;; +;; Ersterstellung MD 30.05.94 +;; +;; Anmerkungen +;; Direktaufruf von C- und PASCAL-Routinen, OS/2 +;; +;; Source Code Control System - Header +;; $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/basic/source/runtime/os2.asm,v 1.1.1.1 2000-09-18 16:12:11 hr Exp $ +;; +;; Copyright (c) 1990,95 by STAR DIVISION GmbH +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Inhalt: +; type = CallXXX (far *proc, char *stack, short nstack) +; +; Kopie des Basic-Stacks (nstack Bytes) auf den C-Stack +; und Aufruf der Prozedur. + + .386 + .MODEL FLAT + + .CODE + + PUBLIC CallINT + PUBLIC CallLNG + PUBLIC CallSNG + PUBLIC CallDBL + PUBLIC CallSTR + PUBLIC CallFIX + + PUBLIC _CallINT + PUBLIC _CallLNG + PUBLIC _CallSNG + PUBLIC _CallDBL + PUBLIC _CallSTR + PUBLIC _CallFIX + +_CallINT LABEL byte +_CallLNG LABEL byte +_CallSNG LABEL byte +_CallDBL LABEL byte +_CallSTR LABEL byte +_CallFIX LABEL byte + +CallINT LABEL byte +CallLNG LABEL byte +CallSNG LABEL byte +CallDBL LABEL byte +CallSTR LABEL byte +CallFIX PROC + +p EQU [EBP+8] +stk EQU [EBP+12] +n EQU [EBP+16] + + PUSH EBP + MOV EBP,ESP + PUSH ESI + PUSH EDI + MOV DX,DS + MOVZX ECX,word ptr [n] + SUB ESP,ECX + MOV EDI,ESP + MOV AX,SS + MOV ES,AX + MOV ESI,[stk] + SHR ECX,1 + CLD + JCXZ $1 + REP MOVSW ; Stack uebernehmen +$1: MOV DS,DX + CALL LARGE [p] ; 32-bit + MOV ECX,EBP + SUB ECX,8 ; wegen gepushter Register + MOV ESP,ECX + POP EDI + POP ESI + POP EBP +; Bei Borland C++ Calling Convention: +; RET 12 +; CSet System-Calling Convention + RET +CallFIX ENDP + + END diff --git a/basic/source/runtime/props.cxx b/basic/source/runtime/props.cxx new file mode 100644 index 000000000000..7c43f22b5dc5 --- /dev/null +++ b/basic/source/runtime/props.cxx @@ -0,0 +1,504 @@ +/************************************************************************* + * + * $RCSfile: props.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <svtools/sbx.hxx> +#include "runtime.hxx" +#pragma hdrstop +#include "stdobj.hxx" +#include "rtlproto.hxx" + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBRUNTIME, SBRUNTIME_CODE ) + +#if defined (OS2) && defined (__BORLANDC__) +#pragma option -w-par +#endif + + +// Properties und Methoden legen beim Get (bWrite = FALSE) den Returnwert +// im Element 0 des Argv ab; beim Put (bWrite = TRUE) wird der Wert aus +// Element 0 gespeichert. + +RTLFUNC(Erl) +{ + rPar.Get( 0 )->PutLong( StarBASIC::GetErl() ); +} + +RTLFUNC(Err) +{ + if( bWrite ) + { + INT32 nVal = rPar.Get( 0 )->GetLong(); + if( nVal <= 65535L ) + StarBASIC::Error( StarBASIC::GetSfxFromVBError( (USHORT) nVal ) ); + } + else + rPar.Get( 0 )->PutLong( StarBASIC::GetVBErrorCode( StarBASIC::GetErr() ) ); +} + +RTLFUNC(False) +{ + rPar.Get(0)->PutBool( FALSE ); +} + +RTLFUNC(Nothing) +{ + // liefert eine leere Objekt-Variable. + rPar.Get( 0 )->PutObject( NULL ); +} + +RTLFUNC(Null) +{ + // liefert eine leere Objekt-Variable. + rPar.Get( 0 )->PutNull(); +} + +RTLFUNC(PI) +{ + rPar.Get( 0 )->PutDouble( F_PI ); +} + +RTLFUNC(True) +{ + rPar.Get( 0 )->PutBool( TRUE ); +} + +RTLFUNC(ATTR_NORMAL) +{ + rPar.Get(0)->PutInteger(0); +} +RTLFUNC(ATTR_READONLY) +{ + rPar.Get(0)->PutInteger(1); +} +RTLFUNC(ATTR_HIDDEN) +{ + rPar.Get(0)->PutInteger(2); +} +RTLFUNC(ATTR_SYSTEM) +{ + rPar.Get(0)->PutInteger(4); +} +RTLFUNC(ATTR_VOLUME) +{ + rPar.Get(0)->PutInteger(8); +} +RTLFUNC(ATTR_DIRECTORY) +{ + rPar.Get(0)->PutInteger(16); +} +RTLFUNC(ATTR_ARCHIVE) +{ + rPar.Get(0)->PutInteger(32); +} + +RTLFUNC(V_EMPTY) +{ + rPar.Get(0)->PutInteger(0); +} +RTLFUNC(V_NULL) +{ + rPar.Get(0)->PutInteger(1); +} +RTLFUNC(V_INTEGER) +{ + rPar.Get(0)->PutInteger(2); +} +RTLFUNC(V_LONG) +{ + rPar.Get(0)->PutInteger(3); +} +RTLFUNC(V_SINGLE) +{ + rPar.Get(0)->PutInteger(4); +} +RTLFUNC(V_DOUBLE) +{ + rPar.Get(0)->PutInteger(5); +} +RTLFUNC(V_CURRENCY) +{ + rPar.Get(0)->PutInteger(6); +} +RTLFUNC(V_DATE) +{ + rPar.Get(0)->PutInteger(7); +} +RTLFUNC(V_STRING) +{ + rPar.Get(0)->PutInteger(8); +} + +RTLFUNC(MB_OK) +{ + rPar.Get(0)->PutInteger(0); +} +RTLFUNC(MB_OKCANCEL) +{ + rPar.Get(0)->PutInteger(1); +} +RTLFUNC(MB_ABORTRETRYIGNORE) +{ + rPar.Get(0)->PutInteger(2); +} +RTLFUNC(MB_YESNOCANCEL) +{ + rPar.Get(0)->PutInteger(3); +} +RTLFUNC(MB_YESNO) +{ + rPar.Get(0)->PutInteger(4); +} +RTLFUNC(MB_RETRYCANCEL) +{ + rPar.Get(0)->PutInteger(5); +} +RTLFUNC(MB_ICONSTOP) +{ + rPar.Get(0)->PutInteger(16); +} +RTLFUNC(MB_ICONQUESTION) +{ + rPar.Get(0)->PutInteger(32); +} +RTLFUNC(MB_ICONEXCLAMATION) +{ + rPar.Get(0)->PutInteger(48); +} +RTLFUNC(MB_ICONINFORMATION) +{ + rPar.Get(0)->PutInteger(64); +} +RTLFUNC(MB_DEFBUTTON1) +{ + rPar.Get(0)->PutInteger(0); +} +RTLFUNC(MB_DEFBUTTON2) +{ + rPar.Get(0)->PutInteger(256); +} +RTLFUNC(MB_DEFBUTTON3) +{ + rPar.Get(0)->PutInteger(512); +} +RTLFUNC(MB_APPLMODAL) +{ + rPar.Get(0)->PutInteger(0); +} +RTLFUNC(MB_SYSTEMMODAL) +{ + rPar.Get(0)->PutInteger(4096); +} + +RTLFUNC(IDOK) +{ + rPar.Get(0)->PutInteger(1); +} + +RTLFUNC(IDCANCEL) +{ + rPar.Get(0)->PutInteger(2); +} +RTLFUNC(IDABORT) +{ + rPar.Get(0)->PutInteger(3); +} +RTLFUNC(IDRETRY) +{ + rPar.Get(0)->PutInteger(4); +} +RTLFUNC(IDYES) +{ + rPar.Get(0)->PutInteger(6); +} +RTLFUNC(IDNO) +{ + rPar.Get(0)->PutInteger(7); +} + +RTLFUNC(CF_TEXT) +{ + rPar.Get(0)->PutInteger(1); +} +RTLFUNC(CF_BITMAP) +{ + rPar.Get(0)->PutInteger(2); +} +RTLFUNC(CF_METAFILEPICT) +{ + rPar.Get(0)->PutInteger(3); +} + +RTLFUNC(TYP_AUTHORFLD) +{ + rPar.Get(0)->PutInteger(7); +} +RTLFUNC(TYP_CHAPTERFLD) +{ + rPar.Get(0)->PutInteger(4); +} +RTLFUNC(TYP_CONDTXTFLD) +{ + rPar.Get(0)->PutInteger(27); +} +RTLFUNC(TYP_DATEFLD) +{ + rPar.Get(0)->PutInteger(0); +} +RTLFUNC(TYP_DBFLD) +{ + rPar.Get(0)->PutInteger(19); +} +RTLFUNC(TYP_DBNAMEFLD) +{ + rPar.Get(0)->PutInteger(3); +} +RTLFUNC(TYP_DBNEXTSETFLD) +{ + rPar.Get(0)->PutInteger(24); +} +RTLFUNC(TYP_DBNUMSETFLD) +{ + rPar.Get(0)->PutInteger(25); +} +RTLFUNC(TYP_DBSETNUMBERFLD) +{ + rPar.Get(0)->PutInteger(26); +} +RTLFUNC(TYP_DDEFLD) +{ + rPar.Get(0)->PutInteger(14); +} +RTLFUNC(TYP_DOCINFOFLD) +{ + rPar.Get(0)->PutInteger(18); +} +RTLFUNC(TYP_DOCSTATFLD) +{ + rPar.Get(0)->PutInteger(6); +} +RTLFUNC(TYP_EXTUSERFLD) +{ + rPar.Get(0)->PutInteger(30); +} +RTLFUNC(TYP_FILENAMEFLD) +{ + rPar.Get(0)->PutInteger(2); +} +RTLFUNC(TYP_FIXDATEFLD) +{ + rPar.Get(0)->PutInteger(31); +} +RTLFUNC(TYP_FIXTIMEFLD) +{ + rPar.Get(0)->PutInteger(32); +} +RTLFUNC(TYP_FORMELFLD) +{ + rPar.Get(0)->PutInteger(10); +} +RTLFUNC(TYP_GETFLD) +{ + rPar.Get(0)->PutInteger(9); +} +RTLFUNC(TYP_GETREFFLD) +{ + rPar.Get(0)->PutInteger(13); +} +RTLFUNC(TYP_HIDDENPARAFLD) +{ + rPar.Get(0)->PutInteger(17); +} +RTLFUNC(TYP_HIDDENTXTFLD) +{ + rPar.Get(0)->PutInteger(11); +} +RTLFUNC(TYP_INPUTFLD) +{ + rPar.Get(0)->PutInteger(16); +} +RTLFUNC(TYP_MACROFLD) +{ + rPar.Get(0)->PutInteger(15); +} +RTLFUNC(TYP_NEXTPAGEFLD) +{ + rPar.Get(0)->PutInteger(28); +} +RTLFUNC(TYP_PAGENUMBERFLD) +{ + rPar.Get(0)->PutInteger(5); +} +RTLFUNC(TYP_POSTITFLD) +{ + rPar.Get(0)->PutInteger(21); +} +RTLFUNC(TYP_PREVPAGEFLD) +{ + rPar.Get(0)->PutInteger(29); +} +RTLFUNC(TYP_SEQFLD) +{ + rPar.Get(0)->PutInteger(23); +} +RTLFUNC(TYP_SETFLD) +{ + rPar.Get(0)->PutInteger(8); +} +RTLFUNC(TYP_SETINPFLD) +{ + rPar.Get(0)->PutInteger(33); +} +RTLFUNC(TYP_SETREFFLD) +{ + rPar.Get(0)->PutInteger(12); +} +RTLFUNC(TYP_TEMPLNAMEFLD) +{ + rPar.Get(0)->PutInteger(22); +} +RTLFUNC(TYP_TIMEFLD) +{ + rPar.Get(0)->PutInteger(1); +} +RTLFUNC(TYP_USERFLD) +{ + rPar.Get(0)->PutInteger(20); +} +RTLFUNC(TYP_USRINPFLD) +{ + rPar.Get(0)->PutInteger(34); +} +RTLFUNC(TYP_SETREFPAGEFLD) +{ + rPar.Get(0)->PutInteger(35); +} +RTLFUNC(TYP_GETREFPAGEFLD) +{ + rPar.Get(0)->PutInteger(36); +} +RTLFUNC(TYP_INTERNETFLD) +{ + rPar.Get(0)->PutInteger(37); +} + +RTLFUNC(SET_ON) +{ + rPar.Get(0)->PutInteger(1); +} +RTLFUNC(SET_OFF) +{ + rPar.Get(0)->PutInteger(0); +} +RTLFUNC(TOGGLE) +{ + rPar.Get(0)->PutInteger(2); +} + +RTLFUNC(FRAMEANCHORPAGE) +{ + rPar.Get(0)->PutInteger(1); +} +RTLFUNC(FRAMEANCHORPARA) +{ + rPar.Get(0)->PutInteger(14); +} +RTLFUNC(FRAMEANCHORCHAR) +{ + rPar.Get(0)->PutInteger(15); +} + +RTLFUNC(CLEAR_ALLTABS) +{ + rPar.Get(0)->PutInteger(2); +} +RTLFUNC(CLEAR_TAB) +{ + rPar.Get(0)->PutInteger(1); +} +RTLFUNC(SET_TAB) +{ + rPar.Get(0)->PutInteger(0); +} + +RTLFUNC(LINEPROP) +{ + rPar.Get(0)->PutInteger(0); +} +RTLFUNC(LINE_1) +{ + rPar.Get(0)->PutInteger(1); +} +RTLFUNC(LINE_15) +{ + rPar.Get(0)->PutInteger(2); +} +RTLFUNC(LINE_2) +{ + rPar.Get(0)->PutInteger(3); +} + +RTLFUNC(TYP_JUMPEDITFLD) +{ + rPar.Get(0)->PutInteger(38); +} + + diff --git a/basic/source/runtime/rtlproto.hxx b/basic/source/runtime/rtlproto.hxx new file mode 100644 index 000000000000..18902eafae0e --- /dev/null +++ b/basic/source/runtime/rtlproto.hxx @@ -0,0 +1,354 @@ +/************************************************************************* + * + * $RCSfile: rtlproto.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include "sbstar.hxx" +#include "macfix.hxx" + +#define RTLFUNC( name ) void SbRtl_##name( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) +#define RTLNAME( name ) MEMBER(SbRtl_##name) + +typedef void( *RtlCall ) ( StarBASIC* p, SbxArray& rArgs, BOOL bWrite ); + +// Properties + +extern RTLFUNC(Date); +extern RTLFUNC(Err); +extern RTLFUNC(Erl); +extern RTLFUNC(False); +extern RTLFUNC(Nothing); +extern RTLFUNC(Null); +extern RTLFUNC(True); + +extern RTLFUNC(ATTR_NORMAL); +extern RTLFUNC(ATTR_READONLY); +extern RTLFUNC(ATTR_HIDDEN); +extern RTLFUNC(ATTR_SYSTEM); +extern RTLFUNC(ATTR_VOLUME); +extern RTLFUNC(ATTR_DIRECTORY); +extern RTLFUNC(ATTR_ARCHIVE); + +extern RTLFUNC(V_EMPTY); +extern RTLFUNC(V_NULL); +extern RTLFUNC(V_INTEGER); +extern RTLFUNC(V_LONG); +extern RTLFUNC(V_SINGLE); +extern RTLFUNC(V_DOUBLE); +extern RTLFUNC(V_CURRENCY); +extern RTLFUNC(V_DATE); +extern RTLFUNC(V_STRING); + +extern RTLFUNC(MB_OK); +extern RTLFUNC(MB_OKCANCEL); +extern RTLFUNC(MB_ABORTRETRYIGNORE); +extern RTLFUNC(MB_YESNOCANCEL); +extern RTLFUNC(MB_YESNO); +extern RTLFUNC(MB_RETRYCANCEL); +extern RTLFUNC(MB_ICONSTOP); +extern RTLFUNC(MB_ICONQUESTION); +extern RTLFUNC(MB_ICONEXCLAMATION); +extern RTLFUNC(MB_ICONINFORMATION); +extern RTLFUNC(MB_DEFBUTTON1); +extern RTLFUNC(MB_DEFBUTTON2); +extern RTLFUNC(MB_DEFBUTTON3); +extern RTLFUNC(MB_APPLMODAL); +extern RTLFUNC(MB_SYSTEMMODAL); + +extern RTLFUNC(IDOK); +extern RTLFUNC(IDCANCEL); +extern RTLFUNC(IDABORT); +extern RTLFUNC(IDRETRY); +extern RTLFUNC(IDYES); +extern RTLFUNC(IDNO); + +extern RTLFUNC(CF_TEXT); +extern RTLFUNC(CF_BITMAP); +extern RTLFUNC(CF_METAFILEPICT); + +extern RTLFUNC(PI); + +extern RTLFUNC(SET_OFF); +extern RTLFUNC(SET_ON); +extern RTLFUNC(TOGGLE); + +extern RTLFUNC(TYP_AUTHORFLD); +extern RTLFUNC(TYP_CHAPTERFLD); +extern RTLFUNC(TYP_CONDTXTFLD); +extern RTLFUNC(TYP_DATEFLD); +extern RTLFUNC(TYP_DBFLD); +extern RTLFUNC(TYP_DBNAMEFLD); +extern RTLFUNC(TYP_DBNEXTSETFLD); +extern RTLFUNC(TYP_DBNUMSETFLD); +extern RTLFUNC(TYP_DBSETNUMBERFLD); +extern RTLFUNC(TYP_DDEFLD); +extern RTLFUNC(TYP_DOCINFOFLD); +extern RTLFUNC(TYP_DOCSTATFLD); +extern RTLFUNC(TYP_EXTUSERFLD); +extern RTLFUNC(TYP_FILENAMEFLD); +extern RTLFUNC(TYP_FIXDATEFLD); +extern RTLFUNC(TYP_FIXTIMEFLD); +extern RTLFUNC(TYP_FORMELFLD); +extern RTLFUNC(TYP_GETFLD); +extern RTLFUNC(TYP_GETREFFLD); +extern RTLFUNC(TYP_HIDDENPARAFLD); +extern RTLFUNC(TYP_HIDDENTXTFLD); +extern RTLFUNC(TYP_INPUTFLD); +extern RTLFUNC(TYP_MACROFLD); +extern RTLFUNC(TYP_NEXTPAGEFLD); +extern RTLFUNC(TYP_PAGENUMBERFLD); +extern RTLFUNC(TYP_POSTITFLD); +extern RTLFUNC(TYP_PREVPAGEFLD); +extern RTLFUNC(TYP_SEQFLD); +extern RTLFUNC(TYP_SETFLD); +extern RTLFUNC(TYP_SETINPFLD); +extern RTLFUNC(TYP_SETREFFLD); +extern RTLFUNC(TYP_TEMPLNAMEFLD); +extern RTLFUNC(TYP_TIMEFLD); +extern RTLFUNC(TYP_USERFLD); +extern RTLFUNC(TYP_USRINPFLD); +extern RTLFUNC(TYP_SETREFPAGEFLD); +extern RTLFUNC(TYP_GETREFPAGEFLD); +extern RTLFUNC(TYP_INTERNETFLD); +extern RTLFUNC(TYP_JUMPEDITFLD); + +extern RTLFUNC(FRAMEANCHORPAGE); +extern RTLFUNC(FRAMEANCHORPARA); +extern RTLFUNC(FRAMEANCHORCHAR); + +extern RTLFUNC(CLEAR_ALLTABS); +extern RTLFUNC(CLEAR_TAB); +extern RTLFUNC(SET_TAB); + +extern RTLFUNC(LINEPROP); +extern RTLFUNC(LINE_1); +extern RTLFUNC(LINE_15); +extern RTLFUNC(LINE_2); + +// Methoden + +extern RTLFUNC(CreateObject); +extern RTLFUNC(Error); +extern RTLFUNC(Sin); +extern RTLFUNC(Abs); +extern RTLFUNC(Asc); +extern RTLFUNC(Atn); +extern RTLFUNC(Chr); +extern RTLFUNC(Cos); +extern RTLFUNC(CurDir); +extern RTLFUNC(ChDir); // JSM +extern RTLFUNC(ChDrive); // JSM +extern RTLFUNC(FileCopy); // JSM +extern RTLFUNC(Kill); // JSM +extern RTLFUNC(MkDir); // JSM +extern RTLFUNC(RmDir); // JSM +extern RTLFUNC(SendKeys); // JSM +extern RTLFUNC(DimArray); +extern RTLFUNC(Dir); +extern RTLFUNC(Exp); +extern RTLFUNC(FileLen); +extern RTLFUNC(Fix); +extern RTLFUNC(Hex); +extern RTLFUNC(InStr); +extern RTLFUNC(Int); +extern RTLFUNC(LCase); +extern RTLFUNC(Left); +extern RTLFUNC(Log); +extern RTLFUNC(LTrim); +extern RTLFUNC(Mid); +extern RTLFUNC(Oct); +extern RTLFUNC(Right); +extern RTLFUNC(RTrim); +extern RTLFUNC(Sgn); +extern RTLFUNC(Space); +extern RTLFUNC(Sqr); +extern RTLFUNC(Str); +extern RTLFUNC(StrComp); +extern RTLFUNC(String); +extern RTLFUNC(Tan); +extern RTLFUNC(UCase); +extern RTLFUNC(Val); +extern RTLFUNC(Len); +extern RTLFUNC(Spc); +extern RTLFUNC(DateSerial); +extern RTLFUNC(TimeSerial); +extern RTLFUNC(DateValue); +extern RTLFUNC(TimeValue); +extern RTLFUNC(Day); +extern RTLFUNC(Hour); +extern RTLFUNC(Minute); +extern RTLFUNC(Month); +extern RTLFUNC(Now); +extern RTLFUNC(Second); +extern RTLFUNC(Time); +extern RTLFUNC(Timer); +extern RTLFUNC(Weekday); +extern RTLFUNC(Year); +extern RTLFUNC(Date); +extern RTLFUNC(InputBox); +extern RTLFUNC(MsgBox); +extern RTLFUNC(IsArray); +extern RTLFUNC(IsDate); +extern RTLFUNC(IsEmpty); +extern RTLFUNC(IsError); +extern RTLFUNC(IsNull); +extern RTLFUNC(IsNumeric); +extern RTLFUNC(IsObject); +extern RTLFUNC(IsUnoStruct); + +extern RTLFUNC(FileDateTime); +extern RTLFUNC(Format); +extern RTLFUNC(GetAttr); +extern RTLFUNC(Randomize); // JSM +extern RTLFUNC(Rnd); +extern RTLFUNC(Shell); +extern RTLFUNC(VarType); +extern RTLFUNC(TypeName); +extern RTLFUNC(TypeLen); + +extern RTLFUNC(EOF); +extern RTLFUNC(FileAttr); +extern RTLFUNC(Loc); +extern RTLFUNC(Lof); +extern RTLFUNC(Seek); +extern RTLFUNC(SetAttr); // JSM +extern RTLFUNC(Reset); // JSM + +extern RTLFUNC(DDEInitiate); +extern RTLFUNC(DDETerminate); +extern RTLFUNC(DDETerminateAll); +extern RTLFUNC(DDERequest); +extern RTLFUNC(DDEExecute); +extern RTLFUNC(DDEPoke); + +extern RTLFUNC(FreeFile); +extern RTLFUNC(IsMissing); +extern RTLFUNC(LBound); +extern RTLFUNC(UBound); +extern RTLFUNC(RGB); +extern RTLFUNC(QBColor); +extern RTLFUNC(StrConv); + +extern RTLFUNC(Beep); + +extern RTLFUNC(Load); +extern RTLFUNC(Unload); +extern RTLFUNC(AboutStarBasic); +extern RTLFUNC(LoadPicture); +extern RTLFUNC(SavePicture); + +extern RTLFUNC(CBool); // JSM +extern RTLFUNC(CByte); // JSM +extern RTLFUNC(CCur); // JSM +extern RTLFUNC(CDate); // JSM +extern RTLFUNC(CDbl); // JSM +extern RTLFUNC(CInt); // JSM +extern RTLFUNC(CLng); // JSM +extern RTLFUNC(CSng); // JSM +extern RTLFUNC(CStr); // JSM +extern RTLFUNC(CVar); // JSM +extern RTLFUNC(CVErr); // JSM + +extern RTLFUNC(Iif); // JSM + +extern RTLFUNC(DumpAllObjects); + +extern RTLFUNC(GetSystemType); +extern RTLFUNC(GetGUIType); +extern RTLFUNC(Red); +extern RTLFUNC(Green); +extern RTLFUNC(Blue); + +extern RTLFUNC(Switch); +extern RTLFUNC(Wait); +extern RTLFUNC(GetGUIVersion); +extern RTLFUNC(Choose); +extern RTLFUNC(Trim); + +extern RTLFUNC(DateAdd); +extern RTLFUNC(DateDiff); +extern RTLFUNC(DatePart); +extern RTLFUNC(GetSolarVersion); +extern RTLFUNC(TwipsPerPixelX); +extern RTLFUNC(TwipsPerPixelY); +extern RTLFUNC(FreeLibrary); +extern RTLFUNC(Array); +extern RTLFUNC(FindObject); +extern RTLFUNC(FindPropertyObject); +extern RTLFUNC(EnableReschedule); + +extern RTLFUNC(Put); +extern RTLFUNC(Get); +extern RTLFUNC(Environ); +extern RTLFUNC(GetDialogZoomFactorX); +extern RTLFUNC(GetDialogZoomFactorY); +extern RTLFUNC(GetSystemTicks); +extern RTLFUNC(GetPathSeparator); +extern RTLFUNC(ResolvePath); +extern RTLFUNC(CreateUnoStruct); +extern RTLFUNC(CreateUnoService); +extern RTLFUNC(GetProcessServiceManager); +extern RTLFUNC(CreatePropertySet); +extern RTLFUNC(CreateUnoListener); +extern RTLFUNC(HasUnoInterfaces); +extern RTLFUNC(EqualUnoObjects); + +extern RTLFUNC(FileExists); + + diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx new file mode 100644 index 000000000000..587c59ffeb9e --- /dev/null +++ b/basic/source/runtime/runtime.cxx @@ -0,0 +1,934 @@ +/************************************************************************* + * + * $RCSfile: runtime.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _FSYS_HXX //autogen +#include <tools/fsys.hxx> +#endif +#ifndef _SV_SVAPP_HXX //autogen +#include <vcl/svapp.hxx> +#endif +#ifndef _INTN_HXX //autogen +#include <tools/intn.hxx> +#endif + +#ifndef _ZFORLIST_HXX //autogen +#include <svtools/zforlist.hxx> +#endif +#include <svtools/sbx.hxx> +#include "runtime.hxx" +#pragma hdrstop +#include "sbintern.hxx" +#include "opcodes.hxx" +#include "iosys.hxx" +#include "image.hxx" +#include "ddectrl.hxx" +#include "dllmgr.hxx" + +// Makro MEMBER() +#include <macfix.hxx> + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBRUNTIME, SBRUNTIME_CODE ) + +struct SbiGosubStack { // GOSUB-Stack: + SbiGosubStack* pNext; // Chain + const BYTE* pCode; // Return-Pointer +}; + +struct SbiArgvStack { // Argv stack: + SbiArgvStack* pNext; // Stack Chain + SbxArrayRef refArgv; // Argv + short nArgc; // Argc +}; + +SbiRuntime::pStep0 SbiRuntime::aStep0[] = { // Alle Opcodes ohne Operanden + MEMBER(SbiRuntime::StepNOP), + MEMBER(SbiRuntime::StepEXP), + MEMBER(SbiRuntime::StepMUL), + MEMBER(SbiRuntime::StepDIV), + MEMBER(SbiRuntime::StepMOD), + MEMBER(SbiRuntime::StepPLUS), + MEMBER(SbiRuntime::StepMINUS), + MEMBER(SbiRuntime::StepNEG), + MEMBER(SbiRuntime::StepEQ), + MEMBER(SbiRuntime::StepNE), + MEMBER(SbiRuntime::StepLT), + MEMBER(SbiRuntime::StepGT), + MEMBER(SbiRuntime::StepLE), + MEMBER(SbiRuntime::StepGE), + MEMBER(SbiRuntime::StepIDIV), + MEMBER(SbiRuntime::StepAND), + MEMBER(SbiRuntime::StepOR), + MEMBER(SbiRuntime::StepXOR), + MEMBER(SbiRuntime::StepEQV), + MEMBER(SbiRuntime::StepIMP), + MEMBER(SbiRuntime::StepNOT), + MEMBER(SbiRuntime::StepCAT), + + MEMBER(SbiRuntime::StepLIKE), + MEMBER(SbiRuntime::StepIS), + // Laden/speichern + MEMBER(SbiRuntime::StepARGC), // neuen Argv einrichten + MEMBER(SbiRuntime::StepARGV), // TOS ==> aktueller Argv + MEMBER(SbiRuntime::StepINPUT), // Input ==> TOS + MEMBER(SbiRuntime::StepLINPUT), // Line Input ==> TOS + MEMBER(SbiRuntime::StepGET), // TOS anfassen + MEMBER(SbiRuntime::StepSET), // Speichern Objekt TOS ==> TOS-1 + MEMBER(SbiRuntime::StepPUT), // TOS ==> TOS-1 + MEMBER(SbiRuntime::StepPUTC), // TOS ==> TOS-1, dann ReadOnly + MEMBER(SbiRuntime::StepDIM), // DIM + MEMBER(SbiRuntime::StepREDIM), // REDIM + MEMBER(SbiRuntime::StepREDIMP), // REDIM PRESERVE + MEMBER(SbiRuntime::StepERASE), // TOS loeschen + // Verzweigen + MEMBER(SbiRuntime::StepSTOP), // Programmende + MEMBER(SbiRuntime::StepINITFOR), // FOR-Variable initialisieren + MEMBER(SbiRuntime::StepNEXT), // FOR-Variable inkrementieren + MEMBER(SbiRuntime::StepCASE), // Anfang CASE + MEMBER(SbiRuntime::StepENDCASE), // Ende CASE + MEMBER(SbiRuntime::StepSTDERROR), // Standard-Fehlerbehandlung + MEMBER(SbiRuntime::StepNOERROR), // keine Fehlerbehandlung + MEMBER(SbiRuntime::StepLEAVE), // UP verlassen + // E/A + MEMBER(SbiRuntime::StepCHANNEL), // TOS = Kanalnummer + MEMBER(SbiRuntime::StepPRINT), // print TOS + MEMBER(SbiRuntime::StepPRINTF), // print TOS in field + MEMBER(SbiRuntime::StepWRITE), // write TOS + MEMBER(SbiRuntime::StepRENAME), // Rename Tos+1 to Tos + MEMBER(SbiRuntime::StepPROMPT), // Input Prompt aus TOS definieren + MEMBER(SbiRuntime::StepRESTART), // Set restart point + MEMBER(SbiRuntime::StepCHANNEL0), // E/A-Kanal 0 einstellen + MEMBER(SbiRuntime::StepEMPTY), // Leeren Ausdruck auf Stack + MEMBER(SbiRuntime::StepERROR), // TOS = Fehlercode + MEMBER(SbiRuntime::StepLSET), // Speichern Objekt TOS ==> TOS-1 + MEMBER(SbiRuntime::StepRSET) // Speichern Objekt TOS ==> TOS-1 +}; + +SbiRuntime::pStep1 SbiRuntime::aStep1[] = { // Alle Opcodes mit einem Operanden + MEMBER(SbiRuntime::StepLOADNC), // Laden einer numerischen Konstanten (+ID) + MEMBER(SbiRuntime::StepLOADSC), // Laden einer Stringkonstanten (+ID) + MEMBER(SbiRuntime::StepLOADI), // Immediate Load (+Wert) + MEMBER(SbiRuntime::StepARGN), // Speichern eines named Args in Argv (+StringID) + MEMBER(SbiRuntime::StepPAD), // String auf feste Laenge bringen (+Laenge) + // Verzweigungen + MEMBER(SbiRuntime::StepJUMP), // Sprung (+Target) + MEMBER(SbiRuntime::StepJUMPT), // TOS auswerten), bedingter Sprung (+Target) + MEMBER(SbiRuntime::StepJUMPF), // TOS auswerten), bedingter Sprung (+Target) + MEMBER(SbiRuntime::StepONJUMP), // TOS auswerten), Sprung in JUMP-Tabelle (+MaxVal) + MEMBER(SbiRuntime::StepGOSUB), // UP-Aufruf (+Target) + MEMBER(SbiRuntime::StepRETURN), // UP-Return (+0 oder Target) + MEMBER(SbiRuntime::StepTESTFOR), // FOR-Variable testen), inkrementieren (+Endlabel) + MEMBER(SbiRuntime::StepCASETO), // Tos+1 <= Case <= Tos), 2xremove (+Target) + MEMBER(SbiRuntime::StepERRHDL), // Fehler-Handler (+Offset) + MEMBER(SbiRuntime::StepRESUME), // Resume nach Fehlern (+0 or 1 or Label) + // E/A + MEMBER(SbiRuntime::StepCLOSE), // (+Kanal/0) + MEMBER(SbiRuntime::StepPRCHAR), // (+char) + // Verwaltung + MEMBER(SbiRuntime::StepCLASS), // Klassennamen testen (+StringId) + MEMBER(SbiRuntime::StepLIB), // Lib fuer Declare-Call (+StringId) + MEMBER(SbiRuntime::StepBASED), // TOS wird um BASE erhoeht, BASE davor gepusht + MEMBER(SbiRuntime::StepARGTYP), // Letzten Parameter in Argv konvertieren (+Typ) +}; + +SbiRuntime::pStep2 SbiRuntime::aStep2[] = {// Alle Opcodes mit zwei Operanden + MEMBER(SbiRuntime::StepRTL), // Laden aus RTL (+StringID+Typ) + MEMBER(SbiRuntime::StepFIND), // Laden (+StringID+Typ) + MEMBER(SbiRuntime::StepELEM), // Laden Element (+StringID+Typ) + MEMBER(SbiRuntime::StepPARAM), // Parameter (+Offset+Typ) + // Verzweigen + MEMBER(SbiRuntime::StepCALL), // Declare-Call (+StringID+Typ) + MEMBER(SbiRuntime::StepCALLC), // CDecl-Declare-Call (+StringID+Typ) + MEMBER(SbiRuntime::StepCASEIS), // Case-Test (+Test-Opcode+False-Target) + // Verwaltung + MEMBER(SbiRuntime::StepSTMNT), // Beginn eines Statements (+Line+Col) + // E/A + MEMBER(SbiRuntime::StepOPEN), // (+SvStreamFlags+Flags) + // Objekte + MEMBER(SbiRuntime::StepLOCAL), // Lokale Variable definieren (+StringId+Typ) + MEMBER(SbiRuntime::StepPUBLIC), // Modulglobale Variable (+StringID+Typ) + MEMBER(SbiRuntime::StepGLOBAL), // Globale Variable definieren (+StringID+Typ) + MEMBER(SbiRuntime::StepCREATE), // Objekt kreieren (+StringId+StringId) + MEMBER(SbiRuntime::StepSTATIC), // Statische Variable (+StringId+StringId) + MEMBER(SbiRuntime::StepTCREATE), // User Defined Objekte (+StringId+StringId) + MEMBER(SbiRuntime::StepDCREATE), // Objekt-Array kreieren (+StringID+StringID) +}; + +////////////////////////////////////////////////////////////////////////// +// SbiRTLData // +////////////////////////////////////////////////////////////////////////// + +SbiRTLData::SbiRTLData() +{ + pDir = 0; + nDirFlags = 0; + nCurDirPos = 0; +} + +SbiRTLData::~SbiRTLData() +{ + delete pDir; + pDir = 0; +} + +////////////////////////////////////////////////////////////////////////// +// SbiInstance // +////////////////////////////////////////////////////////////////////////// + +// 16.10.96: #31460 Neues Konzept fuer StepInto/Over/Out +// Die Entscheidung, ob StepPoint aufgerufen werden soll, wird anhand des +// CallLevels getroffen. Angehalten wird, wenn der aktuelle CallLevel <= +// nBreakCallLvl ist. Der aktuelle CallLevel kann niemals kleiner als 1 +// sein, da er beim Aufruf einer Methode (auch main) inkrementiert wird. +// Daher bedeutet ein BreakCallLvl von 0, dass das Programm gar nicht +// angehalten wird. +// (siehe auch step2.cxx, SbiRuntime::StepSTMNT() ) + +// Hilfsfunktion, um den BreakCallLevel gemaess der der Debug-Flags zu ermitteln +void SbiInstance::CalcBreakCallLevel( USHORT nFlags ) +{ + // Break-Flag wegfiltern + nFlags &= ~((USHORT)SbDEBUG_BREAK); + + USHORT nRet; + switch( nFlags ) + { + case SbDEBUG_STEPINTO: + nRet = nCallLvl + 1; // CallLevel+1 wird auch angehalten + break; + case SbDEBUG_STEPOVER | SbDEBUG_STEPINTO: + nRet = nCallLvl; // Aktueller CallLevel wird angehalten + break; + case SbDEBUG_STEPOUT: + nRet = nCallLvl - 1; // Kleinerer CallLevel wird angehalten + break; + case SbDEBUG_CONTINUE: + // Basic-IDE liefert 0 statt SbDEBUG_CONTINUE, also auch default=continue + default: + nRet = 0; // CallLevel ist immer >0 -> kein StepPoint + } + nBreakCallLvl = nRet; // Ergebnis uebernehmen +} + +SbiInstance::SbiInstance( StarBASIC* p ) +{ + pBasic = p; + pNext = NULL; + pRun = NULL; + pIosys = new SbiIoSystem; + pDdeCtrl = new SbiDdeControl; + pDllMgr = 0; // on demand + pNumberFormatter = 0; // on demand + nCallLvl = 0; + nBreakCallLvl = 0; + nErr = + nErl = 0; + bReschedule = TRUE; +} + +SbiInstance::~SbiInstance() +{ + while( pRun ) + { + SbiRuntime* p = pRun->pNext; + delete pRun; + pRun = p; + } + delete pIosys; + delete pDdeCtrl; + delete pDllMgr; + delete pNumberFormatter; +} + +SbiDllMgr* SbiInstance::GetDllMgr() +{ + if( !pDllMgr ) + pDllMgr = new SbiDllMgr; + return pDllMgr; +} + +// #39629 NumberFormatter jetzt ueber statische Methode anlegen +SvNumberFormatter* SbiInstance::GetNumberFormatter() +{ + if( !pNumberFormatter ) + PrepareNumberFormatter( pNumberFormatter, nStdDateIdx, nStdTimeIdx, nStdDateTimeIdx ); + return pNumberFormatter; +} + +// #39629 NumberFormatter auch statisch anbieten +void SbiInstance::PrepareNumberFormatter( SvNumberFormatter*& rpNumberFormatter, + ULONG &rnStdDateIdx, ULONG &rnStdTimeIdx, ULONG &rnStdDateTimeIdx ) +{ + const International& rInter = GetpApp()->GetAppInternational(); + LanguageType eLangType = rInter.GetLanguage(); + rpNumberFormatter = new SvNumberFormatter( eLangType ); + xub_StrLen nCheckPos = 0; short nType; + rnStdTimeIdx = rpNumberFormatter->GetStandardFormat( NUMBERFORMAT_TIME, eLangType ); + + // Standard-Vorlagen des Formatters haben nur zweistellige + // Jahreszahl. Deshalb eigenes Format registrieren + + // HACK, da der Numberformatter in PutandConvertEntry die Platzhalter + // fuer Monat, Tag, Jahr nicht entsprechend der Systemeinstellung + // austauscht. Problem: Print Year(Date) unter engl. BS + // siehe auch svtools\source\sbx\sbxdate.cxx + + DateFormat eDate = rInter.GetDateFormat(); + String aDateStr; + switch( eDate ) + { + case MDY: aDateStr = String( RTL_CONSTASCII_USTRINGPARAM("MM.TT.JJJJ") ); break; + case DMY: aDateStr = String( RTL_CONSTASCII_USTRINGPARAM("TT.MM.JJJJ") ); break; + case YMD: aDateStr = String( RTL_CONSTASCII_USTRINGPARAM("JJJJ.MM.TT") ); break; + default: aDateStr = String( RTL_CONSTASCII_USTRINGPARAM("MM.TT.JJJJ") ); + } + String aStr( aDateStr ); + rpNumberFormatter->PutandConvertEntry( aStr, nCheckPos, nType, + rnStdDateIdx, LANGUAGE_GERMAN, eLangType ); + nCheckPos = 0; + String aStrHHMMSS( RTL_CONSTASCII_USTRINGPARAM(" HH:MM:SS") ); + aStr = aDateStr; + aStr += aStrHHMMSS; + rpNumberFormatter->PutandConvertEntry( aStr, nCheckPos, nType, + rnStdDateTimeIdx, LANGUAGE_GERMAN, eLangType ); +} + + + +// Engine laufenlassen. Falls Flags == SbDEBUG_CONTINUE, Flags uebernehmen + +void SbiInstance::Stop() +{ + for( SbiRuntime* p = pRun; p; p = p->pNext ) + p->Stop(); +} + +void SbiInstance::Error( SbError n ) +{ + Error( n, String() ); +} + +void SbiInstance::Error( SbError n, const String& rMsg ) +{ + aErrorMsg = rMsg; + pRun->Error( n ); +} + +void SbiInstance::FatalError( SbError n ) +{ + pRun->FatalError( n ); +} + +void SbiInstance::Abort() +{ + // Basic suchen, in dem der Fehler auftrat + StarBASIC* pErrBasic = GetCurrentBasic( pBasic ); + pErrBasic->RTError( nErr, aErrorMsg, pRun->nLine, pRun->nCol1, pRun->nCol2 ); + pBasic->Stop(); +} + +// Hilfsfunktion, um aktives Basic zu finden, kann ungleich pRTBasic sein +StarBASIC* GetCurrentBasic( StarBASIC* pRTBasic ) +{ + StarBASIC* pCurBasic = pRTBasic; + SbModule* pActiveModule = pRTBasic->GetActiveModule(); + if( pActiveModule ) + { + SbxObject* pParent = pActiveModule->GetParent(); + if( pParent && pParent->ISA(StarBASIC) ) + pCurBasic = (StarBASIC*)pParent; + } + return pCurBasic; +} + +SbModule* SbiInstance::GetActiveModule() +{ + if( pRun ) + return pRun->GetModule(); + else + return NULL; +} + +SbMethod* SbiInstance::GetCaller( USHORT nLevel ) +{ + SbiRuntime* p = pRun; + while( nLevel-- && p ) + p = p->pNext; + if( p ) + return p->GetCaller(); + else + return NULL; +} + +SbxArray* SbiInstance::GetLocals( SbMethod* pMeth ) +{ + SbiRuntime* p = pRun; + while( p && p->GetMethod() != pMeth ) + p = p->pNext; + if( p ) + return p->GetLocals(); + else + return NULL; +} + +////////////////////////////////////////////////////////////////////////// +// SbiInstance // +////////////////////////////////////////////////////////////////////////// + +// Achtung: pMeth kann auch NULL sein (beim Aufruf des Init-Codes) + +SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, USHORT nStart ) + : pMeth( pe ), pMod( pm ), pImg( pMod->pImage ), + rBasic( *(StarBASIC*)pm->pParent ), pInst( pINST ) +{ + nFlags = pe ? pe->GetDebugFlags() : 0; + pIosys = pInst->pIosys; + pArgvStk = NULL; + pGosubStk = NULL; + pForStk = NULL; + pError = NULL; + pErrCode = + pErrStmnt = + pRestart = NULL; + pNext = NULL; + pCode = + pStmnt = (const BYTE* ) pImg->GetCode() + nStart; + bRun = + bError = TRUE; + bInError = FALSE; + nLine = + nCol1 = + nCol2 = + nExprLvl = + nArgc = + nError = + nGosubLvl = + nOps = 0; + refExprStk = new SbxArray; +#if defined GCC + SetParameters( pe ? pe->GetParameters() : (class SbxArray *)NULL ); +#else + SetParameters( pe ? pe->GetParameters() : NULL ); +#endif + pRefSaveList = NULL; + pItemStoreList = NULL; +} + +SbiRuntime::~SbiRuntime() +{ + ClearGosubStack(); + ClearArgvStack(); + ClearForStack(); + + // #74254 Items zum Sichern temporaere Referenzen freigeben + ClearRefs(); + while( pItemStoreList ) + { + RefSaveItem* pToDeleteItem = pItemStoreList; + pItemStoreList = pToDeleteItem->pNext; + delete pToDeleteItem; + } +} + +// Aufbau der Parameterliste. Alle ByRef-Parameter werden direkt +// uebernommen; von ByVal-Parametern werden Kopien angelegt. Falls +// ein bestimmter Datentyp verlangt wird, wird konvertiert. + +void SbiRuntime::SetParameters( SbxArray* pParams ) +{ + refParams = new SbxArray; + // fuer den Returnwert + refParams->Put( pMeth, 0 ); + if( pParams ) + { + SbxInfo* pInfo = pMeth->GetInfo(); + for( USHORT i = 1; i < pParams->Count(); i++ ) + { + const SbxParamInfo* p = pInfo ? pInfo->GetParam( i ) : NULL; + SbxVariable* v = pParams->Get( i ); + // Methoden sind immer byval! + BOOL bByVal = v->IsA( TYPE(SbxMethod) ); + SbxDataType t = v->GetType(); + if( p ) + { + bByVal |= BOOL( ( p->eType & SbxBYREF ) == 0 ); + t = (SbxDataType) ( p->eType & 0x0FFF ); + } + if( bByVal ) + { + SbxVariable* v2 = new SbxVariable( t ); + v2->SetFlag( SBX_READWRITE ); + *v2 = *v; + refParams->Put( v2, i ); + } + else + { + if( t != SbxVARIANT && t != ( v->GetType() & 0x0FFF ) ) + { + // Array konvertieren?? + if( p && (p->eType & SbxARRAY) ) + Error( SbERR_CONVERSION ); + else + v->Convert( t ); + } + refParams->Put( v, i ); + } + if( p ) + refParams->PutAlias( p->aName, i ); + } + } +} + +// Einen P-Code ausfuehren + +BOOL SbiRuntime::Step() +{ + if( bRun ) + { + // Unbedingt gelegentlich die Kontrolle abgeben! + if( pInst->IsReschedule() && !( ++nOps & 0x1F ) ) + Application::Reschedule(); + + SbiOpcode eOp = (SbiOpcode ) ( *pCode++ ); + USHORT nOp1, nOp2; + if( eOp <= SbOP0_END ) + { + (this->*( aStep0[ eOp ] ) )(); + } + else if( eOp >= SbOP1_START && eOp <= SbOP1_END ) + { + nOp1 = *pCode++; nOp1 |= *pCode++ << 8; + (this->*( aStep1[ eOp - SbOP1_START ] ) )( nOp1 ); + } + else if( eOp >= SbOP2_START && eOp <= SbOP2_END ) + { + nOp1 = *pCode++; nOp1 |= *pCode++ << 8; + nOp2 = *pCode++; nOp2 |= *pCode++ << 8; + (this->*( aStep2[ eOp - SbOP2_START ] ) )( nOp1, nOp2 ); + } + else + StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); + + // SBX-Fehler aufgetreten? + SbError nSbError = SbxBase::GetError(); + Error( ERRCODE_TOERROR(nSbError) ); // Warnings rausfiltern + + // AB 13.2.1997, neues Error-Handling: + // ACHTUNG: Hier kann nError auch dann gesetzt sein, wenn !nSbError, + // da nError jetzt auch von anderen RT-Instanzen gesetzt werden kann + + if( nError ) + SbxBase::ResetError(); + + // AB,15.3.96: Fehler nur anzeigen, wenn BASIC noch aktiv + // (insbesondere nicht nach Compiler-Fehlern zur Laufzeit) + if( nError && bRun ) + { + SbError err = nError; + ClearExprStack(); + nError = 0; + // Im Error Handler? Dann Std-Error + if( bInError ) + { + StepSTDERROR(); + pInst->Abort(); + } + else + { + bInError = TRUE; + + pInst->nErr = err; + pInst->nErl = nLine; + pErrCode = pCode; + pErrStmnt = pStmnt; + if( !bError ) // On Error Resume Next + StepRESUME( 1 ); + else if( pError ) // On Error Goto ... + pCode = pError; + else // Standard-Fehlerbehandlung + { + // AB 13.2.1997, neues Error-Handling: + // Uebergeordnete Error-Handler beruecksichtigen + + // Wir haben keinen Error-Handler -> weiter oben suchen + SbiRuntime* pRtErrHdl = NULL; + SbiRuntime* pRt = this; + while( NULL != (pRt = pRt->pNext) ) + { + // Gibt es einen Error-Handler? + if( pRt->bError == FALSE || pRt->pError != NULL ) + { + pRtErrHdl = pRt; + break; + } + } + + // Error-Hdl gefunden? + if( pRtErrHdl ) + { + // (Neuen) Error-Stack anlegen + SbErrorStack*& rErrStack = GetSbData()->pErrStack; + if( rErrStack ) + delete rErrStack; + rErrStack = new SbErrorStack(); + + // Alle im Call-Stack darunter stehenden RTs manipulieren + pRt = this; + do + { + // Fehler setzen + pRt->nError = err; + if( pRt != pRtErrHdl ) + pRt->bRun = FALSE; + + // In Error-Stack eintragen + SbErrorStackEntry *pEntry = new SbErrorStackEntry + ( pRt->pMeth, pRt->nLine, pRt->nCol1, pRt->nCol2 ); + rErrStack->C40_INSERT(SbErrorStackEntry, pEntry, rErrStack->Count() ); + + // Nach RT mit Error-Handler aufhoeren + if( pRt == pRtErrHdl ) + break; + } + while( pRt = pRt->pNext ); + } + // Kein Error-Hdl gefunden -> altes Vorgehen + else + { + pInst->Abort(); + } + + // ALT: Nur + // pInst->Abort(); + } + } + } + } + return bRun; +} + +void SbiRuntime::Error( SbError n ) +{ + if( n ) + nError = n; +} + +void SbiRuntime::FatalError( SbError n ) +{ + StepSTDERROR(); + Error( n ); +} + +////////////////////////////////////////////////////////////////////////// +// +// Parameter, Locals, Caller +// +////////////////////////////////////////////////////////////////////////// + +SbMethod* SbiRuntime::GetCaller() +{ + return pMeth; +} + +SbxArray* SbiRuntime::GetLocals() +{ + return refLocals; +} + +SbxArray* SbiRuntime::GetParams() +{ + return refParams; +} + +////////////////////////////////////////////////////////////////////////// +// +// Stacks +// +////////////////////////////////////////////////////////////////////////// + +// Der Expression-Stack steht fuer die laufende Auswertung von Expressions +// zur Verfuegung. + +void SbiRuntime::PushVar( SbxVariable* pVar ) +{ + if( pVar ) + refExprStk->Put( pVar, nExprLvl++ ); +} + +SbxVariableRef SbiRuntime::PopVar() +{ +#ifndef PRODUCT + if( !nExprLvl ) + { + StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); + return new SbxVariable; + } +#endif + SbxVariableRef xVar = refExprStk->Get( --nExprLvl ); +#ifdef DBG_UTIL + if ( xVar->GetName().EqualsAscii( "Cells" ) ) + DBG_TRACE( "" ); +#endif + // Methods halten im 0.Parameter sich selbst, also weghauen + if( xVar->IsA( TYPE(SbxMethod) ) ) + xVar->SetParameters(0); + return xVar; +} + +BOOL SbiRuntime::ClearExprStack() +{ + // #74732 Hier kann ein Fehler gesetzt werden + BOOL bErrorSet = FALSE; + + // Achtung: Clear() reicht nicht, da Methods geloescht werden muessen + while ( nExprLvl ) + { + SbxVariableRef xVar = PopVar(); + if( !nError && xVar->ISA( UnoClassMemberVariable ) ) + { + Error( SbERR_NO_METHOD ); + bErrorSet = TRUE; + } + } + refExprStk->Clear(); + return bErrorSet; +} + +// Variable auf dem Expression-Stack holen, ohne sie zu entfernen +// n zaehlt ab 0. + +SbxVariable* SbiRuntime::GetTOS( short n ) +{ + n = nExprLvl - n - 1; +#ifndef PRODUCT + if( n < 0 ) + { + StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); + return new SbxVariable; + } +#endif + return refExprStk->Get( (USHORT) n ); +} + +// Sicherstellen, dass TOS eine temporaere Variable ist + +void SbiRuntime::TOSMakeTemp() +{ + SbxVariable* p = refExprStk->Get( nExprLvl - 1 ); + if( p->GetRefCount() != 1 ) + { + // #74573 UnoClassSbxVariable spezialbehandeln + SbxVariable* pNew; + if( p->ISA( UnoClassSbxVariable ) ) + pNew = new UnoClassSbxVariable( *(UnoClassSbxVariable*)p ); + else + pNew = new SbxVariable( *p ); + pNew->SetFlag( SBX_READWRITE ); + refExprStk->Put( pNew, nExprLvl - 1 ); + } +} + +// Der GOSUB-Stack nimmt Returnadressen fuer GOSUBs auf + +void SbiRuntime::PushGosub( const BYTE* pc ) +{ + if( ++nGosubLvl > MAXRECURSION ) + StarBASIC::FatalError( SbERR_STACK_OVERFLOW ); + SbiGosubStack* p = new SbiGosubStack; + p->pCode = pc; + p->pNext = pGosubStk; + pGosubStk = p; +} + +void SbiRuntime::PopGosub() +{ + if( !pGosubStk ) + Error( SbERR_NO_GOSUB ); + else + { + SbiGosubStack* p = pGosubStk; + pCode = p->pCode; + pGosubStk = p->pNext; + delete p; + nGosubLvl--; + } +} + +// Entleeren des GOSUB-Stacks + +void SbiRuntime::ClearGosubStack() +{ + SbiGosubStack* p; + while(( p = pGosubStk ) != NULL ) + pGosubStk = p->pNext, delete p; + nGosubLvl = 0; +} + +// Der Argv-Stack nimmt aktuelle Argument-Vektoren auf + +void SbiRuntime::PushArgv() +{ + SbiArgvStack* p = new SbiArgvStack; + p->refArgv = refArgv; + p->nArgc = nArgc; + nArgc = 1; + refArgv.Clear(); + p->pNext = pArgvStk; + pArgvStk = p; +} + +void SbiRuntime::PopArgv() +{ + if( pArgvStk ) + { + SbiArgvStack* p = pArgvStk; + pArgvStk = p->pNext; + refArgv = p->refArgv; + nArgc = p->nArgc; + delete p; + } +} + +// Entleeren des Argv-Stacks + +void SbiRuntime::ClearArgvStack() +{ + while( pArgvStk ) + PopArgv(); +} + +// Push des For-Stacks. Der Stack hat Inkrement, Ende, Beginn und Variable. +// Nach Aufbau des Stack-Elements ist der Stack leer. + +void SbiRuntime::PushFor() +{ + SbiForStack* p = new SbiForStack; + p->pNext = pForStk; + pForStk = p; + // Der Stack ist wie folgt aufgebaut: + p->refInc = PopVar(); + p->refEnd = PopVar(); + SbxVariableRef xBgn = PopVar(); + p->refVar = PopVar(); + *(p->refVar) = *xBgn; +} + +// Poppen des FOR-Stacks + +void SbiRuntime::PopFor() +{ + if( pForStk ) + { + SbiForStack* p = pForStk; + pForStk = p->pNext; + delete p; + } +} + +// Entleeren des FOR-Stacks + +void SbiRuntime::ClearForStack() +{ + while( pForStk ) + PopFor(); +} + +////////////////////////////////////////////////////////////////////////// +// +// DLL-Aufrufe +// +////////////////////////////////////////////////////////////////////////// + +void SbiRuntime::DllCall + ( const String& aFuncName, // Funktionsname + const String& aDLLName, // Name der DLL + SbxArray* pArgs, // Parameter (ab Index 1, kann NULL sein) + SbxDataType eResType, // Returnwert + BOOL bCDecl ) // TRUE: nach C-Konventionen +{ + // No DllCall for "virtual" portal users + if( needSecurityRestrictions() ) + { + StarBASIC::Error(SbERR_NOT_IMPLEMENTED); + return; + } + + // MUSS NOCH IMPLEMENTIERT WERDEN + /* + String aMsg; + aMsg = "FUNC="; + aMsg += pFunc; + aMsg += " DLL="; + aMsg += pDLL; + MessBox( NULL, WB_OK, String( "DLL-CALL" ), aMsg ).Execute(); + Error( SbERR_NOT_IMPLEMENTED ); + */ + + SbxVariable* pRes = new SbxVariable( eResType ); + SbiDllMgr* pDllMgr = pInst->GetDllMgr(); + ByteString aByteFuncName( aFuncName, gsl_getSystemTextEncoding() ); + ByteString aByteDLLName( aDLLName, gsl_getSystemTextEncoding() ); + SbError nErr = pDllMgr->Call( aByteFuncName.GetBuffer(), aByteDLLName.GetBuffer(), pArgs, *pRes, bCDecl ); + if( nErr ) + Error( nErr ); + PushVar( pRes ); +} + diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx new file mode 100644 index 000000000000..778d5d727440 --- /dev/null +++ b/basic/source/runtime/stdobj.cxx @@ -0,0 +1,729 @@ +/************************************************************************* + * + * $RCSfile: stdobj.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SBXCLASS_HXX //autogen +#include <svtools/sbx.hxx> +#endif +#include "runtime.hxx" +#pragma hdrstop +#include "stdobj.hxx" +#include "stdobj1.hxx" +#include "rtlproto.hxx" + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBRUNTIME, SBRUNTIME_CODE ) + +// Das nArgs-Feld eines Tabelleneintrags ist wie folgt verschluesselt: +// Zur Zeit wird davon ausgegangen, dass Properties keine Parameter +// benoetigen! + +#define _ARGSMASK 0x00FF // Bis zu 255 Argumente +#define _RWMASK 0x0F00 // Maske fuer R/W-Bits +#define _TYPEMASK 0xF000 // Maske fuer den Typ des Eintrags + +#define _READ 0x0100 // kann gelesen werden +#define _BWRITE 0x0200 // kann as Lvalue verwendet werden +#define _LVALUE _BWRITE // kann as Lvalue verwendet werden +#define _READWRITE 0x0300 // beides +#define _OPT 0x0400 // Parameter ist optional +#define _CONST 0x0800 // Property ist const +#define _METHOD 0x3000 // Masken-Bits fuer eine Methode +#define _PROPERTY 0x4000 // Masken-Bit fuer eine Property +#define _OBJECT 0x8000 // Masken-Bit fuer ein Objekt + // Kombination von oberen Bits: +#define _FUNCTION 0x1100 // Maske fuer Function +#define _LFUNCTION 0x1300 // Maske fuer Function, die auch als Lvalue geht +#define _SUB 0x2100 // Maske fuer Sub +#define _ROPROP 0x4100 // Maske Read Only-Property +#define _WOPROP 0x4200 // Maske Write Only-Property +#define _RWPROP 0x4300 // Maske Read/Write-Property +#define _CPROP 0x4900 // Maske fuer Konstante + +struct Methods { + const char* pName; // Name des Eintrags + SbxDataType eType; // Datentyp + short nArgs; // Argumente und Flags + RtlCall pFunc; // Function Pointer + USHORT nHash; // Hashcode +}; + +static Methods aMethods[] = { + +{ "AboutStarBasic", SbxNULL, 1 | _FUNCTION, RTLNAME(AboutStarBasic) }, + { "Name", SbxSTRING }, +{ "Abs", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Abs) }, + { "number", SbxDOUBLE }, +{ "Array", SbxOBJECT, _FUNCTION, RTLNAME(Array) }, +{ "Asc", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Asc) }, + { "string", SbxSTRING }, +{ "Atn", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Atn) }, + { "number", SbxDOUBLE }, +{ "ATTR_ARCHIVE", SbxINTEGER, _CPROP, RTLNAME(ATTR_ARCHIVE) }, +{ "ATTR_DIRECTORY", SbxINTEGER, _CPROP, RTLNAME(ATTR_DIRECTORY) }, +{ "ATTR_HIDDEN", SbxINTEGER, _CPROP, RTLNAME(ATTR_HIDDEN) }, +{ "ATTR_NORMAL", SbxINTEGER, _CPROP, RTLNAME(ATTR_NORMAL) }, +{ "ATTR_READONLY", SbxINTEGER, _CPROP, RTLNAME(ATTR_READONLY) }, +{ "ATTR_SYSTEM", SbxINTEGER, _CPROP, RTLNAME(ATTR_SYSTEM) }, +{ "ATTR_VOLUME", SbxINTEGER, _CPROP, RTLNAME(ATTR_VOLUME) }, +{ "Beep", SbxNULL, _FUNCTION, RTLNAME(Beep) }, +{ "Blue", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Blue) }, + { "RGB-Value", SbxLONG }, + +{ "CBool", SbxBOOL, 1 | _FUNCTION, RTLNAME(CBool) }, + { "expression", SbxVARIANT }, +{ "CByte", SbxBYTE, 1 | _FUNCTION, RTLNAME(CByte) }, + { "expression", SbxVARIANT }, +{ "CCur", SbxCURRENCY, 1 | _FUNCTION, RTLNAME(CCur) }, + { "expression", SbxVARIANT }, +{ "CDate", SbxDATE, 1 | _FUNCTION, RTLNAME(CDate) }, + { "expression", SbxVARIANT }, +{ "CDbl", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(CDbl) }, + { "expression", SbxVARIANT }, +{ "CF_BITMAP", SbxINTEGER, _CPROP, RTLNAME(CF_BITMAP) }, +{ "CF_METAFILEPICT",SbxINTEGER, _CPROP, RTLNAME(CF_METAFILEPICT) }, +{ "CF_TEXT", SbxINTEGER, _CPROP, RTLNAME(CF_TEXT) }, +{ "ChDir", SbxNULL, 1 | _FUNCTION, RTLNAME(ChDir) }, + { "string", SbxSTRING }, +{ "ChDrive", SbxNULL, 1 | _FUNCTION, RTLNAME(ChDrive) }, + { "string", SbxSTRING }, + +{ "Choose", SbxVARIANT, 2 | _FUNCTION, RTLNAME(Choose) }, + { "Index", SbxINTEGER }, + { "Expression", SbxVARIANT }, + +{ "Chr", SbxSTRING, 1 | _FUNCTION, RTLNAME(Chr) }, + { "string", SbxINTEGER }, + +{ "CInt", SbxINTEGER, 1 | _FUNCTION, RTLNAME(CInt) }, + { "expression", SbxVARIANT }, +{ "CLEAR_ALLTABS", SbxINTEGER, _CPROP, RTLNAME(CLEAR_ALLTABS) }, +{ "CLEAR_TAB", SbxINTEGER, _CPROP, RTLNAME(CLEAR_TAB) }, + +{ "CLng", SbxLONG, 1 | _FUNCTION, RTLNAME(CLng) }, + { "expression", SbxVARIANT }, +{ "Cos", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Cos) }, + { "number", SbxDOUBLE }, +{ "CreateObject", SbxOBJECT, 1 | _FUNCTION, RTLNAME( CreateObject ) }, + { "class", SbxSTRING }, +{ "CreateUnoListener",SbxOBJECT, 1 | _FUNCTION, RTLNAME( CreateUnoListener ) }, + { "prefix", SbxSTRING }, + { "typename", SbxSTRING }, +{ "CreateUnoService",SbxOBJECT, 1 | _FUNCTION, RTLNAME( CreateUnoService ) }, + { "servicename", SbxSTRING }, +{ "CreateUnoStruct",SbxOBJECT, 1 | _FUNCTION, RTLNAME( CreateUnoStruct ) }, + { "classname", SbxSTRING }, +{ "CreatePropertySet",SbxOBJECT, 1 | _FUNCTION, RTLNAME( CreatePropertySet ) }, + { "values", SbxARRAY }, +{ "CSng", SbxSINGLE, 1 | _FUNCTION, RTLNAME(CSng) }, + { "expression", SbxVARIANT }, +{ "CStr", SbxSTRING, 1 | _FUNCTION, RTLNAME(CStr) }, + { "expression", SbxVARIANT }, +{ "CurDir", SbxSTRING, 1 | _FUNCTION, RTLNAME(CurDir) }, + { "string", SbxSTRING }, +{ "CVar", SbxVARIANT, 1 | _FUNCTION, RTLNAME(CVar) }, + { "expression", SbxVARIANT }, +{ "CVErr", SbxVARIANT, 1 | _FUNCTION, RTLNAME(CVErr) }, + { "expression", SbxVARIANT }, +{ "Date", SbxSTRING, _LFUNCTION,RTLNAME(Date) }, +{ "DateAdd", SbxDATE, 1 | _FUNCTION, RTLNAME(DateAdd) }, + { "Interval", SbxSTRING }, + { "Number", SbxLONG }, + { "Date", SbxDATE }, +{ "DateDiff", SbxLONG, 1 | _FUNCTION, RTLNAME(DateDiff) }, + { "Interval", SbxSTRING }, + { "Date1", SbxDATE }, + { "Date2", SbxDATE }, +{ "DatePart", SbxLONG, 1 | _FUNCTION, RTLNAME(DatePart) }, + { "Interval", SbxSTRING }, + { "Date", SbxDATE }, +{ "DateSerial", SbxDATE, 3 | _FUNCTION, RTLNAME(DateSerial) }, + { "Year", SbxINTEGER }, + { "Month", SbxINTEGER }, + { "Day", SbxINTEGER }, +{ "DateValue", SbxDATE, 1 | _FUNCTION, RTLNAME(DateValue) }, + { "String", SbxSTRING }, +{ "Day", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Day) }, + { "Date", SbxDATE }, + +{ "Ddeexecute", SbxNULL, 2 | _FUNCTION, RTLNAME(DDEExecute) }, + { "Channel", SbxLONG }, + { "Command", SbxSTRING }, +{ "Ddeinitiate", SbxINTEGER, 2 | _FUNCTION, RTLNAME(DDEInitiate) }, + { "Application", SbxSTRING }, + { "Topic", SbxSTRING }, +{ "Ddepoke", SbxNULL, 3 | _FUNCTION, RTLNAME(DDEPoke) }, + { "Channel", SbxLONG }, + { "Item", SbxSTRING }, + { "Data", SbxSTRING }, +{ "Dderequest", SbxSTRING, 2 | _FUNCTION, RTLNAME(DDERequest) }, + { "Channel", SbxLONG }, + { "Item", SbxSTRING }, +{ "Ddeterminate", SbxNULL, 1 | _FUNCTION, RTLNAME(DDETerminate) }, + { "Channel", SbxLONG }, +{ "Ddeterminateall", SbxNULL, _FUNCTION, RTLNAME(DDETerminateAll) }, +{ "DimArray", SbxOBJECT, _FUNCTION, RTLNAME(DimArray) }, +{ "Dir", SbxSTRING, 2 | _FUNCTION, RTLNAME(Dir) }, + { "FileSpec", SbxSTRING, _OPT }, + { "attrmask", SbxINTEGER, _OPT }, +{ "DumpAllObjects", SbxEMPTY, 2 | _SUB, RTLNAME(DumpAllObjects) }, + { "FileSpec", SbxSTRING }, + { "DumpAll", SbxINTEGER, _OPT }, + +{ "EqualUnoObjects",SbxBOOL, 2 | _FUNCTION, RTLNAME(EqualUnoObjects) }, + { "Variant", SbxVARIANT }, + { "Variant", SbxVARIANT }, +{ "EnableReschedule", SbxNULL, 1 | _FUNCTION, RTLNAME(EnableReschedule) }, + { "bEnable", SbxBOOL }, +{ "Environ", SbxSTRING, 1 | _FUNCTION, RTLNAME(Environ) }, + { "Environmentstring",SbxSTRING }, +{ "EOF", SbxBOOL, 1 | _FUNCTION, RTLNAME(EOF) }, + { "Channel", SbxINTEGER }, +{ "Erl", SbxLONG, _ROPROP, RTLNAME( Erl ) }, +{ "Err", SbxLONG, _RWPROP, RTLNAME( Err ) }, +{ "Error", SbxSTRING, 1 | _FUNCTION, RTLNAME( Error ) }, + { "code", SbxLONG }, +{ "Exp", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Exp) }, + { "number", SbxDOUBLE }, +{ "False", SbxBOOL, _CPROP, RTLNAME(False) }, +{ "FileAttr", SbxINTEGER, 2 | _FUNCTION, RTLNAME(FileAttr) }, + { "Channel", SbxINTEGER }, + { "Attributes", SbxINTEGER }, +{ "FileCopy", SbxNULL, 2 | _FUNCTION, RTLNAME(FileCopy) }, + { "Source", SbxSTRING }, + { "Destination", SbxSTRING }, +{ "FileDateTime", SbxSTRING, 1 | _FUNCTION, RTLNAME(FileDateTime) }, + { "filename", SbxSTRING }, +{ "FileExists", SbxBOOL, 1 | _FUNCTION, RTLNAME(FileExists) }, + { "filename", SbxSTRING }, +{ "FileLen", SbxLONG, 1 | _FUNCTION, RTLNAME(FileLen) }, + { "filename", SbxSTRING }, +{ "FindObject", SbxOBJECT, 1 | _FUNCTION, RTLNAME(FindObject) }, + { "Name", SbxSTRING }, +{ "FindPropertyObject", SbxOBJECT, 2 | _FUNCTION, RTLNAME(FindPropertyObject) }, + { "Object", SbxOBJECT }, + { "Name", SbxSTRING }, +{ "Fix", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Fix) }, + { "number", SbxDOUBLE }, +{ "Format", SbxSTRING, 2 | _FUNCTION, RTLNAME(Format) }, + { "expression", SbxVARIANT }, + { "format", SbxSTRING, _OPT }, + +{ "FRAMEANCHORCHAR", SbxINTEGER, _CPROP, RTLNAME(FRAMEANCHORCHAR) }, +{ "FRAMEANCHORPAGE", SbxINTEGER, _CPROP, RTLNAME(FRAMEANCHORPAGE) }, +{ "FRAMEANCHORPARA", SbxINTEGER, _CPROP, RTLNAME(FRAMEANCHORPARA) }, + +{ "FreeFile", SbxINTEGER, _FUNCTION, RTLNAME(FreeFile) }, +{ "FreeLibrary", SbxNULL, 1 | _FUNCTION, RTLNAME(FreeLibrary) }, + { "Modulename", SbxSTRING }, + +{ "Get", SbxNULL, 3 | _FUNCTION, RTLNAME(Get) }, + { "filenumber", SbxINTEGER }, + { "recordnumber", SbxLONG }, + { "variablename", SbxVARIANT }, + +{ "GetAttr", SbxINTEGER, 1 | _FUNCTION, RTLNAME(GetAttr) }, + { "filename", SbxSTRING }, +{ "GetDialogZoomFactorX", SbxDOUBLE, _FUNCTION,RTLNAME(GetDialogZoomFactorX) }, +{ "GetDialogZoomFactorY", SbxDOUBLE, _FUNCTION,RTLNAME(GetDialogZoomFactorY) }, +{ "GetGUIType", SbxINTEGER, _FUNCTION,RTLNAME(GetGUIType) }, +{ "GetGUIVersion", SbxLONG, _FUNCTION,RTLNAME(GetGUIVersion) }, +{ "GetPathSeparator", SbxSTRING, _FUNCTION,RTLNAME(GetPathSeparator) }, +{ "GetProcessServiceManager", SbxOBJECT, 0 | _FUNCTION, RTLNAME(GetProcessServiceManager) }, +{ "GetSolarVersion", SbxLONG, _FUNCTION,RTLNAME(GetSolarVersion) }, +{ "GetSystemTicks", SbxLONG, _FUNCTION,RTLNAME(GetSystemTicks) }, +{ "GetSystemType", SbxINTEGER, _FUNCTION,RTLNAME(GetSystemType) }, +{ "Green", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Green) }, + { "RGB-Value", SbxLONG }, + +{ "HasUnoInterfaces", SbxBOOL, 1 | _FUNCTION, RTLNAME(HasUnoInterfaces) }, + { "InterfaceName",SbxSTRING }, +{ "Hex", SbxSTRING, 1 | _FUNCTION, RTLNAME(Hex) }, + { "number", SbxLONG }, +{ "Hour", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Hour) }, + { "Date", SbxDATE }, + +{ "IDABORT", SbxINTEGER, _CPROP, RTLNAME(IDABORT) }, +{ "IDCANCEL", SbxINTEGER, _CPROP, RTLNAME(IDCANCEL) }, +{ "IDNO", SbxINTEGER, _CPROP, RTLNAME(IDNO) }, +{ "IDOK", SbxINTEGER, _CPROP, RTLNAME(IDOK) }, +{ "IDRETRY", SbxINTEGER, _CPROP, RTLNAME(IDRETRY) }, +{ "IDYES", SbxINTEGER, _CPROP, RTLNAME(IDYES) }, + +{ "Iif", SbxVARIANT, 3 | _FUNCTION, RTLNAME(Iif) }, + { "Bool", SbxBOOL }, + { "Variant1", SbxVARIANT }, + { "Variant2", SbxVARIANT }, + +{ "InputBox", SbxSTRING, 5 | _FUNCTION, RTLNAME(InputBox) }, + { "Prompt", SbxSTRING }, + { "Title", SbxSTRING, _OPT }, + { "Default", SbxSTRING, _OPT }, + { "XPosTwips", SbxLONG, _OPT }, + { "YPosTwips", SbxLONG, _OPT }, +{ "InStr", SbxINTEGER, 4 | _FUNCTION, RTLNAME(InStr) }, + { "StartPos", SbxSTRING, _OPT }, + { "String1", SbxSTRING }, + { "String2", SbxSTRING }, + { "Compare", SbxINTEGER, _OPT }, +{ "Int", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Int) }, + { "number", SbxDOUBLE }, +{ "IsArray", SbxBOOL, 1 | _FUNCTION, RTLNAME(IsArray) }, + { "Variant", SbxVARIANT }, +{ "IsDate", SbxBOOL, 1 | _FUNCTION, RTLNAME(IsDate) }, + { "Variant", SbxVARIANT }, +{ "IsEmpty", SbxBOOL, 1 | _FUNCTION, RTLNAME(IsEmpty) }, + { "Variant", SbxVARIANT }, +{ "IsError", SbxBOOL, 1 | _FUNCTION, RTLNAME(IsError) }, + { "Variant", SbxVARIANT }, +{ "IsMissing", SbxBOOL, 1 | _FUNCTION, RTLNAME(IsMissing) }, + { "Variant", SbxVARIANT }, +{ "IsNull", SbxBOOL, 1 | _FUNCTION, RTLNAME(IsNull) }, + { "Variant", SbxVARIANT }, +{ "IsNumeric", SbxBOOL, 1 | _FUNCTION, RTLNAME(IsNumeric) }, + { "Variant", SbxVARIANT }, +{ "IsObject", SbxBOOL, 1 | _FUNCTION, RTLNAME(IsObject) }, + { "Variant", SbxVARIANT }, +{ "IsUnoStruct", SbxBOOL, 1 | _FUNCTION, RTLNAME(IsUnoStruct) }, + { "Variant", SbxVARIANT }, +{ "Kill", SbxNULL, 1 | _FUNCTION, RTLNAME(Kill) }, + { "filespec", SbxSTRING }, +{ "LBound", SbxINTEGER, 1 | _FUNCTION, RTLNAME(LBound) }, + { "Variant", SbxVARIANT }, +{ "LCase", SbxSTRING, 1 | _FUNCTION, RTLNAME(LCase) }, + { "string", SbxSTRING }, +{ "Left", SbxSTRING, 2 | _FUNCTION, RTLNAME(Left) }, + { "String", SbxSTRING }, + { "Count", SbxLONG }, +{ "Len", SbxLONG, 1 | _FUNCTION, RTLNAME(Len) }, + { "StringOrVariant", SbxVARIANT }, +{ "Load", SbxNULL, 1 | _FUNCTION, RTLNAME(Load) }, + { "object", SbxOBJECT }, +{ "LoadPicture", SbxOBJECT, 1 | _FUNCTION, RTLNAME(LoadPicture) }, + { "string", SbxSTRING }, +{ "Loc", SbxLONG, 1 | _FUNCTION, RTLNAME(Loc) }, + { "Channel", SbxINTEGER }, +{ "Lof", SbxLONG, 1 | _FUNCTION, RTLNAME(Lof) }, + { "Channel", SbxINTEGER }, +{ "Log", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Log) }, + { "number", SbxDOUBLE }, +{ "LTrim", SbxSTRING, 1 | _FUNCTION, RTLNAME(LTrim) }, + { "string", SbxSTRING }, + +{ "MB_ABORTRETRYIGNORE", SbxINTEGER, _CPROP, RTLNAME(MB_ABORTRETRYIGNORE)}, +{ "MB_APPLMODAL", SbxINTEGER, _CPROP, RTLNAME(MB_APPLMODAL) }, +{ "MB_DEFBUTTON1", SbxINTEGER, _CPROP, RTLNAME(MB_DEFBUTTON1) }, +{ "MB_DEFBUTTON2", SbxINTEGER, _CPROP, RTLNAME(MB_DEFBUTTON2) }, +{ "MB_DEFBUTTON3", SbxINTEGER, _CPROP, RTLNAME(MB_DEFBUTTON3) }, +{ "MB_ICONEXCLAMATION", SbxINTEGER, _CPROP, RTLNAME(MB_ICONEXCLAMATION)}, +{ "MB_ICONINFORMATION", SbxINTEGER, _CPROP, RTLNAME(MB_ICONINFORMATION)}, +{ "MB_ICONQUESTION",SbxINTEGER, _CPROP, RTLNAME(MB_ICONQUESTION) }, +{ "MB_ICONSTOP", SbxINTEGER, _CPROP, RTLNAME(MB_ICONSTOP) }, +{ "MB_OK", SbxINTEGER, _CPROP, RTLNAME(MB_OK) }, +{ "MB_OKCANCEL", SbxINTEGER, _CPROP, RTLNAME(MB_OKCANCEL) }, +{ "MB_RETRYCANCEL", SbxINTEGER, _CPROP, RTLNAME(MB_RETRYCANCEL) }, +{ "MB_SYSTEMMODAL", SbxINTEGER, _CPROP, RTLNAME(MB_SYSTEMMODAL) }, +{ "MB_YESNO", SbxINTEGER, _CPROP, RTLNAME(MB_YESNO) }, +{ "MB_YESNOCANCEL", SbxINTEGER, _CPROP, RTLNAME(MB_YESNOCANCEL) }, + + +{ "Mid", SbxSTRING, 3 | _LFUNCTION,RTLNAME(Mid) }, + { "String", SbxSTRING }, + { "StartPos", SbxLONG } , + { "Length", SbxLONG, _OPT } , +{ "Minute", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Minute) }, + { "Date", SbxDATE }, +{ "MkDir", SbxNULL, 1 | _FUNCTION, RTLNAME(MkDir) }, + { "pathname", SbxSTRING }, +{ "Month", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Month) }, + { "Date", SbxDATE }, +{ "MsgBox", SbxINTEGER, 3 | _FUNCTION, RTLNAME(MsgBox) }, + { "Message", SbxSTRING }, + { "Type", SbxINTEGER, _OPT }, + { "Title", SbxSTRING, _OPT }, + +{ "Nothing", SbxOBJECT, _CPROP, RTLNAME(Nothing) }, +{ "Now", SbxDATE, _FUNCTION, RTLNAME(Now) }, +{ "Null", SbxOBJECT, _CPROP, RTLNAME(Null) }, +{ "Oct", SbxSTRING, 1 | _FUNCTION, RTLNAME(Oct) }, + { "number", SbxLONG }, +{ "Pi", SbxDOUBLE, _CPROP, RTLNAME(PI) }, + +{ "Put", SbxNULL, 3 | _FUNCTION, RTLNAME(Put) }, + { "filenumber", SbxINTEGER }, + { "recordnumber", SbxLONG }, + { "variablename", SbxVARIANT }, + +{ "QBColor", SbxLONG, 1 | _FUNCTION, RTLNAME(QBColor) }, + { "number", SbxINTEGER }, +{ "Randomize", SbxNULL, 1 | _FUNCTION, RTLNAME(Randomize) }, + { "Number", SbxDOUBLE, _OPT }, +{ "Red", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Red) }, + { "RGB-Value", SbxLONG }, +{ "Reset", SbxNULL, 0 | _FUNCTION, RTLNAME(Reset) }, +{ "ResolvePath", SbxSTRING, 1 | _FUNCTION, RTLNAME(ResolvePath) }, + { "Path", SbxSTRING }, +{ "RGB", SbxLONG, 3 | _FUNCTION, RTLNAME(RGB) }, + { "Red", SbxINTEGER }, + { "Green", SbxINTEGER }, + { "Blue", SbxINTEGER }, + +{ "Right", SbxSTRING, 2 | _FUNCTION, RTLNAME(Right) }, + { "String", SbxSTRING }, + { "Count", SbxLONG } , +{ "RmDir", SbxNULL, 1 | _FUNCTION, RTLNAME(RmDir) }, + { "pathname", SbxSTRING }, +{ "Rnd", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Rnd) }, + { "Number", SbxDOUBLE, _OPT }, +{ "RTrim", SbxSTRING, 1 | _FUNCTION, RTLNAME(RTrim) }, + { "string", SbxSTRING }, +{ "SavePicture", SbxNULL, 2 | _FUNCTION, RTLNAME(SavePicture) }, + { "object", SbxOBJECT }, + { "string", SbxSTRING }, +{ "Second", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Second) }, + { "Date", SbxDATE }, +{ "Seek", SbxLONG, 1 | _FUNCTION, RTLNAME(Seek) }, + { "Channel", SbxINTEGER }, + +{ "SendKeys", SbxNULL, 2 | _FUNCTION, RTLNAME(SendKeys) }, + { "String", SbxSTRING }, + { "Wait", SbxBOOL, _OPT } , +{ "SetAttr", SbxNULL, 2 | _FUNCTION, RTLNAME(SetAttr) }, + { "File" , SbxSTRING }, + { "Attributes", SbxINTEGER } , +{ "SET_OFF", SbxINTEGER, _CPROP, RTLNAME(SET_OFF) }, +{ "SET_ON", SbxINTEGER, _CPROP, RTLNAME(SET_ON) }, +{ "SET_TAB", SbxINTEGER, _CPROP, RTLNAME(SET_TAB) }, + +{ "Sgn", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Sgn) }, + { "number", SbxDOUBLE }, +{ "Shell", SbxLONG, 2 | _FUNCTION, RTLNAME(Shell) }, + { "Commandstring",SbxSTRING }, + { "WindowStyle", SbxINTEGER, _OPT }, +{ "Sin", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Sin) }, + { "number", SbxDOUBLE }, +{ "Space", SbxSTRING, 1 | _FUNCTION, RTLNAME(Space) }, + { "string", SbxLONG }, +{ "Spc", SbxSTRING, 1 | _FUNCTION, RTLNAME(Spc) }, + { "Count", SbxLONG }, +{ "Sqr", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Sqr) }, + { "number", SbxDOUBLE }, +{ "Str", SbxSTRING, 1 | _FUNCTION, RTLNAME(Str) }, + { "number", SbxDOUBLE }, +{ "StrComp", SbxINTEGER, 3 | _FUNCTION, RTLNAME(StrComp) }, + { "String1", SbxSTRING }, + { "String2", SbxSTRING }, + { "Compare", SbxINTEGER, _OPT }, +{ "StrConv", SbxSTRING, 2 | _FUNCTION, RTLNAME(StrConv) }, + { "String", SbxSTRING }, + { "Conversion", SbxSTRING }, +{ "String", SbxSTRING, 2 | _FUNCTION, RTLNAME(String) }, + { "Count", SbxLONG }, + { "Filler", SbxVARIANT }, + +{ "Switch", SbxVARIANT, 2 | _FUNCTION, RTLNAME(Switch) }, + { "Expression", SbxVARIANT }, + { "Value", SbxVARIANT }, + +{ "Tan", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Tan) }, + { "number", SbxDOUBLE }, +{ "Time", SbxVARIANT, _LFUNCTION,RTLNAME(Time) }, +{ "Timer", SbxDATE, _FUNCTION, RTLNAME(Timer) }, +{ "TimeSerial", SbxDATE, 3 | _FUNCTION, RTLNAME(TimeSerial) }, + { "Hour", SbxLONG }, + { "Minute", SbxLONG }, + { "Second", SbxLONG }, +{ "TimeValue", SbxDATE, 1 | _FUNCTION, RTLNAME(TimeValue) }, + { "String", SbxSTRING }, + +{ "TOGGLE", SbxINTEGER, _CPROP, RTLNAME(TOGGLE) }, + +{ "Trim", SbxSTRING, 1 | _FUNCTION, RTLNAME(Trim) }, + { "String", SbxSTRING }, +{ "True", SbxBOOL, _CPROP, RTLNAME(True) }, +{ "TwipsPerPixelX", SbxLONG, _FUNCTION, RTLNAME(TwipsPerPixelX) }, +{ "TwipsPerPixelY", SbxLONG, _FUNCTION, RTLNAME(TwipsPerPixelY) }, + +{ "TYP_AUTHORFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_AUTHORFLD) }, +{ "TYP_CHAPTERFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_CHAPTERFLD) }, +{ "TYP_CONDTXTFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_CONDTXTFLD) }, +{ "TYP_DATEFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_DATEFLD) }, +{ "TYP_DBFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_DBFLD) }, +{ "TYP_DBNAMEFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_DBNAMEFLD) }, +{ "TYP_DBNEXTSETFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_DBNEXTSETFLD) }, +{ "TYP_DBNUMSETFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_DBNUMSETFLD) }, +{ "TYP_DBSETNUMBERFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_DBSETNUMBERFLD) }, +{ "TYP_DDEFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_DDEFLD) }, +{ "TYP_DOCINFOFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_DOCINFOFLD) }, +{ "TYP_DOCSTATFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_DOCSTATFLD) }, +{ "TYP_EXTUSERFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_EXTUSERFLD) }, +{ "TYP_FILENAMEFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_FILENAMEFLD) }, +{ "TYP_FIXDATEFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_FIXDATEFLD) }, +{ "TYP_FIXTIMEFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_FIXTIMEFLD) }, +{ "TYP_FORMELFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_FORMELFLD) }, +{ "TYP_GETFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_GETFLD) }, +{ "TYP_GETREFFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_GETREFFLD) }, +{ "TYP_GETREFPAGEFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_GETREFPAGEFLD) }, +{ "TYP_HIDDENPARAFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_HIDDENPARAFLD) }, +{ "TYP_HIDDENTXTFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_HIDDENTXTFLD) }, +{ "TYP_INPUTFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_INPUTFLD) }, +{ "TYP_INTERNETFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_INTERNETFLD) }, +{ "TYP_JUMPEDITFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_JUMPEDITFLD) }, +{ "TYP_MACROFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_MACROFLD) }, +{ "TYP_NEXTPAGEFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_NEXTPAGEFLD) }, +{ "TYP_PAGENUMBERFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_PAGENUMBERFLD) }, +{ "TYP_POSTITFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_POSTITFLD) }, +{ "TYP_PREVPAGEFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_PREVPAGEFLD) }, +{ "TYP_SEQFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_SEQFLD) }, +{ "TYP_SETFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_SETFLD) }, +{ "TYP_SETINPFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_SETINPFLD) }, +{ "TYP_SETREFFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_SETREFFLD) }, +{ "TYP_SETREFPAGEFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_SETREFPAGEFLD) }, +{ "TYP_TEMPLNAMEFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_TEMPLNAMEFLD) }, +{ "TYP_TIMEFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_TIMEFLD) }, +{ "TYP_USERFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_USERFLD) }, +{ "TYP_USRINPFLD", SbxINTEGER, _CPROP, RTLNAME(TYP_USRINPFLD) }, + +{ "TypeLen", SbxINTEGER, 1 | _FUNCTION, RTLNAME(TypeLen) }, + { "Var", SbxVARIANT }, +{ "TypeName", SbxSTRING, 1 | _FUNCTION, RTLNAME(TypeName) }, + { "Var", SbxVARIANT }, +{ "UBound", SbxINTEGER, 1 | _FUNCTION, RTLNAME(UBound) }, + { "Var", SbxVARIANT }, +{ "UCase", SbxSTRING, 1 | _FUNCTION, RTLNAME(UCase) }, + { "String", SbxSTRING }, +{ "Unload", SbxNULL, 1 | _FUNCTION, RTLNAME(Unload) }, + { "Dialog", SbxOBJECT }, +{ "Val", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Val) }, + { "String", SbxSTRING }, +{ "VarType", SbxINTEGER, 1 | _FUNCTION, RTLNAME(VarType) }, + { "Var", SbxVARIANT }, +{ "V_EMPTY", SbxINTEGER, _CPROP, RTLNAME(V_EMPTY) }, +{ "V_NULL", SbxINTEGER, _CPROP, RTLNAME(V_NULL) }, +{ "V_INTEGER", SbxINTEGER, _CPROP, RTLNAME(V_INTEGER) }, +{ "V_LONG", SbxINTEGER, _CPROP, RTLNAME(V_LONG) }, +{ "V_SINGLE", SbxINTEGER, _CPROP, RTLNAME(V_SINGLE) }, +{ "V_DOUBLE", SbxINTEGER, _CPROP, RTLNAME(V_DOUBLE) }, +{ "V_CURRENCY", SbxINTEGER, _CPROP, RTLNAME(V_CURRENCY) }, +{ "V_DATE", SbxINTEGER, _CPROP, RTLNAME(V_DATE) }, +{ "V_STRING", SbxINTEGER, _CPROP, RTLNAME(V_STRING) }, + +{ "Wait", SbxNULL, 1 | _FUNCTION, RTLNAME(Wait) }, + { "Milliseconds", SbxLONG }, +{ "Weekday", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Weekday) }, + { "Date", SbxDATE }, +{ "Year", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Year) }, + { "Date", SbxDATE }, + +{ NULL, SbxNULL, -1 }}; // Tabellenende + +SbiStdObject::SbiStdObject( const String& r, StarBASIC* pb ) : SbxObject( r ) +{ + // Muessen wir die Hashcodes initialisieren? + Methods* p = aMethods; + if( !p->nHash ) + while( p->nArgs != -1 ) + { + String aName = String::CreateFromAscii( p->pName ); + p->nHash = SbxVariable::MakeHashCode( aName ); + p += ( p->nArgs & _ARGSMASK ) + 1; + } + + SetParent( pb ); + + pStdFactory = new SbStdFactory; + SbxBase::AddFactory( pStdFactory ); + + Insert( new SbStdClipboard ); +} + +SbiStdObject::~SbiStdObject() +{ + SbxBase::RemoveFactory( pStdFactory ); + delete pStdFactory; +} + +// Suche nach einem Element: +// Hier wird linear durch die Methodentabelle gegangen, bis eine +// passende Methode gefunden wurde. Auf Grund der Bits im nArgs-Feld +// wird dann die passende Instanz eines SbxObjElement generiert. +// Wenn die Methode/Property nicht gefunden wurde, nur NULL ohne +// Fehlercode zurueckliefern, da so auch eine ganze Chain von +// Objekten nach der Methode/Property befragt werden kann. + +SbxVariable* SbiStdObject::Find( const String& rName, SbxClassType t ) +{ + // Bereits eingetragen? + SbxVariable* pVar = SbxObject::Find( rName, t ); + if( !pVar ) + { + // sonst suchen + USHORT nHash = SbxVariable::MakeHashCode( rName ); + Methods* p = aMethods; + BOOL bFound = FALSE; + short nIndex = 0; + USHORT nSrchMask = _TYPEMASK; + switch( t ) + { + case SbxCLASS_METHOD: nSrchMask = _METHOD; break; + case SbxCLASS_PROPERTY: nSrchMask = _PROPERTY; break; + case SbxCLASS_OBJECT: nSrchMask = _OBJECT; break; + } + while( p->nArgs != -1 ) + { + if( ( p->nArgs & nSrchMask ) + && ( p->nHash == nHash ) + && ( rName.EqualsIgnoreCaseAscii( p->pName ) ) ) + { + bFound = TRUE; break; + } + nIndex += ( p->nArgs & _ARGSMASK ) + 1; + p = aMethods + nIndex; + } + if( bFound ) + { + // Args-Felder isolieren: + short nAccess = ( p->nArgs & _RWMASK ) >> 8; + short nType = ( p->nArgs & _TYPEMASK ); + if( p->nArgs & _CONST ) + nAccess |= SBX_CONST; + String aName = String::CreateFromAscii( p->pName ); + SbxClassType eCT = SbxCLASS_OBJECT; + if( nType & _PROPERTY ) + eCT = SbxCLASS_PROPERTY; + else if( nType & _METHOD ) + eCT = SbxCLASS_METHOD; + pVar = Make( aName, eCT, p->eType ); + pVar->SetUserData( nIndex + 1 ); + pVar->SetFlags( nAccess ); + } + } + return pVar; +} + +// SetModified muß bei der RTL abgklemmt werden +void SbiStdObject::SetModified( BOOL ) +{ +} + +// Aufruf einer Property oder Methode. + +void SbiStdObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ) + +{ + const SbxHint* pHint = PTR_CAST(SbxHint,&rHint); + if( pHint ) + { + SbxVariable* pVar = pHint->GetVar(); + SbxArray* pPar = pVar->GetParameters(); + ULONG t = pHint->GetId(); + USHORT nCallId = (USHORT) pVar->GetUserData(); + if( nCallId ) + { + if( t == SBX_HINT_INFOWANTED ) + pVar->SetInfo( GetInfo( (short) pVar->GetUserData() ) ); + else + { + BOOL bWrite = FALSE; + if( t == SBX_HINT_DATACHANGED ) + bWrite = TRUE; + if( t == SBX_HINT_DATAWANTED || bWrite ) + { + RtlCall p = (RtlCall) aMethods[ nCallId-1 ].pFunc; + SbxArrayRef rPar( pPar ); + if( !pPar ) + { + rPar = pPar = new SbxArray; + pPar->Put( pVar, 0 ); + } + p( (StarBASIC*) GetParent(), *pPar, bWrite ); + return; + } + } + } + SbxObject::SFX_NOTIFY( rBC, rBCType, rHint, rHintType ); + } +} + +// Zusammenbau der Infostruktur fuer einzelne Elemente +// Falls nIdx = 0, nix erzeugen (sind Std-Props!) + +SbxInfo* SbiStdObject::GetInfo( short nIdx ) +{ + if( !nIdx ) + return NULL; + Methods* p = &aMethods[ --nIdx ]; + // Wenn mal eine Hilfedatei zur Verfuegung steht: + // SbxInfo* pInfo = new SbxInfo( Hilfedateiname, p->nHelpId ); + SbxInfo* pInfo = new SbxInfo; + short nPar = p->nArgs & _ARGSMASK; + for( short i = 0; i < nPar; i++ ) + { + p++; + String aName = String::CreateFromAscii( p->pName ); + USHORT nFlags = ( p->nArgs >> 8 ) & 0x03; + if( p->nArgs & _OPT ) + nFlags |= SBX_OPTIONAL; + pInfo->AddParam( aName, p->eType, nFlags ); + } + return pInfo; +} + diff --git a/basic/source/runtime/stdobj1.cxx b/basic/source/runtime/stdobj1.cxx new file mode 100644 index 000000000000..e72786422d9b --- /dev/null +++ b/basic/source/runtime/stdobj1.cxx @@ -0,0 +1,547 @@ +/************************************************************************* + * + * $RCSfile: stdobj1.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SV_WRKWIN_HXX //autogen +#include <vcl/wrkwin.hxx> +#endif +#ifndef _SV_SVAPP_HXX //autogen +#include <vcl/svapp.hxx> +#endif +#ifndef _SV_CLIP_HXX //autogen +#include <vcl/clip.hxx> +#endif +#ifndef _SBXCLASS_HXX //autogen +#include <svtools/sbx.hxx> +#endif +#include "runtime.hxx" +#pragma hdrstop +#include "stdobj1.hxx" + +#include "segmentc.hxx" +//#pragma SW_SEGMENT_CLASS( SBRUNTIME, SBRUNTIME_CODE ) + +#define ATTR_IMP_TYPE 1 +#define ATTR_IMP_WIDTH 2 +#define ATTR_IMP_HEIGHT 3 +#define ATTR_IMP_BOLD 4 +#define ATTR_IMP_ITALIC 5 +#define ATTR_IMP_STRIKETHROUGH 6 +#define ATTR_IMP_UNDERLINE 7 +#define ATTR_IMP_WEIGHT 8 +#define ATTR_IMP_SIZE 9 +#define ATTR_IMP_NAME 10 + +#define METH_CLEAR 20 +#define METH_GETDATA 21 +#define METH_GETFORMAT 22 +#define METH_GETTEXT 23 +#define METH_SETDATA 24 +#define METH_SETTEXT 25 + +//------------------------------------------------------------------------------ +SbStdFactory::SbStdFactory() +{ +} + +SbxObject* SbStdFactory::CreateObject( const String& rClassName ) +{ + if( rClassName.EqualsIgnoreCaseAscii( String( RTL_CONSTASCII_USTRINGPARAM("Picture") ) ) ) + return new SbStdPicture; + else + if( rClassName.EqualsIgnoreCaseAscii( String( RTL_CONSTASCII_USTRINGPARAM("Font") ) ) ) + return new SbStdFont; + else + return NULL; +} + +//------------------------------------------------------------------------------ + + + +void SbStdPicture::PropType( SbxVariable* pVar, SbxArray*, BOOL bWrite ) +{ + if( bWrite ) + { + StarBASIC::Error( SbERR_PROP_READONLY ); + return; + } + + GraphicType eType = aGraphic.GetType(); + INT16 nType = 0; + + if( eType == GRAPHIC_BITMAP ) + nType = 1; + else + if( eType != GRAPHIC_NONE ) + nType = 2; + + pVar->PutInteger( nType ); +} + + +void SbStdPicture::PropWidth( SbxVariable* pVar, SbxArray*, BOOL bWrite ) +{ + if( bWrite ) + { + StarBASIC::Error( SbERR_PROP_READONLY ); + return; + } + + Size aSize = aGraphic.GetPrefSize(); + aSize = GetpApp()->GetAppWindow()->LogicToPixel( aSize, aGraphic.GetPrefMapMode() ); + aSize = GetpApp()->GetAppWindow()->PixelToLogic( aSize, MapMode( MAP_TWIP ) ); + + pVar->PutInteger( (INT16)aSize.Width() ); +} + +void SbStdPicture::PropHeight( SbxVariable* pVar, SbxArray*, BOOL bWrite ) +{ + if( bWrite ) + { + StarBASIC::Error( SbERR_PROP_READONLY ); + return; + } + + Size aSize = aGraphic.GetPrefSize(); + aSize = GetpApp()->GetAppWindow()->LogicToPixel( aSize, aGraphic.GetPrefMapMode() ); + aSize = GetpApp()->GetAppWindow()->PixelToLogic( aSize, MapMode( MAP_TWIP ) ); + + pVar->PutInteger( (INT16)aSize.Height() ); +} + + +TYPEINIT1( SbStdPicture, SbxObject ); + +SbStdPicture::SbStdPicture() : + SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("Picture") ) ) +{ + // Properties + SbxVariable* p = Make( String( RTL_CONSTASCII_USTRINGPARAM("Type") ), SbxCLASS_PROPERTY, SbxVARIANT ); + p->SetFlags( SBX_READ | SBX_DONTSTORE ); + p->SetUserData( ATTR_IMP_TYPE ); + p = Make( String( RTL_CONSTASCII_USTRINGPARAM("Width") ), SbxCLASS_PROPERTY, SbxVARIANT ); + p->SetFlags( SBX_READ | SBX_DONTSTORE ); + p->SetUserData( ATTR_IMP_WIDTH ); + p = Make( String( RTL_CONSTASCII_USTRINGPARAM("Height") ), SbxCLASS_PROPERTY, SbxVARIANT ); + p->SetFlags( SBX_READ | SBX_DONTSTORE ); + p->SetUserData( ATTR_IMP_HEIGHT ); +} + +SbStdPicture::~SbStdPicture() +{ +} + + +SbxVariable* SbStdPicture::Find( const String& rName, SbxClassType t ) +{ + // Bereits eingetragen? + return SbxObject::Find( rName, t ); +} + + + +void SbStdPicture::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ) + +{ + const SbxHint* pHint = PTR_CAST( SbxHint, &rHint ); + + if( pHint ) + { + if( pHint->GetId() == SBX_HINT_INFOWANTED ) + { + SbxObject::SFX_NOTIFY( rBC, rBCType, rHint, rHintType ); + return; + } + + SbxVariable* pVar = pHint->GetVar(); + SbxArray* pPar = pVar->GetParameters(); + USHORT nWhich = (USHORT)pVar->GetUserData(); + BOOL bWrite = pHint->GetId() == SBX_HINT_DATACHANGED; + + // Propteries + switch( nWhich ) + { + case ATTR_IMP_TYPE: PropType( pVar, pPar, bWrite ); return; + case ATTR_IMP_WIDTH: PropWidth( pVar, pPar, bWrite ); return; + case ATTR_IMP_HEIGHT: PropHeight( pVar, pPar, bWrite ); return; + } + + SbxObject::SFX_NOTIFY( rBC, rBCType, rHint, rHintType ); + } +} + +//----------------------------------------------------------------------------- + +void SbStdFont::PropBold( SbxVariable* pVar, SbxArray*, BOOL bWrite ) +{ + if( bWrite ) + SetBold( pVar->GetBool() ); + else + pVar->PutBool( IsBold() ); +} + +void SbStdFont::PropItalic( SbxVariable* pVar, SbxArray*, BOOL bWrite ) +{ + if( bWrite ) + SetItalic( pVar->GetBool() ); + else + pVar->PutBool( IsItalic() ); +} + +void SbStdFont::PropStrikeThrough( SbxVariable* pVar, SbxArray*, BOOL bWrite ) +{ + if( bWrite ) + SetStrikeThrough( pVar->GetBool() ); + else + pVar->PutBool( IsStrikeThrough() ); +} + +void SbStdFont::PropUnderline( SbxVariable* pVar, SbxArray*, BOOL bWrite ) +{ + if( bWrite ) + SetUnderline( pVar->GetBool() ); + else + pVar->PutBool( IsUnderline() ); +} + +void SbStdFont::PropSize( SbxVariable* pVar, SbxArray*, BOOL bWrite ) +{ + if( bWrite ) + SetSize( (USHORT)pVar->GetInteger() ); + else + pVar->PutInteger( (INT16)GetSize() ); +} + +void SbStdFont::PropName( SbxVariable* pVar, SbxArray*, BOOL bWrite ) +{ + if( bWrite ) + SetFontName( pVar->GetString() ); + else + pVar->PutString( GetFontName() ); +} + + +TYPEINIT1( SbStdFont, SbxObject ); + +SbStdFont::SbStdFont() : + SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("Font") ) ) +{ + // Properties + SbxVariable* p = Make( String( RTL_CONSTASCII_USTRINGPARAM("Bold") ), SbxCLASS_PROPERTY, SbxVARIANT ); + p->SetFlags( SBX_READWRITE | SBX_DONTSTORE ); + p->SetUserData( ATTR_IMP_BOLD ); + p = Make( String( RTL_CONSTASCII_USTRINGPARAM("Italic") ), SbxCLASS_PROPERTY, SbxVARIANT ); + p->SetFlags( SBX_READWRITE | SBX_DONTSTORE ); + p->SetUserData( ATTR_IMP_ITALIC ); + p = Make( String( RTL_CONSTASCII_USTRINGPARAM("StrikeThrough") ), SbxCLASS_PROPERTY, SbxVARIANT ); + p->SetFlags( SBX_READWRITE | SBX_DONTSTORE ); + p->SetUserData( ATTR_IMP_STRIKETHROUGH ); + p = Make( String( RTL_CONSTASCII_USTRINGPARAM("Underline") ), SbxCLASS_PROPERTY, SbxVARIANT ); + p->SetFlags( SBX_READWRITE | SBX_DONTSTORE ); + p->SetUserData( ATTR_IMP_UNDERLINE ); + p = Make( String( RTL_CONSTASCII_USTRINGPARAM("Size") ), SbxCLASS_PROPERTY, SbxVARIANT ); + p->SetFlags( SBX_READWRITE | SBX_DONTSTORE ); + p->SetUserData( ATTR_IMP_SIZE ); + + // Name Property selbst verarbeiten + p = Find( String( RTL_CONSTASCII_USTRINGPARAM("Name") ), SbxCLASS_PROPERTY ); + DBG_ASSERT( p, "Keine Name Property" ); + p->SetUserData( ATTR_IMP_NAME ); +} + +SbStdFont::~SbStdFont() +{ +} + + +SbxVariable* SbStdFont::Find( const String& rName, SbxClassType t ) +{ + // Bereits eingetragen? + return SbxObject::Find( rName, t ); +} + + + +void SbStdFont::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ) +{ + const SbxHint* pHint = PTR_CAST( SbxHint, &rHint ); + + if( pHint ) + { + if( pHint->GetId() == SBX_HINT_INFOWANTED ) + { + SbxObject::SFX_NOTIFY( rBC, rBCType, rHint, rHintType ); + return; + } + + SbxVariable* pVar = pHint->GetVar(); + SbxArray* pPar = pVar->GetParameters(); + USHORT nWhich = (USHORT)pVar->GetUserData(); + BOOL bWrite = pHint->GetId() == SBX_HINT_DATACHANGED; + + // Propteries + switch( nWhich ) + { + case ATTR_IMP_BOLD: PropBold( pVar, pPar, bWrite ); return; + case ATTR_IMP_ITALIC: PropItalic( pVar, pPar, bWrite ); return; + case ATTR_IMP_STRIKETHROUGH:PropStrikeThrough( pVar, pPar, bWrite ); return; + case ATTR_IMP_UNDERLINE: PropUnderline( pVar, pPar, bWrite ); return; + case ATTR_IMP_SIZE: PropSize( pVar, pPar, bWrite ); return; + case ATTR_IMP_NAME: PropName( pVar, pPar, bWrite ); return; + } + + SbxObject::SFX_NOTIFY( rBC, rBCType, rHint, rHintType ); + } +} + + +//----------------------------------------------------------------------------- +void SbStdClipboard::MethClear( SbxVariable*, SbxArray* pPar, BOOL ) +{ + if( pPar && (pPar->Count() > 1) ) + { + StarBASIC::Error( SbERR_BAD_NUMBER_OF_ARGS ); + return; + } + + Clipboard::Clear(); +} + +void SbStdClipboard::MethGetData( SbxVariable* pVar, SbxArray* pPar, BOOL ) +{ + if( !pPar || (pPar->Count() != 2) ) + { + StarBASIC::Error( SbERR_BAD_NUMBER_OF_ARGS ); + return; + } + + USHORT nFormat = pPar->Get(1)->GetInteger(); + if( !nFormat || nFormat > 3 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + if( nFormat == FORMAT_STRING ) + pVar->PutString( Clipboard::PasteString() ); + else + if( (nFormat == FORMAT_BITMAP) || + (nFormat == FORMAT_GDIMETAFILE ) ) + { + SbxObjectRef xPic = new SbStdPicture; + Graphic aGraph; + aGraph.Paste(); + ((SbStdPicture*)(SbxObject*)xPic)->SetGraphic( aGraph ); + pVar->PutObject( xPic ); + } +} + +void SbStdClipboard::MethGetFormat( SbxVariable* pVar, SbxArray* pPar, BOOL ) +{ + if( !pPar || (pPar->Count() != 2) ) + { + StarBASIC::Error( SbERR_BAD_NUMBER_OF_ARGS ); + return; + } + + USHORT nFormat = pPar->Get(1)->GetInteger(); + if( !nFormat || nFormat > 3 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + pVar->PutBool( Clipboard::HasFormat( nFormat ) ); +} + +void SbStdClipboard::MethGetText( SbxVariable* pVar, SbxArray* pPar, BOOL ) +{ + if( pPar && (pPar->Count() > 1) ) + { + StarBASIC::Error( SbERR_BAD_NUMBER_OF_ARGS ); + return; + } + + pVar->PutString( Clipboard::PasteString() ); +} + +void SbStdClipboard::MethSetData( SbxVariable* pVar, SbxArray* pPar, BOOL ) +{ + if( !pPar || (pPar->Count() != 3) ) + { + StarBASIC::Error( SbERR_BAD_NUMBER_OF_ARGS ); + return; + } + + USHORT nFormat = pPar->Get(2)->GetInteger(); + if( !nFormat || nFormat > 3 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + if( nFormat == FORMAT_STRING ) + { + Clipboard::CopyString( pPar->Get(1)->GetString() ); + } + else + if( (nFormat == FORMAT_BITMAP) || + (nFormat == FORMAT_GDIMETAFILE) ) + { + SbxObject* pObj = (SbxObject*)pPar->Get(1)->GetObject(); + + if( pObj && pObj->IsA( TYPE( SbStdPicture ) ) ) + ((SbStdPicture*)(SbxObject*)pObj)->GetGraphic().Copy(); + } +} + +void SbStdClipboard::MethSetText( SbxVariable* pVar, SbxArray* pPar, BOOL ) +{ + if( !pPar || (pPar->Count() != 2) ) + { + StarBASIC::Error( SbERR_BAD_NUMBER_OF_ARGS ); + return; + } + + Clipboard::CopyString( pPar->Get(1)->GetString() ); +} + + +TYPEINIT1( SbStdClipboard, SbxObject ); + +SbStdClipboard::SbStdClipboard() : + SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("Clipboard") ) ) +{ + // Name Property selbst verarbeiten + SbxVariable* p = Find( String( RTL_CONSTASCII_USTRINGPARAM("Name") ), SbxCLASS_PROPERTY ); + DBG_ASSERT( p, "Keine Name Property" ); + p->SetUserData( ATTR_IMP_NAME ); + + //Methoden registrieren + p = Make( String( RTL_CONSTASCII_USTRINGPARAM("Clear") ), SbxCLASS_METHOD, SbxEMPTY ); + p->SetFlag( SBX_DONTSTORE ); + p->SetUserData( METH_CLEAR ); + p = Make( String( RTL_CONSTASCII_USTRINGPARAM("GetData") ), SbxCLASS_METHOD, SbxEMPTY ); + p->SetFlag( SBX_DONTSTORE ); + p->SetUserData( METH_GETDATA ); + p = Make( String( RTL_CONSTASCII_USTRINGPARAM("GetFormat") ), SbxCLASS_METHOD, SbxEMPTY ); + p->SetFlag( SBX_DONTSTORE ); + p->SetUserData( METH_GETFORMAT ); + p = Make( String( RTL_CONSTASCII_USTRINGPARAM("GetText") ), SbxCLASS_METHOD, SbxEMPTY ); + p->SetFlag( SBX_DONTSTORE ); + p->SetUserData( METH_GETTEXT ); + p = Make( String( RTL_CONSTASCII_USTRINGPARAM("SetData") ), SbxCLASS_METHOD, SbxEMPTY ); + p->SetFlag( SBX_DONTSTORE ); + p->SetUserData( METH_SETDATA ); + p = Make( String( RTL_CONSTASCII_USTRINGPARAM("SetText") ), SbxCLASS_METHOD, SbxEMPTY ); + p->SetFlag( SBX_DONTSTORE ); + p->SetUserData( METH_SETTEXT ); +} + +SbStdClipboard::~SbStdClipboard() +{ +} + + +SbxVariable* SbStdClipboard::Find( const String& rName, SbxClassType t ) +{ + // Bereits eingetragen? + return SbxObject::Find( rName, t ); +} + + + +void SbStdClipboard::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ) +{ + const SbxHint* pHint = PTR_CAST( SbxHint, &rHint ); + + if( pHint ) + { + if( pHint->GetId() == SBX_HINT_INFOWANTED ) + { + SbxObject::SFX_NOTIFY( rBC, rBCType, rHint, rHintType ); + return; + } + + SbxVariable* pVar = pHint->GetVar(); + SbxArray* pPar = pVar->GetParameters(); + USHORT nWhich = (USHORT)pVar->GetUserData(); + BOOL bWrite = pHint->GetId() == SBX_HINT_DATACHANGED; + + // Methods + switch( nWhich ) + { + case METH_CLEAR: MethClear( pVar, pPar, bWrite ); return; + case METH_GETDATA: MethGetData( pVar, pPar, bWrite ); return; + case METH_GETFORMAT: MethGetFormat( pVar, pPar, bWrite ); return; + case METH_GETTEXT: MethGetText( pVar, pPar, bWrite ); return; + case METH_SETDATA: MethSetData( pVar, pPar, bWrite ); return; + case METH_SETTEXT: MethSetText( pVar, pPar, bWrite ); return; + } + + SbxObject::SFX_NOTIFY( rBC, rBCType, rHint, rHintType ); + } +} + + diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx new file mode 100644 index 000000000000..2b848e97a2d4 --- /dev/null +++ b/basic/source/runtime/step0.cxx @@ -0,0 +1,799 @@ +/************************************************************************* + * + * $RCSfile: step0.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SV_MSGBOX_HXX //autogen +#include <vcl/msgbox.hxx> +#endif +#ifndef _FSYS_HXX //autogen +#include <tools/fsys.hxx> +#endif + +#include <svtools/sbx.hxx> +#include "runtime.hxx" +#pragma hdrstop +#include "sbintern.hxx" +#include "iosys.hxx" +#include <sb.hrc> +#include <basrid.hxx> +#include "sbunoobj.hxx" +#include <com/sun/star/uno/Any.hxx> + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBRUNTIME, SBRUNTIME_CODE ) + +void SbiRuntime::StepNOP() +{} + +void SbiRuntime::StepArith( SbxOperator eOp ) +{ + SbxVariableRef p1 = PopVar(); + TOSMakeTemp(); + SbxVariable* p2 = GetTOS(); + p2->ResetFlag( SBX_FIXED ); + p2->Compute( eOp, *p1 ); +} + +void SbiRuntime::StepUnary( SbxOperator eOp ) +{ + TOSMakeTemp(); + SbxVariable* p = GetTOS(); + p->Compute( eOp, *p ); +} + +void SbiRuntime::StepCompare( SbxOperator eOp ) +{ + SbxVariableRef p1 = PopVar(); + SbxVariableRef p2 = PopVar(); +#ifndef WIN + static SbxVariable* pTRUE = NULL; + static SbxVariable* pFALSE = NULL; + + if( p2->Compare( eOp, *p1 ) ) + { + if( !pTRUE ) + { + pTRUE = new SbxVariable; + pTRUE->PutBool( TRUE ); + pTRUE->AddRef(); + } + PushVar( pTRUE ); + } + else + { + if( !pFALSE ) + { + pFALSE = new SbxVariable; + pFALSE->PutBool( FALSE ); + pFALSE->AddRef(); + } + PushVar( pFALSE ); + } +#else + BOOL bRes = p2->Compare( eOp, *p1 ); + SbxVariable* pRes = new SbxVariable; + pRes->PutBool( bRes ); + PushVar( pRes ); +#endif +} + +void SbiRuntime::StepEXP() { StepArith( SbxEXP ); } +void SbiRuntime::StepMUL() { StepArith( SbxMUL ); } +void SbiRuntime::StepDIV() { StepArith( SbxDIV ); } +void SbiRuntime::StepIDIV() { StepArith( SbxIDIV ); } +void SbiRuntime::StepMOD() { StepArith( SbxMOD ); } +void SbiRuntime::StepPLUS() { StepArith( SbxPLUS ); } +void SbiRuntime::StepMINUS() { StepArith( SbxMINUS ); } +void SbiRuntime::StepCAT() { StepArith( SbxCAT ); } +void SbiRuntime::StepAND() { StepArith( SbxAND ); } +void SbiRuntime::StepOR() { StepArith( SbxOR ); } +void SbiRuntime::StepXOR() { StepArith( SbxXOR ); } +void SbiRuntime::StepEQV() { StepArith( SbxEQV ); } +void SbiRuntime::StepIMP() { StepArith( SbxIMP ); } + +void SbiRuntime::StepNEG() { StepUnary( SbxNEG ); } +void SbiRuntime::StepNOT() { StepUnary( SbxNOT ); } + +void SbiRuntime::StepEQ() { StepCompare( SbxEQ ); } +void SbiRuntime::StepNE() { StepCompare( SbxNE ); } +void SbiRuntime::StepLT() { StepCompare( SbxLT ); } +void SbiRuntime::StepGT() { StepCompare( SbxGT ); } +void SbiRuntime::StepLE() { StepCompare( SbxLE ); } +void SbiRuntime::StepGE() { StepCompare( SbxGE ); } + +void SbiRuntime::StepLIKE() +{ + StarBASIC::FatalError( SbERR_NOT_IMPLEMENTED ); +} + +// TOS und TOS-1 sind beides Objektvariable und enthalten den selben Pointer + +void SbiRuntime::StepIS() +{ + SbxVariableRef refVar1 = PopVar(); + SbxVariableRef refVar2 = PopVar(); + BOOL bRes = BOOL( + refVar1->GetType() == SbxOBJECT + && refVar2->GetType() == SbxOBJECT + && refVar1->GetObject() == refVar2->GetObject() ); + SbxVariable* pRes = new SbxVariable; + pRes->PutBool( bRes ); + PushVar( pRes ); +} + +// Aktualisieren des Wertes von TOS + +void SbiRuntime::StepGET() +{ + SbxVariable* p = GetTOS(); + p->Broadcast( SBX_HINT_DATAWANTED ); +} + +// #67607 Uno-Structs kopieren +inline void checkUnoStructCopy( SbxVariableRef& refVal, SbxVariableRef& refVar ) +{ + SbxDataType eVarType = refVar->GetType(); + if( eVarType == SbxOBJECT ) + { + SbxObjectRef xVarObj = (SbxObject*)refVar->GetObject(); + SbxDataType eValType = refVal->GetType(); + if( eValType == SbxOBJECT && xVarObj == refVal->GetObject() ) + { + SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,(SbxObject*)xVarObj); + if( pUnoObj ) + { + Any aAny = pUnoObj->getUnoAny(); + if( aAny.getValueType().getTypeClass() == TypeClass_STRUCT ) + { + SbUnoObject* pNewUnoObj = new SbUnoObject( pUnoObj->GetName(), aAny ); + // #70324: ClassName uebernehmen + pNewUnoObj->SetClassName( pUnoObj->GetClassName() ); + refVar->PutObject( pNewUnoObj ); + } + } + } + } +} + +// Ablage von TOS in TOS-1 + +void SbiRuntime::StepPUT() +{ + SbxVariableRef refVal = PopVar(); + SbxVariableRef refVar = PopVar(); + // Store auf die eigene Methode (innerhalb einer Function)? + BOOL bFlagsChanged = FALSE; + USHORT n; + if( (SbxVariable*) refVar == (SbxVariable*) pMeth ) + { + bFlagsChanged = TRUE; + n = refVar->GetFlags(); + refVar->SetFlag( SBX_WRITE ); + } + *refVar = *refVal; + // #67607 Uno-Structs kopieren + checkUnoStructCopy( refVal, refVar ); + if( bFlagsChanged ) + refVar->SetFlags( n ); +} + + +// Speichern Objektvariable +// Nicht-Objekt-Variable fuehren zu Fehlern + +void SbiRuntime::StepSET() +{ + SbxVariableRef refVal = PopVar(); + SbxVariableRef refVar = PopVar(); + // #67733 Typen mit Array-Flag sind auch ok + SbxDataType eValType = refVal->GetType(); + SbxDataType eVarType = refVar->GetType(); + if( (eValType != SbxOBJECT && eValType != SbxEMPTY && !(eValType & SbxARRAY)) || + (eVarType != SbxOBJECT && !(eVarType & SbxARRAY) ) ) + { + Error( SbERR_INVALID_USAGE_OBJECT ); + } + else + { + // Auf refVal GetObject fuer Collections ausloesen + SbxBase* pObjVarObj = refVal->GetObject(); + if( pObjVarObj ) + { + SbxVariableRef refObjVal = PTR_CAST(SbxObject,pObjVarObj); + + // #67733 Typen mit Array-Flag sind auch ok + if( refObjVal ) + refVal = refObjVal; + else if( !(eValType & SbxARRAY) ) + refVal = NULL; + } + + // #52896 Wenn Uno-Sequences bzw. allgemein Arrays einer als + // Object deklarierten Variable zugewiesen werden, kann hier + // refVal ungueltig sein! + if( !refVal ) + { + Error( SbERR_INVALID_USAGE_OBJECT ); + } + else + { + // Store auf die eigene Methode (innerhalb einer Function)? + BOOL bFlagsChanged = FALSE; + USHORT n; + if( (SbxVariable*) refVar == (SbxVariable*) pMeth ) + { + bFlagsChanged = TRUE; + n = refVar->GetFlags(); + refVar->SetFlag( SBX_WRITE ); + } + *refVar = *refVal; + // #67607 Uno-Structs kopieren + checkUnoStructCopy( refVal, refVar ); + if( bFlagsChanged ) + refVar->SetFlags( n ); + } + } +} + +// JSM 07.10.95 +void SbiRuntime::StepLSET() +{ + SbxVariableRef refVal = PopVar(); + SbxVariableRef refVar = PopVar(); + if( refVar->GetType() != SbxSTRING + || refVal->GetType() != SbxSTRING ) + Error( SbERR_INVALID_USAGE_OBJECT ); + else + { + // Store auf die eigene Methode (innerhalb einer Function)? + USHORT n = refVar->GetFlags(); + if( (SbxVariable*) refVar == (SbxVariable*) pMeth ) + refVar->SetFlag( SBX_WRITE ); + String aRefVarString = refVar->GetString(); + String aRefValString = refVal->GetString(); + + if (aRefVarString.Len() > aRefValString.Len()) + aRefVarString.Fill(aRefVarString.Len(),' '); + aRefVarString = aRefValString.Copy( 0, aRefVarString.Len() ); + aRefVarString += aRefVarString.Copy( aRefValString.Len() ); + refVar->PutString(aRefVarString); + + refVar->SetFlags( n ); + } +} + +// JSM 07.10.95 +void SbiRuntime::StepRSET() +{ + SbxVariableRef refVal = PopVar(); + SbxVariableRef refVar = PopVar(); + if( refVar->GetType() != SbxSTRING + || refVal->GetType() != SbxSTRING ) + Error( SbERR_INVALID_USAGE_OBJECT ); + else + { + // Store auf die eigene Methode (innerhalb einer Function)? + USHORT n = refVar->GetFlags(); + if( (SbxVariable*) refVar == (SbxVariable*) pMeth ) + refVar->SetFlag( SBX_WRITE ); + String aRefVarString = refVar->GetString(); + String aRefValString = refVal->GetString(); + + USHORT nPos = 0; + if (aRefVarString.Len() > aRefValString.Len()) + { + aRefVarString.Fill(aRefVarString.Len(),' '); + nPos = aRefVarString.Len() - aRefValString.Len(); + } + aRefVarString = aRefVarString.Copy( 0, nPos ); + aRefVarString += aRefValString.Copy( 0, aRefVarString.Len() - nPos ); + refVar->PutString(aRefVarString); + + refVar->SetFlags( n ); + } +} + +// Ablage von TOS in TOS-1, dann ReadOnly-Bit setzen + +void SbiRuntime::StepPUTC() +{ + SbxVariableRef refVal = PopVar(); + SbxVariableRef refVar = PopVar(); + refVar->SetFlag( SBX_WRITE ); + *refVar = *refVal; + refVar->ResetFlag( SBX_WRITE ); + refVar->SetFlag( SBX_CONST ); +} + +// DIM +// TOS = Variable fuer das Array mit Dimensionsangaben als Parameter + +void SbiRuntime::StepDIM() +{ + SbxVariableRef refVar = PopVar(); + DimImpl( refVar ); +} + +// #56204 DIM-Funktionalitaet in Hilfsmethode auslagern (step0.cxx) +void SbiRuntime::DimImpl( SbxVariableRef refVar ) +{ + SbxArray* pDims = refVar->GetParameters(); + // Muss eine gerade Anzahl Argumente haben + // Man denke daran, dass Arg[0] nicht zaehlt! + if( pDims && !( pDims->Count() & 1 ) ) + StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); + else + { + SbxDataType eType = refVar->IsFixed() ? refVar->GetType() : SbxVARIANT; + SbxDimArray* pArray = new SbxDimArray( eType ); + // AB 2.4.1996, auch Arrays ohne Dimensionsangaben zulassen (VB-komp.) + if( pDims ) + { + for( USHORT i = 1; i < pDims->Count(); ) + { + INT16 lb = pDims->Get( i++ )->GetInteger(); + INT16 ub = pDims->Get( i++ )->GetInteger(); + if( ub < lb ) + Error( SbERR_OUT_OF_RANGE ), ub = lb; + pArray->AddDim( lb, ub ); + } + } + else + { + // #62867 Beim Anlegen eines Arrays der Laenge 0 wie bei + // Uno-Sequences der Laenge 0 eine Dimension anlegen + pArray->unoAddDim( 0, -1 ); + } + USHORT nFlags = refVar->GetFlags(); + refVar->ResetFlag( SBX_FIXED ); + refVar->PutObject( pArray ); + refVar->SetFlags( nFlags ); + refVar->SetParameters( NULL ); + } +} + + +// REDIM +// TOS = Variable fuer das Array +// argv = Dimensionsangaben + +void SbiRuntime::StepREDIM() +{ + // Im Moment ist es nichts anderes als Dim, da doppeltes Dim + // bereits vom Compiler erkannt wird. + StepDIM(); +} + +// REDIM PRESERVE +// TOS = Variable fuer das Array +// argv = Dimensionsangaben + +void SbiRuntime::StepREDIMP() +{ + StarBASIC::FatalError( SbERR_NOT_IMPLEMENTED ); +} + +// Variable loeschen +// TOS = Variable + +void SbiRuntime::StepERASE() +{ + SbxVariableRef refVar = PopVar(); + SbxDataType eType = refVar->GetType(); + if( eType & SbxARRAY ) + { + // AB 2.4.1996 + // Arrays haben bei Erase nach VB ein recht komplexes Verhalten. Hier + // werden zunaechst nur die Typ-Probleme bei REDIM (#26295) beseitigt: + // Typ hart auf den Array-Typ setzen, da eine Variable mit Array + // SbxOBJECT ist. Bei REDIM entsteht dann ein SbxOBJECT-Array und + // der ursruengliche Typ geht verloren -> Laufzeitfehler + USHORT nFlags = refVar->GetFlags(); + refVar->ResetFlag( SBX_FIXED ); + refVar->SetType( SbxDataType(eType & 0x0FFF) ); + refVar->SetFlags( nFlags ); + refVar->Clear(); + } + else + if( refVar->IsFixed() ) + refVar->Clear(); + else + refVar->SetType( SbxEMPTY ); +} + +// Einrichten eines Argvs +// nOp1 bleibt so -> 1. Element ist Returnwert + +void SbiRuntime::StepARGC() +{ + PushArgv(); + refArgv = new SbxArray; + nArgc = 1; +} + +// Speichern eines Arguments in Argv + +void SbiRuntime::StepARGV() +{ + if( !refArgv ) + StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); + else + { + SbxVariableRef pVal = PopVar(); + if( pVal->ISA(SbxMethod) || pVal->ISA(SbxProperty) ) + { + // Methoden und Properties evaluieren! + SbxVariable* pRes = new SbxVariable( *pVal ); + pVal = pRes; + } + refArgv->Put( pVal, nArgc++ ); + } +} + +// Input to Variable. Die Variable ist auf TOS und wird +// anschliessend entfernt. + +void SbiRuntime::StepINPUT() +{ + String s; + char ch; + SbError err; + // Skip whitespace + while( ( err = pIosys->GetError() ) == 0 ) + { + ch = pIosys->Read(); + if( ch != ' ' && ch != '\t' && ch != '\n' ) + break; + } + if( !err ) + { + // Scan until comma or whitespace + char sep = ( ch == '"' ) ? ch : 0; + if( sep ) ch = pIosys->Read(); + while( ( err = pIosys->GetError() ) == 0 ) + { + if( ch == sep ) + { + ch = pIosys->Read(); + if( ch != sep ) + break; + } + else if( !sep && (ch == ',' || ch == '\n') ) + break; + s += ch; + ch = pIosys->Read(); + } + // skip whitespace + if( ch == ' ' || ch == '\t' ) + while( ( err = pIosys->GetError() ) == 0 ) + { + if( ch != ' ' && ch != '\t' && ch != '\n' ) + break; + ch = pIosys->Read(); + } + } + if( !err ) + { + SbxVariableRef pVar = GetTOS(); + // Zuerst versuchen, die Variable mit einem numerischen Wert + // zu fuellen, dann mit einem Stringwert + BOOL bSet = FALSE; + if( !pVar->IsFixed() || pVar->IsNumeric() ) + { + USHORT nLen = 0; + if( !pVar->Scan( s, &nLen ) ) + { + err = SbxBase::GetError(); + SbxBase::ResetError(); + } + // Der Wert muss komplett eingescant werden + else if( nLen != s.Len() && !pVar->PutString( s ) ) + { + err = SbxBase::GetError(); + SbxBase::ResetError(); + } + else if( nLen != s.Len() && pVar->IsNumeric() ) + { + err = SbxBase::GetError(); + SbxBase::ResetError(); + if( !err ) + err = SbERR_CONVERSION; + } + } + else + { + pVar->PutString( s ); + err = SbxBase::GetError(); + SbxBase::ResetError(); + } + } + if( err == SbERR_USER_ABORT ) + Error( err ); + else if( err ) + { + if( pRestart && !pIosys->GetChannel() ) + { + BasicResId aId( IDS_SBERR_START + 4 ); + String aMsg( aId ); + ErrorBox( NULL, WB_OK, aMsg ).Execute(); + pCode = pRestart; + } + else + Error( err ); + } + else + { + // pIosys->ResetChannel(); + PopVar(); + } +} + +// Line Input to Variable. Die Variable ist auf TOS und wird +// anschliessend entfernt. + +void SbiRuntime::StepLINPUT() +{ + ByteString aInput; + pIosys->Read( aInput ); + Error( pIosys->GetError() ); + SbxVariableRef p = PopVar(); + p->PutString( String( aInput, gsl_getSystemTextEncoding() ) ); + // pIosys->ResetChannel(); +} + +// Programmende + +void SbiRuntime::StepSTOP() +{ + pInst->Stop(); +} + +// FOR-Variable initialisieren + +void SbiRuntime::StepINITFOR() +{ + PushFor(); +} + +// FOR-Variable inkrementieren + +void SbiRuntime::StepNEXT() +{ + if( !pForStk ) + StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); + else + pForStk->refVar->Compute( SbxPLUS, *pForStk->refInc ); +} + +// Anfang CASE: TOS in CASE-Stack + +void SbiRuntime::StepCASE() +{ + if( !refCaseStk.Is() ) + refCaseStk = new SbxArray; + SbxVariableRef xVar = PopVar(); + refCaseStk->Put( xVar, refCaseStk->Count() ); +} + +// Ende CASE: Variable freigeben + +void SbiRuntime::StepENDCASE() +{ + if( !refCaseStk || !refCaseStk->Count() ) + StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); + else + refCaseStk->Remove( refCaseStk->Count() - 1 ); +} + +// Standard-Fehlerbehandlung + +void SbiRuntime::StepSTDERROR() +{ + pError = NULL; bError = TRUE; + pInst->aErrorMsg = String(); + pInst->nErr = 0L; + pInst->nErl = 0; + nError = 0L; +} + +void SbiRuntime::StepNOERROR() +{ + pInst->aErrorMsg = String(); + pInst->nErr = 0L; + pInst->nErl = 0; + nError = 0L; + bError = FALSE; +} + +// UP verlassen + +void SbiRuntime::StepLEAVE() +{ + bRun = FALSE; +} + +void SbiRuntime::StepCHANNEL() // TOS = Kanalnummer +{ + SbxVariableRef pChan = PopVar(); + short nChan = pChan->GetInteger(); + pIosys->SetChannel( nChan ); + Error( pIosys->GetError() ); +} + +void SbiRuntime::StepCHANNEL0() +{ + pIosys->ResetChannel(); +} + +void SbiRuntime::StepPRINT() // print TOS +{ + SbxVariableRef p = PopVar(); + String s1 = p->GetString(); + String s; + if( p->GetType() >= SbxINTEGER && p->GetType() <= SbxDOUBLE ) + s = ' '; // ein Blank davor + s += s1; + ByteString aByteStr( s, gsl_getSystemTextEncoding() ); + pIosys->Write( aByteStr ); + Error( pIosys->GetError() ); +} + +void SbiRuntime::StepPRINTF() // print TOS in field +{ + SbxVariableRef p = PopVar(); + String s1 = p->GetString(); + String s; + if( p->GetType() >= SbxINTEGER && p->GetType() <= SbxDOUBLE ) + s = ' '; // ein Blank davor + s += s1; + s.Expand( 14, ' ' ); + ByteString aByteStr( s, gsl_getSystemTextEncoding() ); + pIosys->Write( aByteStr ); + Error( pIosys->GetError() ); +} + +void SbiRuntime::StepWRITE() // write TOS +{ + SbxVariableRef p = PopVar(); + // Muss der String gekapselt werden? + char ch = 0; + switch (p->GetType() ) + { + case SbxSTRING: ch = '"'; break; + case SbxCURRENCY: + case SbxBOOL: + case SbxDATE: ch = '#'; break; + } + String s; + if( ch ) + s += ch; + s += p->GetString(); + if( ch ) + s += ch; + ByteString aByteStr( s, gsl_getSystemTextEncoding() ); + pIosys->Write( aByteStr ); + Error( pIosys->GetError() ); +} + +void SbiRuntime::StepRENAME() // Rename Tos+1 to Tos +{ + SbxVariableRef pTos1 = PopVar(); + SbxVariableRef pTos = PopVar(); + String aDest = pTos1->GetString(); + String aSource = pTos->GetString(); + + // <-- UCB + if( hasUno() ) + { + implStepRenameUCB( aSource, aDest ); + } + else + // --> UCB + { + DirEntry aSourceDirEntry( aSource ); + if( aSourceDirEntry.Exists() ) + { + if( aSourceDirEntry.MoveTo( DirEntry(aDest) ) != FSYS_ERR_OK ) + StarBASIC::Error( SbERR_PATH_NOT_FOUND ); + } + else + StarBASIC::Error( SbERR_PATH_NOT_FOUND ); + } +} + +// TOS = Prompt + +void SbiRuntime::StepPROMPT() +{ + SbxVariableRef p = PopVar(); + ByteString aStr( p->GetString(), gsl_getSystemTextEncoding() ); + pIosys->SetPrompt( aStr ); +} + +// Set Restart point + +void SbiRuntime::StepRESTART() +{ + pRestart = pCode; +} + +// Leerer Ausdruck auf Stack fuer fehlenden Parameter + +void SbiRuntime::StepEMPTY() +{ + // #57915 Die Semantik von StepEMPTY() ist die Repraesentation eines fehlenden + // Arguments. Dies wird in VB durch ein durch den Wert 448 (SbERR_NAMED_NOT_FOUND) + // vom Typ Error repraesentiert. StepEmpty jetzt muesste besser StepMISSING() + // heissen, aber der Name wird der Einfachkeit halber beibehalten. + SbxVariableRef xVar = new SbxVariable( SbxVARIANT ); + xVar->PutErr( 448 ); + PushVar( xVar ); + // ALT: PushVar( new SbxVariable( SbxEMPTY ) ); +} + +// TOS = Fehlercode + +void SbiRuntime::StepERROR() +{ + SbxVariableRef refCode = PopVar(); + ULONG n = refCode->GetLong(); + Error( n ); +} + diff --git a/basic/source/runtime/step1.cxx b/basic/source/runtime/step1.cxx new file mode 100644 index 000000000000..9196e5df0fa0 --- /dev/null +++ b/basic/source/runtime/step1.cxx @@ -0,0 +1,423 @@ +/************************************************************************* + * + * $RCSfile: step1.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <stdlib.h> +#include <svtools/sbx.hxx> +#ifndef _TOOLS_SOLMATH_HXX //autogen wg. SolarMath +#include <tools/solmath.hxx> +#endif +#ifndef _TOOLS_INTN_HXX //autogen wg. International +#include <tools/intn.hxx> +#endif +#include "runtime.hxx" +#pragma hdrstop +#include "sbintern.hxx" +#include "iosys.hxx" +#include "image.hxx" + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBRUNTIME, SBRUNTIME_CODE ) + +// Laden einer numerischen Konstanten (+ID) + +void SbiRuntime::StepLOADNC( USHORT nOp1 ) +{ + static International aEnglischIntn( LANGUAGE_ENGLISH_US, LANGUAGE_ENGLISH_US ); + + SbxVariable* p = new SbxVariable( SbxDOUBLE ); + + // #57844 Lokalisierte Funktion benutzen + int nErrno; + String aStr = pImg->GetString( nOp1 ); + // Auch , zulassen !!! + USHORT iComma = aStr.Search( ',' ); + if( iComma != STRING_NOTFOUND ) + { + String aStr1 = aStr.Copy( 0, iComma ); + String aStr2 = aStr.Copy( iComma + 1 ); + aStr = aStr1; + aStr += '.'; + aStr += aStr2; + } + double n = SolarMath::StringToDouble( aStr.GetBuffer(), aEnglischIntn, nErrno ); + //ALT: double n = atof( pImg->GetString( nOp1 ) ); + + p->PutDouble( n ); + PushVar( p ); +} + +// Laden einer Stringkonstanten (+ID) + +void SbiRuntime::StepLOADSC( USHORT nOp1 ) +{ + SbxVariable* p = new SbxVariable; + p->PutString( pImg->GetString( nOp1 ) ); + PushVar( p ); +} + +// Immediate Load (+Wert) + +void SbiRuntime::StepLOADI( USHORT nOp1 ) +{ + SbxVariable* p = new SbxVariable; + p->PutInteger( nOp1 ); + PushVar( p ); +} + +// Speichern eines named Arguments in Argv (+Arg-Nr ab 1!) + +void SbiRuntime::StepARGN( USHORT nOp1 ) +{ + if( !refArgv ) + StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); + else + { + String aAlias( pImg->GetString( nOp1 ) ); + SbxVariableRef pVal = PopVar(); + refArgv->Put( pVal, nArgc ); + refArgv->PutAlias( aAlias, nArgc++ ); + } +} + +// Konvertierung des Typs eines Arguments in Argv fuer DECLARE-Fkt. (+Typ) + +void SbiRuntime::StepARGTYP( USHORT nOp1 ) +{ + if( !refArgv ) + StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); + else + { + BOOL bByVal = (nOp1 & 0x8000) != 0; // Ist BYVAL verlangt? + SbxDataType t = (SbxDataType) (nOp1 & 0x7FFF); + SbxVariable* pVar = refArgv->Get( refArgv->Count() - 1 ); // letztes Arg + + // BYVAL prüfen + if( pVar->GetRefCount() > 2 ) // 2 ist normal für BYVAL + { + // Parameter ist eine Referenz + if( bByVal ) + { + // Call by Value ist verlangt -> Kopie anlegen + pVar = new SbxVariable( *pVar ); + pVar->SetFlag( SBX_READWRITE ); + refExprStk->Put( pVar, refArgv->Count() - 1 ); + } + else + pVar->SetFlag( SBX_REFERENCE ); // Ref-Flag für DllMgr + } + else + { + // Parameter ist KEINE Referenz + if( bByVal ) + pVar->ResetFlag( SBX_REFERENCE ); // Keine Referenz -> OK + else + Error( SbERR_BAD_PARAMETERS ); // Referenz verlangt + } + + if( pVar->GetType() != t ) + { + // Variant, damit richtige Konvertierung + // Ausserdem Fehler, wenn SbxBYREF + pVar->Convert( SbxVARIANT ); + pVar->Convert( t ); + } + } +} + +// String auf feste Laenge bringen (+Laenge) + +void SbiRuntime::StepPAD( USHORT nOp1 ) +{ + SbxVariable* p = GetTOS(); + String& s = (String&)(const String&) *p; + if( s.Len() > nOp1 ) + s.Erase( nOp1 ); + else + s.Expand( nOp1, ' ' ); +} + +// Sprung (+Target) + +void SbiRuntime::StepJUMP( USHORT nOp1 ) +{ +#ifndef PRODUCT + if( nOp1 >= pImg->GetCodeSize() ) + StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); +#endif + pCode = (const BYTE*) pImg->GetCode() + nOp1; +} + +// TOS auswerten, bedingter Sprung (+Target) + +void SbiRuntime::StepJUMPT( USHORT nOp1 ) +{ + SbxVariableRef p = PopVar(); + if( p->GetBool() ) + StepJUMP( nOp1 ); +} + +// TOS auswerten, bedingter Sprung (+Target) + +void SbiRuntime::StepJUMPF( USHORT nOp1 ) +{ + SbxVariableRef p = PopVar(); + if( !p->GetBool() ) + StepJUMP( nOp1 ); +} + +// TOS auswerten, Sprung in JUMP-Tabelle (+MaxVal) +// Sieht so aus: +// ONJUMP 2 +// JUMP target1 +// JUMP target2 +// ... +//Falls im Operanden 0x8000 gesetzt ist, Returnadresse pushen (ON..GOSUB) + +void SbiRuntime::StepONJUMP( USHORT nOp1 ) +{ + SbxVariableRef p = PopVar(); + INT16 n = p->GetInteger(); + if( nOp1 & 0x8000 ) + { + nOp1 &= 0x7FFF; + PushGosub( pCode + 3 * nOp1 ); + } + if( n < 1 || n > (short) nOp1 ) + n = nOp1 + 1; + nOp1 = (USHORT) ( (const char*) pCode - pImg->GetCode() ) + 3 * --n; + StepJUMP( nOp1 ); +} + +// UP-Aufruf (+Target) + +void SbiRuntime::StepGOSUB( USHORT nOp1 ) +{ + PushGosub( pCode ); + if( nOp1 >= pImg->GetCodeSize() ) + StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); + pCode = (const BYTE*) pImg->GetCode() + nOp1; +} + +// UP-Return (+0 oder Target) + +void SbiRuntime::StepRETURN( USHORT nOp1 ) +{ + PopGosub(); + if( nOp1 ) + StepJUMP( nOp1 ); +} + +// FOR-Variable testen (+Endlabel) + +void SbiRuntime::StepTESTFOR( USHORT nOp1 ) +{ + if( !pForStk ) + StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); + else + { + SbxOperator eOp = ( pForStk->refInc->GetDouble() < 0 ) ? SbxLT : SbxGT; + if( pForStk->refVar->Compare( eOp, *pForStk->refEnd ) ) + { + PopFor(); + StepJUMP( nOp1 ); + } + } +} + +// Tos+1 <= Tos+2 <= Tos, 2xremove (+Target) + +void SbiRuntime::StepCASETO( USHORT nOp1 ) +{ + if( !refCaseStk || !refCaseStk->Count() ) + StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); + else + { + SbxVariableRef xTo = PopVar(); + SbxVariableRef xFrom = PopVar(); + SbxVariableRef xCase = refCaseStk->Get( refCaseStk->Count() - 1 ); + if( *xCase >= *xFrom && *xCase <= *xTo ) + StepJUMP( nOp1 ); + } +} + +// Fehler-Handler + +void SbiRuntime::StepERRHDL( USHORT nOp1 ) +{ + const BYTE* p = pCode; + StepJUMP( nOp1 ); + pError = pCode; + pCode = p; + pInst->aErrorMsg = String(); + pInst->nErr = + pInst->nErl = + nError = 0; +} + +// Resume nach Fehlern (+0=statement, 1=next or Label) + +void SbiRuntime::StepRESUME( USHORT nOp1 ) +{ + // AB #32714 Resume ohne Error? -> Fehler + if( !bInError ) + { + Error( SbERR_BAD_RESUME ); + return; + } + if( nOp1 ) + { + // Code-Zeiger auf naechstes Statement setzen + USHORT n1, n2; + pCode = pMod->FindNextStmnt( pErrCode, n1, n2 ); + } + else + pCode = pErrStmnt; + + if( nOp1 > 1 ) + StepJUMP( nOp1 ); + pInst->aErrorMsg = String(); + pInst->nErr = + pInst->nErl = + nError = 0; + bInError = FALSE; + + // Error-Stack loeschen + SbErrorStack*& rErrStack = GetSbData()->pErrStack; + delete rErrStack; + rErrStack = NULL; +} + +// Kanal schliessen (+Kanal, 0=Alle) +void SbiRuntime::StepCLOSE( USHORT nOp1 ) +{ + short err; + if( !nOp1 ) + pIosys->Shutdown(); + else + { + err = pIosys->GetError(); + if( !err ) + { + pIosys->Close(); + } + } + err = pIosys->GetError(); + Error( err ); +} + +// Zeichen ausgeben (+char) + +void SbiRuntime::StepPRCHAR( USHORT nOp1 ) +{ + ByteString s( (char) nOp1 ); + pIosys->Write( s ); + Error( pIosys->GetError() ); +} + +// Check, ob TOS eine bestimmte Objektklasse ist (+StringID) + +void SbiRuntime::StepCLASS( USHORT nOp1 ) +{ + String aClass( pImg->GetString( nOp1 ) ); + SbxVariable* pVar = GetTOS(); + if( pVar->GetType() != SbxOBJECT ) + Error( SbERR_NEEDS_OBJECT ); + else + { + SbxObject* pObj; + if( pVar->IsA( TYPE(SbxObject) ) ) + pObj = (SbxObject*) pVar; + else + { + pObj = (SbxObject*) pVar->GetObject(); + if( pObj && !pObj->IsA( TYPE(SbxObject) ) ) + pObj = NULL; + } + if( !pObj || !pObj->IsClass( aClass ) ) + Error( SbERR_INVALID_USAGE_OBJECT ); + } +} + +// Library fuer anschliessenden Declare-Call definieren + +void SbiRuntime::StepLIB( USHORT nOp1 ) +{ + aLibName = pImg->GetString( nOp1 ); +} + +// TOS wird um BASE erhoeht, BASE davor gepusht (+BASE) +// Dieser Opcode wird vor DIM/REDIM-Anweisungen gepusht, +// wenn nur ein Index angegeben wurde. + +void SbiRuntime::StepBASED( USHORT nOp1 ) +{ + SbxVariable* p1 = new SbxVariable; + SbxVariableRef x2 = PopVar(); + p1->PutInteger( nOp1 ); + x2->Compute( SbxPLUS, *p1 ); + PushVar( x2 ); // erst die Expr + PushVar( p1 ); // dann die Base +} + + + + + diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx new file mode 100644 index 000000000000..34e03c96045c --- /dev/null +++ b/basic/source/runtime/step2.cxx @@ -0,0 +1,960 @@ +/************************************************************************* + * + * $RCSfile: step2.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <svtools/sbxdef.hxx> +#include <svtools/sbx.hxx> +#include "runtime.hxx" +#pragma hdrstop +#include "iosys.hxx" +#include "image.hxx" +#include "sbintern.hxx" +#include "sbunoobj.hxx" +#include "opcodes.hxx" + +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/uno/Any.hxx> + +using namespace com::sun::star::container; +using namespace com::sun::star::lang; + + +#include "segmentc.hxx" +#pragma SW_SEGMENT_CLASS( SBRUNTIME, SBRUNTIME_CODE ) + + +/* +// #72488 Spezielle SbxVariable, die beim get das Verhalten +// einer nicht initialisierten Variable simuliert. Wenn als +// Typ SbxOBJECT verlangt wird, geht das jedoch nicht. +class UnoClassSbxVariable : public SbxVariable +{ + SbxDataType eOrgType; + BOOL bOverWritten; + const SbiImage* mpImg; + SbiRuntime* mpRuntime; + +public: + UnoClassSbxVariable( SbxDataType eType, const SbiImage* pImg_, SbiRuntime* pRuntime_ ) + : SbxVariable( SbxVARIANT ), mpImg( pImg_ ), mpRuntime( pRuntime_ ) + { + eOrgType = eType; + bOverWritten = FALSE; + } + + virtual BOOL Get( SbxValues& ) const; + virtual BOOL Put( const SbxValues& ); +}; +*/ + +BOOL UnoClassSbxVariable::Get( SbxValues& rRes ) const +{ + static SbxVariable* pDummy = new SbxVariable( SbxVARIANT ); + if( mbOverWritten || rRes.eType == SbxOBJECT || rRes.eType == SbxVARIANT ) + { + return SbxVariable::Get( rRes ); + } + if( mpImg->GetFlag( SBIMG_EXPLICIT ) ) + { + mpRuntime->Error( SbERR_VAR_UNDEFINED ); + return FALSE; + } + return pDummy->Get( rRes ); +} + +BOOL UnoClassSbxVariable::Put( const SbxValues& rRes ) +{ + // Sonst, falls keine Parameter sind, anderen Error Code verwenden + if( !mbOverWritten ) + { + if( mpImg->GetFlag( SBIMG_EXPLICIT ) ) + { + mpRuntime->Error( SbERR_VAR_UNDEFINED ); + return FALSE; + } + mbOverWritten = TRUE; + + SetType( meOrgType ); + if( meOrgType != SbxVARIANT ) + SetFlag( SBX_FIXED ); + } + return SbxVariable::Put( rRes ); +} + +TYPEINIT1(UnoClassSbxVariable,SbxVariable) + + +// Suchen eines Elements +// Die Bits im String-ID: +// 0x8000 - Argv ist belegt + +SbxVariable* SbiRuntime::FindElement + ( SbxObject* pObj, USHORT nOp1, USHORT nOp2, SbError nNotFound, BOOL bLocal ) +{ + SbxVariable* pElem = NULL; + if( !pObj ) + { + Error( SbERR_NO_OBJECT ); + pElem = new SbxVariable; + } + else + { + BOOL bFatalError = FALSE; + SbxDataType t = (SbxDataType) nOp2; + String aName( pImg->GetString( nOp1 & 0x7FFF ) ); + if( bLocal ) + pElem = refLocals->Find( aName, SbxCLASS_DONTCARE ); + if( !pElem ) + { + // Die RTL brauchen wir nicht mehr zu durchsuchen! + BOOL bSave = rBasic.bNoRtl; + rBasic.bNoRtl = TRUE; + pElem = pObj->Find( aName, SbxCLASS_DONTCARE ); + rBasic.bNoRtl = bSave; + + // Ist es ein globaler Uno-Bezeichner? + if( bLocal && !pElem ) + { + // #72382 VORSICHT! Liefert jetzt wegen unbekannten + // Modulen IMMER ein Ergebnis! + SbxVariable* pUnoClass = findUnoClass( aName ); + pElem = new UnoClassSbxVariable( t, pImg, this ); + SbxValues aRes( SbxOBJECT ); + aRes.pObj = pUnoClass; + pElem->SbxVariable::Put( aRes ); + //pElem->SbxVariable::PutObject( pUnoClass ); + + // #62939 Wenn eine Uno-Klasse gefunden wurde, muss + // das Wrapper-Objekt gehalten werden, da sonst auch + // die Uno-Klasse, z.B. "stardiv" immer wieder neu + // aus der Registry gelesen werden muss + //if( pElem ) + //{ + // #63774 Darf nicht mit gespeichert werden!!! + pElem->SetFlag( SBX_DONTSTORE ); + pElem->SetFlag( SBX_NO_MODIFY); + + // #72382 Lokal speichern, sonst werden alle implizit + // deklarierten Vars automatisch global ! + pElem->SetName( aName ); + refLocals->Put( pElem, refLocals->Count() ); + // OLD: rBasic.Insert( pElem ); + //} + } + + if( !pElem ) + { + // Nicht da und nicht im Objekt? + // Hat das Ding Parameter, nicht einrichten! + if( nOp1 & 0x8000 ) + bFatalError = TRUE; + // ALT: StarBASIC::FatalError( nNotFound ); + + // Sonst, falls keine Parameter sind, anderen Error Code verwenden + if( !bLocal || pImg->GetFlag( SBIMG_EXPLICIT ) ) + { + // #39108 Bei explizit und als ELEM immer ein Fatal Error + bFatalError = TRUE; + + // Falls keine Parameter sind, anderen Error Code verwenden + if( !( nOp1 & 0x8000 ) && nNotFound == SbERR_PROC_UNDEFINED ) + nNotFound = SbERR_VAR_UNDEFINED; + } + if( bFatalError ) + { + // #39108 Statt FatalError zu setzen, Dummy-Variable liefern + if( !xDummyVar.Is() ) + xDummyVar = new SbxVariable( SbxVARIANT ); + pElem = xDummyVar; + + // Parameter von Hand loeschen + ClearArgvStack(); + + // Normalen Error setzen + Error( nNotFound ); + } + else + { + // Sonst Variable neu anlegen + pElem = new SbxVariable( t ); + if( t != SbxVARIANT ) + pElem->SetFlag( SBX_FIXED ); + pElem->SetName( aName ); + refLocals->Put( pElem, refLocals->Count() ); + } + } + } + // #39108 Args koennen schon geloescht sein! + if( !bFatalError ) + SetupArgs( pElem, nOp1 ); + // Ein bestimmter Call-Type wurde gewuenscht, daher muessen + // wir hier den Typ setzen und das Ding anfassen, um den + // korrekten Returnwert zu erhalten! + if( pElem->IsA( TYPE(SbxMethod) ) ) + { + // Soll der Typ konvertiert werden? + SbxDataType t2 = pElem->GetType(); + BOOL bSet = FALSE; + if( !( pElem->GetFlags() & SBX_FIXED ) ) + { + if( t != SbxVARIANT && t != t2 && + t >= SbxINTEGER && t <= SbxSTRING ) + pElem->SetType( t ), bSet = TRUE; + } + // pElem auf eine Ref zuweisen, um ggf. eine Temp-Var zu loeschen + SbxVariableRef refTemp = pElem; + + // Moegliche Reste vom letzten Aufruf der SbxMethod beseitigen + // Vorher Schreiben freigeben, damit kein Error gesetzt wird. + USHORT nFlags = pElem->GetFlags(); + pElem->SetFlag( SBX_READWRITE | SBX_NO_BROADCAST ); + pElem->SbxValue::Clear(); + pElem->SetFlags( nFlags ); + + // Erst nach dem Setzen anfassen, da z.B. LEFT() + // den Unterschied zwischen Left$() und Left() kennen muss + + // AB 12.8.96: Da in PopVar() die Parameter von Methoden weggehauen + // werden, muessen wir hier explizit eine neue SbxMethod anlegen + SbxVariable* pNew = new SbxMethod( *((SbxMethod*)pElem) ); // das ist der Call! + //ALT: SbxVariable* pNew = new SbxVariable( *pElem ); // das ist der Call! + + pElem->SetParameters(0); // sonst bleibt Ref auf sich selbst + pNew->SetFlag( SBX_READWRITE ); + + // den Datentypen zuruecksetzen? + if( bSet ) + pElem->SetType( t2 ); + pElem = pNew; + } + // Index-Access bei UnoObjekten beruecksichtigen + /* + else if( pElem->ISA(SbUnoProperty) ) + { + // pElem auf eine Ref zuweisen, um ggf. eine Temp-Var zu loeschen + SbxVariableRef refTemp = pElem; + + // Variable kopieren und dabei den Notify aufloesen + SbxVariable* pNew = new SbxVariable( *((SbxVariable*)pElem) ); // das ist der Call! + pElem->SetParameters( NULL ); // sonst bleibt Ref auf sich selbst + pElem = pNew; + } + */ + } + return CheckArray( pElem ); +} + +// Find-Funktion ueber Name fuer aktuellen Scope (z.B. Abfrage aus BASIC-IDE) +SbxBase* SbiRuntime::FindElementExtern( const String& rName ) +{ + // Hinweis zu #35281#: Es darf nicht davon ausgegangen werden, dass + // pMeth != null, da im RunInit noch keine gesetzt ist. + + SbxVariable* pElem = NULL; + if( !pMod || !rName.Len() ) + return NULL; + + // Lokal suchen + if( refLocals ) + pElem = refLocals->Find( rName, SbxCLASS_DONTCARE ); + + // In Statics suchen + if ( !pElem && pMeth ) + { + // Bei Statics, Name der Methode davor setzen + String aMethName = pMeth->GetName(); + aMethName += ':'; + aMethName += rName; + pElem = pMod->Find(aMethName, SbxCLASS_DONTCARE); + } + + // In Parameter-Liste suchen + if( !pElem && pMeth ) + { + SbxInfo* pInfo = pMeth->GetInfo(); + if( pInfo && refParams ) + { + USHORT j = 1; + const SbxParamInfo* pParam = pInfo->GetParam( j ); + while( pParam ) + { + if( pParam->aName.EqualsIgnoreCaseAscii( rName ) ) + { + pElem = refParams->Get( j ); + break; + } + pParam = pInfo->GetParam( ++j ); + } + } + } + + // Im Modul suchen + if( !pElem ) + { + // RTL nicht durchsuchen! + BOOL bSave = rBasic.bNoRtl; + rBasic.bNoRtl = TRUE; + pElem = pMod->Find( rName, SbxCLASS_DONTCARE ); + rBasic.bNoRtl = bSave; + } + return pElem; +} + + +// Argumente eines Elements setzen +// Dabei auch die Argumente umsetzen, falls benannte Parameter +// verwendet wurden + +void SbiRuntime::SetupArgs( SbxVariable* p, USHORT nOp1 ) +{ + if( nOp1 & 0x8000 ) + { + if( !refArgv ) + StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); + BOOL bHasNamed = FALSE; + USHORT i; + for( i = 1; i < refArgv->Count(); i++ ) + { + if( refArgv->GetAlias( i ).Len() ) + { + bHasNamed = TRUE; break; + } + } + if( bHasNamed ) + { + // Wir haben mindestens einen benannten Parameter! + // Wir muessen also umsortieren + // Gibt es Parameter-Infos? + SbxInfo* pInfo = p->GetInfo(); + if( !pInfo ) + Error( SbERR_NO_NAMED_ARGS ); + else + { + USHORT nCurPar = 1; + SbxArray* pArg = new SbxArray; + for( i = 1; i < refArgv->Count(); i++ ) + { + SbxVariable* pVar = refArgv->Get( i ); + const String& rName = refArgv->GetAlias( i ); + if( rName.Len() ) + { + // nCurPar wird auf den gefundenen Parameter gesetzt + USHORT j = 1; + const SbxParamInfo* pParam = pInfo->GetParam( j ); + while( pParam ) + { + if( pParam->aName.EqualsIgnoreCaseAscii( rName ) ) + { + nCurPar = j; + break; + } + pParam = pInfo->GetParam( ++j ); + } + if( !pParam ) + { + Error( SbERR_NAMED_NOT_FOUND ); break; + } + } + pArg->Put( pVar, nCurPar++ ); + } + refArgv = pArg; + } + } + // Eigene Var als Parameter 0 + refArgv->Put( p, 0 ); + p->SetParameters( refArgv ); + PopArgv(); + } + else + p->SetParameters( NULL ); +} + +// Holen eines Array-Elements + +SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem ) +{ + // Falls wir ein Array haben, wollen wir bitte das Array-Element! + SbxArray* pPar; + if( pElem->GetType() & SbxARRAY ) + { + SbxBase* pElemObj = pElem->GetObject(); + SbxDimArray* pDimArray = PTR_CAST(SbxDimArray,pElemObj); + pPar = pElem->GetParameters(); + if( pDimArray ) + { + // Die Parameter koennen fehlen, wenn ein Array als + // Argument uebergeben wird. + if( pPar ) + pElem = pDimArray->Get( pPar ); + } + else + { + SbxArray* pArray = PTR_CAST(SbxArray,pElemObj); + if( pArray ) + { + if( !pPar ) + { + Error( SbERR_OUT_OF_RANGE ); + pElem = new SbxVariable; + } + else + pElem = pArray->Get( pPar->Get( 1 )->GetInteger() ); + } + } + + // #42940, 0.Parameter zu NULL setzen, damit sich Var nicht selbst haelt + if( pPar ) + pPar->Put( NULL, 0 ); + } + // Index-Access bei UnoObjekten beruecksichtigen + else if( pElem->GetType() == SbxOBJECT && !pElem->ISA(SbxMethod) && (pPar = pElem->GetParameters()) ) + { + // Ist es ein Uno-Objekt? + SbxBaseRef pObj = (SbxBase*)pElem->GetObject(); + if( pObj && pObj->ISA(SbUnoObject) ) + { + SbUnoObject* pUnoObj = (SbUnoObject*)(SbxBase*)pObj; + Any aAny = pUnoObj->getUnoAny(); + + if( aAny.getValueType().getTypeClass() == TypeClass_INTERFACE ) + { + Reference< XInterface > x = *(Reference< XInterface >*)aAny.getValue(); + Reference< XIndexAccess > xIndexAccess( x, UNO_QUERY ); + + // Haben wir Index-Access? + if( xIndexAccess.is() ) + { + UINT32 nParamCount = (UINT32)pPar->Count() - 1; + if( nParamCount != 1 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return pElem; + } + + // Index holen + INT32 nIndex = pPar->Get( 1 )->GetLong(); + Reference< XInterface > xRet; + try + { + Any aAny = xIndexAccess->getByIndex( nIndex ); + TypeClass eType = aAny.getValueType().getTypeClass(); + if( eType == TypeClass_INTERFACE ) + xRet = *(Reference< XInterface >*)aAny.getValue(); + } + catch (IndexOutOfBoundsException& e1) + { + // Bei Exception erstmal immer von Konvertierungs-Problem ausgehen + StarBASIC::Error( SbERR_OUT_OF_RANGE ); + } + + // #57847 Immer neue Variable anlegen, sonst Fehler + // durch PutObject(NULL) bei ReadOnly-Properties. + pElem = new SbxVariable( SbxVARIANT ); + if( xRet.is() ) + { + aAny <<= xRet; + + // #67173 Kein Namen angeben, damit echter Klassen-Namen eintragen wird + String aName; + SbxObjectRef xWrapper = (SbxObject*)new SbUnoObject( aName, aAny ); + pElem->PutObject( xWrapper ); + } + else + { + pElem->PutObject( NULL ); + } + } + } + } + + // #42940, 0.Parameter zu NULL setzen, damit sich Var nicht selbst haelt + if( pPar ) + pPar->Put( NULL, 0 ); + } + + return pElem; +} + +// Laden eines Elements aus der Runtime-Library (+StringID+Typ) + +void SbiRuntime::StepRTL( USHORT nOp1, USHORT nOp2 ) +{ + PushVar( FindElement( rBasic.pRtl, nOp1, nOp2, SbERR_PROC_UNDEFINED, FALSE ) ); +} + +// Laden einer lokalen/globalen Variablen (+StringID+Typ) + +void SbiRuntime::StepFIND( USHORT nOp1, USHORT nOp2 ) +{ + if( !refLocals ) + refLocals = new SbxArray; + PushVar( FindElement( pMod, nOp1, nOp2, SbERR_PROC_UNDEFINED, TRUE ) ); +} + +// Laden eines Objekt-Elements (+StringID+Typ) +// Das Objekt liegt auf TOS + +void SbiRuntime::StepELEM( USHORT nOp1, USHORT nOp2 ) +{ + // Liegt auf dem TOS ein Objekt? + SbxVariableRef pObjVar = PopVar(); + + SbxObject* pObj = PTR_CAST(SbxObject,(SbxVariable*) pObjVar); + if( !pObj ) + { + SbxBase* pObjVarObj = pObjVar->GetObject(); + pObj = PTR_CAST(SbxObject,pObjVarObj); + } + + // #56368 Bei StepElem Referenz sichern, sonst koennen Objekte + // in Qualifizierungsketten wie ActiveComponent.Selection(0).Text + // zu fueh die Referenz verlieren + // #74254 Jetzt per Liste + if( pObj ) + SaveRef( (SbxVariable*)pObj ); + + PushVar( FindElement( pObj, nOp1, nOp2, SbERR_NO_METHOD, FALSE ) ); +} + +// Laden eines Parameters (+Offset+Typ) +// Wenn der Datentyp nicht stimmen sollte, eine Kopie anlegen +// Der Datentyp SbxEMPTY zeigt an, daá kein Parameter angegeben ist. +// Get( 0 ) darf EMPTY sein + +void SbiRuntime::StepPARAM( USHORT nOp1, USHORT nOp2 ) +{ + USHORT i = nOp1 & 0x7FFF; + SbxDataType t = (SbxDataType) nOp2; + SbxVariable* p; + + // #57915 Missing sauberer loesen + BOOL bIsMissing = FALSE; + USHORT nParamCount = refParams->Count(); + // Wurden ueberhaupt genug Parameter uebergeben + if( i >= nParamCount ) + { + p = new SbxVariable(); + p->PutErr( 448 ); // Wie in VB: Error-Code 448 (SbERR_NAMED_NOT_FOUND) + refParams->Put( p, i ); + } + else + { + p = refParams->Get( i ); + } + if( p->GetType() == SbxERROR && ( i ) ) + //if( p->GetType() == SbxEMPTY && ( i ) ) + { + // Wenn ein Parameter fehlt, kann er OPTIONAL sein + BOOL bOpt = FALSE; + SbxInfo* pInfo; + if( pMeth && ( pInfo = pMeth->GetInfo() ) ) + { + const SbxParamInfo* pParam = pInfo->GetParam( i ); + if( pParam && ( (pParam->nFlags & SBX_OPTIONAL) != 0 ) ) + bOpt = TRUE; + } + if( bOpt == FALSE ) + Error( SbERR_NOT_OPTIONAL ); + } + else if( t != SbxVARIANT && (SbxDataType)(p->GetType() & 0x0FFF ) != t ) + { + SbxVariable* q = new SbxVariable( t ); + SaveRef( q ); + *q = *p; + p = q; + } + SetupArgs( p, nOp1 ); + PushVar( CheckArray( p ) ); +} + +// Case-Test (+True-Target+Test-Opcode) + +void SbiRuntime::StepCASEIS( USHORT nOp1, USHORT nOp2 ) +{ + if( !refCaseStk || !refCaseStk->Count() ) + StarBASIC::FatalError( SbERR_INTERNAL_ERROR ); + else + { + SbxVariableRef xComp = PopVar(); + SbxVariableRef xCase = refCaseStk->Get( refCaseStk->Count() - 1 ); + if( xCase->Compare( (SbxOperator) nOp2, *xComp ) ) + StepJUMP( nOp1 ); + } +} + +// Aufruf einer DLL-Prozedur (+StringID+Typ) +// Auch hier zeigt das MSB des StringIDs an, dass Argv belegt ist + +void SbiRuntime::StepCALL( USHORT nOp1, USHORT nOp2 ) +{ + String aName = pImg->GetString( nOp1 & 0x7FFF ); + SbxArray* pArgs = NULL; + if( nOp1 & 0x8000 ) + pArgs = refArgv; + DllCall( aName, aLibName, pArgs, (SbxDataType) nOp2, FALSE ); + aLibName = String(); + if( nOp1 & 0x8000 ) + PopArgv(); +} + +// Aufruf einer DLL-Prozedur nach CDecl (+StringID+Typ) +// Auch hier zeigt das MSB des StringIDs an, dass Argv belegt ist + +void SbiRuntime::StepCALLC( USHORT nOp1, USHORT nOp2 ) +{ + String aName = pImg->GetString( nOp1 & 0x7FFF ); + SbxArray* pArgs = NULL; + if( nOp1 & 0x8000 ) + pArgs = refArgv; + DllCall( aName, aLibName, pArgs, (SbxDataType) nOp2, TRUE ); + aLibName = String(); + if( nOp1 & 0x8000 ) + PopArgv(); +} + + +// Beginn eines Statements (+Line+Col) + +void SbiRuntime::StepSTMNT( USHORT nOp1, USHORT nOp2 ) +{ + // Wenn der Expr-Stack am Anfang einen Statements eine Variable enthaelt, + // hat ein Trottel X als Funktion aufgerufen, obwohl es eine Variable ist! + BOOL bFatalExpr = FALSE; + if( nExprLvl > 1 ) + bFatalExpr = TRUE; + else if( nExprLvl ) + { + SbxVariable* p = refExprStk->Get( 0 ); + if( p->GetRefCount() > 1 + && refLocals.Is() && refLocals->Find( p->GetName(), p->GetClass() ) ) + bFatalExpr = TRUE; + } + // Der Expr-Stack ist nun nicht mehr notwendig + ClearExprStack(); + + // #56368 Kuenstliche Referenz fuer StepElem wieder freigeben, + // damit sie nicht ueber ein Statement hinaus erhalten bleibt + //refSaveObj = NULL; + // #74254 Jetzt per Liste + ClearRefs(); + + // Wir muessen hier hart abbrechen, da sonst Zeile und Spalte nicht mehr + // stimmen! + if( bFatalExpr) + { + StarBASIC::FatalError( SbERR_NO_METHOD ); + return; + } + pStmnt = pCode - 5; + USHORT nOld = nLine; + nLine = nOp1; + + // #29955 & 0xFF, um for-Schleifen-Ebene wegzufiltern + nCol1 = nOp2 & 0xFF; + + // Suchen des naechsten STMNT-Befehls, + // um die End-Spalte dieses Statements zu setzen + nCol2 = -1; + USHORT n1, n2; + const BYTE* p = pMod->FindNextStmnt( pCode, n1, n2 ); + if( p ) + { + if( n1 == nOp1 ) + { + // #29955 & 0xFF, um for-Schleifen-Ebene wegzufiltern + nCol2 = (n2 & 0xFF) - 1; + } + } + + // #29955 for-Schleifen-Ebene korrigieren, #67452 NICHT im Error-Handler sonst Chaos + if( !bInError ) + { + // (Bei Sprüngen aus Schleifen tritt hier eine Differenz auf) + USHORT nExspectedForLevel = nOp2 / 0x100; + USHORT nRealForLevel = 0; + SbiForStack* pFor = pForStk; + while( pFor ) + { + nRealForLevel++; + pFor = pFor->pNext; + } + + // Wenn der tatsaechliche For-Level zu klein ist, wurde aus + // einer Schleife heraus gesprungen -> korrigieren + while( nRealForLevel > nExspectedForLevel ) + { + PopFor(); + nRealForLevel--; + } + } + + // 16.10.96: #31460 Neues Konzept fuer StepInto/Over/Out + // Erklärung siehe bei _ImplGetBreakCallLevel. + if( pInst->nCallLvl <= pInst->nBreakCallLvl ) + //if( nFlags & SbDEBUG_STEPINTO ) + { + StarBASIC* pStepBasic = GetCurrentBasic( &rBasic ); + USHORT nNewFlags = pStepBasic->StepPoint( nLine, nCol1, nCol2 ); + + // Neuen BreakCallLevel ermitteln + pInst->CalcBreakCallLevel( nNewFlags ); + } + + // Breakpoints nur bei STMNT-Befehlen in neuer Zeile! + else if( ( nOp1 != nOld ) + && ( nFlags & SbDEBUG_BREAK ) + && pMod->IsBP( nOp1 ) ) + { + StarBASIC* pBreakBasic = GetCurrentBasic( &rBasic ); + USHORT nNewFlags = pBreakBasic->BreakPoint( nLine, nCol1, nCol2 ); + + // Neuen BreakCallLevel ermitteln + pInst->CalcBreakCallLevel( nNewFlags ); + //16.10.96, ALT: + //if( nNewFlags != SbDEBUG_CONTINUE ) + // nFlags = nNewFlags; + } +} + +// (+SvStreamFlags+Flags) +// Stack: Blocklaenge +// Kanalnummer +// Dateiname + +void SbiRuntime::StepOPEN( USHORT nOp1, USHORT nOp2 ) +{ + SbxVariableRef pName = PopVar(); + SbxVariableRef pChan = PopVar(); + SbxVariableRef pLen = PopVar(); + short nBlkLen = pLen->GetInteger(); + short nChan = pChan->GetInteger(); + ByteString aName( pName->GetString(), gsl_getSystemTextEncoding() ); + pIosys->Open( nChan, aName, nOp1, nOp2, nBlkLen ); + Error( pIosys->GetError() ); +} + +// Objekt kreieren (+StringID+StringID) + +void SbiRuntime::StepCREATE( USHORT nOp1, USHORT nOp2 ) +{ + String aClass( pImg->GetString( nOp2 ) ); + SbxObject *pObj = SbxBase::CreateObject( aClass ); + if( !pObj ) + Error( SbERR_INVALID_OBJECT ); + else + { + String aName( pImg->GetString( nOp1 ) ); + pObj->SetName( aName ); + // Das Objekt muss BASIC rufen koennen + pObj->SetParent( &rBasic ); + SbxVariable* pNew = new SbxVariable; + pNew->PutObject( pObj ); + PushVar( pNew ); + } +} + +// #56204 Objekt-Array kreieren (+StringID+StringID), DCREATE == Dim-Create +void SbiRuntime::StepDCREATE( USHORT nOp1, USHORT nOp2 ) +{ + SbxVariableRef refVar = PopVar(); + DimImpl( refVar ); + + // Das Array mit Instanzen der geforderten Klasse fuellen + SbxBaseRef xObj = (SbxBase*)refVar->GetObject(); + if( !xObj ) + { + StarBASIC::Error( SbERR_INVALID_OBJECT ); + return; + } + + if( xObj->ISA(SbxDimArray) ) + { + SbxBase* pObj = (SbxBase*)xObj; + SbxDimArray* pArray = (SbxDimArray*)pObj; + + // Dimensionen auswerten + short nDims = pArray->GetDims(); + USHORT nTotalSize = 0; + + // es muss ein eindimensionales Array sein + short nLower, nUpper, nSize; + USHORT i; + for( i = 0 ; i < nDims ; i++ ) + { + pArray->GetDim( i+1, nLower, nUpper ); + nSize = nUpper - nLower + 1; + if( i == 0 ) + nTotalSize = nSize; + else + nTotalSize *= nSize; + } + + // Objekte anlegen und ins Array eintragen + String aClass( pImg->GetString( nOp2 ) ); + for( i = 0 ; i < nTotalSize ; i++ ) + { + SbxObject *pObj = SbxBase::CreateObject( aClass ); + if( !pObj ) + { + Error( SbERR_INVALID_OBJECT ); + break; + } + else + { + String aName( pImg->GetString( nOp1 ) ); + pObj->SetName( aName ); + // Das Objekt muss BASIC rufen koennen + pObj->SetParent( &rBasic ); + pArray->SbxArray::Put( pObj, i ); + } + } + } +} + +// Objekt aus User-Type kreieren (+StringID+StringID) +void SbiRuntime::StepTCREATE( USHORT nOp1, USHORT nOp2 ) +{ + String aName( pImg->GetString( nOp1 ) ); + String aClass( pImg->GetString( nOp2 ) ); + const SbxObject* pObj = pImg->FindType(aClass); + if (pObj) + { + SbxObject *pCopyObj = new SbxObject(*pObj); + pCopyObj->SetName(pImg->GetString( nOp1 )); + SbxVariable* pNew = new SbxVariable; + pNew->PutObject( pCopyObj ); + PushVar( pNew ); + } + else + Error( SbERR_INVALID_OBJECT ); +} + + + +// Einrichten einer lokalen Variablen (+StringID+Typ) + +void SbiRuntime::StepLOCAL( USHORT nOp1, USHORT nOp2 ) +{ + if( !refLocals.Is() ) + refLocals = new SbxArray; + String aName( pImg->GetString( nOp1 ) ); + SbxDataType t = (SbxDataType) nOp2; + SbxVariable* p = new SbxVariable( t ); + p->SetName( aName ); + refLocals->Put( p, refLocals->Count() ); +} + +// Einrichten einer modulglobalen Variablen (+StringID+Typ) + +void SbiRuntime::StepPUBLIC( USHORT nOp1, USHORT nOp2 ) +{ + String aName( pImg->GetString( nOp1 ) ); + SbxDataType t = (SbxDataType) nOp2; + BOOL bFlag = pMod->IsSet( SBX_NO_MODIFY ); + pMod->SetFlag( SBX_NO_MODIFY ); + SbProperty* pProp = pMod->GetProperty( aName, t ); + if( !bFlag ) + pMod->ResetFlag( SBX_NO_MODIFY ); + if( pProp ) + { + pProp->SetFlag( SBX_DONTSTORE ); + // AB: 2.7.1996: HACK wegen 'Referenz kann nicht gesichert werden' + pProp->SetFlag( SBX_NO_MODIFY); + } + +} + +// Einrichten einer globalen Variablen (+StringID+Typ) + +void SbiRuntime::StepGLOBAL( USHORT nOp1, USHORT nOp2 ) +{ + String aName( pImg->GetString( nOp1 ) ); + SbxDataType t = (SbxDataType) nOp2; + BOOL bFlag = rBasic.IsSet( SBX_NO_MODIFY ); + rBasic.SetFlag( SBX_NO_MODIFY ); + SbxVariableRef p = rBasic.Find( aName, SbxCLASS_PROPERTY ); + if( p.Is() ) + rBasic.Remove (p); + p = rBasic.Make( aName, SbxCLASS_PROPERTY, t ); + if( !bFlag ) + rBasic.ResetFlag( SBX_NO_MODIFY ); + if( p ) + { + p->SetFlag( SBX_DONTSTORE ); + // AB: 2.7.1996: HACK wegen 'Referenz kann nicht gesichert werden' + p->SetFlag( SBX_NO_MODIFY); + } + +} + +// Einrichten einer statischen Variablen (+StringID+Typ) + +void SbiRuntime::StepSTATIC( USHORT nOp1, USHORT nOp2 ) +{ + /* AB #40689, wird nicht mehr verwendet + String aName( pImg->GetString( nOp1 ) ); + SbxDataType t = (SbxDataType) nOp2; + SbxVariable* p = new SbxVariable( t ); + p->SetName( aName ); + pInst -> GetStatics()->Put( p, pInst->GetStatics()->Count() ); + */ +} + + diff --git a/basic/source/runtime/win.asm b/basic/source/runtime/win.asm new file mode 100644 index 000000000000..067766a05173 --- /dev/null +++ b/basic/source/runtime/win.asm @@ -0,0 +1,72 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; WINOS2.ASM +;; +;; Ersterstellung MD 26.02.91 +;; +;; Stand +;; XX in Arbeit +;; XX fertiggestellt +;; __ abgenommen +;; __ freigegeben +;; +;; Anmerkungen +;; Direktaufruf von C- und PASCAL-Routinen, Windows und OS/2 +;; +;; Source Code Control System - Header +;; $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/basic/source/runtime/win.asm,v 1.1.1.1 2000-09-18 16:12:11 hr Exp $ +;; +;; Copyright (c) 1990,95 by STAR DIVISION GmbH +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Inhalt: +; type = CallXXX (far *proc, char *stack, short nstack) +; +; Kopie des Basic-Stacks (nstack Bytes) auf den C-Stack +; und Aufruf der Prozedur. + + .MODEL LARGE,C + + .CODE + + PUBLIC CallINT + PUBLIC CallLNG + PUBLIC CallSNG + PUBLIC CallDBL + PUBLIC CallSTR + PUBLIC CallFIX + +CallINT LABEL byte +CallLNG LABEL byte +CallSNG LABEL byte +CallDBL LABEL byte +CallSTR LABEL byte +CallFIX PROC p:PTR,stk:PTR,n:WORD + + PUSH SI + PUSH DI + MOV DX,DS + SUB SP,[n] + MOV DI,SP + MOV AX,SS + MOV ES,AX + LDS SI,[stk] + MOV CX,[n] + SHR CX,1 + CLD + JCXZ $1 + REP MOVSW ; Stack uebernehmen +$1: MOV DS,DX + CALL [p] ; Aufruf der Prozedur + CLI + MOV SP,BP + SUB SP,4 ; wegen gepushter Register + STI + POP DI + POP SI + RET + +CallFIX ENDP + + END diff --git a/basic/source/runtime/wnt.asm b/basic/source/runtime/wnt.asm new file mode 100644 index 000000000000..036959843ee9 --- /dev/null +++ b/basic/source/runtime/wnt.asm @@ -0,0 +1,84 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; WNT.ASM +;; +;; Ersterstellung MD 26.02.91 +;; +;; Stand +;; XX in Arbeit +;; XX fertiggestellt +;; __ abgenommen +;; __ freigegeben +;; +;; Anmerkungen +;; Direktaufruf von C- und PASCAL-Routinen, Windows und OS/2 +;; +;; Source Code Control System - Header +;; $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/basic/source/runtime/wnt.asm,v 1.1.1.1 2000-09-18 16:12:11 hr Exp $ +;; +;; Copyright (c) 1990,95 by STAR DIVISION GmbH +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Inhalt: +; type = CallXXX (far *pProc, char *pStack, short nStack) +; +; Kopie des Basic-Stacks (nStack Bytes) auf den C-Stack +; und Aufruf der Prozedur. + + .386 + +_TEXT SEGMENT DWORD PUBLIC 'CODE' USE32 + + ASSUME CS:_TEXT + + PUBLIC _CallINT@12 + PUBLIC _CallLNG@12 + PUBLIC _CallDBL@12 + PUBLIC _CallSTR@12 + PUBLIC _CallFIX@12 + +_CallINT@12 LABEL byte +_CallLNG@12 LABEL byte +_CallDBL@12 LABEL byte +_CallSTR@12 LABEL byte + +_CallFIX@12: PUSH EBP + MOV EBP,ESP + PUSH ESI + PUSH EDI + + PUSH ECX + PUSH EDX + + MOV DX,DS + MOVZX EAX,WORD PTR [EBP+16] ; EAX == nStack + SUB ESP,EAX ; Stack um nStack Bytes vergroessern + MOV EDI,ESP + MOV AX,SS + MOV ES,AX ; ES:EDI = Startadresse des fuer + ; Parameter reservierten Stackbereichs + MOV ESI,[EBP+12] ; DS:ESI == pStack + + MOVZX ECX,WORD PTR [EBP+16] ; ECX == nStack + SHR ECX,1 + CLD + JCXZ $1 + REP MOVSW ; Stack uebernehmen +$1: MOV DS,DX + CALL DWORD PTR [EBP+8] ; Aufruf der Prozedur + ; CLI ; unter NT nicht erlaubt (privileged instruction) + MOV ESP,EBP + SUB ESP,16 ; wegen gepushter Register + ; (ESI, EDI) + ; STI + POP EDX + POP ECX + POP EDI + POP ESI + POP EBP + RET 12 + +_TEXT ENDS + + END diff --git a/basic/source/sample/collelem.cxx b/basic/source/sample/collelem.cxx new file mode 100644 index 000000000000..1b183e403a62 --- /dev/null +++ b/basic/source/sample/collelem.cxx @@ -0,0 +1,120 @@ +/************************************************************************* + * + * $RCSfile: collelem.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _ERRCODE_HXX //autogen +#include <tools/errcode.hxx> +#endif +#ifndef _SV_MSGBOX_HXX //autogen +#include <vcl/msgbox.hxx> +#endif +#ifndef _SBXCLASS_HXX //autogen +#include <svtools/sbx.hxx> +#endif +#pragma hdrstop +#include "collelem.hxx" + +// Das Sample-Element ist ein kleines Objekt, das die Properties +// Name und Value enth„lt sowie die Methode Say, die den bergebenen +// Text mit dem eigenen Namen verkoppelt und ausgibt. + +SampleElement::SampleElement( const String& r ) : SbxObject( r ) +{ + // Methode Say mit einem String-Parameter + SbxVariable* pMeth = Make( String( RTL_CONSTASCII_USTRINGPARAM("Say") ), SbxCLASS_METHOD, SbxEMPTY ); + pMeth->SetUserData( 0x12345678 ); + pMeth->ResetFlag( SBX_FIXED ); + SbxInfo* pInfo = new SbxInfo; + pInfo->AddParam( String( RTL_CONSTASCII_USTRINGPARAM("text") ), SbxSTRING, SBX_READ ); + pMeth->SetInfo( pInfo ); +} + +void SampleElement::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ) +{ + const SbxHint* pHint = PTR_CAST(SbxHint,&rHint); + if( pHint ) + { + SbxVariable* pVar = pHint->GetVar(); + SbxArray* pPar = pVar->GetParameters(); + ULONG t = pHint->GetId(); + if( t == SBX_HINT_DATAWANTED && pVar->GetUserData() == 0x12345678 ) + { + // Die Say-Methode: + // 1 Parameter + Returnwert + if( !pPar || pPar->Count() != 2 ) + SetError( SbxERR_WRONG_ARGS ); + else + { + String s( GetName() ); + s.AppendAscii( " says: " ); + s += pPar->Get( 1 )->GetString(); + // Aus Gag: den String zurueckliefern + SbxVariable *pRet = pPar->Get( 0 ); + pPar->Get( 0 )->SetType(SbxSTRING); + pPar->Get( 0 )->PutString( s ); + InfoBox( NULL, s ).Execute(); + } + return; + } + SbxObject::SFX_NOTIFY( rBC, rBCType, rHint, rHintType ); + } +} + diff --git a/basic/source/sample/makefile.mk b/basic/source/sample/makefile.mk new file mode 100644 index 000000000000..1e0c9c32855b --- /dev/null +++ b/basic/source/sample/makefile.mk @@ -0,0 +1,95 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=BASIC +TARGET=sample + +# --- Settings ------------------------------------------------------------ + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Allgemein ------------------------------------------------------------ + +CXXFILES = \ + object.cxx \ + collelem.cxx + + +OBJFILES = \ + $(OBJ)$/object.obj \ + $(OBJ)$/collelem.obj + + +LIBTARGET = NO + +LIB1TARGET=$(LB)$/sample.lib +LIB1ARCHIV=$(LB)$/libsample.a + +LIB1OBJFILES = $(OBJFILES) + +# --- Targets ------------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/basic/source/sample/object.cxx b/basic/source/sample/object.cxx new file mode 100644 index 000000000000..137892c67352 --- /dev/null +++ b/basic/source/sample/object.cxx @@ -0,0 +1,319 @@ +/************************************************************************* + * + * $RCSfile: object.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:11 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _ERRCODE_HXX //autogen +#include <tools/errcode.hxx> +#endif +#ifndef _SBX_SBXOBJECT_HXX //autogen +#include <svtools/sbxobj.hxx> +#endif +#ifndef _SBXCLASS_HXX //autogen +#include <svtools/sbx.hxx> +#endif +#ifndef __SBX_SBXVARIABLE_HXX //autogen +#include <svtools/sbxvar.hxx> +#endif +#ifndef _MSGBOX_HXX //autogen +#include <vcl/msgbox.hxx> +#endif + +#pragma hdrstop +#include "object.hxx" +#include "collelem.hxx" +// Makro MEMBER() +#include "macfix.hxx" + +// Das Sample-Objekt hat folgende Elemente: +// 1) Properties: +// Name der Name +// Value ein double-Wert, beide bereits als Default drin +// 2) Methoden: +// Create Erzeugen eines neuen Unterelements +// Display Ausgabe eines Textes +// Square Argument * Argument +// Event Aufruf eines Basic-Eventhandlers +// 3) Unterobjekte: +// Per Create() kann ein neues Unterelement eingerichtet werden, +// das indiziert werden kann, falls mehrere Objekte gleichen Namens +// existieren. +// Diese Implementation ist ein Beispiel fuer eine tabellengesteuerte +// Version, die sehr viele Elemente enthalten kann. Die Elemente werden +// je nach Bedarf aus der Tabelle in das Objekt uebernommen. +// Die Collection findet sich in COLLECTN.*, die in der Collection +// enthaltenen Objekte in COLLELEM.* + +// Das Sample-Objekt wird in ..\app\mybasic.cxx wie folgt in StarBASIC +// eingebaut: + +// MyBasic::MyBasic() : StarBASIC() +// { +// AddFactory( new SampleObjectFac() ); +// } + +// Das nArgs-Feld eines Tabelleneintrags ist wie folgt verschluesselt: + +#define _ARGSMASK 0x00FF // Bis zu 255 Argumente +#define _RWMASK 0x0F00 // Maske fuer R/W-Bits +#define _TYPEMASK 0xF000 // Maske fuer den Typ des Eintrags + +#define _READ 0x0100 // kann gelesen werden +#define _BWRITE 0x0200 // kann as Lvalue verwendet werden +#define _LVALUE _BWRITE // kann as Lvalue verwendet werden +#define _READWRITE 0x0300 // beides +#define _OPT 0x0400 // TRUE: optionaler Parameter +#define _METHOD 0x1000 // Masken-Bit fuer eine Methode +#define _PROPERTY 0x2000 // Masken-Bit fuer eine Property +#define _COLL 0x4000 // Masken-Bit fuer eine Collection + // Kombination von oberen Bits: +#define _FUNCTION 0x1100 // Maske fuer Function +#define _LFUNCTION 0x1300 // Maske fuer Function, die auch als Lvalue geht +#define _ROPROP 0x2100 // Maske Read Only-Property +#define _WOPROP 0x2200 // Maske Write Only-Property +#define _RWPROP 0x2300 // Maske Read/Write-Property +#define _COLLPROP 0x4100 // Maske Read-Collection-Element + +#define COLLNAME "Elements" // Name der Collection, hier mal hart verdrahtet + +SampleObject::Methods SampleObject::aMethods[] = { +// Eine Sample-Methode (der Returnwert ist SbxNULL) +{ "Display", SbxEMPTY, 1 | _FUNCTION, MEMBER(SampleObject::Display) }, + // Ein Named Parameter + { "message",SbxSTRING }, +// Eine Sample-Funktion +{ "Square", SbxDOUBLE, 1 | _FUNCTION, MEMBER(SampleObject::Square) }, + // Ein Named Parameter + { "value", SbxDOUBLE }, +// Basic-Callback +{ "Event", SbxEMPTY, 1 | _FUNCTION, MEMBER(SampleObject::Event) }, + // Ein Named Parameter + { "event", SbxSTRING }, +// Element erzeugen +{ "Create", SbxEMPTY, 1 | _FUNCTION, MEMBER(SampleObject::Create) }, + // Ein Named Parameter + { "name", SbxSTRING }, + +{ NULL, SbxNULL, -1 }}; // Tabellenende + +SampleObject::SampleObject( const String& rClass ) : SbxObject( rClass ) +{ + SetName( String( RTL_CONSTASCII_USTRINGPARAM("Sample") ) ); + PutDouble( 1.0 ); // Startwert fuer Value +} + +// Suche nach einem Element: +// Hier wird linear durch die Methodentabelle gegangen, bis eine +// passende Methode gefunden wurde. +// Wenn die Methode/Property nicht gefunden wurde, nur NULL ohne +// Fehlercode zurueckliefern, da so auch eine ganze Chain von +// Objekten nach der Methode/Property befragt werden kann. + +SbxVariable* SampleObject::Find( const String& rName, SbxClassType t ) +{ + // Ist das Element bereits vorhanden? + SbxVariable* pRes = SbxObject::Find( rName, t ); + if( !pRes && t != SbxCLASS_OBJECT ) + { + // sonst suchen + Methods* p = aMethods; + short nIndex = 0; + BOOL bFound = FALSE; + while( p->nArgs != -1 ) + { + if( rName.EqualsIgnoreCaseAscii( p->pName ) ) + { + bFound = TRUE; break; + } + nIndex += ( p->nArgs & _ARGSMASK ) + 1; + p = aMethods + nIndex; + } + if( bFound ) + { + // Args-Felder isolieren: + short nAccess = ( p->nArgs & _RWMASK ) >> 8; + short nType = ( p->nArgs & _TYPEMASK ); + String aName = String::CreateFromAscii( p->pName ); + SbxClassType eCT = SbxCLASS_OBJECT; + if( nType & _PROPERTY ) + eCT = SbxCLASS_PROPERTY; + else if( nType & _METHOD ) + eCT = SbxCLASS_METHOD; + pRes = Make( aName, eCT, p->eType ); + // Wir setzen den Array-Index + 1, da ja noch andere + // Standard-Properties existieren, die auch aktiviert + // werden muessen. + pRes->SetUserData( nIndex + 1 ); + pRes->SetFlags( nAccess ); + } + } + return pRes; +} + +// Aktivierung eines Elements oder Anfordern eines Infoblocks + +void SampleObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCT, + const SfxHint& rHint, const TypeId& rHT ) +{ + const SbxHint* pHint = PTR_CAST(SbxHint,&rHint); + if( pHint ) + { + SbxVariable* pVar = pHint->GetVar(); + SbxArray* pPar = pVar->GetParameters(); + USHORT nIndex = (USHORT) pVar->GetUserData(); + // kein Index: weiterreichen! + if( nIndex ) + { + ULONG t = pHint->GetId(); + if( t == SBX_HINT_INFOWANTED ) + pVar->SetInfo( GetInfo( (short) pVar->GetUserData() ) ); + else + { + BOOL bWrite = FALSE; + if( t == SBX_HINT_DATACHANGED ) + bWrite = TRUE; + if( t == SBX_HINT_DATAWANTED || bWrite ) + { + // Parameter-Test fuer Methoden: + USHORT nPar = aMethods[ --nIndex ].nArgs & 0x00FF; + // Element 0 ist der Returnwert + if( ( !pPar && nPar ) + || ( pPar->Count() != nPar+1 ) ) + SetError( SbxERR_WRONG_ARGS ); + // Alles klar, man kann den Call ausfuehren + else + { + (this->*(aMethods[ nIndex ].pFunc))( pVar, pPar, bWrite ); + } + } + } + } + SbxObject::SFX_NOTIFY( rBC, rBCT, rHint, rHT ); + } +} + +// Zusammenbau der Infostruktur fuer einzelne Elemente + +SbxInfo* SampleObject::GetInfo( short nIdx ) +{ + Methods* p = &aMethods[ nIdx ]; + // Wenn mal eine Hilfedatei zur Verfuegung steht: + // SbxInfo* pInfo = new SbxInfo( Hilfedateiname, p->nHelpId ); + SbxInfo* pInfo = new SbxInfo; + short nPar = p->nArgs & _ARGSMASK; + for( short i = 0; i < nPar; i++ ) + { + p++; + String aName = String::CreateFromAscii( p->pName ); + USHORT nFlags = ( p->nArgs >> 8 ) & 0x03; + if( p->nArgs & _OPT ) + nFlags |= SBX_OPTIONAL; + pInfo->AddParam( aName, p->eType, nFlags ); + } + return pInfo; +} + +//////////////////////////////////////////////////////////////////////////// + +// Properties und Methoden legen beim Get (bPut = FALSE) den Returnwert +// im Element 0 des Argv ab; beim Put (bPut = TRUE) wird der Wert aus +// Element 0 gespeichert. + +// Die Methoden: + +void SampleObject::Display( SbxVariable*, SbxArray* pPar, BOOL ) +{ + // GetString() loest u.U. auch einen Error aus! + String s( pPar->Get( 1 )->GetString() ); + if( !IsError() ) + InfoBox( NULL, s ).Execute(); +} + +void SampleObject::Square( SbxVariable* pVar, SbxArray* pPar, BOOL ) +{ + double n = pPar->Get( 1 )->GetDouble(); + pVar->PutDouble( n * n ); +} + +// Callback nach BASIC: + +void SampleObject::Event( SbxVariable*, SbxArray* pPar, BOOL ) +{ + Call( pPar->Get( 1 )->GetString(), NULL ); +} + +// Neues Element anlegen + +void SampleObject::Create( SbxVariable* pVar, SbxArray* pPar, BOOL ) +{ + pVar->PutObject( + MakeObject( pPar->Get( 1 )->GetString(), String( RTL_CONSTASCII_USTRINGPARAM("SampleElement") ) ) ); +} + +// Die Factory legt unsere beiden Objekte an. + +SbxObject* SampleObjectFac::CreateObject( const String& rClass ) +{ + if( rClass.EqualsIgnoreCaseAscii( "SampleObject" ) ) + return new SampleObject( rClass ); + if( rClass.EqualsIgnoreCaseAscii( "SampleElement" ) ) + return new SampleElement( rClass ); + return NULL; +} + diff --git a/basic/source/sample/sample.bas b/basic/source/sample/sample.bas new file mode 100644 index 000000000000..d0e416871af0 --- /dev/null +++ b/basic/source/sample/sample.bas @@ -0,0 +1,39 @@ +' Sample-Programm fuer Sample-Objekte + +Sub Main + Dim Sample As SampleObject + Dim Element1 As Object, Element2 As Object + Set Element1 = Sample!Create "Objekt" + Set Element2 = Sample.Create "Objekt" + Element1 = "Element 1" + Element2 = "Element 2" + For i = 0 to 1 + Print Sample.Objekt( i ) + Next + 'Test der Event-Methode im Sample-Objekt + Sample.Event "Bang" +End Sub + +Sub Bang + print "Sample-Callback: BANG!" +End Sub + + + + + + + + + + + + + + + + + + + + diff --git a/basic/util/makefile.mk b/basic/util/makefile.mk new file mode 100644 index 000000000000..33d23435464a --- /dev/null +++ b/basic/util/makefile.mk @@ -0,0 +1,363 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:12:12 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=.. + +PRJNAME=basic +TARGET=sb +#basic.hid generieren +GEN_HID=TRUE + +# --- Settings --------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +.IF "$(GUI)"=="WIN" +.IF "$(product)" != "" +LINKFLAGS=$(LINKFLAGS) /NOPACKC +.ENDIF +.ENDIF + +.IF "$(depend)" == "" + +# --- Allgemein --------------------------------------------------- + +USE_LDUMP2=TRUE + +.IF "$(header)" == "" + +#SRSFILES= $(SRS)$/app.srs $(SRS)$/testtool.srs + + +LIB1TARGET=$(SLB)$/sb.lib +LIB1FILES= \ + $(SLB)$/basicmgr.lib \ + $(SLB)$/classes.lib \ + $(SLB)$/comp.lib \ + $(SLB)$/runtime.lib + +SHL1TARGET= sb$(UPD)$(DLLPOSTFIX) +SHL1IMPLIB= basic + +SHL1STDLIBS= \ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(TOOLSLIB) \ + $(SVTOOLLIB) \ + $(SVLLIB) \ + $(SVLIB) \ + $(SJLIB) \ + $(VOSLIB) \ + $(SALLIB) \ + $(SVMEMLIB) \ + $(UNOTOOLSLIB) + +.IF "$(GUI)"=="WNT" +SHL1STDLIBS+=$(LIBCIMT) +.ENDIF + +.IF "$(SO3)" != "" +SHL1STDLIBS+=\ + $(SOTLIB) \ + $(VOSLIB) +.ENDIF + + + +.IF "$(GUI)" != "UNX" +SHL1OBJS= \ + $(SLO)$/sb.obj +.ENDIF + +SHL1DEF= $(MISC)$/$(SHL1TARGET).def +SHL1LIBS= $(SLB)$/sb.lib + +DEF1NAME =$(SHL1TARGET) +DEF1DEPN = \ + $(MISC)$/$(SHL1TARGET).flt + +DEFLIB1NAME =sb +DEF1DES =StarBasic + +# --- SBASIC IDE -------------------------------------------------------- + +APP1TARGET=$(PRJNAME) +.IF "$(GUI)" != "MAC" +APP1STDLIBS= \ + $(SALLIB) \ + $(TOOLSLIB) \ + $(SVTOOLLIB) \ + $(SVLLIB) \ + $(SVLIB) \ + $(SO2LIB) \ + $(UNOTOOLSLIB) \ + $(UCBHELPERLIB) \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + $(SJLIB) \ + $(VOSLIB) \ + $(SVMEMLIB) +.IF "$(GUI)"=="WNT" || "$(COM)"=="GCC" +APP1STDLIBS+=$(CPPULIB) +.ENDIF +.ELSE +APP1STDLIBS= \ + $(SOLARLIBDIR)$/SALMAIN.OBJ \ + $(SOLARLIBDIR)$/NOSHAREDMAIN.LIB \ + $(TOOLSLIB) \ + $(SVTOOLLIB) \ + $(SVLIB) \ + $(SJLIB) \ + $(SO2LIB) +.ENDIF +.IF "$(GUI)"=="UNX" +APP1STDLIBS+= \ + $(VOSLIB) \ + $(SALLIB) +.ENDIF + +APP1LIBS= \ + $(LIBPRE) $(LB)$/basic.lib \ + $(LIBPRE) $(LB)$/app.lib \ + $(LIBPRE) $(LB)$/sample.lib +.IF "$(GUI)"=="UNX" +APP1STDLIBS+= \ + $(BASICLIB) +.ENDIF + + +.IF "$(SO3)" != "" +APP1STDLIBS+=\ + $(SOTLIB) +.ENDIF + +.IF "$(GUI)" != "MAC" +APP1DEPN= $(L)$/itools.lib $(SVLIBDEPEND) $(LB)$/basic.lib $(LB)$/app.lib $(LB)$/sample.lib +.ELSE +APP1DEPN = $(APP1STDLIBS) $(APP1LIBS) +MACRES = $(SV_RES)SV.R $(SV_RES)SV_DEMO.R $(SV_RES)SV_POWER.R +.ENDIF + +APP1OBJS = $(OBJ)$/ttbasic.obj + +.IF "$(GUI)" != "UNX" +APP1OBJS+= \ + $(OBJ)$/app.obj + +.IF "$(COM)"!="ICC" +APP1OBJS+= \ + $(SLO)$/sbintern.obj +.ENDIF +.ENDIF + +#APP1DEF= $(MISC)$/$(PRJNAME).def +#APP1RES= $(RES)$/sb.res + +RES1TARGET=$(PRJNAME) +SRS1FILES= \ + $(SRS)$/classes.srs + +# --- TESTTOOL IDE ------------------------------------------------------ +# die ressourcen werden hier gelinkt + +RESLIB1NAME=stt +RESLIB1SRSFILES= \ + $(SRS)$/app.srs \ + $(SRS)$/classes.srs + +# --- jstest ------------------------------------------------------ + +#.IF "$(GUI)" != "MAC" + +#APP4TARGET=jstest +#APP4STDLIBS= \ +# $(TOOLSLIB) \ +# $(SVTOOLLIB) \ +# $(SVLIB) \ +# $(SVMEMLIB) \ +# $(SO2LIB) \ +# $(SALLIB) \ +# $(ONELIB) \ +# $(LB)$/basic.lib + +#.IF "$(GUI)"=="UNX" +#APP4STDLIBS+= \ +# $(VOSLIB) $(SALLIB) +#.ENDIF + + +#APP4DEPN=\ +# $(L)$/svtool.lib \ +# $(L)$/itools.lib \ +# $(SVLIBDEPEND) \ +# $(OBJ)$/jstest.obj + +#APP4OBJS= $(OBJ)$/jstest.obj + +#.ENDIF + +# --- Targets ----------------------------------------------------------- + +ALL: $(LIB1TARGET) \ + $(LB)$/basic.lib \ + ALLTAR + + +#------------------------------------------------------------------------- +# Windows 3.x +#------------------------------------------------------------------------- + + +.IF "$(GUI)" == "WIN" + +LINKFLAGS+=/NOCV /IG +LINK=$(DEVROOT)$/bin\optlinks\optlinks + +$(MISC)$/$(PRJNAME).def: makefile.mk + echo NAME BASIC >$@ + echo DESCRIPTION 'StarBASIC DevSystem (C)1994 STAR DIVISION GmbH'>>$@ + echo EXETYPE WINDOWS >>$@ + echo PROTMODE >>$@ + echo STUB 'winSTUB.EXE' >>$@ + echo CODE LOADONCALL MOVEABLE >>$@ + echo DATA PRELOAD MULTIPLE MOVEABLE >>$@ + echo HEAPSIZE 4096 >>$@ + echo STACKSIZE 30000 >>$@ +.ENDIF # GUI == WIN + +#------------------------------------------------------------------------- +# MAC +#------------------------------------------------------------------------- + +.IF "$(GUI)" == "MAC" + +$(MISC)$/$(PRJNAME).def: makefile.mk + echo Kein def-File fuer Applikationen auf Mac +.ENDIF # GUI == MAC + +#------------------------------------------------------------------------- +# OS/2 +#------------------------------------------------------------------------- + +.IF "$(GUI)" == "OS2" + +$(MISC)$/$(PRJNAME).def: makefile.mk +.IF "$(COM)"!="WTC" + echo NAME BASIC WINDOWAPI >$@ + echo DESCRIPTION 'StarBASIC DevSystem (C)1993 STAR DIVISION GmbH' >>$@ + echo EXETYPE OS2 >>$@ + echo PROTMODE >>$@ + echo STUB 'OS2STUB.EXE' >>$@ + echo CODE LOADONCALL >>$@ + echo DATA PRELOAD MULTIPLE >>$@ + echo HEAPSIZE 4096 >>$@ + echo STACKSIZE 30000 >>$@ +.ELSE + @echo option DESCRIPTION 'StarBasic DLL' >$@ + @echo name $(BIN)$/$(SHL1TARGET).dll >>$@ +# @ldump -E1 -A -F$(MISC)$/$(SHL1TARGET).flt $(SLB)$/sb.lib >>temp.def + @ldump -E1 -A -F$(MISC)$/$(SHL1TARGET).flt $(LIB1TARGET) >>temp.def + @awk -f s:\util\exp.awk temp.def + del temp.def +.ENDIF + +.ENDIF # GUI == OS2 + +#------------------------------------------------------------------------- +# Windows NT +#------------------------------------------------------------------------- +# +# default targets aus target.mk +# + +# --- Basic-Filter-Datei --- + +$(MISC)$/$(SHL1TARGET).flt: makefile.mk + @echo ------------------------------ + @echo Making: $@ + @echo WEP > $@ + @echo LIBMAIN >> $@ + @echo LibMain >> $@ + @echo Sbi >> $@ + @echo SvRTL >> $@ + @echo SbRtl_ >> $@ + @echo exception >> $@ + @echo bad_alloc >> $@ + @echo __CT >> $@ +.IF "$(GUI)"=="OS2" + @echo __alloc >> $@ + @echo __malloc >> $@ +.ENDIF + +.ENDIF + +# ------------------------------------------------------------------------ +.ENDIF + +.INCLUDE : target.mk + +$(SRS)$/basic.srs: + +$(TYPE) $(SRS)$/classes.srs + $(SRS)$/runtime.srs > $@ + + diff --git a/basic/win/res/basic.ico b/basic/win/res/basic.ico Binary files differnew file mode 100644 index 000000000000..c453a0fa988f --- /dev/null +++ b/basic/win/res/basic.ico diff --git a/basic/win/res/testtool.ico b/basic/win/res/testtool.ico Binary files differnew file mode 100644 index 000000000000..db880c8678a7 --- /dev/null +++ b/basic/win/res/testtool.ico diff --git a/basic/win/res/work.ico b/basic/win/res/work.ico Binary files differnew file mode 100644 index 000000000000..43e3b5b3df03 --- /dev/null +++ b/basic/win/res/work.ico diff --git a/basic/workben/basmgr.src b/basic/workben/basmgr.src new file mode 100644 index 000000000000..630a7f8ff732 --- /dev/null +++ b/basic/workben/basmgr.src @@ -0,0 +1,65 @@ +/************************************************************************* + * + * $RCSfile: basmgr.src,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:12 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#pragma CHARSET_IBMPC + +String 300 { + Text = "Dummy"; +}; diff --git a/basic/workben/makefile.mk b/basic/workben/makefile.mk new file mode 100644 index 000000000000..11197e87b0a0 --- /dev/null +++ b/basic/workben/makefile.mk @@ -0,0 +1,221 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:12:12 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=.. + +PRJNAME=basic +TARGET=sb +#basic.hid generieren +GEN_HID=TRUE + +# --- Settings --------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +.IF "$(GUI)"=="WIN" +.IF "$(product)" != "" +LINKFLAGS=$(LINKFLAGS) /NOPACKC +.ENDIF +.ENDIF + +.IF "$(depend)" == "" + +# --- Allgemein --------------------------------------------------- + +.IF "$(header)" == "" + + +# --- TESTTOOL MINIAPP ------------------------------------------------------ + +.IF "$(GUI)" != "MAC" +SRS3FILES= $(SRS)$/miniapp.srs +RES3TARGET=miniapp + +APP3TARGET=miniapp +APP3STDLIBS= \ + $(TOOLSLIB) \ + $(SVTOOLLIB) \ + $(PLUGCTORLIB) \ + $(SVLIB) \ + $(SVMEMLIB) \ + $(SJLIB) \ + $(SO2LIB) +.IF "$(GUI)"=="UNX" +APP3STDLIBS+= \ + $(VOSLIB) $(OSLLIB) +.ENDIF + + +APP3LIBS= \ + $(LIBPRE) $(LB)$/miniapp.lib + +APP3DEPN=\ + $(L)$/svtool.lib \ + $(L)$/itools.lib \ + $(SVLIBDEPEND) \ + $(LB)$/miniapp.lib + +.IF "$(GUI)" != "UNX" +# win16 braucht ein appobj +APP3OBJS= $(OBJ)$/testapp.obj +.ENDIF + +#APP3DEF= $(MISC)$/$(PRJNAME).def +APP3RES= $(RES)$/miniapp.res + +.ENDIF + +# --- Targets ----------------------------------------------------------- + +ALL: ALLTAR + + +#------------------------------------------------------------------------- +# Windows 3.x +#------------------------------------------------------------------------- + + +.IF "$(GUI)" == "WIN" + +LINKFLAGS+=/NOCV /IG +LINK=$(DEVROOT)$/bin\optlinks\optlinks + +$(MISC)$/$(PRJNAME).def: makefile + echo NAME BASIC >$@ + echo DESCRIPTION 'StarBASIC DevSystem (C)1994 STAR DIVISION GmbH'>>$@ + echo EXETYPE WINDOWS >>$@ + echo PROTMODE >>$@ + echo STUB 'winSTUB.EXE' >>$@ + echo CODE LOADONCALL MOVEABLE >>$@ + echo DATA PRELOAD MULTIPLE MOVEABLE >>$@ + echo HEAPSIZE 4096 >>$@ + echo STACKSIZE 30000 >>$@ +.ENDIF # GUI == WIN + +#------------------------------------------------------------------------- +# MAC +#------------------------------------------------------------------------- + +.IF "$(GUI)" == "MAC" + +$(MISC)$/$(PRJNAME).def: makefile + echo Kein def-File fuer Applikationen auf Mac +.ENDIF # GUI == MAC + +#------------------------------------------------------------------------- +# OS/2 +#------------------------------------------------------------------------- + +.IF "$(GUI)" == "OS2" + +$(MISC)$/$(PRJNAME).def: makefile +.IF "$(COM)"!="WTC" + echo NAME BASIC WINDOWAPI >$@ + echo DESCRIPTION 'StarBASIC DevSystem (C)1993 STAR DIVISION GmbH' >>$@ + echo EXETYPE OS2 >>$@ + echo PROTMODE >>$@ + echo STUB 'OS2STUB.EXE' >>$@ + echo CODE LOADONCALL >>$@ + echo DATA PRELOAD MULTIPLE >>$@ + echo HEAPSIZE 4096 >>$@ + echo STACKSIZE 30000 >>$@ +.ELSE + @echo option DESCRIPTION 'StarBasic DLL' >$@ + @echo name $(BIN)$/$(SHL1TARGET).dll >>$@ +# @ldump -E1 -A -F$(MISC)$/$(SHL1TARGET).flt $(SLB)$/sb.lib >>temp.def + @ldump -E1 -A -F$(MISC)$/$(SHL1TARGET).flt $(LIB1TARGET) >>temp.def + @awk -f s:\util\exp.awk temp.def + del temp.def +.ENDIF + +.ENDIF # GUI == OS2 + +#------------------------------------------------------------------------- +# Windows NT +#------------------------------------------------------------------------- +# +# default targets aus target.mk +# + +# --- Basic-Filter-Datei --- + +$(MISC)$/$(SHL1TARGET).flt: makefile + @echo ------------------------------ + @echo Making: $@ + @echo WEP > $@ + @echo LIBMAIN >> $@ + @echo LibMain >> $@ + @echo Sbi >> $@ + @echo SvRTL >> $@ + @echo SbRtl_ >> $@ + +.ENDIF + +# ------------------------------------------------------------------------ +.ENDIF + +.INCLUDE : target.mk + + + diff --git a/basic/workben/mgrtest.cxx b/basic/workben/mgrtest.cxx new file mode 100644 index 000000000000..bcc5643f3903 --- /dev/null +++ b/basic/workben/mgrtest.cxx @@ -0,0 +1,644 @@ +/************************************************************************* + * + * $RCSfile: mgrtest.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:12:12 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _SV_SVAPP_HXX //autogen +#include <vcl/svapp.hxx> +#endif +#ifndef _SV_WRKWIN_HXX //autogen +#include <vcl/wrkwin.hxx> +#endif +#ifndef _SV_TOOLBOX_HXX //autogen +#include <vcl/toolbox.hxx> +#endif +#ifndef _SV_MSGBOX_HXX //autogen +#include <vcl/msgbox.hxx> +#endif +#ifndef _SV_SOUND_HXX //autogen +#include <vcl/sound.hxx> +#endif +#ifndef _BASMGR_HXX //autogen +#include <basic/basmgr.hxx> +#endif +#ifndef _SVSTOR_HXX //autogen +#include <so3/svstor.hxx> +#endif +#ifndef _SBXCLASS_HXX //autogen +#include <svtools/sbx.hxx> +#endif +#ifndef _SB_SBMOD_HXX //autogen +#include <basic/sbmod.hxx> +#endif +#ifndef _BASRDLL_HXX //autogen +#include <basrdll.hxx> +#endif + +//#include <sv.hxx> +//#include <basic.hxx> +//#include <sostor.hxx> + +// Defines fuer ToolBox-Id's +#define TB_NEW 1 +#define TB_OPENSTORAGE 2 +#define TB_SAVESTORAGE 3 +#define TB_ORG 4 +#define TB_CREATELIB1 10 +#define TB_CREATELIB2 11 +#define TB_CREATELIB3 12 +#define TB_LOADLIB1 20 +#define TB_LOADLIB2 21 +#define TB_LOADLIB3 22 +#define TB_STORELIBX 30 +#define TB_UNLOADX 31 +#define TB_LOADX 32 +#define TB_EXECX 33 +#define TB_REMOVEX 34 +#define TB_REMOVEDELX 35 + +#define TB_LIB0 40 +#define TB_LIB1 41 +#define TB_LIB2 42 +#define TB_LIB3 43 + +const char* pLib1Str = "Lib1"; +const char* pLib2Str = "Lib2"; +const char* pLib3Str = "Lib3"; + +// Test-Applikation +class TestApp : public Application +{ +public: + virtual void Main( void ); + virtual void Main( int, char*[] ); +}; + +// Test-Fenster mit ToolBox zur Auswahl eines Tests +// und den typischerweise verwendeten virtuellen Methoden +class TestWindow : public WorkWindow +{ +private: + ToolBox aToolBox; + BasicManager* pBasMgr; + + void CheckError(); + USHORT nLibX; + DECL_LINK( BasicErrorHdl, StarBASIC * ); + + +public: + TestWindow(); + ~TestWindow(); + + virtual void Paint( const Rectangle& ); + virtual void Resize(); + virtual void KeyInput( const KeyEvent& rKeyEvt ); + virtual void MouseMove( const MouseEvent& rMEvt ); + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void MouseButtonUp( const MouseEvent& rMEvt ); + + DECL_LINK( TBSelect, ToolBox * ); + void UpdateToolBox(); + void ShowInfo(); +}; + +TestWindow::~TestWindow() +{ +} + +TestWindow::TestWindow() : + WorkWindow( NULL, WB_APP | WB_STDWORK | WB_SVLOOK | WB_CLIPCHILDREN ) , + aToolBox( this, WinBits( WB_BORDER | WB_SVLOOK | WB_SCROLL | WB_LINESPACING ) ) +{ + nLibX = 0; + + aToolBox.SetButtonType( BUTTON_TEXT ); + aToolBox.SetLineCount( 2 ); + aToolBox.SetPosPixel( Point( 0, 0 ) ); + aToolBox.SetSelectHdl( LINK( this, TestWindow, TBSelect ) ); + + Font aFont; + aFont.SetName( "Helv" ); + aFont.SetSize( Size( 0, 6 ) ); + aFont.SetPitch( PITCH_VARIABLE ); + aFont.SetFamily( FAMILY_SWISS ); + aFont.SetTransparent( TRUE ); + aFont.SetAlign( ALIGN_TOP ); + aToolBox.SetFont( aFont ); + SetFont( aFont ); + + aToolBox.InsertItem( TB_NEW, "New" ); + aToolBox.SetHelpText( TB_NEW, "New BasicManager" ); + aToolBox.InsertItem( TB_OPENSTORAGE, "Load" ); + aToolBox.SetHelpText( TB_OPENSTORAGE, "Load Storage D:\\MYSTORE.SVS" ); + aToolBox.InsertItem( TB_SAVESTORAGE, "Save" ); + aToolBox.SetHelpText( TB_SAVESTORAGE, "Save Storage D:\\MYSTORE.SVS" ); + + aToolBox.InsertSeparator(); + + aToolBox.InsertItem( TB_ORG, "Verwalten" ); + aToolBox.SetHelpText( TB_ORG, "Libaries verwalten" ); + + aToolBox.InsertSeparator(); + + aToolBox.InsertItem( TB_LIB0, "0" ); + aToolBox.SetHelpText( TB_LIB0, "Aktuelle Lib: STANDARD" ); + aToolBox.InsertItem( TB_LIB1, "1" ); + aToolBox.SetHelpText( TB_LIB1, "Aktuelle Lib: 1" ); + aToolBox.InsertItem( TB_LIB2, "2" ); + aToolBox.SetHelpText( TB_LIB2, "Aktuelle Lib: 2" ); + aToolBox.InsertItem( TB_LIB3, "3" ); + aToolBox.SetHelpText( TB_LIB3, "Aktuelle Lib: 3" ); + + aToolBox.InsertBreak(); + aToolBox.InsertItem( TB_CREATELIB1, "CreateLib1" ); + aToolBox.SetHelpText( TB_CREATELIB1, "Create Libary LIB1" ); + aToolBox.InsertItem( TB_CREATELIB2, "CreateLib2" ); + aToolBox.SetHelpText( TB_CREATELIB2, "Create Libary LIB2" ); + aToolBox.InsertItem( TB_CREATELIB3, "CreateLib3" ); + aToolBox.SetHelpText( TB_CREATELIB3, "Create Libary LIB3" ); + + aToolBox.InsertSeparator(); + aToolBox.InsertItem( TB_LOADLIB1, "LoadLib1" ); + aToolBox.SetHelpText( TB_LOADLIB1, "Load Libary LIB1" ); + aToolBox.InsertItem( TB_LOADLIB2, "LoadLib2" ); + aToolBox.SetHelpText( TB_LOADLIB2, "Load Libary LIB2" ); + aToolBox.InsertItem( TB_LOADLIB3, "LoadLib3" ); + aToolBox.SetHelpText( TB_LOADLIB3, "Load Libary LIB3" ); + + aToolBox.InsertSeparator(); + aToolBox.InsertItem( TB_STORELIBX, "StoreLibX" ); + aToolBox.SetHelpText( TB_STORELIBX, "Store Libary LIBX" ); + aToolBox.InsertItem( TB_UNLOADX, "UnloadX" ); + aToolBox.SetHelpText( TB_UNLOADX, "Unload Libary LIBX" ); + aToolBox.InsertItem( TB_LOADX, "LoadX" ); + aToolBox.SetHelpText( TB_LOADX, "Load Libary LIBX" ); + aToolBox.InsertItem( TB_EXECX, "ExecX" ); + aToolBox.SetHelpText( TB_EXECX, "Execute 'Libary' LIBX" ); + aToolBox.InsertItem( TB_REMOVEX, "RemoveX" ); + aToolBox.SetHelpText( TB_REMOVEX, "Remove Libary LIBX" ); + aToolBox.InsertItem( TB_REMOVEDELX, "RemDelX" ); + aToolBox.SetHelpText( TB_REMOVEDELX, "Remove and delete Libary LIBX" ); + + pBasMgr = 0; + + Show(); + UpdateToolBox(); + aToolBox.Show(); +} +void TestWindow::ShowInfo() +{ + Invalidate(); + Update(); + long nH = GetTextSize( "X" ).Height(); + if ( pBasMgr ) + { + Point aPos( 10, aToolBox.GetSizePixel().Height()+5 ); + for ( USHORT nLib = 0; nLib < pBasMgr->GetLibCount(); nLib++ ) + { + String aOutStr( nLib ); + aOutStr +=": "; + StarBASIC* pL = pBasMgr->GetLib( nLib ); + aOutStr += '['; + aOutStr += pBasMgr->GetLibName( nLib ); + aOutStr += "]<"; + if ( pL ) + aOutStr += pL->GetName(); + else + aOutStr += "NoLoaded"; + aOutStr += ">, Storage='"; + aOutStr += pBasMgr->GetLibStorageName( nLib ); + aOutStr += "', bLoaded="; + aOutStr += (USHORT)pBasMgr->IsLibLoaded( nLib ); + DrawText( aPos, aOutStr ); + aPos.Y() += nH; + } + } +} + +void TestWindow::UpdateToolBox() +{ + // Darstellung bestimmter Buttons als gecheckt oder disabled, + // falls fuer Test gewuenscht + aToolBox.EnableItem( TB_ORG, (BOOL)(ULONG)pBasMgr ); + + aToolBox.EnableItem( TB_CREATELIB1, (BOOL)(ULONG)pBasMgr ); + aToolBox.EnableItem( TB_CREATELIB2, (BOOL)(ULONG)pBasMgr ); + aToolBox.EnableItem( TB_CREATELIB3, (BOOL)(ULONG)pBasMgr ); + + aToolBox.EnableItem( TB_LOADLIB1, (BOOL)(ULONG)pBasMgr ); + aToolBox.EnableItem( TB_LOADLIB2, (BOOL)(ULONG)pBasMgr ); + aToolBox.EnableItem( TB_LOADLIB3, (BOOL)(ULONG)pBasMgr ); + + aToolBox.EnableItem( TB_STORELIBX, (BOOL)(ULONG)pBasMgr ); + aToolBox.EnableItem( TB_EXECX, (BOOL)(ULONG)pBasMgr ); + aToolBox.EnableItem( TB_UNLOADX, (BOOL)(ULONG)pBasMgr ); + aToolBox.EnableItem( TB_LOADX, (BOOL)(ULONG)pBasMgr ); + aToolBox.EnableItem( TB_REMOVEX, (BOOL)(ULONG)pBasMgr ); + aToolBox.EnableItem( TB_REMOVEDELX, (BOOL)(ULONG)pBasMgr ); + + aToolBox.CheckItem( TB_LIB0, nLibX == 0 ); + aToolBox.CheckItem( TB_LIB1, nLibX == 1 ); + aToolBox.CheckItem( TB_LIB2, nLibX == 2 ); + aToolBox.CheckItem( TB_LIB3, nLibX == 3 ); +} + +IMPL_LINK( TestWindow, TBSelect, ToolBox *, p ) +{ + USHORT nId = aToolBox.GetCurItemId(); + BOOL bChecked = aToolBox.IsItemChecked( nId ); + switch ( nId ) + { + case TB_NEW: + { + delete pBasMgr; + pBasMgr = new BasicManager( new StarBASIC ); + pBasMgr->SetStorageName( "d:\\mystore.svs" ); + } + break; + case TB_OPENSTORAGE: + { + delete pBasMgr; + SvStorageRef xStorage = new SvStorage( "d:\\mystore.svs", STREAM_READ | STREAM_SHARE_DENYWRITE ); + DBG_ASSERT( xStorage.Is(), "Kein Storage!" ); + pBasMgr = new BasicManager( *xStorage ); + } + break; + case TB_SAVESTORAGE: + { + if ( pBasMgr) + { + SvStorageRef xStorage = new SvStorage( "d:\\mystore.svs" ); + DBG_ASSERT( xStorage.Is(), "Kein Storage!" ); + pBasMgr->Store( *xStorage ); + } + } + break; + case TB_ORG: + { + if ( pBasMgr) + { + InfoBox( 0, "Organisieren..." ).Execute(); + } + } + break; + case TB_CREATELIB1: + { + if ( pBasMgr ) + { + USHORT nLib = pBasMgr->GetLibId( pBasMgr->CreateLib( pLib1Str ) ); + if ( nLib != LIB_NOTFOUND ) + { + pBasMgr->SetLibStorageName( nLib, "d:\\mystore.svs" ); + StarBASIC* pLib = pBasMgr->GetLib( pLib1Str ); + DBG_ASSERT( pLib, "Lib?!" ); + String aSource( "Sub SubInLib1Mod1\nprint\"XXX\"\nEnd Sub"); + SbModule* pM = pLib->MakeModule( "ModLib1", aSource ); + DBG_ASSERT( pM, "Modul?" ); + pLib->Compile( pM ); + } + else + InfoBox( 0, "CreateLibary fehlgeschlagen..." ).Execute(); + } + } + break; + case TB_CREATELIB2: + { + if ( pBasMgr ) + { + USHORT nLib = pBasMgr->GetLibId( pBasMgr->CreateLib( pLib2Str ) ); + if ( nLib != LIB_NOTFOUND ) + { + pBasMgr->SetLibStorageName( nLib, "d:\\mystore.svs" ); + StarBASIC* pLib = pBasMgr->GetLib( pLib2Str ); + DBG_ASSERT( pLib, "Lib?!" ); + SbModule* pM = pLib->MakeModule( "ModuleLib2", "Sub SubInLib2\n print \"Tralala\" \nEnd Sub\n" ); + pLib->Compile( pM ); + } + else + InfoBox( 0, "CreateLibary fehlgeschlagen..." ).Execute(); + } + } + break; + case TB_CREATELIB3: + { + if ( pBasMgr ) + { + // liegt in einem anderen Storage !!! + USHORT nLib = pBasMgr->GetLibId( pBasMgr->CreateLib( pLib3Str ) ); + if ( nLib != LIB_NOTFOUND ) + { + pBasMgr->SetLibStorageName( nLib, "d:\\mystore2.svs" ); + StarBASIC* pLib = pBasMgr->GetLib( pLib3Str ); + DBG_ASSERT( pLib, "Lib?!" ); + SbModule* pM = pLib->MakeModule( "ModuleLib2", "Sub XYZInLib3\n print \"?!\" \nEnd Sub\n" ); + pLib->Compile( pM ); + } + else + InfoBox( 0, "CreateLibary fehlgeschlagen..." ).Execute(); + } + } + break; + case TB_LOADLIB1: + { + if ( pBasMgr ) + { + SvStorageRef xStorage = new SvStorage( "d:\\mystore.svs" ); + if ( !pBasMgr->AddLib( *xStorage, pLib1Str, FALSE ) ) + Sound::Beep(); + } + } + break; + case TB_LOADLIB2: + { + if ( pBasMgr ) + { + SvStorageRef xStorage = new SvStorage( "d:\\mystore.svs" ); + if ( !pBasMgr->AddLib( *xStorage, pLib2Str, FALSE ) ) + Sound::Beep(); + } + } + break; + case TB_LOADLIB3: + { + if ( pBasMgr ) + { + // liegt in einem anderen Storage !!! + SvStorageRef xStorage = new SvStorage( "d:\\mystore2.svs" ); + if ( !pBasMgr->AddLib( *xStorage, pLib3Str, FALSE ) ) + Sound::Beep(); + } + } + break; + case TB_STORELIBX: + { + if ( pBasMgr ) + pBasMgr->StoreLib( nLibX ); + } + break; + case TB_UNLOADX: + { + if ( pBasMgr ) + pBasMgr->UnloadLib( nLibX ); + } + break; + case TB_LOADX: + { + if ( pBasMgr ) + pBasMgr->LoadLib( nLibX ); + } + break; + case TB_REMOVEX: + { + if ( pBasMgr ) + pBasMgr->RemoveLib( nLibX, FALSE ); + } + break; + case TB_REMOVEDELX: + { + if ( pBasMgr ) + pBasMgr->RemoveLib( nLibX, TRUE ); + } + break; + case TB_EXECX: + { + if ( pBasMgr ) + { + StarBASIC* pBasic = pBasMgr->GetLib( nLibX ); + if ( pBasic && pBasic->GetModules()->Count() ) + { + pBasic->SetErrorHdl( LINK( this, TestWindow, BasicErrorHdl ) ); + + SbModule* pMod = (SbModule*)pBasic->GetModules()->Get( 0 ); + if ( pMod && pMod->GetMethods()->Count() ) + pMod->GetMethods()->Get(0)->GetInteger(); + } + } + } + break; + + case TB_LIB0: nLibX = 0; + break; + case TB_LIB1: nLibX = 1; + break; + case TB_LIB2: nLibX = 2; + break; + case TB_LIB3: nLibX = 3; + break; + } + + UpdateToolBox(); + CheckError(); + ShowInfo(); + return 0; +} + +void TestWindow::CheckError() +{ + if ( pBasMgr ) + { + BasicError* pError = pBasMgr->GetFirstError(); + while ( pError ) + { + String aErrorStr; + String aReasonStr; + switch ( pError->GetErrorId() ) + { + case BASERR_ID_STDLIBOPEN: + aErrorStr = "Standard-Lib konnte nicht geoffnet werden."; + break; + case BASERR_ID_STDLIBSAVE: + aErrorStr = "Standard-Lib konnte nicht gespeichert werden."; + break; + case BASERR_ID_LIBLOAD: + aErrorStr = "Lib konnte nicht geoffnet werden."; + break; + case BASERR_ID_LIBCREATE: + aErrorStr = "Lib konnte nicht erzeugt werden."; + break; + case BASERR_ID_LIBSAVE: + aErrorStr = "Lib konnte nicht gespeichert werden."; + break; + case BASERR_ID_MGROPEN: + aErrorStr = "Manager konnte nicht geladen werden."; + break; + case BASERR_ID_MGRSAVE: + aErrorStr = "Manager konnte nicht gespeichert werden."; + break; + case BASERR_ID_UNLOADLIB: + aErrorStr = "Libary konnte nicht entladen werden."; + break; + case BASERR_ID_REMOVELIB: + aErrorStr = "Libary konnte nicht entfernt werden."; + break; + default: + aErrorStr = "Unbekannter Fehler!"; + } + + switch ( pError->GetReason() ) + { + case BASERR_REASON_OPENSTORAGE: + aReasonStr = "Der Storage konnte nicht geoeffnet werden"; + break; + case BASERR_REASON_OPENLIBSTORAGE: + aReasonStr = "Der Lib-Storage konnte nicht geoeffnet werden"; + break; + case BASERR_REASON_OPENMGRSTREAM: + aReasonStr = "Der Manager-Stream konnte nicht geoeffnet werden"; + break; + case BASERR_REASON_OPENLIBSTREAM: + aReasonStr = "Der Basic-Stream konnte nicht geoeffnet werden"; + break; + case BASERR_REASON_STDLIB: + aReasonStr = "STANDARD-Lib"; + break; + case BASERR_REASON_BASICLOADERROR: + aReasonStr = "Fehler beim Laden des Basics"; + default: + aReasonStr = " - "; + } + + String aErr( aErrorStr ); + aErr += "\nGrund: "; + aErr += aReasonStr; + InfoBox( 0, aErr ).Execute(); + + pError = pBasMgr->GetNextError(); + } + pBasMgr->ClearErrors(); + } +} + +void __EXPORT TestWindow::Paint( const Rectangle& rRec ) +{ +} + +void __EXPORT TestWindow::Resize() +{ + Size aTBSz = aToolBox.CalcWindowSizePixel(); + aToolBox.SetSizePixel( Size( GetOutputSizePixel().Width(), aTBSz.Height()) ); + Invalidate(); + ShowInfo(); +} + +void __EXPORT TestWindow::KeyInput( const KeyEvent& rKEvt ) +{ + char nCharCode = rKEvt.GetCharCode(); + USHORT nCode = rKEvt.GetKeyCode().GetCode(); + + // Nur bei Alt-Return + if ( ( nCode == KEY_RETURN ) && rKEvt.GetKeyCode().IsMod2() ) + ; + else + WorkWindow::KeyInput( rKEvt ); + + UpdateToolBox(); +} + +void __EXPORT TestWindow::MouseMove( const MouseEvent& rMEvt ) +{ +} + +void __EXPORT TestWindow::MouseButtonDown( const MouseEvent& rMEvt ) +{ + ShowInfo(); +} + +void __EXPORT TestWindow::MouseButtonUp( const MouseEvent& rMEvt ) +{ + UpdateToolBox(); +} + +IMPL_LINK( TestWindow, BasicErrorHdl, StarBASIC *, pBasic ) +{ + String aErrorText( pBasic->GetErrorText() ); + + String aErrorTextPrefix; + if( pBasic->IsCompilerError() ) + { + aErrorTextPrefix = "Compilererror: "; + } + else + { + aErrorTextPrefix = "Runtimeerror: "; + aErrorTextPrefix += pBasic->GetErrorCode(); + aErrorTextPrefix += " "; + } + + InfoBox( 0, String( aErrorTextPrefix + aErrorText ) ).Execute(); + return 0; +} + +void __EXPORT TestApp::Main( void ) +{ + Main( 0, NULL ); +} + +void __EXPORT TestApp::Main( int, char*[] ) +{ + BasicDLL aBasiDLL; + SvFactory::Init(); + EnableSVLook(); + TestWindow aWindow; + Execute(); + SvFactory::DeInit(); +} + + +TestApp aTestApp; diff --git a/configmgr/prj/d.lst b/configmgr/prj/d.lst new file mode 100644 index 000000000000..cde324ffe1b7 --- /dev/null +++ b/configmgr/prj/d.lst @@ -0,0 +1,9 @@ +mkdir: %_DEST%\inc%_EXT%\configmgr +:wq..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\*.so +..\%__SRC%\lib\*.sl %_DEST%\lib%_EXT%\*.sl +..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll +..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res +..\%__SRC%\bin\*.exe %_DEST%\bin%_EXT%\*.exe +..\%__SRC%\bin\*.bin %_DEST%\bin%_EXT%\*.bin + + diff --git a/configmgr/source/api/confeventhelpers.cxx b/configmgr/source/api/confeventhelpers.cxx new file mode 100644 index 000000000000..ef2ea4ee13a3 --- /dev/null +++ b/configmgr/source/api/confeventhelpers.cxx @@ -0,0 +1,484 @@ +/************************************************************************* + * + * $RCSfile: confeventhelpers.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <stdio.h> +#include "confeventhelpers.hxx" + +#ifndef CONFIGMGR_CONFNAME_HXX_ +#include "confname.hxx" +#endif + +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif + +namespace configmgr +{ + namespace internal + { + + void throwDispatchIllegalSequenceException() + { + OSL_ENSHURE( 0, "Illegal Call to brodcaster while dispatching" ); + } + +//////////////////////////////////////////////////////////////////////// +/* template <class Listener> + class BroadcastImplHelper + { + public: + osl::Mutex m_aMutex; + + BroadcastImplHelper() {} + ~BroadcastImplHelper() {} + + typedef std::set<Listener*> Interfaces; + typedef Interfaces::const_iterator Iterator; + + void addInterface(Listener* aListener) { m_aInterfaces.insert(aListener); } + void removeInterface(Listener* aListener) { m_aInterfaces.erase(aListener); } + + void disposing(ConfigChangeBroadcaster* pSource); + + Iterator begin() const { return m_aInterfaces.begin(); } + Iterator end() const { return m_aInterfaces.end(); } + private: + Interfaces m_aInterfaces; + + // no implementation - not copyable + BroadcastImplHelper(BroadcastImplHelper&); + void operator=(BroadcastImplHelper&); + }; +*/ + +///////////////////////////////////////////////////////////////////////// +/* + struct NodeListenerInfo + { + INodeListener* m_pListener; + OUString m_path; + + // fake a pointer for generic clients + INodeListener* operator->() const { return m_pListener; } + INodeListener& operator*() const { return *m_pListener; } + + bool operator < (NodeListenerInfo const& aInfo) const; + }; +*/ +///////////////////////////////////////////////////////////////////////// + +/* + class ConfigChangesBroadcasterImpl + { + private: + typedef BroadcastImplHelper<NodeListenerInfo> Listeners; + Listeners m_aListeners; + std::map<OUString, Listeners::Iterator> m_aDispatchInfos; + }; +*/ +///////////////////////////////////////////////////////////////////////// +ConfigChangesBroadcasterImpl::ConfigChangesBroadcasterImpl() +{ +} + +///////////////////////////////////////////////////////////////////////// +ConfigChangesBroadcasterImpl::~ConfigChangesBroadcasterImpl() +{ + OSL_ENSURE(m_aListeners.begin() == m_aListeners.end(), "Remaining listeners found - forgot to dispose ?"); + OSL_ENSURE(m_aPathMap.empty(), "Spurious mappings found"); +} + +///////////////////////////////////////////////////////////////////////// +void ConfigChangesBroadcasterImpl::add(OUString const& aName, INodeListener* pListener) +{ + OSL_ASSERT( ! ConfigurationName(aName).isRelative() ); + + osl::MutexGuard aGuard(m_aListeners.mutex); + + InfoRef aAdded = m_aListeners.addListener(NodeListenerInfo(pListener)); + aAdded->addPath(aName); + m_aPathMap.insert(PathMap::value_type(aName,aAdded)); +} + +///////////////////////////////////////////////////////////////////////// +void ConfigChangesBroadcasterImpl::remove(INodeListener* pListener) +{ + osl::MutexGuard aGuard(m_aListeners.mutex); + + Listeners::Iterator const iter = m_aListeners.find(pListener); + if (iter != m_aListeners.end()) + { + typedef NodeListenerInfo::Pathes Pathes; + Pathes const& pathes = iter->pathList(); + + // first clear the Path Map + for(Pathes::iterator itPath = pathes.begin(); itPath != pathes.end(); ++itPath) + { + typedef PathMap::iterator PMIter; + typedef std::pair<PMIter, PMIter> PMRange; + + PMRange aRange = m_aPathMap.equal_range(*itPath); + while (aRange.first != aRange.second) + { + PMIter cur = aRange.first++; + if (cur->second == iter) + m_aPathMap.erase(cur); + } + } + + // the remove the broadcast helper entry + m_aListeners.removeListener(pListener); + } +} + +void ConfigChangesBroadcasterImpl::removed(OUString const& aBasePath, bool bRemovedFromModel, IConfigBroadcaster* pSource) +{ + OSL_ASSERT( ! ConfigurationName(aBasePath).isRelative() ); + + // Dispatch 'deleted' to descendants of the changed path + + for( PathMap::const_iterator it = m_aPathMap.lower_bound(aBasePath); + it != m_aPathMap.end() && 0 == aBasePath.compareTo(it->first, aBasePath.getLength()); + ) + { + OSL_ASSERT( m_aListeners.find(it->second->get()) != m_aListeners.end() ); + + OUString aDispatchPath = it->first; + OSL_ASSERT( ! ConfigurationName(aDispatchPath).isRelative() ); + + INodeListener* pTarget = it->second->get(); + ++it; + + // we allow a listener to remove itself from within the callback + // the simple increment above wont work, if the following listener is the same listener + // (which really shouldn't happen) + PathMap::const_iterator next = it; + while (next != m_aPathMap.end() && next->second->get() == pTarget) + ++next; + + pTarget->nodeDeleted(aBasePath, pSource); + + // if a listener removes itself from within the callback, it will be missing by now + // so we check whether our listener is still there and if necessary patch our position + if (m_aListeners.find(pTarget) == m_aListeners.end()) + it = next; + } +} + + +///////////////////////////////////////////////////////////////////////// +// This should actually be available from the TreeChangeList +///////////////////////////////////////////////////////////////////////// + +static Change const* resolvePath(Change const* pChange, ConfigurationName& aRelativePath, RemoveNode const*& pRemoveNode) +{ + OSL_ASSERT(aRelativePath.isRelative()); + OSL_ASSERT(pRemoveNode == 0); + pRemoveNode = 0; + + ConfigurationName::Iterator aIter(aRelativePath.begin()); + ConfigurationName::Iterator const aEnd(aRelativePath.end()); + + OSL_ASSERT(pChange); + OSL_ASSERT(aIter != aEnd); + + while (pChange) + { + if (pChange->ISA(RemoveNode)) + pRemoveNode = static_cast<RemoveNode const*>(pChange); + + OSL_ASSERT(*aIter == pChange->getNodeName()); + if (++aIter == aEnd) + break; // found it + + pChange = pChange->getSubChange(*aIter); + + OSL_ASSERT(pRemoveNode == NULL || pChange == NULL); + } + if (pRemoveNode) + { + aRelativePath = ConfigurationName(aRelativePath.begin(),aIter); + OSL_ASSERT( aRelativePath.localName() == pRemoveNode->getNodeName()); + } + else + OSL_ASSERT(pChange == 0 || aRelativePath == ConfigurationName(aRelativePath.begin(),aIter)); + + return pChange; +} + +///////////////////////////////////////////////////////////////////////// +void ConfigChangesBroadcasterImpl::dispatchInner +( + INodeListener* pTarget, + OUString const& sTargetPath, + Change const& rBaseChange, + OUString const& sChangeContext, + sal_Bool , //_bError, + IConfigBroadcaster* pSource +) +{ + ConfigurationName aContext(sChangeContext); + + OSL_ASSERT(pTarget); + OSL_ASSERT( ConfigurationName(sTargetPath).isNestedIn( aContext ) ); + + ConfigurationName aLocalPath = ConfigurationName(sTargetPath).relativeTo( aContext ); + RemoveNode const* pRemoved = 0; + Change const* pTargetChange = resolvePath(&rBaseChange, aLocalPath, pRemoved ); + + if (pRemoved) + { + pTarget->nodeDeleted(aContext.composeWith(aLocalPath).fullName(), pSource); + } + else if (pTargetChange) + { + OSL_ASSERT(aContext.composeWith(aLocalPath) == sTargetPath); + pTarget->nodeChanged(*pTargetChange, sTargetPath, pSource); + } +} + +///////////////////////////////////////////////////////////////////////// +void ConfigChangesBroadcasterImpl::dispatchOuter +( + INodeListener* pTarget, + OUString const& sTargetPath, + Change const& rBaseChange, + OUString const& sChangeContext, + sal_Bool , //_bError, + IConfigBroadcaster* pSource +) +{ + ConfigurationName sChangesRoot(sChangeContext,rBaseChange.getNodeName()); + + OSL_ASSERT(pTarget); + OSL_ASSERT( sChangesRoot.isNestedIn( sTargetPath ) ); + + pTarget->nodeChanged(rBaseChange, sChangesRoot.fullName(), pSource); +} + +///////////////////////////////////////////////////////////////////////// +void ConfigChangesBroadcasterImpl::dispatch(TreeChangeList const& rList_, sal_Bool _bError, IConfigBroadcaster* pSource) +{ + dispatch(rList_.root, rList_.pathToRoot,_bError, pSource); +} +void ConfigChangesBroadcasterImpl::dispatch +( + Change const& rBaseChange, + OUString const& sChangeContext, + sal_Bool _bError, + IConfigBroadcaster* pSource +) +{ + // listeners registered under multiple sub-pathes will be called multiple times ! + + osl::MutexGuard aGuard(m_aListeners.mutex); + + ConfigurationName aRootName(sChangeContext); + OSL_ASSERT(!aRootName.isRelative()); + + ConfigurationName aNodeName(aRootName, rBaseChange.getNodeName()); + OUString aBasePath( aNodeName.fullName() ); + OSL_ASSERT(!aNodeName.isRelative()); + + OSL_ASSERT(aNodeName.getParentName() == aRootName); + + // Dispatch listeners to ancestors of the change root + PathMap::const_iterator const endOuter = m_aPathMap.upper_bound(aRootName.fullName()); + + // TODO: Both loops are so similar - they should be a single function + for ( PathMap::const_iterator itOuter = m_aPathMap.lower_bound( ConfigurationName::rootname() += aRootName.moduleName() ); + itOuter != endOuter; + ) + { + OSL_ASSERT( m_aListeners.find(itOuter->second->get()) != m_aListeners.end() ); + + OUString aDispatchPath = itOuter->first; + OSL_ASSERT( ! ConfigurationName(aDispatchPath).isRelative() ); + + INodeListener* pTarget = itOuter->second->get(); + + // incrementing here usually is enough + ++itOuter; + + // check whether this should be dispatched at all + if (aBasePath == aDispatchPath || aNodeName.isNestedIn(aDispatchPath)) + { + // we allow a listener to remove itself from within the callback + // the simple increment above wont work, if the following listener is the same listener + // (which really shouldn't happen) + PathMap::const_iterator next = itOuter; + while (next != m_aPathMap.end() && next->second->get() == pTarget) + ++next; + + this->dispatchOuter(pTarget, aDispatchPath, rBaseChange, sChangeContext, _bError, pSource); + + // if a listener removes itself from within the callback, it will be missing by now + // so we check whether our listener is still there and if necessary patch our position + if (m_aListeners.find(pTarget) == m_aListeners.end()) + itOuter = next; + } + } + + + // Dispatch listeners to descendants of the change root + for( PathMap::const_iterator itInner = m_aPathMap.lower_bound(aBasePath); + itInner != m_aPathMap.end() && 0 == aBasePath.compareTo(itInner->first, aBasePath.getLength()); + ) + { + OSL_ASSERT( m_aListeners.find(itInner->second->get()) != m_aListeners.end() ); + + OUString aDispatchPath = itInner->first; + OSL_ASSERT( ! ConfigurationName(aDispatchPath).isRelative() ); + + INodeListener* pTarget = itInner->second->get(); + ++itInner; + + // check whether this should be dispatched at all + if (aBasePath == aDispatchPath || ConfigurationName(aDispatchPath).isNestedIn(aRootName)) + { + // we allow a listener to remove itself from within the callback + // the simple increment above wont work, if the following listener is the same listener + // (which really shouldn't happen) + PathMap::const_iterator next = itInner; + while (next != m_aPathMap.end() && next->second->get() == pTarget) + ++next; + + this->dispatchInner(pTarget, aDispatchPath, rBaseChange, sChangeContext, _bError, pSource); + + // if a listener removes itself from within the callback, it will be missing by now + // so we check whether our listener is still there and if necessary patch our position + if (m_aListeners.find(pTarget) == m_aListeners.end()) + itInner = next; + } + + } +} + +///////////////////////////////////////////////////////////////////////// +void ConfigChangesBroadcasterImpl::disposing(IConfigBroadcaster* pSource) +{ + osl::MutexGuard aGuard(m_aListeners.mutex); + + m_aPathMap.clear(); + m_aListeners.disposing(pSource); +} + +///////////////////////////////////////////////////////////////////////// +/* class ConfigMessageBroadcasterImpl + { + public: + private: + typedef BroadcastImplHelper<INodeListener*> Listeners; + Listeners m_aListeners; + }; +*/ +///////////////////////////////////////////////////////////////////////// +void ConfigMessageBroadcasterImpl::add(IMessageHandler* pListener) +{ + osl::MutexGuard aGuard(m_aListeners.mutex); + + m_aListeners.addListener(pListener); +} + +///////////////////////////////////////////////////////////////////////// +void ConfigMessageBroadcasterImpl::remove(IMessageHandler* pListener) +{ + osl::MutexGuard aGuard(m_aListeners.mutex); + + m_aListeners.removeListener(pListener); +} + +///////////////////////////////////////////////////////////////////////// +void ConfigMessageBroadcasterImpl::dispatch(OUString const& _rNotifyReason, sal_Int32 _nNotificationId, IConfigBroadcaster* pSource) +{ + osl::MutexGuard aGuard(m_aListeners.mutex); + + for (Listeners::Iterator it = m_aListeners.begin(); it != m_aListeners.end(); ) + { + // incrementing here allows a listener to remove itself from within the callback + + // it is illegal to cause removal of another listener from the callback + // if this occurs (dereferencing, incrementing or comparing 'it' fails) + // we need to explicitly guard against that (which is really too expensive) + + IMessageHandler* pHandler = *it; + ++it; + + if (pHandler) + pHandler->message(_rNotifyReason,_nNotificationId,pSource); + } + +} + +///////////////////////////////////////////////////////////////////////// +void ConfigMessageBroadcasterImpl::disposing(IConfigBroadcaster* pSource) +{ + osl::MutexGuard aGuard(m_aListeners.mutex); + + m_aListeners.disposing(pSource); +} + +///////////////////////////////////////////////////////////////////////// + } // namespace +} // namespace + + + diff --git a/configmgr/source/api/confeventhelpers.hxx b/configmgr/source/api/confeventhelpers.hxx new file mode 100644 index 000000000000..1b3b45898377 --- /dev/null +++ b/configmgr/source/api/confeventhelpers.hxx @@ -0,0 +1,248 @@ +/************************************************************************* + * + * $RCSfile: confeventhelpers.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef CONFIGMGR_API_EVENTHELPERS_HXX_ +#define CONFIGMGR_API_EVENTHELPERS_HXX_ + +#ifndef _COM_SUN_STAR_UNO_RUNTIMEEXCEPTION_HPP_ +#include <com/sun/star/uno/RuntimeException.hpp> +#endif + +#ifndef CONFIGMGR_API_EVENTS_HXX_ +#include "confevents.hxx" +#endif + +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#ifndef __SGI_STL_MAP +#include <stl/map> +#endif +#ifndef __SGI_STL_SET +#include <stl/set> +#endif + +namespace configmgr +{ + namespace internal + { + + + //////////////////////////////////////////////////////////////////////// + template <class ListenerRef> + class BroadcastImplHelper + { + public: + osl::Mutex mutex; + + public: + BroadcastImplHelper() + {} + + ~BroadcastImplHelper() + { + OSL_ENSHURE(m_aInterfaces.empty(), "Configuration Broadcaster was not disposed properly"); + } + + public: + typedef std::set<ListenerRef> Interfaces; + typedef typename Interfaces::iterator FullIterator; + typedef typename Interfaces::const_iterator Iterator; + + public: + FullIterator addListener(ListenerRef aListener) + { + return m_aInterfaces.insert(aListener).first; + } + void removeListener(ListenerRef aListener) + { + m_aInterfaces.erase(aListener); + } + + void disposing(IConfigBroadcaster* pSource); + + public: + Iterator begin() const { return m_aInterfaces.begin(); } + Iterator end() const { return m_aInterfaces.end(); } + + Iterator find(ListenerRef aListener) const { return m_aInterfaces.find(aListener); } + FullIterator findFull(ListenerRef aListener) { return m_aInterfaces.find(aListener); } + private: + Interfaces m_aInterfaces; + + // no implementation - not copyable + BroadcastImplHelper(BroadcastImplHelper&); + void operator=(BroadcastImplHelper&); + }; + + //////////////////////////////////////////////////////////////////////// + template <class Listener> + void BroadcastImplHelper<Listener>::disposing(IConfigBroadcaster* pSource) + { + osl::MutexGuard aGuard(this->mutex); // ensure that no notifications are running + + for(FullIterator it = m_aInterfaces.begin(); it != m_aInterfaces.end(); ) + { + FullIterator cur = it++; + if (*cur) + (*cur)->disposing(pSource); + m_aInterfaces.erase(cur); + } + } + + + ///////////////////////////////////////////////////////////////////////// + + class NodeListenerInfo + { + public: + typedef std::set<OUString> Pathes; + + public: + NodeListenerInfo(INodeListener* pListener) + : m_pListener(pListener) + { + } + + // path handling + Pathes const& pathList() const { return m_aPathes; } + + void addPath(OUString const& sPath) const { m_aPathes.insert(sPath); } + void removePath(OUString const& sPath) const { m_aPathes.erase(sPath); } + //void removeChildPathes(OUString const& sPath); + + // behave as pointer for use as a 'reference' class + INodeListener* get() const { return m_pListener; } + INodeListener* operator->() const { return get(); } + INodeListener& operator*() const { return *get(); } + // needed to allow if (info) ... + struct HasListener; + operator HasListener const*() const { return reinterpret_cast<HasListener*>(m_pListener); } + + bool operator < (NodeListenerInfo const& aInfo) const + { return std::less<INodeListener*>()(m_pListener, aInfo.m_pListener); } + + bool operator == (NodeListenerInfo const& aInfo) const + { return m_pListener == aInfo.m_pListener; } + + bool operator > (NodeListenerInfo const& aInfo) const + { return aInfo.operator < (*this); } + bool operator >= (NodeListenerInfo const& aInfo) const + { return !operator<(aInfo); } + bool operator <= (NodeListenerInfo const& aInfo) const + { return !operator>(aInfo); } + + bool operator != (NodeListenerInfo const& aInfo) const + { return !operator==(aInfo); } + + private: + INodeListener* m_pListener; + mutable Pathes m_aPathes; // hack to be mutable as set element + }; + class ConfigChangesBroadcasterImpl + { + public: + ConfigChangesBroadcasterImpl(); + ~ConfigChangesBroadcasterImpl(); + + void add(OUString const& aName, INodeListener* pListener); + void remove(INodeListener* pListener); + + void removed(OUString const& aPath, bool bRemovedFromModel, IConfigBroadcaster* pSource); + + void dispatch(Change const& rBaseChange, OUString const& sChangeContext, sal_Bool _bError, IConfigBroadcaster* pSource); + void dispatch(TreeChangeList const& rList_, sal_Bool _bError, IConfigBroadcaster* pSource); + void disposing(IConfigBroadcaster* pSource); + private: + typedef BroadcastImplHelper<NodeListenerInfo> Listeners; + typedef Listeners::FullIterator InfoRef; + typedef std::multimap<OUString, InfoRef> PathMap; + Listeners m_aListeners; + PathMap m_aPathMap; + private: + void dispatchInner(INodeListener* pTarget, OUString const& sTargetPath, Change const& rBaseChange, OUString const& sChangeContext, sal_Bool _bError, IConfigBroadcaster* pSource); + void dispatchOuter(INodeListener* pTarget, OUString const& sTargetPath, Change const& rBaseChange, OUString const& sChangeContext, sal_Bool _bError, IConfigBroadcaster* pSource); + }; + + ///////////////////////////////////////////////////////////////////////// + class ConfigMessageBroadcasterImpl + { + public: + void add(IMessageHandler* pListener); + void remove(IMessageHandler* pListener); + + void dispatch(OUString const& _rNotifyReason, sal_Int32 _nNotificationId, IConfigBroadcaster* pSource); + void disposing(IConfigBroadcaster* pSource); + private: + typedef BroadcastImplHelper<IMessageHandler*> Listeners; + Listeners m_aListeners; + }; + + ///////////////////////////////////////////////////////////////////////// + } // namespace +} // namespace + +#endif // CONFIGMGR_API_EVENTHELPERS_HXX_ + + diff --git a/configmgr/source/api/confevents.cxx b/configmgr/source/api/confevents.cxx new file mode 100644 index 000000000000..19dd9d8e4a7c --- /dev/null +++ b/configmgr/source/api/confevents.cxx @@ -0,0 +1,410 @@ +/************************************************************************* + * + * $RCSfile: confevents.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <stdio.h> +#include "confevents.hxx" + +#ifndef CONFIGMGR_API_EVENTHELPERS_HXX_ +#include "confeventhelpers.hxx" +#endif +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif +namespace configmgr +{ + // class is still abstract, ITreeListener methods are still unimplemented + TreeListenerImpl::TreeListenerImpl(ITreeNotifier* aSource) + : mySource(aSource) + { + if (mySource) mySource->setListener(this); + } + TreeListenerImpl::~TreeListenerImpl() + { + if (mySource) mySource->setListener(0); + } + + void TreeListenerImpl::disposing(ITreeNotifier* pSource) + { + OSL_ASSERT(pSource && pSource == mySource); + if (pSource == mySource) + mySource = 0; + } + + ITreeNotifier* TreeListenerImpl::rebind(ITreeNotifier* aSource) + { + ITreeNotifier* aOldSource = mySource; + if (aSource != aOldSource) + { + if (mySource) mySource->setListener(0); + mySource = aSource; + if (mySource) mySource->setListener(this); + } + return aOldSource; + } + + ///////////////////////////////////////////////////////////////////////// + using internal::ConfigChangesBroadcasterImpl; + using internal::ConfigMessageBroadcasterImpl; + + ///////////////////////////////////////////////////////////////////////// + class ConfigChangeBroadcaster::Impl + { + public: + Impl() : m_changes(), m_messages() {} + + ConfigChangesBroadcasterImpl m_changes; + ConfigMessageBroadcasterImpl m_messages; + }; + + ///////////////////////////////////////////////////////////////////////// + ConfigChangeBroadcaster::ConfigChangeBroadcaster(ITreeNotifier* aSource) + : TreeListenerImpl(aSource) + , pImpl(new Impl()) + { + } + + ConfigChangeBroadcaster::~ConfigChangeBroadcaster() + { + dispose(); + } + + ///////////////////////////////////////////////////////////////////////// + void ConfigChangeBroadcaster::dispose() + { + unbind(); + + if (!pImpl) return; + pImpl->m_changes.disposing(this); + pImpl->m_messages.disposing(this); + delete pImpl, pImpl = 0; + } + + ///////////////////////////////////////////////////////////////////////// + // IConfigBroadcaster implementation + void ConfigChangeBroadcaster::addListener(OUString const& aName, INodeListener* pHandler) + { pImpl->m_changes.add(aName, pHandler); } + + void ConfigChangeBroadcaster::removeListener(INodeListener* pHandler) + { pImpl->m_changes.remove(pHandler); } + + void ConfigChangeBroadcaster::removeNode(OUString const& aPath, bool bRemovedFromModel) + { pImpl->m_changes.removed(aPath,bRemovedFromModel,this); } + + void ConfigChangeBroadcaster::addHandler(IMessageHandler* pHandler) + { pImpl->m_messages.add(pHandler); } + + void ConfigChangeBroadcaster::removeHandler(IMessageHandler* pHandler) + { pImpl->m_messages.remove(pHandler); } + + ///////////////////////////////////////////////////////////////////////// + void ConfigChangeBroadcaster::broadcast(TreeChangeList const& anUpdate, sal_Bool bError) + { + pImpl->m_changes.dispatch(anUpdate, bError, this); + } + + ///////////////////////////////////////////////////////////////////////// + // ITreeListener implementation + void ConfigChangeBroadcaster::changes(TreeChangeList const& rList_, sal_Bool bError_) + { + broadcast(rList_, bError_);; + } + + void ConfigChangeBroadcaster::changes(sal_Int32 _nNotificationId,const OUString& _rNotifyReason) + { + pImpl->m_messages.dispatch(_rNotifyReason, _nNotificationId, this); + } + + ///////////////////////////////////////////////////////////////////////// + class ConfigChangeMultiplexer::Impl + { + public: + + Impl(OUString const& sBasePath_) : sBasePath(sBasePath_), m_changes(), m_messages() {} + + OUString const sBasePath; + ConfigChangesBroadcasterImpl m_changes; + ConfigMessageBroadcasterImpl m_messages; + }; + + ///////////////////////////////////////////////////////////////////////// + ConfigChangeMultiplexer::ConfigChangeMultiplexer(IConfigBroadcaster* pSource) + : m_pSource(pSource) + , pImpl(0) + { + if (m_pSource) m_pSource->addHandler(this); + } + + ConfigChangeMultiplexer::ConfigChangeMultiplexer(OUString const& aBasePath, IConfigBroadcaster* pSource) + : m_pSource(pSource) + , pImpl(0) + { + bind(aBasePath,pSource); + } + + ConfigChangeMultiplexer::~ConfigChangeMultiplexer() + { + dispose(); + } + ///////////////////////////////////////////////////////////////////////// + void ConfigChangeMultiplexer::bind(OUString const& sNewPath, IConfigBroadcaster* pSource) + { + if (pImpl) + { + OSL_ASSERT(sNewPath == pImpl->sBasePath); + rebind(pSource); + } + else + { + pImpl = new Impl(sNewPath); + if (pSource) + m_pSource = pSource; + m_pSource->addListener(pImpl->sBasePath, this); + m_pSource->addHandler(this); + } + } + + ///////////////////////////////////////////////////////////////////////// + void ConfigChangeMultiplexer::rebind(IConfigBroadcaster* pSource) + { + if (pSource != m_pSource) + { + unbind(); + m_pSource = pSource; + if (m_pSource) + { + if (pImpl) m_pSource->addListener(pImpl->sBasePath, this); + m_pSource->addHandler(this); + } + } + } + ///////////////////////////////////////////////////////////////////////// + void ConfigChangeMultiplexer::unbind() + { + if (m_pSource) + { + if (pImpl) m_pSource->removeListener(this); + m_pSource->removeHandler(this); + } + m_pSource = 0; + } + + ///////////////////////////////////////////////////////////////////////// + bool ConfigChangeMultiplexer::normalizePath(OUString& aName) + { + if (!pImpl) return false; + + ConfigurationName aMyPath(pImpl->sBasePath); + ConfigurationName aPath(aName); + if (aPath.isRelative()) + { + aName = aMyPath.composeWith(aPath).fullName(); + return true; + } + else + { + bool ok = (aMyPath == aPath) || aPath.isNestedIn(aMyPath); + + return ok; + } + } + + ///////////////////////////////////////////////////////////////////////// + void ConfigChangeMultiplexer::broadcast(Change const& anUpdate, OUString const& aRelativePath, sal_Bool bError) + { + OSL_ENSURE(pImpl!=0, "Trying to broadcast on disconnected Notification Multiplexer"); + + OUString aContext( aRelativePath ); + if (!normalizePath(aContext)) + OSL_TRACE("Invalid path. Multiplexer may not walk subtrees correctly\n\r"); + + if (pImpl) + { + pImpl->m_changes.dispatch(anUpdate, aContext, bError, this); + } + } + + void ConfigChangeMultiplexer::broadcast(Change const& anUpdate) + { + // do we need to append the local name ?? + if (pImpl) + pImpl->m_changes.dispatch(anUpdate, pImpl->sBasePath, false, this); + } + ///////////////////////////////////////////////////////////////////////// + void ConfigChangeMultiplexer::dispose() + { + unbind(); + + if (!pImpl) return; + pImpl->m_changes.disposing(this); + pImpl->m_messages.disposing(this); + delete pImpl, pImpl = 0; + } + + // IConfigListener implementation + ///////////////////////////////////////////////////////////////////////// + void ConfigChangeMultiplexer::disposing(IConfigBroadcaster* pSource) + { + OSL_ASSERT(pSource == m_pSource); + if (pSource == m_pSource) + unbind(); + } + + // INodeListener implementation + ///////////////////////////////////////////////////////////////////////// + void ConfigChangeMultiplexer::nodeChanged(Change const& aChange, OUString const& aPath, IConfigBroadcaster* pSource) + { + OSL_ASSERT(pImpl != 0); + OSL_VERIFY(pSource == m_pSource); + broadcast(aChange, aPath); + } + void ConfigChangeMultiplexer::nodeDeleted(OUString const& aPath, IConfigBroadcaster* pSource) + { + OSL_ASSERT(pImpl != 0); + + if (pImpl) + { + OUString aContext( aPath ); + + // must be this base path or a child of it + OSL_ASSERT(!ConfigurationName(aPath).isRelative() || aPath.getLength() == 0); + OSL_ASSERT(aPath.getLength() == 0 || + pImpl->sBasePath == aPath || + ConfigurationName(pImpl->sBasePath).isNestedIn(aPath)); + pImpl->m_changes.removed(aContext,true,this); + } + } + + // IMessageHandler implementation + ///////////////////////////////////////////////////////////////////////// + void ConfigChangeMultiplexer::message(const OUString& rNotifyReason, sal_Int32 nNotificationId, IConfigBroadcaster* pSource) + { + OSL_VERIFY(pSource == m_pSource); + if (pImpl) + pImpl->m_messages.dispatch(rNotifyReason, nNotificationId, this); + } + + ///////////////////////////////////////////////////////////////////////// + // IConfigBroadcaster implementation + + void ConfigChangeMultiplexer::addListener(OUString const& aName, INodeListener* pHandler) + { pImpl->m_changes.add(aName, pHandler); } + + void ConfigChangeMultiplexer::removeListener(INodeListener* pHandler) + { pImpl->m_changes.remove(pHandler); } + + void ConfigChangeMultiplexer::removeNode(OUString const& aPath, bool bRemovedFromModel) + { pImpl->m_changes.removed(aPath,bRemovedFromModel,this); } + + void ConfigChangeMultiplexer::addHandler(IMessageHandler* pHandler) + { pImpl->m_messages.add(pHandler); } + + void ConfigChangeMultiplexer::removeHandler(IMessageHandler* pHandler) + { pImpl->m_messages.remove(pHandler); } + + ///////////////////////////////////////////////////////////////////////// + // ScreenedChangeMultiplexer + ScreenedChangeMultiplexer:: ScreenedChangeMultiplexer(IConfigBroadcaster* aSource) + : ConfigChangeMultiplexer() + , m_pScreeningChanges(0) + { + } + + ScreenedChangeMultiplexer:: ScreenedChangeMultiplexer(TreeChangeList& aScreeningTree, IConfigBroadcaster* aSource) + : ConfigChangeMultiplexer(aScreeningTree.pathToRoot, aSource) + , m_pScreeningChanges(&aScreeningTree.root) + { + } + + ScreenedChangeMultiplexer:: ScreenedChangeMultiplexer(ScreeningChange* aScreening, OUString const& aBasePath, IConfigBroadcaster* aSource) + : ConfigChangeMultiplexer(aBasePath, aSource) + , m_pScreeningChanges(aScreening) + { + } + + void ScreenedChangeMultiplexer:: bind(TreeChangeList& aScreeningTree, IConfigBroadcaster* aSource) + { + bind(&aScreeningTree.root, aScreeningTree.pathToRoot, aSource); + } + + void ScreenedChangeMultiplexer:: bind(ScreeningChange* aScreening, OUString const& aBasePath, IConfigBroadcaster* aSource) + { + unbind(); + m_pScreeningChanges = aScreening; + ConfigChangeMultiplexer::bind(aBasePath, aSource); + } + + void ScreenedChangeMultiplexer:: nodeChanged(Change const& aChange, OUString const& aPath, IConfigBroadcaster* pSource) + { + // To do: filter with local changes herehere + if (&aChange != m_pScreeningChanges) + ConfigChangeMultiplexer::nodeChanged(aChange,aPath,pSource); + } + + void ScreenedChangeMultiplexer:: nodeDeleted(OUString const& aPath, IConfigBroadcaster* pSource) + { + // To do: filter here + ConfigChangeMultiplexer::nodeDeleted(aPath,pSource); + } + +} // namespace + + + diff --git a/configmgr/source/api/confsvccomponent.cxx b/configmgr/source/api/confsvccomponent.cxx new file mode 100644 index 000000000000..1eba8c196734 --- /dev/null +++ b/configmgr/source/api/confsvccomponent.cxx @@ -0,0 +1,181 @@ +/************************************************************************* + * + * $RCSfile: confsvccomponent.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include "confsvccomponent.hxx" + +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif + +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#ifndef __SGI_STL_MAP +#include <stl/map> +#endif + +namespace configmgr { + + + ServiceComponentImpl::ServiceComponentImpl(ServiceInfo const* aInfo) + : ServiceImplBase(m_aMutex) + , m_aMutex() + , m_info(aInfo) + { + } + + void ServiceComponentImpl::disposing() + { + ServiceImplBase::disposing(); + } + void ServiceComponentImpl::checkAlive() throw (uno::RuntimeException) + { + checkAlive("Object was disposed"); + } + void ServiceComponentImpl::checkAlive(OUString const& sMessage) throw (uno::RuntimeException) + { + if (rBHelper.bDisposed) + throw lang::DisposedException(sMessage, *this); + } + + sal_Int32 ServiceComponentImpl::countServices(ServiceInfo const* aInfo) + { + AsciiServiceName const* p= aInfo ? aInfo->serviceNames : 0; + if (p == 0) + return 0; + + sal_Int32 nCount = 0; + while (*p != 0) + { + ++nCount; + ++p; + } + + return nCount; + } + + // XTypeProvider + uno::Sequence<sal_Int8> ServiceComponentImpl::getStaticImplementationId(ServiceInfo const* pServiceInfo) + throw(uno::RuntimeException) + { + static osl::Mutex aMapMutex; + static std::map<ServiceInfo const*, ::cppu::OImplementationId> aIdMap; + + osl::MutexGuard aMapGuard(aMapMutex); + return aIdMap[pServiceInfo].getImplementationId(); + } + + uno::Sequence<sal_Int8> SAL_CALL ServiceComponentImpl::getImplementationId() + throw(uno::RuntimeException) + { + return getStaticImplementationId(m_info); + } + + // XServiceInfo + OUString SAL_CALL ServiceComponentImpl::getImplementationName( ) throw(uno::RuntimeException) + { + AsciiServiceName p= m_info ? m_info->implementationName : 0; + + return p ? OUString::createFromAscii(p) : OUString(); + } + + sal_Bool SAL_CALL ServiceComponentImpl::supportsService( const ::rtl::OUString& ServiceName ) throw(uno::RuntimeException) + { + AsciiServiceName const* p= m_info ? m_info->serviceNames : 0; + if (p == 0) + return false; + + while (*p != 0) + { + if (0 == ServiceName.compareToAscii(*p)) + return true; + ++p; + } + + return false; + } + + uno::Sequence< OUString > ServiceComponentImpl::getServiceNames(ServiceInfo const* pInfo ) throw(uno::RuntimeException) + { + sal_Int32 const nCount = countServices(pInfo); + + uno::Sequence< OUString > aServices( nCount ); + + for(sal_Int32 i= 0; i < nCount; ++i) + aServices[i] = OUString::createFromAscii(pInfo->serviceNames[i]); + + return aServices; + } + + uno::Sequence< OUString > SAL_CALL ServiceComponentImpl::getSupportedServiceNames( ) throw(uno::RuntimeException) + { + return getServiceNames( m_info ); + } + + //ServiceComponentImpl:: + +} // namespace configmgr + + diff --git a/configmgr/source/api/makefile.mk b/configmgr/source/api/makefile.mk new file mode 100644 index 000000000000..5703b6b3c4a9 --- /dev/null +++ b/configmgr/source/api/makefile.mk @@ -0,0 +1,102 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:13:40 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. +PRJINC=$(PRJ)$/source$/inc +PRJNAME=configmgr +TARGET=api + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ---------------------------------- + +.INCLUDE : settings.mk + +# --- Files ------------------------------------- + +SLOFILES= \ + $(SLO)$/encodename.obj \ + $(SLO)$/useradminimpl.obj \ + $(SLO)$/readaccessimpl.obj \ + $(SLO)$/confaccessfactory.obj \ + $(SLO)$/cfgupdatehelper.obj \ + $(SLO)$/nodepropset.obj \ + $(SLO)$/confreadaccess.obj \ + $(SLO)$/confgroupaccess.obj \ + $(SLO)$/confsetaccess.obj \ + $(SLO)$/confupdateimpl.obj \ + $(SLO)$/confupdateaccess.obj \ + $(SLO)$/confbaseelement.obj \ + $(SLO)$/confbaseaccess.obj \ + $(SLO)$/confaccess.obj \ + $(SLO)$/confsvccomponent.obj \ + $(SLO)$/confevents.obj \ + $(SLO)$/confeventhelpers.obj \ + $(SLO)$/confprovider.obj \ + $(SLO)$/confproviderimpl.obj \ + $(SLO)$/confchangesset.obj \ + $(SLO)$/changenotifier.obj \ + +# --- Targets ---------------------------------- + +.INCLUDE : target.mk + diff --git a/configmgr/source/cmdtools/makefile.mk b/configmgr/source/cmdtools/makefile.mk new file mode 100644 index 000000000000..cf830dbe237e --- /dev/null +++ b/configmgr/source/cmdtools/makefile.mk @@ -0,0 +1,121 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:13:40 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. +PRJINC=$(PRJ)$/source + +PRJNAME=configmgr + +TARGET=configshutdown +TARGETTYPE=CUI +LIBTARGET=NO + +# --- Settings ----------------------------------------------------- +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Files -------------------------------------------------------- +CDEFS += -DDLL_VERSION=\"$(UPD)$(DLLPOSTFIX)\" + +APPSTDLIBS=\ + $(SALLIB) \ + $(VOSLIB) \ + $(CPPULIB) \ + $(CPPUHELPERLIB) + + +APP1STDLIBS = $(APPSTDLIBS) + +.IF "$(GUI)"=="UNX" +APP1TARGET= $(TARGET).bin +.ELSE +APP1TARGET= $(TARGET) +.ENDIF + +APP1OBJS= \ + $(SLO)$/configshutdown.obj + +.INCLUDE : target.mk + +#************************************************************************** +# history: +# $Log: not supported by cvs2svn $ +# Revision 1.4 2000/09/15 09:51:48 willem.vandorp +# OpenOffice header added +# +# Revision 1.3 2000/08/27 15:44:53 fs +# #78183# replaced cout/cerr with fprintf +# +# Revision 1.2 2000/08/25 13:22:39 fs +# #78116# on unx, build *.bin +# +# Revision 1.1 2000/08/25 13:02:07 fs +# common reg server related command line tools +# +# Revision 1.1 2000/06/23 08:47:33 fs +# socket related helpers/samples +# +# +# Revision 1.0 26.05.00 17:11:32 fs +#************************************************************************** + diff --git a/configmgr/source/inc/attributes.hxx b/configmgr/source/inc/attributes.hxx new file mode 100644 index 000000000000..ffd7835d81e4 --- /dev/null +++ b/configmgr/source/inc/attributes.hxx @@ -0,0 +1,116 @@ +/************************************************************************* + * + * $RCSfile: attributes.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONFIGMGR_MISC_ATTRIBUTES_HXX_ +#define _CONFIGMGR_MISC_ATTRIBUTES_HXX_ + +#ifndef _COM_SUN_STAR_XML_SAX_XATTRIBUTELIST_HPP_ +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#endif + +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif + +/*---------------------------------------- +* +* Attributlist implementation +* +*----------------------------------------*/ + +//.......................................................................... +namespace configmgr +{ +//.......................................................................... + +struct AttributeListImpl_impl; +class AttributeListImpl : public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XAttributeList > +{ +protected: + ~AttributeListImpl(); + +public: + AttributeListImpl(); + AttributeListImpl( const AttributeListImpl & ); + +public: + virtual sal_Int16 SAL_CALL getLength(void) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getNameByIndex(sal_Int16 i) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTypeByIndex(sal_Int16 i) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTypeByName(const ::rtl::OUString& aName) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getValueByIndex(sal_Int16 i) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getValueByName(const ::rtl::OUString& aName) throw (::com::sun::star::uno::RuntimeException); + +public: + void addAttribute( const ::rtl::OUString &sName , const ::rtl::OUString &sType , const ::rtl::OUString &sValue ); + void clear(); + +private: + struct AttributeListImpl_impl *m_pImpl; +}; + +//.......................................................................... +} // namespace configmgr +//.......................................................................... + +#endif // _CONFIGMGR_MISC_ATTRIBUTES_HXX_ + + diff --git a/configmgr/source/inc/bootstrap.hxx b/configmgr/source/inc/bootstrap.hxx new file mode 100644 index 000000000000..0273f79fd9a0 --- /dev/null +++ b/configmgr/source/inc/bootstrap.hxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * $RCSfile: bootstrap.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef CONFIGMGR_BOOTSTRAP_HXX_ +#define CONFIGMGR_BOOTSTRAP_HXX_ + +#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_ +#include <com/sun/star/uno/Reference.hxx> +#endif + +#ifndef _CONFIGMGR_COMMONTYPES_HXX_ +#include "commontypes.hxx" +#endif + +namespace com { namespace sun { namespace star { + + namespace uno { template <class> class Reference; } + namespace lang { class XMultiServiceFactory; } + +} } } + +#include <rtl/ustring.hxx> + +namespace configmgr +{ + namespace css = ::com::sun::star; + namespace uno = css::uno; + namespace lang = css::lang; + using ::rtl::OUString; + + class IConfigSession; + + class ConnectionSettings + { + OUString m_sSettingsFile; + public: + ConnectionSettings(); + explicit + ConnectionSettings(OUString const& aSettingsFile); + + + /** create a connection with the current settings. If the user name provided in _rSecurityOverride + is not empty, the security override will be used (if applicable), else it will be ignored + */ + IConfigSession* createConnection(uno::Reference<lang::XMultiServiceFactory> const& aServiceMgr, + const SettingsOverride& _rSettings) const; + }; + +} + +#endif // CONFIGMGR_BOOTSTRAP_HXX_ + + diff --git a/configmgr/source/inc/commontypes.hxx b/configmgr/source/inc/commontypes.hxx new file mode 100644 index 000000000000..ff89fc214c20 --- /dev/null +++ b/configmgr/source/inc/commontypes.hxx @@ -0,0 +1,129 @@ +/************************************************************************* + * + * $RCSfile: commontypes.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONFIGMGR_COMMONTYPES_HXX_ +#define _CONFIGMGR_COMMONTYPES_HXX_ + +#ifndef _RTL_USTRING_HXX_ +#include <rtl/ustring.hxx> +#endif +#ifndef _UTL_STLTYPES_HXX_ +#include <unotools/stl_types.hxx> +#endif + +#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_ +#include <com/sun/star/container/XNamed.hpp> +#endif +#ifndef _COM_SUN_STAR_UNO_ANY_HXX_ +#include <com/sun/star/uno/Any.hxx> +#endif + +//.......................................................................... +namespace configmgr +{ +//.......................................................................... + +//========================================================================== +//= IInterface +//========================================================================== +/** abstract base class for objects which may be aquired by ORef's + (in opposite to the IReference, classes deriving from this IInterface can be + derived from XInterface, too) +*/ +class IInterface +{ +public: + virtual void SAL_CALL acquire( ) throw () = 0; + virtual void SAL_CALL release( ) throw () = 0; +}; + +//========================================================================== +//= SettingsOverride +//========================================================================== +DECLARE_STL_USTRINGACCESS_MAP( ::com::sun::star::uno::Any, SettingsOverride ); + +typedef ::com::sun::star::uno::RuntimeException CantRenameException_Base; +class CantRenameException : CantRenameException_Base +{ +public: + ::rtl::OUString newName; + ::rtl::OUString oldName; + + static ::rtl::OUString message(::rtl::OUString const& sNewName, ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed> xContext) + { + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Object cannot be renamed") ); + } + + CantRenameException(::rtl::OUString const& sNewName, ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > xContext) + : CantRenameException_Base(message(sNewName,xContext), xContext) + , newName(sNewName) + , oldName(xContext->getName()) + { + } +}; + +//.......................................................................... +} // namespace configmgr +//.......................................................................... + +#endif // _CONFIGMGR_COMMONTYPES_HXX_ + + diff --git a/configmgr/source/inc/confapifactory.hxx b/configmgr/source/inc/confapifactory.hxx new file mode 100644 index 000000000000..067634cca328 --- /dev/null +++ b/configmgr/source/inc/confapifactory.hxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * $RCSfile: confapifactory.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef CONFIGMGR_API_FACTORY_HXX_ +#define CONFIGMGR_API_FACTORY_HXX_ + +namespace com { namespace sun { namespace star { + namespace uno + { + class XInterface; + template <class> class Reference; + } + namespace lang + { + class XMultiServiceFactory; + } +} } } + +namespace configmgr +{ + namespace css = ::com::sun::star; + namespace uno = css::uno; + namespace lang = css::lang; + struct ServiceInfo; + + // instantiation + uno::Reference< uno::XInterface > SAL_CALL instantiateProvider(uno::Reference< lang::XMultiServiceFactory > const& rServiceManager ); + uno::Reference< uno::XInterface > SAL_CALL instantiateReadAccess(uno::Reference< lang::XMultiServiceFactory > const& rServiceManager ); + uno::Reference< uno::XInterface > SAL_CALL instantiateUpdateAccess(uno::Reference< lang::XMultiServiceFactory > const& rServiceManager ); + + uno::Reference< uno::XInterface > SAL_CALL instantiateConfigRegistry(uno::Reference< lang::XMultiServiceFactory > const& rServiceManager ); + + // Import / export + uno::Reference< uno::XInterface > SAL_CALL instantiateDataExport(uno::Reference< lang::XMultiServiceFactory > const& rServiceManager ); + const ServiceInfo* getDataExportServiceInfo(); + + uno::Reference< uno::XInterface > SAL_CALL instantiateDataImport(uno::Reference< lang::XMultiServiceFactory > const& rServiceManager ); + const ServiceInfo* getDataImportServiceInfo(); + + // service infos + const ServiceInfo* getConfigurationRegistryServiceInfo(); + +} // namespace configmgr + +#endif // CONFIGMGR_API_FACTORY_HXX_ + + diff --git a/configmgr/source/inc/confevents.hxx b/configmgr/source/inc/confevents.hxx new file mode 100644 index 000000000000..44deb33fd0b3 --- /dev/null +++ b/configmgr/source/inc/confevents.hxx @@ -0,0 +1,211 @@ +/************************************************************************* + * + * $RCSfile: confevents.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef CONFIGMGR_API_EVENTS_HXX_ +#define CONFIGMGR_API_EVENTS_HXX_ + +#include "cmtreemodel.hxx" +namespace rtl { class OUString; } + +namespace configmgr +{ + using ::rtl::OUString; + + // class is still abstract, ITreeListener methods are still unimplemented + class TreeListenerImpl : private ITreeListener + { + ITreeNotifier* mySource; + public: + explicit TreeListenerImpl(ITreeNotifier* aSource = 0); + virtual ~TreeListenerImpl(); + + ITreeNotifier* rebind(ITreeNotifier* aSource); + ITreeNotifier* unbind() { return rebind(0); } + protected: + virtual void disposing(ITreeNotifier* pSource); + private: + TreeListenerImpl(TreeListenerImpl&); + void operator=(TreeListenerImpl&); + }; + + struct IConfigBroadcaster; + struct IConfigListener + { + virtual void disposing(IConfigBroadcaster* pSource) = 0; + }; + struct INodeListener : IConfigListener + { + virtual void nodeChanged(Change const& aChange, OUString const& aPath, IConfigBroadcaster* pSource) = 0; + virtual void nodeDeleted(OUString const& aPath, IConfigBroadcaster* pSource) = 0; + }; + struct IMessageHandler: IConfigListener + { + virtual void message(const OUString& rNotifyReason, sal_Int32 nNotificationId, IConfigBroadcaster* pSource) = 0; + }; + + struct IConfigBroadcaster + { + protected: + IConfigBroadcaster() {} + ~IConfigBroadcaster() {} + public: + virtual void addListener(OUString const& aName, INodeListener* pListener) = 0; + virtual void removeListener(INodeListener* pListener) = 0; + + virtual void removeNode(OUString const& aPath, bool bRemovedFromModel = false) = 0; + + virtual void addHandler(IMessageHandler* pHandler) = 0; + virtual void removeHandler(IMessageHandler* pHandler) = 0; + }; + + class ConfigChangeBroadcaster : public TreeListenerImpl, public IConfigBroadcaster + { + class Impl; + Impl* pImpl; + public: + ConfigChangeBroadcaster(ITreeNotifier* aSource = 0); + virtual ~ConfigChangeBroadcaster(); + + void rebind(ITreeNotifier* aSource); + + void broadcast(TreeChangeList const& anUpdate, sal_Bool bError = false); + + public: + // IConfigBroadcaster implementation + void addListener(OUString const& aName, INodeListener* ); + void removeListener(INodeListener*); + + void removeNode(OUString const& aPath, bool bRemovedFromModel = false); + + void addHandler(IMessageHandler* ); + void removeHandler(IMessageHandler* ); + + void dispose(); + protected: + // ITreeListener implementation + virtual void changes(TreeChangeList const& , sal_Bool _bError); + virtual void changes(sal_Int32 _nNotificationId,const ::rtl::OUString& _rNotifyReason); + }; + + class ConfigChangeMultiplexer : public IConfigBroadcaster, private INodeListener, private IMessageHandler + { + class Impl; + Impl* pImpl; + IConfigBroadcaster* m_pSource; + public: + ConfigChangeMultiplexer(IConfigBroadcaster* aSource = 0); + ConfigChangeMultiplexer(OUString const& aBasePath, IConfigBroadcaster* aSource); + virtual ~ConfigChangeMultiplexer(); + + void bind(OUString const& aBasePath, IConfigBroadcaster* aSource = 0); + void rebind(IConfigBroadcaster* aSource); + void unbind(); + + void broadcast(Change const& anUpdate, OUString const& aRelativePath, sal_Bool bError = false); + void broadcast(Change const& anUpdate); + + public: + // IConfigBroadcaster implementation + void addListener(OUString const& aName, INodeListener* ); + void removeListener(INodeListener*); + + void removeNode(OUString const& aPath, bool bRemovedFromModel = false); + + void addHandler(IMessageHandler* ); + void removeHandler(IMessageHandler* ); + + void dispose(); + protected: + bool normalizePath(OUString& aPath); + + // IConfigListener implementation + virtual void disposing(IConfigBroadcaster* pSource); + + // INodeListener implementation + virtual void nodeChanged(Change const& aChange, OUString const& aPath, IConfigBroadcaster* pSource); + virtual void nodeDeleted(OUString const& aPath, IConfigBroadcaster* pSource); + + // IMessageHandler implementation + virtual void message(const OUString& rNotifyReason, sal_Int32 nNotificationId, IConfigBroadcaster* pSource); + }; + + class ScreenedChangeMultiplexer : public ConfigChangeMultiplexer + { + typedef SubtreeChange ScreeningChange; + ScreeningChange* m_pScreeningChanges; + public: + ScreenedChangeMultiplexer(IConfigBroadcaster* aSource = 0); + ScreenedChangeMultiplexer(TreeChangeList& aScreeningTree, IConfigBroadcaster* aSource); + ScreenedChangeMultiplexer(ScreeningChange* aScreening, OUString const& aBasePath, IConfigBroadcaster* aSource); + + void bind(TreeChangeList& aScreeningTree, IConfigBroadcaster* aSource = 0); + void bind(ScreeningChange* aScreening, OUString const& aBasePath, IConfigBroadcaster* aSource = 0); + + protected: + virtual void nodeChanged(Change const& aChange, OUString const& aPath, IConfigBroadcaster* pSource); + virtual void nodeDeleted(OUString const& aPath, IConfigBroadcaster* pSource); + }; +} // namespace + +#endif // CONFIGMGR_API_EVENTS_HXX_ + + + diff --git a/configmgr/source/inc/confsvccomponent.hxx b/configmgr/source/inc/confsvccomponent.hxx new file mode 100644 index 000000000000..218ddb94c7f1 --- /dev/null +++ b/configmgr/source/inc/confsvccomponent.hxx @@ -0,0 +1,139 @@ +/************************************************************************* + * + * $RCSfile: confsvccomponent.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef CONFIGMGR_API_SVCCOMPONENT_HXX_ +#define CONFIGMGR_API_SVCCOMPONENT_HXX_ + +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif + +#ifndef _CPPUHELPER_COMPBASE1_HXX_ +#include <cppuhelper/compbase1.hxx> +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/Mutex.hxx> +#endif +#ifndef _RTL_USTRING_HXX_ +#include <rtl/ustring.hxx> +#endif + +namespace configmgr { + + namespace css = ::com::sun::star; + namespace uno = css::uno; + namespace lang = css::lang; + using ::rtl::OUString; + + typedef sal_Char const * AsciiServiceName; + struct ServiceInfo + { + AsciiServiceName implementationName; + AsciiServiceName const * serviceNames; + }; + + typedef ::cppu::WeakComponentImplHelper1< lang::XServiceInfo > ServiceImplBase; + + class ServiceComponentImpl + : public ServiceImplBase + { + protected: + ::osl::Mutex m_aMutex; + ServiceInfo const* const m_info; + public: + ServiceComponentImpl(ServiceInfo const* aInfo); + + // XTypeProvider + virtual uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) throw(uno::RuntimeException); + //virtual uno::Sequence<uno::Type> SAL_CALL getTypes( ) throw(uno::RuntimeException) = 0; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) throw(uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(uno::RuntimeException); + virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(uno::RuntimeException); + + // Component Helper - force override + virtual void SAL_CALL disposing() = 0; + // Component Helper - check object state + virtual void checkAlive() throw (uno::RuntimeException); + void checkAlive(char const* message) throw (uno::RuntimeException) + { checkAlive( OUString::createFromAscii(message) ); } + void checkAlive(OUString const& message) throw (uno::RuntimeException); + + // Extra helpers + static sal_Int32 countServices(ServiceInfo const* aInfo); + static uno::Sequence< OUString > getServiceNames(ServiceInfo const* aInfo) throw(uno::RuntimeException); + static uno::Sequence<sal_Int8> getStaticImplementationId(ServiceInfo const* pServiceInfo) throw(uno::RuntimeException); + + private: // no implementation + ServiceComponentImpl(ServiceComponentImpl&); + void operator=(ServiceComponentImpl&); + }; + +} // namespace configmgr + +#endif // CONFIGMGR_API_SVCCOMPONENT_HXX_ + + diff --git a/configmgr/source/inc/filehelper.hxx b/configmgr/source/inc/filehelper.hxx new file mode 100644 index 000000000000..fb9d6f3282a1 --- /dev/null +++ b/configmgr/source/inc/filehelper.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * $RCSfile: filehelper.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:41 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONFIGMGR_FILEHELPER_HXX_ +#define _CONFIGMGR_FILEHELPER_HXX_ + +#ifndef _OSL_FILE_HXX_ +#include <osl/file.hxx> +#endif + +namespace configmgr +{ + class FileHelper + { + public: + + static sal_Int32 createBackupRemoveAndRename( + const rtl::OUString& _aFromURL, const rtl::OUString &_aToURL); + + static sal_Int32 tryToRemoveFile(const rtl::OUString& _aURL); + + static rtl::OUString createOSLErrorString(osl::FileBase::RC eError); + }; +} // namespace configmgr + +#endif diff --git a/configmgr/source/inc/oslstream.hxx b/configmgr/source/inc/oslstream.hxx new file mode 100644 index 000000000000..939227665245 --- /dev/null +++ b/configmgr/source/inc/oslstream.hxx @@ -0,0 +1,149 @@ +/************************************************************************* + * + * $RCSfile: oslstream.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:41 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONFIGMGR_OSLSTREAM_HXX_ +#define _CONFIGMGR_OSLSTREAM_HXX_ + +#ifndef _OSL_MUTEX_HXX_ //autogen wg. ::osl::Mutex +#include <osl/mutex.hxx> +#endif + +#ifndef _COM_SUN_STAR_IO_XOUTPUTSTREAM_HPP_ +#include <com/sun/star/io/XOutputStream.hpp> +#endif +#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_ +#include <com/sun/star/io/XInputStream.hpp> +#endif + +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif + +#ifndef _UTL_UNO3_HXX_ +#include <unotools/uno3.hxx> +#endif + +#ifndef _OSL_FILE_HXX_ +#include <osl/file.hxx> +#endif + + +namespace configmgr +{ + namespace stario = ::com::sun::star::io; + namespace staruno = ::com::sun::star::uno; + +//================================================================== +// FmUnoIOStream, +// stream zum schreiben un lesen von Daten, basieren auf File +//================================================================== + typedef ::cppu::WeakImplHelper1<stario::XInputStream> InputStreamWrapper_Base; + // needed for some compilers +class OSLInputStreamWrapper : public InputStreamWrapper_Base +{ + ::osl::Mutex m_aMutex; + ::osl::File* m_pFile; + sal_Bool m_bFileOwner : 1; + +public: + OSLInputStreamWrapper(::osl::File& _rStream); + OSLInputStreamWrapper(::osl::File* pStream, sal_Bool bOwner=sal_False); + virtual ~OSLInputStreamWrapper(); + +// UNO Anbindung + DECLARE_UNO3_AGG_DEFAULTS(OSLInputStreamWrapper, InputStreamWrapper_Base); + +// stario::XInputStream + virtual sal_Int32 SAL_CALL readBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException); + virtual sal_Int32 SAL_CALL readSomeBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException); + virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException); + virtual sal_Int32 SAL_CALL available() throw(stario::NotConnectedException, staruno::RuntimeException); + virtual void SAL_CALL closeInput() throw(stario::NotConnectedException, staruno::RuntimeException); +}; + +//================================================================== +// FmUnoOutStream, +// Datensenke fuer Files +//================================================================== +typedef ::cppu::WeakImplHelper1<stario::XOutputStream> OutputStreamWrapper_Base; + // needed for some compilers +class OSLOutputStreamWrapper : public OutputStreamWrapper_Base +{ + ::osl::File& rFile; + +public: + OSLOutputStreamWrapper(::osl::File& _rFile) :rFile(_rFile) { } + +// UNO Anbindung + DECLARE_UNO3_AGG_DEFAULTS(OSLOutputStreamWrapper, OutputStreamWrapper_Base); + +// stario::XOutputStream + virtual void SAL_CALL writeBytes(const staruno::Sequence< sal_Int8 >& aData) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException); + virtual void SAL_CALL flush() throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException); + virtual void SAL_CALL closeOutput() throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException); +}; + +} // namespace configmgr + +#endif // _CONFIGMGR_OSLSTREAM_HXX_ + + + diff --git a/configmgr/source/inc/strdecl.hxx b/configmgr/source/inc/strdecl.hxx new file mode 100644 index 000000000000..154d11f631f3 --- /dev/null +++ b/configmgr/source/inc/strdecl.hxx @@ -0,0 +1,113 @@ +/************************************************************************* + * + * $RCSfile: strdecl.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:41 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONFIGMGR_STRDECL_HXX_ +#define _CONFIGMGR_STRDECL_HXX_ + +#ifndef _CONFIGMGR_STRINGS_HXX_ +#include "strings.hxx" +#endif + +//......................................................................... +namespace configmgr +{ +//......................................................................... + +// extern declaration for predefined strings, uncompleted + DECLARE_CONSTASCII_USTRING(TAG_VALUE); + DECLARE_CONSTASCII_USTRING(TAG_USERVALUE); + DECLARE_CONSTASCII_USTRING(TAG_VALUE_ITEM); + DECLARE_CONSTASCII_USTRING(TAG_DEFAULT_ITEM); + DECLARE_CONSTASCII_USTRING(TAG_NODEFAULT); + DECLARE_CONSTASCII_USTRING(TAG_DEFAULT); + DECLARE_CONSTASCII_USTRING(TAG_DEFAULTVALUE); + DECLARE_CONSTASCII_USTRING(TAG_DATA); + + DECLARE_CONSTASCII_USTRING(TYPE_BOOLEAN); + DECLARE_CONSTASCII_USTRING(TYPE_SHORT); + DECLARE_CONSTASCII_USTRING(TYPE_INT); + DECLARE_CONSTASCII_USTRING(TYPE_LONG); + DECLARE_CONSTASCII_USTRING(TYPE_DOUBLE); + DECLARE_CONSTASCII_USTRING(TYPE_STRING); + DECLARE_CONSTASCII_USTRING(TYPE_BINARY); + DECLARE_CONSTASCII_USTRING(TYPE_SET); + DECLARE_CONSTASCII_USTRING(TYPE_GROUP); + + DECLARE_CONSTASCII_USTRING(ATTR_ENCODING_HEX); + DECLARE_CONSTASCII_USTRING(ATTR_NAME); + DECLARE_CONSTASCII_USTRING(ATTR_TYPE); + DECLARE_CONSTASCII_USTRING(ATTR_GROUP); + DECLARE_CONSTASCII_USTRING(ATTR_DERIVED); + DECLARE_CONSTASCII_USTRING(ATTR_INSTANCE); + DECLARE_CONSTASCII_USTRING(ATTR_ENCODING); + DECLARE_CONSTASCII_USTRING(ATTR_MODE); + DECLARE_CONSTASCII_USTRING(ATTR_PATH); + DECLARE_CONSTASCII_USTRING(ATTR_DERIVED_LIST); + DECLARE_CONSTASCII_USTRING(ATTR_VALUE_ADD); + DECLARE_CONSTASCII_USTRING(ATTR_VALUE_REMOVE); + + DECLARE_CONSTASCII_USTRING(PARAM_OBJECT); + DECLARE_CONSTASCII_USTRING(PARAM_NAME); + DECLARE_CONSTASCII_USTRING(PARAM_ISNEWOBJECT); + + DECLARE_CONSTASCII_USTRING(XML_CDATA); +} // namespace configmgr +#endif + diff --git a/configmgr/source/inc/strings.hxx b/configmgr/source/inc/strings.hxx new file mode 100644 index 000000000000..9921b2efc597 --- /dev/null +++ b/configmgr/source/inc/strings.hxx @@ -0,0 +1,112 @@ +/************************************************************************* + * + * $RCSfile: strings.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:41 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONFIGMGR_STRINGS_HXX_ +#define _CONFIGMGR_STRINGS_HXX_ + +#ifndef _SAL_TYPES_H_ +#include <sal/types.h> +#endif + +#ifndef _RTL_USTRING_HXX_ +#include <rtl/ustring.hxx> +#endif + + +//......................................................................... +namespace configmgr +{ +//......................................................................... + +struct UStringDescription +{ + const sal_Char* m_pZeroTerminatedName; + sal_Int32 m_nLen; + rtl_TextEncoding m_encoding; + + UStringDescription(const sal_Char* _pName, sal_Int32 _nLen, rtl_TextEncoding _encoding) + { + m_pZeroTerminatedName = _pName; + m_nLen = _nLen; + m_encoding = _encoding; + m_aString = ::rtl::OUString(_pName, _nLen, _encoding); + } + operator ::rtl::OUString() const { + return m_aString; + } + +private: + rtl::OUString m_aString; + UStringDescription(); +}; + +#define DECLARE_CONSTASCII_USTRING(name) \ + extern ::configmgr::UStringDescription name + +#define IMPLEMENT_CONSTASCII_USTRING(name, asciivalue) \ + ::configmgr::UStringDescription name(RTL_CONSTASCII_USTRINGPARAM(asciivalue)) + +//......................................................................... +} // namespace frm +//......................................................................... + +#endif _CONFIGMGR_STRINGS_HXX_ + diff --git a/configmgr/source/inc/tracer.hxx b/configmgr/source/inc/tracer.hxx new file mode 100644 index 000000000000..27eba4317f86 --- /dev/null +++ b/configmgr/source/inc/tracer.hxx @@ -0,0 +1,180 @@ +/************************************************************************* + * + * $RCSfile: tracer.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:41 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONFIGMGR_TRACER_HXX_ +#define _CONFIGMGR_TRACER_HXX_ + +#if defined(DEBUG) || defined(_DEBUG) +#define CFG_ENABLE_TRACING +#endif + +#ifdef CFG_ENABLE_TRACING + +#ifndef _SAL_TYPES_H_ +#include <sal/types.h> +#endif +#include <rtl/string.hxx> +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#include <stdarg.h> +#include <stdio.h> + +#define OUSTRING2ASCII(rtlOUString) ::rtl::OString((rtlOUString).getStr(), (rtlOUString).getLength(), RTL_TEXTENCODING_ASCII_US).getStr() + +#define CFG_TRACE_INFO OTraceIndent aIndent; OConfigTracer::traceInfo +#define CFG_TRACE_WARNING OTraceIndent aIndent; OConfigTracer::traceWarning +#define CFG_TRACE_ERROR OTraceIndent aIndent; OConfigTracer::traceError +#define CFG_TRACE_INFO_NI OConfigTracer::traceInfo +#define CFG_TRACE_WARNING_NI OConfigTracer::traceWarning +#define CFG_TRACE_ERROR_NI OConfigTracer::traceError + +#define CFG_TRACE_TO_DEVICE OConfigTracer::traceToVirtualDevice + +namespace configmgr +{ + +struct OTracerSetup; +class OConfigTracer +{ + friend class OTraceIndent; + +protected: + static ::osl::Mutex s_aMutex; + static OTracerSetup* s_pImpl; + +private: + OConfigTracer(); // never implemented, no instantiation of this class allowed, only static members + +public: + static void traceInfo(const sal_Char* _pFormat, ...); + static void traceWarning(const sal_Char* _pFormat, ...); + static void traceError(const sal_Char* _pFormat, ...); + + static void traceToVirtualDevice(const sal_Char* _pDeviceName, const sal_Char* _pFormat, ...); + + static ::rtl::OString getTimeStamp(); + +protected: + static void implTrace(const sal_Char* _pType, const sal_Char* _pFormat, va_list args); + + static void inc(); + static void dec(); + + static void indent(); + + static void ensureData(); + static void ensureInitalized(); +}; + +class OTraceIndent +{ +public: + OTraceIndent() { OConfigTracer::inc(); } + ~OTraceIndent() { OConfigTracer::dec(); } +}; + +} // namespace configmgr + +#else // !(defined(DEBUG) || defined(_DEBUG)) + +#include <stdio.h> + +#define OUSTRING2ASCII(rtlOUString) "nothing" + +#define CFG_TRACE_INFO 1 ? (0) : printf +#define CFG_TRACE_WARNING 1 ? (0) : printf +#define CFG_TRACE_ERROR 1 ? (0) : printf +#define CFG_TRACE_INFO_NI 1 ? (0) : printf +#define CFG_TRACE_WARNING_NI 1 ? (0) : printf +#define CFG_TRACE_ERROR_NI 1 ? (0) : printf +#define CFG_TRACE_TO_DEVICE 1 ? (0) : printf + +#endif // (defined(DEBUG) || defined(_DEBUG)) + +#endif // _CONFIGMGR_TRACER_HXX_ + +//************************************************************************** +// history: +// $Log: not supported by cvs2svn $ +// Revision 1.6 2000/09/15 09:51:50 willem.vandorp +// OpenOffice header added +// +// Revision 1.5 2000/08/30 10:00:40 fs +// getTimeStamp +// +// Revision 1.4 2000/08/20 12:52:14 fs +// #77860# introduced an impl class; introduces virtual trace devices +// +// Revision 1.3 2000/08/10 11:37:30 hjs +// filled defines with correct dummies +// +// Revision 1.2 2000/08/10 06:53:08 fs +// m_bInitialized +// +// Revision 1.1 2000/08/09 18:53:41 fs +// helper classes for tracing +// +// +// Revision 1.0 09.08.00 13:10:04 fs +//************************************************************************** + diff --git a/configmgr/source/inc/treeactions.hxx b/configmgr/source/inc/treeactions.hxx new file mode 100644 index 000000000000..70b21d21b23e --- /dev/null +++ b/configmgr/source/inc/treeactions.hxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * $RCSfile: treeactions.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:41 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONFIGMGR_TREEACTIONS_HXX_ +#define _CONFIGMGR_TREEACTIONS_HXX_ + +#ifndef CONFIGMGR_CMTREEMODEL_HXX +#include "cmtreemodel.hxx" +#endif + +//.......................................................................... +namespace configmgr +{ +//.......................................................................... + +//========================================================================== +//= OChangeActionCounter +//========================================================================== +/** collects meta data about a changes tree +*/ +struct OChangeActionCounter : public ChangeTreeAction +{ + sal_Int32 nValues, nAdds, nAddUsers, nRemoves; + sal_Bool bDifferentSetActionLevels; + + OChangeActionCounter() :nValues(0), nAdds(0), nAddUsers(0), nRemoves(0), bDifferentSetActionLevels(sal_False) { } + + virtual void handle(ValueChange const& aValueNode) { ++nValues; } + virtual void handle(AddNode const& aAddNode); // moved to + virtual void handle(RemoveNode const& aRemoveNode) { ++nRemoves; } + virtual void handle(SubtreeChange const& aSubtree) + { + sal_Int32 nOldAdds(nAdds), nOldRemoves(nRemoves); + applyToChildren(aSubtree); + if ( ( nOldAdds + && (nAdds > nOldAdds) + ) + || ( nOldRemoves + && (nRemoves > nOldRemoves) + ) + ) + bDifferentSetActionLevels = sal_True; + } +}; + + +//.......................................................................... +} // namespace configmgr +//.......................................................................... + +#endif // _CONFIGMGR_TREEACTIONS_HXX_ + + diff --git a/configmgr/source/inc/typeconverter.hxx b/configmgr/source/inc/typeconverter.hxx new file mode 100644 index 000000000000..7c72df9c2587 --- /dev/null +++ b/configmgr/source/inc/typeconverter.hxx @@ -0,0 +1,112 @@ +/************************************************************************* + * + * $RCSfile: typeconverter.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:41 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef CONFIGMGR_TYPECONVERTER_HXX +#define CONFIGMGR_TYPECONVERTER_HXX + +#ifndef _COM_SUN_STAR_SCRIPT_XTYPECONVERTER_HPP_ +#include <com/sun/star/script/XTypeConverter.hpp> +#endif + +#ifndef _RTL_USTRING_HXX_ +#include <rtl/ustring.hxx> +#endif + +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_ +#include <com/sun/star/uno/Sequence.hxx> +#endif + +namespace configmgr +{ + namespace staruno = ::com::sun::star::uno; + namespace starscript = ::com::sun::star::script; + + // UNO Type handling + staruno::Type getSequenceElementType(staruno::Type const& rSequenceType); + + staruno::Type getBasicType(staruno::Type const& rType, bool& bSequence); + inline + staruno::Type getBasicType(staruno::Type const& rType) + { bool dummy; return getBasicType(rType,dummy); } + + // Any Conversion + staruno::Any toAny(const staruno::Reference< starscript::XTypeConverter >& xTypeConverter, const ::rtl::OUString& _rValue,const staruno::TypeClass& _rTypeClass) throw( starscript::CannotConvertException ); + rtl::OUString toString(const staruno::Reference< starscript::XTypeConverter >& xTypeConverter, const staruno::Any& rValue) throw( starscript::CannotConvertException ); + + // Type conversion + staruno::TypeClass toTypeClass(const ::rtl::OUString& _rType); + ::rtl::OUString toTypeName(const staruno::TypeClass& _rTypeClass); + + staruno::Type toType(const ::rtl::OUString& _rsType); + staruno::Type toListType(const ::rtl::OUString& _rsElementType); + ::rtl::OUString toTypeName(const staruno::Type& _rType); + + inline + staruno::Type toType(const ::rtl::OUString& _rsSimpleType, bool isList) + { + return isList ? toListType(_rsSimpleType) : toType(_rsSimpleType); + } + + inline staruno::Type getBinaryType() { return ::getCppuType(static_cast<staruno::Sequence<sal_Int8> const*>(0)); } + + +} // namespace configmgr + +#endif /* CONFIGMGR_TYPECONVERTER_HXX */ diff --git a/configmgr/source/misc/configunoreg.cxx b/configmgr/source/misc/configunoreg.cxx new file mode 100644 index 000000000000..ad01d187abd9 --- /dev/null +++ b/configmgr/source/misc/configunoreg.cxx @@ -0,0 +1,490 @@ +/************************************************************************* + * + * $RCSfile: configunoreg.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:41 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CPPUHELPER_FACTORY_HXX_ +#include <cppuhelper/factory.hxx> +#endif +#ifndef _UNO_LBNAMES_H_ +#include <uno/lbnames.h> +#endif +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif + +#ifndef CONFIGMGR_API_FACTORY_HXX_ +#include "confapifactory.hxx" +#endif + +#ifndef CONFIGMGR_API_SVCCOMPONENT_HXX_ +#include "confsvccomponent.hxx" +#endif +#ifndef CONFIGMGR_API_PROVIDER_HXX_ +#include "confprovider.hxx" +#endif + +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif +#ifndef _CPPUHELPER_IMPLBASE2_HXX_ +#include <cppuhelper/implbase2.hxx> +#endif +#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_ILLEGALARGUMENTEXCEPTION_HPP_ +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ +#include <com/sun/star/beans/PropertyValue.hpp> +#endif +#ifndef _UTL_STLTYPES_HXX_ +#include <unotools/stl_types.hxx> +#endif + +/********************************************************************************************/ + +using ::rtl::OUString; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::registry::XRegistryKey; +using ::com::sun::star::lang::XSingleServiceFactory; +using ::com::sun::star::lang::XMultiServiceFactory; +using configmgr::ServiceInfo; +using configmgr::AsciiServiceName; + +#define THISREF() static_cast< ::cppu::OWeakObject* >(this) + + +typedef Reference< XSingleServiceFactory > (SAL_CALL * createFactoryFunc) + ( + const Reference< XMultiServiceFactory > & rServiceManager, + const OUString & rComponentName, + ::cppu::ComponentInstantiation pCreateFunction, + const Sequence< OUString > & rServiceNames + ); + +// *************************************************************************************** + +namespace configmgr +{ + + using namespace ::com::sun::star::uno; + using namespace ::com::sun::star::lang; + using namespace ::com::sun::star::beans; + using namespace ::cppu; + using namespace ::osl; + +//======================================================================================= +//= OProviderFactory +//======================================================================================= + typedef ::cppu::WeakImplHelper1< ::com::sun::star::lang::XSingleServiceFactory > OProviderFactory_Base; + /** a special factory for the configuration provider, which implements some kind of + "shared multiple instances" factory. + */ + class OProviderFactory : public OProviderFactory_Base + { + protected: + ::osl::Mutex m_aMutex; + ::cppu::ComponentInstantiation m_pObjectCreator; + Reference< XMultiServiceFactory > m_xORB; + Reference< XInterface > m_xDefaultProvider; + + typedef ::com::sun::star::uno::WeakReference< XInterface > ProviderReference; + DECLARE_STL_USTRINGACCESS_MAP(ProviderReference, UserSpecificProvider); + UserSpecificProvider m_aUserProvider; + + public: + OProviderFactory( + const Reference< XMultiServiceFactory >& _rxORB, + ::cppu::ComponentInstantiation _pObjectCreator); + + virtual Reference< XInterface > SAL_CALL createInstance( ) throw(Exception, RuntimeException); + virtual Reference< XInterface > SAL_CALL createInstanceWithArguments( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException); + + Reference< XInterface > createProvider(); + Reference< XInterface > createProviderWithArguments(const Sequence< Any >& _rArguments); + + protected: + void ensureDefaultProvider(); + }; + + //======================================================================================= + //= OProviderFactory + //======================================================================================= + //--------------------------------------------------------------------------------------- + OProviderFactory::OProviderFactory(const Reference< XMultiServiceFactory >& _rxORB, ::cppu::ComponentInstantiation _pObjectCreator) + :m_pObjectCreator(_pObjectCreator) + ,m_xORB(_rxORB) + { + } + + //--------------------------------------------------------------------------------------- + void OProviderFactory::ensureDefaultProvider() + { + MutexGuard aGuard(m_aMutex); + if (m_xDefaultProvider.is()) + return; + m_xDefaultProvider = (*m_pObjectCreator)(m_xORB); + + // initialize it with an empty sequence, thus we ensure the provider establishes it's connection + Reference< XInitialization > xProvInit(m_xDefaultProvider, UNO_QUERY); + if (xProvInit.is()) + xProvInit->initialize(Sequence< Any >()); + + // TODO : we need direct access to the provider implementation. This way we won't need the XInitialization + // interface, and we don't need this weird behaviour of initializing with an empty argument sequence + } + + //--------------------------------------------------------------------------------------- + Reference< XInterface > OProviderFactory::createProvider() + { + MutexGuard aGuard(m_aMutex); + ensureDefaultProvider(); + return m_xDefaultProvider; + } + + //--------------------------------------------------------------------------------------- + Reference< XInterface > OProviderFactory::createProviderWithArguments(const Sequence< Any >& _rArguments) + { + MutexGuard aGuard(m_aMutex); + ::rtl::OUString sUser; + // #78409 + // if a provider is queried with a password, we always create a new instance for him, + // as don't wan't to the passwords for the user. + ::rtl::OUString sPassword; + bool bPasswordUsed = false; + + const Any* pArguments = _rArguments.getConstArray(); + PropertyValue aCurrentArg; + for (sal_Int32 i=0; i<_rArguments.getLength(); ++i, ++pArguments) + { + if (!((*pArguments) >>= aCurrentArg)) + throw IllegalArgumentException(::rtl::OUString::createFromAscii("Arguments have to be com.sun.star.beans.PropertyValue's."), NULL, i); + if (0 == aCurrentArg.Name.compareToAscii("user")) + { + if (!(aCurrentArg.Value >>= sUser) || !sUser.getLength()) + throw IllegalArgumentException(::rtl::OUString::createFromAscii("The user name specified is invalid."), NULL, i); + } + + // sesions which query for a password are always one instance + if (0 == aCurrentArg.Name.compareToAscii("password")) + { + bPasswordUsed = true; + if (!(aCurrentArg.Value >>= sPassword)) + throw IllegalArgumentException(::rtl::OUString::createFromAscii("The password specified is invalid."), NULL, i); + } + } + + Reference< XInterface > xThisUsersProvider; + if (!bPasswordUsed) + { + UserSpecificProviderIterator aExistentProvider = m_aUserProvider.find(sUser); + if (m_aUserProvider.end() != aExistentProvider) + xThisUsersProvider = aExistentProvider->second; + } + + if (!xThisUsersProvider.is()) + { + xThisUsersProvider = (*m_pObjectCreator)(m_xORB); + if (!bPasswordUsed) + m_aUserProvider[sUser] = xThisUsersProvider; + + // initialize it + Reference< XInitialization > xProvInit(xThisUsersProvider, UNO_QUERY); + if (xProvInit.is()) + xProvInit->initialize(_rArguments); + } + + return xThisUsersProvider; + } + + //--------------------------------------------------------------------------------------- + Reference< XInterface > SAL_CALL OProviderFactory::createInstance( ) throw(Exception, RuntimeException) + { + // default provider + return createProvider(); + } + + //--------------------------------------------------------------------------------------- + Reference< XInterface > SAL_CALL OProviderFactory::createInstanceWithArguments( const Sequence< Any >& _rArguments ) throw(Exception, RuntimeException) + { + return createProviderWithArguments(_rArguments); + } + + //======================================================================================= + Reference< XSingleServiceFactory > SAL_CALL createProviderFactory( + const Reference< XMultiServiceFactory > & rServiceManager, + const OUString & rComponentName, + ::cppu::ComponentInstantiation pCreateFunction, + const Sequence< OUString > & rServiceNames + ) + { + OSL_ENSHURE(0 == rComponentName.compareToAscii(ConfigurationProvider::staticServiceInfo.implementationName), + "configmgr::createProviderFactory : invalid argument !"); + return new OProviderFactory(rServiceManager, pCreateFunction); + } + +} // namespace configmgr + +// *************************************************************************************** +// +// Die vorgeschriebene C-Api muss erfuellt werden! +// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen. +// + +//--------------------------------------------------------------------------------------- +void REGISTER_PROVIDER( + const OUString& aServiceImplName, + const Sequence<OUString>& Services, + const Reference< XRegistryKey > & xKey) +{ + OUString aMainKeyName(OUString(RTL_CONSTASCII_USTRINGPARAM("/"))); + aMainKeyName += aServiceImplName; + aMainKeyName += OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES")); + + Reference< XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) ); + OSL_ENSHURE(xNewKey.is(), "CONFMGR::component_writeInfo : could not create a registry key !"); + + for (sal_uInt32 i=0; i<Services.getLength(); ++i) + xNewKey->createKey(Services[i]); +} + + +//--------------------------------------------------------------------------------------- +void RegisterService( + const ServiceInfo* pInfo, + const Reference< XRegistryKey > & xKey) +{ + if (pInfo == 0 || pInfo->serviceNames==0 || pInfo->implementationName==0) + return; + + OUString aMainKeyName(OUString(RTL_CONSTASCII_USTRINGPARAM("/"))); + aMainKeyName += OUString::createFromAscii(pInfo->implementationName); + aMainKeyName += OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES")); + + Reference< XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) ); + OSL_ENSHURE(xNewKey.is(), "CONFMGR::component_writeInfo : could not create a registry key !"); + + AsciiServiceName const* p = pInfo->serviceNames; + if (p != 0) + for( ; *p; ++p) + { + xNewKey->createKey(OUString::createFromAscii(*p)); + } +} + +//--------------------------------------------------------------------------------------- +struct ProviderRequest +{ + Reference< XSingleServiceFactory > xRet; + Reference< XMultiServiceFactory > const xServiceManager; + OUString const sImplementationName; + + ProviderRequest( + void* pServiceManager, + sal_Char const* pImplementationName + ) + : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager)) + , sImplementationName(OUString::createFromAscii(pImplementationName)) + { + } + + inline + sal_Bool CREATE_PROVIDER( + const OUString& Implname, + const Sequence< OUString > & Services, + ::cppu::ComponentInstantiation Factory, + createFactoryFunc creator + ) + { + if (!xRet.is() && (Implname == sImplementationName)) + try + { + OSL_ENSHURE(!xRet.is(), "CREATE_PROVIDER : invalid : already have a return value !"); + if (xRet.is()) + xRet->release(); + + xRet = creator( xServiceManager, sImplementationName,Factory, Services); + OSL_ENSHURE(xRet.is(), "CREATE_PROVIDER : invalid return value !"); + + if (xRet.is()) + xRet->acquire(); + // we want to transport the interface pointer as flat C void pointer, so this prevents deletion + } + catch(...) + { + } + return xRet.is(); + } + + inline + sal_Bool CreateProvider( + const ServiceInfo* pInfo, + ::cppu::ComponentInstantiation Factory, + createFactoryFunc creator + ) + { + OSL_ENSHURE(!xRet.is(), "CreateProvider : invalid : we already have a return value !"); + if (xRet.is()) + return true; //xRet->release(); + + if (!xRet.is() && pInfo!=0 && (0 == sImplementationName.compareToAscii(pInfo->implementationName))) + try + { + const Sequence< OUString > Services= configmgr::ServiceComponentImpl::getServiceNames(pInfo); + + xRet = creator( xServiceManager, OUString::createFromAscii(pInfo->implementationName),Factory, Services); + OSL_ENSHURE(xRet.is(), "CreateProvider : WHERE IS THE return value !"); + + if (xRet.is()) + xRet->acquire(); + // we want to transport the interface pointer as flat C void pointer, so this prevents deletion + } + catch(...) + { + } + return xRet.is(); + } + + void* getProvider() const { return xRet.get(); } +}; + +//--------------------------------------------------------------------------------------- + +extern "C" void SAL_CALL component_getImplementationEnvironment( + const sal_Char **ppEnvTypeName, + uno_Environment **ppEnv + ) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +//--------------------------------------------------------------------------------------- +extern "C" sal_Bool SAL_CALL component_writeInfo( + void* pServiceManager, + void* pRegistryKey + ) +{ + if (pRegistryKey) + try + { + Reference< XRegistryKey > xKey(reinterpret_cast<XRegistryKey*>(pRegistryKey)); + + RegisterService(&configmgr::ConfigurationProvider::staticServiceInfo, xKey); + + RegisterService(configmgr::getConfigurationRegistryServiceInfo(), xKey); + + // im/export + RegisterService(configmgr::getDataExportServiceInfo(), xKey); + RegisterService(configmgr::getDataImportServiceInfo(), xKey); + + return sal_True; + } + catch (::com::sun::star::registry::InvalidRegistryException& ) + { + OSL_ENSHURE(sal_False, "SBA::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); + } + + return sal_False; +} + +//--------------------------------------------------------------------------------------- +extern "C" void* SAL_CALL component_getFactory( + const sal_Char* pImplementationName, + void* pServiceManager, + void* pRegistryKey) +{ + void* pRet = 0; + if (pServiceManager) + { + ProviderRequest aReq(pServiceManager,pImplementationName); + + aReq.CreateProvider( + &configmgr::ConfigurationProvider::staticServiceInfo, + &configmgr::instantiateProvider, + ::configmgr::createProviderFactory) + || + aReq.CreateProvider( + configmgr::getConfigurationRegistryServiceInfo(), + &configmgr::instantiateConfigRegistry, + ::cppu::createSingleFactory) + || + /* Export */ + aReq.CreateProvider( + configmgr::getDataExportServiceInfo(), + &configmgr::instantiateDataExport, + ::cppu::createSingleFactory) + || + /* Import */ + aReq.CreateProvider( + configmgr::getDataImportServiceInfo(), + &configmgr::instantiateDataImport, + ::cppu::createSingleFactory) + || + false; + + pRet = aReq.getProvider(); + } + + return pRet; +}; +//--------------------------------------------------------------------------------------- + diff --git a/configmgr/source/misc/filehelper.cxx b/configmgr/source/misc/filehelper.cxx new file mode 100644 index 000000000000..f7bb7ec7138e --- /dev/null +++ b/configmgr/source/misc/filehelper.cxx @@ -0,0 +1,320 @@ +/************************************************************************* + * + * $RCSfile: filehelper.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:41 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef _RTL_USTRING_H_ +#include <rtl/ustring.hxx> +#endif + +#ifndef _OSL_FILE_HXX_ +#include <osl/file.hxx> +#endif + +#ifndef _CONFIGMGR_FILEHELPER_HXX_ +#include "filehelper.hxx" +#endif + +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif + + +namespace configmgr +{ +using namespace ::osl; + +#define ASCII(x) rtl::OUString::createFromAscii(x) +// ---------------------------- tryToRemoveFile ---------------------------- + sal_Int32 FileHelper::tryToRemoveFile(const rtl::OUString& _aURL) + { + { + File aFile(_aURL); + FileBase::RC eError = aFile.open(OpenFlag_Read); + if (eError != osl_File_E_None) + { + // IF not exists + return 0; + } + aFile.close(); + } + FileBase::RC eError = File::remove(_aURL); + if (eError != osl_File_E_None) + { + rtl::OUString sError = ASCII("tryToRemoveFile: "); + sError += FileHelper::createOSLErrorString(eError); + sError += ASCII("\n with URL: "); + sError += _aURL; + rtl::OString aStr = rtl::OUStringToOString(sError,RTL_TEXTENCODING_ASCII_US); + OSL_ENSHURE(0, aStr.getStr()); + return 1; + } + return 0; + } + +// ----------------------------------------------------------------------------- + sal_Int32 FileHelper::createBackupRemoveAndRename( + const rtl::OUString& _aFromURL, const rtl::OUString &_aToURL) + { + // remove FromURL + // rename ToURL to FromURL + if (FileHelper::tryToRemoveFile(_aFromURL) != 0) + return 1; + + FileBase::RC eError = File::move(_aToURL, _aFromURL); + if (eError != osl_File_E_None) + { + rtl::OUString sError = ASCII("createBackupAndRemove: ") + FileHelper::createOSLErrorString(eError) + ASCII("\n with URL: ") + _aFromURL; + rtl::OString aStr = rtl::OUStringToOString(sError,RTL_TEXTENCODING_ASCII_US); + OSL_ENSHURE(0, aStr.getStr()); + return 2; + } + return 0; + } +// ------------------ Create a string from FileBase::RC Error ------------------ + rtl::OUString FileHelper::createOSLErrorString(FileBase::RC eError) + { + rtl::OUString aRet; + switch(eError) + { + case osl_File_E_None: + aRet = ASCII(""); + break; + + case osl_File_E_PERM: + aRet = ASCII("Operation not permitted"); + break; + + case osl_File_E_NOENT: + aRet = ASCII("No such file or directory"); + break; + + case osl_File_E_SRCH: + aRet = ASCII("unknown error: osl_File_E_SRCH"); + break; + + case osl_File_E_INTR: + aRet = ASCII("function call was interrupted"); + break; + + case osl_File_E_IO: + aRet = ASCII("I/O error"); + break; + + case osl_File_E_NXIO: + aRet = ASCII("No such device or address"); + break; + + case osl_File_E_2BIG: + aRet = ASCII("unknown error: osl_File_E_2BIG"); + break; + + case osl_File_E_NOEXEC: + aRet = ASCII("unknown error: osl_File_E_NOEXEC"); + break; + + case osl_File_E_BADF: + aRet = ASCII("Bad file"); + break; + + case osl_File_E_CHILD: + aRet = ASCII("unknown error: osl_File_E_CHILD"); + break; + + case osl_File_E_AGAIN: + aRet = ASCII("Operation would block"); + break; + + case osl_File_E_NOMEM: + aRet = ASCII("not enough memory for allocating structures"); + break; + + case osl_File_E_ACCES: + aRet = ASCII("Permission denied"); + break; + + case osl_File_E_FAULT: + aRet = ASCII("Bad address"); + break; + + case osl_File_E_BUSY: + aRet = ASCII("Text file busy"); + break; + + case osl_File_E_EXIST: + aRet = ASCII("File exists"); + break; + + case osl_File_E_XDEV: + aRet = ASCII("unknown error: osl_File_E_XDEV"); + break; + + case osl_File_E_NODEV: + aRet = ASCII("No such device"); + break; + + case osl_File_E_NOTDIR: + aRet = ASCII("Not a directory"); + break; + + case osl_File_E_ISDIR: + aRet = ASCII("Is a director"); + break; + + case osl_File_E_INVAL: + aRet = ASCII("the format of the parameters was not valid"); + break; + + case osl_File_E_NFILE: + aRet = ASCII("too many open files in the system"); + break; + + case osl_File_E_MFILE: + aRet = ASCII("too many open files used by the process"); + break; + + case osl_File_E_NOTTY: + aRet = ASCII("unknown error: osl_File_E_NOTTY"); + break; + + case osl_File_E_FBIG: + aRet = ASCII("File too large"); + break; + + case osl_File_E_NOSPC: + aRet = ASCII("No space left on device"); + break; + + case osl_File_E_SPIPE: + aRet = ASCII("unknown error: osl_File_E_SPIPE"); + break; + + case osl_File_E_ROFS: + aRet = ASCII("Read-only file system"); + break; + + case osl_File_E_MLINK: + aRet = ASCII("Too many links"); + break; + + case osl_File_E_PIPE: + aRet = ASCII("unknown error: osl_File_E_PIPE"); + break; + + case osl_File_E_DOM: + aRet = ASCII("unknown error: osl_File_E_DOM"); + break; + + case osl_File_E_RANGE: + aRet = ASCII("unknown error: osl_File_E_RANGE"); + break; + + case osl_File_E_DEADLK: + aRet = ASCII("unknown error: osl_File_E_DEADLK"); + break; + + case osl_File_E_NAMETOOLONG: + aRet = ASCII("File name too long"); + break; + + case osl_File_E_NOLCK: + aRet = ASCII("No record locks available"); + break; + + case osl_File_E_NOSYS: + aRet = ASCII("Function not implemente"); + break; + + case osl_File_E_NOTEMPTY: + aRet = ASCII("Directory not empt"); + break; + + case osl_File_E_LOOP: + aRet = ASCII("Too many symbolic links encountered"); + break; + + case osl_File_E_ILSEQ: + aRet = ASCII("unknown error: osl_File_E_ILSEQ"); + break; + + case osl_File_E_NOLINK: + aRet = ASCII("Link has been severed"); + break; + + case osl_File_E_MULTIHOP: + aRet = ASCII("Multihop attempted"); + break; + + case osl_File_E_USERS: + aRet = ASCII("unknown error: osl_File_E_USERS"); + break; + + case osl_File_E_OVERFLOW: + aRet = ASCII("Value too large for defined data type"); + break; + + /* unmapped error: always last entry in enum! */ + case osl_File_E_invalidError: + aRet = ASCII("unmapped Error"); + break; + } + return aRet; + } +} // namespace configmgr diff --git a/configmgr/source/misc/makefile.mk b/configmgr/source/misc/makefile.mk new file mode 100644 index 000000000000..38808828d11e --- /dev/null +++ b/configmgr/source/misc/makefile.mk @@ -0,0 +1,100 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:13:41 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. +PRJINC=$(PRJ)$/source +PRJNAME=configmgr +TARGET=misc + +#ENABLE_EXCEPTIONS=TRUE + +# --- Settings ---------------------------------- + +.INCLUDE : settings.mk + +# --- Files ------------------------------------- + +EXCEPTIONSFILES = \ + $(SLO)$/saxtools.obj \ + $(SLO)$/oslstream.obj \ + $(SLO)$/attributes.obj \ + $(SLO)$/confname.obj \ + $(SLO)$/configmodule.obj \ + $(SLO)$/configunoreg.obj \ + +SLOFILES= \ + $(SLO)$/tracer.obj \ + $(SLO)$/saxtools.obj \ + $(SLO)$/oslstream.obj \ + $(SLO)$/attributes.obj \ + $(SLO)$/confname.obj \ + $(SLO)$/configmodule.obj \ + $(SLO)$/configunoreg.obj \ + $(SLO)$/synchronize.obj \ + $(SLO)$/filehelper.obj \ + $(SLO)$/strimpl.obj \ + $(SLO)$/strconverter.obj \ + +# --- Targets ---------------------------------- + +.INCLUDE : target.mk + diff --git a/configmgr/source/misc/oslstream.cxx b/configmgr/source/misc/oslstream.cxx new file mode 100644 index 000000000000..1fe03b22ec7e --- /dev/null +++ b/configmgr/source/misc/oslstream.cxx @@ -0,0 +1,239 @@ +/************************************************************************* + * + * $RCSfile: oslstream.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:41 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONFIGMGR_OSLSTREAM_HXX_ +#include "oslstream.hxx" +#endif + +//#ifndef _STREAM_HXX //autogen +//#include <tools/stream.hxx> +//#endif +//#ifndef _TOOLS_DEBUG_HXX +//#include <tools/debug.hxx> +//#endif + +namespace configmgr +{ + using namespace osl; + +//------------------------------------------------------------------ +OSLInputStreamWrapper::OSLInputStreamWrapper( File& _rFile ) + :m_pFile(&_rFile) + ,m_bFileOwner(sal_False) +{ +} + +//------------------------------------------------------------------ +OSLInputStreamWrapper::OSLInputStreamWrapper( File* pStream, sal_Bool bOwner ) + :m_pFile( pStream ) + ,m_bFileOwner( bOwner ) +{ +} + +//------------------------------------------------------------------ +OSLInputStreamWrapper::~OSLInputStreamWrapper() +{ + if( m_bFileOwner ) + delete m_pFile; +} + +//------------------------------------------------------------------------------ +sal_Int32 SAL_CALL OSLInputStreamWrapper::readBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead) + throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException ) +{ + if (!m_pFile) + throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this)); + + if (nBytesToRead < 0) + throw stario::BufferSizeExceededException(::rtl::OUString(),static_cast<staruno::XWeak*>(this)); + + ::osl::MutexGuard aGuard( m_aMutex ); + + aData.realloc(nBytesToRead); + + sal_uInt64 nRead = 0; + FileBase::RC eError = m_pFile->read((void*)aData.getArray(), nBytesToRead, nRead); + if (eError != osl_File_E_None) + throw stario::BufferSizeExceededException(::rtl::OUString(),static_cast<staruno::XWeak*>(this)); + + // Wenn gelesene Zeichen < MaxLength, staruno::Sequence anpassen + if (nRead < (sal_uInt32)nBytesToRead) + aData.realloc( nRead ); + + return nRead; +} + +//------------------------------------------------------------------------------ +sal_Int32 SAL_CALL OSLInputStreamWrapper::readSomeBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead) throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException ) +{ + if (!m_pFile) + throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this)); + + if (nMaxBytesToRead < 0) + throw stario::BufferSizeExceededException(::rtl::OUString(),static_cast<staruno::XWeak*>(this)); + + /* + if (m_pFile->IsEof()) + { + aData.realloc(0); + return 0; + } + else + */ + return readBytes(aData, nMaxBytesToRead); +} + +//------------------------------------------------------------------------------ +void SAL_CALL OSLInputStreamWrapper::skipBytes(sal_Int32 nBytesToSkip) throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (!m_pFile) + throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this)); + + sal_uInt64 nCurrentPos; + m_pFile->getPos(nCurrentPos); + + sal_uInt64 nNewPos = nCurrentPos + nBytesToSkip; + FileBase::RC eError = m_pFile->setPos(osl_Pos_Absolut, nNewPos); + if (eError != osl_File_E_None) + { + throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this)); + } + +#ifdef DBG_UTIL + m_pFile->getPos(nCurrentPos); + volatile int dummy = 0; // to take a look at last changes ;-) +#endif +} + +//------------------------------------------------------------------------------ +sal_Int32 SAL_CALL OSLInputStreamWrapper::available() throw( stario::NotConnectedException, staruno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (!m_pFile) + throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this)); + + sal_uInt64 nPos; + FileBase::RC eError = m_pFile->getPos(nPos); + if (eError != osl_File_E_None) + throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this)); + + sal_uInt64 nDummy = 0; + eError = m_pFile->setPos(Pos_End, nDummy); + if (eError != osl_File_E_None) + throw stario::NotConnectedException(::rtl::OUString(),static_cast<staruno::XWeak*>(this)); + + sal_uInt64 nAvailable; + eError = m_pFile->getPos(nAvailable); + if (eError != osl_File_E_None) + throw stario::NotConnectedException(::rtl::OUString(),static_cast<staruno::XWeak*>(this)); + + nAvailable = nAvailable - nPos; + eError = m_pFile->setPos(Pos_Absolut, nPos); + if (eError != osl_File_E_None) + throw stario::NotConnectedException(::rtl::OUString(),static_cast<staruno::XWeak*>(this)); + return nAvailable; +} + +//------------------------------------------------------------------------------ +void SAL_CALL OSLInputStreamWrapper::closeInput() throw( stario::NotConnectedException, staruno::RuntimeException ) +{ + if (!m_pFile) + throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this)); + + m_pFile->close(); + if (m_bFileOwner) + delete m_pFile; + + m_pFile = NULL; +} + +/*************************************************************************/ +// stario::XOutputStream +//------------------------------------------------------------------------------ +void SAL_CALL OSLOutputStreamWrapper::writeBytes(const staruno::Sequence< sal_Int8 >& aData) throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException ) +{ + sal_uInt64 nWritten; + if (aData.getLength() != 0) + { + FileBase::RC eError = rFile.write(aData.getConstArray(),aData.getLength(), nWritten); + if (eError != osl_File_E_None || nWritten != aData.getLength()) + { + throw stario::BufferSizeExceededException(::rtl::OUString(),static_cast<staruno::XWeak*>(this)); + } + } +} + + +//------------------------------------------------------------------ +void SAL_CALL OSLOutputStreamWrapper::flush() throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException ) +{ +} + +//------------------------------------------------------------------ +void SAL_CALL OSLOutputStreamWrapper::closeOutput() throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException ) +{ + rFile.close(); +} + +} // namespace configmgr + + diff --git a/configmgr/source/misc/strimpl.cxx b/configmgr/source/misc/strimpl.cxx new file mode 100644 index 000000000000..bf872dd58c3c --- /dev/null +++ b/configmgr/source/misc/strimpl.cxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * $RCSfile: strimpl.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:41 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONFIGMGR_STRINGS_HXX_ +#include "strings.hxx" +#endif + +namespace configmgr +{ + // tag names + // <name>...</name> + IMPLEMENT_CONSTASCII_USTRING(TAG_VALUE, "cfg:value"); + IMPLEMENT_CONSTASCII_USTRING(TAG_USERVALUE, "uservalue"); + IMPLEMENT_CONSTASCII_USTRING(TAG_VALUE_ITEM, "value_item"); + IMPLEMENT_CONSTASCII_USTRING(TAG_DEFAULT_ITEM, "default_item"); + IMPLEMENT_CONSTASCII_USTRING(TAG_NODEFAULT, "nodefault"); + IMPLEMENT_CONSTASCII_USTRING(TAG_DEFAULT, "default"); + IMPLEMENT_CONSTASCII_USTRING(TAG_DEFAULTVALUE, "defaultvalue"); + IMPLEMENT_CONSTASCII_USTRING(TAG_DATA, "data"); + + // simple types Attribut params + IMPLEMENT_CONSTASCII_USTRING(TYPE_BOOLEAN, "boolean"); + IMPLEMENT_CONSTASCII_USTRING(TYPE_SHORT, "short"); + IMPLEMENT_CONSTASCII_USTRING(TYPE_INT, "int"); + IMPLEMENT_CONSTASCII_USTRING(TYPE_LONG, "long"); + IMPLEMENT_CONSTASCII_USTRING(TYPE_DOUBLE, "double"); + IMPLEMENT_CONSTASCII_USTRING(TYPE_STRING, "string"); + + // Type: Sequence<bytes> + IMPLEMENT_CONSTASCII_USTRING(TYPE_BINARY, "binary"); + + // special types + IMPLEMENT_CONSTASCII_USTRING(TYPE_SET, "set"); + IMPLEMENT_CONSTASCII_USTRING(TYPE_GROUP, "group"); + + + // Attributes name="..." + IMPLEMENT_CONSTASCII_USTRING(ATTR_ENCODING_HEX, "hex"); + IMPLEMENT_CONSTASCII_USTRING(ATTR_NAME, "name"); + IMPLEMENT_CONSTASCII_USTRING(ATTR_TYPE, "cfg:type"); + + IMPLEMENT_CONSTASCII_USTRING(ATTR_GROUP, "group"); + IMPLEMENT_CONSTASCII_USTRING(ATTR_DERIVED, "derived"); + IMPLEMENT_CONSTASCII_USTRING(ATTR_INSTANCE, "cfg:element-type"); + IMPLEMENT_CONSTASCII_USTRING(ATTR_ENCODING, "encoding"); + IMPLEMENT_CONSTASCII_USTRING(ATTR_MODE, "mode"); + IMPLEMENT_CONSTASCII_USTRING(ATTR_PATH, "path"); + + // some Attribute params + IMPLEMENT_CONSTASCII_USTRING(ATTR_DERIVED_LIST, "list"); + IMPLEMENT_CONSTASCII_USTRING(ATTR_VALUE_ADD, "add"); + IMPLEMENT_CONSTASCII_USTRING(ATTR_VALUE_REMOVE, "remove"); + + // Parameter + IMPLEMENT_CONSTASCII_USTRING(PARAM_OBJECT, "Object"); + IMPLEMENT_CONSTASCII_USTRING(PARAM_NAME, "Name"); + IMPLEMENT_CONSTASCII_USTRING(PARAM_ISNEWOBJECT, "IsNewObject"); + + IMPLEMENT_CONSTASCII_USTRING(XML_CDATA, "CDATA"); + +// emacs: +// create the declare from the implement +// (fset 'create-declare-from-implement +// [home M-right ?\C- ?\C-s ?, left right left ?\M-w f12 return up tab ?D ?E ?C ?L ?A ?R ?E ?\C-y ?) ?; home down f12 home down]) + +} // namespace configmgr diff --git a/configmgr/source/misc/tracer.cxx b/configmgr/source/misc/tracer.cxx new file mode 100644 index 000000000000..64dbf87e5d1a --- /dev/null +++ b/configmgr/source/misc/tracer.cxx @@ -0,0 +1,396 @@ +/************************************************************************* + * + * $RCSfile: tracer.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:41 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +// SUNPRO5 does not like the following to be done after including stdio.h, that's why it's here at the very +// beginning of the file +#undef _TIME_T_DEFINED +#include <time.h> +#include <rtl/string.hxx> +#include <map> + +namespace configmgr +{ + typedef ::std::map< ::rtl::OString, void*, ::std::less< ::rtl::OString > > VirtualDevices; +} + +#ifndef _CONFIGMGR_TRACER_HXX_ +#include "tracer.hxx" +#endif + +#ifdef CFG_ENABLE_TRACING + +#include <stdlib.h> +#include <ctype.h> +#include <string.h> + +#define INFO 1 +#define WARNING 2 +#define ERROR 4 + +namespace configmgr +{ + +struct OTracerSetup +{ + sal_Int32 s_nTraceMask; + sal_Int32 s_nIndentDepth; + FILE* s_pOutputMedium; + sal_Bool s_bInitialized; + + VirtualDevices s_aDevices; + + OTracerSetup() + :s_nTraceMask(INFO | WARNING | ERROR) + ,s_nIndentDepth(0) + ,s_pOutputMedium(NULL) + ,s_bInitialized(sal_False) + { + } +}; + +//========================================================================== +//= OConfigTracer +//========================================================================== +::osl::Mutex OConfigTracer::s_aMutex; +OTracerSetup* OConfigTracer::s_pImpl = NULL; + +//-------------------------------------------------------------------------- +void OConfigTracer::ensureData() +{ + if (s_pImpl) + return; + s_pImpl = new OTracerSetup; +} + +//-------------------------------------------------------------------------- +void OConfigTracer::inc() +{ + ::osl::MutexGuard aGuard(s_aMutex); + ensureData(); + ++s_pImpl->s_nIndentDepth; +} + +//-------------------------------------------------------------------------- +void OConfigTracer::dec() +{ + ::osl::MutexGuard aGuard(s_aMutex); + ensureData(); + --s_pImpl->s_nIndentDepth; +} + +//-------------------------------------------------------------------------- +void OConfigTracer::traceInfo(const sal_Char* _pFormat, ...) +{ + ::osl::MutexGuard aGuard(s_aMutex); + ensureData(); + if (s_pImpl->s_nTraceMask & INFO) + { + va_list args; + va_start(args, _pFormat); + implTrace("info : ", _pFormat, args); + va_end(args); + } +} + +//-------------------------------------------------------------------------- +void OConfigTracer::traceWarning(const sal_Char* _pFormat, ...) +{ + ::osl::MutexGuard aGuard(s_aMutex); + ensureData(); + if (s_pImpl->s_nTraceMask & WARNING) + { + va_list args; + va_start(args, _pFormat); + implTrace("warning : ", _pFormat, args); + va_end(args); + } +} + +//-------------------------------------------------------------------------- +void OConfigTracer::traceError(const sal_Char* _pFormat, ...) +{ + ::osl::MutexGuard aGuard(s_aMutex); + ensureData(); + if (s_pImpl->s_nTraceMask & ERROR) + { + va_list args; + va_start(args, _pFormat); + implTrace("error : ", _pFormat, args); + va_end(args); + } +} + +//-------------------------------------------------------------------------- +void OConfigTracer::indent() +{ + for (sal_Int32 i=0; i<s_pImpl->s_nIndentDepth; ++i) + fprintf(s_pImpl->s_pOutputMedium, " "); +} + +//-------------------------------------------------------------------------- +FILE* disambiguate(const ::rtl::OString& _rFileName) +{ + FILE* pExistenceCheck = NULL; + sal_Int32 i = 1; + ::rtl::OString sLoop; + while (i <= 256) + { + sLoop = _rFileName; + sLoop += "."; + sLoop += ::rtl::OString::valueOf(i); + + pExistenceCheck = fopen(sLoop.getStr(), "r"); + if (!pExistenceCheck) + // does not exist + return fopen(sLoop.getStr(), "w+"); + + // already exists, try the next name + fclose(pExistenceCheck); + ++i; + } + + // could not open such a file + return NULL; +} + +//-------------------------------------------------------------------------- +void OConfigTracer::ensureInitalized() +{ + if (s_pImpl->s_bInitialized) + return; + + s_pImpl->s_bInitialized = sal_True; + + char* pSettings = getenv("ENVCFGFLAGS"); + if (!pSettings) + return; + + /* currently recognized structure : + + switches have to be separated by whitespaces + + valid switches are: + -m[e|o|f<file>] - output to stderr (e), stdout (o) or a file (f). In the latter case the whole rest + of the param ('til the next one, means 'til the next whitespace) is the filename + -t{i,w,e}* - type of output : i includes infos, w includes warnings, e includes errors + */ + + s_pImpl->s_pOutputMedium = stderr; + s_pImpl->s_nTraceMask = 0; + + char* pParamLoop = pSettings; + while (*pParamLoop) + { + while (!isspace(*pParamLoop) && *pParamLoop) + ++pParamLoop; + + sal_Int32 nLen = pParamLoop - pSettings; + if ((nLen > 1) && (*pSettings == '-')) + { + ++pSettings; + switch (*pSettings) + { + case 'm': + case 'w': + if (nLen > 2) + { + ++pSettings; + switch (*pSettings) + { + case 'e': + s_pImpl->s_pOutputMedium = stderr; + break; + case 'o': + s_pImpl->s_pOutputMedium = stdout; + break; + case 'f': + { + ++pSettings; + // copy the filename into an own buffer + ::rtl::OString sFileName(pSettings, pParamLoop - pSettings); + + // open the file + s_pImpl->s_pOutputMedium = disambiguate(sFileName); + + break; + } + } + } + break; + case 'd': + { // assign a virtual device + // copy the device assingment description + ::rtl::OString sDescription(pSettings + 1, pParamLoop - pSettings - 1); + sal_Int32 nSep = sDescription.indexOf(':'); + if (-1 == nSep) + break; // invalid format + + ::rtl::OString sVirtualDeviceName, sFileName; + sVirtualDeviceName = sDescription.copy(0, nSep); + sFileName = sDescription.copy(nSep + 1); + + FILE* pVirtualDevice = disambiguate(sFileName); + if (pVirtualDevice) + s_pImpl->s_aDevices[sVirtualDeviceName] = pVirtualDevice; + } + case 't': + { + ++pSettings; + while (pSettings != pParamLoop) + { + switch (*pSettings) + { + case 'i': s_pImpl->s_nTraceMask |= INFO; break; + case 'w': s_pImpl->s_nTraceMask |= WARNING; break; + case 'e': s_pImpl->s_nTraceMask |= ERROR; break; + } + ++pSettings; + } + } + } + } + + if (!*pParamLoop) + break; + + ++pParamLoop; + pSettings = pParamLoop; + } +} +//-------------------------------------------------------------------------- +void OConfigTracer::traceToVirtualDevice(const sal_Char* _pDeviceName, const sal_Char* _pFormat, ...) +{ + ::osl::MutexGuard aGuard(s_aMutex); + ensureData(); + ensureInitalized(); + + VirtualDevices::const_iterator aDeviceMediumPos = s_pImpl->s_aDevices.find(::rtl::OString(_pDeviceName)); + if (aDeviceMediumPos != s_pImpl->s_aDevices.end()) + { + FILE* pDeviceMedium = (FILE*)aDeviceMediumPos->second; + + va_list args; + va_start(args, _pFormat); + vfprintf(pDeviceMedium, _pFormat, args); + fflush(pDeviceMedium); + va_end(args); + } +} + +//-------------------------------------------------------------------------- +::rtl::OString OConfigTracer::getTimeStamp() +{ + time_t aTime = time(NULL); + tm* pStructuredTime = gmtime(&aTime); + ::rtl::OString sTimeStamp(asctime(pStructuredTime)); + // cut the trainling linefeed (asctime is defined to contain such a line feed) + sal_Int32 nStampLen = sTimeStamp.getLength(); + if ((0 != nStampLen) && ('\n' == sTimeStamp.getStr()[nStampLen - 1])) + sTimeStamp = sTimeStamp.copy(0, nStampLen - 1); + + return sTimeStamp; +} + +//-------------------------------------------------------------------------- +void OConfigTracer::implTrace(const sal_Char* _pType, const sal_Char* _pFormat, va_list args) +{ + ensureInitalized(); + if (!s_pImpl->s_pOutputMedium) + // no tracing enabled + return; + + fprintf(s_pImpl->s_pOutputMedium, "%s", _pType); + indent(); + vfprintf(s_pImpl->s_pOutputMedium, _pFormat, args); + fprintf(s_pImpl->s_pOutputMedium,"\n"); + fflush(s_pImpl->s_pOutputMedium); +} + +} // namespace configmgr + +#endif // defined(DEBUG) || defined(_DEBUG) + +//************************************************************************** +// history: +// $Log: not supported by cvs2svn $ +// Revision 1.7 2000/09/15 09:51:51 willem.vandorp +// OpenOffice header added +// +// Revision 1.6 2000/08/31 10:00:21 fs +// time_t unknown +// +// Revision 1.5 2000/08/30 14:34:09 fs +// getTimeStamp +// +// Revision 1.4 2000/08/20 12:55:42 fs +// #77860# introduced an impl class; introduces virtual trace devices +// +// Revision 1.3 2000/08/17 07:18:02 lla +// im/export +// +// Revision 1.2 2000/08/10 06:53:45 fs +// read settings from the ENVCFGFLAGS environment variable +// +// Revision 1.1 2000/08/09 18:52:46 fs +// helper classes for tracing +// +// +// Revision 1.0 09.08.00 13:10:05 fs +//************************************************************************** + diff --git a/configmgr/source/registry/cfgregistrykey.cxx b/configmgr/source/registry/cfgregistrykey.cxx new file mode 100644 index 000000000000..259df2542b98 --- /dev/null +++ b/configmgr/source/registry/cfgregistrykey.cxx @@ -0,0 +1,783 @@ +/************************************************************************* + * + * $RCSfile: cfgregistrykey.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:41 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONFIGMGR_REGISTRY_CFGREGISTRYKEY_HXX_ +#include "cfgregistrykey.hxx" +#endif + +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif +#ifndef _CPPUHELPER_EXTRACT_HXX_ +#include <cppuhelper/extract.hxx> +#endif + +#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_ +#include <com/sun/star/container/XNameContainer.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#endif + +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_ +#include <com/sun/star/uno/Sequence.hxx> +#endif +#ifndef _TYPELIB_TYPEDESCRIPTION_HXX_ +#include <typelib/typedescription.hxx> +#endif + +#define THISREF() static_cast< ::cppu::OWeakObject* >(this) +#define UNISTRING(c) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(c) ) + +//.......................................................................... +namespace configmgr +{ +//.......................................................................... + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::registry; +using namespace ::com::sun::star::container; +using namespace ::osl; +using namespace ::cppu; + +//========================================================================== +//= OConfigurationRegistryKey +//========================================================================== + +//-------------------------------------------------------------------------- +OConfigurationRegistryKey::OConfigurationRegistryKey + (const Reference< XNameAccess >& _rxContainerNode + ,sal_Bool _bWriteable + ,SubtreeRoot + ) + :m_xNodeAccess(_rxContainerNode) + ,m_bReadOnly(!_bWriteable) + ,m_xNodeDeepAccess(_rxContainerNode, UNO_QUERY) +{ + OSL_ENSHURE(m_xNodeAccess.is(), "OConfigurationRegistryKey::OConfigurationRegistryKey : invalid config node param !"); +} + +//-------------------------------------------------------------------------- +OConfigurationRegistryKey::OConfigurationRegistryKey( + const Reference< XNameAccess >& _rxContainerNode, + const ::rtl::OUString& _rLocalName, + sal_Bool _bWriteable) + :m_xNodeAccess(_rxContainerNode) + ,m_bReadOnly(!_bWriteable) + ,m_xNodeDeepAccess(_rxContainerNode, UNO_QUERY) + ,m_sLocalName(_rLocalName) +{ + OSL_ENSHURE(m_xNodeAccess.is(), "OConfigurationRegistryKey::OConfigurationRegistryKey : invalid config node param !"); + OSL_ENSHURE(m_sLocalName.getLength(), "OConfigurationRegistryKey::OConfigurationRegistryKey : invalid relative name !"); +} + +//-------------------------------------------------------------------------- +OConfigurationRegistryKey::OConfigurationRegistryKey( + Any _rCurrentValue, + const Reference< XNameAccess >& _rxParentNode, + const ::rtl::OUString& _rRelativeName, + sal_Bool _bWriteable) + :m_aLeafElement(_rCurrentValue) + ,m_xLeafParent(_rxParentNode) + ,m_sLocalName(_rRelativeName) + ,m_bReadOnly(!_bWriteable) +{ + OSL_ENSHURE(_rxParentNode.is() && _rCurrentValue.hasValue(), + "OConfigurationRegistryKey::OConfigurationRegistryKey : invalid value and/or parent !"); + OSL_ENSHURE(m_bReadOnly || Reference< XNameReplace >(_rxParentNode, UNO_QUERY).is(), + "OConfigurationRegistryKey::OConfigurationRegistryKey : invalid parent (no value write access) !"); + OSL_ENSHURE(m_sLocalName.getLength(), "OConfigurationRegistryKey::OConfigurationRegistryKey : invalid relative name !"); +} + +//-------------------------------------------------------------------------- +void OConfigurationRegistryKey::checkValid(KEY_ACCESS_TYPE _eIntentedAccess) throw (InvalidRegistryException) +{ + if (!isValid()) + throw InvalidRegistryException(UNISTRING("The registry is not bound to a configuration node anymore."), THISREF()); + // "anymore", because at the moment the ctor was called it probably was bound .... + switch (_eIntentedAccess) + { + case KAT_VALUE_WRITE: + if (m_bReadOnly) + throw InvalidRegistryException(UNISTRING("This configuration node is not writeable."), THISREF()); + // !!! NO !!! BREAK !!! + case KAT_VALUE: + if (!m_aLeafElement.hasValue()) + throw InvalidRegistryException(UNISTRING("This configuration node does not have a value, it is a container."), THISREF()); + if (!m_xLeafParent.is()) + throw InvalidRegistryException(UNISTRING("This configuration nodes parent is invalid."), THISREF()); + break; + case KAT_CHILD: + if (!m_xNodeAccess.is()) + throw InvalidRegistryException(UNISTRING("This configuration node does not have children, it is a value node."), THISREF()); + break; + } +} + +//-------------------------------------------------------------------------- +Any OConfigurationRegistryKey::getDescendant(const ::rtl::OUString& _rDescendantName) throw(InvalidRegistryException) +{ + Any aElementReturn; + + try + { + if (-1 != _rDescendantName.indexOf('/')) + { + if (m_xNodeDeepAccess.is()) + aElementReturn = m_xNodeDeepAccess->getByHierarchicalName(_rDescendantName); + else + throw InvalidRegistryException(UNISTRING("Nested element access not supported by this node."), THISREF()); + } + else + { + if (m_xNodeAccess.is()) + aElementReturn = m_xNodeAccess->getByName(_rDescendantName); + else + { + OSL_ENSHURE(sal_False, "OConfigurationRegistryKey::getDescendant : invalid call !"); + // this method should not be called if the object does not represent a container node ... + throw InvalidRegistryException(UNISTRING("invalid object."), THISREF()); + } + } + } + catch(NoSuchElementException&) + { // not allowed to leave the method, wrap it + ::rtl::OUString sMessage(UNISTRING("There is no element named ")); + sMessage += _rDescendantName; + sMessage += UNISTRING("."); + throw InvalidRegistryException(sMessage, THISREF()); + } + catch(WrappedTargetException&) + { // allowed to be thrown by XNameAccess::getByName, but not allowed to leave this method + ::rtl::OUString sMessage(UNISTRING("The configuration node could not provide an element for ")); + sMessage += _rDescendantName; + sMessage += UNISTRING("."); + throw InvalidRegistryException(sMessage, THISREF()); + } + + if (!aElementReturn.hasValue()) + { // suspicious .... either there is an element, or there is none, but in the latter case an exception should + // have been thrown. + ::rtl::OUString sMessage(UNISTRING("There is no element named ")); + sMessage += _rDescendantName; + sMessage += UNISTRING("."); + throw InvalidRegistryException(sMessage, THISREF()); + } + + return aElementReturn; +} + +//-------------------------------------------------------------------------- +void OConfigurationRegistryKey::writeValueNode(const Any& _rValue) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_VALUE_WRITE); + + Reference< XNameReplace > xParentValueAccess(m_xLeafParent, UNO_QUERY); + if (!xParentValueAccess.is()) + throw InvalidRegistryException(UNISTRING("The parent configuration node does not allow write access to it's children."), THISREF()); + + try + { + xParentValueAccess->replaceByName(m_sLocalName, _rValue); + } + catch(IllegalArgumentException&) + { + throw InvalidRegistryException(UNISTRING("Unable to replace the old value. The configuration node threw an IllegalArgumentException."), THISREF()); + } + catch(NoSuchElementException&) + { + OSL_ENSHURE(sal_False, "OConfigurationRegistryKey::writeValueNode : a NoSuchElementException should be impossible !"); + throw InvalidRegistryException(UNISTRING("Unable to replace the old value. The configuration node threw an NoSuchElementException."), THISREF()); + } + catch(WrappedTargetException&) + { + throw InvalidRegistryException(UNISTRING("Unable to replace the old value. The configuration node threw an WrappedTargetException."), THISREF()); + } +} + +//-------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OConfigurationRegistryKey::getKeyName() throw(RuntimeException) +{ + return m_sLocalName; +} + +//-------------------------------------------------------------------------- +sal_Bool SAL_CALL OConfigurationRegistryKey::isReadOnly( ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_META); + return m_bReadOnly; +} + +//-------------------------------------------------------------------------- +sal_Bool SAL_CALL OConfigurationRegistryKey::isValid( ) throw(RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + // TODO : perhaps if the registry we're a part of is closed .... + return m_xNodeAccess.is() || m_aLeafElement.hasValue(); +} + +//-------------------------------------------------------------------------- +RegistryKeyType SAL_CALL OConfigurationRegistryKey::getKeyType( const ::rtl::OUString& _rKeyName ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_CHILD); + + // no further checks are made (for performance reasons) ... + return RegistryKeyType_KEY; +} + +//-------------------------------------------------------------------------- +namespace { + inline + Type getBinaryDataType() { + Sequence<sal_Int8> const * const p= 0; + return ::getCppuType(p); + } +} +//-------------------------------------------------------------------------- +typedef typelib_TypeDescriptionReference ElementTypeDesc; + +RegistryValueType SAL_CALL OConfigurationRegistryKey::getValueType( ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_VALUE); + + switch (m_aLeafElement.getValueType().getTypeClass()) + { + case TypeClass_STRING: + return RegistryValueType_STRING; + case TypeClass_SHORT: + case TypeClass_UNSIGNED_SHORT: + case TypeClass_BYTE: + case TypeClass_LONG: + case TypeClass_UNSIGNED_LONG: + case TypeClass_BOOLEAN: + return RegistryValueType_LONG; + case TypeClass_SEQUENCE: + if (m_aLeafElement.getValueType() == getBinaryDataType()) + return RegistryValueType_BINARY; + else + { + TypeDescription aType( m_aLeafElement.getValueType() ); + typelib_IndirectTypeDescription* pSequenceType + = reinterpret_cast< typelib_IndirectTypeDescription* >(aType.get()); + ElementTypeDesc* pElementType = pSequenceType->pType; + + switch (pElementType->eTypeClass) + { + case TypeClass_SHORT: + case TypeClass_UNSIGNED_SHORT: + case TypeClass_BYTE: + case TypeClass_LONG: + case TypeClass_UNSIGNED_LONG: + case TypeClass_BOOLEAN: + return RegistryValueType_LONGLIST; + case TypeClass_STRING: + return RegistryValueType_STRINGLIST; + case TypeClass_DOUBLE: + OSL_ENSHURE(sal_False, "OConfigurationRegistryKey::getValueType : registry does not support lists of floating point numebrs !"); + default: + if (Type(pElementType) == getBinaryDataType()) + OSL_ENSHURE(sal_False,"OConfigurationRegistryKey::getValueType : Registry cannot support LIST of BINARY"); + else + OSL_ENSHURE(sal_False, "OConfigurationRegistryKey::getValueType : unknown sequence element type !"); + return RegistryValueType_NOT_DEFINED; + } + } + case TypeClass_DOUBLE: + OSL_ENSHURE(sal_False, "OConfigurationRegistryKey::getValueType : registry does not support floating point numebrs !"); + return RegistryValueType_NOT_DEFINED; + default: + OSL_ENSHURE(sal_False, "OConfigurationRegistryKey::getValueType : unknown entry type !"); + return RegistryValueType_NOT_DEFINED; + } +} + +//-------------------------------------------------------------------------- +sal_Int32 SAL_CALL OConfigurationRegistryKey::getLongValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_VALUE); + +#define EXTRACT(tcname, type) \ + case TypeClass_##tcname : { type nNativeValue; m_aLeafElement >>= nNativeValue; nLongValue = nNativeValue; } + + sal_Int32 nLongValue(0); + switch (m_aLeafElement.getValueTypeClass()) + { + case TypeClass_SHORT : { sal_Int16 nNativeValue; m_aLeafElement >>= nNativeValue; nLongValue = nNativeValue; } break; + case TypeClass_UNSIGNED_SHORT : { sal_uInt16 nNativeValue; m_aLeafElement >>= nNativeValue; nLongValue = nNativeValue; } break; + case TypeClass_BYTE : { sal_Int8 nNativeValue; m_aLeafElement >>= nNativeValue; nLongValue = nNativeValue; } break; + case TypeClass_LONG : { sal_Int32 nNativeValue; m_aLeafElement >>= nNativeValue; nLongValue = nNativeValue; } break; + case TypeClass_UNSIGNED_LONG : { sal_uInt32 nNativeValue; m_aLeafElement >>= nNativeValue; nLongValue = nNativeValue; } break; + case TypeClass_BOOLEAN : { sal_Bool nNativeValue; m_aLeafElement >>= nNativeValue; nLongValue = nNativeValue; } break; + default: + throw InvalidValueException(UNISTRING("This node does not contain a long (or a compatible) value."), THISREF()); + } + return nLongValue; +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistryKey::setLongValue( sal_Int32 _nValue ) throw(InvalidRegistryException, RuntimeException) +{ + writeValueNode(makeAny(_nValue)); +} + +//-------------------------------------------------------------------------- +Sequence< sal_Int32 > SAL_CALL OConfigurationRegistryKey::getLongListValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_VALUE); + + Sequence< sal_Int32 > aReturn; + if (m_aLeafElement >>= aReturn) + return aReturn; + + // TODO : maybe it's a sequence of sal_Int8 or anything like that which we're able to convert .... + + throw InvalidValueException(UNISTRING("This configuration node does not contain a list of longs !"), THISREF()); +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistryKey::setLongListValue( const Sequence< sal_Int32 >& _seqValue ) throw(InvalidRegistryException, RuntimeException) +{ + writeValueNode(makeAny(_seqValue)); +} + +//-------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OConfigurationRegistryKey::getAsciiValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException) +{ + ::rtl::OUString sReturn = getStringValue(); + // TODO : check if it's really ascii ... + return sReturn; +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistryKey::setAsciiValue( const ::rtl::OUString& _rValue ) throw(InvalidRegistryException, RuntimeException) +{ + setStringValue(_rValue); +} + +//-------------------------------------------------------------------------- +Sequence< ::rtl::OUString > SAL_CALL OConfigurationRegistryKey::getAsciiListValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException) +{ + return getStringListValue(); + // TODO : it's not really an "ascii list" .... perhaps we should throw an exception here ... +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistryKey::setAsciiListValue( const Sequence< ::rtl::OUString >& _seqValue ) throw(InvalidRegistryException, RuntimeException) +{ + setStringListValue(_seqValue); +} + +//-------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OConfigurationRegistryKey::getStringValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_VALUE); + + ::rtl::OUString sReturn; + if (!(m_aLeafElement >>= sReturn)) + throw InvalidValueException(UNISTRING("This node does not contain a string value."), THISREF()); + return sReturn; +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistryKey::setStringValue( const ::rtl::OUString& _rValue ) throw(InvalidRegistryException, RuntimeException) +{ + writeValueNode(makeAny(_rValue)); +} + +//-------------------------------------------------------------------------- +Sequence< ::rtl::OUString > SAL_CALL OConfigurationRegistryKey::getStringListValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_VALUE); + + Sequence< ::rtl::OUString > aReturn; + if (m_aLeafElement >>= aReturn) + return aReturn; + + throw InvalidValueException(UNISTRING("This configuration node does not contain a list of strings !"), THISREF()); +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistryKey::setStringListValue( const Sequence< ::rtl::OUString >& _seqValue ) throw(InvalidRegistryException, RuntimeException) +{ + writeValueNode(makeAny(_seqValue)); +} + +//-------------------------------------------------------------------------- +Sequence< sal_Int8 > SAL_CALL OConfigurationRegistryKey::getBinaryValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_VALUE); + + Sequence< sal_Int8 > aReturn; + if (m_aLeafElement >>= aReturn) + return aReturn; + + throw InvalidValueException(UNISTRING("This configuration node does not contain a list of strings !"), THISREF()); +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistryKey::setBinaryValue( const Sequence< sal_Int8 >& _rValue ) throw(InvalidRegistryException, RuntimeException) +{ + writeValueNode(makeAny(_rValue)); +} + +//-------------------------------------------------------------------------- +Reference< XRegistryKey > OConfigurationRegistryKey::implGetKey( const ::rtl::OUString& _rKeyName ) + throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException) +{ + ::rtl::OUString sDescRelativeName(_rKeyName); + // will be the name of the new key relative to it's parent + sal_Bool bDeepAccess = sal_False; + sal_Int32 nSeparatorPos = _rKeyName.lastIndexOf('/'); + if ((nSeparatorPos >= 0) && (nSeparatorPos == (_rKeyName.getLength() - 1))) + // recognize a trailing slashs + nSeparatorPos = _rKeyName.lastIndexOf('/', nSeparatorPos - 1); + if (nSeparatorPos >= 1) + { + sDescRelativeName = _rKeyName.copy(nSeparatorPos + 1); + bDeepAccess = sal_True; + } + + Any aDescendant = getDescendant(_rKeyName); + if (aDescendant.getValueType().getTypeClass() == TypeClass_INTERFACE) + { + Reference< XNameAccess > xContainerNode; + ::cppu::extractInterface(xContainerNode, aDescendant); + if (!xContainerNode.is()) + throw InvalidRegistryException(UNISTRING("invalid descendant node."), THISREF()); + return new OConfigurationRegistryKey(xContainerNode, sDescRelativeName, !m_bReadOnly); + } + else + { + Reference< XNameAccess > xDescParent(m_xNodeAccess); // the parent config node of the descandent + + OSL_ENSHURE(aDescendant.hasValue(), "OConfigurationRegistryKey::openKey : invalid return from getDescendant."); +#ifdef DEBUG + switch (aDescendant.getValueType().getTypeClass()) + { + case TypeClass_STRING: + case TypeClass_SHORT: + case TypeClass_UNSIGNED_SHORT: + case TypeClass_BYTE: + case TypeClass_LONG: + case TypeClass_UNSIGNED_LONG: + case TypeClass_BOOLEAN: + case TypeClass_SEQUENCE: + break; + default: + OSL_ENSHURE(sal_False, "OConfigurationRegistryKey::openKey : unknown or invalid descendant value type !"); + } +#endif + if (bDeepAccess) + { + Any aDescParent = getDescendant(_rKeyName.copy(0, nSeparatorPos)); + ::cppu::extractInterface(xDescParent, aDescParent); + if (!xDescParent.is()) + throw InvalidRegistryException(UNISTRING("The internal registry structure seems to be corrupt."), THISREF()); + } + + return new OConfigurationRegistryKey(aDescendant, xDescParent, sDescRelativeName, !m_bReadOnly); + } +} + +//-------------------------------------------------------------------------- +Reference< XRegistryKey > SAL_CALL OConfigurationRegistryKey::openKey( const ::rtl::OUString& _rKeyName ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_CHILD); + + return implGetKey(_rKeyName); +} + +//-------------------------------------------------------------------------- +void OConfigurationRegistryKey::checkRelativeKeyName(::rtl::OUString& _rKeyName) throw(InvalidRegistryException, RuntimeException) +{ + // no empty names allowed + if (!_rKeyName.getLength()) + throw InvalidRegistryException(UNISTRING("The key name is invalid."), THISREF()); + + // no absolute names ("/...") allowed + if (_rKeyName.getStr()[0] == '/') + throw InvalidRegistryException(UNISTRING("The key name is invalid. It must be a relative, not an absolute name."), THISREF()); + + // cut trailing slashes + while (_rKeyName.getLength() && (_rKeyName.getStr()[_rKeyName.getLength() - 1] == '/')) + _rKeyName = _rKeyName.copy(0, _rKeyName.getLength() - 1); + + if (!_rKeyName.getLength()) + // the original name consists of slashes only + throw InvalidRegistryException(UNISTRING("The key name is invalid."), THISREF()); +} + +//-------------------------------------------------------------------------- +Reference< XRegistryKey > SAL_CALL OConfigurationRegistryKey::createKey( const ::rtl::OUString& _rKeyName ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_CHILD); + + if (m_bReadOnly) + throw InvalidRegistryException(UNISTRING("The key is read only."), THISREF()); + + ::rtl::OUString sKeyName(_rKeyName); + checkRelativeKeyName(sKeyName); + + sal_Int32 nSeparatorPos = sKeyName.lastIndexOf('/'); + if (-1 != nSeparatorPos) + { + // deep access. delegate it to a registry key which is one level above the to-be-created one + ::rtl::OUString sSetNodeName = sKeyName.copy(0, nSeparatorPos); + sKeyName = sKeyName.copy(nSeparatorPos + 1); + + Reference< XRegistryKey > xSetNode = implGetKey(sSetNodeName); + if (!xSetNode.is()) + { + OSL_ENSHURE(sal_False, "OConfigurationRegistryKey::createKey : somebody changed the implGetKey behaviour !"); + throw InvalidRegistryException(UNISTRING("An internal error occured."), THISREF()); + } + return xSetNode->createKey(sKeyName); + } + + // The requested new key is one level below ourself. Can't delegate the creation. + Reference< XNameContainer > xContainer(m_xNodeAccess, UNO_QUERY); + Reference< XSingleServiceFactory > xChildFactory(xContainer, UNO_QUERY); + if (!xChildFactory.is()) + throw InvalidRegistryException(UNISTRING("The configuration node represented by this key is not a container node, you can't insert keys."), THISREF()); + + // In the configuration API, the creation of a new child is two-stage process : first you create a child which + // is "floating", i.e. does not belong to the configuration tree, yet. After filling it with values, you insert + // it into the container node which was used for the creation. + // We can't map this behaviour with the registry API, so we have to combine both steps + + // create a new floating child for the container node + Reference< XInterface > xFloatingChild; + try + { + xFloatingChild = xChildFactory->createInstance(); + } + catch (RuntimeException&) + { // allowed to leave this method + throw; + } + catch (Exception& e) + { // not allowed to leave this method + throw InvalidRegistryException(UNISTRING("Unable to create a new child for the configuration node. Original error message as provided by the configuration API : ") += e.Message, + THISREF()); + } + + // and immediately insert it into the container + try + { + xContainer->insertByName(sKeyName, makeAny(xFloatingChild)); + } + catch (IllegalArgumentException& e) + { + throw InvalidRegistryException(UNISTRING("illegal argument : ") += e.Message, THISREF()); + } + catch (ElementExistException& e) + { + if (e.Message.getLength()) + throw InvalidRegistryException(e.Message, THISREF()); + else + throw InvalidRegistryException((UNISTRING("There already is an element named ") += sKeyName) += UNISTRING("."), THISREF()); + } + catch (WrappedTargetException& e) + { + throw InvalidRegistryException(UNISTRING("Caught an WrappedTargetException. Original error message : ") += e.Message, THISREF()); + } + + Reference< XNameAccess > xInsertedChild(xFloatingChild, UNO_QUERY); + if (!xInsertedChild.is()) + throw InvalidRegistryException(UNISTRING("An internal error occured. The objects provided by the configuration API are invalid."), THISREF()); + + return new OConfigurationRegistryKey(xInsertedChild, sKeyName, !m_bReadOnly); +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistryKey::closeKey( ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + + m_xNodeAccess = NULL; + m_xNodeDeepAccess = NULL; + m_aLeafElement.clear(); + m_xLeafParent = NULL; + m_sLocalName = ::rtl::OUString(); +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistryKey::deleteKey( const ::rtl::OUString& _rKeyName ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + + checkValid(KAT_CHILD); + if (m_bReadOnly) + throw InvalidRegistryException(UNISTRING("The key is read only."), THISREF()); + + ::rtl::OUString sKeyName(_rKeyName); + checkRelativeKeyName(sKeyName); + + sal_Int32 nSeparatorPos = sKeyName.lastIndexOf('/'); + if (-1 != nSeparatorPos) + { + // deep access. delegate it to a registry key which is one level above the to-be-created one + ::rtl::OUString sSetNodeName = sKeyName.copy(0, nSeparatorPos); + sKeyName = sKeyName.copy(nSeparatorPos + 1); + + Reference< XRegistryKey > xSetNode = implGetKey(sSetNodeName); + if (!xSetNode.is()) + { + OSL_ENSHURE(sal_False, "OConfigurationRegistryKey::createKey : somebody changed the implGetKey behaviour !"); + throw InvalidRegistryException(UNISTRING("An internal error occured."), THISREF()); + } + xSetNode->deleteKey(sKeyName); + return; + } + + // The requested new key is one level below ourself. Can't delegate the creation. + Reference< XNameContainer > xContainer(m_xNodeAccess, UNO_QUERY); + if (!xContainer.is()) + throw InvalidRegistryException(UNISTRING("The configuration node represented by this key is not a container node, you can't remove keys."), THISREF()); + + // and immediately insert it into the container + try + { + xContainer->removeByName(sKeyName); + } + catch (NoSuchElementException& e) + { + if (e.Message.getLength()) + throw InvalidRegistryException(e.Message, THISREF()); + else + throw InvalidRegistryException((UNISTRING("There is no element named ") += sKeyName) += UNISTRING("."), THISREF()); + } + catch (WrappedTargetException& e) + { + throw InvalidRegistryException(UNISTRING("Caught an WrappedTargetException. Original error message : ") += e.Message, THISREF()); + } +} + +//-------------------------------------------------------------------------- +Sequence< Reference< XRegistryKey > > SAL_CALL OConfigurationRegistryKey::openKeys( ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_CHILD); + + Sequence< ::rtl::OUString > aNames(m_xNodeAccess->getElementNames()); + const ::rtl::OUString* pNames = aNames.getConstArray(); + Sequence< Reference< XRegistryKey > > aReturn(aNames.getLength()); + Reference< XRegistryKey >* pReturn = aReturn.getArray(); + for (sal_Int32 i=0; i<aNames.getLength(); ++i, ++pNames, ++pReturn) + *pReturn = implGetKey(*pNames); + + return aReturn; +} + +//-------------------------------------------------------------------------- +Sequence< ::rtl::OUString > SAL_CALL OConfigurationRegistryKey::getKeyNames( ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkValid(KAT_CHILD); + return m_xNodeAccess->getElementNames(); +} + +//-------------------------------------------------------------------------- +sal_Bool SAL_CALL OConfigurationRegistryKey::createLink( const ::rtl::OUString& aLinkName, const ::rtl::OUString& aLinkTarget ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + throw InvalidRegistryException(UNISTRING("This registry, which is base on a configuration tree, does not support links."), THISREF()); +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistryKey::deleteLink( const ::rtl::OUString& rLinkName ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + throw InvalidRegistryException(UNISTRING("This registry, which is base on a configuration tree, does not support links."), THISREF()); +} + +//-------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OConfigurationRegistryKey::getLinkTarget( const ::rtl::OUString& rLinkName ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + throw InvalidRegistryException(UNISTRING("This registry, which is base on a configuration tree, does not support links."), THISREF()); +} + +//-------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OConfigurationRegistryKey::getResolvedName( const ::rtl::OUString& aKeyName ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + throw InvalidRegistryException(UNISTRING("This registry, which is base on a configuration tree, does not support links."), THISREF()); +} + +//-------------------------------------------------------------------------- +//.......................................................................... +} // namespace configmgr +//.......................................................................... + + diff --git a/configmgr/source/registry/cfgregistrykey.hxx b/configmgr/source/registry/cfgregistrykey.hxx new file mode 100644 index 000000000000..edf9c7d25fea --- /dev/null +++ b/configmgr/source/registry/cfgregistrykey.hxx @@ -0,0 +1,256 @@ +/************************************************************************* + * + * $RCSfile: cfgregistrykey.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:41 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONFIGMGR_REGISTRY_CFGREGISTRYKEY_HXX_ +#define _CONFIGMGR_REGISTRY_CFGREGISTRYKEY_HXX_ + +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif + +#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ +#include <com/sun/star/container/XNameAccess.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XHIERARCHICALNAMEACCESS_HPP_ +#include <com/sun/star/container/XHierarchicalNameAccess.hpp> +#endif +#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_ +#include <com/sun/star/registry/XRegistryKey.hpp> +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/Mutex.hxx> +#endif + +//.......................................................................... +namespace configmgr +{ +//.......................................................................... + +//========================================================================== +//= OConfigurationRegistryKey +//========================================================================== +typedef ::cppu::WeakImplHelper1 < ::com::sun::star::registry::XRegistryKey + > OConfigurationRegistryKey_Base; + +/** wraps the registry-like access to a single node of a configuration sub tree +*/ +class OConfigurationRegistryKey + :public OConfigurationRegistryKey_Base +{ + ::osl::Mutex m_aMutex; /// access safety + sal_Bool m_bReadOnly; /// is the key readonly ? + + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > + m_xNodeAccess; /// the config node object, if it describes a container + ::com::sun::star::uno::Reference< ::com::sun::star::container::XHierarchicalNameAccess > + m_xNodeDeepAccess; /// for accessing elements which are grandchildren + + ::com::sun::star::uno::Any + m_aLeafElement; /// if the key represents a leaf, this is the value + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > + m_xLeafParent; /// if the key represents a leaf, this is it's parent. used for write access + + ::rtl::OUString m_sLocalName; /** the name of the element relative to the parent, which would be + m_xLeafParent in case the key represents a value node + */ + + // TODO : the current concept does not recognize any changes in the config tree, i.e. the values stored + // in a configuration key wrapper are not changed if the value in the corresponding config node changes. + // Possible solutions: + // 1. on each value (or even on each sub key) access, the node is read from the configuration hierarchy, again. + // sounds very expensive. + // 2. each registry key is a listener on the node it represents. + // sounds expensive, too. + // + // At the moment we ignore this restriction, but perhaps we can't do that forever .... + +public: + /// when used as ctor parameter, this indicates that the key wraps a config tree subtree root + struct SubtreeRoot { }; + + /** builds an registry key which wraps the root of a configuration node + */ + OConfigurationRegistryKey( + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxContainerNode + ,sal_Bool _bWriteable + ,SubtreeRoot + ); + + /** builds an registry key for a configuration container node + @param _rxContainerNode the container the key should represent + @param _rLocalName the name of the node local to it's parent. Must be empty only if + the key represents the root node of a navigatable sub tree. + @param _bWriteable should the key be writeable ? + */ + OConfigurationRegistryKey( + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxContainerNode + ,const ::rtl::OUString& _rLocalName + ,sal_Bool _bWriteable + ); + + /** builds an registry key for a configuration value container node. + @param _rCurrentValue the current value of the node. Must be the same as _rxParentNode->getByName(_rRelativeName) would provide + @param _rxParentNode the parent of the value node. Used for update access and for obtaining the initial value. + @param _rRelativeName te relative name within the parent + @param _bWriteable should the key be writeable ? + */ + OConfigurationRegistryKey( + ::com::sun::star::uno::Any _rCurrentValue + ,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxParentNode + ,const ::rtl::OUString& _rRelativeName + ,sal_Bool _bWriteable + ); + + // XRegistryKey + virtual ::rtl::OUString SAL_CALL getKeyName() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isValid( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::registry::RegistryKeyType SAL_CALL getKeyType( const ::rtl::OUString& rKeyName ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::registry::RegistryValueType SAL_CALL getValueType( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getLongValue( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::registry::InvalidValueException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setLongValue( sal_Int32 value ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getLongListValue( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::registry::InvalidValueException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setLongListValue( const ::com::sun::star::uno::Sequence< sal_Int32 >& seqValue ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAsciiValue( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::registry::InvalidValueException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setAsciiValue( const ::rtl::OUString& value ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAsciiListValue( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::registry::InvalidValueException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setAsciiListValue( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& seqValue ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getStringValue( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::registry::InvalidValueException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setStringValue( const ::rtl::OUString& value ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getStringListValue( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::registry::InvalidValueException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setStringListValue( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& seqValue ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBinaryValue( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::registry::InvalidValueException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBinaryValue( const ::com::sun::star::uno::Sequence< sal_Int8 >& value ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > SAL_CALL openKey( const ::rtl::OUString& aKeyName ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > SAL_CALL createKey( const ::rtl::OUString& aKeyName ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL closeKey( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deleteKey( const ::rtl::OUString& rKeyName ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > > SAL_CALL openKeys( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getKeyNames( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL createLink( const ::rtl::OUString& aLinkName, const ::rtl::OUString& aLinkTarget ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deleteLink( const ::rtl::OUString& rLinkName ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getLinkTarget( const ::rtl::OUString& rLinkName ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getResolvedName( const ::rtl::OUString& aKeyName ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + +protected: + /** specifies the kind of access to the key. + */ + enum KEY_ACCESS_TYPE + { + KAT_META, /// access on a meta level, e.g. asking for the read-onyl flag + KAT_VALUE, /// read access to the value the node represents + KAT_VALUE_WRITE, /// write access to the value the node represents + KAT_CHILD /// access to one of the (grand-)children of the node + }; + + /** check if the registry key is valid + @param _eIntentedAccess type of access which the caller wants to perform on the object + @throws <type scope="com.sun.star.registry">InvalidRegistryException</type> if the key is invalid + */ + void checkValid(KEY_ACCESS_TYPE _eIntentedAccess) throw (::com::sun::star::registry::InvalidRegistryException); + + /** return an child element. + @param _rDescendantName the name of the descendant to open. May have a depth of more than 1, if + the node container support XHierarchicalNameAccess + @return the requested element. The caller can assume that the returned + <type scope="com.sun.star.uno">Any</type> always contains an object, all other cases are + handled with exceptions + @throws <type scope="com.sun.star.registry">InvalidRegistryException</type> if the key is invalid, + the element refered by _rName does not exist, the configuration node threw an exception, or + the name has a depth of more than one and the config node does not support this. + */ + ::com::sun::star::uno::Any getDescendant(const ::rtl::OUString& _rDescendantName) throw(::com::sun::star::registry::InvalidRegistryException); + + /** write the given value into the configuration node the object represents. + @throws <type scope="com.sun.star.registry">InvalidRegistryException</type> if the key is invalid, + not opened for write access or the configurations parent is not able to provide a value access + @throws <type scope="com.sun.star.uno">RuntimeException</type> if a fatal runtime error occurs + */ + void writeValueNode(const ::com::sun::star::uno::Any& _rValue) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + + /** open the sub key (depth 1 or more) determined by the given name + @param _rKeyName the name of the descendant node + @return a XRegistryKey wrapper for the requested configuration node + @throws <type scope="com.sun.star.registry">InvalidRegistryException</type> if the key is invalid, + the element refered by _rName does not exist, the configuration node threw an exception, or + the name has a depth of more than one and the config node does not support this. + */ + ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > OConfigurationRegistryKey::implGetKey( const ::rtl::OUString& _rKeyName ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + + /** check the given (relative) key name syntactically. In particular, this means that no checks are made if a node + with the given name exists or something like that ... + <BR> + In addition, the given name will be normalized. Basically, this means that it does not contain trailing slashes. + @throws InvalidRegistryException if the name is not relative (i.e. if it starts with an slash) + @throws InvalidRegistryException if the name is empty or consists of slashes only + */ + void checkRelativeKeyName(::rtl::OUString& _rKeyName) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); +}; + + +//.......................................................................... +} // namespace configmgr +//.......................................................................... + +#endif // _CONFIGMGR_REGISTRY_CFGREGISTRYKEY_HXX_ + + diff --git a/configmgr/source/registry/configregistry.cxx b/configmgr/source/registry/configregistry.cxx new file mode 100644 index 000000000000..82d9eba7a743 --- /dev/null +++ b/configmgr/source/registry/configregistry.cxx @@ -0,0 +1,344 @@ +/************************************************************************* + * + * $RCSfile: configregistry.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:41 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef _CONFIGMGR_REGISTRY_CONFIGREGISTRY_HXX_ +#include "configregistry.hxx" +#endif +#ifndef _CONFIGMGR_REGISTRY_CFGREGISTRYKEY_HXX_ +#include "cfgregistrykey.hxx" +#endif + +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif +#ifndef _COM_SUN_STAR_LANG_SERVICENOTREGISTEREDEXCEPTION_HPP_ +#include <com/sun/star/lang/ServiceNotRegisteredException.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ +#include <com/sun/star/container/XNameAccess.hpp> +#endif + +#define THISREF() static_cast< ::cppu::OWeakObject* >(this) +#define UNISTRING(c) ::rtl::OUString::createFromAscii(c) + +//.......................................................................... +namespace configmgr +{ +//.......................................................................... + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::registry; +using namespace ::com::sun::star::container; +using namespace ::osl; +using namespace ::cppu; + +//========================================================================== +//= OConfigurationRegistry +//========================================================================== + + static const AsciiServiceName aConfigRegistryServices[] = + { + "com.sun.star.registry.SimpleRegistry", + "com.sun.star.configuration.ConfigurationRegistry", + NULL + }; + const ServiceInfo OConfigurationRegistry::s_aServiceInfo = + { + "com.sun.star.configuration.configmgr.OConfigurationRegistry", + aConfigRegistryServices + }; + + Reference< XInterface > SAL_CALL instantiateConfigRegistry(Reference< XMultiServiceFactory > const& _rServiceManager ) + { + return static_cast< ::cppu::OWeakObject* >(new OConfigurationRegistry(_rServiceManager)); + } + + const ServiceInfo* getConfigurationRegistryServiceInfo() + { + return &OConfigurationRegistry::s_aServiceInfo; + } + +//-------------------------------------------------------------------------- +OConfigurationRegistry::OConfigurationRegistry(const Reference< XMultiServiceFactory >& _rORB) throw(Exception, RuntimeException) + :ServiceComponentImpl(&s_aServiceInfo) + ,m_xORB(_rORB) + ,m_aFlushListeners(m_aMutex) +{ + // create the configuration provider used for accessing the configuration + OSL_ENSHURE(m_xORB.is(), "OConfigurationRegistry::OConfigurationRegistry : invalid service factory !"); + if (m_xORB.is()) + m_xConfigurationProvider = + Reference< XMultiServiceFactory > ( + m_xORB->createInstance(UNISTRING("com.sun.star.configuration.ConfigurationProvider")), + UNO_QUERY + ); + + if (!m_xConfigurationProvider.is()) + // it's heavily needed ... + throw ServiceNotRegisteredException(UNISTRING("Failed to instantiate the mandatory service com.sun.star.configuration.ConfigurationProvider."), + THISREF()); +} + +//-------------------------------------------------------------------------- +Any SAL_CALL OConfigurationRegistry::queryInterface( const Type& _rType ) throw(RuntimeException) +{ + Any aReturn = ServiceComponentImpl::queryInterface(_rType); + if (!aReturn.hasValue()) + aReturn = OConfigurationRegistry_Base::queryInterface(_rType); + return aReturn; +} + +//-------------------------------------------------------------------------- +Sequence< Type > SAL_CALL OConfigurationRegistry::getTypes( ) throw(RuntimeException) +{ + return ::utl::concatSequences( + ServiceComponentImpl::getTypes(), + OConfigurationRegistry_Base::getTypes()); +} + +//-------------------------------------------------------------------------- +Sequence< sal_Int8 > SAL_CALL OConfigurationRegistry::getImplementationId( ) throw(RuntimeException) +{ + static OImplementationId aId; + return aId.getImplementationId(); +} + +//-------------------------------------------------------------------------- +::rtl::OUString OConfigurationRegistry::getNodePathFromURL(const ::rtl::OUString& _rURL) +{ + // TODO + return _rURL; +} + +//-------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OConfigurationRegistry::getURL() throw(RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + return m_sLocation; +} + +//-------------------------------------------------------------------------- +void OConfigurationRegistry::checkOpen() throw(InvalidRegistryException, RuntimeException) +{ + if (!isOpen()) + throw InvalidRegistryException(UNISTRING("The registry is not bound to a configuration node."), THISREF()); +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistry::open( const ::rtl::OUString& _rURL, sal_Bool _bReadOnly, sal_Bool _bCreate ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + if (isOpen()) + close(); + + ::rtl::OUString sNodePath = getNodePathFromURL(_rURL); + + if (!m_xConfigurationProvider.is()) + throw RuntimeException(UNISTRING("invalid object. configuration provider is already disposed."), THISREF()); + + Reference< XInterface > xNodeAccess; + try + { + // the one and only parameter for creating the config access : the node path + Sequence< Any > aArguments(1); + aArguments[0] <<= sNodePath; + + if (_bReadOnly) + xNodeAccess = m_xConfigurationProvider->createInstanceWithArguments(UNISTRING("com.sun.star.configuration.ConfigurationAccess"), aArguments); + else + xNodeAccess = m_xConfigurationProvider->createInstanceWithArguments(UNISTRING("com.sun.star.configuration.ConfigurationUpdateAccess"), aArguments); + } + catch (RuntimeException&) + { // allowed to leave this method + throw; + } + catch (Exception& e) + { // not allowed to leave this method + ::rtl::OUString sMessage = UNISTRING("The configuration provider does not supply a registry access for the requested Node."); + sMessage += UNISTRING(" original error message of the provider : "); + sMessage += e.Message; + throw InvalidRegistryException(sMessage, THISREF()); + } + + Reference< XNameAccess > xReadRoot(xNodeAccess, UNO_QUERY); + if (!_bReadOnly) + m_xUpdateRoot = m_xUpdateRoot.query(xNodeAccess); + + if (!xReadRoot.is() || (!_bReadOnly && !m_xUpdateRoot.is())) + throw InvalidRegistryException(UNISTRING("The object supplied the by configuration provider is invalid."), THISREF()); + + m_xRootKey = new OConfigurationRegistryKey(xReadRoot, !_bReadOnly, OConfigurationRegistryKey::SubtreeRoot()); + m_xSubtreeRoot = xNodeAccess; +} + +//-------------------------------------------------------------------------- +sal_Bool SAL_CALL OConfigurationRegistry::isValid( ) throw(RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + return m_xRootKey.is(); +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistry::close( ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + + if (m_xRootKey.is()) + m_xRootKey->closeKey(); + m_xRootKey = NULL; + + Reference< XComponent > xRootComponent(m_xSubtreeRoot, UNO_QUERY); + if (xRootComponent.is()) + xRootComponent->dispose(); + m_xSubtreeRoot = NULL; + m_xUpdateRoot = NULL; + + m_sLocation = ::rtl::OUString(); +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistry::destroy( ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + throw InvalidRegistryException(UNISTRING("This registry is a wrapper for a configuration access. It can not be destroyed."), THISREF()); +} + +//-------------------------------------------------------------------------- +Reference< XRegistryKey > SAL_CALL OConfigurationRegistry::getRootKey( ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkOpen(); + + return m_xRootKey; +} + +//-------------------------------------------------------------------------- +sal_Bool SAL_CALL OConfigurationRegistry::isReadOnly( ) throw(InvalidRegistryException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + checkOpen(); + + return !m_xUpdateRoot.is(); + // if we don't have the update root, we're readonly +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistry::mergeKey( const ::rtl::OUString& aKeyName, const ::rtl::OUString& aUrl ) throw(InvalidRegistryException, MergeConflictException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + // not supported. but we can't throw an NoSupportException here ... + throw InvalidRegistryException(UNISTRING("You can't merge into this registry. It's just a wrapper for a configuration node, which has a fixed structure which can not be modified"), THISREF()); +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistry::flush( ) throw(RuntimeException) +{ + { + MutexGuard aGuard(m_aMutex); + + try + { + m_xUpdateRoot->commitChanges(); + } + catch (WrappedTargetException& e) + { // not allowed to leave this method + // TODO : the specification of XFlushable has to be changed !!!!! + OSL_ENSHURE(sal_False, "OConfigurationRegistry::flush : caught an exception, could not flush the data !"); + return; +// ::rtl::OUString sMessage; +// sMessage = UNISTRING("The changes made could not be committed. Orginal exception message : "); +// sMessage += e.Message; +// throw RuntimeException(sMessage, THISREF()); + } + } + + EventObject aFlushed(THISREF()); + ::cppu::OInterfaceIteratorHelper aIter(m_aFlushListeners); + while (aIter.hasMoreElements()) + static_cast< XFlushListener* >(aIter.next())->flushed(aFlushed); +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistry::addFlushListener( const Reference< XFlushListener >& _rxListener ) throw(RuntimeException) +{ + m_aFlushListeners.addInterface(_rxListener); +} + +//-------------------------------------------------------------------------- +void SAL_CALL OConfigurationRegistry::removeFlushListener( const Reference< XFlushListener >& _rxListener ) throw(RuntimeException) +{ + m_aFlushListeners.removeInterface(_rxListener); +} + +//.......................................................................... +} // namespace configmgr +//.......................................................................... + + diff --git a/configmgr/source/registry/configregistry.hxx b/configmgr/source/registry/configregistry.hxx new file mode 100644 index 000000000000..661aa6b2bb32 --- /dev/null +++ b/configmgr/source/registry/configregistry.hxx @@ -0,0 +1,175 @@ +/************************************************************************* + * + * $RCSfile: configregistry.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:42 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONFIGMGR_REGISTRY_CONFIGREGISTRY_HXX_ +#define _CONFIGMGR_REGISTRY_CONFIGREGISTRY_HXX_ + +#ifndef _CPPUHELPER_IMPLBASE2_HXX_ +#include <cppuhelper/implbase2.hxx> +#endif +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#ifndef CONFIGMGR_API_SVCCOMPONENT_HXX_ +#include "confsvccomponent.hxx" +#endif + +#ifndef _COM_SUN_STAR_REGISTRY_XSIMPLEREGISTRY_HPP_ +#include <com/sun/star/registry/XSimpleRegistry.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_XFLUSHABLE_HPP_ +#include <com/sun/star/util/XFlushable.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_XCHANGESBATCH_HPP_ +#include <com/sun/star/util/XChangesBatch.hpp> +#endif + +//.......................................................................... +namespace configmgr +{ +//.......................................................................... + +//========================================================================== +//= OConfigurationRegistry +//========================================================================== +typedef ::cppu::ImplHelper2 < ::com::sun::star::registry::XSimpleRegistry + , ::com::sun::star::util::XFlushable + > OConfigurationRegistry_Base; + +/** an object implmenting the <service scope="com.sun.star.configuration">ConfigurationRegistry</service> + service. +*/ +class OConfigurationRegistry + :public ServiceComponentImpl + ,public OConfigurationRegistry_Base +{ +public: + static const ServiceInfo s_aServiceInfo; + +protected: + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > + m_xORB; /// the service provider used for creating the instance + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > + m_xConfigurationProvider; /// the configuration provider used for creating configuration accesses + + ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > + m_xRootKey; /// the root key for the registry-like configuration access + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > + m_xSubtreeRoot; /// the root of the sub tree the object wraps + ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesBatch > + m_xUpdateRoot; /// the update access to the root of the sub tree, valid if opened for writing + ::rtl::OUString m_sLocation; /// URL of the configuration node we're representing, if any + + ::cppu::OInterfaceContainerHelper + m_aFlushListeners; + + +public: + OConfigurationRegistry( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rORB) + throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire( ) throw() { ServiceComponentImpl::acquire(); } + virtual void SAL_CALL release( ) throw() { ServiceComponentImpl::release(); } + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); + + // XSimpleRegistry + virtual ::rtl::OUString SAL_CALL getURL() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL open( const ::rtl::OUString& rURL, sal_Bool bReadOnly, sal_Bool bCreate ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isValid( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL close( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL destroy( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > SAL_CALL getRootKey( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL mergeKey( const ::rtl::OUString& aKeyName, const ::rtl::OUString& aUrl ) throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::registry::MergeConflictException, ::com::sun::star::uno::RuntimeException); + + // XFlushable + virtual void SAL_CALL flush( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addFlushListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XFlushListener >& l ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeFlushListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XFlushListener >& l ) throw(::com::sun::star::uno::RuntimeException); + +protected: + virtual void SAL_CALL disposing() { ServiceComponentImpl::disposing(); } + /// translates the given URL into a nodepath which may be used with the configuration provider + ::rtl::OUString getNodePathFromURL(const ::rtl::OUString& _rURL); + + void checkOpen() throw(::com::sun::star::registry::InvalidRegistryException, ::com::sun::star::uno::RuntimeException); + + sal_Bool isOpen() { return isValid(); } +}; + + +//.......................................................................... +} // namespace configmgr +//.......................................................................... + +#endif // _CONFIGMGR_REGISTRY_CONFIGREGISTRY_HXX_ + + diff --git a/configmgr/source/registry/makefile.mk b/configmgr/source/registry/makefile.mk new file mode 100644 index 000000000000..70653bc4fe59 --- /dev/null +++ b/configmgr/source/registry/makefile.mk @@ -0,0 +1,82 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:13:42 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. +PRJINC=$(PRJ)$/source$/inc +PRJNAME=configmgr +TARGET=registry + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ---------------------------------- + +.INCLUDE : settings.mk +# --- Files ------------------------------------- + +SLOFILES= \ + $(SLO)$/configregistry.obj \ + $(SLO)$/cfgregistrykey.obj \ + +# --- Targets ---------------------------------- + +.INCLUDE : target.mk + diff --git a/configmgr/source/tree/changes.cxx b/configmgr/source/tree/changes.cxx new file mode 100644 index 000000000000..0181578b88fe --- /dev/null +++ b/configmgr/source/tree/changes.cxx @@ -0,0 +1,194 @@ +/************************************************************************* + * + * $RCSfile: changes.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:42 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <stdio.h> +#include "cmtreemodel.hxx" +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif + +using namespace configmgr; + +//========================================================================== +//= ValueChange +//========================================================================== +// ------------------------------------------------------------------------- +ValueChange::ValueChange(OUString const& _rName,Any aNewValue, Mode aMode, Any aOldValue) + : Change(_rName) + ,m_aValue(aNewValue) + ,m_aOldValue(aOldValue) + ,m_eMode(aMode) +{ +} +// ------------------------------------------------------------------------- +ValueChange::ValueChange(Any aNewValue, ValueNode const& aOldValue) + : Change(aOldValue.getName()) + ,m_aValue(aNewValue) + ,m_aOldValue(aOldValue.getValue()) +{ + m_eMode = aOldValue.isDefault() ? wasDefault : changeValue; +} +// ------------------------------------------------------------------------- +ValueChange::ValueChange(SetToDefault, ValueNode const& aOldValue) + : Change(aOldValue.getName()) + ,m_aValue(aOldValue.getDefault()) + ,m_aOldValue(aOldValue.getValue()) + ,m_eMode(setToDefault) +{ +} + +// ------------------------------------------------------------------------- +namespace tree_changes_internal { + inline void doAdjust(uno::Any& aActual, uno::Any const& aTarget) + { + // If set - it should already match + OSL_ASSERT(!aActual.hasValue() || aTarget == aActual); + aActual = aTarget; + } +} +using namespace tree_changes_internal; + +// ------------------------------------------------------------------------- +void ValueChange::applyTo(ValueNode& aValue) +{ + switch (getMode()) + { + case wasDefault: + OSL_ASSERT(aValue.isDefault()); + case changeValue: + doAdjust( m_aOldValue, aValue.getValue()); + aValue.setValue(getNewValue()); + break; + + case setToDefault: + doAdjust( m_aOldValue, aValue.getValue()); + doAdjust( m_aValue, aValue.getDefault()); + aValue.setDefault(); + break; + + case changeDefault: + doAdjust( m_aOldValue, aValue.getDefault()); + aValue.changeDefault(getNewValue()); + break; + + default: + OSL_ENSHURE(0, "Unknown mode found for ValueChange"); + break; + } +} + +// ------------------------------------------------------------------------- +::rtl::OUString ValueChange::getModeAsString() const +{ + ::rtl::OUString aRet; + switch(m_eMode) + { + case wasDefault: + aRet = ::rtl::OUString::createFromAscii("wasDefault"); + break; + case changeValue: + aRet = ::rtl::OUString::createFromAscii("changeValue"); + break; + case setToDefault: + aRet = ::rtl::OUString::createFromAscii("setToDefault"); + break; + case changeDefault: + aRet = ::rtl::OUString::createFromAscii("changeDefault"); + break; + default: + OSL_ENSHURE(0,"getModeAsString: Wrong mode!"); + } + + return aRet; +} +// ------------------------------------------------------------------------- +void ValueChange::setModeAsString(const ::rtl::OUString& _rMode) +{ + if(_rMode == ::rtl::OUString::createFromAscii("wasDefault")) m_eMode = wasDefault; + else if(_rMode == ::rtl::OUString::createFromAscii("changeValue")) m_eMode = changeValue; + else if(_rMode == ::rtl::OUString::createFromAscii("setToDefault")) m_eMode = setToDefault; + else if(_rMode == ::rtl::OUString::createFromAscii("changeDefault"))m_eMode = changeDefault; + else + { + OSL_ENSHURE(0,"setModeAsString: Wrong mode!"); + } +} + +//========================================================================== +//= AddNode +//========================================================================== +//-------------------------------------------------------------------------- +AddNode::AddNode(std::auto_ptr<INode> aNewNode_, OUString const& _rName) + :Change(_rName) + ,m_aOwnNewNode(aNewNode_) +{ + m_pNewNode = m_aOwnNewNode.get(); +} + +//-------------------------------------------------------------------------- +AddNode::~AddNode() +{ +} + +//-------------------------------------------------------------------------- + + diff --git a/configmgr/source/tree/cmtree.cxx b/configmgr/source/tree/cmtree.cxx new file mode 100644 index 000000000000..ea565365f3e8 --- /dev/null +++ b/configmgr/source/tree/cmtree.cxx @@ -0,0 +1,719 @@ +/************************************************************************* + * + * $RCSfile: cmtree.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:42 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +/* PLEASE DON'T DELETE ANY COMMENT LINES, ALSO IT'S UNNECESSARY. */ + +#include <stl/deque> +#include <stl/vector> +#include <iostream> +#include <exception> +#include <sal/types.h> +#include <stl/set> +#include <rtl/string.hxx> +#include <rtl/ustring.hxx> +#include <osl/diagnose.h> + +#include "cmtree.hxx" +#include "confname.hxx" // Iterator for PathName scans +#include "cmtreemodel.hxx" + +#include <com/sun/star/uno/Any.hxx> + +#ifndef _CONFIGMGR_TREEACCESS_HXX_ +#include "treeaccess.hxx" +#endif + +// WISDOM +// !!Never write same code twice!! + +using namespace std; +using namespace rtl; +using namespace com::sun::star::uno; + +namespace configmgr +{ + +// ------------------------ ChildListSet implementations ------------------------ + ChildListSet::ChildListSet(ChildListSet const& aSet) + { + for(ChildList::iterator it = aSet.GetSet().begin(); + it != aSet.GetSet().end(); + ++it) + m_aChildList.insert(m_aChildList.end(), (*it)->clone()); + } + ChildListSet::~ChildListSet() + { + for(ChildList::iterator it = m_aChildList.begin(); + it != m_aChildList.end(); + ++it) + delete *it; + } + + +// ---------------------------- Node implementation ---------------------------- + + INode::INode(){} + INode::INode(OUString const& aName) + :m_aName(aName){} + // CopyCTor will be create automatically + + INode::~INode() {} + + // Node* Node::clone() {} + + OUString INode::getName() const {return m_aName;} + NodeAttributes INode::getAttributes() const {return m_aNodeAttribute;} + + ISubtree* INode::asISubtree(){return NULL;} + ISubtree const* INode::asISubtree() const {return NULL;} + ValueNode* INode::asValueNode() {return NULL;} + ValueNode const* INode::asValueNode() const {return NULL;} + + +// ------------------------- SearchNode implementation ------------------------- + SearchNode::SearchNode(){} + SearchNode::SearchNode(OUString const& aName) + :INode(aName){} + + INode* SearchNode::clone() const {return new SearchNode(*this);} + + OUString SearchNode::getName() const {return getName();} + SearchNode::~SearchNode(){} + + +// -------------------------- ISubtree implementation -------------------------- + ISubtree* ISubtree::asISubtree() {return this;} + ISubtree const* ISubtree::asISubtree() const {return this;} + +// --------------------------- Subtree implementation --------------------------- + + Subtree::Subtree(OUString const& aName) + :ISubtree(aName) + ,m_nLevel(0) + ,m_bComplete(sal_False) + { + } + Subtree::Subtree() + :m_nLevel(0) + ,m_bComplete(sal_False) + { + } + Subtree::~Subtree() {} + +// #pragma message("__FILE__(__LINE__) Subtree::clone() has empty implementation") + INode* Subtree::clone() const {return new Subtree(*this);} + +// #define MAX_NODE_NAME_LENGTH 256 + +// RECURSIVE: Node* Subtree::createChild(OUString const& aPath) +// RECURSIVE: { +// RECURSIVE: //? configmgr::Node searchObj(aName); +// RECURSIVE: //? ChildList::iterator it = m_aNode->GetSet().find(&searchObj); +// RECURSIVE: //? if (it == m_aNode->GetSet().end()) +// RECURSIVE: //? return NULL; +// RECURSIVE: //? else +// RECURSIVE: //? return *it; +// RECURSIVE: sal_Unicode aName[MAX_NODE_NAME_LENGTH]; +// RECURSIVE: int nStartPos = 0; +// RECURSIVE: int nPos = 0; +// RECURSIVE: +// RECURSIVE: if (aPath[0] == '/') +// RECURSIVE: { +// RECURSIVE: nStartPos++; +// RECURSIVE: } +// RECURSIVE: if (aPath[nStartPos] == '\0') +// RECURSIVE: { +// RECURSIVE: return this; +// RECURSIVE: } +// RECURSIVE: +// RECURSIVE: int nEndPos = nStartPos; +// RECURSIVE: while ((aPath[nEndPos] != '\0') && (aPath[nEndPos] != '/')) { +// RECURSIVE: aName[nPos++] = aPath[nEndPos++]; +// RECURSIVE: } +// RECURSIVE: aName[nPos] = '\0'; +// RECURSIVE: +// RECURSIVE: #ifdef DEBUG +// RECURSIVE: // list(cout << " searching for [" << aName << "] in\n"); +// RECURSIVE: #endif +// RECURSIVE: +// RECURSIVE: // search Node +// RECURSIVE: SearchNode searchObj(aName); +// RECURSIVE: ChildList::iterator it = m_aChildren->GetSet().find(&searchObj); +// RECURSIVE: if (it == m_aChildren->GetSet().end()) +// RECURSIVE: { +// RECURSIVE: // create new Child +// RECURSIVE: auto_ptr<Node> pSubtree( new Subtree(aName)); +// RECURSIVE: Node *pN = addChild(pSubtree); +// RECURSIVE: Subtree *pS = (Subtree*)pN; +// RECURSIVE: return pS->createChild(aPath + nEndPos); +// RECURSIVE: } +// RECURSIVE: else { +// RECURSIVE: // call recursive the inner child +// RECURSIVE: Node *pN = *it; +// RECURSIVE: Subtree *pP = (Subtree*)pN; +// RECURSIVE: return pP->createChild(aPath + nEndPos); +// RECURSIVE: } +// RECURSIVE: } + + INode* Subtree::createChild(OUString const& aName) + { + // POST: create Subtree if not found + + // search Node + SearchNode searchObj(aName); + ChildList::iterator it = m_aChildren.GetSet().find(&searchObj); + if (it == m_aChildren.GetSet().end()) + { + // create new Child + auto_ptr<INode> pSubtree( new Subtree(aName)); + return addChild(pSubtree); + } + return *it; + } + + INode* Subtree::doGetChild(OUString const& aName) const + { + SearchNode searchObj(aName); + ChildList::iterator it = m_aChildren.GetSet().find(&searchObj); + if (it == m_aChildren.GetSet().end()) + return NULL; + else + return *it; + } + + INode* Subtree::addChild(std::auto_ptr<INode> aNode) // takes ownership + { + OUString aName = aNode->getName(); + std::pair<ChildList::iterator, bool> aInserted = + m_aChildren.GetSet().insert(aNode.get()); + if (aInserted.second) + aNode.release(); + return *aInserted.first; + } + + ::std::auto_ptr<INode> Subtree::removeChild(OUString const& aName) + { + SearchNode searchObj(aName); + ChildList::const_iterator it = m_aChildren.GetSet().find(&searchObj); + + ::std::auto_ptr<INode> aReturn; + if (m_aChildren.GetSet().end() != it) + { + aReturn = ::std::auto_ptr<INode>(*it); + m_aChildren.GetSet().erase(it); + } + return aReturn; + } + + struct OPropagateLevels : public NodeModification + { + protected: + sal_Int32 nChildLevel; + public: + OPropagateLevels(sal_Int32 _nParentLevel) + { + nChildLevel = (ITreeProvider::ALL_LEVELS == _nParentLevel) ? ITreeProvider::ALL_LEVELS : _nParentLevel - 1; + } + virtual void handle(ValueNode&) { /* not interested in value nodes */ } + virtual void handle(ISubtree& _rSubtree) + { + if ((ITreeProvider::ALL_LEVELS == nChildLevel) || (nChildLevel > 0)) + { + OPropagateLevels aDeeperInto(nChildLevel); + aDeeperInto.applyToChildren(_rSubtree); + } + } + }; + + void Subtree::setLevel(sal_Int16 _nLevel) + { + m_nLevel = _nLevel; + if (0 == _nLevel) + // nothing more to do, this means "nothing known about any children" + return; + + // forward the level number to any child subtrees we have + OPropagateLevels aDeeperInto(_nLevel); + aDeeperInto.applyToChildren(*this); + } + + void Subtree::forEachChild(NodeAction& anAction) const { + for(ChildList::const_iterator it = m_aChildren.GetSet().begin(); + it != m_aChildren.GetSet().end(); + ++it) + (**it).dispatch(anAction); + } + + void Subtree::forEachChild(NodeModification& anAction) { + for(ChildList::iterator it = m_aChildren.GetSet().begin(); + it != m_aChildren.GetSet().end(); + ++it) + (**it).dispatch(anAction); + } + +// -------------------------- ValueNode implementation -------------------------- + void ValueNode::check_init() // may throw in the future + { + if (m_aValue.hasValue()) + { + OSL_ASSERT(m_aType != ::getVoidCppuType()); + OSL_ASSERT(m_aType == m_aValue.getValueType()); + } + else OSL_ASSERT(getVoidCppuType() == m_aValue.getValueType()); + + if (m_aDefaultValue.hasValue()) + { + OSL_ASSERT(m_aType != ::getVoidCppuType()); + OSL_ASSERT(m_aType == m_aDefaultValue.getValueType()); + } + else OSL_ASSERT(getVoidCppuType() == m_aDefaultValue.getValueType()); + } + + void ValueNode::init() + { + OSL_ASSERT(m_aType == ::getVoidCppuType()); + + if (m_aDefaultValue.hasValue()) + { + m_aType = m_aDefaultValue.getValueType(); + OSL_ASSERT(m_aType != ::getVoidCppuType()); + } + else if (m_aValue.hasValue()) + { + m_aType = m_aValue.getValueType(); + OSL_ASSERT(m_aType != ::getVoidCppuType()); + } + } + + bool ValueNode::isDefault() const + { + // POST: true, if only m_aDefaultValue is set. + return !m_aValue.hasValue() && hasDefault(); + } + + bool ValueNode::hasDefault() const + { + // POST: true, if only m_aDefaultValue is set. + return getAttributes().optional || m_aDefaultValue.hasValue(); + } + + bool ValueNode::isNull() const + { + // POST: true, if neither Any is set. + return !m_aValue.hasValue() && !m_aDefaultValue.hasValue(); + } + + + Type ValueNode::getValueType() const + { + // POST: return Type of Any + return m_aType; + } + + Any ValueNode::getValue() const + { + // POST: getValue, if not set, get DefaultValue + if (isDefault()) + return m_aDefaultValue; + return m_aValue; + } + + Any ValueNode::getDefault() const + { + return m_aDefaultValue; + } + + + void ValueNode::setValue(Any aValue) + { + m_aValue = aValue; + } + + void ValueNode::changeDefault(Any aValue) + { + m_aDefaultValue = aValue; + } + + void ValueNode::setDefault() + { + // PRE: ???? + // POST: isDefault() == true + m_aValue = Any(); + } + + INode* ValueNode::clone() const + { + return new ValueNode(*this); + } + + ValueNode* ValueNode::asValueNode() {return this;} + ValueNode const* ValueNode::asValueNode() const {return this;} + +// ---------------------------- Tree implementation ---------------------------- + + Tree::Tree() + : m_pRoot(NULL), m_pLock(NULL) + { + m_pRoot = new Subtree(); + m_pLock = new OTreeAccessor; + } + + Tree::~Tree() + { + delete m_pLock; + } + + void Tree::acquireReadAccess() const + { + m_pLock->acquireReadAccess(); + } + + void Tree::releaseReadAccess() const + { + m_pLock->releaseReadAccess(); + } + + void Tree::acquireWriteAccess() + { + m_pLock->acquireWriteAccess(); + } + + void Tree::releaseWriteAccess() + { + m_pLock->releaseWriteAccess(); + } + +// ----------------------------------------------------------------------------- + ISubtree* Tree::requestSubtree( OUString const& aComponentName, sal_Int16 nLevel ) + { + // OLD: + // INode* pResult = m_pRoot->getChild(aComponentName); + // return pResult->asISubtree(); + + // Build SearchName + OSL_ENSHURE(m_pRoot, "Tree::requestSubtree : m_pRoot MUST NOT BE ZERO"); + // hey, don't cry that loud .... + + ISubtree* pSubtree = m_pRoot; + ConfigurationName aConfigName(aComponentName,ConfigurationName::Absolute() ); + for(ConfigurationName::Iterator it = aConfigName.begin(); + it != aConfigName.end(); + ++it) + { + if (pSubtree) + { + INode* pNode = pSubtree->getChild(*it); + if (!pNode) + return NULL; + + pSubtree = pNode->asISubtree(); + } + else + break; + } + + if (pSubtree && (ALL_LEVELS != pSubtree->getLevel()) && (nLevel > pSubtree->getLevel())) + pSubtree = NULL; + return pSubtree; + } + +// ----------------------------------------------------------------------------- + const INode* Tree::getNode(const OUString& _rPath) + { + OSL_ENSHURE(m_pRoot, "Tree::getNode : invalid root !"); + + ConfigurationName aPath(_rPath, ConfigurationName::Absolute() ); + + INode* pNodeLoop = m_pRoot; + for ( ConfigurationName::Iterator aSearch = aPath.begin(); + (aSearch != aPath.end()) && pNodeLoop; + ++aSearch) + { + ISubtree* pNodeContainer = pNodeLoop->asISubtree(); + if (pNodeContainer) + pNodeLoop = pNodeContainer->getChild(*aSearch); + else + return NULL; + } + + return pNodeLoop; + } + +// ----------------------------------------------------------------------------- + ISubtree const* Tree::getSubtree( OUString const& aComponentName ) const + { + // Build SearchName + OSL_ENSHURE(m_pRoot, "m_pRoot MUST NOT BE ZERO"); + + ISubtree const* pSubtree = m_pRoot; + ConfigurationName aConfigName(aComponentName,ConfigurationName::Absolute() ); + for(ConfigurationName::Iterator it = aConfigName.begin(); + it != aConfigName.end(); + ++it) + { + if (pSubtree) + { + const INode* pNode = pSubtree->getChild(*it); + if (!pNode) + return NULL; + + pSubtree = pNode->asISubtree(); + } + else + break; + } + return pSubtree; + /* + sal_Unicode aName[MAX_NODE_NAME_LENGTH]; + int nStartPos = 0; + int nPos = 0; + + if (aPath[0] == '/') + { + nStartPos++; + } + if (aPath[nStartPos] == '\0') + { + return this; + } + + int nEndPos = nStartPos; + while ((aPath[nEndPos] != '\0') && (aPath[nEndPos] != '/')) { + aName[nPos++] = aPath[nEndPos++]; + } + aName[nPos] = '\0'; + + ISubtree const* pSubtree = m_pRoot->getChild(aName)->asISubtree(); + + + if (pSubtree) + { + // call recursive the inner child + return pSubtree->getSubtree(aPath + nEndPos); + } + return NULL; + */ + } + + Subtree * Tree::addSubtree(const ConfigurationName& _rLocation, std::auto_ptr<Subtree> _pSubtree, sal_Int16 nLevels) + { + OSL_ENSHURE(nLevels != 0, "Tree::addSubtree : invalid level count !"); + // there was a time where 0 meant "all levels", but we changed the according enum in ITReeProvider + // so that it is -1 now. Since this time, 0 isn't valid as level depth anymore ! + + auto_ptr<INode> pNode; + + // look for the place where to insert the given node + ConfigurationName::Iterator aGoDown = _rLocation.begin(); + ConfigurationName::Iterator aStopAt = _rLocation.end(); + Subtree* pInsertInto = m_pRoot; + while (aGoDown != aStopAt) + { + OUString sCurrentName = *aGoDown; + ++aGoDown; + + Subtree* pExistentSubtree = static_cast<Subtree*>(pInsertInto->getChild(sCurrentName)); + if (!pExistentSubtree) + { + Subtree* pNewChild = NULL; + if (aGoDown != aStopAt) + { // we already incremented aGoDown, so this means we still have (at least) one level to go + // -> we need a new temporary node + pNewChild = new Subtree(sCurrentName); + pNewChild = static_cast<Subtree*>(pInsertInto->addChild(::std::auto_ptr<INode>(pNewChild))); + pNewChild->setLevel(0); // which means "we know nothing about any children" + } + else + { // at this last level, we don't need an intermediate node, instead we have to insert _pSubtree here + break; + } + pExistentSubtree = pNewChild; + } + + // one level down + pInsertInto = pExistentSubtree; + } + + Subtree* pNewSubtree = static_cast<Subtree*>(pInsertInto->addChild(::std::auto_ptr<INode>(_pSubtree.release()))); + pNewSubtree->setLevel(nLevels); + return pNewSubtree; + } + + + // --------------------------------- updateTree --------------------------------- + class TreeUpdate : public ChangeTreeModification + { + ISubtree* m_pCurrentSubtree; + std::vector<OString> aLog; + + public: + TreeUpdate(ISubtree* pSubtree):m_pCurrentSubtree(pSubtree){} + + void handle(ValueChange& aValueNode); + void handle(AddNode& aAddNode); + void handle(RemoveNode& aRemoveNode); + void handle(SubtreeChange& aSubtree); + }; + + void TreeUpdate::handle(ValueChange& aValueNode) + { + // Change a Value + OSL_ENSURE(m_pCurrentSubtree,"Cannot apply ValueChange without subtree"); + + INode* pBaseNode = m_pCurrentSubtree ? m_pCurrentSubtree->getChild(aValueNode.getNodeName()) : 0; + OSL_ENSURE(pBaseNode,"Cannot apply Change: No node to change"); + + ValueNode* pValue = pBaseNode ? pBaseNode->asValueNode() : 0; + OSL_ENSURE(pValue,"Cannot apply ValueChange: Node is not a value"); + + if (pValue) + aValueNode.applyTo(*pValue); +#ifdef DBUG + else + { + ::rtl::OString aStr("TreeUpdate: Can't find value with name:="); + aStr += rtl::OUStringToOString(aValueNode.getNodeName(),RTL_TEXTENCODING_ASCII_US); + OSL_ENSHURE(pValue, aStr.getStr()); + aLog.push_back(aStr); + } +#endif + } + + void TreeUpdate::handle(AddNode& aAddNode) + { + // Add a new Value + if (m_pCurrentSubtree) + m_pCurrentSubtree->addChild(aAddNode.releaseAddedNode()); +#ifdef DBUG + else + aLog.push_back(OString("TreeUpdate: no CurrentSubtree for AddNode")); +#endif + + } + + void TreeUpdate::handle(RemoveNode& aRemoveNode) + { + // remove a Value + if (m_pCurrentSubtree) + { + sal_Bool bOk = (NULL != m_pCurrentSubtree->removeChild(aRemoveNode.getNodeName()).get()); + +#ifdef DBUG + ::rtl::OString aStr("TreeUpdate: Can't remove child with name:="); + aStr += rtl::OUStringToOString(aRemoveNode.getNodeName(),RTL_TEXTENCODING_ASCII_US); + OSL_ENSHURE(bOk, aStr.getStr()); + if (!bOk) + aLog.push_back(aStr); +#endif + } + } + + + void TreeUpdate::handle(SubtreeChange& aSubtree) + { + // handle traversion + ISubtree *pOldSubtree = m_pCurrentSubtree; + OSL_ENSHURE(m_pCurrentSubtree->getChild(aSubtree.getNodeName()), "TreeUpdate::handle : invalid subtree change ... this will crash !"); + m_pCurrentSubtree = m_pCurrentSubtree->getChild(aSubtree.getNodeName())->asISubtree(); + +#if DEBUG + ::rtl::OString aStr("TreeUpdate: there is no Subtree for name:="); + aStr += rtl::OUStringToOString(aSubtree.getNodeName(),RTL_TEXTENCODING_ASCII_US); + OSL_ENSHURE(m_pCurrentSubtree, aStr.getStr()); + if (!m_pCurrentSubtree) + aLog.push_back(aStr); +#endif + + aSubtree.forEachChange(*this); + m_pCurrentSubtree = pOldSubtree; + } + + + void Tree::updateTree( TreeChangeList& aTree) throw (starlang::WrappedTargetException, uno::RuntimeException) + { + ConfigurationName aSubtreeName(aTree.pathToRoot, aTree.root.getNodeName()); + ISubtree *pSubtree = requestSubtree(aSubtreeName.fullName(), ITreeProvider::ALL_LEVELS); + +#ifdef DEBUG + ::rtl::OString aStr("Tree: there is no Subtree for name:="); + aStr += rtl::OUStringToOString(aSubtreeName.fullName(),RTL_TEXTENCODING_ASCII_US); + OSL_ENSHURE(pSubtree, aStr.getStr()); +#endif + + if (pSubtree) + { + TreeUpdate aTreeUpdate(pSubtree); + aTree.root.forEachChange(aTreeUpdate); + } + // Better: + // ISubtree *pCloneTree = m_pRoot->clone(); + // ISubtree *pSubtree = pCloneTree->requestSubtree(aTree.pathToRoot, ITreeProvider::ALL_LEVELS); + // TreeUpdate aTreeUpdate(pSubtree); + // aTreeUpdate.handle(aTree.root); + // if (aTreeUpdate.isOk()) + // { + // delete m_pRoot; + // m_pRoot = pSubtree; + // } + } +} // namespace configmgr + + diff --git a/configmgr/source/tree/cmtreemodel.cxx b/configmgr/source/tree/cmtreemodel.cxx new file mode 100644 index 000000000000..2ef5f6e846aa --- /dev/null +++ b/configmgr/source/tree/cmtreemodel.cxx @@ -0,0 +1,323 @@ +/************************************************************************* + * + * $RCSfile: cmtreemodel.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:42 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <stdio.h> +#ifndef CONFIGMGR_CMTREEMODEL_HXX +#include "cmtreemodel.hxx" +#endif +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif + +//.......................................................................... +namespace configmgr +{ +//.......................................................................... + +//========================================================================== +//= SubtreeChange +//========================================================================== +//-------------------------------------------------------------------------- +SubtreeChange::SubtreeChange(OUString const& _rName) + :Change(_rName) +{ +} + +//-------------------------------------------------------------------------- +SubtreeChange::~SubtreeChange() +{ + for(Children::iterator aIter = m_mChanges.begin(); + aIter != m_mChanges.end(); + ++aIter) + { + // Change* pChange = aIter->second; + delete aIter->second; + } +} + +//-------------------------------------------------------------------------- +void SubtreeChange::addChange(std::auto_ptr<Change> aChange) +{ + OUString aNodeName(aChange->getNodeName()); + OSL_ENSHURE(m_mChanges.end() == m_mChanges.find(aNodeName), + "SubtreeChange::addChange : overwriting an existent change !"); + delete m_mChanges[aNodeName]; + m_mChanges[aNodeName] = aChange.release(); +} + +//-------------------------------------------------------------------------- +::std::auto_ptr<Change> SubtreeChange::removeChange(OUString const& _rName) +{ + Children::iterator aIter = m_mChanges.find(_rName); + + ::std::auto_ptr<Change> aReturn; + if (m_mChanges.end() != aIter) + { + aReturn = ::std::auto_ptr<Change>(aIter->second); + m_mChanges.erase(aIter); + } + return aReturn; +} + +//-------------------------------------------------------------------------- +Change* SubtreeChange::getChange(OUString const& _rName) +{ + return doGetChild(_rName); +} + +//-------------------------------------------------------------------------- +Change const* SubtreeChange::getChange(OUString const& _rName) const +{ + return doGetChild(_rName); +} + +//-------------------------------------------------------------------------- +void SubtreeChange::dispatch(ChangeTreeAction& _anAction) const +{ + _anAction.handle(*this); +} + +//-------------------------------------------------------------------------- +void SubtreeChange::dispatch(ChangeTreeModification& _anAction) +{ + _anAction.handle(*this); +} + +//-------------------------------------------------------------------------- +void SubtreeChange::forEachChange(ChangeTreeAction& _anAction) const +{ + ::std::map< ::rtl::OUString,Change* >::const_iterator aIter = m_mChanges.begin(); + for(;aIter != m_mChanges.end();) + { + ::std::map< ::rtl::OUString,Change* >::const_iterator aNextIter = aIter; + ++aNextIter; + aIter->second->dispatch(_anAction); + aIter = aNextIter; + } +} + +//-------------------------------------------------------------------------- +void SubtreeChange::forEachChange(ChangeTreeModification& _anAction) +{ + ::std::map< ::rtl::OUString,Change* >::const_iterator aIter = m_mChanges.begin(); + for(;aIter != m_mChanges.end();++aIter) + aIter->second->dispatch(_anAction); +} + +//-------------------------------------------------------------------------- +Change* SubtreeChange::doGetChild(OUString const& _rName) const +{ + Children::const_iterator aIter = m_mChanges.find(_rName); + return (aIter != m_mChanges.end()) ? aIter->second : NULL; +} + +//-------------------------------------------------------------------------- +uno::Sequence< OUString > SubtreeChange::elementNames() const +{ + uno::Sequence< OUString > aReturn(size()); + OUString* pReturn = aReturn.getArray(); + + for ( Children::const_iterator aCollector = m_mChanges.begin(); + aCollector != m_mChanges.end(); + ++aCollector, ++pReturn + ) + { + *pReturn = aCollector->first; + } + + return aReturn; +} + +//-------------------------------------------------------------------------- +SubtreeChange::ChildIterator SubtreeChange::begin() const throw() +{ + return ChildIterator(this); +} + +//-------------------------------------------------------------------------- +SubtreeChange::ChildIterator SubtreeChange::end() const throw() +{ + return ChildIterator(this, ChildIterator::EndPos()); +} + +//-------------------------------------------------------------------------- +SubtreeChange::ChildIterator::ChildIterator(const SubtreeChange* _pTree) + :m_pTree(_pTree) + ,m_aNames(_pTree->elementNames()) + ,m_nPos(0) +{ +} + +//-------------------------------------------------------------------------- +SubtreeChange::ChildIterator::ChildIterator(const SubtreeChange* _pTree, struct EndPos) + :m_pTree(_pTree) + ,m_aNames(_pTree->elementNames()) + ,m_nPos(_pTree->size()) +{ +} + +//-------------------------------------------------------------------------- +Change const * SubtreeChange::ChildIterator::operator*() const +{ + if (isValid()) + return m_pTree->getChange(m_aNames[m_nPos]); + OSL_ENSHURE(sal_False, "SubtreeChange::ChildIterator::operator* : invalid iterator !"); + return NULL; +} + +//-------------------------------------------------------------------------- +Change const * SubtreeChange::ChildIterator::operator->() const +{ + if (isValid()) + return m_pTree->getChange(m_aNames[m_nPos]); + OSL_ENSHURE(sal_False, "SubtreeChange::ChildIterator::operator-> : invalid iterator !"); + return NULL; +} + +//-------------------------------------------------------------------------- +SubtreeChange::ChildIterator& SubtreeChange::ChildIterator::operator++() +{ + OSL_ENSHURE(m_nPos < m_aNames.getLength(), "SubtreeChange::ChildIterator : can't increment the end iterator !"); + if (m_nPos < m_aNames.getLength()) + ++m_nPos; + return *this; +} + +//-------------------------------------------------------------------------- +SubtreeChange::ChildIterator& SubtreeChange::ChildIterator::operator--() +{ + OSL_ENSHURE(m_nPos > 0, "SubtreeChange::ChildIterator : can't decrement the begin iterator !"); + if (m_nPos > 0) + --m_nPos; + return *this; +} + +//-------------------------------------------------------------------------- +bool operator==(SubtreeChange::ChildIterator const& lhs, SubtreeChange::ChildIterator const& rhs) +{ + return (lhs.m_pTree == rhs.m_pTree) && (lhs.m_nPos == rhs.m_nPos); +} + +//========================================================================== +//= SubtreeChangeReferrer +//========================================================================== +//-------------------------------------------------------------------------- +SubtreeChangeReferrer::SubtreeChangeReferrer(const SubtreeChange& _rSource) + :SubtreeChange(_rSource.getNodeName()) +{ + ChildIterator aSourceChildren = _rSource.begin(); + while (aSourceChildren != _rSource.end()) + { + const Change* pChange = *aSourceChildren; + OSL_ENSHURE(pChange, "SubtreeChangeReferrer::SubtreeChangeReferrer : invalid change !"); + if ( pChange->isA(ValueChange::getStaticType()) + || pChange->isA(RemoveNode::getStaticType()) + || pChange->isA(AddNode::getStaticType()) + ) + SubtreeChange::addChange(::std::auto_ptr<Change>(const_cast<Change*>(pChange))); + else if ( pChange->isA(SubtreeChange::getStaticType()) + || pChange->isA(SubtreeChangeReferrer::getStaticType()) + ) + { + SubtreeChange::addChange(::std::auto_ptr<Change>(new SubtreeChangeReferrer(*static_cast<const SubtreeChange*>(pChange)))); + } + else + OSL_ENSHURE(sal_False, "SubtreeChangeReferrer::SubtreeChangeReferrer : unknown changes type !"); + + ++aSourceChildren; + } +} + +//-------------------------------------------------------------------------- +SubtreeChangeReferrer::~SubtreeChangeReferrer() +{ + for ( Children::iterator aChildren = m_mChanges.begin(); + aChildren != m_mChanges.end(); + ++aChildren + ) + { + const Change* pChange = aChildren->second; + if ( pChange->isA(ValueChange::getStaticType()) + || pChange->isA(RemoveNode::getStaticType()) + || pChange->isA(AddNode::getStaticType()) + ) + { + // we just hold references to the non-SubtreeChange-objects, so don't delete them + m_mChanges.erase(aChildren); + } + else if ( pChange->isA(SubtreeChange::getStaticType()) + || pChange->isA(SubtreeChangeReferrer::getStaticType()) + ) + { + // nothing to do + } + else + OSL_ENSHURE(sal_False, "SubtreeChangeReferrer::~SubtreeChangeReferrer : unknown changes type !"); + } + + // the base class will remove the remaining SubtreeChanges, which are SubtreeChangeReferrer's in real +} + +//.......................................................................... +} // namespace configmgr +//.......................................................................... + + diff --git a/configmgr/source/tree/makefile.mk b/configmgr/source/tree/makefile.mk new file mode 100644 index 000000000000..6d0cead70b93 --- /dev/null +++ b/configmgr/source/tree/makefile.mk @@ -0,0 +1,89 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:13:42 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. +PRJINC=$(PRJ)$/source + +PRJNAME=configmgr +TARGET=cm +ENABLE_EXCEPTIONS=TRUE + + +# --- Settings --- +.IF "$(DBGUTIL_OJ)"!="" +ENVCFLAGS+=/FR$(SLO)$/ +.ENDIF + +.INCLUDE : settings.mk + +# --- Files --- + +SLOFILES=\ + $(SLO)$/changes.obj \ + $(SLO)$/cmtreemodel.obj \ + $(SLO)$/cmtree.obj + +# --- Targets --- + +.INCLUDE : target.mk +.INCLUDE : $(PRJ)$/util$/target.pmk + diff --git a/configmgr/source/treecache/makefile.mk b/configmgr/source/treecache/makefile.mk new file mode 100644 index 000000000000..5a211c6a2238 --- /dev/null +++ b/configmgr/source/treecache/makefile.mk @@ -0,0 +1,83 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:13:42 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. +PRJINC=$(PRJ)$/source +PRJNAME=configmgr +TARGET=treecache + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ---------------------------------- + +.INCLUDE : settings.mk + +# --- Files ------------------------------------- + +SLOFILES= \ + $(SLO)$/treecache.obj \ + + +# --- Targets ---------------------------------- + +.INCLUDE : target.mk + diff --git a/configmgr/source/xml/makefile.mk b/configmgr/source/xml/makefile.mk new file mode 100644 index 000000000000..7dbbe2583a70 --- /dev/null +++ b/configmgr/source/xml/makefile.mk @@ -0,0 +1,92 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:13:42 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. + +PRJINC=$(PRJ)$/source +PRJNAME=configmgr +TARGET=xml +ENABLE_EXCEPTIONS=TRUE + +# --- Settings --- + +.INCLUDE : settings.mk + +# --- Files --- + + +SLOFILES=\ + $(SLO)$/typeconverter.obj \ + $(SLO)$/xmltreebuilder.obj \ + $(SLO)$/xmlformater.obj \ + $(SLO)$/localsession.obj \ + $(SLO)$/mergeupdates.obj \ + $(SLO)$/dataexport.obj \ + $(SLO)$/dataimport.obj \ + $(SLO)$/updatedom.obj \ + + +# --- Targets --- + +.INCLUDE : target.mk +.INCLUDE : $(PRJ)$/util$/target.pmk + diff --git a/configmgr/source/xml/typeconverter.cxx b/configmgr/source/xml/typeconverter.cxx new file mode 100644 index 000000000000..db302e3c6a29 --- /dev/null +++ b/configmgr/source/xml/typeconverter.cxx @@ -0,0 +1,362 @@ +/************************************************************************* + * + * $RCSfile: typeconverter.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:42 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#include "typeconverter.hxx" + +#ifndef _COM_SUN_STAR_SCRIPT_XTYPECONVERTER_HPP_ +#include <com/sun/star/script/XTypeConverter.hpp> +#endif +#ifndef _COM_SUN_STAR_SCRIPT_FAILREASON_HPP_ +#include <com/sun/star/script/FailReason.hpp> +#endif +#ifndef _COM_SUN_STAR_UNO_TYPE_HXX_ +#include <com/sun/star/uno/Type.hxx> +#endif + +#ifndef _TYPELIB_TYPEDESCRIPTION_HXX_ +#include <typelib/typedescription.hxx> +#endif + + +#ifndef _RTL_USTRING_HXX_ +#include <rtl/ustring.hxx> +#endif + +//#include <stdio.h> + +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif + +namespace staruno = ::com::sun::star::uno; +namespace starscript = ::com::sun::star::script; +namespace starlang = ::com::sun::star::lang; + +namespace configmgr +{ + +//-------------------------------------------------------------------------------------------------- + rtl::OUString toString(const staruno::Reference< starscript::XTypeConverter >& xTypeConverter, const staruno::Any& rValue) throw( starscript::CannotConvertException ) + { + rtl::OUString aRes; + ::staruno::TypeClass aDestinationClass = rValue.getValueType().getTypeClass(); + + switch (aDestinationClass) + { + case ::staruno::TypeClass_BOOLEAN: + case ::staruno::TypeClass_CHAR: + case ::staruno::TypeClass_BYTE: + case ::staruno::TypeClass_SHORT: + case ::staruno::TypeClass_LONG: + case ::staruno::TypeClass_FLOAT: + case ::staruno::TypeClass_DOUBLE: + if (!xTypeConverter.is()) + { + throw( starscript::CannotConvertException( ::rtl::OUString::createFromAscii("stardiv.script.Converter!"), ::staruno::Reference< ::staruno::XInterface > (), + aDestinationClass, starscript::FailReason::UNKNOWN, 0 ) ); + } + xTypeConverter->convertToSimpleType(rValue, ::staruno::TypeClass_STRING) >>= aRes; + break; + case ::staruno::TypeClass_STRING: + rValue >>= aRes; + break; + default: + throw( starscript::CannotConvertException( ::rtl::OUString::createFromAscii("TYPE is not supported!"), staruno::Reference< ::staruno::XInterface > (), + aDestinationClass, starscript::FailReason::TYPE_NOT_SUPPORTED, 0 ) ); + + } + return aRes; + } + + staruno::Any toAny(const staruno::Reference< starscript::XTypeConverter >& xTypeConverter, const ::rtl::OUString& _rValue,const staruno::TypeClass& _rTypeClass) throw( starscript::CannotConvertException ) + { + staruno::Any aRes; + try + { + xTypeConverter->convertToSimpleType(staruno::makeAny(_rValue), _rTypeClass) >>= aRes; + } + catch (starscript::CannotConvertException&) + { + OSL_ENSHURE(sal_False, "toAny : could not convert !"); + } + catch (starlang::IllegalArgumentException&) + { + OSL_ENSHURE(sal_False, "toAny : could not convert !"); + } + return aRes; + } + + ::rtl::OUString toTypeName(const staruno::TypeClass& _rTypeClass) + { + ::rtl::OUString aRet; + switch(_rTypeClass) + { + case staruno::TypeClass_BOOLEAN: aRet = ::rtl::OUString::createFromAscii("boolean"); break; + case staruno::TypeClass_SHORT: aRet = ::rtl::OUString::createFromAscii("short"); break; + case staruno::TypeClass_LONG: aRet = ::rtl::OUString::createFromAscii("integer"); break; + case staruno::TypeClass_HYPER: aRet = ::rtl::OUString::createFromAscii("long"); break; + case staruno::TypeClass_DOUBLE: aRet = ::rtl::OUString::createFromAscii("double"); break; + case staruno::TypeClass_STRING: aRet = ::rtl::OUString::createFromAscii("string"); break; + case staruno::TypeClass_SEQUENCE: aRet = ::rtl::OUString::createFromAscii("binary"); break; + default: + { + ::rtl::OString aStr("Wrong typeclass! "); + aStr += ::rtl::OString::valueOf((sal_Int32)_rTypeClass); + OSL_ENSHURE(0,aStr.getStr()); + } + } + return aRet; + } + + staruno::TypeClass toTypeClass(const ::rtl::OUString& _rType) + { + staruno::TypeClass aRet = staruno::TypeClass_VOID; + + if (_rType.equalsIgnoreCase(::rtl::OUString::createFromAscii("boolean"))) aRet = staruno::TypeClass_BOOLEAN; + else if(_rType.equalsIgnoreCase(::rtl::OUString::createFromAscii("short"))) aRet = staruno::TypeClass_SHORT; + else if(_rType.equalsIgnoreCase(::rtl::OUString::createFromAscii("int"))) aRet = staruno::TypeClass_LONG; + else if(_rType.equalsIgnoreCase(::rtl::OUString::createFromAscii("integer"))) aRet = staruno::TypeClass_LONG; + else if(_rType.equalsIgnoreCase(::rtl::OUString::createFromAscii("long"))) aRet = staruno::TypeClass_HYPER; + else if(_rType.equalsIgnoreCase(::rtl::OUString::createFromAscii("double"))) aRet = staruno::TypeClass_DOUBLE; + else if(_rType.equalsIgnoreCase(::rtl::OUString::createFromAscii("string"))) aRet = staruno::TypeClass_STRING; + else if(_rType.equalsIgnoreCase(::rtl::OUString::createFromAscii("binary"))) aRet = staruno::TypeClass_SEQUENCE; + else + { + ::rtl::OString aStr("Wrong typeclass! "); + aStr += rtl::OUStringToOString(_rType,RTL_TEXTENCODING_ASCII_US); + OSL_ENSHURE(0,aStr.getStr()); + } + + return aRet; + } + +// ************************************************************************* + + namespace + { + + inline staruno::Type getBooleanType() { return ::getBooleanCppuType(); } + + inline staruno::Type getShortType() { return ::getCppuType(static_cast<sal_Int16 const*>(0)); } + inline staruno::Type getIntType() { return ::getCppuType(static_cast<sal_Int32 const*>(0)); } + inline staruno::Type getLongType() { return ::getCppuType(static_cast<sal_Int64 const*>(0)); } + + inline staruno::Type getDoubleType() { return ::getCppuType(static_cast<double const*>(0)); } + + inline staruno::Type getStringType() { return ::getCppuType(static_cast<rtl::OUString const*>(0)); } + +// ************************************************************************* +/* + ::rtl::OUString findXMLTypeName(const staruno::Type& _rType) + { + ::rtl::OUString aRet; + switch(_rType.getTypeClass()) + { + case staruno::TypeClass_BOOLEAN: + OSL_ASSERT( _rType == getBooleanType() ); + aRet = ::rtl::OUString::createFromAscii("boolean"); + break; + + case staruno::TypeClass_SHORT: + OSL_ASSERT( _rType == getShortType() ); + aRet = ::rtl::OUString::createFromAscii("short"); + break; + + case staruno::TypeClass_LONG: + OSL_ASSERT( _rType == getIntType() ); + aRet = ::rtl::OUString::createFromAscii("int"); + break; + + case staruno::TypeClass_HYPER: + OSL_ASSERT( _rType == getLongType() ); + Ret = ::rtl::OUString::createFromAscii("long"); + break; + + case staruno::TypeClass_DOUBLE: + OSL_ASSERT( _rType == getDoubleType() ); + aRet = ::rtl::OUString::createFromAscii("double"); + break; + + case staruno::TypeClass_STRING: + OSL_ASSERT( _rType == getStringType() ); + aRet = ::rtl::OUString::createFromAscii("string"); + break; + + case staruno::TypeClass_SEQUENCE: + if ( _rType == getStringType() ); + aRet = ::rtl::OUString::createFromAscii("sequence"); + break; + + default: + { + ::rtl::OString aStr("Wrong typeclass! "); + aStr += ::rtl::OString::valueOf((sal_Int32)_rTypeClass); + OSL_ENSHURE(0,aStr.getStr()); + } + } + return aRet; + } + */ + } // unamed namespace +// ************************************************************************* + + staruno::Type toType(const ::rtl::OUString& _rType) + { + staruno::Type aRet; + + if (_rType.equalsIgnoreCase(::rtl::OUString::createFromAscii("boolean"))) aRet = getBooleanType(); + + else if(_rType.equalsIgnoreCase(::rtl::OUString::createFromAscii("short"))) aRet = getShortType(); + else if(_rType.equalsIgnoreCase(::rtl::OUString::createFromAscii("int"))) aRet = getIntType(); + else if(_rType.equalsIgnoreCase(::rtl::OUString::createFromAscii("integer"))) aRet = getIntType(); + else if(_rType.equalsIgnoreCase(::rtl::OUString::createFromAscii("long"))) aRet = getLongType(); + + else if(_rType.equalsIgnoreCase(::rtl::OUString::createFromAscii("double"))) aRet = getDoubleType(); + + else if(_rType.equalsIgnoreCase(::rtl::OUString::createFromAscii("string"))) aRet = getStringType(); + else if(_rType.equalsIgnoreCase(::rtl::OUString::createFromAscii("binary"))) aRet = getBinaryType(); +// else if(_rType.equalsIgnoreCase(::rtl::OUString::createFromAscii("sequence"))) aRet = staruno::TypeClass_SEQUENCE; + else + { + ::rtl::OString aStr("Unknown type! "); + aStr += rtl::OUStringToOString(_rType,RTL_TEXTENCODING_ASCII_US); + OSL_ENSHURE(0,aStr.getStr()); + } + + return aRet; + } + staruno::Type toListType(const ::rtl::OUString& _rsElementType) + { + staruno::Type aRet; + + if (_rsElementType.equalsIgnoreCase(::rtl::OUString::createFromAscii("boolean"))) + aRet = ::getCppuType(static_cast<staruno::Sequence<sal_Bool> const*>(0)); + + else if(_rsElementType.equalsIgnoreCase(::rtl::OUString::createFromAscii("short"))) + aRet = ::getCppuType(static_cast<staruno::Sequence<sal_Int16> const*>(0)); + + else if(_rsElementType.equalsIgnoreCase(::rtl::OUString::createFromAscii("int"))) + aRet = ::getCppuType(static_cast<staruno::Sequence<sal_Int32> const*>(0)); + else if(_rsElementType.equalsIgnoreCase(::rtl::OUString::createFromAscii("integer"))) + aRet = ::getCppuType(static_cast<staruno::Sequence<sal_Int32> const*>(0)); + + else if(_rsElementType.equalsIgnoreCase(::rtl::OUString::createFromAscii("long"))) + aRet = ::getCppuType(static_cast<staruno::Sequence<sal_Int64> const*>(0)); + + else if(_rsElementType.equalsIgnoreCase(::rtl::OUString::createFromAscii("double"))) + aRet = ::getCppuType(static_cast<staruno::Sequence<double> const*>(0)); + + else if(_rsElementType.equalsIgnoreCase(::rtl::OUString::createFromAscii("string"))) + aRet = ::getCppuType(static_cast<staruno::Sequence<rtl::OUString> const*>(0)); + + else if(_rsElementType.equalsIgnoreCase(::rtl::OUString::createFromAscii("binary"))) + aRet = ::getCppuType(static_cast<staruno::Sequence<staruno::Sequence<sal_Int8> > const*>(0)); + +// else if(_rsElementType.equalsIgnoreCase(::rtl::OUString::createFromAscii("sequence"))) aRet = staruno::TypeClass_SEQUENCE; + else + { + ::rtl::OString aStr("Unknown type! "); + aStr += rtl::OUStringToOString(_rsElementType,RTL_TEXTENCODING_ASCII_US); + OSL_ENSHURE(0,aStr.getStr()); + } + + return aRet; + } + + staruno::Type getSequenceElementType(staruno::Type const& rSequenceType) + { + OSL_ENSHURE(rSequenceType.getTypeClass() == staruno::TypeClass_SEQUENCE, + "getSequenceElementType() must be called with a sequence type"); + + if (!(rSequenceType.getTypeClass() == staruno::TypeClass_SEQUENCE)) + return staruno::Type(); + + staruno::TypeDescription aTD(rSequenceType); + typelib_IndirectTypeDescription* pSequenceTD = + reinterpret_cast< typelib_IndirectTypeDescription* >(aTD.get()); + + OSL_ASSERT(pSequenceTD); + OSL_ASSERT(pSequenceTD->pType); + + if (pSequenceTD && pSequenceTD->pType) + { + #if (SUPD >= 0x601) + return staruno::Type(pSequenceTD->pType); + #else + OSL_ASSERT(pSequenceTD->pType); + return staruno::Type(pSequenceTD->pType->pWeakRef); + #endif + } + + return staruno::Type(); + } + staruno::Type getBasicType(staruno::Type const& rType, bool& bSequence) + { + bSequence = rType.getTypeClass() == staruno::TypeClass_SEQUENCE && + rType != getBinaryType(); + + if (!bSequence) + return rType; + + return getSequenceElementType(rType); + } + + +} // namespace configmgr diff --git a/configmgr/util/exports.dxp b/configmgr/util/exports.dxp new file mode 100644 index 000000000000..9630d7e06768 --- /dev/null +++ b/configmgr/util/exports.dxp @@ -0,0 +1,3 @@ +component_getImplementationEnvironment +component_writeInfo +component_getFactory diff --git a/configmgr/util/makefile.mk b/configmgr/util/makefile.mk new file mode 100644 index 000000000000..ca92f116e0af --- /dev/null +++ b/configmgr/util/makefile.mk @@ -0,0 +1,106 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:13:43 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=.. +PRJNAME=configmgr +TARGET=cfgmgr + +ENABLE_EXCEPTIONS=TRUE + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/version.mk + + +# --- Library ----------------------------------- + +SHL1TARGET= $(CFGMGR_TARGET)$(CFGMGR_MAJOR) +SHL1VERSIONMAP= $(TARGET).map +SHL1OBJS=$(SLOFILES) +SHL1STDLIBS=\ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(VOSLIB) \ + $(OSLLIB) \ + $(SALLIB) \ + $(CPPRTLLIB) + +SHL1DEPN= +SHL1IMPLIB= i$(SHL1TARGET) +SHL1LIBS= $(SLB)$/registry.lib \ + $(SLB)$/treecache.lib \ + $(SLB)$/session.lib \ + $(SLB)$/misc.lib \ + $(SLB)$/xml.lib \ + $(SLB)$/api.lib \ + $(SLB)$/cm.lib + +SHL1DEF= $(MISC)$/$(SHL1TARGET).def + +DEF1NAME= $(SHL1TARGET) +DEF1EXPORTFILE= exports.dxp + + +# --- Targets ---------------------------------- + +.INCLUDE : target.mk + + diff --git a/configmgr/version.mk b/configmgr/version.mk new file mode 100644 index 000000000000..0e11cac1e39b --- /dev/null +++ b/configmgr/version.mk @@ -0,0 +1,81 @@ +#************************************************************************* +# +# $RCSfile: version.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:13:39 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +# ----------------------------CFGMGR settings------------------------------------# +# target +CFGMGR_TARGET=cfgmgr + +# the major +CFGMGR_MAJOR=2 +# the minor +CFGMGR_MINOR=0 +# the micro +CFGMGR_MICRO=0 + +# this is a c++ compatible library +CFGMGR_CPP=1 + +CFGMGR=$(CFGMGR_TARGET_TARGET)_$(CMPEXT) + + + + diff --git a/configmgr/workben/apitest/cfgadduser.cxx b/configmgr/workben/apitest/cfgadduser.cxx new file mode 100644 index 000000000000..a6d8b45d79f9 --- /dev/null +++ b/configmgr/workben/apitest/cfgadduser.cxx @@ -0,0 +1,409 @@ +/************************************************************************* + * + * $RCSfile: cfgadduser.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:43 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <stdio.h> +#include <string.h> + +#ifndef _UTL_STLTYPES_HXX_ +#include <unotools/stl_types.hxx> +#endif +#include <cppuhelper/extract.hxx> + +#ifndef _COM_SUN_STAR_UNO_TYPE_HXX_ +#include <com/sun/star/uno/Type.hxx> +#endif +#ifndef _COM_SUN_STAR_UNO_TYPECLASS_HPP_ +#include <com/sun/star/uno/TypeClass.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ +#include <com/sun/star/beans/PropertyValue.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ +#include <com/sun/star/beans/PropertyValue.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_XCHANGESBATCH_HPP_ +#include <com/sun/star/util/XChangesBatch.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_ +#include <com/sun/star/container/XNameContainer.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#endif + +#ifndef _CPPUHELPER_SERVICEFACTORY_HXX_ +#include <cppuhelper/servicefactory.hxx> +#endif + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::container; + +#define ASCII_STRING(rtlOUString) ::rtl::OString((rtlOUString).getStr(), (rtlOUString).getLength(), RTL_TEXTENCODING_ASCII_US).getStr() + +//============================================================================= +void explain(sal_Bool _bVerbose) +{ + cout << "cfgadduser - adding users to a registry server\n"; + cout << "\nusage :\n"; + cout << "cfgadduser [-s <server> -p <port>] [-portal] [-r <registry>] [-a <sysaccount>]"; + cout << " [-h <homedirbase>] [-pwd] <user> [<user>]*\n"; + cout << "\nparameters\n"; + cout << " <server> - machine where the registry server is running\n"; + cout << " <port> - port the registry server is listening at\n"; + cout << " <registry> - registry file to use to instantiate services. Defaulted to\n"; + cout << " applicat.rdb\n"; + cout << " <sysaccount> - system account to use for the newly created user(s)\n"; + cout << " <homedirbase> - home directory base. The concret home dir of a user will\n"; + cout << " be built by appending the the user name to the base dir.\n"; + cout << " <user> - user name to add\n"; + cout << " -portal - specify that the program should connect to a running portal,\n"; + cout << " not directly to the registry server (you need a "; +#ifdef WIN32 + cout << "portal.dll\n"; +#else + cout << "libportal.so\n"; +#endif + cout << " for this)\n"; + cout << " In this case, <server> and <port> specify the location where\n"; + cout << " StarPortal is running\n"; + cout << "\n"; + cout << "If no server is specified, the configuration proxy will try to bootstrap from\n"; + cout << "the initialization file ("; +#ifdef WIN32 + cout << "sregistry.ini"; +#else + cout << "sregistryrc"; +#endif + cout << ")\n\n"; + cout.flush(); +} + +//============================================================================= +#if (defined UNX) || (defined OS2) +int main( int argc, char * argv[] ) +#else +int _cdecl main( int argc, char * argv[] ) +#endif +{ + sal_Char* pPort = NULL; + sal_Char* pServer = NULL; + sal_Char* pRegistry = NULL; + sal_Char* pSysAccount = NULL; + sal_Char* pHomeDirBase = NULL; + sal_Bool bPortal = sal_False; + + ::std::vector< sal_Char* > aUsers; + + // collect some parameters + sal_Char** pArgs = argv + 1; + for (sal_Int32 i=1; i<argc; ++i, ++pArgs) + { + sal_Char* pCurArg = *pArgs; + sal_Int32 nLen = strlen(pCurArg); + sal_Bool bInvalidArg = sal_True; + if (nLen && ('-' == *pCurArg)) + { // it's a switch + sal_Char* pSwitch = pCurArg + 1; + switch (nLen) + { + case 2: + switch (*pSwitch) + { + case '?': + explain(sal_True); + return 1; + case 'h': + pHomeDirBase = *++pArgs; + ++i; + bInvalidArg = sal_False; + break; + case 'a': + pSysAccount = *++pArgs; + ++i; + bInvalidArg = sal_False; + break; + case 'p': + pPort = *++pArgs; + ++i; + bInvalidArg = sal_False; + break; + case 's': + pServer = *++pArgs; + ++i; + bInvalidArg = sal_False; + break; + case 'r': + pRegistry = *++pArgs; + ++i; + bInvalidArg = sal_False; + break; + } + break; + case 7: + if (0 == strncmp(pSwitch, "portal", 6)) + { + bInvalidArg = sal_False; + bPortal = sal_True; + } + break; + } + } + else + { + if ((1 == nLen) && ('?' == *pCurArg)) + { + explain(sal_True); + return 1; + } + else + { + bInvalidArg = sal_False; + aUsers.push_back(pCurArg); + } + } + if (bInvalidArg) + { + explain(sal_False); + return 1; + } + } + + if ((!pServer && pPort) || (!pPort && pServer)) + { + explain(sal_False); + return 1; + } + + if (0 == aUsers.size()) + { + explain(sal_False); + return 1; + } + + // refine some params + ::rtl::OUString sHomeDirBase, sSystemAccountName; + if (pHomeDirBase) + { + sHomeDirBase = ::rtl::OUString::createFromAscii(pHomeDirBase); + if (!sHomeDirBase.getLength() || ('/' != sHomeDirBase.getStr()[sHomeDirBase.getLength() - 1])) + sHomeDirBase += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); + } + if (pSysAccount) + sSystemAccountName = ::rtl::OUString::createFromAscii(pSysAccount); + + try + { + ::rtl::OUString const sServiceRegistry = ::rtl::OUString::createFromAscii( pRegistry ? pRegistry : "applicat.rdb" ); + Reference< XMultiServiceFactory > xORB = ::cppu::createRegistryServiceFactory( + sServiceRegistry, + ::rtl::OUString() + ); + if (!xORB.is()) + { + cerr << "Could not create the service factory !\n\n"; + return 1; + } + + // collect the params for the config provider + Sequence< Any > aProviderArgs(3 + (pServer ? 2 : 0)); + aProviderArgs[0] = makeAny(PropertyValue( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("servertype")), + 0, + makeAny(::rtl::OUString::createFromAscii(bPortal ? "portal" : "remote")), + PropertyState_DIRECT_VALUE + )); + aProviderArgs[1] = makeAny(PropertyValue( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user")), + 0, + makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Administrator"))), + PropertyState_DIRECT_VALUE + )); + aProviderArgs[2] = makeAny(PropertyValue( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("password")), + 0, + makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("unused"))), + PropertyState_DIRECT_VALUE + )); + if (pServer) + { + aProviderArgs[3] = makeAny(PropertyValue( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("server")), + 0, + makeAny(::rtl::OUString::createFromAscii(pServer)), + PropertyState_DIRECT_VALUE + )); + + sal_Int32 nPort = ::rtl::OUString::createFromAscii(pPort).toInt32(); + aProviderArgs[4] = makeAny(PropertyValue( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("port")), + 0, + makeAny(nPort), + PropertyState_DIRECT_VALUE + )); + } + + Reference< XMultiServiceFactory > xCfgProvider( + xORB->createInstanceWithArguments(::rtl::OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider"), + aProviderArgs), + UNO_QUERY); + if (!xCfgProvider.is()) + { + cerr << "Could not create the configuration provider !\n\n"; + return 3; + } + + Reference< XInterface > xIFace = xCfgProvider->createInstance( + ::rtl::OUString::createFromAscii("com.sun.star.configuration.UserAdministration")); + if (!xIFace.is()) + { + cerr << "Could not create the configuration provider !\n\n"; + return 4; + } + + Reference< XChangesBatch > xUserChanges(xIFace, UNO_QUERY); + Reference< XNameContainer > xUserContainer(xIFace, UNO_QUERY); + Reference< XSingleServiceFactory> xUserFactory(xIFace, UNO_QUERY); + if (!xUserChanges.is() || !xUserContainer.is() || !xUserFactory.is()) + { + cerr << "the user admin access does not provide the necessary interfaces !\n\n"; + return 5; + } + + cout << "going to add the users ..." << endl << endl; + for ( ::std::vector< sal_Char* >::const_iterator aUserLoop = aUsers.begin(); + aUserLoop != aUsers.end(); + ++aUserLoop + ) + { + cout << *aUserLoop << " ... "; + sal_Bool bHadLinebreak = sal_False; + try + { + Reference< XInterface > xNewUser = xUserFactory->createInstance(); + + // the user name as unicode string use more than once) + ::rtl::OUString sUserName = ::rtl::OUString::createFromAscii(*aUserLoop); + + // the XNameContainer access to the Security node in the user profile data + Reference< XNameReplace > xSecurityDataAccess; + Reference< XNameAccess > xUserDataAccess(xNewUser, UNO_QUERY); + if (xUserDataAccess.is()) + { + Any aSecurity = xUserDataAccess->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Security"))); + ::cppu::extractInterface(xSecurityDataAccess, aSecurity); + } + + if (!xSecurityDataAccess.is()) + throw Exception(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("The user administration service did not provide a valid user template.")), NULL); + + // set the home directory + if (sHomeDirBase.getLength()) + { + ::rtl::OUString sHomeDir(sHomeDirBase); + sHomeDir += sUserName; + xSecurityDataAccess->replaceByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("homeDirectory")), makeAny(sHomeDir)); + cout << "\n\thome dir : " << ASCII_STRING(sHomeDir) << " ... "; + cout.flush(); + bHadLinebreak = sal_True; + } + + if (sSystemAccountName.getLength()) + { + xSecurityDataAccess->replaceByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("systemAccount")), makeAny(sSystemAccountName)); + cout << "\n\tsystem account: " << ASCII_STRING(sSystemAccountName) << " ... "; + cout.flush(); + bHadLinebreak = sal_True; + } + + xUserContainer->insertByName(sUserName, makeAny(xNewUser)); + xUserChanges->commitChanges(); + if (bHadLinebreak) + cout << "\n"; + cout << "done.\n"; + cout.flush(); + } + catch(Exception& e) + { + cout << "\n"; + if (!bHadLinebreak) + cout << "\t"; + cerr << "unable to add the user named " << *aUserLoop << endl; + if (!bHadLinebreak) + cout << "\t"; + cerr << "(exception message: " << ::rtl::OString(e.Message.getStr(), e.Message.getLength(), RTL_TEXTENCODING_ASCII_US).getStr() << ")" << endl; + } + cout << "\n"; + } + } + catch(Exception& e) + { + cerr << "Caught exception: " << ASCII_STRING(e.Message) << endl; + return 2; + } + + return 0; +} diff --git a/configmgr/workben/apitest/cfgapi.cxx b/configmgr/workben/apitest/cfgapi.cxx new file mode 100644 index 000000000000..757f2675a937 --- /dev/null +++ b/configmgr/workben/apitest/cfgapi.cxx @@ -0,0 +1,496 @@ +/************************************************************************* + * + * $RCSfile: cfgapi.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:43 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#define _PRIVATE_TEST_ + +#include <iostream> +using namespace std; + +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/Type.hxx> +#include <com/sun/star/uno/TypeClass.hpp> + +#include <com/sun/star/container/XHierarchicalNameAccess.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XHierarchicalName.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/beans/XExactName.hpp> + +#include <rtl/ustring.hxx> +#include <rtl/string.hxx> + +#ifndef _CPPUHELPER_SERVICEFACTORY_HXX_ +#include <cppuhelper/servicefactory.hxx> +#endif + +#include "createpropertyvalue.hxx" + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::beans; +//using namespace ::com::sun::star::util; + +using ::rtl::OUString; +using ::rtl::OString; +//using namespace ::configmgr; + +using namespace ::cppu; + +#define ASCII(x) ::rtl::OUString::createFromAscii(x) + +ostream& operator << (ostream& out, rtl::OUString const& aStr) +{ + sal_Unicode const* const pStr = aStr.getStr(); + sal_Unicode const* const pEnd = pStr + aStr.getLength(); + for (sal_Unicode const* p = pStr; p < pEnd; ++p) + if (0 < *p && *p < 127) // ASCII + out << char(*p); + else + out << "[\\u" << hex << *p << "]"; + return out; +} +//============================================================================= +//============================================================================= +void test_read_access(Reference< XInterface >& xIface); +//============================================================================= +struct prompt_and_wait +{ + char const* myText; + prompt_and_wait(char const* text = "") : myText(text) {} + ~prompt_and_wait() + { + cout << myText << ">" << endl; + int const mx = int( (+0u - +1u) >> 1); + + char c=0; + if (cin.get(c) && c != '\n') + cin.ignore(mx,'\n'); + } +}; +static prompt_and_wait exit_prompt("Quitting\nQ"); + +// ----------------------------------------------------------------------------- +rtl::OUString enterValue(const char* aStr) +{ + char aValue[300] = "com.sun.star."; + cout << aStr << flush; + if (!cin.getline(aValue, 200)) + { + cerr << "\nInput error\n"; + return OUString(); + } + + OUString sValue = OUString::createFromAscii(aValue); + return sValue; +} + +//============================================================================= +#if (defined UNX) || (defined OS2) +int main( int argc, char * argv[] ) +#else +int _cdecl main( int argc, char * argv[] ) +#endif +{ + TimeValue aTimeout; + aTimeout.Seconds = 5; + aTimeout.Nanosec = 0; + + try + { + OUString const sServiceRegistry = OUString::createFromAscii( argc > 1 ? argv[1] : "applicat.rdb" ); + Reference< XMultiServiceFactory > xORB = createRegistryServiceFactory( + sServiceRegistry, + ::rtl::OUString() + ); + if (!xORB.is()) + { + flush(cout); + cerr << "Could not create the service factory !\n\n"; + return 1; + } + cout << "Service factory created !\n---------------------------------------------------------------" << endl; + + OUString sUser = enterValue(" Enter User: "); + OUString sPasswd = enterValue("Enter Password: "); + + Sequence< Any > aCPArgs(2); + aCPArgs[0] <<= configmgr::createPropertyValue(ASCII("user"), sUser); + aCPArgs[1] <<= configmgr::createPropertyValue(ASCII("password"), sPasswd); + + Reference< XMultiServiceFactory > xCfgProvider( + xORB->createInstanceWithArguments( + ::rtl::OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider"), + aCPArgs), + UNO_QUERY); + if (!xCfgProvider.is()) + { + flush(cout); + cerr << "Could not create the configuration provider !\n\n"; + return 3; + } + +// char aPath[300] = "Root/ApplProfile/StarPortal/"; +// int const nStart = sizeof( "Root/ApplProfile/StarPortal/" ) - 1; + char aPath[300] = "/"; + int nStart = sizeof( "/" ) - 1; + + cout << "Configuration Provider created !\n---------------------------------------------------------------" << endl; + + OUString sPath = enterValue("Enter RootPath: "); + + Sequence< Any > aArgs(2); + aArgs[0] <<= configmgr::createPropertyValue(ASCII("user"), sUser); + aArgs[1] <<= configmgr::createPropertyValue(ASCII("nodepath"), sPath); + + Reference< XInterface > xIFace = xCfgProvider->createInstanceWithArguments( + OUString::createFromAscii("com.sun.star.configuration.ConfigurationAccess"), + aArgs); + cout << "Configuration Read Access created !\n---------------------------------------------------------------" << endl; + + test_read_access(xIFace); + } + catch (Exception& e) + { + flush(cout); + cerr << "Caught exception: " << e.Message << endl; + } + catch (...) + { + flush(cout); + cerr << "BUG: Caught UNKNOWN exception (?) " << endl; + } + + return 0; +} + +/////////////////////////////////////////////////////////////////////////////////////////// +void test(Reference< XHierarchicalName >& xAccessName) +{ + if (xAccessName.is()) + cout << "Accessing Node: " << xAccessName->getHierarchicalName(); + else + cout << "BUG: XHierarchicalName not available"; + cout << endl; +} +void test(Reference< XNamed >& xAccess) +{ + if (xAccess.is()) + cout << "Node is named: " << xAccess->getName(); + else + cout << "BUG: XNamed not available"; + cout << endl; +} + +/////////////////////////////////////////////////////////////////////////////////////////// +void write(Reference<XNameAccess >& xAccess) +{ + if (xAccess.is()) + { + Sequence<OUString> aNames( xAccess->getElementNames() ); + + cout << "Element Names: (" << aNames.getLength() << ")"; + for (int i = 0; i < aNames.getLength(); ++i) + cout << "\n[" << i << "] -\t" << aNames[i]; + cout << endl; + } + else + cout << "BUG: XNameAccess not available"; + cout << endl; +} +void write(Reference< XChild >& xChild) +{ + if (xChild.is()) + cout << "\n[ P ] -\tParent"; + else + cout << "BUG: Parent not available (no XChild)"; + cout << endl; +} +/////////////////////////////////////////////////////////////////////////////////////////// + +bool ask(Reference< XInterface >& xIface); + +void test_read_access(Reference< XInterface >& xIface) +{ + using com::sun::star::uno::UNO_QUERY; + do + { + cout << "\n\n---------------------------------------------------------------" << endl; + Reference< XNameAccess > xAccess(xIface, UNO_QUERY); + Reference< XChild > xChild(xIface, UNO_QUERY); + Reference< XHierarchicalName > xAccessPath(xIface,UNO_QUERY); + Reference< XNamed > xAccessName(xIface,UNO_QUERY); +// Reference< XHierarchicalNameAccess >& xAccess(xIface, UNO_QUERY); + + test(xAccessPath); + test(xAccessName); + write(xAccess); + write(xChild); + } + while (ask(xIface)); +} + +bool ask(Reference< XInterface >& xIface) +{ + cout << "\n[ Q ] -> <Quit>"; + cout << endl; + + cout << "\n:> " << flush; + char buf[200] = {0}; + try + { + if (cin.getline(buf,sizeof buf)) + { + Reference< XInterface > xNext; + if ((buf[0] == 0 || buf[0] == 'q' || buf[0] == 'Q') && (0 == buf[1])) + { + return false; + } + else if ((buf[0] == 'p' || buf[0] == 'P') && (0 == buf[1])) + { + Reference< XChild > xChild(xIface, UNO_QUERY); + if (xChild.is()) + xNext = xChild->getParent(); + + } + else + { + Reference< XNameAccess > xAccess(xIface, UNO_QUERY); + Reference< XHierarchicalNameAccess > xDeepAccess(xIface, UNO_QUERY); + Reference< XExactName > xExactName(xIface, UNO_QUERY); + + if (xAccess.is() || xDeepAccess.is()) + { + OUString aName; + OUString aInput = OUString::createFromAscii(buf); + + if (xExactName.is()) + { + ::rtl::OUString sTemp = xExactName->getExactName(aInput); + if (sTemp.getLength()) + aInput = sTemp; + } + + if (xAccess.is() && xAccess->hasByName(aInput)) + { + aName = aInput; + } + else if (xDeepAccess.is() && xDeepAccess->hasByHierarchicalName(aInput)) + { + aName = aInput; + } + else if ('0' <= buf[0] && buf[0] <= '9' && xAccess.is()) + { + unsigned int n = unsigned(atoi(buf)); + Sequence<OUString> aNames = xAccess->getElementNames(); + if (n < aNames.getLength()) + aName = aNames[n]; + } + + if (aName.getLength()) + { + bool bNest = aInput.indexOf(sal_Unicode('/')) >= 0; + + Any aElement = bNest ? ( xDeepAccess.is() ? xDeepAccess->getByHierarchicalName(aName) : Any()) + : ( xAccess. is() ? xAccess-> getByName(aName) : Any() ); + + while (aElement.getValueTypeClass() == TypeClass_ANY) + { + Any aWrap(aElement); + aWrap >>= aElement; + } + sal_Bool bValue = true; + sal_Bool bValueOk = false; + + switch (aElement.getValueTypeClass() ) + { + case TypeClass_INTERFACE: bValue = false; break; + case TypeClass_BOOLEAN: + { + sal_Bool* pVal = (sal_Bool*)aElement.getValue(); + bValueOk = (pVal != 0); + + cout << "VALUE '" << aName << "' is a BOOLEAN = "; + if (!bValueOk) + cout << "NULL (error!!)"; + else if (*pVal) + cout << "'TRUE'"; + else + cout << "'FALSE'"; + + cout << endl; + } + break; + case TypeClass_SHORT: + { + sal_Int16 aValue; + cout << "VALUE '" << aName << "' is a SHORT (16 bit) = "; + if (bValueOk = (aElement >>= aValue)) + cout << aValue; + else + cout << "ERROR RETRIEVING VALUE"; + cout << endl; + } + break; + case TypeClass_LONG: + { + + sal_Int32 aValue; + cout << "VALUE '" << aName << "' is a INT (32 bit) = "; + if (bValueOk = (aElement >>= aValue)) + cout << aValue; + else + cout << "ERROR RETRIEVING VALUE"; + cout << endl; + } + break; + case TypeClass_HYPER: + { + sal_Int64 aValue; + cout << "VALUE '" << aName << "' is a LONG (64 bit) = "; + if (bValueOk = (aElement >>= aValue)) + cout << double(aValue); + else + cout << "ERROR RETRIEVING VALUE"; + cout << endl; + } + break; + case TypeClass_DOUBLE: + { + double aValue; + cout << "VALUE '" << aName << "' is a DOUBLE = "; + if (bValueOk = (aElement >>= aValue)) + cout << aValue; + else + cout << "ERROR RETRIEVING VALUE"; + cout << endl; + } + break; + case TypeClass_STRING: + { + OUString aValue; + cout << "VALUE '" << aName << "' is a STRING = "; + if (bValueOk = (aElement >>= aValue)) + cout << "\"" << aValue << "\""; + else + cout << "ERROR RETRIEVING VALUE"; + cout << endl; + } + break; + case TypeClass_SEQUENCE: + { + cout << "VALUE '" << aName << "' is a SEQUENCE or BINARY" << endl; + bValueOk = true; + } + break; + case TypeClass_VOID: + cout << "Error: ELEMENT '" << aName << "' is NULL and VOID " << endl; + break; + default: + cout << "Error: ELEMENT '" << aName << "' is of unknown or unrecognized type" << endl; + break; + } + if (bValue) + { + prompt_and_wait(); + return bValueOk; + } + + if (aElement >>= xNext) + cout << "Got an Interface for '" << aName << "'" << endl; + else + cout << "Error: Cannot get an Interface for '" << aName << "'" << endl; + } + else + { + cout << "Error: No element \"" << aInput << "\" found." <<endl; + } + } + + } + if (xNext.is()) + { + xIface = xNext; + return true; + } + cout << "Error: could not obtain the requested Object " << endl; + } + else + { + cout << "Input Error " << endl; + return false; + } + } + catch (Exception& e) + { + cout << "An Exception occurred: " << e.Message << endl; + + } + catch (...) + { + cout << "An UNKNOWN Exception occurred !" << endl; + + } + + + prompt_and_wait(); + return true; +} diff --git a/configmgr/workben/apitest/cfgregistry.cxx b/configmgr/workben/apitest/cfgregistry.cxx new file mode 100644 index 000000000000..2c56ad013801 --- /dev/null +++ b/configmgr/workben/apitest/cfgregistry.cxx @@ -0,0 +1,226 @@ +/************************************************************************* + * + * $RCSfile: cfgregistry.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:43 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#include <memory.h> +#include <stdio.h> + +#ifndef _COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_ +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XNAMEREPLACE_HPP_ +#include <com/sun/star/container/XNameReplace.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XHIERARCHICALNAMEACCESS_HPP_ +#include <com/sun/star/container/XHierarchicalNameAccess.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_ +#include <com/sun/star/container/XChild.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_XCHANGESBATCH_HPP_ +#include <com/sun/star/util/XChangesBatch.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ +#include <com/sun/star/beans/PropertyValue.hpp> +#endif +#ifndef _COM_SUN_STAR_REGISTRY_XSIMPLEREGISTRY_HPP_ +#include <com/sun/star/registry/XSimpleRegistry.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_XFLUSHABLE_HPP_ +#include <com/sun/star/util/XFlushable.hpp> +#endif + +#ifndef _CPPUHELPER_SERVICEFACTORY_HXX_ +#include <cppuhelper/servicefactory.hxx> +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif +#ifndef _CPPUHELPER_EXTRACT_HXX_ +#include <cppuhelper/extract.hxx> +#endif +#ifndef _VOS_CONDITN_HXX_ +#include <vos/conditn.hxx> +#endif +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::xml; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::registry; +using namespace ::vos; +using namespace ::cppu; +//using namespace ::configmgr; + +//============================================================================= +//= a dirty littly class for printing ascii characters +//============================================================================= +class OAsciiOutput +{ +protected: + sal_Char* m_pCharacters; + +public: + OAsciiOutput(const ::rtl::OUString& _rUnicodeChars); + ~OAsciiOutput() { delete m_pCharacters; } + + const sal_Char* getCharacters() const { return m_pCharacters; } +}; + +//----------------------------------------------------------------------------- +OAsciiOutput::OAsciiOutput(const ::rtl::OUString& _rUnicodeChars) +{ + sal_Int32 nLen = _rUnicodeChars.getLength(); + m_pCharacters = new sal_Char[nLen + 1]; + sal_Char* pFillPtr = m_pCharacters; + const sal_Unicode* pSourcePtr = _rUnicodeChars.getStr(); +#ifdef DEBUG + sal_Bool bAsserted = sal_False; +#endif + for (sal_Int32 i=0; i<nLen; ++i, ++pFillPtr, ++pSourcePtr) + { + OSL_ENSHURE(bAsserted || !(bAsserted = (*pSourcePtr >= 0x80)), + "OAsciiOutput::OAsciiOutput : non-ascii character found !"); + *pFillPtr = *reinterpret_cast<const sal_Char*>(pSourcePtr); + } + *pFillPtr = 0; +} + +#define ASCII_STRING(rtlOUString) OAsciiOutput(rtlOUString).getCharacters() +#define UNI_STRING(asciiString) ::rtl::OUString::createFromAscii(asciiString) + +//============================================================================= +//============================================================================= + +#if (defined UNX) || (defined OS2) +void main( int argc, char * argv[] ) +#else +void _cdecl main( int argc, char * argv[] ) +#endif +{ + TimeValue aTimeout; + aTimeout.Seconds = 5; + aTimeout.Nanosec = 0; + + Reference< XMultiServiceFactory > xORB = createRegistryServiceFactory( + ::rtl::OUString::createFromAscii("l:\\bin.a\\applicat.rdb"), + ::rtl::OUString() + ); + if (!xORB.is()) + { + fprintf(stdout, "could not create the service factory !\n\n"); + return; + } + + try + { + Reference< XSimpleRegistry > xConfigurationRegistry; + printf("instantiating the configuration registry access\n\r"); + xConfigurationRegistry = xConfigurationRegistry.query( + xORB->createInstance(::rtl::OUString::createFromAscii("com.sun.star.configuration.ConfigurationRegistry")) + ); + + const sal_Char* pLayoutNode = "com.sun.star.Inet"; + printf("opening the registry access to %s\n\r", pLayoutNode); + xConfigurationRegistry->open(UNI_STRING(pLayoutNode), sal_False, sal_False); + + printf("retrieving the root key, enumerating elements\n\r"); + Reference< XRegistryKey > xRoot = xConfigurationRegistry->getRootKey(); + Sequence< ::rtl::OUString > aKeyNames = xRoot->getKeyNames(); + const ::rtl::OUString* pKeyNames = aKeyNames.getConstArray(); + for (sal_Int32 i=0; i<aKeyNames.getLength(); ++i, ++pKeyNames) + printf("\t%i\t%s\n\r", i, ASCII_STRING(*pKeyNames)); + + const sal_Char* pUpdateKey = "Proxy/NoProxy"; + printf("retrieving the key for %s\n\r", pUpdateKey); + Reference< XRegistryKey > xTabStopsKey = xRoot->openKey(UNI_STRING(pUpdateKey)); + +/* xTabStopsKey->createKey(UNI_STRING("blupp")); + + Sequence< ::rtl::OUString > sLanguages = xTabStopsKey->getStringListValue(); + sLanguages.realloc(sLanguages.getLength() + 1); + sLanguages[sLanguages.getLength() - 1] = UNI_STRING("ru"); + xTabStopsKey->setStringListValue(sLanguages); +*/ + + ::rtl::OUString sTest = xTabStopsKey->getStringValue(); + xTabStopsKey->setStringValue(UNI_STRING("blimp")); + + printf("flushing the changes\n\r"); + Reference< XFlushable > xCommit(xConfigurationRegistry, UNO_QUERY); + xCommit->flush(); + } + catch(RuntimeException& e) + { + printf("\n\r\n\rcaught an RuntimeException :\n\r"); + printf(" exception message : %s\n\r", ASCII_STRING(e.Message)); + return; + } + catch(Exception& e) + { + printf("\n\r\n\rcaught an Exception :\n\r"); + printf(" exception message : %s\n\r", ASCII_STRING(e.Message)); + return; + } +} diff --git a/configmgr/workben/apitest/makefile.mk b/configmgr/workben/apitest/makefile.mk new file mode 100644 index 000000000000..e12353ea51f5 --- /dev/null +++ b/configmgr/workben/apitest/makefile.mk @@ -0,0 +1,133 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:13:43 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. +PRJINC=$(PRJ)$/source + +PRJNAME=configmgr + +TARGET=cfgapi +TARGET2=cfgreg +TARGET3=cfgadduser +TARGETTYPE=CUI +LIBTARGET=NO + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Files -------------------------------------------------------- +CDEFS += -DDLL_VERSION=\"$(UPD)$(DLLPOSTFIX)\" + +# ... common for all test executables .............................. +APPSTDLIBS=\ + $(SALLIB) \ + $(VOSLIB) \ + $(CPPULIB) \ + $(CPPUHELPERLIB) + +# ... cfgapi .............................. +APP1STDLIBS = $(APPSTDLIBS) + +APP1STDLIBS+=$(STDLIBCPP) + +.IF "$(GUI)"=="WNT" +APP1STDLIBS+=$(LIBCIMT) +.ENDIF + +APP1TARGET= $(TARGET) +APP1OBJS= \ + $(SLO)$/cfgapi.obj \ + +# ... cfgreg .............................. +APP2STDLIBS = $(APPSTDLIBS) + +APP2STDLIBS+=$(STDLIBCPP) + +.IF "$(GUI)"=="WNT" +APP2STDLIBS+=$(LIBCIMT) +.ENDIF + +APP2TARGET= $(TARGET2) +APP2OBJS= \ + $(SLO)$/cfgregistry.obj \ + +# ... cfgadduser .............................. +APP3STDLIBS = $(APPSTDLIBS) + +APP3STDLIBS+=$(STDLIBCPP) + +.IF "$(GUI)"=="WNT" +APP3STDLIBS+=$(LIBCIMT) +.ENDIF + +APP3TARGET= $(TARGET3) +APP3OBJS= \ + $(SLO)$/cfgadduser.obj \ + + +.INCLUDE : target.mk + + diff --git a/configmgr/workben/apitest/sregistry b/configmgr/workben/apitest/sregistry new file mode 100644 index 000000000000..f4f353181f25 --- /dev/null +++ b/configmgr/workben/apitest/sregistry @@ -0,0 +1,8 @@ +[configuration] +servertype=remote +[RemoteRegistry] +Server=munch-11072:100 +Timeout=2500 +[LocalRegistry] +rootpath="G:\Configuration" + diff --git a/configmgr/workben/local_io/cfgfile.cxx b/configmgr/workben/local_io/cfgfile.cxx new file mode 100644 index 000000000000..844b20aabeb6 --- /dev/null +++ b/configmgr/workben/local_io/cfgfile.cxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * $RCSfile: cfgfile.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:43 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +// ----------------------------------------------------------------------------- +// ------------------------------------ main ------------------------------------ +// ----------------------------------------------------------------------------- + +/* + OUString operator+(const OUString &a, const OUString &b) + { + OUString c = a; + c += b; + return c; + } +*/ + +namespace configmgr +{ + void simpleMappingTest(); + + void importTest(); + void exportTest(); + + void hierarchyTest(); + //void simpleTest(); + void speedTest(); + void stringTest(); +} + + +#if (defined UNX) || (defined OS2) +int main( int argc, char * argv[] ) +#else + int _cdecl main( int argc, char * argv[] ) +#endif +{ + +// configmgr::hierarchyTest(); + + +// configmgr::importTest(); +// configmgr::exportTest(); +// configmgr::speedTest(); +// configmgr::simpleTest(); + +// configmgr::simpleMappingTest(); + configmgr::stringTest(); + + return 0; +} + + diff --git a/configmgr/workben/local_io/cfglocal.cxx b/configmgr/workben/local_io/cfglocal.cxx new file mode 100644 index 000000000000..8c2111b8f364 --- /dev/null +++ b/configmgr/workben/local_io/cfglocal.cxx @@ -0,0 +1,666 @@ +/************************************************************************* + * + * $RCSfile: cfglocal.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:43 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#define _PRIVATE_TEST_ + +#include <memory.h> +#include <string.h> +#include <stdio.h> + +#ifndef _VOS_SOCKET_HXX_ +#include <vos/socket.hxx> +#endif + +#ifndef _CONFIGMGR_MISC_ATTRIBUTES_HXX_ +#include "attributes.hxx" +#endif + +#ifndef _CONFIGMGR_SESSION_REMOTESESSION_HXX_ +#include "remotesession.hxx" +#endif +#ifndef _COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_ +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#endif + +#ifndef _CPPUHELPER_SERVICEFACTORY_HXX_ +#include <cppuhelper/servicefactory.hxx> +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif +#ifndef _VOS_CONDITN_HXX_ +#include <vos/conditn.hxx> +#endif + +#include <osl/time.h> + +#include "localsession.hxx" +#include "confname.hxx" + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::xml; +using namespace ::vos; +using namespace ::cppu; +using namespace ::configmgr; +using namespace rtl; + +// #define USE_LAYOUT_NODE + +//============================================================================= +//= a dirty littly class for printing ascii characters +//============================================================================= +class OAsciiOutput +{ +protected: + sal_Char* m_pCharacters; + +public: + OAsciiOutput(const ::rtl::OUString& _rUnicodeChars); + ~OAsciiOutput() { delete m_pCharacters; } + + const sal_Char* getCharacters() const { return m_pCharacters; } +}; + +//----------------------------------------------------------------------------- +OAsciiOutput::OAsciiOutput(const ::rtl::OUString& _rUnicodeChars) +{ + sal_Int32 nLen = _rUnicodeChars.getLength(); + m_pCharacters = new sal_Char[nLen + 1]; + sal_Char* pFillPtr = m_pCharacters; + const sal_Unicode* pSourcePtr = _rUnicodeChars.getStr(); +#ifdef DBG_UTIL + sal_Bool bAsserted = sal_False; +#endif + for (sal_Int32 i=0; i<nLen; ++i, ++pFillPtr, ++pSourcePtr) + { + OSL_ENSHURE(bAsserted || !(bAsserted = (*pSourcePtr >= 0x80)), + "OAsciiOutput::OAsciiOutput : non-ascii character found !"); + *pFillPtr = *reinterpret_cast<const sal_Char*>(pSourcePtr); + } + *pFillPtr = 0; +} + +#define ASCII_STRING(rtlOUString) OAsciiOutput(rtlOUString).getCharacters() +#define UNI_STRING(salCharPtr) ::rtl::OUString::createFromAscii(salCharPtr) + +//============================================================================= +//= OOpenNodeCallback +//============================================================================= +typedef ::cppu::WeakImplHelper1< sax::XDocumentHandler > OOpenNodeCallback_Base; +class OOpenNodeCallback : public IOpenObjectCallback, public OOpenNodeCallback_Base +{ +protected: + OUString m_sNodeId; + ::vos::OCondition& m_rFinishCondition; + + enum ACTION { STARTELEMENT, CHARACTERS, ENDELEMENT }; + ACTION m_eLastAction; + sal_Int32 m_nLevel; + sal_Bool m_bCloseStartTag; + +protected: + ~OOpenNodeCallback() + { + } + +public: + OOpenNodeCallback(::vos::OCondition& _rFinishCond) : m_rFinishCondition(_rFinishCond), m_nLevel(0), m_eLastAction(ENDELEMENT), m_bCloseStartTag(sal_False) { } + + OUString getNodeId() const { return m_sNodeId; } + + // IOpenObjectCallback + virtual void gotObjectId(const OUString &aName); + + // IDataRequestCallback + virtual Reference< sax::XDocumentHandler > getDataReader() { return static_cast< sax::XDocumentHandler* >(this); } + + // IRequestCallback + virtual void acknowledged(sal_Int32 _nTransId); + virtual void failed(sal_Int32 _nErrorCode); + virtual void done(const StatusInfo& _rStatus); + + // IInterface + virtual void SAL_CALL acquire( ) throw (::com::sun::star::uno::RuntimeException) { OOpenNodeCallback_Base::acquire(); } + virtual void SAL_CALL release( ) throw (::com::sun::star::uno::RuntimeException) { OOpenNodeCallback_Base::release(); } + + // XDocumentHandler + virtual void SAL_CALL startDocument( ) throw(sax::SAXException, RuntimeException) { } + virtual void SAL_CALL endDocument( ) throw(sax::SAXException, RuntimeException) { } + virtual void SAL_CALL startElement( const ::rtl::OUString& aName, const Reference< sax::XAttributeList >& xAttribs ) throw(sax::SAXException, RuntimeException); + virtual void SAL_CALL endElement( const ::rtl::OUString& aName ) throw(sax::SAXException, RuntimeException); + virtual void SAL_CALL characters( const ::rtl::OUString& aChars ) throw(sax::SAXException, RuntimeException); + virtual void SAL_CALL ignorableWhitespace( const ::rtl::OUString& aWhitespaces ) throw(sax::SAXException, RuntimeException) { } + virtual void SAL_CALL processingInstruction( const ::rtl::OUString& aTarget, const ::rtl::OUString& aData ) throw(sax::SAXException, RuntimeException) { } + virtual void SAL_CALL setDocumentLocator( const Reference< sax::XLocator >& xLocator ) throw(sax::SAXException, RuntimeException) { } +}; + +//............................................................................. +inline void linefeed() +{ + // printf("\n"); +} + +//............................................................................. +void printTabs(sal_Int32 _nCount) +{ + sal_Char* pBuffer = new sal_Char[2 * _nCount + 1]; + memset(pBuffer, ' ', 2 * _nCount); + pBuffer[2 * _nCount] = 0; + // printf(pBuffer); +} + +//----------------------------------------------------------------------------- +void SAL_CALL OOpenNodeCallback::startElement( const ::rtl::OUString& _rName, const Reference< sax::XAttributeList >& xAttribs ) throw(sax::SAXException, RuntimeException) +{ + switch (m_eLastAction) + { + case STARTELEMENT: + if (m_bCloseStartTag) + { + // printf(">"); + } + + m_bCloseStartTag = sal_False; + // no break + case CHARACTERS: + case ENDELEMENT: + linefeed(); + printTabs(m_nLevel); + break; + } + m_eLastAction = STARTELEMENT; + ++m_nLevel; + // printf("<%s", ASCII_STRING(_rName)); + m_bCloseStartTag = sal_True; +} + +//----------------------------------------------------------------------------- +void SAL_CALL OOpenNodeCallback::endElement( const ::rtl::OUString& _rName ) throw(sax::SAXException, RuntimeException) +{ + --m_nLevel; + switch (m_eLastAction) + { + case STARTELEMENT: + if (m_bCloseStartTag) + { + // printf("/>"); + } + + m_bCloseStartTag = sal_False; + break; + case ENDELEMENT: + linefeed(); + printTabs(m_nLevel); + // dont break + case CHARACTERS: + // printf("</%s>", ASCII_STRING(_rName)); + break; + } + m_eLastAction = ENDELEMENT; +} + +//----------------------------------------------------------------------------- +void SAL_CALL OOpenNodeCallback::characters( const ::rtl::OUString& _rChars ) throw(sax::SAXException, RuntimeException) +{ + if (STARTELEMENT == m_eLastAction) + { + if (m_bCloseStartTag && _rChars.trim().getLength()) + { + // printf(">"); + m_bCloseStartTag = sal_False; + } + } + if (_rChars.trim().getLength() != 0) + { + // printf("%s", ASCII_STRING(_rChars)); + m_eLastAction = CHARACTERS; + } +} + +//----------------------------------------------------------------------------- +void OOpenNodeCallback::gotObjectId(const OUString &_nId) +{ + m_sNodeId = _nId; + // printf("object id %i\n", m_nNodeId); +} + +//----------------------------------------------------------------------------- +void OOpenNodeCallback::acknowledged(sal_Int32 _nTransId) +{ + // printf("acknowledged, transaction id : %i\n", _nTransId); +} + +//----------------------------------------------------------------------------- +void OOpenNodeCallback::failed(sal_Int32 _nErrorCode) +{ + // printf("failed because of a connection error (%i)\n", _nErrorCode); + m_rFinishCondition.set(); +} + +//----------------------------------------------------------------------------- +void OOpenNodeCallback::done(const StatusInfo& _rStatus) +{ + if (_rStatus.nCode) + { + printf("\n\ndone, but had an error : %s\n", ASCII_STRING(_rStatus.sMessage)); + } + else + { + // printf("\n\nsuccessfully done\n", ASCII_STRING(_rStatus.sMessage)); + } + + m_rFinishCondition.set(); +} + +//============================================================================= +//= ONodeUpdater +//============================================================================= +class ONodeUpdater : public IDOMNodeDataProvider +{ + sal_Bool m_bWriterLevel; + sal_Bool m_bAdd; +public: + ONodeUpdater(sal_Bool _bStartAtWriterLevel, sal_Bool bAdd) : m_bWriterLevel(_bStartAtWriterLevel), m_bAdd(bAdd) { } + + virtual void writeNodeData(const Reference< sax::XDocumentHandler >& _rHandler); +}; + +//----------------------------------------------------------------------------- +void ONodeUpdater::writeNodeData(const Reference< sax::XDocumentHandler >& _rHandler) +{ + AttributeListImpl *pAttr = new AttributeListImpl; + Reference< sax::XAttributeList > xEmptyAttrList = pAttr; + + pAttr = new AttributeListImpl; + pAttr->addAttribute(UNI_STRING("type"),UNI_STRING("CDATA"),UNI_STRING("string")); + Reference< sax::XAttributeList > xStringAttrList = pAttr; + + if (m_bWriterLevel) + _rHandler->startElement(UNI_STRING("Writer"), xEmptyAttrList); +#ifdef USE_LAYOUT_NODE + _rHandler->startElement(UNI_STRING("Layout"), xEmptyAttrList); + _rHandler->startElement(UNI_STRING("TabStops"), xEmptyAttrList); + if (m_bAdd) + _rHandler->characters(UNI_STRING("0.90")); + else + _rHandler->characters(UNI_STRING("99.99")); + + _rHandler->endElement(UNI_STRING("TabStops")); + _rHandler->endElement(UNI_STRING("Layout")); +#else + // _rHandler->startElement(UNI_STRING("com.sun.star.office.Setup"), xEmptyAttrList); + _rHandler->startElement(UNI_STRING("Modules"), xEmptyAttrList); + _rHandler->startElement(UNI_STRING("StandFonts"), xEmptyAttrList); + _rHandler->startElement(UNI_STRING("Standard"), xStringAttrList); + _rHandler->startElement(UNI_STRING("value"), xEmptyAttrList); + if (m_bAdd) + _rHandler->characters(UNI_STRING("Arial")); + else + _rHandler->characters(UNI_STRING("Courier")); + + _rHandler->endElement(UNI_STRING("value")); + _rHandler->endElement(UNI_STRING("Standard")); + _rHandler->endElement(UNI_STRING("StandFonts")); + _rHandler->endElement(UNI_STRING("Modules")); + // _rHandler->endElement(UNI_STRING("com.sun.star.office.Setup")); + + _rHandler->ignorableWhitespace(OUString()); +#endif + if (m_bWriterLevel) + _rHandler->endElement(UNI_STRING("Writer")); +} + +//============================================================================= +//= OSessionListener +//============================================================================= +class OSessionListener : public ISessionListener +{ +protected: + oslInterlockedCount m_refCount; + +public: + // ISessionListener + virtual void nodeUpdated(const ::rtl::OUString& _rNodePath); + virtual void nodeDeleted(const ::rtl::OUString& _rNodePath); + virtual void nodeAdded(const ::rtl::OUString& _rNodePath); + + // IInterface + virtual void SAL_CALL acquire( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL release( ) throw (::com::sun::star::uno::RuntimeException); +}; + +//----------------------------------------------------------------------------- +void OSessionListener::nodeUpdated(const ::rtl::OUString& _rNodePath) +{ + // printf("[listener] : a node was updated, node path : %s\n", ASCII_STRING(_rNodePath)); +} + +//----------------------------------------------------------------------------- +void OSessionListener::nodeDeleted(const ::rtl::OUString& _rNodePath) +{ + // printf("[listener] : a node was deleted, node path : %s\n", ASCII_STRING(_rNodePath)); +} + +//----------------------------------------------------------------------------- +void OSessionListener::nodeAdded(const ::rtl::OUString& _rNodePath) +{ + // printf("\n[listener] : a node was added, node path : %s", ASCII_STRING(_rNodePath)); +} + +//----------------------------------------------------------------------------- +void SAL_CALL OSessionListener::acquire( ) throw (::com::sun::star::uno::RuntimeException) +{ + osl_incrementInterlockedCount(&m_refCount); +} + +//----------------------------------------------------------------------------- +void SAL_CALL OSessionListener::release( ) throw (::com::sun::star::uno::RuntimeException) +{ + if (!osl_decrementInterlockedCount(&m_refCount)) + delete this; +} + +//============================================================================= +//============================================================================= + +//============================================================================= +static ::rtl::OUString sHost; +static sal_Int32 nPort; +static ::rtl::OUString sRegistry = ::rtl::OUString::createFromAscii("applicat.rdb"); + +//============================================================================= +sal_Bool collectArgs(int argc, char * argv[]) +{ + if (argc > 1) + { + sal_Char* pConnectTo = argv[1]; + sal_Char* pSeparator = strchr(pConnectTo, ':'); + if (pSeparator && (0 != *(pSeparator + 1))) + { + sHost = ::rtl::OUString(pConnectTo, pSeparator - pConnectTo, RTL_TEXTENCODING_ASCII_US); + nPort = ::rtl::OUString::createFromAscii(pSeparator + 1).toInt32(); + + if (argc > 2) + sRegistry = ::rtl::OUString::createFromAscii(argv[2]); + return sal_True; + } + } + + printf("cfgclient - registry server client test ...\n\r\n\r"); + printf("usage :\n\r"); + printf(" cfgclient <server>:<port> [<registry file>]\n\r\n\r"); + printf(" <server> : machine to connect to\n\r"); + printf(" <port> : port to connect to\n\r"); + printf(" <registry file> : (optional) registry to bootstrap from. defaulted to \"applicat.rdb\"\n\r\n\r"); + return sal_False; +} + +//============================================================================= + +#if (defined UNX) || (defined OS2) +void main( int argc, char * argv[] ) +#else +void _cdecl main( int argc, char * argv[] ) +#endif +{ + Reference< XMultiServiceFactory > xORB; + try + { + xORB = createRegistryServiceFactory(sRegistry, ::rtl::OUString()); + } + catch (Exception& e) + { + printf("could not bootstrap the services from %s\n\r", ASCII_STRING(sRegistry)); + printf(" (error message : %s)", ASCII_STRING(e.Message)); + } + + if (!xORB.is()) + { + fprintf(stdout, "could not create the service factory !"); + return; + } + + ORef< OSessionListener > xListener = new OSessionListener; + { +/* + ORemoteSession aSession(xORB); + // --------- connect ---------- + sal_Bool bSuccess = aSession.connect(sHost, nPort, &aTimeout); + if (!bSuccess) + { + printf("could not connect to the server (error : %i) ...", aSession.getConnectionError()); + return; + } +*/ + + void testSession(const Reference< XMultiServiceFactory > &xORB, bool bPrint); + + for (int i=0;i<100;i++) + { + TimeValue aStartTime, aEndTime; + osl_getSystemTime(&aStartTime); + testSession(xORB, false); + osl_getSystemTime(&aEndTime); + + sal_Int32 nSeconds = aEndTime.Seconds - aStartTime.Seconds; + sal_Int32 nNanoSec = aEndTime.Nanosec - aStartTime.Nanosec; + if (nNanoSec < 0) + { + nNanoSec = 1000000000 - nNanoSec; + nSeconds++; + } + + cout << "Time: " << nSeconds << ". " << nNanoSec << endl; + } + } +} + +void testSession(const Reference< XMultiServiceFactory > &xORB, bool bPrint) +{ + TimeValue aTimeout; + aTimeout.Seconds = 5; + aTimeout.Nanosec = 0; + + + // create it .. and connect + LocalSession aSession(xORB); + + // --------- openSession ---------- + + OUString aRootPath = OUString::createFromAscii("f:/local/SRC598/configmgr/workben/local_io"); + // f:/local/SRC595/configmgr/workben/local_io); + aSession.open(aRootPath); + + if (aSession.isOpen()) + { + if (bPrint) printf("\nopened the session ..."); + } + else + { + printf("\ncould not open the session ... exiting\n\n"); + return; + } + + // aSession.setListener(xListener.getBodyPtr()); + + OCondition aWaitForSomething; + aWaitForSomething.reset(); + + // --------- openNode ---------- + char* pWriterNode = "com.sun.star.Setup/Modules"; + if (bPrint) printf("\nsending an openNode request for %s ...\n", pWriterNode); + ORef< OOpenNodeCallback > xOpenCallback = new OOpenNodeCallback(aWaitForSomething); + aSession.openNode(UNI_STRING(pWriterNode), 2, xOpenCallback.getBodyPtr()); + + aTimeout.Seconds = 30; + switch (aWaitForSomething.wait(&aTimeout)) + { + case ICondition::result_error: + printf("error while waiting for the callback ... exiting\n\n"); + return; + case ICondition::result_timeout: + if (bPrint) printf("timed out ... exiting\n\n"); + return; + } + + OUString sOpenedNode = xOpenCallback->getNodeId(); + +// aSession.getNode(UNI_STRING("com.sun.star.Spreadsheet"), NULL); +// +// // --------- getNode (1) ---------- +//#ifdef USE_LAYOUT_NODE +// char* pLayoutNode = "com.sun.star.office.Setup/Modules"; +//#else + char* pLayoutNode = "com.sun.star.Setup/Modules"; +//#endif +// printf("\nsending an getNode request for %s ...\n", pLayoutNode); +// aWaitForSomething.reset(); +// aSession.getNode(UNI_STRING(pLayoutNode), new OOpenNodeCallback(aWaitForSomething)); +// +// switch (aWaitForSomething.wait(&aTimeout)) +// { +// case ICondition::result_error: +// printf("error while waiting for the callback ... exiting\n\n"); +// return; +// case ICondition::result_timeout: +// printf("timed out ... exiting\n\n"); +// return; +// } + + // --------- addNode ---------- + if (bPrint) printf("\n\naddNode ...."); + ONodeUpdater aAddTabstops(sal_False, true); // true = WRITER LEVEL + aWaitForSomething.reset(); + aSession.addNode(sOpenedNode, UNI_STRING(pLayoutNode), &aAddTabstops, new OOpenNodeCallback(aWaitForSomething)); + switch (aWaitForSomething.wait(&aTimeout)) + { + case ICondition::result_error: + printf("error while waiting for the callback ... exiting\n\n"); + return; + case ICondition::result_timeout: + if (bPrint) printf("timed out ... exiting\n\n"); + return; + } + + // --------- updateNode ---------- + if (bPrint) printf("\n\nokay, let's try an update ....\n"); + + ONodeUpdater aUpdateWriter(sal_False, false); + aWaitForSomething.reset(); + aSession.updateNode(sOpenedNode, UNI_STRING(pLayoutNode), &aUpdateWriter, new OOpenNodeCallback(aWaitForSomething)); + + switch (aWaitForSomething.wait(&aTimeout)) + { + case ICondition::result_error: + printf("error while waiting for the callback ... exiting\n\n"); + return; + case ICondition::result_timeout: + if (bPrint) printf("timed out ... exiting\n\n"); + return; + } + + // --------- deleteNode ---------- + char* pLayoutNode2 = "com.sun.star.Setup/Modules/StandFonts"; + + if (bPrint) printf("\n\ndeleteNode ...."); + aWaitForSomething.reset(); + aSession.deleteNode(sOpenedNode, UNI_STRING(pLayoutNode2), new OOpenNodeCallback(aWaitForSomething)); + switch (aWaitForSomething.wait(&aTimeout)) + { + case ICondition::result_error: + printf("error while waiting for the callback ... exiting\n\n"); + return; + case ICondition::result_timeout: + if (bPrint) printf("timed out ... exiting\n\n"); + return; + } + +/* + // --------- startListening ---------- + printf("\n\nadding a listener for the Layout node\n"); + Sequence< ::rtl::OUString > aNodesToListen(1); + aNodesToListen[0] = UNI_STRING(pLayoutNode); + aSession.startListening(aNodesToListen, NULL); + + printf("waiting 10 seconds ....\n\n"); + aWaitForSomething.reset(); + aTimeout.Seconds = 10; + aWaitForSomething.wait(&aTimeout); +*/ + // --------- getNode (2) ---------- +// printf("\ndoing a new getNode for the Layout node ...\n"); +// aWaitForSomething.reset(); +// aSession.getNode(UNI_STRING(pLayoutNode), new OOpenNodeCallback(aWaitForSomething)); +// switch (aWaitForSomething.wait(&aTimeout)) +// { +// case ICondition::result_error: +// printf("error while waiting for the callback ... exiting\n\n"); +// return; +// case ICondition::result_timeout: +// printf("timed out ... exiting\n\n"); +// return; +// } + + aSession.closeNode(sOpenedNode, NULL); + aSession.close(NULL); + +} + diff --git a/configmgr/workben/local_io/com.sun.star.office.Setup.xml b/configmgr/workben/local_io/com.sun.star.office.Setup.xml new file mode 100644 index 000000000000..4018ab3b8d5d --- /dev/null +++ b/configmgr/workben/local_io/com.sun.star.office.Setup.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<com.sun.star.office.Setup> + <Language> + <Language_ID Type="string"><value>1033</value></Language_ID> + </Language> + <Modules> + <SCalc Type="boolean"> + <value>true</value> + </SCalc> + <SChart Type="boolean"> + <value>true</value> + </SChart> + <SDraw Type="boolean"> + <value>true</value> + </SDraw> + <SImage Type="boolean"> + <value>true</value> + </SImage> + <SImpress Type="boolean"> + <value>true</value> + </SImpress> + <SMath Type="boolean"> + <value>true</value> + </SMath> + <SWriter Type="boolean"> + <value>true</value> + </SWriter> + </Modules> +</com.sun.star.office.Setup>
\ No newline at end of file diff --git a/configmgr/workben/local_io/filetest.cxx b/configmgr/workben/local_io/filetest.cxx new file mode 100644 index 000000000000..1d038480e827 --- /dev/null +++ b/configmgr/workben/local_io/filetest.cxx @@ -0,0 +1,127 @@ +/************************************************************************* + * + * $RCSfile: filetest.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:43 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#include <iostream> + +#ifndef _OSL_FILE_HXX_ +#include<osl/file.hxx> +#endif + +#include <rtl/ustring.hxx> + +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_ +#include <com/sun/star/uno/Sequence.hxx> +#endif + +// ----------------------------------------------------------------------------- +// --------------------------------- namespaces --------------------------------- +// ----------------------------------------------------------------------------- +using namespace com::sun::star::uno; + +using ::rtl::OUString; +using ::osl::File; +// ----------------------------------------------------------------------------- +// ---------------------------------- defines ---------------------------------- +// ----------------------------------------------------------------------------- +#define ASCII(x) OUString::createFromAscii(x) + + +// ----------------------------------------------------------------------------- +// ------------------------------------ main ------------------------------------ +// ----------------------------------------------------------------------------- + +/* +OUString operator+(const OUString &a, const OUString &b) +{ + OUString c = a; + c += b; + return c; +} +*/ + +#if (defined UNX) || (defined OS2) +int main( int argc, char * argv[] ) +#else +int _cdecl main( int argc, char * argv[] ) +#endif +{ + OUString aPath = ASCII("f:/local/SRC598/configmgr/workben/local_io"); + OUString aFilename = ASCII("com.sun.star.office.Setup"); + OUString aExtension = ASCII("xml"); + + OUString aFullname = aPath + ASCII("/") + aFilename + ASCII(".") + aExtension; + + // Filename convertieren + OUString aURL; + File aConvert(ASCII("")); + aConvert.normalizePath(aFullname, aURL); + + // File oeffnen + File aFile(aURL); + aFile.open(osl_File_OpenFlag_Read); + + sal_uInt64 nBytesRead; + Sequence< sal_Int8 > aBufferSeq(2000); + sal_Int8 *pBuff = aBufferSeq.getArray(); + aFile.read(pBuff, 2000, nBytesRead); + + aFile.close(); + return 0; +} diff --git a/configmgr/workben/local_io/makefile.mk b/configmgr/workben/local_io/makefile.mk new file mode 100644 index 000000000000..e82cc8e9c586 --- /dev/null +++ b/configmgr/workben/local_io/makefile.mk @@ -0,0 +1,154 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:13:43 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. +PRJINC=$(PRJ)$/source + +PRJNAME=configmgr + +TARGET=cfglocal +TARGETTYPE=CUI +LIBTARGET=NO + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Files -------------------------------------------------------- +CDEFS += -DDLL_VERSION=\"$(UPD)$(DLLPOSTFIX)\" + +# ... common for all test executables .............................. +APPSTDLIBS=\ + $(SALLIB) \ + $(VOSLIB) \ + $(CPPULIB) \ + $(UNOTOOLSLIB) \ + $(CPPUHELPERLIB) \ + + +# ... FileTests ..................................................... +APP1STDLIBS = $(APPSTDLIBS) \ + $(STDLIBCPP) \ + +APP1STDLIBS+=$(STDLIBCPP) + +.IF "$(GUI)"=="WNT" +APP1STDLIBS+=$(LIBCIMT) +.ENDIF + + +APP1TARGET= cfgfile + +APP1OBJS= \ + $(SLO)$/cfgfile.obj \ + $(SLO)$/oslstream.obj \ + $(SLO)$/xmlexport.obj \ + $(SLO)$/xmlimport.obj \ + $(SLO)$/filehelper.obj \ + $(SLO)$/simpletest.obj \ + $(SLO)$/strimpl.obj \ + +# $(SLO)$/xmltreebuilder.obj \ +# $(SLO)$/cmtree.obj \ +# $(SLO)$/cmtreemodel.obj \ +# $(SLO)$/typeconverter.obj \ +# $(SLO)$/confname.obj \ +# $(SLO)$/changes.obj \ +# $(SLO)$/xmlformater.obj \ +# $(SLO)$/attributes.obj \ +# $(SLO)$/tracer.obj \ + + +# ... common for all test executables .............................. +APP2STDLIBS = $(APPSTDLIBS) + +APP2STDLIBS+=$(STDLIBCPP) + +.IF "$(GUI)"=="WNT" +APP2STDLIBS+=$(LIBCIMT) +.ENDIF + +APP2TARGET= $(TARGET) +APP2OBJS= \ + $(SLO)$/cfglocal.obj \ + $(SLO)$/receivethread.obj \ + $(SLO)$/redirector.obj \ + $(SLO)$/socketstream.obj \ + $(SLO)$/attributes.obj \ + $(SLO)$/localsession.obj \ + $(SLO)$/saxtools.obj \ + $(SLO)$/mergeupdates.obj \ + $(SLO)$/oslstream.obj \ + $(SLO)$/configsession.obj \ + $(SLO)$/confname.obj \ + $(SLO)$/sessionstream.obj \ + $(SLO)$/filehelper.obj \ + $(SLO)$/tracer.obj \ + $(SLO)$/updatedom.obj \ + + +.INCLUDE : target.mk + + diff --git a/configmgr/workben/local_io/simpletest.cxx b/configmgr/workben/local_io/simpletest.cxx new file mode 100644 index 000000000000..2cf9d567c225 --- /dev/null +++ b/configmgr/workben/local_io/simpletest.cxx @@ -0,0 +1,537 @@ +/************************************************************************* + * + * $RCSfile: simpletest.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:43 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <stl/memory> +#include <stl/vector> +#include <stl/stack> + +#ifndef _OSL_FILE_HXX_ +#include<osl/file.hxx> +#endif + +#include <rtl/ustring> + +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_ +#include <com/sun/star/uno/Sequence.hxx> +#endif + +#ifndef _COM_SUN_STAR_UNO_ANY_HXX_ +#include <com/sun/star/uno/Any.hxx> +#endif + +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif +#ifndef _CPPUHELPER_IMPLBASE2_HXX_ +#include <cppuhelper/implbase2.hxx> +#endif + +#ifndef _CPPUHELPER_SERVICEFACTORY_HXX_ +#include <cppuhelper/servicefactory.hxx> +#endif + +#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HDL_ +#include <com/sun/star/lang/XComponent.hpp> +#endif +#ifndef _COM_SUN_STAR_IO_XACTIVEDATASOURCE_HDL_ +#include <com/sun/star/io/XActiveDataSource.hpp> +#endif +#ifndef _COM_SUN_STAR_IO_XACTIVEDATASINK_HDL_ +#include <com/sun/star/io/XActiveDataSink.hpp> +#endif +#ifndef _COM_SUN_STAR_IO_XACTIVEDATACONTROL_HDL_ +#include <com/sun/star/io/XActiveDataControl.hpp> +#endif +#ifndef _COM_SUN_STAR_IO_XDATATRANSFEREVENTLISTENER_HDL_ +#include <com/sun/star/io/XDataTransferEventListener.hpp> +#endif +#ifndef _COM_SUN_STAR_IO_XDATAIMPORTER_HDL_ +#include <com/sun/star/io/XDataImporter.hpp> +#endif + +#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HDL_ +#include <com/sun/star/io/XInputStream.hpp> +#endif + +#ifndef _COM_SUN_STAR_XML_SAX_XPARSER_HPP_ +#include <com/sun/star/xml/sax/XParser.hpp> +#endif + +#ifndef _COM_SUN_STAR_XML_SAX_SAXPARSEEXCEPTION_HPP_ +#include <com/sun/star/xml/sax/SAXParseException.hpp> +#endif + +#ifndef _COM_SUN_STAR_XML_SAX_XEXTENDEDDOCUMENTHANDLER_HPP_ +#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> +#endif + +#include <com/sun/star/xml/sax/InputSource.hpp> + +#ifndef _VOS_THREAD_HXX_ +#include <vos/thread.hxx> +#endif + +#include <vos/pipe.hxx> + +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif +#include "oslstream.hxx" + +#ifndef _COM_SUN_STAR_XML_SAX_XATTRIBUTELIST_HPP_ +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#endif + +#include <com/sun/star/container/XHierarchicalNameAccess.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XHierarchicalName.hpp> + +#include <com/sun/star/container/XNameReplace.hpp> +#include <com/sun/star/util/XChangesBatch.hpp> + +#ifndef _COM_SUN_STAR_SCRIPT_XTYPECONVERTER_HPP_ +#include <com/sun/star/script/XTypeConverter.hpp> +#endif + +#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_ +#include <com/sun/star/container/XNameContainer.hpp> +#endif + +#ifndef _OSL_CONDITN_HXX_ +#include <osl/conditn.hxx> +#endif + +#include "xmltreebuilder.hxx" + +#include "dataimport.hxx" + +#include "createpropertyvalue.hxx" + +#ifndef _CONFIGMGR_STRDECL_HXX_ +#include "strdecl.hxx" +#endif + +// ----------------------------------------------------------------------------- +// --------------------------------- namespaces --------------------------------- +// ----------------------------------------------------------------------------- +namespace uno = com::sun::star::uno; +namespace lang = com::sun::star::lang; +namespace io = com::sun::star::io; +namespace sax = com::sun::star::xml::sax; +namespace script = com::sun::star::script; + +using ::rtl::OUString; +using ::osl::File; + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::xml::sax; +using namespace ::com::sun::star::io; + +// ----------------------------------------------------------------------------- +// ---------------------------------- defines ---------------------------------- +// ----------------------------------------------------------------------------- +#define ASCII(x) OUString::createFromAscii(x) + + + +// ----------------------------------------------------------------------------- +// ---------------------------------- a Class ---------------------------------- +// ----------------------------------------------------------------------------- +// <Name a="xyz" b="bar"> + +//========================================================================== +//= Visitors +//========================================================================== + + +namespace configmgr +{ + + class XMLSimpleDocHandler : public ::cppu::WeakImplHelper1<sax::XDocumentHandler> + { + // uno::Reference< sax::XDocumentHandler > m_xWriter; // the service object for writing XML code + + sal_Int32 m_nElementDepth; + sal_Int32 m_nIgnoreLevel; + public: + XMLSimpleDocHandler::XMLSimpleDocHandler() + {} + + + // DECLARE_UNO3_DEFAULTS(XMLReadFilter, CmDocumentHandler_BASE); + + // XDocumentHandler + virtual void SAL_CALL startDocument(void) + throw (sax::SAXException, uno::RuntimeException) + { + } + + virtual void SAL_CALL endDocument(void) + throw(sax::SAXException, uno::RuntimeException) + { + } + + virtual void SAL_CALL startElement(const rtl::OUString& aName, + const uno::Reference< sax::XAttributeList > &_xAttrList) + throw(sax::SAXException, uno::RuntimeException) + { + sal_Int16 nAttrCount = _xAttrList.is() ? _xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; i++ ) + { + OUString aParamName( _xAttrList->getNameByIndex( i ) ); + OUString aParamValue( _xAttrList->getValueByIndex( i ) ); + volatile int dummy = 0; + } + } + + virtual void SAL_CALL endElement(const rtl::OUString& aName) + throw(sax::SAXException, uno::RuntimeException) + { + } + + virtual void SAL_CALL characters(const rtl::OUString& aChars) + throw(sax::SAXException, uno::RuntimeException) + {} + + + virtual void SAL_CALL ignorableWhitespace(const rtl::OUString& aWhitespaces) + throw(sax::SAXException, uno::RuntimeException) + {} + + + virtual void SAL_CALL processingInstruction(const rtl::OUString& aTarget, + const rtl::OUString& aData) + throw(sax::SAXException, uno::RuntimeException) + {} + + virtual void SAL_CALL setDocumentLocator(const uno::Reference< sax::XLocator > &xLocator) + throw(sax::SAXException, uno::RuntimeException) + {} + }; + +// ----------------------------------------------------------------------------- +// ------------------------------------ Test ------------------------------------ +// ----------------------------------------------------------------------------- +#define ASCII_STRING(rtlOUString) rtl::OUStringToOString(rtlOUString, RTL_TEXTENCODING_ASCII_US).getStr() + static ::rtl::OUString sRegistry = ::rtl::OUString::createFromAscii("applicat.rdb"); + + void simpleTest() + { + uno::Reference< lang::XMultiServiceFactory > xMSF; + try + { + xMSF = cppu::createRegistryServiceFactory(sRegistry, ::rtl::OUString()); + } + catch (uno::Exception& e) + { + cout << "could not bootstrap the services from " << ASCII_STRING(sRegistry) << endl ; + cout << " (error message : " << ASCII_STRING(e.Message) << ")" << endl; + } + + if (!xMSF.is()) + { + cerr << "could not create the service factory !" << endl; + return; + } + + OUString aPath = ASCII("e:/temp/Test"); + OUString aFilename = ASCII("calc"); + OUString aExtension = ASCII("xml"); + + OUString aFullname = aPath + ASCII("/") + aFilename + ASCII(".") + aExtension; + + // Filename convertieren + OUString aURL; + File aConvert(ASCII("")); + aConvert.normalizePath(aFullname, aURL); + + // File oeffnen + File aFile(aURL); + aFile.open(osl_File_OpenFlag_Read); + + uno::Reference<io::XInputStream> xInputStream = + new configmgr::OSLInputStreamWrapper(aFile); + + // connect stream to input stream to the parser + InputSource aInputSource; + Reference<XInputStream> xPipeInput( xInputStream, UNO_QUERY ); + aInputSource.aInputStream = xPipeInput; + + Reference< sax::XParser > xParser; + xParser = Reference< sax::XParser > ( + xMSF->createInstance( + ::rtl::OUString::createFromAscii("com.sun.star.xml.sax.Parser")), UNO_QUERY); + + XMLSimpleDocHandler *pTest = new XMLSimpleDocHandler(); + + // get filter + Reference<XDocumentHandler> xFilter = pTest; + + // connect parser and filter + xParser->setDocumentHandler( xFilter ); + + // parse + sal_Int16 nRet = 0; + OUString sError; + try + { + xParser->parseStream( aInputSource ); + } + catch( SAXParseException &e ) + { + OUString sLine = OUString::valueOf(e.LineNumber); + OUString aStr = ASCII("SAXParseException occured in "); + sError = aStr + ASCII(" Line: (") + sLine + ASCII(")"); + + OSL_ENSHURE(0, rtl::OUStringToOString(sError,RTL_TEXTENCODING_ASCII_US).getStr()); + nRet = 3; + } + catch( SAXException &e ) + { + sError = e.Message; + OSL_ENSHURE(0, rtl::OUStringToOString(sError,RTL_TEXTENCODING_ASCII_US).getStr()); + nRet = 4; + } + catch( IOException &e ) + { + sError = e.Message; + OSL_ENSHURE(0, rtl::OUStringToOString(sError,RTL_TEXTENCODING_ASCII_US).getStr()); + nRet = 5; + } + } + + +#include <osl/time.h> +#include <rtl/string.hxx> + +class TimeTest +{ + TimeValue m_aStartTime, m_aEndTime; + bool m_bStarted; +public: + TimeTest() + :m_bStarted(false) + { + } + + void start() + { + m_bStarted = true; + osl_getSystemTime(&m_aStartTime); + } + void stop() + { + osl_getSystemTime(&m_aEndTime); + OSL_ENSHURE(m_bStarted, "Not Started."); + m_bStarted = false; + } + void showTime(const rtl::OString & aWhatStr) + { + OSL_ENSHURE(!m_bStarted, "Not Stopped."); + + sal_Int32 nSeconds = m_aEndTime.Seconds - m_aStartTime.Seconds; + sal_Int32 nNanoSec = m_aEndTime.Nanosec - m_aStartTime.Nanosec; + if (nNanoSec < 0) + { + nNanoSec = 1000000000 - nNanoSec; + nSeconds++; + } + rtl::OString aStr = "Time for "; + aStr += aWhatStr; + aStr += " : "; + aStr += rtl::OString::valueOf(nSeconds); + aStr += "."; + aStr += rtl::OString::valueOf(nNanoSec); + + cout << aStr.getStr() << endl; + } + +}; + +// ----------------------------------------------------------------------------- +// -------------------------------- Mapping Test -------------------------------- +// ----------------------------------------------------------------------------- + +typedef ::std::pair< rtl::OUString, rtl::OUString > Assoc; +// typedef ::std::set<Assoc, ltNode> MappingTable; +typedef std::vector<Assoc> MappingTable; + +rtl::OUString mapTo(const rtl::OUString& aFrom, bool bToNew) +{ + static MappingTable aMap; + if (aMap.empty()) + { + // Fill Map old, new + + aMap.push_back(Assoc(ASCII("value"), TAG_VALUE)); + aMap.push_back(Assoc(ASCII("type"), ATTR_TYPE)); + aMap.push_back(Assoc(ASCII("instance"), ATTR_INSTANCE)); + } + if (bToNew) + { + // check, if we should convert first to second + for (std::vector<Assoc>::const_iterator it = aMap.begin();it != aMap.end();++it) + { + if ((*it).first.equals(aFrom)) + return (*it).second; + } + } + else + { + // check if we should convert second to first + for (std::vector<Assoc>::const_iterator it = aMap.begin();it != aMap.end();++it) + { + if ((*it).second.equals(aFrom)) + return (*it).first; + } + } + + // do nothing! + return aFrom; +} +// ----------------------------------------------------------------------------- +void simpleMappingTest() +{ + OUString aValue = ASCII("value"); + OUString aNew; + + aNew = mapTo(aValue, true); // true for ToNew + aNew = mapTo(aNew, false); + aNew = mapTo(aNew, false); + + volatile int dummy = 0; +} + +// ----------------------------------------------------------------------------- + void speedTest() + { + // check speed of: + // ASCII("value") + // TAG_VALUE + // ... + + sal_Int32 nCount = 1000 * 1000 * 100; + sal_Int32 n; + + cout << "Starting Timetest" << endl; + TimeTest tt; + tt.start(); + for(n=0;n<nCount;n++) + { + } + tt.stop(); + tt.showTime("Leere Schleife: "); + + + nCount = 1000 * 1000 * 5; + rtl::OUString aStr; + + tt.start(); + for(n=0;n<nCount;n++) + { + aStr = ASCII("value"); + } + tt.stop(); + tt.showTime("ASCII() "); + + + OUString aValue = ASCII("value"); + tt.start(); + for(n=0;n<nCount;n++) + { + aStr = TAG_VALUE; + } + tt.stop(); + tt.showTime("TAG_VALUE: "); + + } + +OUString changeToComSunStarPath(const OUString &aPath) +{ + static OUString aOO = ASCII("org.OpenOffice"); + static OUString aCSS = ASCII("com.sun.star"); + OUString aNewPath; + + // compare + if (aPath.compareTo( aOO, aOO.getLength() ) == 0) + { + aNewPath = aCSS; + aNewPath += aPath.copy(aOO.getLength()); + return aNewPath; + } + return aPath; +} + +void stringTest() +{ + OUString aPath = ASCII("org.OpenOffice.Setup/blah/blub"); + + OUString aNewPath = changeToComSunStarPath(aPath); + volatile int dummy = 0; +} + +} // namespace configmgr diff --git a/configmgr/workben/local_io/xmlexport.cxx b/configmgr/workben/local_io/xmlexport.cxx new file mode 100644 index 000000000000..341647154baa --- /dev/null +++ b/configmgr/workben/local_io/xmlexport.cxx @@ -0,0 +1,302 @@ +/************************************************************************* + * + * $RCSfile: xmlexport.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:43 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include<iostream> + +#ifndef _OSL_FILE_HXX_ +#include<osl/file.hxx> +#endif + +#include <rtl/ustring.hxx> + +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif +#ifndef _CPPUHELPER_IMPLBASE2_HXX_ +#include <cppuhelper/implbase2.hxx> +#endif +#ifndef _CPPUHELPER_SERVICEFACTORY_HXX_ +#include <cppuhelper/servicefactory.hxx> +#endif +/* +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif +*/ +#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HDL_ +#include <com/sun/star/lang/XComponent.hpp> +#endif +#ifndef _COM_SUN_STAR_IO_XDATATRANSFEREVENTLISTENER_HDL_ +#include <com/sun/star/io/XDataTransferEventListener.hpp> +#endif +#ifndef _COM_SUN_STAR_IO_XDATAIMPORTER_HDL_ +#include <com/sun/star/io/XDataExporter.hpp> +#endif +#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HDL_ +#include <com/sun/star/io/XOutputStream.hpp> +#endif +#ifndef _COM_SUN_STAR_IO_XACTIVEDATASOURCE_HPP_ +#include <com/sun/star/io/XActiveDataSource.hpp> +#endif +#ifndef _COM_SUN_STAR_XML_SAX_SAXPARSEEXCEPTION_HPP_ +#include <com/sun/star/xml/sax/SAXParseException.hpp> +#endif + +#ifndef _COM_SUN_STAR_XML_SAX_XEXTENDEDDOCUMENTHANDLER_HPP_ +#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> +#endif + +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif +#ifndef _COM_SUN_STAR_XML_SAX_XATTRIBUTELIST_HPP_ +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#endif + +#include "oslstream.hxx" +#include "attributes.hxx" +#include "typeconverter.hxx" +#include "xmlformater.hxx" + +#ifndef _CONFIGMGR_FILEHELPER_HXX_ +#include "filehelper.hxx" +#endif + + +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> + +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ +#include <com/sun/star/beans/PropertyValue.hpp> +#endif + +#ifndef _COM_SUN_STAR_LANG_ILLEGALARGUMENTEXCEPTION_HPP_ +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#endif + +#include "createpropertyvalue.hxx" +// ----------------------------------------------------------------------------- +// --------------------------------- namespaces --------------------------------- +// ----------------------------------------------------------------------------- +namespace configmgr +{ + + namespace uno = com::sun::star::uno; + namespace lang = com::sun::star::lang; + namespace io = com::sun::star::io; + namespace sax = com::sun::star::xml::sax; + namespace beans = com::sun::star::beans; + + using ::rtl::OUString; + using ::osl::File; + + using namespace ::com::sun::star::uno; + using namespace ::com::sun::star::lang; + using namespace ::com::sun::star::container; + +// ----------------------------------------------------------------------------- +// ---------------------------------- defines ---------------------------------- +// ----------------------------------------------------------------------------- +#define ASCII(x) OUString::createFromAscii(x) + +// ----------------------------------------------------------------------------- + class Listener : public ::cppu::WeakImplHelper1<io::XDataTransferEventListener> + { + virtual void SAL_CALL disposing( const lang::EventObject& Source ) + throw(::com::sun::star::uno::RuntimeException) + { + OSL_ENSHURE(0, "disposing"); + } + + + virtual void SAL_CALL finished( const io::DataTransferEvent& aEvent ) + throw(uno::RuntimeException) + { + OSL_ENSHURE(0, "finished"); + } + + virtual void SAL_CALL cancelled( const io::DataTransferEvent& aEvent ) + throw(uno::RuntimeException) + { + OSL_ENSHURE(0, "cancelled"); + } + }; + + class Component: public ::cppu::WeakImplHelper1<lang::XComponent> + { + virtual void SAL_CALL dispose( ) + throw(uno::RuntimeException) + { + OSL_ENSHURE(0, "dispose"); + + } + virtual void SAL_CALL addEventListener( const uno::Reference< lang::XEventListener >& xListener ) + throw(uno::RuntimeException) + { + OSL_ENSHURE(0, "addEventListener"); + } + virtual void SAL_CALL removeEventListener( const uno::Reference< lang::XEventListener >& aListener ) + throw(uno::RuntimeException) + { + OSL_ENSHURE(0, "removeEventListener"); + } + }; + + + + + +#define ASCII_STRING(rtlOUString) rtl::OUStringToOString(rtlOUString, RTL_TEXTENCODING_ASCII_US).getStr() + static ::rtl::OUString sRegistry = ::rtl::OUString::createFromAscii("applicat.rdb"); + + + + + + + + +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- + void exportTest() + { + uno::Reference< lang::XMultiServiceFactory > xMSF; + try + { + xMSF = cppu::createRegistryServiceFactory(sRegistry, ::rtl::OUString()); + } + catch (uno::Exception& e) + { + cout << "could not bootstrap the services from " << ASCII_STRING(sRegistry) << endl ; + cout << " (error message : " << ASCII_STRING(e.Message) << ")" << endl; + } + + if (!xMSF.is()) + { + cerr << "could not create the service factory !" << endl; + return; + } + + OUString aPath = ASCII("l:/SRC601/configmgr/workben/local_io"); + OUString sFilename = ASCII("exported_config"); + OUString aExtension = ASCII("xml"); + + OUString aFullname = aPath + ASCII("/") + sFilename + ASCII(".") + aExtension; + + // Filename convertieren + OUString aURL; + File aConvert(ASCII("")); + aConvert.normalizePath(aFullname, aURL); + + FileHelper::tryToRemoveFile(aURL); + + rtl::OUString sError; + + // File oeffnen + File aFile(aURL); + osl::FileBase::RC eError = aFile.open(OpenFlag_Write | OpenFlag_Create); + + if (eError != osl_File_E_None) + { + sError = ASCII("XMLExportTest:"); + rtl::OString aStr = rtl::OUStringToOString(sError,RTL_TEXTENCODING_ASCII_US); + OSL_ENSHURE(0, aStr.getStr()); + return; + } + + // create an outputstream + uno::Reference<io::XOutputStream> xOutputStream = new configmgr::OSLOutputStreamWrapper(aFile); + + // Listener & Component + uno::Reference<io::XDataTransferEventListener> rListener = new Listener(); + uno::Reference<lang::XComponent> rComponent = new Component(); + + + OUString sPath = ASCII("com.sun.star.ucb.Hierarchy"); + + // Create a TypeConverter + uno::Reference<script::XTypeConverter> aConverter; + aConverter = aConverter.query(xMSF->createInstance(ASCII( "com.sun.star.script.Converter" )) ); + + // prepare parameters for DataExport + Sequence< uno::Any > aArgs(4); + aArgs[0] <<= createPropertyValue(ASCII("PackageName"), sFilename); + aArgs[1] <<= createPropertyValue(ASCII("Path"), sPath); // multiple occur possible + aArgs[2] <<= createPropertyValue(ASCII("TypeConverter"), aConverter); // optional + aArgs[3] <<= createPropertyValue(ASCII("Path"), ASCII("com.sun.star.office.Setup")); // multiple occur possible + + // important: createInstanceWithArguments will throw an IllegalArgumentException() if + // parameters are wrong... + Reference< XInterface > xDataExport = xMSF->createInstanceWithArguments( + OUString::createFromAscii("com.sun.star.configuration.DataExport"), + aArgs); + + uno::Reference<io::XDataExporter> rExporter(xDataExport, UNO_QUERY); + + // Export Data + rExporter->exportData(xOutputStream, rComponent, rListener); + } + +} // namespace configmgr diff --git a/configmgr/workben/local_io/xmlimport.cxx b/configmgr/workben/local_io/xmlimport.cxx new file mode 100644 index 000000000000..1f8ad31f5d4c --- /dev/null +++ b/configmgr/workben/local_io/xmlimport.cxx @@ -0,0 +1,545 @@ +/************************************************************************* + * + * $RCSfile: xmlimport.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:13:43 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <stl/memory> +#include <stl/vector> +#include <stl/stack> + +#ifndef _OSL_FILE_HXX_ +#include<osl/file.hxx> +#endif + +#include <rtl/ustring.hxx> + +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_ +#include <com/sun/star/uno/Sequence.hxx> +#endif + +#ifndef _COM_SUN_STAR_UNO_ANY_HXX_ +#include <com/sun/star/uno/Any.hxx> +#endif + +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif +#ifndef _CPPUHELPER_IMPLBASE2_HXX_ +#include <cppuhelper/implbase2.hxx> +#endif + +#ifndef _CPPUHELPER_SERVICEFACTORY_HXX_ +#include <cppuhelper/servicefactory.hxx> +#endif + +#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HDL_ +#include <com/sun/star/lang/XComponent.hpp> +#endif +#ifndef _COM_SUN_STAR_IO_XACTIVEDATASOURCE_HDL_ +#include <com/sun/star/io/XActiveDataSource.hpp> +#endif +#ifndef _COM_SUN_STAR_IO_XACTIVEDATASINK_HDL_ +#include <com/sun/star/io/XActiveDataSink.hpp> +#endif +#ifndef _COM_SUN_STAR_IO_XACTIVEDATACONTROL_HDL_ +#include <com/sun/star/io/XActiveDataControl.hpp> +#endif +#ifndef _COM_SUN_STAR_IO_XDATATRANSFEREVENTLISTENER_HDL_ +#include <com/sun/star/io/XDataTransferEventListener.hpp> +#endif +#ifndef _COM_SUN_STAR_IO_XDATAIMPORTER_HDL_ +#include <com/sun/star/io/XDataImporter.hpp> +#endif + +#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HDL_ +#include <com/sun/star/io/XInputStream.hpp> +#endif + +#ifndef _COM_SUN_STAR_XML_SAX_XPARSER_HPP_ +#include <com/sun/star/xml/sax/XParser.hpp> +#endif + +#ifndef _COM_SUN_STAR_XML_SAX_SAXPARSEEXCEPTION_HPP_ +#include <com/sun/star/xml/sax/SAXParseException.hpp> +#endif + +#ifndef _COM_SUN_STAR_XML_SAX_XEXTENDEDDOCUMENTHANDLER_HPP_ +#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> +#endif + +#include <com/sun/star/xml/sax/InputSource.hpp> + +#ifndef _VOS_THREAD_HXX_ +#include <vos/thread.hxx> +#endif + +#include <vos/pipe.hxx> + +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif +#include "oslstream.hxx" + +#ifndef _COM_SUN_STAR_XML_SAX_XATTRIBUTELIST_HPP_ +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#endif + +#include <com/sun/star/container/XHierarchicalNameAccess.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XHierarchicalName.hpp> + +#include <com/sun/star/container/XNameReplace.hpp> +#include <com/sun/star/util/XChangesBatch.hpp> + +#ifndef _COM_SUN_STAR_SCRIPT_XTYPECONVERTER_HPP_ +#include <com/sun/star/script/XTypeConverter.hpp> +#endif + +#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_ +#include <com/sun/star/container/XNameContainer.hpp> +#endif + +#ifndef _OSL_CONDITN_HXX_ +#include <osl/conditn.hxx> +#endif + +#include "xmltreebuilder.hxx" + +#include "dataimport.hxx" + +#include "createpropertyvalue.hxx" +// ----------------------------------------------------------------------------- +// --------------------------------- namespaces --------------------------------- +// ----------------------------------------------------------------------------- +namespace uno = com::sun::star::uno; +namespace lang = com::sun::star::lang; +namespace io = com::sun::star::io; +namespace sax = com::sun::star::xml::sax; +namespace script = com::sun::star::script; + +using ::rtl::OUString; +using ::osl::File; + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::util; + +// ----------------------------------------------------------------------------- +// ---------------------------------- defines ---------------------------------- +// ----------------------------------------------------------------------------- +#define ASCII(x) OUString::createFromAscii(x) + + + +// ----------------------------------------------------------------------------- +// ---------------------------------- a Class ---------------------------------- +// ----------------------------------------------------------------------------- +// <Name a="xyz" b="bar"> + +//========================================================================== +//= Visitors +//========================================================================== + + +// ----------------------------------------------------------------------------- +class Listener : public ::cppu::WeakImplHelper1<io::XDataTransferEventListener> +{ + osl::Condition m_aCondition; +public: + Listener() + { + m_aCondition.reset(); // will block + } + + virtual void SAL_CALL disposing( const lang::EventObject& Source ) + throw(::com::sun::star::uno::RuntimeException) + { + OSL_ENSHURE(0, "disposing"); + m_aCondition.set(); // will not block + } + + virtual void SAL_CALL finished( const io::DataTransferEvent& aEvent ) + throw(uno::RuntimeException) + { + OSL_ENSHURE(0, "finished"); + m_aCondition.set(); // will not block + } + + virtual void SAL_CALL cancelled( const io::DataTransferEvent& aEvent ) + throw(uno::RuntimeException) + { + OSL_ENSHURE(0, "cancelled"); + m_aCondition.set(); // will not block + } +public: + void wait() + { + m_aCondition.wait(); + } +}; + +class Component: public ::cppu::WeakImplHelper1<lang::XComponent> +{ + virtual void SAL_CALL dispose( ) + throw(uno::RuntimeException) + { + OSL_ENSHURE(0, "dispose"); + + } + virtual void SAL_CALL addEventListener( const uno::Reference< lang::XEventListener >& xListener ) + throw(uno::RuntimeException) + { + OSL_ENSHURE(0, "addEventListener"); + } + virtual void SAL_CALL removeEventListener( const uno::Reference< lang::XEventListener >& aListener ) + throw(uno::RuntimeException) + { + OSL_ENSHURE(0, "removeEventListener"); + } +}; + + + +namespace configmgr +{ + +// ----------------------------------------------------------------------------- +// ------------------------------------ Test ------------------------------------ +// ----------------------------------------------------------------------------- +#define ASCII_STRING(rtlOUString) rtl::OUStringToOString(rtlOUString, RTL_TEXTENCODING_ASCII_US).getStr() + static ::rtl::OUString sRegistry = ::rtl::OUString::createFromAscii("applicat.rdb"); + + void importTest() + { + uno::Reference< lang::XMultiServiceFactory > xMSF; + try + { + xMSF = cppu::createRegistryServiceFactory(sRegistry, ::rtl::OUString()); + } + catch (uno::Exception& e) + { + cout << "could not bootstrap the services from " << ASCII_STRING(sRegistry) << endl ; + cout << " (error message : " << ASCII_STRING(e.Message) << ")" << endl; + } + + if (!xMSF.is()) + { + cerr << "could not create the service factory !" << endl; + return; + } + + OUString aPath = ASCII("l:/SRC601/configmgr/workben/local_io"); + OUString aFilename = ASCII("hierarchy"); + OUString aExtension = ASCII("xml"); + + OUString aFullname = aPath + ASCII("/") + aFilename + ASCII(".") + aExtension; + + // Filename convertieren + OUString aURL; + File aConvert(ASCII("")); + aConvert.normalizePath(aFullname, aURL); + + // File oeffnen + File aFile(aURL); + aFile.open(osl_File_OpenFlag_Read); + + // sal_uInt64 nBytesRead; + // uno::Sequence< sal_Int8 > aBufferSeq(2000); + // sal_Int8 *pBuff = aBufferSeq.getArray(); + // aFile.read(pBuff, 2000, nBytesRead); + // + // aFile.close(); + + uno::Reference<io::XInputStream> xInputStream = new configmgr::OSLInputStreamWrapper(aFile); + + uno::Reference <uno::XInterface> xPump = xMSF->createInstance( L"com.sun.star.io.Pump" ); + OSL_ENSHURE(xPump.is(), "there is no pump"); + + uno::Reference<io::XActiveDataSink> xPumpSink(xPump, uno::UNO_QUERY); + xPumpSink->setInputStream(xInputStream); + + uno::Reference<io::XActiveDataSource> xPumpSource(xPump, uno::UNO_QUERY); + + Listener *pListener = new Listener(); + uno::Reference<io::XDataTransferEventListener> rListener = pListener; + uno::Reference<lang::XComponent> rComponent = new Component(); + + // Create a TypeConverter + uno::Reference<script::XTypeConverter> aConverter; + aConverter = aConverter.query(xMSF->createInstance(ASCII( "com.sun.star.script.Converter" )) ); + + Sequence< uno::Any > aArgs(1); // optional arg. + aArgs[0] <<= configmgr::createPropertyValue(ASCII("TypeConverter"), aConverter); + + Reference< XInterface > xDataImport = xMSF->createInstanceWithArguments( + OUString::createFromAscii("com.sun.star.configuration.DataImport"), + aArgs); + + if (xDataImport.is()) + { + uno::Reference<io::XDataImporter> rImporter(xDataImport, UNO_QUERY); + + // Import Data + rImporter->importData(xPumpSource, rComponent, rListener); + + // lets pump + uno::Reference<io::XActiveDataControl> xControl(xPump, uno::UNO_QUERY); + xControl->start(); + + // TEST: + // rImporter->cancel(); + + // pImporter->wait(); + // Wait until the listener send ready + pListener->wait(); + } + return; + } + +// ----------------------------------------------------------------------------- +// -------------------------------- Import Test -------------------------------- +// ----------------------------------------------------------------------------- + + // ----------- TEST ReadAccess ----------- + void showSequence(const Sequence<OUString> &aSeq); + +void hierarchyTest() +{ + + uno::Reference< lang::XMultiServiceFactory > xMSF; + try + { + xMSF = cppu::createRegistryServiceFactory(sRegistry, ::rtl::OUString()); + } + catch (uno::Exception& e) + { + cout << "could not bootstrap the services from " << ASCII_STRING(sRegistry) << endl ; + cout << " (error message : " << ASCII_STRING(e.Message) << ")" << endl; + } + + if (!xMSF.is()) + { + cerr << "could not create the service factory !" << endl; + return; + } + + + Reference< XMultiServiceFactory > xCfgProvider( xMSF->createInstance( + ::rtl::OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider")), + UNO_QUERY); + + if (!xCfgProvider.is()) + { + OSL_ENSHURE(0, "No Configuration Provider"); + } + + OUString sPath = ASCII("com.sun.star.ucb.Hierarchy"); + + Sequence< Any > aArgs(1); + aArgs[0] <<= sPath; + + Reference< XInterface > xCfgUpdt = xCfgProvider->createInstanceWithArguments( + OUString::createFromAscii("com.sun.star.configuration.ConfigurationUpdateAccess"), + aArgs); + + Reference< XNameAccess > xNameAccess(xCfgUpdt, UNO_QUERY); + + // which Names are exist? + showSequence(xNameAccess->getElementNames()); + + OUString aNamePath = ASCII("Root"); + if (xNameAccess->hasByName(aNamePath)) + { + Any aAny; + aAny = xNameAccess->getByName(aNamePath); + TypeClass aTypeClass = aAny.getValueTypeClass(); + if (aAny.getValueTypeClass() == TypeClass_INTERFACE) + { + Reference< XInterface > xInterface; + aAny >>= xInterface; + Reference< XNameAccess > xNameAccess2(xInterface, UNO_QUERY); + if (xNameAccess.is()) + { + Sequence<OUString> aSeq = xNameAccess2->getElementNames(); + showSequence(aSeq); + + // insert a new set +/* + Reference<XHierarchicalName> xHierarchical(xNameAccess, UNO_QUERY); + OUString aHierachicalName = xHierarchical->getHierarchicalName(); + + Sequence< Any > aArgs(2); + aArgs[0] <<= aHierachicalName; + sal_Int32 nLevels=1; + aArgs[1] <<= nLevels; + + Reference< XInterface > xCfgNewUpdt = xCfgProvider->createInstanceWithArguments( + OUString::createFromAscii("com.sun.star.configuration.ConfigurationUpdateAccess"), + aArgs); +*/ + Reference< lang::XSingleServiceFactory > xChildFactory(xNameAccess2, UNO_QUERY); + if (xChildFactory.is()) + { + Reference< XInterface > xChild = xChildFactory->createInstance(); + if (xChild.is()) + { + Reference<XNameAccess> xObjectOnTheMedow(xChild, UNO_QUERY); + + + + + // which Names are exist? + showSequence(xObjectOnTheMedow->getElementNames()); + + OUString aChildren = ASCII("Children"); + if (xObjectOnTheMedow->hasByName(aChildren)) + { + Any aAny; + aAny = xObjectOnTheMedow->getByName(aChildren); + TypeClass aTypeClass = aAny.getValueTypeClass(); + if (aAny.getValueTypeClass() == TypeClass_INTERFACE) + { + Reference< XInterface > xInterface; + aAny >>= xInterface; + Reference< XNameAccess > xChildFromOOM(xInterface, UNO_QUERY); + + if (xChildFromOOM.is()) + { + // insert a new Object in the new Object + + Reference< lang::XSingleServiceFactory > xChildFactory(xChildFromOOM, UNO_QUERY); + if (xChildFactory.is()) + { + Reference< XInterface > xChild = xChildFactory->createInstance(); + if (xChild.is()) + { + Reference<XNameContainer> xNameContainer(xChildFromOOM, UNO_QUERY); + if (xNameContainer.is()) + { + xNameContainer->insertByName(ASCII("Test2"), makeAny(xChild)); + } + } + } + } + } + } + + + Reference<XNameContainer> xNameContainer(xNameAccess2, UNO_QUERY); + if (xNameContainer.is()) + { + xNameContainer->insertByName(ASCII("Test"), makeAny(xObjectOnTheMedow)); + } + } + + // commit changes + Reference< XChangesBatch > xChangesBatch(xCfgUpdt, UNO_QUERY); + if (xChangesBatch.is()) + { + xChangesBatch->commitChanges(); + } + } + + Sequence<OUString> aSeq2 = xNameAccess2->getElementNames(); + showSequence(aSeq2); + +/* + OUString *pStr = aSeq.getArray(); + for (int i=0;i<aSeq.getLength();i++) + { + OUString aStr = pStr[i]; + Any aAny; + aAny = xNameAccess->getByName(aStr); + TypeClass aTypeClass = aAny.getValueTypeClass(); + + Reference< XNameReplace > xNameReplace(xNameAccess, UNO_QUERY); + + Any aNewAny; + sal_Bool bValue = false; + aNewAny <<= bValue; + xNameReplace->replaceByName(aStr, aNewAny); + + volatile int dummy = 0; + } +*/ + } + } + volatile int dummy = 0; + } +} + +// ------------------------------ Helperfunctions ------------------------------ + + void showSequence(const Sequence<OUString> &aSeq) + { + OUString aArray; + const OUString *pStr = aSeq.getConstArray(); + for (int i=0;i<aSeq.getLength();i++) + { + OUString aStr = pStr[i]; + aArray += aStr + ASCII(", "); + } + volatile int dummy = 0; + } + +} // namespace configmgr diff --git a/connectivity/inc/connectivity/CommonTools.hxx b/connectivity/inc/connectivity/CommonTools.hxx new file mode 100644 index 000000000000..dfa1bd28f3d8 --- /dev/null +++ b/connectivity/inc/connectivity/CommonTools.hxx @@ -0,0 +1,249 @@ +/************************************************************************* + * + * $RCSfile: CommonTools.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:18 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#define _CONNECTIVITY_COMMONTOOLS_HXX_ + +#ifndef _RTL_USTRING_ +#include <rtl/ustring> +#endif +#ifndef _COM_SUN_STAR_UNO_ANY_HXX_ +#include <com/sun/star/uno/Any.hxx> +#endif +#ifndef _VECTOR_ +#include <vector> +#endif +#ifndef _CPPUHELPER_WEAKREF_HXX_ +#include <cppuhelper/weakref.hxx> +#endif +#ifndef _UTL_STLTYPES_HXX_ +#include <unotools/stl_types.hxx> +#endif +#ifndef _COM_SUN_STAR_BEANS_XFASTPROPERTYSET_HPP_ +#include <com/sun/star/beans/XFastPropertySet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> +#endif +#ifndef _OSL_INTERLOCK_H_ +#include <osl/interlck.h> +#endif + + /** used for declaring UNO3-Defaults, i.e. acquire/release + */ +// { baseclass::acquire(); } +// { baseclass::release(); } + + #define DECLARE_CTY_DEFAULTS(baseclass) \ + virtual void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { baseclass::acquire(); } \ + virtual void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { baseclass::release(); } \ + void SAL_CALL PUT_SEMICOLON_AT_THE_END() + + #define DECLARE_CTY_ACQUIRE(baseclass) \ + virtual void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { baseclass::acquire(); } + +#define DECLARE_CTY_PROPERTY(realclass,baseclass) \ + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const \ + { \ + return baseclass::createArrayHelper( ); \ + } \ + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() \ + { \ + return *realclass::getArrayHelper(); \ + } + + +namespace com { namespace sun { namespace star { namespace util { + struct Date; + struct DateTime; + struct Time; +}}}} + +namespace connectivity +{ + //------------------------------------------------------------------------------ + sal_Int32 getINT32(const ::com::sun::star::uno::Any& _rAny); + //------------------------------------------------------------------------------ + sal_Int16 getINT16(const ::com::sun::star::uno::Any& _rAny); + //------------------------------------------------------------------------------ + double getDouble(const ::com::sun::star::uno::Any& _rAny); + //------------------------------------------------------------------------------ + ::rtl::OUString getString(const ::com::sun::star::uno::Any& _rAny); + //------------------------------------------------------------------------------ + sal_Bool getBOOL(const ::com::sun::star::uno::Any& _rAny); + //------------------------------------------------------------------------------ + + //------------------------------------------------------------------------------ + sal_Bool match(const sal_Unicode* pWild, const sal_Unicode* pStr, const sal_Unicode cEscape); + //------------------------------------------------------------------------------ + rtl::OUString toString(const ::com::sun::star::uno::Any& rValue); + rtl::OUString toDateString(const ::com::sun::star::util::Date& rDate); + rtl::OUString toTimeString(const ::com::sun::star::util::Time& rTime); + rtl::OUString toDateTimeString(const ::com::sun::star::util::DateTime& rDateTime); + + // base class for all classes who are derived from OPropertySet and from OComponent + class OBaseMutex + { + protected: + ::osl::Mutex m_aMutex; + }; + + // typedefs + typedef std::vector< ::com::sun::star::uno::WeakReferenceHelper > OWeakRefArray; + typedef ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier> OSQLTable; + + DECLARE_STL_MAP(::rtl::OUString,OSQLTable,utl::UStringMixLess, OSQLTables); + + // ------------------------------------------------------------------------- + // class ORefVector allows reference counting on a std::vector + // ------------------------------------------------------------------------- + template< class VectorVal > class ORefVector : public ::std::vector< VectorVal > + { + oslInterlockedCount m_refCount; + public: + ORefVector() : m_refCount(0) {} + ORefVector(size_t _st) : ::std::vector< VectorVal > (_st) , m_refCount(0) {} + + void acquire() + { + osl_incrementInterlockedCount( &m_refCount ); + } + void release() + { + if (! osl_decrementInterlockedCount( &m_refCount )) + delete this; + } + + }; + // ------------------------------------------------------------------------- + // class ORowVector incudes refcounting and initialze himself + // with at least one element. This first element is reserved for + // the bookmark + // ------------------------------------------------------------------------- + template< class VectorVal > class ORowVector : public ORefVector< VectorVal > + { + public: + ORowVector() : ORefVector< VectorVal >(1){} + ORowVector(size_t _st) : ORefVector< VectorVal >(_st+1) + {} + }; + + typedef ORefVector< ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet> > OSQLColumns; + + // ======================================================================================= + // search from __first to __last the column with the name _rVal + // when no such column exist __last is returned + OSQLColumns::const_iterator find( OSQLColumns::const_iterator __first, + OSQLColumns::const_iterator __last, + const ::rtl::OUString& _rVal, + const ::utl::UStringMixEqual& _rCase); + // ======================================================================================= + // search from __first to __last the column with the realname _rVal + // when no such column exist __last is returned + OSQLColumns::const_iterator findRealName( OSQLColumns::const_iterator __first, + OSQLColumns::const_iterator __last, + const ::rtl::OUString& _rVal, + const ::utl::UStringMixEqual& _rCase); + + // ======================================================================================= + // the first two find methods are much faster than the one below + // ======================================================================================= + // search from __first to __last the column with the property _rProp equals the value _rVal + // when no such column exist __last is returned + OSQLColumns::const_iterator find( OSQLColumns::const_iterator __first, + OSQLColumns::const_iterator __last, + const ::rtl::OUString& _rProp, + const ::rtl::OUString& _rVal, + const ::utl::UStringMixEqual& _rCase); +} + +//================================================================================== + +#define DECLARE_SERVICE_INFO() \ + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); \ + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); \ + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) \ + +#define IMPLEMENT_SERVICE_INFO(classname, implasciiname, serviceasciiname) \ + ::rtl::OUString SAL_CALL classname::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) \ + { \ + return ::rtl::OUString::createFromAscii(implasciiname); \ + } \ + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL classname::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) \ + { \ + ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1); \ + aSupported[0] = ::rtl::OUString::createFromAscii(serviceasciiname); \ + return aSupported; \ + } \ + sal_Bool SAL_CALL classname::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException) \ + { \ + ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); \ + const ::rtl::OUString* pSupported = aSupported.getConstArray(); \ + for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) \ + if (pSupported->equals(_rServiceName)) \ + return sal_True; \ + \ + return sal_False; \ + } \ + +//================================================================================== + +#endif // _CONNECTIVITY_COMMONTOOLS_HXX_ + diff --git a/connectivity/inc/connectivity/PColumn.hxx b/connectivity/inc/connectivity/PColumn.hxx new file mode 100644 index 000000000000..25e5111299ea --- /dev/null +++ b/connectivity/inc/connectivity/PColumn.hxx @@ -0,0 +1,114 @@ +/************************************************************************* + * + * $RCSfile: PColumn.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:18 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ +#include "connectivity/sdbcx/VColumn.hxx" +#endif + +namespace connectivity +{ + namespace parse + { + class OParseColumn; + + typedef sdbcx::OColumn OParseColumn_BASE; + typedef ::utl::OPropertyArrayUsageHelper<OParseColumn> OParseColumn_PROP; + + class OParseColumn : public OParseColumn_BASE, + public OParseColumn_PROP + { + ::rtl::OUString m_aRealName; + ::rtl::OUString m_aTableName; + sal_Bool m_bFunction; + sal_Bool m_bDbasePrecisionChanged; + protected: + DECLARE_CTY_PROPERTY(OParseColumn_PROP,OParseColumn_BASE) + + public: + OParseColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet>& _xColumn,sal_Bool _bCase); + OParseColumn(const ::rtl::OUString& _Name, + const ::rtl::OUString& _TypeName, + const ::rtl::OUString& _DefaultValue, + sal_Int32 _IsNullable, + sal_Int32 _Precision, + sal_Int32 _Scale, + sal_Int32 _Type, + sal_Bool _IsAutoIncrement, + sal_Bool _IsCurrency, + sal_Bool _bCase); + + ~OParseColumn(); + + virtual void construct(); + + void setRealName(const ::rtl::OUString& _rName) { m_aRealName = _rName; } + void setTableName(const ::rtl::OUString& _rName) { m_aTableName = _rName; } + void setFunction(sal_Bool _bFunction) { m_bFunction = _bFunction; } + void setDbasePrecisionChanged(sal_Bool _bDbasePrecisionChanged) { m_bDbasePrecisionChanged = _bDbasePrecisionChanged; } + + ::rtl::OUString getRealName() const { return m_aRealName; } + ::rtl::OUString getTableName() const { return m_aTableName; } + sal_Bool getFunction() const { return m_bFunction; } + sal_Bool getDbasePrecisionChanged() const { return m_bDbasePrecisionChanged; } + }; + } +} + diff --git a/connectivity/inc/connectivity/sdbcx/IRefreshable.hxx b/connectivity/inc/connectivity/sdbcx/IRefreshable.hxx new file mode 100644 index 000000000000..435190aa5289 --- /dev/null +++ b/connectivity/inc/connectivity/sdbcx/IRefreshable.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * $RCSfile: IRefreshable.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_ +#define _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_ + +namespace connectivity +{ + namespace sdbcx + { + class IRefreshableGroups + { + public: + virtual void refreshGroups() = 0; + }; + + class IRefreshableUsers + { + public: + virtual void refreshUsers() = 0; + }; + + class IRefreshableColumns + { + public: + virtual void refreshColumns() = 0; + }; + } +} +#endif //_CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_ + diff --git a/connectivity/inc/connectivity/sdbcx/VCatalog.hxx b/connectivity/inc/connectivity/sdbcx/VCatalog.hxx new file mode 100644 index 000000000000..d01105c6d915 --- /dev/null +++ b/connectivity/inc/connectivity/sdbcx/VCatalog.hxx @@ -0,0 +1,186 @@ +/************************************************************************* + * + * $RCSfile: VCatalog.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_SDBCX_CATALOG_HXX_ +#define _CONNECTIVITY_SDBCX_CATALOG_HXX_ + +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif + +#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XTablesSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XVIEWSSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XViewsSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XUSERSSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XUsersSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XGROUPSSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XGroupsSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ +#include <com/sun/star/sdbc/XConnection.hpp> +#endif +#ifndef _UNOTOOLS_PROPERTY_ARRAY_HELPER_HXX_ +#include <unotools/proparrhlp.hxx> +#endif +#ifndef _CPPUHELPER_COMPBASE5_HXX_ +#include <cppuhelper/compbase5.hxx> +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_TABLE_HXX_ +#include "connectivity/sdbcx/VTable.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_VIEW_HXX_ +#include "connectivity/sdbcx/VView.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_GROUP_HXX_ +#include "connectivity/sdbcx/VGroup.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_USER_HXX_ +#include "connectivity/sdbcx/VUser.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ +#include "connectivity/sdbcx/VColumn.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_KEY_HXX_ +#include "connectivity/sdbcx/VKey.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_INDEX_HXX_ +#include "connectivity/sdbcx/VIndex.hxx" +#endif +#ifndef _CONNECTIVITY_OSUBCOMPONENT_HXX_ +#include "OSubComponent.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_ +#include "connectivity/sdbcx/IRefreshable.hxx" +#endif + +namespace connectivity +{ + namespace sdbcx + { + + typedef ::cppu::WeakComponentImplHelper5< ::com::sun::star::sdbcx::XTablesSupplier, + ::com::sun::star::sdbcx::XViewsSupplier, + ::com::sun::star::sdbcx::XUsersSupplier, + ::com::sun::star::sdbcx::XGroupsSupplier, + ::com::sun::star::lang::XServiceInfo> OCatalog_BASE; + + + class OCatalog : public OCatalog_BASE, + public IRefreshableGroups, + public IRefreshableUsers, + public connectivity::OSubComponent<OCatalog> + { + friend class connectivity::OSubComponent<OCatalog>; + protected: + + ::osl::Mutex m_aMutex; + + OCollection* m_pTables; + OCollection* m_pViews; + OCollection* m_pGroups; + OCollection* m_pUsers; + + public: + DECLARE_CTY_ACQUIRE( OCatalog_BASE); + + OCatalog(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> &_xConnection); + virtual ~OCatalog(); + + DECLARE_SERVICE_INFO(); + + virtual void refreshTables() = 0; + virtual void refreshViews() = 0; + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface +// virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) +// { +// return OCatalog_BASE::queryInterface(rType); +// } + void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException); + // XTablesSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTables( ) throw(::com::sun::star::uno::RuntimeException); + // XViewsSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getViews( ) throw(::com::sun::star::uno::RuntimeException); + // XUsersSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getUsers( ) throw(::com::sun::star::uno::RuntimeException); + // XGroupsSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getGroups( ) throw(::com::sun::star::uno::RuntimeException); + + }; + } +} + +#endif // _CONNECTIVITY_SDBCX_CATALOG_HXX_ + diff --git a/connectivity/inc/connectivity/sdbcx/VCollection.hxx b/connectivity/inc/connectivity/sdbcx/VCollection.hxx new file mode 100644 index 000000000000..7a58854e2710 --- /dev/null +++ b/connectivity/inc/connectivity/sdbcx/VCollection.hxx @@ -0,0 +1,242 @@ +/************************************************************************* + * + * $RCSfile: VCollection.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#define _CONNECTIVITY_SDBCX_COLLECTION_HXX_ + +#ifndef _CPPUHELPER_IMPLBASE9_HXX_ +#include <cppuhelper/implbase9.hxx> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ +#include <com/sun/star/container/XNameAccess.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_ +#include <com/sun/star/container/XIndexAccess.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_ +#include <com/sun/star/container/XNamed.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XENUMERATIONACCESS_HPP_ +#include <com/sun/star/container/XEnumerationAccess.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XENUMERATION_HPP_ +#include <com/sun/star/container/XEnumeration.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include <com/sun/star/beans/XPropertySet.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_XREFRESHABLE_HPP_ +#include <com/sun/star/util/XRefreshable.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_ +#include <com/sun/star/lang/XComponent.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_ +#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XAPPEND_HPP_ +#include <com/sun/star/sdbcx/XAppend.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XDROP_HPP_ +#include <com/sun/star/sdbcx/XDrop.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XCOLUMNLOCATE_HPP_ +#include <com/sun/star/sdbc/XColumnLocate.hpp> +#endif +#ifndef _UTL_STLTYPES_HXX_ +#include <unotools/stl_types.hxx> +#endif +#ifndef _UTL_CONTAINER_HXX_ +#include <unotools/container.hxx> +#endif +#ifndef _CPPUHELPER_INTERFACECONTAINER_H_ +#include <cppuhelper/interfacecontainer.h> +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif + +namespace connectivity +{ + namespace sdbcx + { + + typedef ::cppu::WeakImplHelper9< ::com::sun::star::container::XNameAccess, + ::com::sun::star::container::XIndexAccess, + ::com::sun::star::container::XEnumerationAccess, + ::com::sun::star::sdbc::XColumnLocate, + ::com::sun::star::util::XRefreshable, + ::com::sun::star::sdbcx::XDataDescriptorFactory, + ::com::sun::star::sdbcx::XAppend, + ::com::sun::star::sdbcx::XDrop, + ::com::sun::star::lang::XServiceInfo> OCollectionBase; + + typedef ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > Object_BASE; + //************************************************************ + // OCollection + //************************************************************ + class OCollection : public OCollectionBase + { + protected: + + typedef ::std::map< ::rtl::OUString, Object_BASE, ::utl::UStringMixLess> ObjectMap; + typedef ObjectMap::iterator ObjectIter; + + ::std::vector< ObjectIter > m_aElements; + ObjectMap m_aNameMap; + ::cppu::OInterfaceContainerHelper m_aRefreshListeners; + ::cppu::OWeakObject& m_rParent; + ::osl::Mutex& m_rMutex; // mutex of the parent + + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException) = 0; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName) = 0; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject() = 0; + + OCollection(::cppu::OWeakObject& _rParent,sal_Bool _bCase, ::osl::Mutex& _rMutex,const ::std::vector< ::rtl::OUString> &_rVector) + : m_rParent(_rParent) + ,m_rMutex(_rMutex) + ,m_aRefreshListeners(_rMutex) + ,m_aNameMap(_bCase) + { + for(::std::vector< ::rtl::OUString>::const_iterator i=_rVector.begin(); i != _rVector.end();++i) + m_aElements.push_back(m_aNameMap.insert(m_aNameMap.begin(), ObjectMap::value_type(*i,::com::sun::star::uno::WeakReference< ::com::sun::star::container::XNamed >()))); + } + + public: + virtual ~OCollection() + { + } + + DECLARE_SERVICE_INFO(); + + sal_Bool isCaseSensitive() const { return m_aNameMap.key_comp().isCaseSensitive(); } + + // only the name is identical to ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // dispatch the refcounting to the parent + virtual void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) + { + m_rParent.acquire(); + } + virtual void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) + { + m_rParent.release(); + } + + // ::com::sun::star::container::XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException) + { + return::getCppuType(static_cast< ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>*>(NULL)); + } + + virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException) + { + ::osl::MutexGuard aGuard(m_rMutex); + return getCount() > 0; + } + + // ::com::sun::star::container::XIndexAccess + virtual sal_Int32 SAL_CALL getCount( ) throw(::com::sun::star::uno::RuntimeException) + { + ::osl::MutexGuard aGuard(m_rMutex); + return m_aElements.size(); + } + + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::container::XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException) + { + ::osl::MutexGuard aGuard(m_rMutex); + return m_aNameMap.find(aName) != m_aNameMap.end(); + } + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration( ) throw(::com::sun::star::uno::RuntimeException); + // ::com::sun::star::util::XRefreshable + virtual void SAL_CALL refresh( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addRefreshListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener >& l ) throw(::com::sun::star::uno::RuntimeException) + { + m_aRefreshListeners.addInterface(l); + } + virtual void SAL_CALL removeRefreshListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener >& l ) throw(::com::sun::star::uno::RuntimeException) + { + m_aRefreshListeners.removeInterface(l); + } + // XDataDescriptorFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw(::com::sun::star::uno::RuntimeException); + // XAppend + virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + // XDrop + virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_SDBCX_COLLECTION_HXX_ + + diff --git a/connectivity/inc/connectivity/sdbcx/VColumn.hxx b/connectivity/inc/connectivity/sdbcx/VColumn.hxx new file mode 100644 index 000000000000..45c9920571f9 --- /dev/null +++ b/connectivity/inc/connectivity/sdbcx/VColumn.hxx @@ -0,0 +1,175 @@ +/************************************************************************* + * + * $RCSfile: VColumn.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ +#define _CONNECTIVITY_SDBCX_COLUMN_HXX_ + +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif + +#ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_ +#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_ +#include <com/sun/star/container/XNamed.hpp> +#endif +#ifndef _UNOTOOLS_PROPERTY_ARRAY_HELPER_HXX_ +#include <unotools/proparrhlp.hxx> +#endif +#ifndef _CPPUHELPER_COMPBASE3_HXX_ +#include <cppuhelper/compbase3.hxx> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_ +#include "connectivity/sdbcx/VDescriptor.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif + +namespace connectivity +{ + namespace sdbcx + { + typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbcx::XDataDescriptorFactory, + ::com::sun::star::container::XNamed, + ::com::sun::star::lang::XServiceInfo> OColumn_BASE; + + + class OColumn : public OBaseMutex, + public OColumn_BASE, + public ::utl::OPropertyArrayUsageHelper<OColumn>, + public ODescriptor + + { + protected: + ::rtl::OUString m_TypeName; + ::rtl::OUString m_Description; + ::rtl::OUString m_DefaultValue; + + sal_Int32 m_IsNullable; + sal_Int32 m_Precision; + sal_Int32 m_Scale; + sal_Int32 m_Type; + + sal_Bool m_IsAutoIncrement; + sal_Bool m_IsRowVersion; + sal_Bool m_IsCurrency; + + using OColumn_BASE::rBHelper; + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + public: + DECLARE_CTY_DEFAULTS( OColumn_BASE); + + OColumn(sal_Bool _bCase); + OColumn(const ::rtl::OUString& _Name, + const ::rtl::OUString& _TypeName, + const ::rtl::OUString& _DefaultValue, + sal_Int32 _IsNullable, + sal_Int32 _Precision, + sal_Int32 _Scale, + sal_Int32 _Type, + sal_Bool _IsAutoIncrement, + sal_Bool _IsRowVersion, + sal_Bool _IsCurrency, + sal_Bool _bCase); + + virtual ~OColumn(){} + + DECLARE_SERVICE_INFO(); + // IMPLEMENT_SERVICE_INFO(OColumn,"com.sun.star.sdbcx.VColumn","com.sun.star.sdbcx.Column"); + + //XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // ODescriptor + virtual void construct(); + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) + { + return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); + } + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw(::com::sun::star::uno::RuntimeException); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException) + { + return m_Name; + } + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException) + { + m_Name = aName; + } + }; + } +} + +#endif // _CONNECTIVITY_SDBCX_COLUMN_HXX_ + diff --git a/connectivity/inc/connectivity/sdbcx/VDescriptor.hxx b/connectivity/inc/connectivity/sdbcx/VDescriptor.hxx new file mode 100644 index 000000000000..673e3440ec46 --- /dev/null +++ b/connectivity/inc/connectivity/sdbcx/VDescriptor.hxx @@ -0,0 +1,120 @@ +/************************************************************************* + * + * $RCSfile: VDescriptor.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_ +#define _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_ + +#ifndef _CONNECTIVITY_SIMPLEPROPERTYCONTAINER_HXX_ +#include "connectivity/simplepropertycontainer.hxx" +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ +#include <com/sun/star/beans/PropertyAttribute.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif + + +namespace connectivity +{ + namespace sdbcx + { + class ODescriptor : public connectivity::OSimplePropertyContainer + { + protected: + ::rtl::OUString m_Name; + private: + sal_Bool m_bNew; + utl::UStringMixEqual m_aCase; + + public: + ODescriptor(::cppu::OBroadcastHelper& _rBHelper,sal_Bool _bCase, sal_Bool _bNew = sal_False) + : connectivity::OSimplePropertyContainer(_rBHelper) + , m_bNew(_bNew),m_aCase(_bCase){} + + sal_Bool isNew() const { return m_bNew; } + sal_Bool getNew() const { return m_bNew; } + + sal_Bool isCaseSensitive() const { return m_aCase.isCaseSensitive(); } + + virtual void construct(); + + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException) + { + ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > *)0 )); + return aTypes.getTypes(); + } + + inline sal_Bool operator == ( const ::rtl::OUString & _rRH ) + { + return m_aCase(m_Name,_rRH); + } + }; + } + +} +#endif // _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_ + diff --git a/connectivity/inc/connectivity/sdbcx/VGroup.hxx b/connectivity/inc/connectivity/sdbcx/VGroup.hxx new file mode 100644 index 000000000000..97a4d055cb49 --- /dev/null +++ b/connectivity/inc/connectivity/sdbcx/VGroup.hxx @@ -0,0 +1,175 @@ +/************************************************************************* + * + * $RCSfile: VGroup.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_SDBCX_GROUP_HXX_ +#define _CONNECTIVITY_SDBCX_GROUP_HXX_ + +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif + + +#ifndef _COM_SUN_STAR_SDBCX_XUSERSSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XUsersSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XAUTHORIZABLE_HPP_ +#include <com/sun/star/sdbcx/XAuthorizable.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_ +#include <com/sun/star/container/XNamed.hpp> +#endif +#ifndef _UNOTOOLS_PROPERTY_ARRAY_HELPER_HXX_ +#include <unotools/proparrhlp.hxx> +#endif +#ifndef _CPPUHELPER_COMPBASE4_HXX_ +#include <cppuhelper/compbase4.hxx> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _CONNECTIVITY_SIMPLEPROPERTYCONTAINER_HXX_ +#include "connectivity/simplepropertycontainer.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_ +#include "connectivity/sdbcx/IRefreshable.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_ +#include "connectivity/sdbcx/VDescriptor.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif + +namespace connectivity +{ + namespace sdbcx + { + typedef OCollection OUsers; + + typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::sdbcx::XUsersSupplier, + ::com::sun::star::sdbcx::XAuthorizable, + ::com::sun::star::container::XNamed, + ::com::sun::star::lang::XServiceInfo> OGroup_BASE; + + class OGroup : public OBaseMutex, + public OGroup_BASE, + public IRefreshableUsers, + public ::utl::OPropertyArrayUsageHelper<OGroup>, + public ODescriptor + { + protected: + OUsers* m_pUsers; + + using OGroup_BASE::rBHelper; + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + public: + DECLARE_CTY_DEFAULTS( OGroup_BASE); + + OGroup(sal_Bool _bCase); + OGroup( const ::rtl::OUString& _Name,sal_Bool _bCase); + virtual ~OGroup() + { + delete m_pUsers; + } + DECLARE_SERVICE_INFO(); + + //XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) + { + return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); + } + + // XUsersSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getUsers( ) throw(::com::sun::star::uno::RuntimeException); + // XAuthorizable + virtual sal_Int32 SAL_CALL getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException) + { + return m_Name; + } + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException) + {} + }; + } +} + +#endif // _CONNECTIVITY_SDBCX_GROUP_HXX_ + + diff --git a/connectivity/inc/connectivity/sdbcx/VIndex.hxx b/connectivity/inc/connectivity/sdbcx/VIndex.hxx new file mode 100644 index 000000000000..28c6c5b68bd5 --- /dev/null +++ b/connectivity/inc/connectivity/sdbcx/VIndex.hxx @@ -0,0 +1,177 @@ +/************************************************************************* + * + * $RCSfile: VIndex.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_SDBCX_INDEX_HXX_ +#define _CONNECTIVITY_SDBCX_INDEX_HXX_ + +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif + +#ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_ +#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_ +#include <com/sun/star/container/XNamed.hpp> +#endif +#ifndef _UNOTOOLS_PROPERTY_ARRAY_HELPER_HXX_ +#include <unotools/proparrhlp.hxx> +#endif +#ifndef _CPPUHELPER_COMPBASE2_HXX_ +#include <cppuhelper/compbase2.hxx> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_TYPEDEF_HXX_ +#include "connectivity/sdbcx/VTypeDef.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_ +#include "connectivity/sdbcx/IRefreshable.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_ +#include "connectivity/sdbcx/VDescriptor.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif + +namespace connectivity +{ + namespace sdbcx + { + + class OIndex : public OBaseMutex, + public OColumns_BASE, + public IRefreshableColumns, + public ::utl::OPropertyArrayUsageHelper<OIndex>, + public ODescriptor + { + protected: + ::rtl::OUString m_Catalog; + sal_Bool m_IsUnique; + sal_Bool m_IsPrimaryKeyIndex; + sal_Bool m_IsClustered; + + OCollection* m_pColumns; + + using OColumns_BASE::rBHelper; + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + public: + DECLARE_CTY_DEFAULTS( OColumns_BASE); + + OIndex(sal_Bool _bCase); + OIndex( const ::rtl::OUString& _Name, + const ::rtl::OUString& _Catalog, + sal_Bool _isUnique, + sal_Bool _isPrimaryKeyIndex, + sal_Bool _isClustered, + sal_Bool _bCase); + + virtual ~OIndex( ) + { + delete m_pColumns; + } + + DECLARE_SERVICE_INFO(); + + //XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // ODescriptor + virtual void construct(); + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) + { + return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); + } + + // XDataDescriptorFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( void ) throw(::com::sun::star::uno::RuntimeException); + // XColumnsSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns( ) throw(::com::sun::star::uno::RuntimeException); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException) + { + return m_Name; + } + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException) + {} + }; + } +} + +#endif // _CONNECTIVITY_SDBCX_INDEX_HXX_ + diff --git a/connectivity/inc/connectivity/sdbcx/VIndexColumn.hxx b/connectivity/inc/connectivity/sdbcx/VIndexColumn.hxx new file mode 100644 index 000000000000..041bbd3f3fa5 --- /dev/null +++ b/connectivity/inc/connectivity/sdbcx/VIndexColumn.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * $RCSfile: VIndexColumn.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_ +#define _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ +#include "connectivity/sdbcx/VColumn.hxx" +#endif + +namespace connectivity +{ + namespace sdbcx + { + class OIndexColumn; + typedef ::utl::OPropertyArrayUsageHelper<OIndexColumn> OIndexColumn_PROP; + + class OIndexColumn : public OColumn, + public OIndexColumn_PROP + { + protected: + sal_Bool m_IsAscending; + DECLARE_CTY_PROPERTY(OIndexColumn_PROP,OColumn) + public: + OIndexColumn(sal_Bool _bCase); + OIndexColumn( sal_Bool _IsAscending, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _TypeName, + const ::rtl::OUString& _DefaultValue, + sal_Int32 _IsNullable, + sal_Int32 _Precision, + sal_Int32 _Scale, + sal_Int32 _Type, + sal_Bool _IsAutoIncrement, + sal_Bool _IsRowVersion, + sal_Bool _IsCurrency, + sal_Bool _bCase); + + virtual void construct(); + }; + } +} +#endif // _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_ + diff --git a/connectivity/inc/connectivity/sdbcx/VKey.hxx b/connectivity/inc/connectivity/sdbcx/VKey.hxx new file mode 100644 index 000000000000..c8c3ce7e745c --- /dev/null +++ b/connectivity/inc/connectivity/sdbcx/VKey.hxx @@ -0,0 +1,165 @@ +/************************************************************************* + * + * $RCSfile: VKey.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_SDBCX_KEY_HXX_ +#define _CONNECTIVITY_SDBCX_KEY_HXX_ + +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif + +#ifndef _UNOTOOLS_PROPERTY_ARRAY_HELPER_HXX_ +#include <unotools/proparrhlp.hxx> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_TYPEDEF_HXX_ +#include "connectivity/sdbcx/VTypeDef.hxx" +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_ +#include <com/sun/star/container/XNamed.hpp> +#endif +#ifndef _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_ +#include "connectivity/sdbcx/IRefreshable.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_ +#include "connectivity/sdbcx/VDescriptor.hxx" +#endif + +namespace connectivity +{ + namespace sdbcx + { + + class OKey : public OBaseMutex, + public OColumns_BASE, + public IRefreshableColumns, + public ::utl::OPropertyArrayUsageHelper<OKey>, + public ODescriptor + { + protected: + ::rtl::OUString m_ReferencedTable; + sal_Int32 m_Type; + sal_Int32 m_UpdateRule; + sal_Int32 m_DeleteRule; + + OCollection* m_pColumns; + + using OColumns_BASE::rBHelper; + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + public: + DECLARE_CTY_DEFAULTS( OColumns_BASE); + + OKey(sal_Bool _bCase); + OKey( const ::rtl::OUString& _Name, + const ::rtl::OUString& _ReferencedTable, + sal_Int32 _Type, + sal_Int32 _UpdateRule, + sal_Int32 _DeleteRule, + sal_Bool _bCase); + + virtual ~OKey( ) + { + delete m_pColumns; + } + + DECLARE_SERVICE_INFO(); + //XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // ODescriptor + virtual void construct(); + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) + { + return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); + } + + // XDataDescriptorFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw(::com::sun::star::uno::RuntimeException); + // XColumnsSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns( ) throw(::com::sun::star::uno::RuntimeException); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException) + { + return m_Name; + } + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException) + {} + }; + } +} + +#endif // _CONNECTIVITY_SDBCX_KEY_HXX_ + + diff --git a/connectivity/inc/connectivity/sdbcx/VKeyColumn.hxx b/connectivity/inc/connectivity/sdbcx/VKeyColumn.hxx new file mode 100644 index 000000000000..36371c278073 --- /dev/null +++ b/connectivity/inc/connectivity/sdbcx/VKeyColumn.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * $RCSfile: VKeyColumn.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_SDBCX_KEYCOLUMN_HXX_ +#define _CONNECTIVITY_SDBCX_KEYCOLUMN_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ +#include "connectivity/sdbcx/VColumn.hxx" +#endif + +namespace connectivity +{ + namespace sdbcx + { + class OKeyColumn; + typedef ::utl::OPropertyArrayUsageHelper<OKeyColumn> OKeyColumn_PROP; + + class OKeyColumn : public OColumn, + public OKeyColumn_PROP + { + protected: + ::rtl::OUString m_ReferencedColumn; + DECLARE_CTY_PROPERTY(OKeyColumn_PROP,OColumn) + public: + OKeyColumn(sal_Bool _bCase); + OKeyColumn( const ::rtl::OUString& _ReferencedColumn, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _TypeName, + const ::rtl::OUString& _DefaultValue, + sal_Int32 _IsNullable, + sal_Int32 _Precision, + sal_Int32 _Scale, + sal_Int32 _Type, + sal_Bool _IsAutoIncrement, + sal_Bool _IsRowVersion, + sal_Bool _IsCurrency, + sal_Bool _bCase); + + virtual void construct(); + }; + } +} +#endif // _CONNECTIVITY_SDBCX_KEYCOLUMN_HXX_ + diff --git a/connectivity/inc/connectivity/sdbcx/VTable.hxx b/connectivity/inc/connectivity/sdbcx/VTable.hxx new file mode 100644 index 000000000000..68f611070dd2 --- /dev/null +++ b/connectivity/inc/connectivity/sdbcx/VTable.hxx @@ -0,0 +1,209 @@ +/************************************************************************* + * + * $RCSfile: VTable.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_SDBCX_TABLE_HXX_ +#define _CONNECTIVITY_SDBCX_TABLE_HXX_ + +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif + +#ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_ +#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XINDEXESSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XIndexesSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XKEYSSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XKeysSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XRENAME_HPP_ +#include <com/sun/star/sdbcx/XRename.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XALTERTABLE_HPP_ +#include <com/sun/star/sdbcx/XAlterTable.hpp> +#endif +#ifndef _UNOTOOLS_PROPERTY_ARRAY_HELPER_HXX_ +#include <unotools/proparrhlp.hxx> +#endif +#ifndef _CPPUHELPER_COMPBASE8_HXX_ +#include <cppuhelper/compbase8.hxx> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_ +#include <com/sun/star/container/XNamed.hpp> +#endif +#ifndef _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_ +#include "connectivity/sdbcx/IRefreshable.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_ +#include "connectivity/sdbcx/VDescriptor.hxx" +#endif + +namespace connectivity +{ + namespace sdbcx + { + + typedef ::cppu::WeakComponentImplHelper8< ::com::sun::star::sdbcx::XDataDescriptorFactory, + ::com::sun::star::sdbcx::XColumnsSupplier, + ::com::sun::star::sdbcx::XIndexesSupplier, + ::com::sun::star::sdbcx::XKeysSupplier, + ::com::sun::star::sdbcx::XRename, + ::com::sun::star::sdbcx::XAlterTable, + ::com::sun::star::container::XNamed, + ::com::sun::star::lang::XServiceInfo> OTable_BASE; + + + class OTable : public OBaseMutex, + public OTable_BASE, + public IRefreshableColumns, + public ::utl::OPropertyArrayUsageHelper<OTable>, + public ODescriptor + { + protected: + ::rtl::OUString m_CatalogName; + ::rtl::OUString m_SchemaName; + ::rtl::OUString m_Description; + ::rtl::OUString m_Type; + + OCollection* m_pIndexes; + OCollection* m_pKeys; + OCollection* m_pColumns; + + using OTable_BASE::rBHelper; + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + public: + DECLARE_CTY_DEFAULTS( OTable_BASE); + + OTable(sal_Bool _bCase); + OTable( sal_Bool _bCase, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _Type, + const ::rtl::OUString& _Description = ::rtl::OUString(), + const ::rtl::OUString& _SchemaName = ::rtl::OUString(), + const ::rtl::OUString& _CatalogName = ::rtl::OUString()); + + virtual ~OTable() + { + delete m_pIndexes; + delete m_pKeys; + delete m_pColumns; + } + + DECLARE_SERVICE_INFO(); + //XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // ODescriptor + virtual void construct(); + + virtual void refreshKeys() = 0; + virtual void refreshIndexes() = 0; + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) + { + return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); + } + + // XDataDescriptorFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( void ) throw(::com::sun::star::uno::RuntimeException); + // XColumnsSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns( ) throw(::com::sun::star::uno::RuntimeException); + // XIndexesSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getIndexes( ) throw(::com::sun::star::uno::RuntimeException); + // XKeysSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getKeys( ) throw(::com::sun::star::uno::RuntimeException); + // XRename + virtual void SAL_CALL rename( const ::rtl::OUString& newName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + // XAlterTable + virtual void SAL_CALL alterColumnByName( const ::rtl::OUString& colName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL alterColumnByIndex( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException) + { + return m_SchemaName + ::rtl::OUString::createFromAscii(".") + m_Name; + } + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException) + {} + }; + } +} + +#endif // _CONNECTIVITY_SDBCX_TABLE_HXX_ + diff --git a/connectivity/inc/connectivity/sdbcx/VTypeDef.hxx b/connectivity/inc/connectivity/sdbcx/VTypeDef.hxx new file mode 100644 index 000000000000..30548d5aa265 --- /dev/null +++ b/connectivity/inc/connectivity/sdbcx/VTypeDef.hxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * $RCSfile: VTypeDef.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_SDBCX_TYPEDEF_HXX_ +#define _CONNECTIVITY_SDBCX_TYPEDEF_HXX_ + +#ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_ +#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> +#endif +#ifndef _CPPUHELPER_COMPBASE4_HXX_ +#include <cppuhelper/compbase4.hxx> +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif + + +namespace connectivity +{ + namespace sdbcx + { + namespace starsdbcx = ::com::sun::star::sdbcx; + namespace starlang = ::com::sun::star::lang; + + typedef ::cppu::WeakComponentImplHelper4< starsdbcx::XDataDescriptorFactory, + starsdbcx::XColumnsSupplier, + ::com::sun::star::container::XNamed, + starlang::XServiceInfo> OColumns_BASE; + } +} + +#endif // _CONNECTIVITY_SDBCX_TYPEDEF_HXX_ + diff --git a/connectivity/inc/connectivity/sdbcx/VUser.hxx b/connectivity/inc/connectivity/sdbcx/VUser.hxx new file mode 100644 index 000000000000..d7cb74e851c9 --- /dev/null +++ b/connectivity/inc/connectivity/sdbcx/VUser.hxx @@ -0,0 +1,171 @@ +/************************************************************************* + * + * $RCSfile: VUser.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_SDBCX_USER_HXX_ +#define _CONNECTIVITY_SDBCX_USER_HXX_ + +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif + +#ifndef _COM_SUN_STAR_SDBCX_XUSER_HPP_ +#include <com/sun/star/sdbcx/XUser.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XGROUPSSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XGroupsSupplier.hpp> +#endif +#ifndef _UNOTOOLS_PROPERTY_ARRAY_HELPER_HXX_ +#include <unotools/proparrhlp.hxx> +#endif +#ifndef _CPPUHELPER_COMPBASE4_HXX_ +#include <cppuhelper/compbase4.hxx> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_ +#include <com/sun/star/container/XNamed.hpp> +#endif +#ifndef _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_ +#include "connectivity/sdbcx/IRefreshable.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_ +#include "connectivity/sdbcx/VDescriptor.hxx" +#endif + + +namespace connectivity +{ + namespace sdbcx + { + typedef OCollection OGroups; + + typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::sdbcx::XUser, + ::com::sun::star::sdbcx::XGroupsSupplier, + ::com::sun::star::container::XNamed, + ::com::sun::star::lang::XServiceInfo> OUser_BASE; + + class OUser : public OBaseMutex, + public OUser_BASE, + public IRefreshableGroups, + public ::utl::OPropertyArrayUsageHelper<OUser>, + public ODescriptor + { + protected: + OGroups* m_pGroups; + + using OUser_BASE::rBHelper; + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + public: + DECLARE_CTY_DEFAULTS( OUser_BASE); + + OUser(sal_Bool _bCase); + OUser(const ::rtl::OUString& _Name,sal_Bool _bCase); + + virtual ~OUser( ) + { + delete m_pGroups; + } + + DECLARE_SERVICE_INFO(); + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + //XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) + { + return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); + } + + // XUser + virtual void SAL_CALL changePassword( const ::rtl::OUString& objPassword, const ::rtl::OUString& newPassword ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XAuthorizable + virtual sal_Int32 SAL_CALL getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XGroupsSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getGroups( ) throw(::com::sun::star::uno::RuntimeException); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException) + { + return m_Name; + } + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException) + {} + }; + } +} + +#endif // _CONNECTIVITY_SDBCX_USER_HXX_ + diff --git a/connectivity/inc/connectivity/sdbcx/VView.hxx b/connectivity/inc/connectivity/sdbcx/VView.hxx new file mode 100644 index 000000000000..91f83624f9fd --- /dev/null +++ b/connectivity/inc/connectivity/sdbcx/VView.hxx @@ -0,0 +1,167 @@ +/************************************************************************* + * + * $RCSfile: VView.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_SDBCX_VIEW_HXX_ +#define _CONNECTIVITY_SDBCX_VIEW_HXX_ + +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif + +#ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_ +#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> +#endif +#ifndef _UNOTOOLS_PROPERTY_ARRAY_HELPER_HXX_ +#include <unotools/proparrhlp.hxx> +#endif +#ifndef _CPPUHELPER_COMPBASE1_HXX_ +#include <cppuhelper/compbase1.hxx> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _CPPUHELPER_INTERFACECONTAINER_H_ +#include <cppuhelper/interfacecontainer.h> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_ +#include <com/sun/star/container/XNamed.hpp> +#endif +#ifndef _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_ +#include "connectivity/sdbcx/VDescriptor.hxx" +#endif + +namespace connectivity +{ + namespace sdbcx + { + + typedef ::cppu::OWeakObject OView_BASE; + + + class OViewHelper + { + protected: + ::osl::Mutex m_aMutex; + ::cppu::OBroadcastHelper rBHelper; + + public: + OViewHelper(): rBHelper(m_aMutex){} + }; + + class OView : public OViewHelper, + public OView_BASE, + public ::com::sun::star::container::XNamed, + public ::com::sun::star::lang::XServiceInfo, + public ::utl::OPropertyArrayUsageHelper<OView>, + public ODescriptor + { + protected: + ::rtl::OUString m_CatalogName; + ::rtl::OUString m_SchemaName; + ::rtl::OUString m_Command; + sal_Int32 m_CheckOption; + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + + public: + DECLARE_CTY_DEFAULTS( OView_BASE); + DECLARE_SERVICE_INFO(); + + OView(sal_Bool _bCase ); + OView( sal_Bool _bCase, + const ::rtl::OUString& _rName, + sal_Int32 _nCheckOption = 0, + const ::rtl::OUString& _rCommand = ::rtl::OUString(), + const ::rtl::OUString& _rSchemaName = ::rtl::OUString(), + const ::rtl::OUString& _rCatalogName = ::rtl::OUString()); + virtual ~OView(){} + + // ODescriptor + virtual void construct(); + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) + { + return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); + } + + // XNamed + virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException) + { + return m_Name; + } + virtual void SAL_CALL setName( const ::rtl::OUString& ) throw(::com::sun::star::uno::RuntimeException) + {} + }; + } +} + +#endif // _CONNECTIVITY_SDBCX_VIEW_HXX_ + diff --git a/connectivity/inc/connectivity/sqliterator.hxx b/connectivity/inc/connectivity/sqliterator.hxx new file mode 100644 index 000000000000..c8176e6c950e --- /dev/null +++ b/connectivity/inc/connectivity/sqliterator.hxx @@ -0,0 +1,337 @@ +/************************************************************************* + * + * $RCSfile: sqliterator.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:18 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_PARSE_SQLITERATOR_HXX_ +#define _CONNECTIVITY_PARSE_SQLITERATOR_HXX_ + +#ifndef _SVTOOLS_HASHCONT_HXX //autogen +#include <svtools/hashcont.hxx> +#endif +#ifndef _CONNECTIVITY_SQLNODE_HXX +#include "connectivity/sqlnode.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XTablesSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include <com/sun/star/beans/XPropertySet.hpp> +#endif +#ifndef _MAP_ +#include <map> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _VOS_REF_HXX_ +#include <vos/ref.hxx> +#endif +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +namespace connectivity +{ + + class OSQLParseNode; + + + enum OSQLStatementType { + SQL_STATEMENT_UNKNOWN, + SQL_STATEMENT_SELECT, + SQL_STATEMENT_INSERT, + SQL_STATEMENT_UPDATE, + SQL_STATEMENT_DELETE, + SQL_STATEMENT_ODBC_CALL, + SQL_STATEMENT_SELECT_COUNT + }; + + enum OSQLPredicateType { + SQL_PRED_EQUAL = 'a', // Als sichtbare ASCII-Zeichen, damit man + SQL_PRED_NOTEQUAL, // den Predicate Type auch in Strings + SQL_PRED_LESS, // speichern kann. + SQL_PRED_LESSOREQUAL, + SQL_PRED_GREATER, + SQL_PRED_GREATEROREQUAL, + SQL_PRED_LIKE, + SQL_PRED_ISNULL, + SQL_PRED_ISNOTNULL, + SQL_PRED_NOTLIKE + }; + + //================================================================== + // SbaParseIteratorErrorInfo wird dem Call von aErrorHdl aus SbaParseIterator "ubergeben + // nErrorCode enth"alt eine Zusatzinformation "uber den Fehler + // 1 -> Tabelle nicht gefunden + // 2 -> Spalte nicht gefunden + //================================================================== + struct OSQLParseIteratorErrorInfo + { + USHORT nErrorCode; // 1 == Tabelle nicht gefunden, 2 == Spalte nicht gefunden + String aExpression; // der Teil-Ausdruck, der das Problem verursacht hat (kann leer sein) + }; + + #define RET_CONTINUE 1 // Parsevorgang fortsetzen + #define RET_HANDLED 2 // der Fehler wurde schon behandelt, das Parsen soll (mit Status auf Success) abgebrochen werden + #define RET_BREAK 3 // Abbrechen, Status-Fehlercode setzen + + class OSQLParseTreeIterator + { + private: + const OSQLParseNode* m_pParseTree; // aktueller ParseTree + OSQLStatementType m_eStatementType; // Art des Statements + OSQLTables m_aTables; // Alle Tabellen die im ParseTree und bei der Connection gefunden wurden + ::vos::ORef<OSQLColumns> m_aSelectColumns; // alle Spalten aus dem Select-Clause + ::utl::UStringMixEqual m_aCaseEqual; + + Link m_aErrorHdl; // wird im Fehlerfall gerufen + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xTables; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> m_xDatabaseMetaData; + + // F"ugt eine Tabelle in die Map ein + void traverseOneTableName(const OSQLParseNode * pTableName, const String & rTableRange); + void traverseORCriteria(OSQLParseNode * pSearchCondition); + void traverseANDCriteria(OSQLParseNode * pSearchCondition); + void traverseOnePredicate( + OSQLParseNode * pColumnRef, + OSQLPredicateType ePredicateType, + String& aValue, + BOOL bCompareNull, + OSQLParseNode * pParameter); + OSQLParseNode * getTableRef(OSQLParseNode *pTableRef,String& aTableRange); + OSQLParseNode * getQualified_join(OSQLParseNode *pTableRef,String& aTableRange); + void getSelect_statement(OSQLParseNode *pSelect); + BOOL CallError(USHORT nError, const String& rExpression = String()); + String getUniqueColumnName(const String & rColumnName) const; + + protected: + void setSelectColumnName(const String & rColumnName,const String & rColumnAlias, const String & rTableRange,BOOL bFkt=FALSE); + void appendColumns(const OSQLTable& _rTable); + // Weitere Member-Variable, die in den "set"-Funktionen zur + // Verfuegung stehen sollen, koennen in der abgeleiteten Klasse + // definiert werden und z. B. in deren Konstruktor initialisiert + // bzw. nach Benutzung der "traverse"-Routinen mit Hilfe weiterer + // Funktionen abgefragt werden. + + + public: + OSQLParseTreeIterator(); + OSQLParseTreeIterator(const OSQLParseTreeIterator & rIter); + OSQLParseTreeIterator( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _xTableSupplier , + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData>& _xDatabaseMetaData, + const OSQLParseNode* pRoot); + ~OSQLParseTreeIterator(); + + sal_Bool isCaseSensitive() const { return m_aCaseEqual.isCaseSensitive(); } + // Der zu analysierende/zu traversierende Parse Tree: + // bei "Ubergabe von NULL wird der aktuelle Parsetree gel"oscht und der Fehlerstatus gecleared + void setParseTree(const OSQLParseNode * pNewParseTree); + const OSQLParseNode * getParseTree() const { return m_pParseTree; }; + + // Teilbaueme bei einem select statement + const OSQLParseNode* getWhereTree() const; + const OSQLParseNode* getOrderTree() const; + const OSQLParseNode* getGroupByTree() const; + const OSQLParseNode* getHavingTree() const; + + // Statement-Typ (wird bereits in setParseTree gesetzt): + OSQLStatementType getStatementType() const { return m_eStatementType; } + + // Die "traverse"-Routinen durchlaufen bestimmte Teile des Parse Tree + // und rufen fuer die erkannten Konstrukte die virtuellen "set"-Routinen + // auf und uebergeben diesen die erkannten Informationen als Parameter. + // + // Der Parse Tree muss in einer bestimmten Form vorliegen: + // SELECT [<tablerange>.]<columnname>, [<tablerange>.]<columnname>, ... + // FROM <tablename> [<tablerange>], <tablename> [<tablerange>], ... + // WHERE ( + // <predicate> + // AND <predicate> + // ... + // ) + // OR ( + // ... + // ) + // ... + // ORDER BY <columname>, <columnname>, ... + // + // (die Klammern sind optional bzw. zusaetzliche Klammern stoeren nicht, aber + // es duerfen nur mehrere AND-Bedingungen, die ihrerseits mit OR verknuepft sind, + // auftreten). + // + // + // <predicate> kann sein: + // [<tablerange>.]<columnname> <operator> <value> + // [<tablerange>.]<columnname> LIKE <value> + // [<tablerange>.]<columnname> NOT LIKE <value> + // [<tablerange>.]<columnname> IS NULL + // [<tablerange>.]<columnname> IS NOT NULL + // + // <operator> kann sein: + // "=" + // "<>" + // "<" + // "<=" + // ">" + // ">=" + // + // <value> kann auch ein Parameter sein, in diesem Fall enthaelt + // das Argument "ParameterName" der "set"-Funktionen den Namen des Parameters + // (ohne fuehrenden Doppelpunkt) bzw. "?" bei unbenannten Parametern. + // + // <columnname> in der Select-Klausel kann auch "*" oder "COUNT(*)" sein. + // + // + // Wenn das Statement NICHT diese Form hat, oder wenn eine der "set"-Routinen + // den IteratorStatus != IsSuccessful() hinterlaesst, wird die weitere Analyse + // des Parse Tree abgebrochen. Ansonsten liefert "Status().IsSuccessful() == TRUE". + + void traverseTableNames(); + virtual void setTableName(const String & rTableName, const String & rDBName, const String& rOwner, + const String & rTableRange); + // [TableName enthaelt immer einen Namen, TableRange ist, falls angegeben, die "Range"- + // Variable (eine Art Alias-Name fuer den TableName), falls nicht angegeben, identisch + // zum TableName. SchemaName ist leer, wenn nicht angegeben.] + + void traverseSelectColumnNames(const OSQLParseNode* pSelectNode); + // [TableRange kann leer sein, wenn nicht angegeben] + + void traverseOrderByColumnNames(const OSQLParseNode* pSelectNode); + virtual void setOrderByColumnName(const String & rColumnName, const String & rTableRange, BOOL bAscending); + // [TableRange kann leer sein, wenn nicht angegeben] + + // Bei Selektionskriterien werden (selbst bei einem einfachen Praedikat) + // folgende "set"-Funktionen in der angegebenen Reihenfolge aufgerufen: + // + // setORCriteriaPre + // | + // | setANDCriteriaPre + // | | setPredicate + // | | [weitere setPredicate-Aufrufe] ... + // | setANDCriteriaPost + // | + // | ... [weitere setANDCriteriaPre/Post-Paare und darin setPredicate-Aufrufe] + // | + // setORCriteriaPost + // + // Die AND-Verknuepfungen sind also implizit ODER-Verknuepft. setORCriteriaPre und + // setORCriteriaPost werden jeweils nur ein einziges Mal aufgerufen (sind also + // eigentlich ziemlich ueberfluessig, da man diese Aktionen auch vor bzw. nach dem + // traverse-Aufruf erledigen kann)! + // + void traverseSelectionCriteria(const OSQLParseNode* pSelectNode); + virtual void setORCriteriaPre(); + virtual void setORCriteriaPost(); + virtual void setANDCriteriaPre(); + virtual void setANDCriteriaPost(); + virtual void setPredicate(const String & rColumnName, + const String & rTableRange, + OSQLPredicateType ePredicateType, + const String & rValue, + const String & rParameterName); + + + // Erweiterung auf UPDATE- und INSERT-Statement ... (nyi): + void traverseAssignments(); + virtual void setAssign(const String & rColumnName, + const String & rValue, BOOL bsetNull, + const String & rParameterName); + + // Alle "traverse"-Routinen hintereinander aufrufen. Je nach Statement-Typ: + // Bei UPDATE und INSERT-Statement nur traverseTableNames und traverseAssignments, + // bei DELETE nur traverseTableNames und bei SELECT-Statement + // in der Reihenfolge: traverseTableNames, traverseSelectColumnNames, + // traverseOrderByColumnNames, traverseSelectionCriteria. + // Bricht bei irgendwelchen Fehlern sofort ab und liefert entsprechenden + // Status. + void traverseAll(); + + // Die TableRangeMap enth"alt alle Tabellen unter dem zugeh"origen Rangenamen der zuerst gefunden wird + const OSQLTables& getTables() const { return m_aTables;}; + // return tables as nameaccess + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > + getTablesAsNameAccess(::cppu::OWeakObject& _rParent,::osl::Mutex& _rMutex) const; + + ::vos::ORef<OSQLColumns> getSelectColumns() const { return m_aSelectColumns;} + // return select columns as nameaccess + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > + getSelectAsNameAccess(::cppu::OWeakObject& _rParent,::osl::Mutex& _rMutex) const; + // gibt den Aliasnamen der Column zur"uck, Leer falls nicht vorhanden + String getColumnAlias(const OSQLParseNode* pDerivedColumn) const; + // gibt den Columnnamen und die Tablerange (falls vorhanden) zur"uck + void getColumnRange(const OSQLParseNode* pColumnRef,String &rColumnName,String &rTableRange) const; + + // Ermittelt fuer eine Funktion, Spalten den zugehoeren TableRange, + // wenn nicht eindeutig, dann leer + BOOL getColumnTableRange(const OSQLParseNode* pNode, String &rTableRange) const; + + // FehlerHdl setzen + void setErrorHdl(const Link& rHdl){ m_aErrorHdl = rHdl;}; + const Link& getErrorHdl(){ return m_aErrorHdl;}; + }; +} + +#endif // _CONNECTIVITY_PARSE_SQLITERATOR_HXX_ + diff --git a/connectivity/inc/connectivity/sqlnode.hxx b/connectivity/inc/connectivity/sqlnode.hxx new file mode 100644 index 000000000000..4cf5e68ff511 --- /dev/null +++ b/connectivity/inc/connectivity/sqlnode.hxx @@ -0,0 +1,405 @@ +/************************************************************************* + * + * $RCSfile: sqlnode.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_SQLNODE_HXX +#define _CONNECTIVITY_SQLNODE_HXX + +#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_ +#include <com/sun/star/uno/Reference.h> +#endif +#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATTYPES_HPP_ +#include <com/sun/star/util/XNumberFormatTypes.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include <com/sun/star/beans/XPropertySet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#endif +#ifndef __SGI_STL_VECTOR +#include <stl/vector> +#endif +#ifndef _STRING_HXX //autogen +#include <tools/string.hxx> +#endif +#ifndef _DEBUG_HXX //autogen +#include <tools/debug.hxx> +#endif + +// forward declarations +namespace com +{ + namespace sun + { + namespace star + { + namespace sdbc + { + class XDatabaseMetaData; + } + namespace beans + { + class XPropertySet; + } + namespace util + { + class XNumberFormatter; + } + } + } +} + +class International; + +namespace connectivity +{ + + class OSQLParseNode; + class OParseContext; + + typedef ::std::vector< OSQLParseNode* > OSQLParseNodes; + + enum SQLNodeType {SQL_NODE_RULE, SQL_NODE_LISTRULE, SQL_NODE_COMMALISTRULE, + SQL_NODE_KEYWORD, SQL_NODE_COMPARISON, SQL_NODE_NAME, + SQL_NODE_STRING, SQL_NODE_INTNUM, SQL_NODE_APPROXNUM, + SQL_NODE_EQUAL,SQL_NODE_LESS,SQL_NODE_GREAT,SQL_NODE_LESSEQ,SQL_NODE_GREATEQ,SQL_NODE_NOTEQUAL, + SQL_NODE_PUNCTUATION, SQL_NODE_AMMSC, SQL_NODE_ACCESS_DATE,SQL_NODE_DATE}; + + //========================================================================== + //= OSQLParseNode + //========================================================================== + class OSQLParseNode + { + friend class OSQLParser; + + OSQLParseNodes m_aChilds; + OSQLParseNode* m_pParent; // pParent fuer Reuckverkettung im Baum + String m_aNodeValue; // Token-Name oder leer bei Regeln oder String bei + // String, INT, usw. -Werten + SQLNodeType m_eNodeType; // s. o. + sal_uInt32 m_nNodeID; // ::com::sun::star::chaos::Rule ID (bei IsRule()) oder Token ID (bei !IsRule()) + // ::com::sun::star::chaos::Rule IDs und Token IDs koennen nicht anhand des Wertes + // unterschieden werden, dafuer ist IsRule() abzufragen! + protected: + struct SQLParseNodeParameter + { + const International& rIntl; + const String aIdentifierQuote; + const String aCatalogSeparator; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > xFormatter; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xField; + const OParseContext& rContext; + char cDecSep ; + sal_Bool bQuote : 1; + sal_Bool bInternational : 1; + sal_Bool bPredicate : 1; + + SQLParseNodeParameter(const String& _rIdentifierQuote, + const String& _rCatalogSep, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > & _xFormatter, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & _xField, + const International& _rIntl, + const OParseContext* _pContext, + sal_Bool _bIntl = sal_False, + sal_Bool _bQuote= sal_True, + char _cDecSep = '.', + sal_Bool _bPredicate = sal_False); + }; + + public: + enum Rule + { + select_statement = 0, + table_exp, + table_ref_commalist, + table_ref, + table_name, + opt_column_commalist, + column_commalist, + column_ref_commalist, + column_ref, + opt_order_by_clause, + ordering_spec_commalist, + ordering_spec, + opt_asc_desc, + where_clause, + opt_where_clause, + search_condition, + comparison_predicate, + between_predicate, + like_predicate, + opt_escape, + test_for_null, + scalar_exp_commalist, + scalar_exp, + parameter_ref, + parameter, + general_set_fct, + range_variable, + column, + delete_statement_positioned, + delete_statement_searched, + update_statement_positioned, + update_statement_searched, + assignment_commalist, + assignment, + values_or_query_spec, + insert_statement, + insert_atom_commalist, + insert_atom, + predicate_check, + from_clause, + qualified_join, + cross_union, + select_sublist, + derived_column, + column_val, + set_fct_spec, + boolean_term, + boolean_primary, + num_value_exp, + join_type, + position_exp, + extract_exp, + length_exp, + char_value_fct, + odbc_call_spec, + in_predicate, + existence_test, + unique_test, + all_or_any_predicate, + named_columns_join, + join_condition, + joined_table, + boolean_factor, + not, + boolean_test, + manipulative_statement, + subquery, + value_exp_commalist, + odbc_fct_spec, + union_statement, + outer_join_type, + char_value_exp, + term, + value_exp_primary, + value_exp, + rule_count // letzter_wert + }; + + // must be ascii encoding for the value + OSQLParseNode(const sal_Char* _pValueStr, + SQLNodeType _eNodeType, + sal_uInt32 _nNodeID = 0); + + OSQLParseNode(const ByteString& _rValue, + SQLNodeType eNewNodeType, + sal_uInt32 nNewNodeID=0); + + OSQLParseNode(const sal_Unicode* _pValue, + SQLNodeType _eNodeType, + sal_uInt32 _nNodeID = 0); + + OSQLParseNode(const String& _rValue, + SQLNodeType _eNodeType, + sal_uInt32 _nNodeID = 0); + + // Kopiert den entsprechenden ParseNode + OSQLParseNode(const OSQLParseNode& rParseNode); + OSQLParseNode& operator=(const OSQLParseNode& rParseNode); + + sal_Bool operator==(OSQLParseNode& rParseNode) const; + + // Destruktor raeumt rekursiv den Baum ab + virtual ~OSQLParseNode(); + + // Parent gibt den Zeiger auf den Parent zurueck + OSQLParseNode* getParent() const {return m_pParent;}; + + // SetParent setzt den Parent-Zeiger eines ParseNodes + void setParent(OSQLParseNode* pParseNode) {m_pParent = pParseNode;}; + + // ChildCount liefert die Anzahl der Kinder eines Knotens + sal_uInt32 count() const {return m_aChilds.size();}; + inline OSQLParseNode* getChild(sal_uInt32 nPos) const; + + void append(OSQLParseNode* pNewSubTree); + void insert(sal_uInt32 nPos, OSQLParseNode* pNewSubTree); + + OSQLParseNode* replaceAt(sal_uInt32 nPos, OSQLParseNode* pNewSubTree); + OSQLParseNode* replace(OSQLParseNode* pOldSubTree, OSQLParseNode* pNewSubTree); + + OSQLParseNode* removeAt(sal_uInt32 nPos); + OSQLParseNode* remove(OSQLParseNode* pSubTree); + + void replaceNodeValue(const String& rTableAlias,const String& rColumnName); + + void parseNodeToStr(String& rString, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > & xMeta, + OParseContext* pContext = NULL, + sal_Bool _bIntl = sal_False, + sal_Bool _bQuote= sal_True) const; + + // quoted und internationalisert + void parseNodeToPredicateStr(String& rString, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > & xMeta, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > & xFormatter, + const International& rIntl, + OParseContext* pContext = NULL ) const; + + void parseNodeToPredicateStr(String& rString, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > & xMeta, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > & xFormatter, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & _xField, + const International& rIntl, + OParseContext* pContext = NULL ) const; + + OSQLParseNode* getByRule(OSQLParseNode::Rule eRule) const; + + // zeigt den ParseTree mit tabs und linefeeds + void showParseTree(String& rString, sal_uInt32 nLevel=0); + + // GetNodeType gibt den Knotentyp zurueck + SQLNodeType getNodeType() const {return m_eNodeType;}; + + // RuleId liefert die RuleId der Regel des Knotens (nur bei IsRule()) + sal_uInt32 getRuleID() const {return m_nNodeID;} + + // RuleId liefert die TokenId des Tokens des Knotens (nur bei ! IsRule()) + sal_uInt32 getTokenID() const {return m_nNodeID;} + + // IsRule testet ob ein Node eine Regel (NonTerminal) ist + // Achtung : Regeln koenne auch Blaetter sein, z.B. leere Listen + sal_Bool isRule() const + { return (m_eNodeType == SQL_NODE_RULE) || (m_eNodeType == SQL_NODE_LISTRULE) + || (m_eNodeType == SQL_NODE_COMMALISTRULE);} + + // IsToken testet ob ein Node ein Token (Terminal) ist + sal_Bool isToken() const {return !isRule();} // ein Token ist keine Regel + + // TokenValue liefert den NodeValue eines Tokens + const String& getTokenValue() const {return m_aNodeValue;} + + // SetTokenValue setzt den NodeValue + void setTokenValue(const String& rString) { if (isToken()) m_aNodeValue = rString;} + + // IsLeaf testet ob ein Node ein Blatt ist + sal_Bool isLeaf() const {return m_aChilds.empty();} + + // negate only a searchcondition, any other rule could cause a gpf + static void negateSearchCondition(OSQLParseNode*& pSearchCondition,sal_Bool bNegate=sal_False); + + // normalize a logic form + // e.q. (a or b) and (c or d) <=> a and c or a and d or b and c or b and d + static void disjunctiveNormalForm(OSQLParseNode*& pSearchCondition); + + // Simplies logic expressions + // a * a = a + // a + a = a + // a * ( a + b) = a + // a + a * b = a + static void absorptions(OSQLParseNode*& pSearchCondition); + + // erase not nessary braces + static void eraseBraces(OSQLParseNode*& pSearchCondition); + + // makes the logic formula a little more smaller + static void compress(OSQLParseNode*& pSearchCondition); + + protected: + // ParseNodeToStr konkateniert alle Token (Blaetter) des ParseNodes + void parseNodeToStr(String& rString, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > & xMeta, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > & xFormatter, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & _xField, + const International& rIntl, + OParseContext* pContext, + sal_Bool _bIntl, + sal_Bool _bQuote, + char _cDecSep, + sal_Bool bPredicate) const; + + virtual void parseNodeToStr(String& rString, + const SQLParseNodeParameter& rParam) const; + private: + void likeNodeToStr(String& rString, + const SQLParseNodeParameter& rParam) const; + void tableRangeNodeToStr(String& rString, + const SQLParseNodeParameter& rParam) const; + sal_Bool addDateValue(String& rString, const SQLParseNodeParameter& rParam) const; + String convertDateTimeString(const SQLParseNodeParameter& rParam, const String& rString) const; + String convertDateString(const SQLParseNodeParameter& rParam, const String& rString) const; + String convertTimeString(const SQLParseNodeParameter& rParam, const String& rString) const; + }; + + //----------------------------------------------------------------------------- + inline OSQLParseNode* OSQLParseNode::getChild(sal_uInt32 nPos) const + { + DBG_ASSERT(nPos < m_aChilds.size(), "Invalid Position"); + return m_aChilds[nPos]; + } + + // Utility-Methoden zum Abfragen auf bestimmte Rules, Token oder Punctuation: + #define SQL_ISRULE(pParseNode, eRule) ((pParseNode)->isRule() && (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::##eRule)) + #define SQL_ISTOKEN(pParseNode, token) ((pParseNode)->isToken() && (pParseNode)->getTokenID() == SQL_TOKEN_##token) + #define SQL_ISPUNCTUATION(pParseNode, aString) ((pParseNode)->getNodeType() == SQL_NODE_PUNCTUATION && (pParseNode)->getTokenValue().EqualsAscii(aString)) +} + +#endif //_CONNECTIVITY_SQLNODE_HXX diff --git a/connectivity/inc/connectivity/sqlparse.hxx b/connectivity/inc/connectivity/sqlparse.hxx new file mode 100644 index 000000000000..eafab5b20b23 --- /dev/null +++ b/connectivity/inc/connectivity/sqlparse.hxx @@ -0,0 +1,260 @@ +/************************************************************************* + * + * $RCSfile: sqlparse.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_SQLPARSE_HXX +#define _CONNECTIVITY_SQLPARSE_HXX + +#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_ +#include <com/sun/star/uno/Reference.h> +#endif +#ifndef _OSL_MUTEX_HXX_ //autogen wg. Mutex +#include <osl/mutex.hxx> +#endif +#ifndef _CONNECTIVITY_SQLNODE_HXX +#include <connectivity/sqlnode.hxx> +#endif +#ifndef YYBISON +#ifndef FLEX_SCANNER +#include "connectivity/sqlbison.hxx" +#endif +#endif + +// forward declarations +namespace com +{ + namespace sun + { + namespace star + { + namespace beans + { + class XPropertySet; + } + namespace util + { + class XNumberFormatter; + } + } + } +} +class International; +namespace connectivity +{ + class OSQLScanner; + + //========================================================================== + //= OParseContext + //========================================================================== + class OParseContext + { + public: + enum ErrorCode + { + ERROR_NONE = 0, + ERROR_GENERAL, // "Syntax error in SQL expression" + ERROR_GENERAL_HINT, // "before \"#\" expression.", uses 1 parameter + ERROR_VALUE_NO_LIKE, // "The value # can not be used with LIKE!", uses 1 parameter + ERROR_FIELD_NO_LIKE, // "LIKE can not be used with this field!" + ERROR_INVALID_COMPARE, // "The entered criterion can not be compared with this field!"; + ERROR_INVALID_INT_COMPARE, // "The field can not be compared with a number!" + ERROR_INVALID_STRING_COMPARE, // "The field can not be compared with a string!" + ERROR_INVALID_DATE_COMPARE, // "The field can not be compared with a date!" + ERROR_INVALID_REAL_COMPARE // "The field can not be compared with a floating point number!" + }; + + enum InternationalKeyCode + { + KEY_NONE = 0, + KEY_LIKE = SQL_TOKEN_LIKE, + KEY_NOT = SQL_TOKEN_NOT, + KEY_NULL = SQL_TOKEN_NULL, + KEY_TRUE = SQL_TOKEN_TRUE, + KEY_FALSE = SQL_TOKEN_FALSE, + KEY_IS = SQL_TOKEN_IS, + KEY_BETWEEN = SQL_TOKEN_BETWEEN, + KEY_OR = SQL_TOKEN_OR, + KEY_AND = SQL_TOKEN_AND, + KEY_AVG = SQL_TOKEN_AVG, + KEY_COUNT = SQL_TOKEN_COUNT, + KEY_MAX = SQL_TOKEN_MAX, + KEY_MIN = SQL_TOKEN_MIN, + KEY_SUM = SQL_TOKEN_SUM + }; + + public: + OParseContext(); + + virtual ~OParseContext(); + // retrieves language specific error messages + virtual String getErrorMessage(ErrorCode _eCodes) const; + + // retrieves language specific keyword strings (only ASCII allowed) + virtual ByteString getIntlKeywordAscii(InternationalKeyCode _eKey) const; + + // finds out, if we have an international keyword (only ASCII allowed) + virtual InternationalKeyCode getIntlKeyCode(const ByteString& rToken) const; + + // determines the default international setting + static const International& getDefaultInternational(); + }; + + //========================================================================== + //= OSQLParser + //========================================================================== + /** Parser for SQL92 + */ + class OSQLParser + { + friend class OSQLParseNode; + friend class OSQLInternalNode; + friend struct OSQLParseNode::SQLParseNodeParameter; + + private: + // static parts for parsers + static sal_uInt32 s_nRuleIDs[OSQLParseNode::rule_count + 1]; + static OParseContext s_aDefaultContext; + + // parts controled by mutex + static ::osl::Mutex s_aMutex; + static OSQLScanner* s_pScanner; + static OSQLParseNodes* s_pGarbageCollector; + static sal_Int32 s_nRefCount; + + // informations on the current parse action + OParseContext* m_pContext; + OSQLParseNode* m_pParseTree; // result from parsing + International* m_pIntl; // current internation settings for parsing + String m_sFieldName; // current field name for a predicate + String m_sErrorMessage;// current error msg + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > + m_xField; // current field + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > + m_xFormatter; // current number formatter + sal_Int32 m_nFormatKey; // numberformat, which should be used + + public: + // if NULL, a default context will be used + // the context must live as long as the parser + OSQLParser(OParseContext* _pContext = NULL); + ~OSQLParser(); + + // Parsing an SQLStatement + OSQLParseNode* parseTree(String& rErrorMessage, + const String& rStatement, + sal_Bool bInternational = sal_False); + + // Check a Predicate + OSQLParseNode* predicateTree(String& rErrorMessage, const String& rStatement, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > & xFormatter, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xField); + + // Access to the context + const OParseContext& getContext() const {return *m_pContext;} + + // TokenIDToStr: Token-Name zu einer Token-Nr. + static ByteString TokenIDToStr(sal_uInt32 nTokenID, OParseContext* pContext = NULL); + + // StrToTokenID: Token-Nr. zu einem Token-Namen. + // static sal_uInt32 StrToTokenID(const ByteString & rName); + + // RuleIDToStr gibt den zu einer RuleID gehoerenden String zurueck + // (Leerstring, falls nicht gefunden) + static String RuleIDToStr(sal_uInt32 nRuleID); + + // StrToRuleID berechnet zu einem String die RuleID (d.h. ::com::sun::star::sdbcx::Index in yytname) + // (0, falls nicht gefunden). Die Suche nach der ID aufgrund eines Strings ist + // extrem ineffizient (sequentielle Suche nach String)! + static sal_uInt32 StrToRuleID(const ByteString & rValue); + + // RuleId mit enum, wesentlich effizienter + static sal_uInt32 RuleID(OSQLParseNode::Rule eRule); + + + + void error(char *fmt); + int SQLlex(); +#ifdef YYBISON + inline void setParseTree(OSQLParseNode * pNewParseTree) {m_pParseTree = pNewParseTree;} + + // Is the parse in a special mode? + // Predicate chack is used to check a condition for a field + sal_Bool inPredicateCheck() const {return m_xField.is();} + const String& getFieldName() const {return m_sFieldName;} + + void reduceLiteral(OSQLParseNode*& pLiteral, sal_Bool bAppendBlank); + // does not change the pLiteral argument + sal_Int16 buildNode(OSQLParseNode*& pAppend,OSQLParseNode* pLiteral,OSQLParseNode*& pCompare); + // makes a string out of a number, pLiteral will be deleted + sal_Int16 buildNode_STR_NUM(OSQLParseNode*& pAppend,OSQLParseNode*& pLiteral,OSQLParseNode*& pCompare); + sal_Int16 buildNode_Date(const double& fValue, sal_Int16 nType, OSQLParseNode*& pAppend,OSQLParseNode* pLiteral,OSQLParseNode*& pCompare); + + sal_Int16 buildComparsionRule(OSQLParseNode*& pAppend,OSQLParseNode* pLiteral); + // pCompre will be deleted if it is not used + sal_Int16 buildComparsionRule(OSQLParseNode*& pAppend,OSQLParseNode* pLiteral,OSQLParseNode*& pCompare); + + sal_Int16 buildLikeRule(OSQLParseNode*& pAppend,OSQLParseNode*& pLiteral,const OSQLParseNode* pEscape); + sal_Int16 buildStringNodes(OSQLParseNode*& pLiteral); +#else +#endif + }; +} + + +#endif //_CONNECTIVITY_SQLPARSE_HXX diff --git a/connectivity/prj/d.lst b/connectivity/prj/d.lst new file mode 100644 index 000000000000..72fb57e93598 --- /dev/null +++ b/connectivity/prj/d.lst @@ -0,0 +1,42 @@ +..\%__SRC%\bin\sdbc*.dll %_DEST%\bin%_EXT%\sdbc*.dll +..\%__SRC%\bin\jdbc*.dll %_DEST%\bin%_EXT%\jdbc*.dll +..\%__SRC%\bin\odbc*.dll %_DEST%\bin%_EXT%\odbc*.dll +..\%__SRC%\bin\dbase*.dll %_DEST%\bin%_EXT%\dbase*.dll +..\%__SRC%\bin\adabas*.dll %_DEST%\bin%_EXT%\adabas*.dll +..\%__SRC%\bin\ado*.dll %_DEST%\bin\%_EXT%\ado*.dll +..\%__SRC%\bin\oterro*.dll %_DEST%\bin\%_EXT%\oterro*.dll +..\%__SRC%\lib\libsdbc*.so %_DEST%\lib%_EXT%\libsdbc*.so +..\%__SRC%\lib\libjdbc*.so %_DEST%\lib%_EXT%\libjdbc*.so +..\%__SRC%\lib\libodbc*.so %_DEST%\lib%_EXT%\libodbc*.so +..\%__SRC%\lib\libdbase*.so %_DEST%\lib%_EXT%\libdbase*.so +..\%__SRC%\lib\libadabas*.so %_DEST%\lib%_EXT%\libadabas*.so +..\%__SRC%\lib\libconnectivity*.* %_DEST%\lib%_EXT%\connectivity*.* +..\%__SRC%\slb\connectivity*.* %_DEST%\lib%_EXT%\connectivity*.* + + +mkdir: %_DEST%\inc%_EXT%\connectivity +mkdir: %_DEST%\inc%_EXT%\connectivity\sdbcx + +hedabu: ..\inc\connectivity\CommonTools.hxx %_DEST%\inc%_EXT%\connectivity\CommonTools.hxx +hedabu: ..\inc\connectivity\PColumn.hxx %_DEST%\inc%_EXT%\connectivity\PColumn.hxx +hedabu: ..\inc\connectivity\sqliterator.hxx %_DEST%\inc%_EXT%\connectivity\sqliterator.hxx +hedabu: ..\inc\connectivity\sqlnode.hxx %_DEST%\inc%_EXT%\connectivity\sqlnode.hxx +hedabu: ..\inc\connectivity\sqlparse.hxx %_DEST%\inc%_EXT%\connectivity\sqlparse.hxx +hedabu: ..\%__SRC%\inc\connectivity\sqlbison.hxx %_DEST%\inc%_EXT%\connectivity\sqlbison.hxx +hedabu: ..\inc\connectivity\simplepropertycontainer.hxx %_DEST%\inc%_EXT%\connectivity\simplepropertycontainer.hxx +hedabu: ..\inc\connectivity\sdbcx\IRefreshable.hxx %_DEST%\inc%_EXT%\connectivity\sdbcx\IRefreshable.hxx +hedabu: ..\inc\connectivity\sdbcx\VCatalog.hxx %_DEST%\inc%_EXT%\connectivity\sdbcx\VCatalog.hxx +hedabu: ..\inc\connectivity\sdbcx\VColumn.hxx %_DEST%\inc%_EXT%\connectivity\sdbcx\VColumn.hxx +hedabu: ..\inc\connectivity\sdbcx\VIndexColumn.hxx %_DEST%\inc%_EXT%\connectivity\sdbcx\VIndexColumn.hxx +hedabu: ..\inc\connectivity\sdbcx\VKey.hxx %_DEST%\inc%_EXT%\connectivity\sdbcx\VKey.hxx +hedabu: ..\inc\connectivity\sdbcx\VKeyColumn.hxx %_DEST%\inc%_EXT%\connectivity\sdbcx\VKeyColumn.hxx +hedabu: ..\inc\connectivity\sdbcx\VCollection.hxx %_DEST%\inc%_EXT%\connectivity\sdbcx\VCollection.hxx +hedabu: ..\inc\connectivity\sdbcx\VGroup.hxx %_DEST%\inc%_EXT%\connectivity\sdbcx\VGroup.hxx +hedabu: ..\inc\connectivity\sdbcx\VUser.hxx %_DEST%\inc%_EXT%\connectivity\sdbcx\VUser.hxx +hedabu: ..\inc\connectivity\sdbcx\VDescriptor.hxx %_DEST%\inc%_EXT%\connectivity\sdbcx\VDescriptor.hxx +hedabu: ..\inc\connectivity\sdbcx\VIndex.hxx %_DEST%\inc%_EXT%\connectivity\sdbcx\VIndex.hxx +hedabu: ..\inc\connectivity\sdbcx\VIndexColumn.hxx %_DEST%\inc%_EXT%\connectivity\sdbcx\VIndexColumn.hxx +hedabu: ..\inc\connectivity\sdbcx\VTable.hxx %_DEST%\inc%_EXT%\connectivity\sdbcx\VTable.hxx +hedabu: ..\inc\connectivity\sdbcx\VView.hxx %_DEST%\inc%_EXT%\connectivity\sdbcx\VView.hxx +hedabu: ..\inc\connectivity\sdbcx\VTypeDef.hxx %_DEST%\inc%_EXT%\connectivity\sdbcx\VTypeDef.hxx + diff --git a/connectivity/source/commontools/CommonTools.cxx b/connectivity/source/commontools/CommonTools.cxx new file mode 100644 index 000000000000..9142ac4af8ec --- /dev/null +++ b/connectivity/source/commontools/CommonTools.cxx @@ -0,0 +1,318 @@ +/************************************************************************* + * + * $RCSfile: CommonTools.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _RTL_CHAR_H_ +#include <rtl/char.h> +#endif +#ifndef _COM_SUN_STAR_UTIL_DATE_HPP_ +#include <com/sun/star/util/Date.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_TIME_HPP_ +#include <com/sun/star/util/Time.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_DATETIME_HPP_ +#include <com/sun/star/util/DateTime.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include <com/sun/star/beans/XPropertySet.hpp> +#endif +#include <stdio.h> +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +#ifndef _CPPUHELPER_EXTRACT_HXX_ +#include <cppuhelper/extract.hxx> +#endif + +namespace connectivity +{ + using namespace ::com::sun::star::uno; + using namespace ::com::sun::star::beans; + //------------------------------------------------------------------------------ + sal_Int32 getINT32(const Any& _rAny) + { + sal_Int32 nReturn = 0; + _rAny >>= nReturn; + return nReturn; + } + + //------------------------------------------------------------------------------ + sal_Int16 getINT16(const Any& _rAny) + { + sal_Int16 nReturn = 0; + _rAny >>= nReturn; + return nReturn; + } + + //------------------------------------------------------------------------------ + double getDouble(const Any& _rAny) + { + double nReturn = 0.0; + _rAny >>= nReturn; + return nReturn; + } + + //------------------------------------------------------------------------------ + ::rtl::OUString getString(const Any& _rAny) + { + ::rtl::OUString nReturn; + _rAny >>= nReturn; + return nReturn; + } + + //------------------------------------------------------------------------------ + sal_Bool getBOOL(const Any& _rAny) + { + return ::cppu::any2bool(_rAny); + } + //------------------------------------------------------------------ + const sal_Unicode CHAR_PLACE = '_'; + const sal_Unicode CHAR_WILD = '%'; + // ------------------------------------------------------------------------- + sal_Bool match(const sal_Unicode* pWild, const sal_Unicode* pStr, const sal_Unicode cEscape) + { + int pos=0; + int flag=0; + + while ( *pWild || flag ) + { + switch (*pWild) + { + case CHAR_PLACE: + if ( *pStr == 0 ) + return sal_False; + break; + default: + if (*pWild && (*pWild == cEscape) && ((*(pWild+1)== CHAR_PLACE) || (*(pWild+1) == CHAR_WILD)) ) + pWild++; + if ( rtl_char_toUpperCase(*pWild) != rtl_char_toUpperCase(*pStr) ) + if ( !pos ) + return sal_False; + else + pWild += pos; + else + break; // ACHTUNG laeuft unter bestimmten + // Umstaenden in den nachsten case rein!! + case CHAR_WILD: + while ( *pWild == CHAR_WILD ) + pWild++; + if ( *pWild == 0 ) + return sal_True; + flag = 1; + pos = 0; + if ( *pStr == 0 ) + return ( *pWild == 0 ); + while ( *pStr && *pStr != *pWild ) + { + if ( *pWild == CHAR_PLACE ) { + pWild++; + while ( *pWild == CHAR_WILD ) + pWild++; + } + pStr++; + if ( *pStr == 0 ) + return ( *pWild == 0 ); + } + break; + } + if ( *pWild != 0 ) + pWild++; + if ( *pStr != 0 ) + pStr++; + else + flag = 0; + if ( flag ) + pos--; + } + return ( *pStr == 0 ) && ( *pWild == 0 ); + } + //------------------------------------------------------------------ + rtl::OUString toDateString(const ::com::sun::star::util::Date& rDate) + { + sal_Char s[11]; + sprintf(s,"%04d-%02d-%02d", + (int)rDate.Year, + (int)rDate.Month, + (int)rDate.Day); + s[10] = 0; + return rtl::OUString::createFromAscii(s); + } + + //------------------------------------------------------------------ + rtl::OUString toTimeString(const ::com::sun::star::util::Time& rTime) + { + sal_Char s[9]; + sprintf(s,"%02d:%02d:%02d", + (int)rTime.Hours, + (int)rTime.Minutes, + (int)rTime.Seconds); + s[8] = 0; + return rtl::OUString::createFromAscii(s); + } + + //------------------------------------------------------------------ + rtl::OUString toDateTimeString(const ::com::sun::star::util::DateTime& rDateTime) + { + sal_Char s[21]; + sprintf(s,"%04d-%02d-%02d %02d:%02d:%02d", + (int)rDateTime.Year, + (int)rDateTime.Month, + (int)rDateTime.Day, + (int)rDateTime.Hours, + (int)rDateTime.Minutes, + (int)rDateTime.Seconds); + s[20] = 0; + return rtl::OUString::createFromAscii(s); + } + + + //-------------------------------------------------------------------------------------------------- + rtl::OUString toString(const Any& rValue) + { + rtl::OUString aRes; + TypeClass aDestinationClass = rValue.getValueType().getTypeClass(); + + switch (aDestinationClass) + { + case TypeClass_CHAR: + aRes = ::rtl::OUString::valueOf(*(sal_Unicode*)rValue.getValue()); + break; + case TypeClass_FLOAT: + aRes = ::rtl::OUString::valueOf(*(float*)rValue.getValue()); + break; + case TypeClass_DOUBLE: + aRes = ::rtl::OUString::valueOf(*(double*)rValue.getValue()); + break; + case TypeClass_BOOLEAN: + aRes = ::rtl::OUString::valueOf(*(sal_Bool*)rValue.getValue()); + break; + case TypeClass_BYTE: + case TypeClass_SHORT: + case TypeClass_LONG: + aRes = ::rtl::OUString::valueOf(*(sal_Int32*)rValue.getValue()); + break; + case TypeClass_STRING: + rValue >>= aRes; + break; + case TypeClass_STRUCT: + if (rValue.getValueType() == ::getCppuType((const ::com::sun::star::util::Date*)0)) + { + ::com::sun::star::util::Date aDate; + rValue >>= aDate; + aRes = toDateString(aDate); + } + else if (rValue.getValueType() == ::getCppuType((const ::com::sun::star::util::DateTime*)0)) + { + ::com::sun::star::util::DateTime aDT; + rValue >>= aDT; + aRes = toDateTimeString(aDT); + } + else if (rValue.getValueType() == ::getCppuType((const ::com::sun::star::util::Time*)0)) + { + ::com::sun::star::util::Time aTime; + rValue >>= aTime; + aRes = toTimeString(aTime); + } + + break; + default: + ; +// throw( CannotConvertException( ::rtl::OUString::createFromAscii("TYPE is not supported!"), Reference< XInterface > (), +// aDestinationClass, FailReason::TYPE_NOT_SUPPORTED, 0 ) ); + + } + return aRes; + } + // ------------------------------------------------------------------------- + OSQLColumns::const_iterator find( OSQLColumns::const_iterator __first, + OSQLColumns::const_iterator __last, + const ::rtl::OUString& _rVal, + const ::utl::UStringMixEqual& _rCase) + { + while (__first != __last && !_rCase(getString((*__first)->getFastPropertyValue(PROPERTY_ID_NAME)),_rVal)) + ++__first; + return __first; + } + // ------------------------------------------------------------------------- + OSQLColumns::const_iterator findRealName( OSQLColumns::const_iterator __first, + OSQLColumns::const_iterator __last, + const ::rtl::OUString& _rVal, + const ::utl::UStringMixEqual& _rCase) + { + while (__first != __last && !_rCase(getString((*__first)->getFastPropertyValue(PROPERTY_ID_REALNAME)),_rVal)) + ++__first; + return __first; + } + // ------------------------------------------------------------------------- + OSQLColumns::const_iterator find( OSQLColumns::const_iterator __first, + OSQLColumns::const_iterator __last, + const ::rtl::OUString& _rProp, + const ::rtl::OUString& _rVal, + const ::utl::UStringMixEqual& _rCase) + { + while (__first != __last && !_rCase(getString(Reference<XPropertySet>((*__first),UNO_QUERY)->getPropertyValue(_rProp)),_rVal)) + ++__first; + return __first; + } +} diff --git a/connectivity/source/commontools/DateConversion.cxx b/connectivity/source/commontools/DateConversion.cxx new file mode 100644 index 000000000000..4bfd7f5f3213 --- /dev/null +++ b/connectivity/source/commontools/DateConversion.cxx @@ -0,0 +1,370 @@ +/************************************************************************* + * + * $RCSfile: DateConversion.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DATECONVERSION_HXX_ +#include "DateConversion.hxx" +#endif + +using namespace connectivity; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::uno; + + +const double fMilliSecondsPerDay = 86400000.0; +const Date STANDARD_DB_DATE(1,1,1900); +static sal_Int32 aDaysInMonth[12] = { 31, 28, 31, 30, 31, 30, + 31, 31, 30, 31, 30, 31 }; + +#define MAX_DAYS 3636532 +//------------------------------------------------------------------------------ +sal_Int32 DateConversion::toINT32(const Date& rVal) +{ + return ((sal_Int32)(rVal.Day%100)) + + (((sal_Int32)(rVal.Month%100))*100) + + (((sal_Int32) rVal.Year%10000)*10000); +} + +//------------------------------------------------------------------------------ +sal_Int32 DateConversion::toINT32(const Time& rVal) +{ + // Zeit normalisieren + sal_Int32 nSeconds = rVal.Seconds + rVal.HundredthSeconds / 100; + sal_Int32 nHundredthSeconds = rVal.HundredthSeconds % 100; + sal_Int32 nMinutes = rVal.Minutes + nSeconds / 60; + nSeconds = nSeconds % 60; + sal_Int32 nHours = rVal.Hours + nMinutes / 60; + nMinutes = nMinutes % 60; + + // Zeit zusammenbauen + return (sal_Int32)(nHundredthSeconds + (nSeconds*100) + (nMinutes*10000) + (nHours*1000000)); +} +//------------------------------------------------------------------------------ +sal_Int64 DateConversion::toINT64(const DateTime& rVal) +{ + // Zeit normalisieren + sal_Int32 nSeconds = rVal.Seconds + rVal.HundredthSeconds / 100; + sal_Int32 nHundredthSeconds = rVal.HundredthSeconds % 100; + sal_Int32 nMinutes = rVal.Minutes + nSeconds / 60; + nSeconds = nSeconds % 60; + sal_Int32 nHours = rVal.Hours + nMinutes / 60; + nMinutes = nMinutes % 60; + + // Zeit zusammenbauen + sal_Int32 nTime = (sal_Int32)(nHundredthSeconds + (nSeconds*100) + (nMinutes*10000) + (nHours*1000000)); + sal_Int32 nDate = ((sal_Int32)(rVal.Day%100)) + (((sal_Int32)(rVal.Month%100))*100) + (((sal_Int32) rVal.Year%10000)*10000); + sal_Int64 nRet; + sal_setInt64(&nRet,nDate,nTime); + return nRet; +} +//------------------------------------------------------------------------------ +sal_Int32 DateConversion::getMsFromTime(const Time& rVal) +{ + sal_Int16 nSign = (toINT32(rVal) >= 0) ? +1 : -1; + sal_Int32 nHour = rVal.Hours; + sal_Int32 nMin = rVal.Minutes; + sal_Int32 nSec = rVal.Seconds; + sal_Int32 n100Sec = rVal.HundredthSeconds; + + return (((nHour*3600000)+(nMin*60000)+(nSec*1000)+(n100Sec*10))*nSign); +} +//------------------------------------------------------------------------------ +double DateConversion::toDouble(const Date& rVal) +{ + return (double)toINT32(rVal); +} +//------------------------------------------------------------------------------ +double DateConversion::toDouble(const Time& rVal) +{ + return (double)getMsFromTime(rVal) / fMilliSecondsPerDay; +} +//------------------------------------------------------------------------------ +double DateConversion::toDouble(const DateTime& rVal) +{ + sal_Int64 nTime = toINT64(rVal); + sal_Int16 nSign = (nTime >= 0) ? +1 : -1; + sal_Int32 nHour = rVal.Hours; + sal_Int32 nMin = rVal.Minutes; + sal_Int32 nSec = rVal.Seconds; + sal_Int32 n100Sec = rVal.HundredthSeconds; + + double nVal = (((nHour*3600000)+(nMin*60000)+(nSec*1000)+(n100Sec*10))*nSign); + + return ((double)nTime) + (nVal * (1/fMilliSecondsPerDay)); +} +// ------------------------------------------------------------------------- +inline sal_Bool ImpIsLeapYear( sal_uInt16 nYear ) +{ + return (((nYear % 4) == 0) && ((nYear % 100) != 0) || ((nYear % 400) == 0)); +} +// ------------------------------------------------------------------------- +inline sal_uInt16 DaysInMonth( sal_uInt16 nMonth, sal_uInt16 nYear ) +{ + if ( nMonth != 2 ) + return aDaysInMonth[nMonth-1]; + else + { + if ( ((nYear % 4) == 0) && ((nYear % 100) != 0) || + ((nYear % 400) == 0) ) + return aDaysInMonth[nMonth-1] + 1; + else + return aDaysInMonth[nMonth-1]; + } +} +//------------------------------------------------------------------------------ +static void DaysToDate( sal_Int32 nDays, + sal_uInt16& rDay, sal_uInt16& rMonth, sal_uInt16& rYear ) +{ + sal_Int32 nTempDays; + sal_Int32 i = 0; + sal_Bool bCalc; + + do + { + nTempDays = nDays; + rYear = ((nTempDays / 365) - i); + nTempDays -= (rYear-1) * 365; + nTempDays -= ((rYear-1) / 4) - ((rYear-1) / 100) + ((rYear-1) / 400); + bCalc = sal_False; + if ( nTempDays < 1 ) + { + i++; + bCalc = sal_True; + } + else + { + if ( nTempDays > 365 ) + { + if ( (nTempDays != 366) || !ImpIsLeapYear( rYear ) ) + { + i--; + bCalc = sal_True; + } + } + } + } + while ( bCalc ); + + rMonth = 1; + while ( nTempDays > DaysInMonth( rMonth, rYear ) ) + { + nTempDays -= DaysInMonth( rMonth, rYear ); + rMonth++; + } + rDay = nTempDays; +} +// ------------------------------------------------------------------------- +static sal_Int32 DateToDays( sal_uInt16 nDay, sal_uInt16 nMonth, sal_uInt16 nYear ) +{ + sal_Int32 nDays; + + nDays = ((sal_Int32)nYear-1) * 365; + nDays += ((nYear-1) / 4) - ((nYear-1) / 100) + ((nYear-1) / 400); + for( sal_uInt16 i = 1; i < nMonth; i++ ) + nDays += DaysInMonth(i,nYear); + nDays += nDay; + return nDays; +} +// ------------------------------------------------------------------------- +static void addDays( sal_Int32 nDays ,Date& _rDate) +{ + sal_Int32 nTempDays = DateToDays( _rDate.Day, _rDate.Month, _rDate.Year ); + + nTempDays += nDays; + if ( nTempDays > MAX_DAYS ) + { + _rDate.Day = 31; + _rDate.Month = 12; + _rDate.Year = 9999; + } + else if ( nTempDays <= 0 ) + { + _rDate.Day = 1; + _rDate.Month = 1; + _rDate.Year = 00; + } + else + DaysToDate( nTempDays, _rDate.Day, _rDate.Month, _rDate.Year ); +} + +// ----------------------------------------------------------------------- + +static void subDays( sal_Int32 nDays,Date& _rDate ) +{ + sal_Int32 nTempDays = DateToDays( _rDate.Day, _rDate.Month, _rDate.Year ); + + nTempDays -= nDays; + if ( nTempDays > MAX_DAYS ) + { + _rDate.Day = 31; + _rDate.Month = 12; + _rDate.Year = 9999; + } + else if ( nTempDays <= 0 ) + { + _rDate.Day = 1; + _rDate.Month = 1; + _rDate.Year = 00; + } + else + DaysToDate( nTempDays, _rDate.Day, _rDate.Month, _rDate.Year ); +} + +// ------------------------------------------------------------------------- +Date DateConversion::toDate(double dVal,const Date& _rSTANDARD_DB_DATE) +{ + Date aRet = _rSTANDARD_DB_DATE; + // DaysToDate((sal_Int32)dVal,aRet.Day,aRet.Month,aRet.Year); + + if (dVal >= 0) + addDays((sal_Int32)dVal,aRet); + else + subDays((sal_uInt32)(-dVal),aRet); + // x -= (sal_uInt32)(-nDays); + + return aRet; +} +//------------------------------------------------------------------------------ +void MakeTimeFromMS( sal_Int32 nMS ) +{ + sal_uInt16 nSign; + if ( nMS < 0 ) + { + nMS *= -1; + nSign = -1; + } + else + nSign = 1; + + // Zeit normalisieren + sal_uInt16 n100Sec = nMS/10; + sal_uInt16 nSec = n100Sec / 100; + n100Sec = n100Sec % 100; + sal_uInt16 nMin = nSec / 60; + nSec = nSec % 60; + sal_uInt16 nHour = nMin / 60; + nMin = nMin % 60; + + // Zeit zusammenbauen + sal_Int32 nTime = (sal_Int32)(n100Sec + (nSec*100) + (nMin*10000) + (nHour*1000000)) * nSign; + + +} +// ------------------------------------------------------------------------- +Time DateConversion::toTime(double dVal) +{ + sal_Int32 nDays = (sal_Int32)dVal; + sal_Int32 nMS = sal_Int32((dVal - (double)nDays) * fMilliSecondsPerDay + 0.5); + + sal_uInt16 nSign; + if ( nMS < 0 ) + { + nMS *= -1; + nSign = -1; + } + else + nSign = 1; + + Time xRet; + // Zeit normalisieren + xRet.HundredthSeconds = nMS/10; + xRet.Seconds = xRet.HundredthSeconds / 100; + xRet.HundredthSeconds = xRet.HundredthSeconds % 100; + xRet.Minutes = xRet.Seconds / 60; + xRet.Seconds = xRet.Seconds % 60; + xRet.Hours = xRet.Minutes / 60; + xRet.Minutes = xRet.Minutes % 60; + + // Zeit zusammenbauen + sal_Int32 nTime = (sal_Int32)(xRet.HundredthSeconds + (xRet.Seconds*100) + (xRet.Minutes*10000) + (xRet.Hours*1000000)) * nSign; + + if(nTime < 0) + { + xRet.HundredthSeconds = 99; + xRet.Minutes = 59; + xRet.Seconds = 59; + xRet.Hours = 23; + } + return xRet; + +} +//------------------------------------------------------------------------------ +DateTime DateConversion::toDateTime(double dVal,const Date& _rSTANDARD_DB_DATE) +{ + Date aDate = DateConversion::toDate(dVal,_rSTANDARD_DB_DATE); + Time aTime = DateConversion::toTime(dVal); + + + DateTime xRet; + + xRet.Day = aDate.Day; + xRet.Month = aDate.Month; + xRet.Year = aDate.Year; + + xRet.HundredthSeconds = aTime.HundredthSeconds; + xRet.Minutes = aTime.Minutes; + xRet.Seconds = aTime.Seconds; + xRet.Hours = aTime.Hours; + + + return xRet; +} +//------------------------------------------------------------------------------ + diff --git a/connectivity/source/commontools/makefile.mk b/connectivity/source/commontools/makefile.mk new file mode 100644 index 000000000000..321d80dd90e8 --- /dev/null +++ b/connectivity/source/commontools/makefile.mk @@ -0,0 +1,90 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=connectivity +TARGET=commontools + +ENABLE_EXCEPTIONS=TRUE +# --- Settings ----------------------------------------------------- +.IF "$(DBGUTIL_OJ)"!="" +ENVCFLAGS+=/FR$(SLO)$/ +.ENDIF + +.INCLUDE : settings.mk +# --- Files -------------------------------------------------------- + +SLOFILES=\ + $(SLO)$/enumhelper.obj \ + $(SLO)$/propertyhelper.obj \ + $(SLO)$/simplepropertycontainer.obj \ + $(SLO)$/CommonTools.obj \ + $(SLO)$/DateConversion.obj \ + + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + diff --git a/connectivity/source/drivers/adabas/BCatalog.cxx b/connectivity/source/drivers/adabas/BCatalog.cxx new file mode 100644 index 000000000000..b9c73fdc4aa3 --- /dev/null +++ b/connectivity/source/drivers/adabas/BCatalog.cxx @@ -0,0 +1,195 @@ +/************************************************************************* + * + * $RCSfile: BCatalog.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_CATALOG_HXX_ +#include "adabas/BCatalog.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_BCONNECTION_HXX_ +#include "adabas/BConnection.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_GROUPS_HXX_ +#include "adabas/BGroups.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_USERS_HXX_ +#include "adabas/BUsers.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_TABLES_HXX_ +#include "adabas/BTables.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif + + +// ------------------------------------------------------------------------- +using namespace connectivity::adabas; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +// ------------------------------------------------------------------------- +OAdabasCatalog::OAdabasCatalog(SQLHANDLE _aConnectionHdl, OAdabasConnection* _pCon) : connectivity::sdbcx::OCatalog(_pCon) + ,m_pConnection(_pCon) + ,m_aConnectionHdl(_aConnectionHdl) + ,m_xMetaData(m_pConnection->getMetaData( )) +{ + osl_incrementInterlockedCount( &m_refCount ); + refreshTables(); + refreshViews(); + refreshGroups(); + refreshUsers(); + osl_decrementInterlockedCount( &m_refCount ); +} +// ------------------------------------------------------------------------- +void OAdabasCatalog::refreshTables() +{ + ::std::vector< ::rtl::OUString> aVector; + Sequence< ::rtl::OUString > aTypes(1); + aTypes[0] = ::rtl::OUString::createFromAscii("%"); + Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), + ::rtl::OUString::createFromAscii("%"),::rtl::OUString::createFromAscii("%"),aTypes); + + if(xResult.is()) + { + Reference< XRow > xRow(xResult,UNO_QUERY); + ::rtl::OUString aName,aDot = ::rtl::OUString::createFromAscii("."),aView = ::rtl::OUString::createFromAscii("VIEW"); + while(xResult->next()) + { + if(xRow->getString(4) != aView) + { + aName = xRow->getString(2); + aName += aDot; + aName += xRow->getString(3); + aVector.push_back(aName); + } + } + } + if(m_pTables) + delete m_pTables; + m_pTables = new OTables(m_xMetaData,*this,m_aMutex,aVector); +} +// ------------------------------------------------------------------------- +void OAdabasCatalog::refreshViews() +{ + ::std::vector< ::rtl::OUString> aVector; + Sequence< ::rtl::OUString > aTypes(1); + aTypes[0] = ::rtl::OUString::createFromAscii("VIEW"); + Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), + ::rtl::OUString::createFromAscii("%"),::rtl::OUString::createFromAscii("%"),aTypes); + + if(xResult.is()) + { + Reference< XRow > xRow(xResult,UNO_QUERY); + ::rtl::OUString aName,aDot = ::rtl::OUString::createFromAscii("."); + while(xResult->next()) + { + aName = xRow->getString(2); + aName += aDot; + aName += xRow->getString(3); + aVector.push_back(aName); + } + } + if(m_pViews) + delete m_pViews; + m_pViews = new OTables(m_xMetaData,*this,m_aMutex,aVector); +} +// ------------------------------------------------------------------------- +void OAdabasCatalog::refreshGroups() +{ + ::std::vector< ::rtl::OUString> aVector; + Reference< XStatement > xStmt = m_pConnection->createStatement( ); + Reference< XResultSet > xResult = xStmt->executeQuery( + ::rtl::OUString::createFromAscii("SELECT DISTINCT GROUPNAME FROM DOMAIN.USERS WHERE GROUPNAME IS NOT NULL AND GROUPNAME <> ' '")); + if(xResult.is()) + { + Reference< XRow > xRow(xResult,UNO_QUERY); + while(xResult->next()) + aVector.push_back(xRow->getString(1)); + } + if(m_pGroups) + delete m_pGroups; + m_pGroups = new OGroups(*this,m_aMutex,aVector,m_pConnection,this); +} +// ------------------------------------------------------------------------- +void OAdabasCatalog::refreshUsers() +{ + ::std::vector< ::rtl::OUString> aVector; + Reference< XStatement > xStmt = m_pConnection->createStatement( ); + Reference< XResultSet > xResult = xStmt->executeQuery( + ::rtl::OUString::createFromAscii("SELECT DISTINCT USERNAME FROM DOMAIN.USERS WHERE USERNAME IS NOT NULL AND USERNAME <> ' ' AND USERNAME <> 'CONTROL'")); + if(xResult.is()) + { + Reference< XRow > xRow(xResult,UNO_QUERY); + while(xResult->next()) + aVector.push_back(xRow->getString(1)); + } + if(m_pUsers) + delete m_pUsers; + m_pUsers = new OUsers(*this,m_aMutex,aVector,m_pConnection,this); +} +// ------------------------------------------------------------------------- + + diff --git a/connectivity/source/drivers/adabas/BColumns.cxx b/connectivity/source/drivers/adabas/BColumns.cxx new file mode 100644 index 000000000000..cfebf615d6f2 --- /dev/null +++ b/connectivity/source/drivers/adabas/BColumns.cxx @@ -0,0 +1,241 @@ +/************************************************************************* + * + * $RCSfile: BColumns.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_COLUMNS_HXX_ +#include "adabas/BColumns.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ +#include "connectivity/sdbcx/VColumn.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif +#ifndef _CONNECTIVITY_ADABAS_TABLE_HXX_ +#include "adabas/BTable.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +using namespace connectivity::adabas; +using namespace connectivity::sdbcx; +using namespace connectivity; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +typedef connectivity::sdbcx::OCollection OCollection_TYPE; + +Reference< XNamed > OColumns::createObject(const ::rtl::OUString& _rName) +{ + + Reference< XResultSet > xResult = m_pTable->getConnection()->getMetaData()->getColumns(Any(), + m_pTable->getSchema(),m_pTable->getName(),_rName); + + Reference< XNamed > xRet = NULL; + if(xResult.is()) + { + Reference< XRow > xRow(xResult,UNO_QUERY); + while(xResult->next()) + { + if(xRow->getString(4) == _rName) + { + OColumn* pRet = new OColumn(_rName, + xRow->getString(6), + xRow->getString(13), + xRow->getInt(11), + xRow->getInt(7), + xRow->getInt(9), + xRow->getInt(5), + sal_False,sal_False,sal_False,sal_True); + xRet = pRet; + break; + } + } + } + + return xRet; +} + +// ------------------------------------------------------------------------- +void OColumns::impl_refresh() throw(RuntimeException) +{ + m_pTable->refreshColumns(); +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > OColumns::createEmptyObject() +{ + OColumn* pNew = new OColumn(sal_True); + Reference< XPropertySet > xRet = pNew; + return xRet; +} +// ------------------------------------------------------------------------- +// XAppend +void SAL_CALL OColumns::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + if(!m_pTable->isNew()) + { + ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("ALTER TABLE "); + ::rtl::OUString aQuote = m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString( ); + ::rtl::OUString aDot = ::rtl::OUString::createFromAscii("."); + + aSql = aSql + aQuote + m_pTable->getSchema() + aQuote + aDot + aQuote + m_pTable->getName() + aQuote; + aSql = aSql + ::rtl::OUString::createFromAscii(" ADD "); + aSql = aSql + aQuote + getString(descriptor->getPropertyValue(PROPERTY_NAME)) + aQuote; + aSql = aSql + ::rtl::OUString::createFromAscii(" "); + + Any aTypeName = descriptor->getPropertyValue(PROPERTY_TYPENAME); + if(aTypeName.hasValue() && getString(aTypeName).getLength()) + aSql = aSql + getString(aTypeName); + else + aSql = aSql + getTypeString(descriptor) + ::rtl::OUString::createFromAscii(" "); + + // aSql = aSql + getString(descriptor->getPropertyValue(PROPERTY_TYPENAME)); + + switch(getINT32(descriptor->getPropertyValue(PROPERTY_TYPE))) + { + case DataType::CHAR: + case DataType::VARCHAR: + aSql = aSql + ::rtl::OUString::createFromAscii("(") + + ::rtl::OUString::valueOf(getINT32(descriptor->getPropertyValue(PROPERTY_PRECISION))) + + ::rtl::OUString::createFromAscii(")"); + break; + + case DataType::DECIMAL: + case DataType::NUMERIC: + aSql = aSql + ::rtl::OUString::createFromAscii("(") + + ::rtl::OUString::valueOf(getINT32(descriptor->getPropertyValue(PROPERTY_PRECISION))) + + ::rtl::OUString::createFromAscii(",") + + ::rtl::OUString::valueOf(getINT32(descriptor->getPropertyValue(PROPERTY_SCALE))) + + ::rtl::OUString::createFromAscii(")"); + break; + } + ::rtl::OUString aDefault = getString(descriptor->getPropertyValue(PROPERTY_DEFAULTVALUE)); + if(getINT32(descriptor->getPropertyValue(PROPERTY_ISNULLABLE)) == ColumnValue::NO_NULLS) + { + aSql = aSql + ::rtl::OUString::createFromAscii(" NOT NULL"); + if(aDefault.getLength()) + aSql = aSql + ::rtl::OUString::createFromAscii(" WITH DEFAULT"); + } + else if(aDefault.getLength()) + aSql = aSql + ::rtl::OUString::createFromAscii(" DEFAULT ") + aDefault; + + Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); + xStmt->execute(aSql); + } + OCollection_TYPE::appendByDescriptor(descriptor); +} +// ------------------------------------------------------------------------- +// XDrop +void SAL_CALL OColumns::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + if(!m_pTable->isNew()) + { + ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("ALTER TABLE "); + ::rtl::OUString aQuote = m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString( ); + ::rtl::OUString aDot = ::rtl::OUString::createFromAscii("."); + + aSql = aSql + aQuote + m_pTable->getSchema() + aQuote + aDot + aQuote + m_pTable->getName() + aQuote; + aSql = aSql + ::rtl::OUString::createFromAscii(" DROP "); + aSql = aSql + aQuote + elementName + aQuote; + + Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); + xStmt->execute(aSql); + } + + OCollection_TYPE::dropByName(elementName); +} +// ------------------------------------------------------------------------- +void SAL_CALL OColumns::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + if (index < 0 || index >= getCount()) + throw IndexOutOfBoundsException(); + + if(!m_pTable->isNew()) + { + ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("ALTER TABLE "); + ::rtl::OUString aQuote = m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString( ); + ::rtl::OUString aDot = ::rtl::OUString::createFromAscii("."); + + aSql = aSql + aQuote + m_pTable->getSchema() + aQuote + aDot + aQuote + m_pTable->getName() + aQuote; + aSql = aSql + ::rtl::OUString::createFromAscii(" DROP "); + aSql = aSql + aQuote + m_aElements[index]->first + aQuote; + + Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); + xStmt->execute(aSql); + } + OCollection_TYPE::dropByIndex(index); +} + + diff --git a/connectivity/source/drivers/adabas/BConnection.cxx b/connectivity/source/drivers/adabas/BConnection.cxx new file mode 100644 index 000000000000..0b7dbea58955 --- /dev/null +++ b/connectivity/source/drivers/adabas/BConnection.cxx @@ -0,0 +1,233 @@ +/************************************************************************* + * + * $RCSfile: BConnection.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADABAS_BCONNECTION_HXX_ +#include "adabas/BConnection.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_BDRIVER_HXX_ +#include "adabas/BDriver.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_CATALOG_HXX_ +#include "adabas/BCatalog.hxx" +#endif +#ifndef _CONNECTIVITY_ODBC_OFUNCTIONS_HXX_ +#include "odbc/OFunctions.hxx" +#endif +#ifndef _CONNECTIVITY_OTOOLS_HXX_ +#include "odbc/OTools.hxx" +#endif +#ifndef _CONNECTIVITY_ODBC_ODATABASEMETADATA_HXX_ +#include "adabas/BDatabaseMetaData.hxx" +#endif + +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif + +using namespace connectivity::adabas; +using namespace connectivity; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + + +//------------------------------------------------------------------------------ +namespace starlang = ::com::sun::star::lang; +// -------------------------------------------------------------------------------- +OAdabasConnection::OAdabasConnection(const SQLHANDLE _pDriverHandle, connectivity::odbc::ODBCDriver* _pDriver) + : OConnection_BASE2(_pDriverHandle,_pDriver) +{ +} +//----------------------------------------------------------------------------- +SQLRETURN OAdabasConnection::Construct( const ::rtl::OUString& url,const Sequence< PropertyValue >& info) throw(SQLException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + osl_incrementInterlockedCount( &m_refCount ); + + m_aConnectionHandle = SQL_NULL_HANDLE; + + // Connection allozieren + N3SQLAllocHandle(SQL_HANDLE_DBC,m_pDriverHandleCopy,&m_aConnectionHandle); + if(m_aConnectionHandle == SQL_NULL_HANDLE) + throw SQLException(); + + const PropertyValue *pBegin = info.getConstArray(); + const PropertyValue *pEnd = pBegin + info.getLength(); + ::rtl::OUString aAdminUid,aAdminPwd; + + sal_Int32 nLen = url.indexOf(':'); + nLen = url.indexOf(':',nLen+1); + ::rtl::OUString aDSN(url.copy(nLen+1)),aUID,aPWD; + sal_Int32 nTimeout = 20; + for(;pBegin != pEnd;++pBegin) + { + if(!pBegin->Name.compareToAscii("CTRLUSER")) + pBegin->Value >>= aAdminUid; + else if(!pBegin->Name.compareToAscii("CTRLPWD")) + pBegin->Value >>= aAdminPwd; + else if(!pBegin->Name.compareToAscii("Timeout")) + pBegin->Value >>= nTimeout; + else if(!pBegin->Name.compareToAscii("user")) + pBegin->Value >>= aUID; + else if(!pBegin->Name.compareToAscii("password")) + pBegin->Value >>= aPWD; + } + + SQLRETURN nSQLRETURN = OpenConnection(aDSN,nTimeout, aUID,aPWD); + + osl_decrementInterlockedCount( &m_refCount ); + return nSQLRETURN; +} +//----------------------------------------------------------------------------- +SQLRETURN OAdabasConnection::OpenConnection(const ::rtl::OUString& aConnectStr,sal_Int32 nTimeOut, const ::rtl::OUString& _uid,const ::rtl::OUString& _pwd) +{ + if (m_aConnectionHandle == SQL_NULL_HANDLE) + return -1; + + SQLRETURN nSQLRETURN = 0; + SDB_ODBC_CHAR szDSN[4096]; + SDB_ODBC_CHAR szUID[20]; + SDB_ODBC_CHAR szPWD[20]; + + memset(szDSN,'\0',4096); + memset(szUID,'\0',20); + memset(szPWD,'\0',20); + + ::rtl::OString aConStr(::rtl::OUStringToOString(aConnectStr,osl_getThreadTextEncoding())); + ::rtl::OString aUID(::rtl::OUStringToOString(_uid,osl_getThreadTextEncoding())); + ::rtl::OString aPWD(::rtl::OUStringToOString(_pwd,osl_getThreadTextEncoding())); + memcpy(szDSN, (SDB_ODBC_CHAR*) aConStr.getStr(), ::std::min<sal_Int32>((sal_Int32)2048,aConStr.getLength())); + memcpy(szUID, (SDB_ODBC_CHAR*) aUID.getStr(), ::std::min<sal_Int32>((sal_Int32)20,aUID.getLength())); + memcpy(szPWD, (SDB_ODBC_CHAR*) aPWD.getStr(), ::std::min<sal_Int32>((sal_Int32)20,aPWD.getLength())); + + + + N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_LOGIN_TIMEOUT,(SQLPOINTER)nTimeOut,SQL_IS_INTEGER); + // Verbindung aufbauen + + nSQLRETURN = N3SQLConnect(m_aConnectionHandle, + szDSN, + (SQLSMALLINT) ::std::min<sal_Int32>((sal_Int32)2048,aConStr.getLength()), + szUID, + (SQLSMALLINT) ::std::min<sal_Int32>((sal_Int32)20,aUID.getLength()), + szPWD, + (SQLSMALLINT) ::std::min<sal_Int32>((sal_Int32)20,aPWD.getLength())); + if (nSQLRETURN == SQL_ERROR || nSQLRETURN == SQL_NO_DATA) + return nSQLRETURN; + +#ifndef MAC + // autocoomit ist immer default + + N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_AUTOCOMMIT,(SQLPOINTER)SQL_AUTOCOMMIT_ON,SQL_IS_INTEGER); +#endif + buildTypeInfo(); + + return nSQLRETURN; +} + +//------------------------------------------------------------------------------ +void OAdabasConnection::disposing() +{ + ::osl::MutexGuard aGuard(m_aMutex); + + Reference< XComponent > xComp2(m_xCatalog.get(), UNO_QUERY); + if(xComp2.is()) + xComp2->dispose(); + + m_xCatalog = Reference< XTablesSupplier >(); + + OConnection_BASE2::disposing(); +} +//------------------------------------------------------------------------------ +::com::sun::star::uno::Reference< XTablesSupplier > OAdabasConnection::createCatalog() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + Reference< XTablesSupplier > xTab = m_xCatalog; + if(!m_xCatalog.get().is()) + { + OAdabasCatalog *pCat = new OAdabasCatalog(m_aConnectionHandle,this); + xTab = pCat; + m_xCatalog = xTab; + } + return xTab; +} +// -------------------------------------------------------------------------------- +Reference< XDatabaseMetaData > SAL_CALL OAdabasConnection::getMetaData( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE2::rBHelper.bDisposed) + throw DisposedException(); + + if(!m_xMetaData.is()) + m_xMetaData = new OAdabasDatabaseMetaData(m_aConnectionHandle,this); + + return m_xMetaData; +} +//------------------------------------------------------------------------------ +sal_Bool OAdabasConnection::isStarted() +{ + return sal_True; + +} + diff --git a/connectivity/source/drivers/adabas/BDatabaseMetaData.cxx b/connectivity/source/drivers/adabas/BDatabaseMetaData.cxx new file mode 100644 index 000000000000..00edcb7e9971 --- /dev/null +++ b/connectivity/source/drivers/adabas/BDatabaseMetaData.cxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * $RCSfile: BDatabaseMetaData.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_BDATABASEMETADATA_HXX_ +#include "adabas/BDatabaseMetaData.hxx" +#endif + +using namespace connectivity::adabas; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + +::rtl::OUString SAL_CALL OAdabasDatabaseMetaData::getURL( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aRet = ::rtl::OUString::createFromAscii("sdbc:adabas:") + OAdabasDatabaseMetaData_BASE::getURL(); + return aRet; +} + + diff --git a/connectivity/source/drivers/adabas/BDriver.cxx b/connectivity/source/drivers/adabas/BDriver.cxx new file mode 100644 index 000000000000..3bbf1c42bd83 --- /dev/null +++ b/connectivity/source/drivers/adabas/BDriver.cxx @@ -0,0 +1,252 @@ +/************************************************************************* + * + * $RCSfile: BDriver.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_BDRIVER_HXX_ +#include "adabas/BDriver.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_BCONNECTION_HXX_ +#include "adabas/BConnection.hxx" +#endif +#ifndef _CONNECTIVITY_ODBC_OFUNCTIONS_HXX_ +#include "odbc/OFunctions.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _CONNECTIVITY_OTOOLS_HXX_ +#include "odbc/OTools.hxx" +#endif + +using namespace connectivity::adabas; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +// -------------------------------------------------------------------------------- +ODriver::ODriver() +{ +} +//------------------------------------------------------------------------------ +void ODriver::disposing() +{ + ::osl::MutexGuard aGuard(m_aMutex); + ODriver_BASE::disposing(); +} + +// static ServiceInfo +//------------------------------------------------------------------------------ +rtl::OUString ODriver::getImplementationName_Static( ) throw(RuntimeException) +{ + return rtl::OUString::createFromAscii("com.sun.star.sdbc.BDriver"); +} +//------------------------------------------------------------------------------ +Sequence< ::rtl::OUString > ODriver::getSupportedServiceNames_Static( ) throw (RuntimeException) +{ + Sequence< ::rtl::OUString > aSNS( 2 ); + aSNS[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.Driver"); + aSNS[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.Driver"); + return aSNS; +} +//------------------------------------------------------------------ +::rtl::OUString SAL_CALL ODriver::getImplementationName( ) throw(RuntimeException) +{ + return getImplementationName_Static(); +} + +//------------------------------------------------------------------ +sal_Bool SAL_CALL ODriver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) +{ + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + const ::rtl::OUString* pSupported = aSupported.getConstArray(); + for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) + if (pSupported->equals(_rServiceName)) + return sal_True; + + return sal_False; +} +//------------------------------------------------------------------ +Sequence< ::rtl::OUString > SAL_CALL ODriver::getSupportedServiceNames( ) throw(RuntimeException) +{ + return getSupportedServiceNames_Static(); +} +//------------------------------------------------------------------ +Any SAL_CALL ODriver::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = ::cppu::queryInterface(rType, static_cast<XDataDefinitionSupplier*>(this)); + if(aRet.hasValue()) + return aRet; + return ODriver_BASE::queryInterface(rType); +} +//------------------------------------------------------------------ +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL connectivity::adabas::ODriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ) throw( ::com::sun::star::uno::Exception ) +{ + return *(new ODriver()); +} +// -------------------------------------------------------------------------------- +Reference< XConnection > SAL_CALL ODriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) +{ + if(!m_pDriverHandle) + { + ::rtl::OUString aPath; + if(!EnvironmentHandle(aPath)) + throw SQLException(aPath,*this,::rtl::OUString(),1000,Any()); + } + OAdabasConnection* pCon = new OAdabasConnection(m_pDriverHandle,this); + SQLRETURN nSQLRETURN = pCon->Construct(url,info); + + if (nSQLRETURN == SQL_ERROR || nSQLRETURN == SQL_NO_DATA) + { + connectivity::odbc::OTools::ThrowException(nSQLRETURN,pCon->getConnection(),SQL_HANDLE_DBC,*this); + } + else if(SQL_SUCCESS_WITH_INFO == nSQLRETURN) // this driver does not support odbc3 + { + } + Reference< XConnection > xCon = pCon; + m_xConnections.push_back(WeakReferenceHelper(*pCon)); + + return xCon; +} + +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL ODriver::acceptsURL( const ::rtl::OUString& url ) + throw(SQLException, RuntimeException) +{ + if(!url.compareTo(::rtl::OUString::createFromAscii("sdbc:adabas:"),12)) + { + return sal_True; + } + return sal_False; +} +// -------------------------------------------------------------------------------- +Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const ::rtl::OUString& , const Sequence< PropertyValue >& ) throw(SQLException, RuntimeException) +{ + return Sequence< DriverPropertyInfo >(); +} +// -------------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODriver::getMajorVersion( ) throw(RuntimeException) +{ + return 1; +} +// -------------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODriver::getMinorVersion( ) throw(RuntimeException) +{ + return 0; +} +// -------------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +// ODBC Environment (gemeinsam fuer alle Connections): +SQLHANDLE ODriver::EnvironmentHandle(::rtl::OUString &_rPath) +{ + // Ist (fuer diese Instanz) bereits ein Environment erzeugt worden? + if (!m_pDriverHandle) + { + SQLHANDLE h = SQL_NULL_HANDLE; + // Environment allozieren + + // ODBC-DLL jetzt laden: + if (! connectivity::LoadLibrary_ADABAS(_rPath)) + return SQL_NULL_HANDLE; + + if (N3SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&h) != SQL_SUCCESS) + return SQL_NULL_HANDLE; + + // In globaler Struktur merken ... + m_pDriverHandle = (void *) h; + SQLRETURN nError = N3SQLSetEnvAttr(h, SQL_ATTR_ODBC_VERSION,(SQLPOINTER) SQL_OV_ODBC3, SQL_IS_INTEGER); + //N3SQLSetEnvAttr(h, SQL_ATTR_CONNECTION_POOLING,(SQLPOINTER) SQL_CP_ONE_PER_HENV, SQL_IS_INTEGER); + } + + return m_pDriverHandle; +} +// -------------------------------------------------------------------------------- +// XDataDefinitionSupplier +Reference< XTablesSupplier > SAL_CALL ODriver::getDataDefinitionByConnection( const Reference< ::com::sun::star::sdbc::XConnection >& connection ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODriver_BASE::rBHelper.bDisposed) + throw DisposedException(); + + + OAdabasConnection* pConnection = NULL; + for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i) + { + if ((OAdabasConnection*) Reference< XConnection >::query(i->get().get()).get() == (OAdabasConnection*)connection.get()) + { + pConnection = (OAdabasConnection*)connection.get(); + break; + } + } + + Reference< XTablesSupplier > xTab = NULL; + if(pConnection) + xTab = pConnection->createCatalog(); + return xTab; +} + +// -------------------------------------------------------------------------------- +Reference< XTablesSupplier > SAL_CALL ODriver::getDataDefinitionByURL( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) +{ + return getDataDefinitionByConnection(connect(url,info)); +} + + diff --git a/connectivity/source/drivers/adabas/BGroup.cxx b/connectivity/source/drivers/adabas/BGroup.cxx new file mode 100644 index 000000000000..8423bf7d3384 --- /dev/null +++ b/connectivity/source/drivers/adabas/BGroup.cxx @@ -0,0 +1,131 @@ +/************************************************************************* + * + * $RCSfile: BGroup.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_GROUP_HXX_ +#include "adabas/BGroup.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_USERS_HXX_ +#include "adabas/BUsers.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _CONNECTIVITY_ADABAS_BCONNECTION_HXX_ +#include "adabas/BConnection.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif + +using namespace connectivity::adabas; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + +// ------------------------------------------------------------------------- +OAdabasGroup::OAdabasGroup( OAdabasConnection* _pConnection) : connectivity::sdbcx::OGroup(sal_True) + ,m_pConnection(_pConnection) +{ + construct(); + ::std::vector< ::rtl::OUString> aVector; + m_pUsers = new OUsers(*this,m_aMutex,aVector,m_pConnection,this); +} +// ------------------------------------------------------------------------- +OAdabasGroup::OAdabasGroup( OAdabasConnection* _pConnection, + const ::rtl::OUString& _Name + ) : connectivity::sdbcx::OGroup(_Name,sal_True) + ,m_pConnection(_pConnection) +{ + construct(); + refreshUsers(); +} +// ------------------------------------------------------------------------- +void OAdabasGroup::refreshUsers() +{ + if(!m_pConnection) + return; + + ::std::vector< ::rtl::OUString> aVector; + Reference< XStatement > xStmt = m_pConnection->createStatement( ); + + ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("SELECT DISTINCT USERNAME FROM DOMAIN.USERS WHERE USERNAME IS NOT NULL AND USERNAME <> ' ' AND USERNAME <> 'CONTROL' AND GROUPNAME = '"); + aSql += getName( ); + aSql += ::rtl::OUString::createFromAscii("'"); + + Reference< XResultSet > xResult = xStmt->executeQuery(aSql); + if(xResult.is()) + { + Reference< XRow > xRow(xResult,UNO_QUERY); + while(xResult->next()) + aVector.push_back(xRow->getString(1)); + } + if(m_pUsers) + delete m_pUsers; + m_pUsers = new OUsers(*this,m_aMutex,aVector,m_pConnection,this); +} + + diff --git a/connectivity/source/drivers/adabas/BGroups.cxx b/connectivity/source/drivers/adabas/BGroups.cxx new file mode 100644 index 000000000000..f9a3c6b8adb7 --- /dev/null +++ b/connectivity/source/drivers/adabas/BGroups.cxx @@ -0,0 +1,161 @@ +/************************************************************************* + * + * $RCSfile: BGroups.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_GROUPS_HXX_ +#include "adabas/BGroups.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_GROUP_HXX_ +#include "adabas/BGroup.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_TABLE_HXX_ +#include "adabas/BTable.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_ +#include "sdbcx/IRefreshable.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif + +using namespace connectivity::adabas; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +typedef connectivity::sdbcx::OCollection OCollection_TYPE; +// ------------------------------------------------------------------------- +Reference< XNamed > OGroups::createObject(const ::rtl::OUString& _rName) +{ + Reference< XNamed > xRet = NULL; + OAdabasGroup* pRet = new OAdabasGroup(m_pConnection,_rName); + xRet = pRet; + return xRet; +} +// ------------------------------------------------------------------------- +void OGroups::impl_refresh() throw(RuntimeException) +{ + m_pParent->refreshGroups(); +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > OGroups::createEmptyObject() +{ + OAdabasGroup* pNew = new OAdabasGroup(m_pConnection); + return pNew; +} +// ------------------------------------------------------------------------- +// XAppend +void SAL_CALL OGroups::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + ::rtl::OUString aName = getString(descriptor->getPropertyValue(PROPERTY_NAME)); + ObjectMap::iterator aIter = m_aNameMap.find(aName); + if( aIter != m_aNameMap.end()) + throw ElementExistException(aName,*this); + + + ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("CREATE USERGROUP "); + ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); + + aSql = aSql + aQuote + getString(descriptor->getPropertyValue(PROPERTY_NAME)) + aQuote; + + Reference< XStatement > xStmt = m_pConnection->createStatement( ); + xStmt->execute(aSql); + + OCollection_TYPE::appendByDescriptor(descriptor); +} +// ------------------------------------------------------------------------- +// XDrop +void SAL_CALL OGroups::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + ObjectMap::iterator aIter = m_aNameMap.find(elementName); + if( aIter == m_aNameMap.end()) + throw NoSuchElementException(elementName,*this); + + ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP USERGROUP "); + ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); + + aSql = aSql + aQuote + elementName + aQuote; + + Reference< XStatement > xStmt = m_pConnection->createStatement( ); + xStmt->execute(aSql); + + OCollection_TYPE::dropByName(elementName); +} +// ------------------------------------------------------------------------- +void SAL_CALL OGroups::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + if (index < 0 || index >= getCount()) + throw IndexOutOfBoundsException(); + + dropByName(m_aElements[index]->first); +} + + diff --git a/connectivity/source/drivers/adabas/BIndex.cxx b/connectivity/source/drivers/adabas/BIndex.cxx new file mode 100644 index 000000000000..6d8276f9b791 --- /dev/null +++ b/connectivity/source/drivers/adabas/BIndex.cxx @@ -0,0 +1,139 @@ +/************************************************************************* + * + * $RCSfile: BIndex.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_INDEX_HXX_ +#include "adabas/BIndex.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_INDEXCOLUMNS_HXX_ +#include "adabas/BIndexColumns.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _CONNECTIVITY_ADABAS_TABLE_HXX_ +#include "adabas/BTable.hxx" +#endif + +using namespace connectivity::adabas; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +// ------------------------------------------------------------------------- +OAdabasIndex::OAdabasIndex( OAdabasTable* _pTable) : connectivity::sdbcx::OIndex(sal_True) + , m_pTable(_pTable) +{ + construct(); + ::std::vector< ::rtl::OUString> aVector; + m_pColumns = new OIndexColumns(this,m_aMutex,aVector); +} +// ------------------------------------------------------------------------- +OAdabasIndex::OAdabasIndex( OAdabasTable* _pTable, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _Catalog, + sal_Bool _isUnique, + sal_Bool _isPrimaryKeyIndex, + sal_Bool _isClustered + ) : connectivity::sdbcx::OIndex(_Name, + _Catalog, + _isUnique, + _isPrimaryKeyIndex, + _isClustered,sal_True) + ,m_pTable(_pTable) +{ + construct(); + refreshColumns(); +} +// ------------------------------------------------------------------------- + +void OAdabasIndex::refreshColumns() +{ + if(!m_pTable) + return; + + ::std::vector< ::rtl::OUString> aVector; + Reference< XResultSet > xResult = m_pTable->getConnection()->getMetaData()->getIndexInfo(Any(), + m_pTable->getSchema(),m_pTable->getName(),sal_False,sal_False); + + if(xResult.is()) + { + Reference< XRow > xRow(xResult,UNO_QUERY); + ::rtl::OUString aColName; + while(xResult->next()) + { + if(xRow->getString(9) == m_Name) + { + aColName = xRow->getString(9); + if(!xRow->wasNull()) + aVector.push_back(aColName); + } + } + } + if(m_pColumns) + delete m_pColumns; + m_pColumns = new OIndexColumns(this,m_aMutex,aVector); +} + diff --git a/connectivity/source/drivers/adabas/BIndexColumns.cxx b/connectivity/source/drivers/adabas/BIndexColumns.cxx new file mode 100644 index 000000000000..8f7582a621d2 --- /dev/null +++ b/connectivity/source/drivers/adabas/BIndexColumns.cxx @@ -0,0 +1,146 @@ +/************************************************************************* + * + * $RCSfile: BIndexColumns.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:19 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_INDEXCOLUMNS_HXX_ +#include "adabas/BIndexColumns.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_ +#include "connectivity/sdbcx/VIndexColumn.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif +#ifndef _CONNECTIVITY_ADABAS_TABLE_HXX_ +#include "adabas/BTable.hxx" +#endif + +using namespace connectivity::adabas; +using namespace connectivity::sdbcx; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +// ------------------------------------------------------------------------- +Reference< XNamed > OIndexColumns::createObject(const ::rtl::OUString& _rName) +{ + + Reference< XResultSet > xResult = m_pIndex->getTable()->getConnection()->getMetaData()->getIndexInfo(Any(), + m_pIndex->getTable()->getSchema(),m_pIndex->getTable()->getName(),sal_False,sal_False); + + sal_Bool bAsc = sal_True; + if(xResult.is()) + { + Reference< XRow > xRow(xResult,UNO_QUERY); + ::rtl::OUString aD(::rtl::OUString::createFromAscii("D")); + while(xResult->next()) + { + if(xRow->getString(9) == _rName) + bAsc = xRow->getString(10) != aD; + } + } + + xResult = m_pIndex->getTable()->getConnection()->getMetaData()->getColumns(Any(), + m_pIndex->getTable()->getSchema(),m_pIndex->getTable()->getName(),_rName); + + Reference< XNamed > xRet = NULL; + if(xResult.is()) + { + Reference< XRow > xRow(xResult,UNO_QUERY); + while(xResult->next()) + { + if(xRow->getString(4) == _rName) + { + OIndexColumn* pRet = new OIndexColumn(bAsc, + _rName, + xRow->getString(6), + xRow->getString(13), + xRow->getInt(11), + xRow->getInt(7), + xRow->getInt(9), + xRow->getInt(5), + sal_False,sal_False,sal_False,sal_True); + xRet = pRet; + break; + } + } + } + + return xRet; +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > OIndexColumns::createEmptyObject() +{ + OIndexColumn* pNew = new OIndexColumn(sal_True); + return pNew; +} +// ------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/adabas/BIndexes.cxx b/connectivity/source/drivers/adabas/BIndexes.cxx new file mode 100644 index 000000000000..82361e74977c --- /dev/null +++ b/connectivity/source/drivers/adabas/BIndexes.cxx @@ -0,0 +1,241 @@ +/************************************************************************* + * + * $RCSfile: BIndexes.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADABAS_INDEXES_HXX_ +#include "adabas/BIndexes.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_INDEX_HXX_ +#include "adabas/BIndex.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_TABLE_HXX_ +#include "adabas/BTable.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_INDEXTYPE_HPP_ +#include <com/sun/star/sdbc/IndexType.hpp> +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +using namespace connectivity::adabas; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +typedef connectivity::sdbcx::OCollection OCollection_TYPE; + +Reference< XNamed > OIndexes::createObject(const ::rtl::OUString& _rName) +{ + ::rtl::OUString aName,aQualifier; + sal_Int32 nLen = _rName.indexOf('.'); + if(nLen != -1) + { + aQualifier = _rName.copy(0,nLen); + aName = _rName.copy(nLen+1); + } + else + aName = _rName; + + + Reference< XResultSet > xResult = m_pTable->getConnection()->getMetaData()->getIndexInfo(Any(), + m_pTable->getSchema(),m_pTable->getName(),sal_False,sal_False); + + Reference< XNamed > xRet = NULL; + if(xResult.is()) + { + Reference< XRow > xRow(xResult,UNO_QUERY); + while(xResult->next()) + { + if(xRow->getString(6) == aName && (!aQualifier.getLength() || xRow->getString(5) == aQualifier )) + { + OAdabasIndex* pRet = new OAdabasIndex(m_pTable,aName,aQualifier,!xRow->getBoolean(4), + aName == ::rtl::OUString::createFromAscii("SYSPRIMARYKEYINDEX"), + xRow->getShort(7) == IndexType::CLUSTERED); + xRet = pRet; + } + } + } + + return xRet; +} +// ------------------------------------------------------------------------- +void OIndexes::impl_refresh() throw(RuntimeException) +{ + m_pTable->refreshIndexes(); +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > OIndexes::createEmptyObject() +{ + OAdabasIndex* pNew = new OAdabasIndex(m_pTable); + return pNew; +} +// ------------------------------------------------------------------------- +// XAppend +void SAL_CALL OIndexes::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + + ::rtl::OUString aName = getString(descriptor->getPropertyValue(PROPERTY_NAME)); + ObjectMap::iterator aIter = m_aNameMap.find(aName); + if( aIter != m_aNameMap.end()) + throw ElementExistException(aName,*this); + + if(!m_pTable->isNew()) + { + ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("CREATE "); + ::rtl::OUString aQuote = m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString( ); + ::rtl::OUString aDot = ::rtl::OUString::createFromAscii("."); + + if(getINT32(descriptor->getPropertyValue(PROPERTY_ISUNIQUE))) + aSql = aSql + ::rtl::OUString::createFromAscii("UNIQUE "); + aSql = aSql + ::rtl::OUString::createFromAscii("INDEX "); + + + if(aName.getLength()) + { + aSql = aSql + aQuote + aName + aQuote + + ::rtl::OUString::createFromAscii(" ON ") + + aQuote + m_pTable->getSchema() + aQuote + aDot + + aQuote + m_pTable->getName() + aQuote + + ::rtl::OUString::createFromAscii(" ( "); + + Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY); + Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY); + Reference< XPropertySet > xColProp; + for(sal_Int32 i=0;i<xColumns->getCount();++i) + { + xColumns->getByIndex(i) >>= xColProp; + aSql = aSql + aQuote + getString(xColProp->getPropertyValue(PROPERTY_NAME)) + aQuote; + aSql = aSql + (getBOOL(xColProp->getPropertyValue(PROPERTY_ISASCENDING)) + ? + ::rtl::OUString::createFromAscii(" ASC") + : + ::rtl::OUString::createFromAscii(" DESC")) + + ::rtl::OUString::createFromAscii(","); + } + aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(")")); + } + else + { + aSql = aSql + aQuote + m_pTable->getSchema() + aQuote + aDot + aQuote + m_pTable->getName() + aQuote; + + Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY); + Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY); + Reference< XPropertySet > xColProp; + if(xColumns->getCount() != 1) + throw SQLException(); + + xColumns->getByIndex(0) >>= xColProp; + + aSql = aSql + aDot + aQuote + getString(xColProp->getPropertyValue(PROPERTY_NAME)) + aQuote; + } + + Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); + xStmt->execute(aSql); + } + OCollection_TYPE::appendByDescriptor(descriptor); +} +// ------------------------------------------------------------------------- +// XDrop +void SAL_CALL OIndexes::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + ObjectMap::iterator aIter = m_aNameMap.find(elementName); + if( aIter == m_aNameMap.end()) + throw NoSuchElementException(elementName,*this); + + if(!m_pTable->isNew()) + { + ::rtl::OUString aName,aSchema; + sal_Int32 nLen = elementName.indexOf('.'); + aSchema = elementName.copy(0,nLen); + aName = elementName.copy(nLen+1); + + ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP INDEX "); + ::rtl::OUString aQuote = m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString( ); + ::rtl::OUString aDot = ::rtl::OUString::createFromAscii("."); + + aSql = aSql + aQuote + aSchema + aQuote + aDot + aQuote + aName + ::rtl::OUString::createFromAscii(" ON ") + + aQuote + m_pTable->getSchema() + aQuote + m_pTable->getName() + aQuote; + + Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); + xStmt->execute(aSql); + } + OCollection_TYPE::dropByName(elementName); +} +// ------------------------------------------------------------------------- +void SAL_CALL OIndexes::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + if (index < 0 || index >= getCount()) + throw IndexOutOfBoundsException(); + + dropByName(m_aElements[index]->first); +} +// ------------------------------------------------------------------------- + + diff --git a/connectivity/source/drivers/adabas/BKeys.cxx b/connectivity/source/drivers/adabas/BKeys.cxx new file mode 100644 index 000000000000..e3227f467b0e --- /dev/null +++ b/connectivity/source/drivers/adabas/BKeys.cxx @@ -0,0 +1,285 @@ +/************************************************************************* + * + * $RCSfile: BKeys.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_KEYS_HXX_ +#include "adabas/BKeys.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_INDEX_HXX_ +#include "adabas/BKey.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_TABLE_HXX_ +#include "adabas/BTable.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_ +#include <com/sun/star/sdbcx/KeyType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_ +#include <com/sun/star/sdbc/KeyRule.hpp> +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +using namespace connectivity::adabas; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +typedef connectivity::sdbcx::OCollection OCollection_TYPE; + +Any SAL_CALL OKeys::queryInterface( const Type & rType ) throw(RuntimeException) +{ + if(rType == ::getCppuType(static_cast< Reference<XNameAccess> *>(NULL))) + return Any(); + + return OCollection_TYPE::queryInterface(rType); +} +// ------------------------------------------------------------------------- +Sequence< Type > SAL_CALL OKeys::getTypes( ) throw(RuntimeException) +{ + Sequence< Type > aTypes(OCollection_TYPE::getTypes()); + Type* pBegin = aTypes.getArray(); + Type* pEnd = pBegin + aTypes.getLength(); + + Sequence< Type > aRetType(aTypes.getLength()-1); + sal_Int32 i=0; + for(;pBegin != pEnd; ++pBegin) + { + if(*pBegin != ::getCppuType(static_cast< Reference<XNameAccess> *>(NULL))) + { + aRetType.getArray()[i++] = *pBegin; + } + } + + return aRetType; +} +// ------------------------------------------------------------------------- +Reference< XNamed > OKeys::createObject(const ::rtl::OUString& _rName) +{ + Reference< XNamed > xRet = NULL; + + if(_rName.getLength()) + { + Reference< XResultSet > xResult = m_pTable->getConnection()->getMetaData()->getExportedKeys(Any(), + m_pTable->getSchema(),m_pTable->getName()); + + if(xResult.is()) + { + Reference< XRow > xRow(xResult,UNO_QUERY); + ::rtl::OUString aName,aDot = ::rtl::OUString::createFromAscii("."); + while(xResult->next()) + { + if(xRow->getString(13) == _rName) + { + aName = xRow->getString(6); + if(aName.getLength()) + aName += aDot; + aName += xRow->getString(7); + + OAdabasKey* pRet = new OAdabasKey(m_pTable,_rName,aName,KeyType::FOREIGN,xRow->getInt(10),xRow->getInt(11)); + xRet = pRet; + break; + } + } + } + } + else + { + OAdabasKey* pRet = new OAdabasKey(m_pTable,_rName,::rtl::OUString(),KeyType::PRIMARY,KeyRule::NO_ACTION,KeyRule::NO_ACTION); + xRet = pRet; + } + + return xRet; +} +// ------------------------------------------------------------------------- +void OKeys::impl_refresh() throw(RuntimeException) +{ + m_pTable->refreshKeys(); +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > OKeys::createEmptyObject() +{ + OAdabasKey* pNew = new OAdabasKey(m_pTable); + return pNew; +} +// ------------------------------------------------------------------------- +// XAppend +void SAL_CALL OKeys::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + ::rtl::OUString aName = getString(descriptor->getPropertyValue(PROPERTY_NAME)); + ObjectMap::iterator aIter = m_aNameMap.find(aName); + if( aIter != m_aNameMap.end()) + throw ElementExistException(aName,*this); + if(!m_pTable->isNew()) + { + sal_Int32 nKeyType = getINT32(descriptor->getPropertyValue(PROPERTY_TYPE)); + + ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("ALTER TABLE "); + ::rtl::OUString aQuote = m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString( ); + ::rtl::OUString aDot = ::rtl::OUString::createFromAscii("."); + + aSql = aSql + aQuote + m_pTable->getSchema() + aQuote + aDot + aQuote + m_pTable->getName() + aQuote; + if(nKeyType == KeyType::PRIMARY) + { + aSql = aSql + ::rtl::OUString::createFromAscii(" ALTER PRIMARY KEY ("); + } + else if(nKeyType == KeyType::FOREIGN) + { + aSql = aSql + ::rtl::OUString::createFromAscii(" FOREIGN KEY ("); + } + else + throw SQLException(); + + Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY); + Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY); + Reference< XPropertySet > xColProp; + for(sal_Int32 i=0;i<xColumns->getCount();++i) + { + xColumns->getByIndex(i) >>= xColProp; + aSql = aSql + aQuote + getString(xColProp->getPropertyValue(PROPERTY_NAME)) + aQuote + + ::rtl::OUString::createFromAscii(","); + } + aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(")")); + + if(nKeyType == KeyType::FOREIGN) + { + sal_Int32 nDeleteRule = getINT32(xColProp->getPropertyValue(PROPERTY_DELETERULE)); + + ::rtl::OUString aName,aSchema,aRefTable = getString(xColProp->getPropertyValue(PROPERTY_REFERENCEDTABLE)); + sal_Int32 nLen = aRefTable.indexOf('.'); + aSchema = aRefTable.copy(0,nLen); + aName = aRefTable.copy(nLen+1); + aSql = aSql + ::rtl::OUString::createFromAscii(" REFERENCES ") + + aQuote + aSchema + aQuote + aDot + aQuote + aName + aQuote; + + for(sal_Int32 i=0;i<xColumns->getCount();++i) + { + xColumns->getByIndex(i) >>= xColProp; + aSql = aSql + aQuote + getString(xColProp->getPropertyValue(PROPERTY_REFERENCEDCOLUMN)) + aQuote + + ::rtl::OUString::createFromAscii(","); + } + aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(")")); + + switch(nDeleteRule) + { + case KeyRule::CASCADE: + aSql = aSql + ::rtl::OUString::createFromAscii(" ON DELETE CASCADE "); + break; + case KeyRule::RESTRICT: + aSql = aSql + ::rtl::OUString::createFromAscii(" ON DELETE RESTRICT "); + break; + case KeyRule::SET_NULL: + aSql = aSql + ::rtl::OUString::createFromAscii(" ON DELETE SET NULL "); + break; + case KeyRule::SET_DEFAULT: + aSql = aSql + ::rtl::OUString::createFromAscii(" ON DELETE SET DEFAULT "); + break; + default: + ; + } + } + + Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); + xStmt->execute(aSql); + } + OCollection_TYPE::appendByDescriptor(descriptor); +} +// ------------------------------------------------------------------------- +// XDrop +void SAL_CALL OKeys::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + ObjectMap::iterator aIter = m_aNameMap.find(elementName); + if( aIter == m_aNameMap.end()) + throw NoSuchElementException(elementName,*this); + + if(!m_pTable->isNew()) + { + ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("ALTER TABLE "); + ::rtl::OUString aQuote = m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString( ); + ::rtl::OUString aDot = ::rtl::OUString::createFromAscii("."); + + aSql = aSql + aQuote + m_pTable->getSchema() + aQuote + m_pTable->getName() + aQuote + + ::rtl::OUString::createFromAscii(" DROP PRIMARY KEY"); + + Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); + xStmt->execute(aSql); + } + OCollection_TYPE::dropByName(elementName); +} +// ------------------------------------------------------------------------- +void SAL_CALL OKeys::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + if (index < 0 || index >= getCount()) + throw IndexOutOfBoundsException(); + + dropByName(m_aElements[index]->first); +} + diff --git a/connectivity/source/drivers/adabas/BResultSetMetaData.cxx b/connectivity/source/drivers/adabas/BResultSetMetaData.cxx new file mode 100644 index 000000000000..df70ad5de067 --- /dev/null +++ b/connectivity/source/drivers/adabas/BResultSetMetaData.cxx @@ -0,0 +1,249 @@ +/************************************************************************* + * + * $RCSfile: BResultSetMetaData.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_BRESULTSETMETADATA_HXX_ +#include "adabas/BResultSetMetaData.hxx" +#endif +#ifndef _CONNECTIVITY_OTOOLS_HXX_ +#include "adabas/BTools.hxx" +#endif + +using namespace connectivity::adabas; +// ------------------------------------------------------------------------- +OResultSetMetaData::~OResultSetMetaData() +{ +} +// ------------------------------------------------------------------------- +::rtl::OUString OResultSetMetaData::getCharColAttrib(sal_Int32 _column,sal_Int32 ident) throw(starsdbc::SQLException, staruno::RuntimeException) +{ + sal_Int32 column = _column; + if(_column < m_vMapping.size()) // use mapping + column = m_vMapping[_column]; + + sal_Int32 BUFFER_LEN = 128; + char *pName = new char[BUFFER_LEN]; + SQLSMALLINT nRealLen=0; + OTools::ThrowException(N3SQLColAttribute(m_aStatementHandle, + column, + ident, + (SQLPOINTER)pName, + BUFFER_LEN, + &nRealLen, + NULL + ),m_aStatementHandle,SQL_HANDLE_STMT,*this); + if(nRealLen > BUFFER_LEN) + { + delete pName; + pName = new char[nRealLen]; + OTools::ThrowException(N3SQLColAttribute(m_aStatementHandle, + column, + ident, + (SQLPOINTER)pName, + nRealLen, + &nRealLen, + NULL + ),m_aStatementHandle,SQL_HANDLE_STMT,*this); + } + + return ::rtl::OUString::createFromAscii(pName); +} +// ------------------------------------------------------------------------- +sal_Int32 OResultSetMetaData::getNumColAttrib(sal_Int32 _column,sal_Int32 ident) throw(starsdbc::SQLException, staruno::RuntimeException) +{ + sal_Int32 column = _column; + if(_column < m_vMapping.size()) // use mapping + column = m_vMapping[_column]; + + sal_Int32 nValue; + OTools::ThrowException(N3SQLColAttribute(m_aStatementHandle, + column, + ident, + NULL, + 0, + NULL, + &nValue),m_aStatementHandle,SQL_HANDLE_STMT,*this); + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(starsdbc::SQLException, staruno::RuntimeException) +{ + return getNumColAttrib(column,SQL_DESC_DISPLAY_SIZE); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSetMetaData::getColumnType( sal_Int32 column ) throw(starsdbc::SQLException, staruno::RuntimeException) +{ + return OTools::MapOdbcType2Jdbc(getNumColAttrib(column,SQL_DESC_TYPE)); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSetMetaData::getColumnCount( ) throw(starsdbc::SQLException, staruno::RuntimeException) +{ + if(m_nColCount != -1) + return m_nColCount; + sal_Int16 nNumResultCols=0; + OTools::ThrowException(N3SQLNumResultCols(m_aStatementHandle,&nNumResultCols),m_aStatementHandle,SQL_HANDLE_STMT,*this); + return m_nColCount = nNumResultCols; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(starsdbc::SQLException, staruno::RuntimeException) +{ + return getNumColAttrib(column,SQL_DESC_CASE_SENSITIVE) == SQL_TRUE; +} +// ------------------------------------------------------------------------- + +::rtl::OUString SAL_CALL OResultSetMetaData::getSchemaName( sal_Int32 column ) throw(starsdbc::SQLException, staruno::RuntimeException) +{ + return getCharColAttrib(column,SQL_DESC_SCHEMA_NAME); +} +// ------------------------------------------------------------------------- + +::rtl::OUString SAL_CALL OResultSetMetaData::getColumnName( sal_Int32 column ) throw(starsdbc::SQLException, staruno::RuntimeException) +{ + return getCharColAttrib(column,SQL_DESC_NAME); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getTableName( sal_Int32 column ) throw(starsdbc::SQLException, staruno::RuntimeException) +{ + return getCharColAttrib(column,SQL_DESC_TABLE_NAME); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getCatalogName( sal_Int32 column ) throw(starsdbc::SQLException, staruno::RuntimeException) +{ + return getCharColAttrib(column,SQL_DESC_CATALOG_NAME); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(starsdbc::SQLException, staruno::RuntimeException) +{ + return getCharColAttrib(column,SQL_DESC_TYPE_NAME +); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(starsdbc::SQLException, staruno::RuntimeException) +{ + return getCharColAttrib(column,SQL_DESC_LABEL); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getColumnServiceName( sal_Int32 column ) throw(starsdbc::SQLException, staruno::RuntimeException) +{ + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isCurrency( sal_Int32 column ) throw(starsdbc::SQLException, staruno::RuntimeException) +{ + return getNumColAttrib(column,SQL_DESC_FIXED_PREC_SCALE) == SQL_TRUE; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(starsdbc::SQLException, staruno::RuntimeException) +{ + return getNumColAttrib(column,SQL_DESC_AUTO_UNIQUE_VALUE) == SQL_TRUE; +} +// ------------------------------------------------------------------------- + + +sal_Bool SAL_CALL OResultSetMetaData::isSigned( sal_Int32 column ) throw(starsdbc::SQLException, staruno::RuntimeException) +{ + return getNumColAttrib(column,SQL_DESC_UNSIGNED) == SQL_FALSE; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OResultSetMetaData::getPrecision( sal_Int32 column ) throw(starsdbc::SQLException, staruno::RuntimeException) +{ + return getNumColAttrib(column,SQL_DESC_PRECISION); +} +sal_Int32 SAL_CALL OResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + return getNumColAttrib(column,SQL_DESC_SCALE); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSetMetaData::isNullable( sal_Int32 column ) throw(starsdbc::SQLException, staruno::RuntimeException) +{ + return getNumColAttrib(column,SQL_DESC_NULLABLE) == SQL_NULLABLE; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 column ) throw(starsdbc::SQLException, staruno::RuntimeException) +{ + return getNumColAttrib(column,SQL_DESC_SEARCHABLE) != SQL_PRED_NONE; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isReadOnly( sal_Int32 column ) throw(starsdbc::SQLException, staruno::RuntimeException) +{ + return getNumColAttrib(column,SQL_DESC_UPDATABLE) == SQL_ATTR_READONLY; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(starsdbc::SQLException, staruno::RuntimeException) +{ + return getNumColAttrib(column,SQL_DESC_UPDATABLE) == SQL_ATTR_WRITE; +; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSetMetaData::isWritable( sal_Int32 column ) throw(starsdbc::SQLException, staruno::RuntimeException) +{ + return getNumColAttrib(column,SQL_DESC_UPDATABLE) == SQL_ATTR_WRITE; +} +// ------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/adabas/BTable.cxx b/connectivity/source/drivers/adabas/BTable.cxx new file mode 100644 index 000000000000..3452ed9b80df --- /dev/null +++ b/connectivity/source/drivers/adabas/BTable.cxx @@ -0,0 +1,590 @@ +/************************************************************************* + * + * $RCSfile: BTable.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_TABLE_HXX_ +#include "adabas/BTable.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_INDEXES_HXX_ +#include "adabas/BIndexes.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_COLUMNS_HXX_ +#include "adabas/BColumns.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_KEYS_HXX_ +#include "adabas/BKeys.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_ +#include <com/sun/star/sdbcx/KeyType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_ +#include <com/sun/star/sdbc/KeyRule.hpp> +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +using namespace connectivity::adabas; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + +OAdabasTable::OAdabasTable(OAdabasConnection* _pConnection) : OTable_TYPEDEF(sal_True) + ,m_pConnection(_pConnection) +{ + construct(); + ::std::vector< ::rtl::OUString> aVector; + m_pColumns = new OColumns(this,m_aMutex,aVector); + m_pKeys = new OKeys(this,m_aMutex,aVector); + m_pIndexes = new OIndexes(this,m_aMutex,aVector); +} +// ------------------------------------------------------------------------- +OAdabasTable::OAdabasTable( OAdabasConnection* _pConnection, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _Type, + const ::rtl::OUString& _Description , + const ::rtl::OUString& _SchemaName, + const ::rtl::OUString& _CatalogName + ) : OTable_TYPEDEF(sal_True,_Name, + _Type, + _Description, + _SchemaName, + _CatalogName) + ,m_pConnection(_pConnection) +{ + construct(); + refreshColumns(); + refreshKeys(); + refreshIndexes(); +} +// ------------------------------------------------------------------------- +void OAdabasTable::refreshColumns() +{ + ::std::vector< ::rtl::OUString> aVector; + Reference< XResultSet > xResult = m_pConnection->getMetaData()->getColumns(Any(), + m_SchemaName,m_Name,::rtl::OUString::createFromAscii("%")); + + if(xResult.is()) + { + Reference< XRow > xRow(xResult,UNO_QUERY); + while(xResult->next()) + aVector.push_back(xRow->getString(4)); + } + + if(m_pColumns) + delete m_pColumns; + m_pColumns = new OColumns(this,m_aMutex,aVector); +} +// ------------------------------------------------------------------------- +void OAdabasTable::refreshPrimaryKeys(std::vector< ::rtl::OUString>& _rKeys) +{ + Reference< XResultSet > xResult = m_pConnection->getMetaData()->getPrimaryKeys(Any(),m_SchemaName,m_Name); + + if(xResult.is()) + { + Reference< XRow > xRow(xResult,UNO_QUERY); + if(xResult->next()) // there can be only one primary key + { + ::rtl::OUString aPkName = xRow->getString(6); + _rKeys.push_back(aPkName); + } + } +} +// ------------------------------------------------------------------------- +void OAdabasTable::refreshForgeinKeys(std::vector< ::rtl::OUString>& _rKeys) +{ + Reference< XResultSet > xResult = m_pConnection->getMetaData()->getExportedKeys(Any(),m_SchemaName,m_Name); + + if(xResult.is()) + { + Reference< XRow > xRow(xResult,UNO_QUERY); + while(xResult->next()) + _rKeys.push_back(xRow->getString(12)); + } +} +// ------------------------------------------------------------------------- +void OAdabasTable::refreshKeys() +{ + ::std::vector< ::rtl::OUString> aVector; + + refreshPrimaryKeys(aVector); + refreshForgeinKeys(aVector); + if(m_pKeys) + delete m_pKeys; + m_pKeys = new OKeys(this,m_aMutex,aVector); +} +// ------------------------------------------------------------------------- +void OAdabasTable::refreshIndexes() +{ + ::std::vector< ::rtl::OUString> aVector; + // fill indexes + Reference< XResultSet > xResult = m_pConnection->getMetaData()->getIndexInfo(Any(), + m_SchemaName,m_Name,sal_False,sal_False); + + if(xResult.is()) + { + Reference< XRow > xRow(xResult,UNO_QUERY); + ::rtl::OUString aName,aDot = ::rtl::OUString::createFromAscii("."); + while(xResult->next()) + { + aName = xRow->getString(5); + if(aName.getLength()) + aName += aDot; + aName += xRow->getString(6); + if(aName.getLength()) + aVector.push_back(aName); + } + } + + if(m_pIndexes) + delete m_pIndexes; + m_pIndexes = new OIndexes(this,m_aMutex,aVector); +} +// ------------------------------------------------------------------------- +Any SAL_CALL OAdabasTable::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = ::cppu::queryInterface(rType,static_cast< ::com::sun::star::lang::XUnoTunnel*> (this)); + if(aRet.hasValue()) + return aRet; + return OTable_TYPEDEF::queryInterface(rType); +} + +//-------------------------------------------------------------------------- +Sequence< sal_Int8 > OAdabasTable::getUnoTunnelImplementationId() +{ + static ::cppu::OImplementationId * pId = 0; + if (! pId) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + if (! pId) + { + static ::cppu::OImplementationId aId; + pId = &aId; + } + } + return pId->getImplementationId(); +} + +// com::sun::star::lang::XUnoTunnel +//------------------------------------------------------------------ +sal_Int64 OAdabasTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException) +{ + if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + return (sal_Int64)this; + + return 0; +} +// ------------------------------------------------------------------------- +sal_Bool OAdabasTable::create() throw(SQLException, RuntimeException) +{ + ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("CREATE TABLE "); + ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); + ::rtl::OUString aDot = ::rtl::OUString::createFromAscii("."); + ::rtl::OUString aComma = ::rtl::OUString::createFromAscii(", "); + + aSql += aQuote + m_SchemaName + aQuote + aDot + aQuote + m_Name + aQuote; + aSql += ::rtl::OUString::createFromAscii(" ( "); + + sal_Int32 nCount = m_pColumns->getCount(); + Reference< XPropertySet > xProp; + for(sal_Int32 i=0;i<nCount;++i) + { + m_pColumns->getByIndex(i) >>= xProp; + aSql += aQuote + getString(xProp->getPropertyValue(PROPERTY_NAME)) + aQuote + + getString(xProp->getPropertyValue(PROPERTY_TYPENAME)); + + // add type definition + switch(getINT32(xProp->getPropertyValue(PROPERTY_TYPE))) + { + case DataType::CHAR: + case DataType::VARCHAR: + aSql += ::rtl::OUString::createFromAscii("(") + + ::rtl::OUString::valueOf(getINT32(xProp->getPropertyValue(PROPERTY_TYPE))) + + ::rtl::OUString::createFromAscii(")"); + break; + + case DataType::DECIMAL: + case DataType::NUMERIC: + aSql += ::rtl::OUString::createFromAscii("(") + + ::rtl::OUString::valueOf(getINT32(xProp->getPropertyValue(PROPERTY_TYPE))) + + ::rtl::OUString::createFromAscii(",") + + ::rtl::OUString::valueOf(getINT32(xProp->getPropertyValue(PROPERTY_SCALE))) + + ::rtl::OUString::createFromAscii(")"); + break; + } + + ::rtl::OUString aDefault = getString(xProp->getPropertyValue(PROPERTY_DEFAULTVALUE)); + if(getINT32(xProp->getPropertyValue(PROPERTY_ISNULLABLE)) == ColumnValue::NO_NULLS) + { + aSql += ::rtl::OUString::createFromAscii(" NOT NULL"); + if(aDefault.getLength()) + aSql += ::rtl::OUString::createFromAscii(" WITH DEFAULT"); + } + else if(aDefault.getLength()) + aSql += ::rtl::OUString::createFromAscii(" DEFAULT ") + aDefault; + + aSql += aComma; + } + + // create the key columns ( only the string ) + nCount = m_pKeys->getCount(); + + for(i=0;i<nCount;++i) + { + m_pKeys->getByIndex(i) >>= xProp; + Reference< XColumnsSupplier > xKey(xProp,UNO_QUERY); + Reference< ::com::sun::star::container::XIndexAccess > xCols(xKey->getColumns(),UNO_QUERY); + switch(getINT32(xProp->getPropertyValue(PROPERTY_TYPE))) + { + case KeyType::PRIMARY: + { + sal_Int32 nCols = xCols->getCount(); + if(nCols) + aSql += ::rtl::OUString::createFromAscii(" PRIMARY KEY( "); + for(sal_Int32 i=0;i<nCols;++i) + { + xCols->getByIndex(i) >>= xProp; + aSql += aQuote + getString(xProp->getPropertyValue(PROPERTY_NAME)) + aQuote; + aSql += aComma; + } + if(nCols) + aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(")")); + } + case KeyType::UNIQUE: + { + sal_Int32 nCols = xCols->getCount(); + if(nCols) + aSql += ::rtl::OUString::createFromAscii(" UNIQUE( "); + for(sal_Int32 i=0;i<nCols;++i) + { + xCols->getByIndex(i) >>= xProp; + aSql += aQuote + getString(xProp->getPropertyValue(PROPERTY_NAME)) + aQuote; + aSql += aComma; + } + if(nCols) + aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(")")); + } + case KeyType::FOREIGN: + { + sal_Int32 nCols = xCols->getCount(); + if(nCols) + { + aSql += ::rtl::OUString::createFromAscii(" FOREIGN KEY( "); + ::rtl::OUString aKeyName = getString(xProp->getPropertyValue(PROPERTY_NAME)); + ::rtl::OUString aRefTableName = getString(xProp->getPropertyValue(PROPERTY_REFERENCEDTABLE)); + sal_Int32 nDeleteRule = getINT32(xProp->getPropertyValue(PROPERTY_DELETERULE)); + if(aKeyName.getLength()) + { + aSql += aQuote + aKeyName + aQuote; + aSql += ::rtl::OUString::createFromAscii(" "); + } + + for(sal_Int32 i=0;i<nCols;++i) + { + xCols->getByIndex(i) >>= xProp; + aSql += aQuote + getString(xProp->getPropertyValue(PROPERTY_NAME)) + aQuote; + aSql += aComma; + } + aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(")")); + aSql += ::rtl::OUString::createFromAscii(" REFERENCES ") + + aQuote + aRefTableName + aQuote; + switch(nDeleteRule) + { + case KeyRule::CASCADE: + aSql += ::rtl::OUString::createFromAscii(" ON DELETE CASCADE "); + break; + case KeyRule::RESTRICT: + aSql += ::rtl::OUString::createFromAscii(" ON DELETE RESTRICT "); + break; + case KeyRule::SET_NULL: + aSql += ::rtl::OUString::createFromAscii(" ON DELETE SET NULL "); + break; + case KeyRule::NO_ACTION: + break; + case KeyRule::SET_DEFAULT: + aSql += ::rtl::OUString::createFromAscii(" ON DELETE SET DEFAULT "); + break; + } + } + + } + } + } + Reference< XStatement > xStmt = m_pConnection->createStatement( ); + xStmt->execute(aSql); + return sal_True; +} +// ------------------------------------------------------------------------- +// XRename +void SAL_CALL OAdabasTable::rename( const ::rtl::OUString& newName ) throw(SQLException, ElementExistException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if ( +#ifdef GCC + sdbcx::OTable_BASE::rBHelper.bDisposed +#else + rBHelper.bDisposed +#endif + ) + throw DisposedException(); + + if(!isNew()) + { + ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("RENAME TABLE "); + ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); + ::rtl::OUString aDot = ::rtl::OUString::createFromAscii("."); + + ::rtl::OUString aName,aSchema; + sal_Int32 nLen = newName.indexOf('.'); + aSchema = newName.copy(0,nLen); + aName = newName.copy(nLen+1); + + aSql += aQuote + m_SchemaName + aQuote + aDot + aQuote + m_Name + aQuote + + ::rtl::OUString::createFromAscii(" TO ") + + aQuote + aSchema + aQuote + aDot + aQuote + aName + aQuote; + + Reference< XStatement > xStmt = m_pConnection->createStatement( ); + xStmt->execute(aSql); + } + else + m_Name = newName; +} +// ------------------------------------------------------------------------- +// XAlterTable +void SAL_CALL OAdabasTable::alterColumnByName( const ::rtl::OUString& colName, const Reference< XPropertySet >& descriptor ) throw(SQLException, NoSuchElementException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if ( +#ifdef GCC + sdbcx::OTable_BASE::rBHelper.bDisposed +#else + rBHelper.bDisposed +#endif + ) + throw DisposedException(); + + if(!isNew()) + { + ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("ALTER TABLE "); + ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); + ::rtl::OUString aDot = ::rtl::OUString::createFromAscii("."); + + aSql += aQuote + m_SchemaName + aQuote + aDot + aQuote + m_Name + aQuote + + ::rtl::OUString::createFromAscii(" COLUMN ") + + aQuote + colName + aQuote + + ::rtl::OUString::createFromAscii(" ALTER "); + + aSql += aQuote + getString(descriptor->getPropertyValue(PROPERTY_NAME)) + aQuote + + getString(descriptor->getPropertyValue(PROPERTY_TYPENAME)); + + switch(getINT32(descriptor->getPropertyValue(PROPERTY_TYPE))) + { + case DataType::CHAR: + case DataType::VARCHAR: + aSql += ::rtl::OUString::createFromAscii("(") + + ::rtl::OUString::valueOf(getINT32(descriptor->getPropertyValue(PROPERTY_TYPE))) + + ::rtl::OUString::createFromAscii(")"); + break; + + case DataType::DECIMAL: + case DataType::NUMERIC: + aSql += ::rtl::OUString::createFromAscii("(") + + ::rtl::OUString::valueOf(getINT32(descriptor->getPropertyValue(PROPERTY_TYPE))) + + ::rtl::OUString::createFromAscii(",") + + ::rtl::OUString::valueOf(getINT32(descriptor->getPropertyValue(PROPERTY_SCALE))) + + ::rtl::OUString::createFromAscii(")"); + break; + } + ::rtl::OUString aDefault = getString(descriptor->getPropertyValue(PROPERTY_DEFAULTVALUE)); + if(getINT32(descriptor->getPropertyValue(PROPERTY_ISNULLABLE)) == ColumnValue::NO_NULLS) + { + aSql += ::rtl::OUString::createFromAscii(" NOT NULL"); + if(aDefault.getLength()) + aSql += ::rtl::OUString::createFromAscii(" WITH DEFAULT"); + } + else if(aDefault.getLength()) + aSql += ::rtl::OUString::createFromAscii(" DEFAULT ") + aDefault; + + Reference< XStatement > xStmt = m_pConnection->createStatement( ); + xStmt->execute(aSql); + + refreshColumns(); + } + else + { + if(m_pColumns) + { + m_pColumns->dropByName(colName); + m_pColumns->appendByDescriptor(descriptor); + } + } + +} +// ------------------------------------------------------------------------- +void SAL_CALL OAdabasTable::alterColumnByIndex( sal_Int32 index, const Reference< XPropertySet >& descriptor ) throw(SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if ( +#ifdef GCC + sdbcx::OTable_BASE::rBHelper.bDisposed +#else + rBHelper.bDisposed +#endif + ) + throw DisposedException(); + + Reference< XPropertySet > xOld; + if(m_pColumns->getByIndex(index) >>= xOld) + alterColumnByName(getString(xOld->getPropertyValue(PROPERTY_NAME)),descriptor); +} + +// ------------------------------------------------------------------------- +::rtl::OUString connectivity::adabas::getTypeString(const Reference< ::com::sun::star::beans::XPropertySet >& xColProp) +{ + ::rtl::OUString aValue; + switch(getINT32(xColProp->getPropertyValue(PROPERTY_TYPE))) + { + case DataType::BIT: + aValue = ::rtl::OUString::createFromAscii("BOOLEAN"); + break; + case DataType::TINYINT: + aValue = ::rtl::OUString::createFromAscii("SMALLINT"); + break; + case DataType::SMALLINT: + aValue = ::rtl::OUString::createFromAscii("SMALLINT"); + break; + case DataType::INTEGER: + aValue = ::rtl::OUString::createFromAscii("INT"); + break; + case DataType::FLOAT: + aValue = ::rtl::OUString::createFromAscii("FLOAT"); + break; + case DataType::REAL: + aValue = ::rtl::OUString::createFromAscii("REAL"); + break; + case DataType::DOUBLE: + aValue = ::rtl::OUString::createFromAscii("DOUBLE"); + break; + case DataType::NUMERIC: + aValue = ::rtl::OUString::createFromAscii("DECIMAL"); + break; + case DataType::DECIMAL: + aValue = ::rtl::OUString::createFromAscii("DECIMAL"); + break; + case DataType::CHAR: + aValue = ::rtl::OUString::createFromAscii("CHAR"); + break; + case DataType::VARCHAR: + aValue = ::rtl::OUString::createFromAscii("VARCHAR"); + break; + case DataType::LONGVARCHAR: + aValue = ::rtl::OUString::createFromAscii("LONG VARCHAR"); + break; + case DataType::DATE: + aValue = ::rtl::OUString::createFromAscii("DATE"); + break; + case DataType::TIME: + aValue = ::rtl::OUString::createFromAscii("TIME"); + break; + case DataType::TIMESTAMP: + aValue = ::rtl::OUString::createFromAscii("TIMESTAMP"); + break; + case DataType::BINARY: + aValue = ::rtl::OUString::createFromAscii("BOOLEAN"); + break; + case DataType::VARBINARY: + aValue = ::rtl::OUString::createFromAscii("VARCHAR BYTE"); + break; + case DataType::LONGVARBINARY: + aValue = ::rtl::OUString::createFromAscii("LONG BYTE"); + break; + } + return aValue; +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OAdabasTable::getTypes( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),OTable_TYPEDEF::getTypes()); +} + + + diff --git a/connectivity/source/drivers/adabas/BTables.cxx b/connectivity/source/drivers/adabas/BTables.cxx new file mode 100644 index 000000000000..93c4e3961715 --- /dev/null +++ b/connectivity/source/drivers/adabas/BTables.cxx @@ -0,0 +1,419 @@ +/************************************************************************* + * + * $RCSfile: BTables.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_TABLES_HXX_ +#include "adabas/BTables.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_TABLE_HXX_ +#include "adabas/BTable.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_ +#include <com/sun/star/sdbc/KeyRule.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_ +#include <com/sun/star/sdbcx/KeyType.hpp> +#endif +#ifndef _CONNECTIVITY_ADABAS_CATALOG_HXX_ +#include "adabas/BCatalog.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_BCONNECTION_HXX_ +#include "adabas/BConnection.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +using namespace connectivity::adabas; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +typedef connectivity::sdbcx::OCollection OCollection_TYPE; + +Reference< XNamed > OTables::createObject(const ::rtl::OUString& _rName) +{ + ::rtl::OUString aName,aSchema; + sal_Int32 nLen = _rName.indexOf('.'); + aSchema = _rName.copy(0,nLen); + aName = _rName.copy(nLen+1); + + Sequence< ::rtl::OUString > aTypes(1); + aTypes[0] = ::rtl::OUString::createFromAscii("%"); + // aTypes[0] = ::rtl::OUString::createFromAscii("TABLE"); + // aTypes[1] = ::rtl::OUString::createFromAscii("SYSTEMTABLE"); + + Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), + aSchema,aName,aTypes); + + Reference< XNamed > xRet = NULL; + if(xResult.is()) + { + Reference< XRow > xRow(xResult,UNO_QUERY); + if(xResult->next()) // there can be only one table with this name + { + OAdabasTable* pRet = new OAdabasTable( static_cast<OAdabasCatalog&>(m_rParent).getConnection(), + aName,xRow->getString(4),xRow->getString(5),aSchema); + xRet = pRet; + } + } + + return xRet; +} +// ------------------------------------------------------------------------- +void OTables::impl_refresh( ) throw(RuntimeException) +{ + static_cast<OAdabasCatalog&>(m_rParent).refreshTables(); +} +// ------------------------------------------------------------------------- +void OTables::disposing(void) +{ + m_xMetaData = NULL; + OCollection::disposing(); +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > OTables::createEmptyObject() +{ + OAdabasTable* pNew = new OAdabasTable(static_cast<OAdabasCatalog&>(m_rParent).getConnection()); + return pNew; +} +// ------------------------------------------------------------------------- +// XAppend +void SAL_CALL OTables::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + ::rtl::OUString aName = getString(descriptor->getPropertyValue(PROPERTY_NAME)); + ObjectMap::iterator aIter = m_aNameMap.find(aName); + if( aIter != m_aNameMap.end()) + throw ElementExistException(aName,*this); + + ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("CREATE TABLE "); + ::rtl::OUString aQuote = static_cast<OAdabasCatalog&>(m_rParent).getConnection()->getMetaData()->getIdentifierQuoteString( ); + ::rtl::OUString aDot = ::rtl::OUString::createFromAscii("."); + + aSql = aSql + aQuote + getString(descriptor->getPropertyValue(PROPERTY_SCHEMANAME)) + aQuote + aDot + + aQuote + getString(descriptor->getPropertyValue(PROPERTY_NAME)) + aQuote + + ::rtl::OUString::createFromAscii(" ("); + + // columns + Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY); + Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY); + Reference< XPropertySet > xColProp; + + Any aTypeName; + for(sal_Int32 i=0;i<xColumns->getCount();++i) + { + if(xColumns->getByIndex(i) >>= xColProp) + { + + aSql = aSql + aQuote + getString(xColProp->getPropertyValue(PROPERTY_NAME)) + aQuote; + + aSql = aSql + ::rtl::OUString::createFromAscii(" "); + + aTypeName = xColProp->getPropertyValue(PROPERTY_TYPENAME); + + if(aTypeName.hasValue() && getString(aTypeName).getLength()) + aSql = aSql + getString(aTypeName); + else + aSql = aSql + getTypeString(xColProp) + ::rtl::OUString::createFromAscii(" "); + + switch(getINT32(xColProp->getPropertyValue(PROPERTY_TYPE))) + { + case DataType::CHAR: + case DataType::VARCHAR: + aSql = aSql + ::rtl::OUString::createFromAscii("(") + + ::rtl::OUString::valueOf(getINT32(xColProp->getPropertyValue(PROPERTY_PRECISION))) + + ::rtl::OUString::createFromAscii(")"); + break; + + case DataType::DECIMAL: + case DataType::NUMERIC: + aSql = aSql + ::rtl::OUString::createFromAscii("(") + + ::rtl::OUString::valueOf(getINT32(xColProp->getPropertyValue(PROPERTY_PRECISION))) + + ::rtl::OUString::createFromAscii(",") + + ::rtl::OUString::valueOf(getINT32(xColProp->getPropertyValue(PROPERTY_SCALE))) + + ::rtl::OUString::createFromAscii(")"); + break; + } + ::rtl::OUString aDefault = getString(xColProp->getPropertyValue(PROPERTY_DEFAULTVALUE)); + if(getINT32(xColProp->getPropertyValue(PROPERTY_ISNULLABLE)) == ColumnValue::NO_NULLS) + { + aSql = aSql + ::rtl::OUString::createFromAscii(" NOT NULL"); + if(aDefault.getLength()) + aSql = aSql + ::rtl::OUString::createFromAscii(" WITH DEFAULT"); + } + else if(aDefault.getLength()) + aSql = aSql + ::rtl::OUString::createFromAscii(" DEFAULT ") + aDefault; + + aSql = aSql + ::rtl::OUString::createFromAscii(","); + } + } + aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(")")); + + // keys + + Reference<XKeysSupplier> xKeySup(descriptor,UNO_QUERY); + + Reference<XIndexAccess> xKeys = xKeySup->getKeys(); + if(xKeys.is()) + { + sal_Bool bPKey = sal_False; + for(sal_Int32 i=0;i<xKeys->getCount();++i) + { + if(xColumns->getByIndex(i) >>= xColProp) + { + + sal_Int32 nKeyType = getINT32(xColProp->getPropertyValue(PROPERTY_TYPE)); + + if(nKeyType == KeyType::PRIMARY) + { + if(!bPKey) + throw SQLException(); + + bPKey = sal_True; + xColumnSup = Reference<XColumnsSupplier>(xColProp,UNO_QUERY); + xColumns = Reference<XIndexAccess>(xColumnSup->getColumns(),UNO_QUERY); + if(!xColumns->getCount()) + throw SQLException(); + + aSql = aSql + ::rtl::OUString::createFromAscii(" PRIMARY KEY ("); + for(sal_Int32 i=0;i<xColumns->getCount();++i) + { + if(xColumns->getByIndex(i) >>= xColProp) + aSql = aSql + aQuote + getString(xColProp->getPropertyValue(PROPERTY_NAME)) + aQuote + + ::rtl::OUString::createFromAscii(","); + } + + aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(")")); + } + else if(nKeyType == KeyType::UNIQUE) + { + xColumnSup = Reference<XColumnsSupplier>(xColProp,UNO_QUERY); + xColumns = Reference<XIndexAccess>(xColumnSup->getColumns(),UNO_QUERY); + if(!xColumns->getCount()) + throw SQLException(); + + aSql = aSql + ::rtl::OUString::createFromAscii(" UNIQUE ("); + for(sal_Int32 i=0;i<xColumns->getCount();++i) + { + if(xColumns->getByIndex(i) >>= xColProp) + aSql = aSql + aQuote + getString(xColProp->getPropertyValue(PROPERTY_NAME)) + aQuote + + ::rtl::OUString::createFromAscii(","); + } + + aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(")")); + } + else if(nKeyType == KeyType::FOREIGN) + { + sal_Int32 nDeleteRule = getINT32(xColProp->getPropertyValue(PROPERTY_DELETERULE)); + + xColumnSup = Reference<XColumnsSupplier>(xColProp,UNO_QUERY); + xColumns = Reference<XIndexAccess>(xColumnSup->getColumns(),UNO_QUERY); + if(!xColumns->getCount()) + throw SQLException(); + + aSql = aSql + ::rtl::OUString::createFromAscii(" FOREIGN KEY "); + ::rtl::OUString aName,aSchema,aRefTable = getString(xColProp->getPropertyValue(PROPERTY_REFERENCEDTABLE)); + sal_Int32 nLen = aRefTable.indexOf('.'); + aSchema = aRefTable.copy(0,nLen); + aName = aRefTable.copy(nLen+1); + + aSql = aSql + aQuote + aSchema + aQuote + aDot + + aQuote + aName + aQuote + + ::rtl::OUString::createFromAscii(" ("); + + for(sal_Int32 i=0;i<xColumns->getCount();++i) + { + if(xColumns->getByIndex(i) >>= xColProp) + aSql = aSql + aQuote + getString(xColProp->getPropertyValue(PROPERTY_NAME)) + aQuote + + ::rtl::OUString::createFromAscii(","); + } + + aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(")")); + + switch(nDeleteRule) + { + case KeyRule::CASCADE: + aSql = aSql + ::rtl::OUString::createFromAscii(" ON DELETE CASCADE "); + break; + case KeyRule::RESTRICT: + aSql = aSql + ::rtl::OUString::createFromAscii(" ON DELETE RESTRICT "); + break; + case KeyRule::SET_NULL: + aSql = aSql + ::rtl::OUString::createFromAscii(" ON DELETE SET NULL "); + break; + case KeyRule::SET_DEFAULT: + aSql = aSql + ::rtl::OUString::createFromAscii(" ON DELETE SET DEFAULT "); + break; + default: + ; + } + } + } + } + } + + OAdabasConnection* pConnection = static_cast<OAdabasCatalog&>(m_rParent).getConnection(); + Reference< XStatement > xStmt = pConnection->createStatement( ); + xStmt->execute(aSql); + + if(getString(descriptor->getPropertyValue(PROPERTY_DESCRIPTION)).getLength()) + setComments(descriptor); + + + OCollection_TYPE::appendByDescriptor(descriptor); +} +// ------------------------------------------------------------------------- +void OTables::setComments(const Reference< XPropertySet >& descriptor ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("CREATE TABLE "); + ::rtl::OUString aQuote = static_cast<OAdabasCatalog&>(m_rParent).getConnection()->getMetaData()->getIdentifierQuoteString( ); + ::rtl::OUString aDot = ::rtl::OUString::createFromAscii("."); + + OAdabasConnection* pConnection = static_cast<OAdabasCatalog&>(m_rParent).getConnection(); + Reference< XStatement > xStmt = pConnection->createStatement( ); + aSql = ::rtl::OUString::createFromAscii("COMMENT ON TABLE ") + + aQuote + getString(descriptor->getPropertyValue(PROPERTY_SCHEMANAME)) + aQuote + aDot + + aQuote + getString(descriptor->getPropertyValue(PROPERTY_NAME)) + aQuote + + ::rtl::OUString::createFromAscii(" '") + + getString(descriptor->getPropertyValue(PROPERTY_DESCRIPTION)) + + ::rtl::OUString::createFromAscii("'"); + xStmt->execute(aSql); + + // columns + Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY); + Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY); + Reference< XPropertySet > xColProp; + + aSql = ::rtl::OUString::createFromAscii("COMMENT ON COLUMN ") + + aQuote + getString(descriptor->getPropertyValue(PROPERTY_SCHEMANAME)) + aQuote + aDot + + aQuote + getString(descriptor->getPropertyValue(PROPERTY_NAME)) + aQuote + aDot + + aQuote; + + for(sal_Int32 i=0;i<xColumns->getCount();++i) + { + xColumns->getByIndex(i) >>= xColProp; + ::rtl::OUString aDescription = getString(xColProp->getPropertyValue(PROPERTY_DESCRIPTION)); + if(aDescription.getLength()) + { + ::rtl::OUString aCom = aSql + getString(xColProp->getPropertyValue(PROPERTY_NAME)) + aQuote + + ::rtl::OUString::createFromAscii(" '") + + aDescription + + ::rtl::OUString::createFromAscii("'"); + xStmt->execute(aSql); + } + } +} +// ------------------------------------------------------------------------- +// XDrop +void SAL_CALL OTables::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + + ObjectMap::iterator aIter = m_aNameMap.find(elementName); + if( aIter == m_aNameMap.end()) + throw NoSuchElementException(elementName,*this); + + Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(aIter->second.get(),UNO_QUERY); + if(xTunnel.is()) + { + OAdabasTable* pTable = (OAdabasTable*)xTunnel->getSomething(OAdabasTable:: getUnoTunnelImplementationId()); + + if(!pTable->isNew()) + { + OAdabasConnection* pConnection = static_cast<OAdabasCatalog&>(m_rParent).getConnection(); + Reference< XStatement > xStmt = pConnection->createStatement( ); + + ::rtl::OUString aName,aSchema; + sal_Int32 nLen = elementName.indexOf('.'); + aSchema = elementName.copy(0,nLen); + aName = elementName.copy(nLen+1); + ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP TABLE "); + aSql = aSql + m_xMetaData->getIdentifierQuoteString( ) + aSchema + m_xMetaData->getIdentifierQuoteString( ); + aSql = aSql + ::rtl::OUString::createFromAscii("."); + aSql = aSql + m_xMetaData->getIdentifierQuoteString( ) + aName + m_xMetaData->getIdentifierQuoteString( ); + xStmt->execute(aSql); + } + } + + OCollection_TYPE::dropByName(elementName); +} +// ------------------------------------------------------------------------- +void SAL_CALL OTables::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + if (index < 0 || index >= getCount()) + throw IndexOutOfBoundsException(); + + dropByName((*m_aElements[index]).first); +} +// ------------------------------------------------------------------------- + + diff --git a/connectivity/source/drivers/adabas/BUser.cxx b/connectivity/source/drivers/adabas/BUser.cxx new file mode 100644 index 000000000000..b017fc2d1f18 --- /dev/null +++ b/connectivity/source/drivers/adabas/BUser.cxx @@ -0,0 +1,151 @@ +/************************************************************************* + * + * $RCSfile: BUser.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_USER_HXX_ +#include "adabas/BUser.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_GROUPS_HXX_ +#include "adabas/BGroups.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _CONNECTIVITY_ADABAS_BCONNECTION_HXX_ +#include "adabas/BConnection.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif + +using namespace connectivity::adabas; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +// ------------------------------------------------------------------------- +OAdabasUser::OAdabasUser( OAdabasConnection* _pConnection) : connectivity::sdbcx::OUser(sal_True) + ,m_pConnection(_pConnection) +{ + construct(); +} +// ------------------------------------------------------------------------- +OAdabasUser::OAdabasUser( OAdabasConnection* _pConnection, + const ::rtl::OUString& _Name + ) : connectivity::sdbcx::OUser(_Name,sal_True) + ,m_pConnection(_pConnection) +{ + construct(); +} +// ------------------------------------------------------------------------- +Any SAL_CALL OAdabasUser::queryInterface( const Type & rType ) throw(RuntimeException) +{ +// if(rType == ::getCppuType((const ::com::sun::star::uno::Reference< XGroupsSupplier>*)0)) +// return Any(); + + return OUser_TYPEDEF::queryInterface(rType); +} +// ------------------------------------------------------------------------- +void OAdabasUser::refreshGroups() +{ + if(!m_pConnection) + return; + + ::std::vector< ::rtl::OUString> aVector; + Reference< XStatement > xStmt = m_pConnection->createStatement( ); + ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("SELECT DISTINCT GROUPNAME FROM DOMAIN.USERS WHERE GROUPNAME IS NOT NULL AND GROUPNAME <> ' ' AND USERNAME = '"); + aSql += getName( ); + aSql += ::rtl::OUString::createFromAscii("'"); + + Reference< XResultSet > xResult = xStmt->executeQuery(aSql); + if(xResult.is()) + { + Reference< XRow > xRow(xResult,UNO_QUERY); + while(xResult->next()) + aVector.push_back(xRow->getString(1)); + } + + if(m_pGroups) + delete m_pGroups; + m_pGroups = new OGroups(*this,m_aMutex,aVector,m_pConnection,this); +} +// ------------------------------------------------------------------------- +OUserExtend::OUserExtend( OAdabasConnection* _pConnection) : OAdabasUser(_pConnection) +{ + construct(); +} +// ------------------------------------------------------------------------- +OUserExtend::OUserExtend( OAdabasConnection* _pConnection,const ::rtl::OUString& _Name) : OAdabasUser(_pConnection,_Name) +{ + construct(); +} +// ------------------------------------------------------------------------- +typedef connectivity::sdbcx::OUser OUser_TYPEDEF; +void OUserExtend::construct() +{ + OUser_TYPEDEF::construct(); + registerProperty(PROPERTY_PASSWORD, PROPERTY_ID_PASSWORD,0,&m_Password,::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); +} + diff --git a/connectivity/source/drivers/adabas/BUsers.cxx b/connectivity/source/drivers/adabas/BUsers.cxx new file mode 100644 index 000000000000..50d896c0b05a --- /dev/null +++ b/connectivity/source/drivers/adabas/BUsers.cxx @@ -0,0 +1,160 @@ +/************************************************************************* + * + * $RCSfile: BUsers.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_USERS_HXX_ +#include "adabas/BUsers.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_USER_HXX_ +#include "adabas/BUser.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_TABLE_HXX_ +#include "adabas/BTable.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_ +#include "connectivity/sdbcx/IRefreshable.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +using namespace connectivity::adabas; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +typedef connectivity::sdbcx::OCollection OCollection_TYPE; + +Reference< XNamed > OUsers::createObject(const ::rtl::OUString& _rName) +{ + OAdabasUser* pRet = new OAdabasUser(m_pConnection,_rName); + Reference< XNamed > xRet = pRet; + return xRet; +} +// ------------------------------------------------------------------------- +void OUsers::impl_refresh() throw(RuntimeException) +{ + m_pParent->refreshUsers(); +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > OUsers::createEmptyObject() +{ + OUserExtend* pNew = new OUserExtend(m_pConnection); + return pNew; +} +// ------------------------------------------------------------------------- +// XAppend +void SAL_CALL OUsers::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + ::rtl::OUString aName = getString(descriptor->getPropertyValue(PROPERTY_NAME)); + ObjectMap::iterator aIter = m_aNameMap.find(aName); + if( aIter != m_aNameMap.end()) + throw ElementExistException(aName,*this); + + ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("CREATE USER "); + ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); + + aSql = aSql + aQuote + getString(descriptor->getPropertyValue(PROPERTY_NAME)) + aQuote + + ::rtl::OUString::createFromAscii(" PASSWORD ") + + getString(descriptor->getPropertyValue(PROPERTY_PASSWORD)); + + Reference< XStatement > xStmt = m_pConnection->createStatement( ); + xStmt->execute(aSql); + + OCollection_TYPE::appendByDescriptor(descriptor); +} +// ------------------------------------------------------------------------- +// XDrop +void SAL_CALL OUsers::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + ObjectMap::iterator aIter = m_aNameMap.find(elementName); + if( aIter == m_aNameMap.end()) + throw NoSuchElementException(elementName,*this); + + ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP USER "); + ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); + + aSql = aSql + aQuote + elementName + aQuote; + + Reference< XStatement > xStmt = m_pConnection->createStatement( ); + xStmt->execute(aSql); + + OCollection_TYPE::dropByName(elementName); +} + +// ------------------------------------------------------------------------- +void SAL_CALL OUsers::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + if (index < 0 || index >= getCount()) + throw IndexOutOfBoundsException(); + + dropByName(m_aElements[index]->first); +} + diff --git a/connectivity/source/drivers/adabas/Bservices.cxx b/connectivity/source/drivers/adabas/Bservices.cxx new file mode 100644 index 000000000000..7485587dc4b8 --- /dev/null +++ b/connectivity/source/drivers/adabas/Bservices.cxx @@ -0,0 +1,212 @@ +/************************************************************************* + * + * $RCSfile: Bservices.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_BDRIVER_HXX_ +#include "adabas/BDriver.hxx" +#endif +#ifndef _CPPUHELPER_FACTORY_HXX_ +#include <cppuhelper/factory.hxx> +#endif +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif + +using namespace connectivity::adabas; +using ::rtl::OUString; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::registry::XRegistryKey; +using ::com::sun::star::lang::XSingleServiceFactory; +using ::com::sun::star::lang::XMultiServiceFactory; + +typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) + ( + const Reference< XMultiServiceFactory > & rServiceManager, + const OUString & rComponentName, + ::cppu::ComponentInstantiation pCreateFunction, + const Sequence< OUString > & rServiceNames + ); + +//*************************************************************************************** +// +// Die vorgeschriebene C-Api muss erfuellt werden! +// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen. +// + +//--------------------------------------------------------------------------------------- +void REGISTER_PROVIDER( + const OUString& aServiceImplName, + const Sequence< OUString>& Services, + const Reference< ::com::sun::star::registry::XRegistryKey > & xKey) +{ + OUString aMainKeyName; + aMainKeyName = OUString::createFromAscii("/"); + aMainKeyName += aServiceImplName; + aMainKeyName += OUString::createFromAscii("/UNO/SERVICES"); + + Reference< ::com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) ); + OSL_ENSHURE(xNewKey.is(), "ADABAS::component_writeInfo : could not create a registry key !"); + + for (sal_uInt32 i=0; i<Services.getLength(); ++i) + xNewKey->createKey(Services[i]); +} + + +//--------------------------------------------------------------------------------------- +struct ProviderRequest +{ + Reference< XSingleServiceFactory > xRet; + Reference< XMultiServiceFactory > const xServiceManager; + OUString const sImplementationName; + + ProviderRequest( + void* pServiceManager, + sal_Char const* pImplementationName + ) + : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager)) + , sImplementationName(OUString::createFromAscii(pImplementationName)) + { + } + + inline + sal_Bool CREATE_PROVIDER( + const OUString& Implname, + const Sequence< OUString > & Services, + ::cppu::ComponentInstantiation Factory, + createFactoryFunc creator + ) + { + if (!xRet.is() && (Implname == sImplementationName)) + try + { + xRet = creator( xServiceManager, sImplementationName,Factory, Services); + } + catch(...) + { + } + return xRet.is(); + } + + void* getProvider() const { return xRet.get(); } +}; + +//--------------------------------------------------------------------------------------- + +extern "C" void SAL_CALL component_getImplementationEnvironment( + const sal_Char **ppEnvTypeName, + uno_Environment **ppEnv + ) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +//--------------------------------------------------------------------------------------- +extern "C" sal_Bool SAL_CALL component_writeInfo( + void* pServiceManager, + void* pRegistryKey + ) +{ + if (pRegistryKey) + try + { + Reference< ::com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast< ::com::sun::star::registry::XRegistryKey*>(pRegistryKey)); + + REGISTER_PROVIDER( + ODriver::getImplementationName_Static(), + ODriver::getSupportedServiceNames_Static(), xKey); + + return sal_True; + } + catch (::com::sun::star::registry::InvalidRegistryException& ) + { + OSL_ENSHURE(sal_False, "ODBC::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); + } + + return sal_False; +} + +//--------------------------------------------------------------------------------------- +extern "C" void* SAL_CALL component_getFactory( + const sal_Char* pImplementationName, + void* pServiceManager, + void* pRegistryKey) +{ + void* pRet = 0; + if (pServiceManager) + { + ProviderRequest aReq(pServiceManager,pImplementationName); + + aReq.CREATE_PROVIDER( + ODriver::getImplementationName_Static(), + ODriver::getSupportedServiceNames_Static(), + ODriver_CreateInstance, ::cppu::createSingleFactory) + ; + + if(aReq.xRet.is()) + aReq.xRet->acquire(); + + pRet = aReq.getProvider(); + } + + return pRet; +}; + + diff --git a/connectivity/source/drivers/adabas/adabas.map b/connectivity/source/drivers/adabas/adabas.map new file mode 100644 index 000000000000..7ce4c703e6b3 --- /dev/null +++ b/connectivity/source/drivers/adabas/adabas.map @@ -0,0 +1,8 @@ +ADABAS_2_0 { + global: + component_getImplementationEnvironment; + component_writeInfo; + component_getFactory; + local: + *; +}; diff --git a/connectivity/source/drivers/adabas/adabas.xml b/connectivity/source/drivers/adabas/adabas.xml new file mode 100644 index 000000000000..40070e191e75 --- /dev/null +++ b/connectivity/source/drivers/adabas/adabas.xml @@ -0,0 +1,70 @@ +<?xml version='1.0' encoding="UTF-8"?> +<!DOCTYPE COMPONENTDESCRIPTION PUBLIC "-//W3C//DTD HTML 3.2//EN" "componentdependencies.dtd"> +<COMPONENTDESCRIPTION> + +<Name> com.sun.star.sdbc.BDriver </Name> + +<Description> + This is the implementation of the sdbc-odbc bridge. +</Description> + +<ModuleName> odbc </ModuleName> + +<LoaderName> com.sun.star.loader.SharedLibrary </LoaderName> + +<SupportedService> com.sun.star.sdbc.Driver </SupportedService> + +<ServiceDependency> ... </ServiceDependency> + +<ProjectBuildDependency> cppuhelper </ProjectBuildDependency> +<ProjectBuildDependency> cppu </ProjectBuildDependency> +<ProjectBuildDependency> sal </ProjectBuildDependency> +<ProjectBuildDependency> vos </ProjectBuildDependency> + +<RuntimeModuleDependency> cppuhelper </RuntimeModuleDependency> +<RuntimeModuleDependency> cppu1 </RuntimeModuleDependency> +<RuntimeModuleDependency> sal1 </RuntimeModuleDependency> +<RuntimeModuleDependency> vos </RuntimeModuleDependency> + +<Language> c++ </Language> + +<Status StatusValue="final"/> + +<Type> com.sun.star.util.XCancellable </Type> +<Type> com.sun.star.util.XNumberFormatter </Type> +<Type> com.sun.star.uno.TypeClass </Type> +<Type> com.sun.star.uno.XWeak </Type> +<Type> com.sun.star.uno.XAggregation </Type> +<Type> com.sun.star.beans.XPropertyState </Type> +<Type> com.sun.star.beans.XPropertySet </Type> +<Type> com.sun.star.beans.PropertyValue </Type> +<Type> com.sun.star.beans.XMultiPropertySet </Type> +<Type> com.sun.star.beans.XFastPropertySet </Type> +<Type> com.sun.star.lang.XTypeProvider </Type> +<Type> com.sun.star.lang.EventObject </Type> +<Type> com.sun.star.lang.XComponent </Type> +<Type> com.sun.star.lang.IllegalArgumentException </Type> +<Type> com.sun.star.lang.XMultiServiceFactory </Type> +<Type> com.sun.star.java.XJavaThreadRegister_11 </Type> +<Type> com.sun.star.java.XJavaVM </Type> +<Type> com.sun.star.sdbc.XConnection </Type> +<Type> com.sun.star.sdbc.XStatement </Type> +<Type> com.sun.star.sdbc.XResultSet </Type> +<Type> com.sun.star.sdbc.XResultSetMetaDataSupplier</Type> +<Type> com.sun.star.sdbc.XColumnLocate </Type> +<Type> com.sun.star.sdbc.XResultSetUpdate </Type> +<Type> com.sun.star.sdbc.XWarningsSupplier </Type> +<Type> com.sun.star.sdbc.XRowUpdate </Type> +<Type> com.sun.star.sdbc.XMultipleResults </Type> +<Type> com.sun.star.sdbc.XBatchExecution </Type> +<Type> com.sun.star.sdbc.XPreparedBatchExecution </Type> +<Type> com.sun.star.sdbc.XParameters </Type> +<Type> com.sun.star.sdbc.XOutParameters </Type> +<Type> com.sun.star.sdbc.DriverPropertyInfo </Type> +<Type> com.sun.star.sdbc.XRow </Type> +<Type> com.sun.star.sdb.XColumnUpdate </Type> +<Type> com.sun.star.sdb.XColumn </Type> + +</COMPONENTDESCRIPTION> + + diff --git a/connectivity/source/drivers/adabas/exports.dxp b/connectivity/source/drivers/adabas/exports.dxp new file mode 100644 index 000000000000..9630d7e06768 --- /dev/null +++ b/connectivity/source/drivers/adabas/exports.dxp @@ -0,0 +1,3 @@ +component_getImplementationEnvironment +component_writeInfo +component_getFactory diff --git a/connectivity/source/drivers/adabas/makefile.mk b/connectivity/source/drivers/adabas/makefile.mk new file mode 100644 index 000000000000..2df67f8df3d1 --- /dev/null +++ b/connectivity/source/drivers/adabas/makefile.mk @@ -0,0 +1,199 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/..$/.. +PRJINC=..$/.. +PRJNAME=connectivity +TARGET=adabas + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ---------------------------------- +.IF "$(DBGUTIL_OJ)"!="" +ENVCFLAGS+=/FR$(SLO)$/ +.ENDIF + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/version.mk + +# --- Types ------------------------------------- + + +UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb +UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb + +UNOUCROUT=$(OUT)$/inc +INCPRE+=$(UNOUCROUT) + +# --- Types ------------------------------------- + +UNOTYPES+= \ + com.sun.star.util.XCancellable \ + com.sun.star.util.XNumberFormatter \ + com.sun.star.uno.TypeClass \ + com.sun.star.uno.XWeak \ + com.sun.star.uno.XAggregation \ + com.sun.star.beans.XPropertyState \ + com.sun.star.beans.XPropertySet \ + com.sun.star.beans.PropertyValue \ + com.sun.star.beans.XMultiPropertySet \ + com.sun.star.beans.XFastPropertySet \ + com.sun.star.lang.XTypeProvider \ + com.sun.star.lang.EventObject \ + com.sun.star.lang.XComponent \ + com.sun.star.lang.IllegalArgumentException \ + com.sun.star.lang.DisposedException \ + com.sun.star.lang.XMultiServiceFactory \ + com.sun.star.lang.XSingleServiceFactory \ + com.sun.star.lang.XUnoTunnel \ + com.sun.star.registry.XRegistryKey \ + com.sun.star.java.XJavaThreadRegister_11 \ + com.sun.star.java.XJavaVM \ + com.sun.star.sdbc.XConnection \ + com.sun.star.sdbc.XStatement \ + com.sun.star.sdbc.XResultSet \ + com.sun.star.sdbc.XResultSetMetaDataSupplier \ + com.sun.star.sdbc.XColumnLocate \ + com.sun.star.sdbc.XResultSetUpdate \ + com.sun.star.sdbc.XWarningsSupplier \ + com.sun.star.sdbc.XRowUpdate \ + com.sun.star.sdbc.XMultipleResults \ + com.sun.star.sdbc.XBatchExecution \ + com.sun.star.sdbc.XPreparedBatchExecution \ + com.sun.star.sdbc.XParameters \ + com.sun.star.sdbc.XOutParameters \ + com.sun.star.sdbc.DriverPropertyInfo \ + com.sun.star.sdbc.XDriver \ + com.sun.star.sdbc.XRow \ + com.sun.star.sdbc.SQLWarning \ + com.sun.star.sdbc.ColumnSearch \ + com.sun.star.sdbc.DataType \ + com.sun.star.sdbc.ResultSetConcurrency \ + com.sun.star.sdbc.ResultSetType \ + com.sun.star.sdbc.ColumnValue \ + com.sun.star.sdbcx.KeyType \ + com.sun.star.sdb.XColumnUpdate \ + com.sun.star.sdb.XColumn \ + + + +# --- Files ------------------------------------- + +SLOFILES=\ + $(SLO)$/BConnection.obj \ + $(SLO)$/BDriver.obj \ + $(SLO)$/BCatalog.obj \ + $(SLO)$/BGroups.obj \ + $(SLO)$/BGroup.obj \ + $(SLO)$/BUser.obj \ + $(SLO)$/BUsers.obj \ + $(SLO)$/BKeyColumns.obj \ + $(SLO)$/BKey.obj \ + $(SLO)$/BKeys.obj \ + $(SLO)$/BColumns.obj \ + $(SLO)$/BIndex.obj \ + $(SLO)$/BIndexColumns.obj \ + $(SLO)$/BIndexes.obj \ + $(SLO)$/BTable.obj \ + $(SLO)$/BTables.obj \ + $(SLO)$/Bservices.obj \ + $(SLO)$/BDatabaseMetaData.obj \ + $(SLO)$/OPreparedStatement.obj \ + $(SLO)$/OStatement.obj \ + $(SLO)$/OResultSetMetaData.obj \ + $(SLO)$/OResultSet.obj \ + $(SLO)$/OTools.obj \ + $(SLO)$/ODatabaseMetaData.obj \ + $(SLO)$/ODriver.obj \ + $(SLO)$/OFunctions.obj \ + $(SLO)$/OConnection.obj + + +# --- Library ----------------------------------- + +SHL1TARGET= $(ADABAS_TARGET)$(ADABAS_MAJOR) +SHL1VERSIONMAP= $(TARGET).map +SHL1OBJS=$(SLOFILES) +SHL1STDLIBS=\ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(VOSLIB) \ + $(OSLLIB) \ + $(SALLIB) + +SHL1DEPN= +SHL1IMPLIB= i$(SHL1TARGET) +SHL1LIBS= $(SLB)$/commontools.lib \ + $(SLB)$/resource.lib \ + $(SLB)$/sdbcx.lib + +SHL1DEF= $(MISC)$/$(SHL1TARGET).def + +DEF1NAME= $(SHL1TARGET) +DEF1EXPORTFILE= exports.dxp + + +# --- Targets ---------------------------------- + +.INCLUDE : target.mk + + diff --git a/connectivity/source/drivers/ado/ACallableStatement.cxx b/connectivity/source/drivers/ado/ACallableStatement.cxx new file mode 100644 index 000000000000..487cf29f4fca --- /dev/null +++ b/connectivity/source/drivers/ado/ACallableStatement.cxx @@ -0,0 +1,258 @@ +/************************************************************************* + * + * $RCSfile: ACallableStatement.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_ACALLABLESTATEMENT_HXX_ +#include "ado/ACallableStatement.hxx" +#endif + +using namespace connectivity::ado; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::container; +using namespace com::sun::star::lang; + +IMPLEMENT_SERVICE_INFO(OCallableStatement,"com.sun.star.sdbcx.ACallableStatement","com.sun.star.sdbc.CallableStatement"); + +#define GET_PARAM() \ + ADOParameter* pParam = NULL; \ + m_pParameters->get_Item(OLEVariant(columnIndex-1),&pParam); \ + if(pParam) \ + pParam->get_Value(&m_aValue); +//************************************************************** +//************ Class: java.sql.CallableStatement +//************************************************************** +OCallableStatement::OCallableStatement( OConnection* _pConnection,const ::std::vector<connectivity::OTypeInfo>& _TypeInfo,const ::rtl::OUString& sql ) + : OPreparedStatement( _pConnection, _TypeInfo, sql ) +{ + m_Command.put_CommandType(adCmdStoredProc); +} +// ------------------------------------------------------------------------- + +Any SAL_CALL OCallableStatement::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = OPreparedStatement::queryInterface(rType); + if(!aRet.hasValue()) + aRet = ::cppu::queryInterface(rType,static_cast< XRow*>(this)); + return aRet; +} +// ------------------------------------------------------------------------- + + +sal_Bool SAL_CALL OCallableStatement::wasNull( ) throw(SQLException, RuntimeException) +{ + return m_aValue.isNull(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OCallableStatement::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + GET_PARAM() + return m_aValue; +} +// ------------------------------------------------------------------------- +sal_Int8 SAL_CALL OCallableStatement::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + GET_PARAM() + return m_aValue; +} +// ------------------------------------------------------------------------- +Sequence< sal_Int8 > SAL_CALL OCallableStatement::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + GET_PARAM() + return m_aValue; +} +// ------------------------------------------------------------------------- +::com::sun::star::util::Date SAL_CALL OCallableStatement::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + GET_PARAM() + return m_aValue; +} +// ------------------------------------------------------------------------- +double SAL_CALL OCallableStatement::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + GET_PARAM() + return m_aValue; +} +// ------------------------------------------------------------------------- + +float SAL_CALL OCallableStatement::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + GET_PARAM() + return m_aValue; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OCallableStatement::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + GET_PARAM() + return m_aValue; +} +// ------------------------------------------------------------------------- + +sal_Int64 SAL_CALL OCallableStatement::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + GET_PARAM() + return (sal_Int64)m_aValue.getCurrency(); +} +// ------------------------------------------------------------------------- + +Any SAL_CALL OCallableStatement::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException) +{ + return Any(); +} +// ------------------------------------------------------------------------- + +sal_Int16 SAL_CALL OCallableStatement::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + GET_PARAM() + return m_aValue; +} +// ------------------------------------------------------------------------- + +::rtl::OUString SAL_CALL OCallableStatement::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + GET_PARAM() + return m_aValue; +} +// ------------------------------------------------------------------------- + + ::com::sun::star::util::Time SAL_CALL OCallableStatement::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + GET_PARAM() + return m_aValue; +} +// ------------------------------------------------------------------------- + + ::com::sun::star::util::DateTime SAL_CALL OCallableStatement::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + GET_PARAM() + return m_aValue; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OCallableStatement::registerOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(SQLException, RuntimeException) +{ + ADOParameter* pParam = NULL; + m_pParameters->get_Item(OLEVariant(parameterIndex-1),&pParam); + if(pParam) + { + pParam->put_Type(ADOS::MapJdbc2ADOType(sqlType)); + pParam->put_Direction(adParamOutput); + } +} +// ------------------------------------------------------------------------- +void SAL_CALL OCallableStatement::registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale ) throw(SQLException, RuntimeException) +{ + ADOParameter* pParam = NULL; + m_pParameters->get_Item(OLEVariant(parameterIndex-1),&pParam); + if(pParam) + { + pParam->put_Type(ADOS::MapJdbc2ADOType(sqlType)); + pParam->put_Direction(adParamOutput); + pParam->put_NumericScale(scale); + } +} +// ------------------------------------------------------------------------- + + +Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCallableStatement::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + m_aValue.setNull(); + return NULL; +} +// ------------------------------------------------------------------------- +Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCallableStatement::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + m_aValue.setNull(); + return NULL; +} +// ------------------------------------------------------------------------- + +Reference< XArray > SAL_CALL OCallableStatement::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + m_aValue.setNull(); + return NULL; +} +// ------------------------------------------------------------------------- + +Reference< XClob > SAL_CALL OCallableStatement::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + m_aValue.setNull(); + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XBlob > SAL_CALL OCallableStatement::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + m_aValue.setNull(); + return NULL; +} +// ------------------------------------------------------------------------- + +Reference< XRef > SAL_CALL OCallableStatement::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + m_aValue.setNull(); + return NULL; +} +// ------------------------------------------------------------------------- + + diff --git a/connectivity/source/drivers/ado/ACatalog.cxx b/connectivity/source/drivers/ado/ACatalog.cxx new file mode 100644 index 000000000000..1f78d41c2e32 --- /dev/null +++ b/connectivity/source/drivers/ado/ACatalog.cxx @@ -0,0 +1,216 @@ +/************************************************************************* + * + * $RCSfile: ACatalog.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_CATALOG_HXX_ +#include "ado/ACatalog.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_BCONNECTION_HXX_ +#include "ado/AConnection.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_GROUPS_HXX_ +#include "ado/AGroups.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_USERS_HXX_ +#include "ado/AUsers.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_TABLES_HXX_ +#include "ado/ATables.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_VIEWS_HXX_ +#include "ado/AViews.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif + + +// ------------------------------------------------------------------------- +using namespace connectivity::ado; +// ------------------------------------------------------------------------- +OCatalog::OCatalog(_ADOCatalog* _pCatalog,OConnection* _pCon) : connectivity::sdbcx::OCatalog(_pCon) + ,m_pConnection(_pCon) + ,m_aCatalog(_pCatalog) +{ + osl_incrementInterlockedCount( &m_refCount ); + refreshTables(); + refreshViews(); + refreshGroups(); + refreshUsers(); + osl_decrementInterlockedCount( &m_refCount ); +} +// ------------------------------------------------------------------------- +void OCatalog::refreshTables() +{ + ::std::vector< ::rtl::OUString> aVector; + + ADOTables* pTables = m_aCatalog.get_Tables(); + if(pTables) + { + pTables->Refresh(); + + sal_Int32 nCount = 0; + pTables->get_Count(&nCount); + for(sal_Int32 i=0;i< nCount;++i) + { + ADOTable* pTable = NULL; + pTables->get_Item(OLEVariant(i),&pTable); + if(pTable) + { + WpADOTable aTable(pTable); + aVector.push_back(aTable.get_Name()); + } + } + } + + if(m_pTables) + delete m_pTables; + m_pTables = new OTables(*this,m_aMutex,aVector,pTables,m_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers()); +} +// ------------------------------------------------------------------------- +void OCatalog::refreshViews() +{ + ::std::vector< ::rtl::OUString> aVector; + + ADOViews* pViews = m_aCatalog.get_Views(); + if(pViews) + { + pViews->Refresh(); + + sal_Int32 nCount = 0; + pViews->get_Count(&nCount); + for(sal_Int32 i=0;i< nCount;++i) + { + ADOView* pView = NULL; + pViews->get_Item(OLEVariant(i),&pView); + if(pView) + { + WpADOView aView(pView); + aVector.push_back(aView.get_Name()); + } + } + } + + if(m_pViews) + delete m_pViews; + m_pViews = new OViews(*this,m_aMutex,aVector,pViews,m_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers()); +} +// ------------------------------------------------------------------------- +void OCatalog::refreshGroups() +{ + ::std::vector< ::rtl::OUString> aVector; + + ADOGroups* pGroups = m_aCatalog.get_Groups(); + if(pGroups) + { + pGroups->Refresh(); + + sal_Int32 nCount = 0; + pGroups->get_Count(&nCount); + for(sal_Int32 i=0;i< nCount;++i) + { + ADOGroup* pGroup = NULL; + pGroups->get_Item(OLEVariant(i),&pGroup); + if(pGroup) + { + WpADOGroup aGroup(pGroup); + aVector.push_back(aGroup.get_Name()); + } + } + } + + if(m_pGroups) + delete m_pGroups; + m_pGroups = new OGroups(*this,m_aMutex,aVector,pGroups,m_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers()); +} +// ------------------------------------------------------------------------- +void OCatalog::refreshUsers() +{ + ::std::vector< ::rtl::OUString> aVector; + + ADOUsers* pUsers = m_aCatalog.get_Users(); + if(pUsers) + { + pUsers->Refresh(); + + sal_Int32 nCount = 0; + pUsers->get_Count(&nCount); + for(sal_Int32 i=0;i< nCount;++i) + { + ADOUser* pUser = NULL; + pUsers->get_Item(OLEVariant(i),&pUser); + if(pUser) + { + WpADOUser aUser(pUser); + aVector.push_back(aUser.get_Name()); + } + } + } + + if(m_pUsers) + delete m_pUsers; + m_pUsers = new OUsers(*this,m_aMutex,aVector,pUsers,m_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers()); +} +// ------------------------------------------------------------------------- + + diff --git a/connectivity/source/drivers/ado/AColumn.cxx b/connectivity/source/drivers/ado/AColumn.cxx new file mode 100644 index 000000000000..7bb7d0c45d30 --- /dev/null +++ b/connectivity/source/drivers/ado/AColumn.cxx @@ -0,0 +1,426 @@ +/************************************************************************* + * + * $RCSfile: AColumn.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_COLUMN_HXX_ +#include "ado/AColumn.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_AWRAPADO_HXX_ +#include "ado/Awrapado.hxx" +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif + +using namespace connectivity::ado; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; + +void WpADOColumn::Create() +{ + IClassFactory2* pIUnknown = NULL; + IUnknown *pOuter = NULL; + HRESULT hr = -1; + _ADOColumn* pCommand; + hr = CoCreateInstance(ADOS::CLSID_ADOCOLUMN_25, + NULL, + CLSCTX_INPROC_SERVER, + ADOS::IID_ADOCOLUMN_25, + (void**)&pCommand ); + + + if( !FAILED( hr ) ) + { + pInterface = pCommand; + pInterface->AddRef(); + } +} +// ------------------------------------------------------------------------- +OAdoColumn::OAdoColumn(sal_Bool _bCase,_ADOColumn* _pColumn) : connectivity::sdbcx::OColumn(_bCase) +{ + if(_pColumn) + m_aColumn = WpADOColumn(_pColumn); + else + m_aColumn.Create(); +} +// ------------------------------------------------------------------------- +OAdoColumn::OAdoColumn( const ::rtl::OUString& _Name, + const ::rtl::OUString& _TypeName, + const ::rtl::OUString& _DefaultValue, + sal_Int32 _IsNullable, + sal_Int32 _Precision, + sal_Int32 _Scale, + sal_Int32 _Type, + sal_Bool _IsAutoIncrement, + sal_Bool _IsCurrency, + sal_Bool _bCase + ) : connectivity::sdbcx::OColumn(_Name, + _TypeName, + _DefaultValue, + _IsNullable, + _Precision, + _Scale, + _Type, + _IsAutoIncrement, + sal_False,_IsCurrency,_bCase) +{ + m_aColumn.Create(); + m_aColumn.put_Name(_Name); + m_aColumn.put_Type(ADOS::MapJdbc2ADOType(_Type)); + m_aColumn.put_Precision(_Precision); + if(_IsNullable) + m_aColumn.put_Attributes(adColNullable); + { + ADOProperties* pProps = m_aColumn.get_Properties(); + pProps->AddRef(); + ADOProperty* pProp = NULL; + pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("AutoIncrement")),&pProp); + WpADOProperty aProp(pProp); + if(pProp) + aProp.PutValue(_IsAutoIncrement); + pProps->Release(); + } + { + ADOProperties* pProps = m_aColumn.get_Properties(); + pProps->AddRef(); + ADOProperty* pProp = NULL; + pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("Default")),&pProp); + WpADOProperty aProp(pProp); + if(pProp) + aProp.PutValue(_DefaultValue); + pProps->Release(); + } +} +// ------------------------------------------------------------------------- +Any SAL_CALL OAdoColumn::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = ::cppu::queryInterface(rType,static_cast< ::com::sun::star::lang::XUnoTunnel*> (this)); + if(aRet.hasValue()) + return aRet; + return OColumn_ADO::queryInterface(rType); +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OAdoColumn::getTypes( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),OColumn_ADO::getTypes()); +} + +//-------------------------------------------------------------------------- +Sequence< sal_Int8 > OAdoColumn::getUnoTunnelImplementationId() +{ + static ::cppu::OImplementationId * pId = 0; + if (! pId) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + if (! pId) + { + static ::cppu::OImplementationId aId; + pId = &aId; + } + } + return pId->getImplementationId(); +} + +// com::sun::star::lang::XUnoTunnel +//------------------------------------------------------------------ +sal_Int64 OAdoColumn::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException) +{ + if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + return (sal_Int64)this; + + return 0; +} + + +typedef connectivity::sdbcx::ODescriptor ODescriptor_TYPEDEF; +// ------------------------------------------------------------------------- +//void OAdoColumn::construct() +//{ +// ODescriptor_TYPEDEF::construct(); +// sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY; +// +// registerProperty(PROPERTY_TYPENAME, PROPERTY_ID_TYPENAME, nAttrib,&m_TypeName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); +// registerProperty(PROPERTY_DEFAULTVALUE, PROPERTY_ID_DEFAULTVALUE, nAttrib,&m_DefaultValue, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); +// registerProperty(PROPERTY_PRECISION, PROPERTY_ID_PRECISION, nAttrib,&m_Precision, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); +// registerProperty(PROPERTY_TYPE, PROPERTY_ID_TYPE, nAttrib,&m_Type, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); +// registerProperty(PROPERTY_SCALE, PROPERTY_ID_SCALE, nAttrib,&m_Scale, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); +// registerProperty(PROPERTY_ISNULLABLE, PROPERTY_ID_ISNULLABLE, nAttrib,&m_IsNullable, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); +// registerProperty(PROPERTY_ISAUTOINCREMENT, PROPERTY_ID_ISAUTOINCREMENT, nAttrib,&m_IsAutoIncrement, ::getBooleanCppuType()); +//} +// +void OAdoColumn::setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const Any& rValue + ) + throw (Exception) +{ + if(m_aColumn.IsValid()) + { + + switch(nHandle) + { + case PROPERTY_ID_NAME: + { + ::rtl::OUString aVal; + rValue >>= aVal; + m_aColumn.put_Name(aVal); + } + break; + case PROPERTY_ID_TYPE: + { + sal_Int32 nVal=0; + rValue >>= nVal; + m_aColumn.put_Type(ADOS::MapJdbc2ADOType(nVal)); + } + break; + case PROPERTY_ID_TYPENAME: + // rValue <<= getResultSetType(); + break; + case PROPERTY_ID_PRECISION: + { + sal_Int32 nVal=0; + rValue >>= nVal; + m_aColumn.put_Precision(nVal); + } + break; + case PROPERTY_ID_SCALE: + { + sal_Int32 nVal=0; + rValue >>= nVal; + m_aColumn.put_NumericScale(nVal); + } + break; + case PROPERTY_ID_ISNULLABLE: + { + sal_Bool _b; + rValue >>= _b; + if(_b) + m_aColumn.put_Attributes(adColNullable); + } + break; + case PROPERTY_ID_ISASCENDING: + { + sal_Bool _b; + rValue >>= _b; + m_aColumn.put_SortOrder( _b ? adSortAscending : adSortDescending); + } + break; + case PROPERTY_ID_ISROWVERSION: + break; + case PROPERTY_ID_ISAUTOINCREMENT: + { + ADOProperties* pProps = m_aColumn.get_Properties(); + pProps->AddRef(); + ADOProperty* pProp = NULL; + pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("AutoIncrement")),&pProp); + WpADOProperty aProp(pProp); + if(pProp) + aProp.PutValue(getString(rValue)); + pProps->Release(); + } + break; + case PROPERTY_ID_DESCRIPTION: + { + ADOProperties* pProps = m_aColumn.get_Properties(); + pProps->AddRef(); + ADOProperty* pProp = NULL; + pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("Default")),&pProp); + WpADOProperty aProp(pProp); + if(pProp) + aProp.PutValue(getString(rValue)); + pProps->Release(); + } + break; + case PROPERTY_ID_DEFAULTVALUE: + { + ADOProperties* pProps = m_aColumn.get_Properties(); + pProps->AddRef(); + ADOProperty* pProp = NULL; + pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("Description")),&pProp); + WpADOProperty aProp(pProp); + if(pProp) + aProp.PutValue(getString(rValue)); + pProps->Release(); + } + break; + case PROPERTY_ID_ISCURRENCY: + { + ADOProperties* pProps = m_aColumn.get_Properties(); + pProps->AddRef(); + ADOProperty* pProp = NULL; + pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("Fixed Length")),&pProp); + WpADOProperty aProp(pProp); + if(pProp) + aProp.PutValue(getBOOL(rValue)); + pProps->Release(); + } + break; + } + } +} +// ------------------------------------------------------------------------- +void OAdoColumn::getFastPropertyValue( + Any& rValue, + sal_Int32 nHandle + ) const +{ + if(m_aColumn.IsValid()) + { + switch(nHandle) + { + case PROPERTY_ID_NAME: + rValue <<= m_aColumn.get_Name(); + break; + case PROPERTY_ID_TYPE: + rValue <<= ADOS::MapADOType2Jdbc(m_aColumn.get_Type()); + break; + case PROPERTY_ID_TYPENAME: + // rValue <<= getResultSetType(); + break; + case PROPERTY_ID_PRECISION: + rValue <<= m_aColumn.get_Precision(); + break; + case PROPERTY_ID_SCALE: + rValue <<= m_aColumn.get_NumericScale(); + break; + case PROPERTY_ID_ISNULLABLE: + { + sal_Bool _b = m_aColumn.get_Attributes() == adColNullable; + rValue <<= Any(&_b, ::getBooleanCppuType()); + } + break; + case PROPERTY_ID_ISASCENDING: + { + sal_Bool _b = m_aColumn.get_SortOrder() == adSortAscending; + rValue <<= Any(&_b, ::getBooleanCppuType()); + } + case PROPERTY_ID_ISAUTOINCREMENT: + { + ADOProperties* pProps = m_aColumn.get_Properties(); + pProps->AddRef(); + ADOProperty* pProp = NULL; + pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("AutoIncrement")),&pProp); + WpADOProperty aProp(pProp); + if(pProp) + { + sal_Bool b = aProp.GetValue(); + rValue <<= Any(&b, ::getBooleanCppuType()); + } + pProps->Release(); + } + break; + case PROPERTY_ID_ISROWVERSION: + // rValue <<= getResultSetType(); + break; + case PROPERTY_ID_DESCRIPTION: + { + ADOProperties* pProps = m_aColumn.get_Properties(); + pProps->AddRef(); + ADOProperty* pProp = NULL; + pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("Description")),&pProp); + WpADOProperty aProp(pProp); + if(pProp) + rValue <<= (::rtl::OUString)aProp.GetValue(); + pProps->Release(); + } + break; + case PROPERTY_ID_DEFAULTVALUE: + { + ADOProperties* pProps = m_aColumn.get_Properties(); + pProps->AddRef(); + ADOProperty* pProp = NULL; + pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("Default")),&pProp); + WpADOProperty aProp(pProp); + if(pProp) + rValue <<= (::rtl::OUString)aProp.GetValue(); + pProps->Release(); + } + break; + case PROPERTY_ID_ISCURRENCY: + { + ADOProperties* pProps = m_aColumn.get_Properties(); + pProps->AddRef(); + ADOProperty* pProp = NULL; + pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("Fixed Length")),&pProp); + WpADOProperty aProp(pProp); + if(pProp) + { + sal_Bool bVal = aProp.GetValue(); + rValue <<= Any(&bVal,getBooleanCppuType()); + } + pProps->Release(); + } + break; + } + } +} + + + diff --git a/connectivity/source/drivers/ado/AColumns.cxx b/connectivity/source/drivers/ado/AColumns.cxx new file mode 100644 index 000000000000..bbed8e773114 --- /dev/null +++ b/connectivity/source/drivers/ado/AColumns.cxx @@ -0,0 +1,149 @@ +/************************************************************************* + * + * $RCSfile: AColumns.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_COLUMNS_HXX_ +#include "ado/AColumns.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_COLUMN_HXX_ +#include "ado/AColumn.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif + +using namespace connectivity::ado; +using namespace connectivity; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::container; + +typedef connectivity::sdbcx::OCollection OCollection_TYPE; + +Reference< XNamed > OColumns::createObject(const ::rtl::OUString& _rName) +{ + + ADOColumn* pColumn = NULL; + m_pCollection->get_Item(OLEVariant(_rName),&pColumn); + + Reference< XNamed > xRet = new OAdoColumn(isCaseSensitive(),pColumn); + + return xRet; +} + +// ------------------------------------------------------------------------- +void OColumns::impl_refresh() throw(RuntimeException) +{ + m_pCollection->Refresh(); +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > OColumns::createEmptyObject() +{ + OAdoColumn* pNew = new OAdoColumn(isCaseSensitive()); + return pNew; +} +// ------------------------------------------------------------------------- +// XAppend +void SAL_CALL OColumns::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + + Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY); + if(xTunnel.is()) + { + OAdoColumn* pColumn = (OAdoColumn*)xTunnel->getSomething(OAdoColumn::getUnoTunnelImplementationId()); + m_pCollection->Append(OLEVariant(pColumn->getColumnImpl())); + } + + OCollection_TYPE::appendByDescriptor(descriptor); +} +// ------------------------------------------------------------------------- +// XDrop +void SAL_CALL OColumns::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + + m_pCollection->Delete(OLEVariant(elementName)); + + OCollection_TYPE::dropByName(elementName); +} +// ------------------------------------------------------------------------- +void SAL_CALL OColumns::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + if (index < 0 || index >= getCount()) + throw IndexOutOfBoundsException(); + + m_pCollection->Delete(OLEVariant(index)); + OCollection_TYPE::dropByIndex(index); +} + + diff --git a/connectivity/source/drivers/ado/AConnection.cxx b/connectivity/source/drivers/ado/AConnection.cxx new file mode 100644 index 000000000000..7baf3eed0c05 --- /dev/null +++ b/connectivity/source/drivers/ado/AConnection.cxx @@ -0,0 +1,554 @@ +/************************************************************************* + * + * $RCSfile: AConnection.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_ACONNECTION_HXX_ +#include "ado/AConnection.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_ADATABASEMETADATA_HXX_ +#include "ado/ADatabaseMetaData.hxx" +#endif + +#ifndef _CONNECTIVITY_RESOURCE_HRC_ +#include "Resource.hrc" +#endif +#ifndef _CONNECTIVITY_MODULECONTEXT_HXX_ +#include "ModuleContext.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_ADRIVER_HXX_ +#include "ado/ADriver.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_ASTATEMENT_HXX_ +#include "ado/AStatement.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_ACALLABLESTATEMENT_HXX_ +#include "ado/ACallableStatement.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_APREPAREDSTATEMENT_HXX_ +#include "ado/APreparedStatement.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_TRANSACTIONISOLATION_HPP_ +#include <com/sun/star/sdbc/TransactionIsolation.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif + +using namespace connectivity::ado; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; + +//------------------------------------------------------------------------------ +IMPLEMENT_SERVICE_INFO(OConnection,"com.sun.star.sdbcx.AConnection","com.sun.star.sdbc.Connection"); +// -------------------------------------------------------------------------------- +OConnection::OConnection(const ::rtl::OUString& url, const Sequence< PropertyValue >& info, + ODriver* _pDriver) throw(SQLException, RuntimeException) + : OConnection_BASE(m_aMutex), + OSubComponent<OConnection>((::cppu::OWeakObject*)_pDriver), + m_bClosed(sal_False), + m_xMetaData(NULL), + m_xCatalog(NULL), + m_pDriver(_pDriver), + m_pAdoConnection(NULL), + m_bAutocommit(sal_True) +{ + ModuleContext::AddRef(); + + osl_incrementInterlockedCount( &m_refCount ); + + IClassFactory2* pIUnknown = NULL; + IUnknown *pOuter = NULL; + HRESULT hr; + hr = CoGetClassObject( ADOS::CLSID_ADOCONNECTION_21, + CLSCTX_INPROC_SERVER, + NULL, + IID_IClassFactory2, + (void**)&pIUnknown ); + + if( !FAILED( hr ) ) + { + pIUnknown->AddRef(); + + ADOConnection *pCon = NULL; + hr = pIUnknown->CreateInstanceLic( pOuter, + NULL, + ADOS::IID_ADOCONNECTION_21, + ADOS::GetKeyStr(), + (void**) &pCon); + + if( !FAILED( hr ) ) + { + m_pAdoConnection = new WpADOConnection(pCon); + // Class Factory is no longer needed + + + } + pIUnknown->Release(); + } + + osl_decrementInterlockedCount( &m_refCount ); +} +//----------------------------------------------------------------------------- +OConnection::~OConnection() +{ + delete m_pAdoConnection; + ModuleContext::ReleaseRef(); +} +//----------------------------------------------------------------------------- +void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyValue >& info) +{ + osl_incrementInterlockedCount( &m_refCount ); + + sal_Int32 nLen = url.indexOf(':'); + nLen = url.indexOf(':',nLen+1); + ::rtl::OUString aDSN(url.copy(nLen+1)),aUID,aPWD; + + sal_Int32 nTimeout = 20; + sal_Bool bSilent = sal_True; + const PropertyValue *pBegin = info.getConstArray(); + const PropertyValue *pEnd = pBegin + info.getLength(); + for(;pBegin != pEnd;++pBegin) + { + if(!pBegin->Name.compareToAscii("Timeout")) + pBegin->Value >>= nTimeout; + else if(!pBegin->Name.compareToAscii("Silent")) + pBegin->Value >>= bSilent; + else if(!pBegin->Name.compareToAscii("user")) + pBegin->Value >>= aUID; + else if(!pBegin->Name.compareToAscii("password")) + pBegin->Value >>= aPWD; + } + + if(m_pAdoConnection) + { + if(m_pAdoConnection->Open(aDSN,aUID,aPWD,adConnectUnspecified)) + m_pAdoConnection->PutCommandTimeout(nTimeout); + else + ADOS::ThrowException(*m_pAdoConnection,*this); + if(m_pAdoConnection->get_State() != adStateOpen) + throw SQLException(); + + ADOProperties* pProps=m_pAdoConnection->get_Properties(); + if(pProps) + { + pProps->AddRef(); + ADOProperty* pProp = NULL; + pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("Jet OLEDB:ODBC Parsing")),&pProp); + WpADOProperty aProp(pProp); + if(pProp) + { + aProp.PutValue(OLEVariant(VARIANT_TRUE)); + OLEVariant aVar = aProp.GetValue(); + } + pProps->Release(); + } + //bErg = TRUE; + } + else + throw SQLException(); + + osl_decrementInterlockedCount( &m_refCount ); +} +//----------------------------------------------------------------------------- +void SAL_CALL OConnection::release() throw(RuntimeException) +{ + relase_ChildImpl(); + OConnection_BASE::release(); +} +// -------------------------------------------------------------------------------- +Reference< XStatement > SAL_CALL OConnection::createStatement( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + OStatement* pStmt = new OStatement(this); + Reference< XStatement > xStmt = pStmt; + m_aStatements.push_back(WeakReferenceHelper(*pStmt)); + return pStmt; +} +// -------------------------------------------------------------------------------- +Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + OPreparedStatement* pStmt = new OPreparedStatement(this,m_aTypeInfo,sql); + Reference< XPreparedStatement > xPStmt = pStmt; + m_aStatements.push_back(WeakReferenceHelper(*pStmt)); + return xPStmt; +} +// -------------------------------------------------------------------------------- +Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + OCallableStatement* pStmt = new OCallableStatement(this,m_aTypeInfo,sql); + Reference< XPreparedStatement > xPStmt = pStmt; + m_aStatements.push_back(WeakReferenceHelper(*pStmt)); + return xPStmt; +} +// -------------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OConnection::nativeSQL( const ::rtl::OUString& _sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + ::rtl::OUString sql = _sql; + ADOProperties* pProps=m_pAdoConnection->get_Properties(); + if(pProps) + { + pProps->AddRef(); + ADOProperty* pProp = NULL; + pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("Jet OLEDB:ODBC Parsing")),&pProp); + WpADOProperty aProp(pProp); + if(pProp) + { + pProp->put_Value(OLEVariant(VARIANT_TRUE)); + WpADOCommand aCommand; + aCommand.Create(); + aCommand.put_ActiveConnection((IDispatch*)*m_pAdoConnection); + aCommand.put_CommandText(sql); + sql = aCommand.get_CommandText(); + } + pProps->Release(); + } + + return sql; +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::setAutoCommit( sal_Bool autoCommit ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_bAutocommit = autoCommit; + if(!autoCommit) + m_pAdoConnection->BeginTrans(); + else + m_pAdoConnection->RollbackTrans(); +} +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL OConnection::getAutoCommit( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_bAutocommit; +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::commit( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_pAdoConnection->CommitTrans(); +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::rollback( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_pAdoConnection->RollbackTrans(); +} +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL OConnection::isClosed( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return OConnection_BASE::rBHelper.bDisposed && !m_pAdoConnection->get_State(); +} +// -------------------------------------------------------------------------------- +Reference< XDatabaseMetaData > SAL_CALL OConnection::getMetaData( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(!m_xMetaData.is()) + m_xMetaData = new ODatabaseMetaData(this); + + return m_xMetaData; +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::setReadOnly( sal_Bool readOnly ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_pAdoConnection->put_Mode(adModeRead); + ADOS::ThrowException(*m_pAdoConnection,*this); +} +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL OConnection::isReadOnly( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_pAdoConnection->get_Mode() == adModeRead; +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::setCatalog( const ::rtl::OUString& catalog ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_pAdoConnection->PutDefaultDatabase(catalog); + ADOS::ThrowException(*m_pAdoConnection,*this); +} +// -------------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OConnection::getCatalog( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_pAdoConnection->GetDefaultDatabase(); +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 level ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + IsolationLevelEnum eIso; + switch(level) + { + case TransactionIsolation::NONE: + eIso = adXactUnspecified; + break; + case TransactionIsolation::READ_UNCOMMITTED: + eIso = adXactReadUncommitted; + break; + case TransactionIsolation::READ_COMMITTED: + eIso = adXactReadCommitted; + break; + case TransactionIsolation::REPEATABLE_READ: + eIso = adXactRepeatableRead; + break; + case TransactionIsolation::SERIALIZABLE: + eIso = adXactSerializable; + break; + default: + OSL_ENSHURE(0,"OConnection::setTransactionIsolation invalid level"); + return; + } + m_pAdoConnection->put_IsolationLevel(eIso); + ADOS::ThrowException(*m_pAdoConnection,*this); +} +// -------------------------------------------------------------------------------- +sal_Int32 SAL_CALL OConnection::getTransactionIsolation( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + sal_Int32 nRet = 0; + switch(m_pAdoConnection->get_IsolationLevel()) + { + case adXactUnspecified: + nRet = TransactionIsolation::NONE; + break; + case adXactReadUncommitted: + nRet = TransactionIsolation::READ_UNCOMMITTED; + break; + case adXactReadCommitted: + nRet = TransactionIsolation::READ_COMMITTED; + break; + case adXactRepeatableRead: + nRet = TransactionIsolation::REPEATABLE_READ; + break; + case adXactSerializable: + nRet = TransactionIsolation::SERIALIZABLE; + break; + default: + OSL_ENSHURE(0,"OConnection::setTransactionIsolation invalid level"); + } + ADOS::ThrowException(*m_pAdoConnection,*this); + return nRet; +} +// -------------------------------------------------------------------------------- +Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OConnection::getTypeMap( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return NULL; +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::setTypeMap( const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException) +{ +} +// -------------------------------------------------------------------------------- +// XCloseable +void SAL_CALL OConnection::close( ) throw(SQLException, RuntimeException) +{ + { + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + } + dispose(); +} +// -------------------------------------------------------------------------------- +// XWarningsSupplier +Any SAL_CALL OConnection::getWarnings( ) throw(SQLException, RuntimeException) +{ + return Any(); +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::clearWarnings( ) throw(SQLException, RuntimeException) +{ +} +//-------------------------------------------------------------------- +void OConnection::buildTypeInfo() throw( SQLException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + Reference< XResultSet> xRs = getMetaData ()->getTypeInfo (); + Reference< XRow> xRow(xRs,UNO_QUERY); + // Information for a single SQL type + + // Loop on the result set until we reach end of file + + sal_Bool more = xRs->next (); + while (more) + { + OTypeInfo aInfo; + aInfo.aTypeName = xRow->getString (1); + aInfo.aLiteralPrefix = xRow->getString (4); + aInfo.aLiteralSuffix = xRow->getString (5); + aInfo.aCreateParams = xRow->getString (6); + aInfo.aLocalTypeName = xRow->getString (13); + + aInfo.nPrecision = xRow->getInt (3); + aInfo.nMaximumScale = xRow->getShort (15); + aInfo.nMinimumScale = xRow->getShort (14); + aInfo.nType = xRow->getShort (2); + aInfo.nSearchType = xRow->getShort (9); + aInfo.nNumPrecRadix = xRow->getInt (18); + + aInfo.bCurrency = xRow->getBoolean (11); + aInfo.bAutoIncrement = xRow->getBoolean (12); + aInfo.bNullable = xRow->getBoolean (7) == ColumnValue::NULLABLE; + aInfo.bCaseSensitive = xRow->getBoolean (8); + aInfo.bUnsigned = xRow->getBoolean (10); + + // Now that we have the type info, save it + // in the Hashtable if we don't already have an + // entry for this SQL type. + + m_aTypeInfo.push_back(aInfo); + more = xRs->next (); + } + + // Close the result set/statement. + + Reference< XCloseable>(xRs,UNO_QUERY)->close(); +} +//------------------------------------------------------------------------------ +void OConnection::disposing() +{ + ::osl::MutexGuard aGuard(m_aMutex); + + // m_aTables.disposing(); + for (OWeakRefArray::iterator i = m_aStatements.begin(); m_aStatements.end() != i; ++i) + { + Reference< XComponent > xComp(i->get(), UNO_QUERY); + if (xComp.is()) + xComp->dispose(); + } + m_aStatements.clear(); + + Reference< XComponent > xComp2(m_xCatalog.get(), UNO_QUERY); + if(xComp2.is()) + xComp2->dispose(); + + m_bClosed = sal_True; + m_xMetaData = NULL; + + m_pAdoConnection->Close(); + + dispose_ChildImpl(); + OConnection_BASE::disposing(); +} + + diff --git a/connectivity/source/drivers/ado/ADatabaseMetaData.cxx b/connectivity/source/drivers/ado/ADatabaseMetaData.cxx new file mode 100644 index 000000000000..1484b81cc008 --- /dev/null +++ b/connectivity/source/drivers/ado/ADatabaseMetaData.cxx @@ -0,0 +1,1602 @@ +/************************************************************************* + * + * $RCSfile: ADatabaseMetaData.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADO_ADATABASEMETADATA_HXX_ +#include "ado/ADatabaseMetaData.hxx" +#endif + +#ifndef _CONNECTIVITY_ADO_ADATABASEMETADATARESULTSET_HXX_ +#include "ado/ADatabaseMetaDataResultSet.hxx" +#endif + +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_ +#include <com/sun/star/sdbc/ResultSetType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_ +#include <com/sun/star/sdbc/ResultSetConcurrency.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_TRANSACTIONISOLATION_HPP_ +#include <com/sun/star/sdbc/TransactionIsolation.hpp> +#endif + +#ifndef _CONNECTIVITY_ADO_ADOIMP_HXX_ +#include "ado/adoimp.hxx" +#endif + +using namespace connectivity::ado; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; + +// using namespace connectivity; + +ODatabaseMetaData::ODatabaseMetaData(OConnection* _pCon) + : m_pADOConnection(_pCon->getConnection()) + ,m_pConnection(_pCon) +{ +} +// ------------------------------------------------------------------------- +void ODatabaseMetaData::fillLiterals() throw(SQLException, RuntimeException) +{ + ADORecordset *pRecordset = NULL; + OLEVariant vtEmpty; + vtEmpty.setNoArg(); + m_pADOConnection->OpenSchema(adSchemaDBInfoLiterals,vtEmpty,vtEmpty,&pRecordset); + + ADOS::ThrowException(*m_pADOConnection,*this); + + OSL_ENSHURE(pRecordset,"getMaxSize no resultset!"); + WpADORecordset aRecordset(pRecordset); + + aRecordset.MoveFirst(); + OLEVariant aValue; + sal_Int32 nRet = 0; + LiteralInfo aInfo; + while(!aRecordset.IsAtEOF()) + { + WpOLEAppendCollection<ADOFields, ADOField, WpADOField> aFields(aRecordset.GetFields()); + WpADOField aField(aFields.GetItem(1)); + aInfo.pwszLiteralValue = aField.get_Value(); + aField = aFields.GetItem(5); + aInfo.fSupported = aField.get_Value(); + aField = aFields.GetItem(6); + aInfo.cchMaxLen = aField.get_Value().getUInt32(); + + aField = aFields.GetItem(4); + sal_uInt32 nId = aField.get_Value().getUInt32(); + m_aLiteralInfo[nId] = aInfo; + + aRecordset.MoveNext(); + } + aRecordset.Close(); +} +// ------------------------------------------------------------------------- +sal_Int32 ODatabaseMetaData::getMaxSize(sal_uInt32 _nId) throw(SQLException, RuntimeException) +{ + if(!m_aLiteralInfo.size()) + fillLiterals(); + ::std::map<sal_uInt32,LiteralInfo>::const_iterator aIter = m_aLiteralInfo.find(_nId); + if(aIter != m_aLiteralInfo.end() && (*aIter).second.fSupported) + return ((*aIter).second.cchMaxLen == (-1)) ? 0 : (*aIter).second.cchMaxLen; + return 0; +} +// ------------------------------------------------------------------------- +sal_Bool ODatabaseMetaData::isCapable(sal_uInt32 _nId) throw(SQLException, RuntimeException) +{ + if(!m_aLiteralInfo.size()) + fillLiterals(); + ::std::map<sal_uInt32,LiteralInfo>::const_iterator aIter = m_aLiteralInfo.find(_nId); + if(aIter != m_aLiteralInfo.end()) + (*aIter).second.fSupported; + return sal_False; +} + +// ------------------------------------------------------------------------- +::rtl::OUString ODatabaseMetaData::getLiteral(sal_uInt32 _nId) throw(SQLException, RuntimeException) +{ + if(!m_aLiteralInfo.size()) + fillLiterals(); + ::std::map<sal_uInt32,LiteralInfo>::const_iterator aIter = m_aLiteralInfo.find(_nId); + if(aIter != m_aLiteralInfo.end() && (*aIter).second.fSupported) + return (*aIter).second.pwszLiteralValue; + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +sal_Int32 ODatabaseMetaData::getInt32Property(const ::rtl::OUString& _aProperty) throw(SQLException, RuntimeException) +{ + WpOLEAppendCollection<ADOProperties, ADOProperty, WpADOProperty> aProps(m_pADOConnection->get_Properties()); + ADOS::ThrowException(*m_pADOConnection,*this); + OSL_ENSHURE(aProps.IsValid(),"There are no properties at the connection"); + ADO_PROP(_aProperty); + sal_Int32 nValue(0); + if(!aVar.isNull() && !aVar.isEmpty()) + nValue = aVar; + return nValue; +} + +// ------------------------------------------------------------------------- +sal_Bool ODatabaseMetaData::getBoolProperty(const ::rtl::OUString& _aProperty) throw(SQLException, RuntimeException) +{ + WpOLEAppendCollection<ADOProperties, ADOProperty, WpADOProperty> aProps(m_pADOConnection->get_Properties()); + ADOS::ThrowException(*m_pADOConnection,*this); + OSL_ENSHURE(aProps.IsValid(),"There are no properties at the connection"); + ADO_PROP(_aProperty); + return (!aVar.isNull() && !aVar.isEmpty() ? aVar.getBool() : sal_False); +} +// ------------------------------------------------------------------------- +::rtl::OUString ODatabaseMetaData::getStringProperty(const ::rtl::OUString& _aProperty) throw(SQLException, RuntimeException) +{ + WpOLEAppendCollection<ADOProperties, ADOProperty, WpADOProperty> aProps(m_pADOConnection->get_Properties()); + ADOS::ThrowException(*m_pADOConnection,*this); + OSL_ENSHURE(aProps.IsValid(),"There are no properties at the connection"); + + ADO_PROP(_aProperty); + ::rtl::OUString aValue; + if(!aVar.isNull() && !aVar.isEmpty() && aVar.getType() == VT_BSTR) + aValue = aVar; + + return aValue; +} + +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo( ) throw(SQLException, RuntimeException) +{ + HRESULT hr = S_OK; + // Create elements used in the array + OLEVariant varCriteria[2]; + const int nCrit = sizeof varCriteria / sizeof varCriteria[0]; + // Create SafeArray Bounds and initialize the array + SAFEARRAYBOUND rgsabound[1]; + rgsabound[0].lLbound = 0; + rgsabound[0].cElements = nCrit; + SAFEARRAY *psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); + + sal_Int32 nPos = 0; + SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++; + SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++; + + // Initialize and fill the SafeArray + OLEVariant vsa; + vsa.setArray(psa,VT_VARIANT); + + OLEVariant aEmpty; + aEmpty.setNoArg(); + + ADORecordset *pRec=NULL; + m_pADOConnection->OpenSchema(adSchemaProviderTypes,vsa,aEmpty,&pRec); + ADOS::ThrowException(*m_pADOConnection,*this); + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRec); + pResult->setTypeInfoMap(); + Reference< XResultSet > xRef = pResult; + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs( ) throw(SQLException, RuntimeException) +{ + OLEVariant vtEmpty; + vtEmpty.setNoArg(); + + ADORecordset *pRecordset = NULL; + m_pADOConnection->OpenSchema(adSchemaCatalogs,vtEmpty,vtEmpty,&pRecordset); + ADOS::ThrowException(*m_pADOConnection,*this); + + Reference< XResultSet > xRef = NULL; + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); + pResult->setCatalogsMap(); + xRef = pResult; + + return xRef; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogSeparator( ) throw(SQLException, RuntimeException) +{ + return getLiteral(DBLITERAL_CATALOG_SEPARATOR); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas( ) throw(SQLException, RuntimeException) +{ + OLEVariant vtEmpty; + vtEmpty.setNoArg(); + + ADORecordset *pRecordset = NULL; + m_pADOConnection->OpenSchema(adSchemaSchemata,vtEmpty,vtEmpty,&pRecordset); + ADOS::ThrowException(*m_pADOConnection,*this); + + Reference< XResultSet > xRef = NULL; + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); + pResult->setSchemasMap(); + xRef = pResult; + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, + const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) +{ + // Create elements used in the array + HRESULT hr = S_OK; + SAFEARRAYBOUND rgsabound[1]; + SAFEARRAY *psa = NULL; + OLEVariant varCriteria[4]; + + // Create SafeArray Bounds and initialize the array + rgsabound[0].lLbound = 0; + rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0]; + psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); + + sal_Int32 nPos=0; + if(catalog.hasValue()) + varCriteria[nPos].setString(getString(catalog)); + + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG + if(schema.toChar() != '%') + varCriteria[nPos].setString(schema); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA + + varCriteria[nPos].setString(table); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME + + varCriteria[nPos].setString(columnNamePattern); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// COLUMN_NAME + + OLEVariant vtEmpty; + vtEmpty.setNoArg(); + + // Initialize and fill the SafeArray + OLEVariant vsa; + vsa.setArray(psa,VT_VARIANT); + + ADORecordset *pRecordset = NULL; + m_pADOConnection->OpenSchema(adSchemaColumnPrivileges,vsa,vtEmpty,&pRecordset); + ADOS::ThrowException(*m_pADOConnection,*this); + + Reference< XResultSet > xRef = NULL; + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); + pResult->setColumnPrivilegesMap(); + xRef = pResult; + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, + const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) +{ + // Create elements used in the array + HRESULT hr = S_OK; + SAFEARRAYBOUND rgsabound[1]; + SAFEARRAY *psa = NULL; + OLEVariant varCriteria[4]; + + // Create SafeArray Bounds and initialize the array + rgsabound[0].lLbound = 0; + rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0]; + psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); + + sal_Int32 nPos=0; + if(catalog.hasValue()) + varCriteria[nPos].setString(getString(catalog)); + + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG + if(schemaPattern.toChar() != '%') + varCriteria[nPos].setString(schemaPattern); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA + + if(tableNamePattern.toChar() != '%') + varCriteria[nPos].setString(tableNamePattern); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME + + varCriteria[nPos].setString(columnNamePattern); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// COLUMN_NAME + + OLEVariant vtEmpty; + vtEmpty.setNoArg(); + + // Initialize and fill the SafeArray + OLEVariant vsa; + vsa.setArray(psa,VT_VARIANT); + + ADORecordset *pRecordset = NULL; + m_pADOConnection->OpenSchema(adSchemaColumns,vsa,vtEmpty,&pRecordset); + ADOS::ThrowException(*m_pADOConnection,*this); + + Reference< XResultSet > xRef = NULL; + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); + pResult->setColumnsMap(); + xRef = pResult; + + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( + const Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException) +{ + // Create elements used in the array + HRESULT hr = S_OK; + SAFEARRAYBOUND rgsabound[1]; + SAFEARRAY *psa = NULL; + OLEVariant varCriteria[4]; + + // Create SafeArray Bounds and initialize the array + rgsabound[0].lLbound = 0; + rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0]; + psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); + + sal_Int32 nPos=0; + if(catalog.hasValue()) + varCriteria[nPos].setString(getString(catalog)); + + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG + if(schemaPattern.toChar() != '%') + varCriteria[nPos].setString(schemaPattern); + + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA + if(tableNamePattern.toChar() != '%') + varCriteria[nPos].setString(tableNamePattern); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME + + ::rtl::OUString aTypes,aComma = ::rtl::OUString::createFromAscii(","); + const ::rtl::OUString* pBegin = types.getConstArray(); + const ::rtl::OUString* pEnd = pBegin + types.getLength(); + for(;pBegin != pEnd;++pBegin) + aTypes = aTypes + *pBegin + aComma; + + if(aTypes.getLength()) + varCriteria[nPos].setString(aTypes); + // else + // varCriteria[nPos].setString(::rtl::OUString::createFromAscii("TABLE")); + + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_TYPE + + OLEVariant vtEmpty; + vtEmpty.setNoArg(); + + // Initialize and fill the SafeArray + OLEVariant vsa; + vsa.setArray(psa,VT_VARIANT); + + ADORecordset *pRecordset = NULL; + m_pADOConnection->OpenSchema(adSchemaTables,vsa,vtEmpty,&pRecordset); + ADOS::ThrowException(*m_pADOConnection,*this); + + Reference< XResultSet > xRef = NULL; + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); + pResult->setTablesMap(); + xRef = pResult; + + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns( + const Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) +{ + // Create elements used in the array + HRESULT hr = S_OK; + SAFEARRAYBOUND rgsabound[1]; + SAFEARRAY *psa = NULL; + OLEVariant varCriteria[4]; + + // Create SafeArray Bounds and initialize the array + rgsabound[0].lLbound = 0; + rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0]; + psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); + + sal_Int32 nPos=0; + if(catalog.hasValue()) + varCriteria[nPos].setString(getString(catalog)); + + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG + if(schemaPattern.toChar() != '%') + varCriteria[nPos].setString(schemaPattern); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA + + if(procedureNamePattern.toChar() != '%') + varCriteria[nPos].setString(procedureNamePattern); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME + + if(columnNamePattern.toChar() != '%') + varCriteria[nPos].setString(columnNamePattern); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// COLUMN_NAME + + OLEVariant vtEmpty; + vtEmpty.setNoArg(); + + // Initialize and fill the SafeArray + OLEVariant vsa; + vsa.setArray(psa,VT_VARIANT); + + ADORecordset *pRecordset = NULL; + m_pADOConnection->OpenSchema(adSchemaProcedureParameters,vsa,vtEmpty,&pRecordset); + ADOS::ThrowException(*m_pADOConnection,*this); + + Reference< XResultSet > xRef = NULL; + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); + pResult->setProcedureColumnsMap(); + xRef = pResult; + + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures( + const Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& procedureNamePattern ) throw(SQLException, RuntimeException) +{ + // Create elements used in the array + HRESULT hr = S_OK; + SAFEARRAYBOUND rgsabound[1]; + SAFEARRAY *psa = NULL; + OLEVariant varCriteria[3]; + + // Create SafeArray Bounds and initialize the array + rgsabound[0].lLbound = 0; + rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0]; + psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); + + sal_Int32 nPos=0; + if(catalog.hasValue()) + varCriteria[nPos].setString(getString(catalog)); + + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG + if(schemaPattern.toChar() != '%') + varCriteria[nPos].setString(schemaPattern); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA + + if(procedureNamePattern.toChar() != '%') + varCriteria[nPos].setString(procedureNamePattern); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME + + OLEVariant vtEmpty; + vtEmpty.setNoArg(); + + // Initialize and fill the SafeArray + OLEVariant vsa; + vsa.setArray(psa,VT_VARIANT); + + ADORecordset *pRecordset = NULL; + m_pADOConnection->OpenSchema(adSchemaProcedures,vsa,vtEmpty,&pRecordset); + ADOS::ThrowException(*m_pADOConnection,*this); + + Reference< XResultSet > xRef = NULL; + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); + pResult->setProceduresMap(); + xRef = pResult; + + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getVersionColumns( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + Reference< XResultSet > xRef = NULL; + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(NULL); + xRef = pResult; + return xRef; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException) +{ + return getMaxSize(DBLITERAL_BINARY_LITERAL); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException) +{ + return getInt32Property(::rtl::OUString::createFromAscii("Maximum Row Size")); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException) +{ + return getMaxSize(DBLITERAL_CATALOG_NAME); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException) +{ + return getMaxSize(DBLITERAL_CHAR_LITERAL); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException) +{ + return getMaxSize(DBLITERAL_COLUMN_NAME); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException) +{ + return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in Index")); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException) +{ + return getMaxSize(DBLITERAL_CURSOR_NAME); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException) +{ + return getInt32Property(::rtl::OUString::createFromAscii("Active Sessions")); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException) +{ + return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in Table")); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException) +{ + return getMaxSize(DBLITERAL_TEXT_COMMAND); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException) +{ + return getMaxSize(DBLITERAL_TABLE_NAME); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTablesInSelect( ) throw(SQLException, RuntimeException) +{ + return getInt32Property(::rtl::OUString::createFromAscii("Maximum Tables in SELECT")); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + // Create elements used in the array + HRESULT hr = S_OK; + SAFEARRAYBOUND rgsabound[1]; + SAFEARRAY *psa = NULL; + OLEVariant varCriteria[6]; + + // Create SafeArray Bounds and initialize the array + rgsabound[0].lLbound = 0; + rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0]; + psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); + + sal_Int32 nPos=0; + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME + + if(catalog.hasValue()) + varCriteria[nPos].setString(getString(catalog)); + + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG + if(schema.toChar() != '%') + varCriteria[nPos].setString(schema); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA + + varCriteria[nPos].setString(table); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME + + OLEVariant vtEmpty; + vtEmpty.setNoArg(); + + // Initialize and fill the SafeArray + OLEVariant vsa; + vsa.setArray(psa,VT_VARIANT); + + ADORecordset *pRecordset = NULL; + m_pADOConnection->OpenSchema(adSchemaForeignKeys,vsa,vtEmpty,&pRecordset); + ADOS::ThrowException(*m_pADOConnection,*this); + + Reference< XResultSet > xRef = NULL; + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); + pResult->setCrossReferenceMap(); + xRef = pResult; + + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + // Create elements used in the array + HRESULT hr = S_OK; + SAFEARRAYBOUND rgsabound[1]; + SAFEARRAY *psa = NULL; + OLEVariant varCriteria[6]; + + // Create SafeArray Bounds and initialize the array + rgsabound[0].lLbound = 0; + rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0]; + psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); + + sal_Int32 nPos=0; + if(catalog.hasValue()) + varCriteria[nPos].setString(getString(catalog)); + + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG + if(schema.toChar() != '%') + varCriteria[nPos].setString(schema); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA + + varCriteria[nPos].setString(table); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME + + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME + + OLEVariant vtEmpty; + vtEmpty.setNoArg(); + + // Initialize and fill the SafeArray + OLEVariant vsa; + vsa.setArray(psa,VT_VARIANT); + + ADORecordset *pRecordset = NULL; + m_pADOConnection->OpenSchema(adSchemaForeignKeys,vsa,vtEmpty,&pRecordset); + ADOS::ThrowException(*m_pADOConnection,*this); + + Reference< XResultSet > xRef = NULL; + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); + pResult->setCrossReferenceMap(); + xRef = pResult; + + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + // Create elements used in the array + HRESULT hr = S_OK; + SAFEARRAYBOUND rgsabound[1]; + SAFEARRAY *psa = NULL; + OLEVariant varCriteria[3]; + + // Create SafeArray Bounds and initialize the array + rgsabound[0].lLbound = 0; + rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0]; + psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); + + sal_Int32 nPos=0; + if(catalog.hasValue()) + varCriteria[nPos].setString(getString(catalog)); + + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG + if(schema.toChar() != '%') + varCriteria[nPos].setString(schema); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA + + varCriteria[nPos].setString(table); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME + + + OLEVariant vtEmpty; + vtEmpty.setNoArg(); + + // Initialize and fill the SafeArray + OLEVariant vsa; + vsa.setArray(psa,VT_VARIANT); + + ADORecordset *pRecordset = NULL; + m_pADOConnection->OpenSchema(adSchemaPrimaryKeys,vsa,vtEmpty,&pRecordset); + ADOS::ThrowException(*m_pADOConnection,*this); + + Reference< XResultSet > xRef = NULL; + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); + pResult->setPrimaryKeysMap(); + xRef = pResult; + + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, + sal_Bool unique, sal_Bool approximate ) throw(SQLException, RuntimeException) +{ + // Create elements used in the array + HRESULT hr = S_OK; + SAFEARRAYBOUND rgsabound[1]; + SAFEARRAY *psa = NULL; + OLEVariant varCriteria[5]; + + // Create SafeArray Bounds and initialize the array + rgsabound[0].lLbound = 0; + rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0]; + psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); + + sal_Int32 nPos=0; + if(catalog.hasValue()) + varCriteria[nPos].setString(getString(catalog)); + + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG + if(schema.toChar() != '%') + varCriteria[nPos].setString(schema); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA + + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// INDEX_NAME + + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TYPE + + varCriteria[nPos].setString(table); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME + + OLEVariant vtEmpty; + vtEmpty.setNoArg(); + + // Initialize and fill the SafeArray + OLEVariant vsa; + vsa.setArray(psa,VT_VARIANT); + + ADORecordset *pRecordset = NULL; + m_pADOConnection->OpenSchema(adSchemaIndexes,vsa,vtEmpty,&pRecordset); + ADOS::ThrowException(*m_pADOConnection,*this); + + Reference< XResultSet > xRef = NULL; + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); + pResult->setIndexInfoMap(); + xRef = pResult; + + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getBestRowIdentifier( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope, + sal_Bool nullable ) throw(SQLException, RuntimeException) +{ + Reference< XResultSet > xRef = NULL; + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(NULL); + xRef = pResult; + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException) +{ + // Create elements used in the array + HRESULT hr = S_OK; + SAFEARRAYBOUND rgsabound[1]; + SAFEARRAY *psa = NULL; + OLEVariant varCriteria[5]; + + // Create SafeArray Bounds and initialize the array + rgsabound[0].lLbound = 0; + rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0]; + psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); + + sal_Int32 nPos=0; + if(catalog.hasValue()) + varCriteria[nPos].setString(getString(catalog)); + + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG + if(schemaPattern.toChar() != '%') + varCriteria[nPos].setString(schemaPattern); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA + + if(tableNamePattern.toChar() != '%') + varCriteria[nPos].setString(tableNamePattern); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME + + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// GRANTOR + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// GRANTEE + + OLEVariant vtEmpty; + vtEmpty.setNoArg(); + + // Initialize and fill the SafeArray + OLEVariant vsa; + vsa.setArray(psa,VT_VARIANT); + + ADORecordset *pRecordset = NULL; + m_pADOConnection->OpenSchema(adSchemaTablePrivileges,vsa,vtEmpty,&pRecordset); + ADOS::ThrowException(*m_pADOConnection,*this); + + Reference< XResultSet > xRef = NULL; + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); + pResult->setTablePrivilegesMap(); + xRef = pResult; + + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference( + const Any& primaryCatalog, const ::rtl::OUString& primarySchema, + const ::rtl::OUString& primaryTable, const Any& foreignCatalog, + const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(SQLException, RuntimeException) +{ + // Create elements used in the array + HRESULT hr = S_OK; + SAFEARRAYBOUND rgsabound[1]; + SAFEARRAY *psa = NULL; + OLEVariant varCriteria[6]; + + // Create SafeArray Bounds and initialize the array + rgsabound[0].lLbound = 0; + rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0]; + psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); + + sal_Int32 nPos=0; + if(primaryCatalog.hasValue()) + varCriteria[nPos].setString(getString(primaryCatalog)); + + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG + if(primarySchema.toChar() != '%') + varCriteria[nPos].setString(primarySchema); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA + + varCriteria[nPos].setString(primaryTable); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME + + if(foreignCatalog.hasValue()) + varCriteria[nPos].setString(getString(foreignCatalog)); + + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG + if(foreignSchema.toChar() != '%') + varCriteria[nPos].setString(foreignSchema); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA + + varCriteria[nPos].setString(foreignTable); + hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME + + OLEVariant vtEmpty; + vtEmpty.setNoArg(); + + // Initialize and fill the SafeArray + OLEVariant vsa; + vsa.setArray(psa,VT_VARIANT); + + ADORecordset *pRecordset = NULL; + m_pADOConnection->OpenSchema(adSchemaForeignKeys,vsa,vtEmpty,&pRecordset); + ADOS::ThrowException(*m_pADOConnection,*this); + + Reference< XResultSet > xRef = NULL; + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); + pResult->setCrossReferenceMap(); + xRef = pResult; + + return xRef; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException) +{ + return getBoolProperty(::rtl::OUString::createFromAscii("Maximum Row Size Includes BLOB")); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("Quoted Identifier Case Sensitivity")) & DBPROPVAL_IC_LOWER) == DBPROPVAL_IC_LOWER ; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_LOWER) == DBPROPVAL_IC_LOWER ; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("Quoted Identifier Case Sensitivity")) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED ; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED ; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("Quoted Identifier Case Sensitivity")) & DBPROPVAL_IC_UPPER) == DBPROPVAL_IC_UPPER ; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_UPPER) == DBPROPVAL_IC_UPPER ; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsAlterTableWithAddColumn( ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsAlterTableWithDropColumn( ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException) +{ + return getInt32Property(::rtl::OUString::createFromAscii("Maximum Index Size")); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException) +{ + return getInt32Property(::rtl::OUString::createFromAscii("NULL Concatenation Behavior")) == DBPROPVAL_CB_NON_NULL; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException) +{ + return getStringProperty(::rtl::OUString::createFromAscii("Catalog Term")); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getIdentifierQuoteString( ) throw(SQLException, RuntimeException) +{ + return getLiteral(DBLITERAL_QUOTE_PREFIX); + +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException) +{ + return getStringProperty(::rtl::OUString::createFromAscii("Special Characters")); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException) +{ + return isCapable(DBLITERAL_CORRELATION_NAME); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::isCatalogAtStart( ) throw(SQLException, RuntimeException) +{ + return getInt32Property(::rtl::OUString::createFromAscii("Catalog Location")) == DBPROPVAL_CL_START; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException) +{ + return getInt32Property(::rtl::OUString::createFromAscii("Transaction DDL")) == DBPROPVAL_TC_DDL_IGNORE; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException) +{ + return getInt32Property(::rtl::OUString::createFromAscii("Transaction DDL")) == DBPROPVAL_TC_DDL_COMMIT; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException) +{ + return getInt32Property(::rtl::OUString::createFromAscii("Transaction DDL")) == DBPROPVAL_TC_DML; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException) +{ + return getInt32Property(::rtl::OUString::createFromAscii("Transaction DDL")) == DBPROPVAL_TC_ALL; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException) +{ + return getInt32Property(::rtl::OUString::createFromAscii("Prepare Abort Behavior")) == DBPROPVAL_CB_PRESERVE; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException) +{ + return getInt32Property(::rtl::OUString::createFromAscii("Prepare Commit Behavior")) == DBPROPVAL_CB_PRESERVE; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("Isolation Retention")) & DBPROPVAL_TR_COMMIT) == DBPROPVAL_TR_COMMIT; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("Isolation Retention")) & DBPROPVAL_TR_ABORT) == DBPROPVAL_TR_ABORT; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level ) throw(SQLException, RuntimeException) +{ + sal_Bool bValue(sal_False); + + sal_Int32 nTxn = getInt32Property(::rtl::OUString::createFromAscii("Isolation Levels")); + if(level == TransactionIsolation::NONE) + bValue = sal_True; + else if(level == TransactionIsolation::READ_UNCOMMITTED) + bValue = (nTxn & DBPROPVAL_TI_READUNCOMMITTED) == DBPROPVAL_TI_READUNCOMMITTED; + else if(level == TransactionIsolation::READ_COMMITTED) + bValue = (nTxn & DBPROPVAL_TI_READCOMMITTED) == DBPROPVAL_TI_READCOMMITTED; + else if(level == TransactionIsolation::REPEATABLE_READ) + bValue = (nTxn & DBPROPVAL_TI_REPEATABLEREAD) == DBPROPVAL_TI_REPEATABLEREAD; + else if(level == TransactionIsolation::SERIALIZABLE) + bValue = (nTxn & DBPROPVAL_TI_SERIALIZABLE) == DBPROPVAL_TI_SERIALIZABLE; + + return bValue; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInDataManipulation( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("Schema Usage")) & DBPROPVAL_SU_DML_STATEMENTS) == DBPROPVAL_SU_DML_STATEMENTS; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("SQL Support")) & DBPROPVAL_SQL_ANSI92_FULL) == DBPROPVAL_SQL_ANSI92_FULL; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("SQL Support")) & DBPROPVAL_SQL_ANSI92_ENTRY) == DBPROPVAL_SQL_ANSI92_ENTRY; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("SQL Support")) & DBPROPVAL_SQL_ANSI89_IEF) == DBPROPVAL_SQL_ANSI89_IEF; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("Schema Usage")) & DBPROPVAL_SU_INDEX_DEFINITION) == DBPROPVAL_SU_INDEX_DEFINITION; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInTableDefinitions( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("Schema Usage")) & DBPROPVAL_SU_TABLE_DEFINITION) == DBPROPVAL_SU_TABLE_DEFINITION; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInTableDefinitions( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_TABLE_DEFINITION) == DBPROPVAL_CU_TABLE_DEFINITION; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_INDEX_DEFINITION) == DBPROPVAL_CU_INDEX_DEFINITION; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInDataManipulation( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_DML_STATEMENTS) == DBPROPVAL_CU_DML_STATEMENTS; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException) +{ + return getBoolProperty(::rtl::OUString::createFromAscii("Outer Join Capabilities")); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException) +{ + // Create elements used in the array + Reference< XResultSet > xRef = NULL; + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(NULL); + xRef = pResult; + return xRef; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatements( ) throw(SQLException, RuntimeException) +{ + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException) +{ + return getMaxSize(DBLITERAL_PROCEDURE_NAME); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException) +{ + return getMaxSize(DBLITERAL_SCHEMA_NAME); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException) +{ + return getInt32Property(::rtl::OUString::createFromAscii("Transaction DDL")) == DBPROPVAL_TC_NONE; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException) +{ + return getBoolProperty(::rtl::OUString::createFromAscii("Read-Only Data Source")); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException) +{ + return getInt32Property(::rtl::OUString::createFromAscii("NULL Concatenation Behavior")) == DBPROPVAL_CB_NULL; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException) +{ + return isCapable(DBLITERAL_COLUMN_ALIAS); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException) +{ + return isCapable(DBLITERAL_CORRELATION_NAME); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(SQLException, RuntimeException) +{ + return getBoolProperty(::rtl::OUString::createFromAscii("Rowset Conversions on Command")); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException) +{ + return getBoolProperty(::rtl::OUString::createFromAscii("ORDER BY Columns in Select List")); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException) +{ + return getInt32Property(::rtl::OUString::createFromAscii("GROUP BY Support")) != DBPROPVAL_GB_NOT_SUPPORTED; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException) +{ + return getInt32Property(::rtl::OUString::createFromAscii("GROUP BY Support")) != DBPROPVAL_GB_CONTAINS_SELECT; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException) +{ + return getInt32Property(::rtl::OUString::createFromAscii("GROUP BY Support")) == DBPROPVAL_GB_NO_RELATION; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException) +{ + return isCapable(DBLITERAL_ESCAPE_PERCENT); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException) +{ + return getBoolProperty(::rtl::OUString::createFromAscii("ORDER BY Columns in Select List")); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("NULL Collation Order")) & DBPROPVAL_NC_END) == DBPROPVAL_NC_END; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("NULL Collation Order")) & DBPROPVAL_NC_START) == DBPROPVAL_NC_START; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("NULL Collation Order")) & DBPROPVAL_NC_HIGH) == DBPROPVAL_NC_HIGH; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("NULL Collation Order")) & DBPROPVAL_NC_LOW) == DBPROPVAL_NC_LOW; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("Schema Usage")) & DBPROPVAL_SU_PRIVILEGE_DEFINITION) == DBPROPVAL_SU_PRIVILEGE_DEFINITION; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_PRIVILEGE_DEFINITION) == DBPROPVAL_CU_PRIVILEGE_DEFINITION; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("Subquery Support")) & DBPROPVAL_SQ_CORRELATEDSUBQUERIES) == DBPROPVAL_SQ_CORRELATEDSUBQUERIES; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("Subquery Support")) & DBPROPVAL_SQ_COMPARISON) == DBPROPVAL_SQ_COMPARISON; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("Subquery Support")) & DBPROPVAL_SQ_EXISTS) == DBPROPVAL_SQ_EXISTS; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("Subquery Support")) & DBPROPVAL_SQ_IN) == DBPROPVAL_SQ_IN; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("Subquery Support")) & DBPROPVAL_SQ_QUANTIFIED) == DBPROPVAL_SQ_QUANTIFIED; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("SQL Support")) & DBPROPVAL_SQL_ANSI92_INTERMEDIATE) == DBPROPVAL_SQL_ANSI92_INTERMEDIATE; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getURL( ) throw(SQLException, RuntimeException) +{ + return ::rtl::OUString::createFromAscii("sdbc:ado:")+ m_pADOConnection->GetConnectionString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException) +{ + return getStringProperty(::rtl::OUString::createFromAscii("User Name")); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException) +{ + return getStringProperty(::rtl::OUString::createFromAscii("Provider Friendly Name")); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverVersion( ) throw(SQLException, RuntimeException) +{ + return getStringProperty(::rtl::OUString::createFromAscii("Provider Version")); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException) +{ + return getStringProperty(::rtl::OUString::createFromAscii("DBMS Version")); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException) +{ + return getStringProperty(::rtl::OUString::createFromAscii("DBMS Name")); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException) +{ + return getStringProperty(::rtl::OUString::createFromAscii("Procedure Term")); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException) +{ + return getStringProperty(::rtl::OUString::createFromAscii("Schema Term")); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException) +{ + return 1; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nRet = TransactionIsolation::NONE; + switch(m_pADOConnection->get_IsolationLevel()) + { + case adXactReadCommitted: + nRet = TransactionIsolation::READ_COMMITTED; + break; + case adXactRepeatableRead: + nRet = TransactionIsolation::REPEATABLE_READ; + break; + case adXactSerializable: + nRet = TransactionIsolation::SERIALIZABLE; + break; + case adXactReadUncommitted: + nRet = TransactionIsolation::READ_UNCOMMITTED; + break; + default: + ; + } + return nRet; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException) +{ + return 0; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException) +{ + ADORecordset *pRecordset = NULL; + OLEVariant vtEmpty; + vtEmpty.setNoArg(); + m_pADOConnection->OpenSchema(adSchemaDBInfoKeywords,vtEmpty,vtEmpty,&pRecordset); + ADOS::ThrowException(*m_pADOConnection,*this); + WpADORecordset aRecordset(pRecordset); + + aRecordset.MoveFirst(); + OLEVariant aValue; + ::rtl::OUString aRet,aComma = ::rtl::OUString::createFromAscii(",");; + while(!aRecordset.IsAtEOF()) + { + WpOLEAppendCollection<ADOFields, ADOField, WpADOField> aFields(aRecordset.GetFields()); + WpADOField aField(aFields.GetItem(0)); + aField.get_Value(aValue); + aRet = aRet + aValue + aComma; + aRecordset.MoveNext(); + } + aRecordset.Close(); + return aRet.copy(0,aRet.lastIndexOf(',')); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException) +{ + return getLiteral(DBLITERAL_ESCAPE_PERCENT); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + return aValue.copy(0,aValue.lastIndexOf(',')); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + return aValue; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + return aValue.copy(0,aValue.lastIndexOf(',')); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + return aValue; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("SQL Support")) & DBPROPVAL_SQL_ODBC_EXTENDED) == DBPROPVAL_SQL_ODBC_EXTENDED; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("SQL Support")) & DBPROPVAL_SQL_ODBC_CORE) == DBPROPVAL_SQL_ODBC_CORE; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("SQL Support")) & DBPROPVAL_SQL_ODBC_MINIMUM) == DBPROPVAL_SQL_ODBC_MINIMUM; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException) +{ + return (getInt32Property(::rtl::OUString::createFromAscii("Outer Join Capabilities")) & 0x00000004L) == 0x00000004L; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException) +{ + return supportsFullOuterJoins( ); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException) +{ + return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in Group By")); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException) +{ + return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in Order by")); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException) +{ + return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in Select")); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException) +{ + return getMaxSize(DBLITERAL_USER_NAME); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(SQLException, RuntimeException) +{ +// ADOProperties* pProps = m_pADOConnection->get_Properties(); +// OSL_ENSHURE(pProps,"There are no properties at the connection"); +// if(!pProps) +// return sal_False; +// pProps->AddRef(); +// ADO_PROP("Maximum Row Size"INCLUDESBLOB); +// sal_Bool bValue(sal_False); +// bValue = (!aVar.isNull() && !aVar.isEmpty() ? aVar.getBool() : sal_False); +// pProps->Release(); +// return bValue; + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return ResultSetType::FORWARD_ONLY != setType; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return ResultSetType::FORWARD_ONLY != setType; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return ResultSetType::FORWARD_ONLY != setType; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return ResultSetType::FORWARD_ONLY != setType; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return ResultSetType::FORWARD_ONLY != setType; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return ResultSetType::FORWARD_ONLY != setType; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return ResultSetType::FORWARD_ONLY != setType; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return ResultSetType::FORWARD_ONLY != setType; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return ResultSetType::FORWARD_ONLY != setType; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const Sequence< sal_Int32 >& types ) throw(SQLException, RuntimeException) +{ + Reference< XResultSet > xRef = NULL; + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(NULL); + xRef = pResult; + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XConnection > SAL_CALL ODatabaseMetaData::getConnection( ) throw(SQLException, RuntimeException) +{ + return (Reference< XConnection >)m_pConnection;//new OConnection(m_aConnectionHandle); +} +// ------------------------------------------------------------------------- + + diff --git a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx new file mode 100644 index 000000000000..295029ab8a1f --- /dev/null +++ b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx @@ -0,0 +1,1282 @@ +/************************************************************************* + * + * $RCSfile: ADatabaseMetaDataResultSet.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef _CONNECTIVITY_ADO_ADATABASEMETADATARESULTSET_HXX_ +#include "ado/ADatabaseMetaDataResultSet.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_ADATABASEMETADATARESULTSETMETADATA_HXX_ +#include "ado/ADatabaseMetaDataResultSetMetaData.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_ +#include <com/sun/star/sdbc/KeyRule.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_PROCEDURERESULT_HPP_ +#include <com/sun/star/sdbc/ProcedureResult.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_INDEXTYPE_HPP_ +#include <com/sun/star/sdbc/IndexType.hpp> +#endif +#ifndef _UTL_PROPERTY_HXX_ +#include <unotools/property.hxx> +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_ +#include <com/sun/star/sdbc/ResultSetConcurrency.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_ +#include <com/sun/star/sdbc/ResultSetType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_FETCHDIRECTION_HPP_ +#include <com/sun/star/sdbc/FetchDirection.hpp> +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif + +#include <oledb.h> + + +using namespace connectivity::ado; +using namespace cppu; +//------------------------------------------------------------------------------ +using namespace ::com::sun::star::lang; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; + +// ------------------------------------------------------------------------- +ODatabaseMetaDataResultSet::ODatabaseMetaDataResultSet(ADORecordset* _pRecordSet) : ODatabaseMetaDataResultSet_BASE(m_aMutex) + ,OPropertySetHelper(ODatabaseMetaDataResultSet_BASE::rBHelper) + ,m_aStatement(NULL) + ,m_xMetaData(NULL) + ,m_pRecordSet(_pRecordSet) + ,m_bEOF(sal_False) +{ + osl_incrementInterlockedCount( &m_refCount ); + m_aColMapping.push_back(-1); + if(_pRecordSet) + { + m_pRecordSet->AddRef(); + VARIANT_BOOL bIsAtBOF; + m_pRecordSet->get_BOF(&bIsAtBOF); + m_bOnFirstAfterOpen = !(sal_Bool)bIsAtBOF; + } + else + m_bOnFirstAfterOpen = sal_False; + osl_decrementInterlockedCount( &m_refCount ); + // allocBuffer(); +} + +// ------------------------------------------------------------------------- +ODatabaseMetaDataResultSet::~ODatabaseMetaDataResultSet() +{ + if(m_pRecordSet) + m_pRecordSet->Release(); +} +// ------------------------------------------------------------------------- +void ODatabaseMetaDataResultSet::disposing(void) +{ + OPropertySetHelper::disposing(); + + ::osl::MutexGuard aGuard(m_aMutex); + if(m_pRecordSet) + m_pRecordSet->Close(); + m_aStatement = NULL; + m_xMetaData = NULL; +} +// ------------------------------------------------------------------------- +Any SAL_CALL ODatabaseMetaDataResultSet::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = OPropertySetHelper::queryInterface(rType); + if(!aRet.hasValue()) + aRet = ODatabaseMetaDataResultSet_BASE::queryInterface(rType); + return aRet; +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL ODatabaseMetaDataResultSet::getTypes( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),ODatabaseMetaDataResultSet_BASE::getTypes()); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed ) + throw DisposedException(); + + Reference< XResultSetMetaData > xMeta = getMetaData(); + sal_Int32 nLen = xMeta->getColumnCount(); + sal_Int32 i = 1; + for(;i<=nLen;++i) + if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) : columnName.equalsIgnoreCase(xMeta->getColumnName(i))) + break; + return i; +} +// ------------------------------------------------------------------------- +Reference< ::com::sun::star::io::XInputStream > SAL_CALL ODatabaseMetaDataResultSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + columnIndex = mapColumn(columnIndex); + return NULL; +} +// ------------------------------------------------------------------------- +Reference< ::com::sun::star::io::XInputStream > SAL_CALL ODatabaseMetaDataResultSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + columnIndex = mapColumn(columnIndex); + return NULL; +} + +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaDataResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + columnIndex = mapColumn(columnIndex); + ADO_GETFIELD(columnIndex); + aField.get_Value(m_aValue); return m_aValue; +} +// ------------------------------------------------------------------------- + +sal_Int8 SAL_CALL ODatabaseMetaDataResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + columnIndex = mapColumn(columnIndex); + ADO_GETFIELD(columnIndex); + aField.get_Value(m_aValue); + if(m_aValueRange.size() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end()) + return (*m_aValueRangeIter).second[(sal_Int32)m_aValue]; + else if(m_aStrValueRange.size() && (m_aStrValueRangeIter = m_aStrValueRange.find(columnIndex)) != m_aStrValueRange.end()) + return (*m_aStrValueRangeIter).second[m_aValue]; + return m_aValue; +} +// ------------------------------------------------------------------------- + +Sequence< sal_Int8 > SAL_CALL ODatabaseMetaDataResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + columnIndex = mapColumn(columnIndex); + ADO_GETFIELD(columnIndex); + aField.get_Value(m_aValue); + return m_aValue; +} +// ------------------------------------------------------------------------- + +::com::sun::star::util::Date SAL_CALL ODatabaseMetaDataResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + columnIndex = mapColumn(columnIndex); + ADO_GETFIELD(columnIndex); + aField.get_Value(m_aValue); + return m_aValue; +} +// ------------------------------------------------------------------------- + +double SAL_CALL ODatabaseMetaDataResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + columnIndex = mapColumn(columnIndex); + ADO_GETFIELD(columnIndex); + aField.get_Value(m_aValue); + return m_aValue; +} +// ------------------------------------------------------------------------- + +float SAL_CALL ODatabaseMetaDataResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + columnIndex = mapColumn(columnIndex); + ADO_GETFIELD(columnIndex); + aField.get_Value(m_aValue); + return m_aValue; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + columnIndex = mapColumn(columnIndex); + ADO_GETFIELD(columnIndex); + aField.get_Value(m_aValue); + if(m_aValueRange.size() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end()) + return (*m_aValueRangeIter).second[(sal_Int32)m_aValue]; + else if(m_aStrValueRange.size() && (m_aStrValueRangeIter = m_aStrValueRange.find(columnIndex)) != m_aStrValueRange.end()) + return (*m_aStrValueRangeIter).second[m_aValue]; + return m_aValue; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getRow( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + return 0; +} +// ------------------------------------------------------------------------- + +sal_Int64 SAL_CALL ODatabaseMetaDataResultSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + columnIndex = mapColumn(columnIndex); + ADO_GETFIELD(columnIndex); + return sal_Int64(0); +} +// ------------------------------------------------------------------------- + +Reference< XResultSetMetaData > SAL_CALL ODatabaseMetaDataResultSet::getMetaData( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + if(!m_xMetaData.is()) + m_xMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); + + return m_xMetaData; +} +// ------------------------------------------------------------------------- +Reference< XArray > SAL_CALL ODatabaseMetaDataResultSet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + columnIndex = mapColumn(columnIndex); + return NULL; +} + +// ------------------------------------------------------------------------- + +Reference< XClob > SAL_CALL ODatabaseMetaDataResultSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + columnIndex = mapColumn(columnIndex); + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XBlob > SAL_CALL ODatabaseMetaDataResultSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + columnIndex = mapColumn(columnIndex); + return NULL; +} +// ------------------------------------------------------------------------- + +Reference< XRef > SAL_CALL ODatabaseMetaDataResultSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + columnIndex = mapColumn(columnIndex); + return NULL; +} +// ------------------------------------------------------------------------- + +Any SAL_CALL ODatabaseMetaDataResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + columnIndex = mapColumn(columnIndex); + return Any(); +} +// ------------------------------------------------------------------------- + +sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + columnIndex = mapColumn(columnIndex); + ADO_GETFIELD(columnIndex); + aField.get_Value(m_aValue); + if(m_aValueRange.size() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end()) + return (*m_aValueRangeIter).second[(sal_Int32)m_aValue]; + else if(m_aStrValueRange.size() && (m_aStrValueRangeIter = m_aStrValueRange.find(columnIndex)) != m_aStrValueRange.end()) + return (*m_aStrValueRangeIter).second[m_aValue]; + return m_aValue; +} +// ------------------------------------------------------------------------- + +::rtl::OUString SAL_CALL ODatabaseMetaDataResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + columnIndex = mapColumn(columnIndex); + ADO_GETFIELD(columnIndex); + aField.get_Value(m_aValue); + + if(m_aIntValueRange.size() && (m_aIntValueRangeIter = m_aIntValueRange.find(columnIndex)) != m_aIntValueRange.end()) + return (*m_aIntValueRangeIter).second[m_aValue]; + return m_aValue; +} + +// ------------------------------------------------------------------------- + + +::com::sun::star::util::Time SAL_CALL ODatabaseMetaDataResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + columnIndex = mapColumn(columnIndex); + ADO_GETFIELD(columnIndex); + aField.get_Value(m_aValue); return m_aValue; +} +// ------------------------------------------------------------------------- + + +::com::sun::star::util::DateTime SAL_CALL ODatabaseMetaDataResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + columnIndex = mapColumn(columnIndex); + ADO_GETFIELD(columnIndex); + aField.get_Value(m_aValue); return m_aValue; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isAfterLast( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + sal_Int16 bIsAtEOF; + m_pRecordSet->get_EOF(&bIsAtEOF); + return bIsAtEOF; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isFirst( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + return m_nRowPos == 1; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isLast( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + return sal_True; +} +// ------------------------------------------------------------------------- +void SAL_CALL ODatabaseMetaDataResultSet::beforeFirst( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + if(first()) + previous(); +} +// ------------------------------------------------------------------------- +void SAL_CALL ODatabaseMetaDataResultSet::afterLast( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + if(last()) + next(); + m_bEOF = sal_True; +} +// ------------------------------------------------------------------------- + +void SAL_CALL ODatabaseMetaDataResultSet::close( ) throw(SQLException, RuntimeException) +{ + { + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + } + dispose(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL ODatabaseMetaDataResultSet::first( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(!m_pRecordSet) + return sal_False; + + sal_Bool bRet; + if(bRet = SUCCEEDED(m_pRecordSet->MoveFirst())) + m_nRowPos = 1; + return bRet; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL ODatabaseMetaDataResultSet::last( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed ) + throw DisposedException(); + + return m_pRecordSet ? SUCCEEDED(m_pRecordSet->MoveLast()) : sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaDataResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(first()) + { + OLEVariant aEmpty; + aEmpty.setNoArg(); + sal_Bool bRet = SUCCEEDED(m_pRecordSet->Move(row,aEmpty)); + if(bRet) + m_nRowPos = row; + return bRet; + } + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaDataResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(!m_pRecordSet) + return sal_False; + + OLEVariant aEmpty; + aEmpty.setNoArg(); + sal_Bool bRet = SUCCEEDED(m_pRecordSet->Move(row,aEmpty)); + if(bRet) + m_nRowPos += row; + return bRet; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaDataResultSet::previous( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(!m_pRecordSet) + return sal_False; + + sal_Bool bRet = SUCCEEDED(m_pRecordSet->MovePrevious()); + if(bRet) + --m_nRowPos; + return bRet; +} +// ------------------------------------------------------------------------- +Reference< XInterface > SAL_CALL ODatabaseMetaDataResultSet::getStatement( ) throw(SQLException, RuntimeException) +{ + return m_aStatement.get(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowDeleted( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + RecordStatusEnum eRec; + m_pRecordSet->get_Status((sal_Int32*)&eRec); + return (eRec & adRecDeleted) == adRecDeleted; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowInserted( ) throw(SQLException, RuntimeException) +{ ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + RecordStatusEnum eRec; + m_pRecordSet->get_Status((sal_Int32*)&eRec); + return (eRec & adRecNew) == adRecNew; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowUpdated( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + RecordStatusEnum eRec; + m_pRecordSet->get_Status((sal_Int32*)&eRec); + return (eRec & adRecModified) == adRecModified; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(!m_pRecordSet) + return sal_True; + + sal_Int16 bIsAtBOF; + m_pRecordSet->get_BOF(&bIsAtBOF); + return bIsAtBOF; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL ODatabaseMetaDataResultSet::next( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(!m_pRecordSet) + return sal_False; + + if(m_bOnFirstAfterOpen) + { + m_bOnFirstAfterOpen = sal_False; + return sal_True; + } + else + return SUCCEEDED(m_pRecordSet->MoveNext()); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL ODatabaseMetaDataResultSet::wasNull( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + return m_aValue.isNull(); +} +// ------------------------------------------------------------------------- +void SAL_CALL ODatabaseMetaDataResultSet::refreshRow( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + m_pRecordSet->Resync(adAffectCurrent,adResyncAllValues); +} +// ------------------------------------------------------------------------- + +void SAL_CALL ODatabaseMetaDataResultSet::cancel( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(!m_pRecordSet) + throw SQLException(); + + m_pRecordSet->Cancel(); +} +// ------------------------------------------------------------------------- +void SAL_CALL ODatabaseMetaDataResultSet::clearWarnings( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- +Any SAL_CALL ODatabaseMetaDataResultSet::getWarnings( ) throw(SQLException, RuntimeException) +{ + return Any(); +} +//------------------------------------------------------------------------------ +sal_Int32 ODatabaseMetaDataResultSet::getResultSetConcurrency() const +{ + return ResultSetConcurrency::READ_ONLY; +} +//------------------------------------------------------------------------------ +sal_Int32 ODatabaseMetaDataResultSet::getResultSetType() const +{ + return ResultSetType::FORWARD_ONLY; +} +//------------------------------------------------------------------------------ +sal_Int32 ODatabaseMetaDataResultSet::getFetchDirection() const +{ + return FetchDirection::FORWARD; +} +//------------------------------------------------------------------------------ +sal_Int32 ODatabaseMetaDataResultSet::getFetchSize() const +{ + sal_Int32 nValue=-1; + if(m_pRecordSet) + m_pRecordSet->get_CacheSize(&nValue); + return nValue; +} +//------------------------------------------------------------------------------ +::rtl::OUString ODatabaseMetaDataResultSet::getCursorName() const +{ + return ::rtl::OUString(); +} + +//------------------------------------------------------------------------------ +void ODatabaseMetaDataResultSet::setFetchDirection(sal_Int32 _par0) +{ +} +//------------------------------------------------------------------------------ +void ODatabaseMetaDataResultSet::setFetchSize(sal_Int32 _par0) +{ + if(m_pRecordSet) + m_pRecordSet->put_CacheSize(_par0); +} +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper* ODatabaseMetaDataResultSet::createArrayHelper( ) const +{ + + Sequence< com::sun::star::beans::Property > aProps(5); + com::sun::star::beans::Property* pProperties = aProps.getArray(); + sal_Int32 nPos = 0; + DECL_PROP0(CURSORNAME, ::rtl::OUString); + DECL_PROP0(FETCHDIRECTION, sal_Int32); + DECL_PROP0(FETCHSIZE, sal_Int32); + DECL_PROP0(RESULTSETCONCURRENCY,sal_Int32); + DECL_PROP0(RESULTSETTYPE, sal_Int32); + + return new ::cppu::OPropertyArrayHelper(aProps); +} +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper & ODatabaseMetaDataResultSet::getInfoHelper() +{ + return *const_cast<ODatabaseMetaDataResultSet*>(this)->getArrayHelper(); +} +// ------------------------------------------------------------------------- +sal_Bool ODatabaseMetaDataResultSet::convertFastPropertyValue( + Any & rConvertedValue, + Any & rOldValue, + sal_Int32 nHandle, + const Any& rValue ) + throw (::com::sun::star::lang::IllegalArgumentException) +{ + switch(nHandle) + { + case PROPERTY_ID_CURSORNAME: + case PROPERTY_ID_RESULTSETCONCURRENCY: + case PROPERTY_ID_RESULTSETTYPE: + throw ::com::sun::star::lang::IllegalArgumentException(); + break; + case PROPERTY_ID_FETCHDIRECTION: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection()); + case PROPERTY_ID_FETCHSIZE: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize()); + default: + ; + } + return sal_False; +} +// ------------------------------------------------------------------------- +void ODatabaseMetaDataResultSet::setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const Any& rValue + ) + throw (Exception) +{ + switch(nHandle) + { + case PROPERTY_ID_CURSORNAME: + case PROPERTY_ID_RESULTSETCONCURRENCY: + case PROPERTY_ID_RESULTSETTYPE: + case PROPERTY_ID_FETCHDIRECTION: + case PROPERTY_ID_FETCHSIZE: + throw Exception(); + break; + default: + OSL_ENSHURE(0,"setFastPropertyValue_NoBroadcast: Illegal handle value!"); + } +} +// ------------------------------------------------------------------------- +void ODatabaseMetaDataResultSet::getFastPropertyValue( + Any& rValue, + sal_Int32 nHandle + ) const +{ + switch(nHandle) + { + case PROPERTY_ID_CURSORNAME: + rValue <<= getCursorName(); + break; + case PROPERTY_ID_RESULTSETCONCURRENCY: + rValue <<= getResultSetConcurrency(); + break; + case PROPERTY_ID_RESULTSETTYPE: + rValue <<= getResultSetType(); + break; + case PROPERTY_ID_FETCHDIRECTION: + rValue <<= getFetchDirection(); + break; + case PROPERTY_ID_FETCHSIZE: + rValue <<= getFetchSize(); + break; + } +} +// ------------------------------------------------------------------------- +void ODatabaseMetaDataResultSet::setProceduresMap() +{ + + for(sal_Int32 i=1;i<4;i++) + m_aColMapping.push_back(i); + m_aColMapping.push_back(5); + m_aColMapping.push_back(7); + m_aColMapping.push_back(8); + m_aColMapping.push_back(6); + m_aColMapping.push_back(4); + + ::std::map<sal_Int32,sal_Int32> aMap; + aMap[DB_PT_UNKNOWN] = ProcedureResult::UNKNOWN; + aMap[DB_PT_PROCEDURE] = ProcedureResult::NONE; + aMap[DB_PT_FUNCTION] = ProcedureResult::RETURN; + m_aValueRange[4] = aMap; + + ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); + pMetaData->setProceduresMap(); + m_xMetaData = pMetaData; +} +// ------------------------------------------------------------------------- +void ODatabaseMetaDataResultSet::setCatalogsMap() +{ + m_aColMapping.push_back(1); + + m_xMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); +} +// ------------------------------------------------------------------------- +void ODatabaseMetaDataResultSet::setSchemasMap() +{ + m_aColMapping.push_back(2); + + m_xMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); +} +// ------------------------------------------------------------------------- +void ODatabaseMetaDataResultSet::setColumnPrivilegesMap() +{ + + m_aColMapping.push_back(3); + m_aColMapping.push_back(4); + m_aColMapping.push_back(5); + m_aColMapping.push_back(6); + m_aColMapping.push_back(2); + m_aColMapping.push_back(9); + m_aColMapping.push_back(10); + + ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); + pMetaData->setColumnPrivilegesMap(); + m_xMetaData = pMetaData; +} +// ------------------------------------------------------------------------- +void ODatabaseMetaDataResultSet::setColumnsMap() +{ + + for(sal_Int32 i=1;i<5;++i) + m_aColMapping.push_back(i); + + m_aColMapping.push_back(12); + m_aColMapping.push_back(12); // is used as TYPE_NAME + + m_aColMapping.push_back(14); + m_aColMapping.push_back(6); + m_aColMapping.push_back(17); + m_aColMapping.push_back(18); + + m_aColMapping.push_back(11); + m_aColMapping.push_back(29); + m_aColMapping.push_back(9); + m_aColMapping.push_back(18); + m_aColMapping.push_back(18); + + m_aColMapping.push_back(15); + m_aColMapping.push_back(7); + m_aColMapping.push_back(11); + + ::std::map<sal_Int32,sal_Int32> aMap; + aMap[DBTYPE_EMPTY] = DataType::SQLNULL; + aMap[DBTYPE_NULL] = DataType::SQLNULL; + aMap[DBTYPE_I2] = DataType::SMALLINT; + aMap[DBTYPE_I4] = DataType::INTEGER; + aMap[DBTYPE_R4] = DataType::FLOAT; + aMap[DBTYPE_R8] = DataType::DOUBLE; + aMap[DBTYPE_CY] = DataType::BIGINT; + aMap[DBTYPE_DATE] = DataType::DATE; + aMap[DBTYPE_BSTR] = DataType::VARCHAR; + aMap[DBTYPE_IDISPATCH] = DataType::OBJECT; + aMap[DBTYPE_ERROR] = DataType::OTHER; + aMap[DBTYPE_BOOL] = DataType::BIT; + aMap[DBTYPE_VARIANT] = DataType::STRUCT; + aMap[DBTYPE_IUNKNOWN] = DataType::OTHER; + aMap[DBTYPE_DECIMAL] = DataType::DECIMAL; + aMap[DBTYPE_UI1] = DataType::TINYINT; + aMap[DBTYPE_ARRAY] = DataType::ARRAY; + aMap[DBTYPE_BYREF] = DataType::REF; + aMap[DBTYPE_I1] = DataType::CHAR; + aMap[DBTYPE_UI2] = DataType::SMALLINT; + aMap[DBTYPE_UI4] = DataType::INTEGER; + + // aMap[The] = ; + // aMap[in] = ; + aMap[DBTYPE_I8] = DataType::BIGINT; + aMap[DBTYPE_UI8] = DataType::BIGINT; + aMap[DBTYPE_GUID] = DataType::OTHER; + aMap[DBTYPE_VECTOR] = DataType::OTHER; + aMap[DBTYPE_FILETIME] = DataType::OTHER; + aMap[DBTYPE_RESERVED] = DataType::OTHER; + + // aMap[The] = ; + aMap[DBTYPE_BYTES] = DataType::VARBINARY; + aMap[DBTYPE_STR] = DataType::LONGVARCHAR; + aMap[DBTYPE_WSTR] = DataType::LONGVARCHAR; + aMap[DBTYPE_NUMERIC] = DataType::NUMERIC; + aMap[DBTYPE_UDT] = DataType::OTHER; + aMap[DBTYPE_DBDATE] = DataType::DATE; + aMap[DBTYPE_DBTIME] = DataType::TIME; + aMap[DBTYPE_DBTIMESTAMP] = DataType::TIMESTAMP; + aMap[DBTYPE_HCHAPTER] = DataType::OTHER; + aMap[DBTYPE_PROPVARIANT] = DataType::OTHER; + aMap[DBTYPE_VARNUMERIC] = DataType::NUMERIC; + + m_aValueRange[12] = aMap; + + ::std::map< sal_Int32,::rtl::OUString> aMap2; + aMap2[0] = ::rtl::OUString::createFromAscii("YES"); + aMap2[1] = ::rtl::OUString::createFromAscii("NO"); + m_aIntValueRange[18] = aMap2; + + ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); + pMetaData->setColumnsMap(); + m_xMetaData = pMetaData; +} +// ------------------------------------------------------------------------- +void ODatabaseMetaDataResultSet::setTablesMap() +{ + + for(sal_Int32 i=1;i<5;i++) + m_aColMapping.push_back(i); + m_aColMapping.push_back(6); + + ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); + pMetaData->setTablesMap(); + m_xMetaData = pMetaData; +} +// ------------------------------------------------------------------------- +void ODatabaseMetaDataResultSet::setProcedureColumnsMap() +{ + + for(sal_Int32 i=1;i<5;i++) + m_aColMapping.push_back(i); + m_aColMapping.push_back(6); + m_aColMapping.push_back(10); + m_aColMapping.push_back(16); + m_aColMapping.push_back(13); + m_aColMapping.push_back(11); + m_aColMapping.push_back(12); + + m_aColMapping.push_back(9); + m_aColMapping.push_back(14); + + ::std::map<sal_Int32,sal_Int32> aMap; + aMap[DBTYPE_EMPTY] = DataType::SQLNULL; + aMap[DBTYPE_NULL] = DataType::SQLNULL; + aMap[DBTYPE_I2] = DataType::SMALLINT; + aMap[DBTYPE_I4] = DataType::INTEGER; + aMap[DBTYPE_R4] = DataType::FLOAT; + aMap[DBTYPE_R8] = DataType::DOUBLE; + aMap[DBTYPE_CY] = DataType::BIGINT; + aMap[DBTYPE_DATE] = DataType::DATE; + aMap[DBTYPE_BSTR] = DataType::VARCHAR; + aMap[DBTYPE_IDISPATCH] = DataType::OBJECT; + aMap[DBTYPE_ERROR] = DataType::OTHER; + aMap[DBTYPE_BOOL] = DataType::BIT; + aMap[DBTYPE_VARIANT] = DataType::STRUCT; + aMap[DBTYPE_IUNKNOWN] = DataType::OTHER; + aMap[DBTYPE_DECIMAL] = DataType::DECIMAL; + aMap[DBTYPE_UI1] = DataType::TINYINT; + aMap[DBTYPE_ARRAY] = DataType::ARRAY; + aMap[DBTYPE_BYREF] = DataType::REF; + aMap[DBTYPE_I1] = DataType::CHAR; + aMap[DBTYPE_UI2] = DataType::SMALLINT; + aMap[DBTYPE_UI4] = DataType::INTEGER; + + // aMap[The] = ; + // aMap[in] = ; + aMap[DBTYPE_I8] = DataType::BIGINT; + aMap[DBTYPE_UI8] = DataType::BIGINT; + aMap[DBTYPE_GUID] = DataType::OTHER; + aMap[DBTYPE_VECTOR] = DataType::OTHER; + aMap[DBTYPE_FILETIME] = DataType::OTHER; + aMap[DBTYPE_RESERVED] = DataType::OTHER; + + // aMap[The] = ; + aMap[DBTYPE_BYTES] = DataType::VARBINARY; + aMap[DBTYPE_STR] = DataType::LONGVARCHAR; + aMap[DBTYPE_WSTR] = DataType::LONGVARCHAR; + aMap[DBTYPE_NUMERIC] = DataType::NUMERIC; + aMap[DBTYPE_UDT] = DataType::OTHER; + aMap[DBTYPE_DBDATE] = DataType::DATE; + aMap[DBTYPE_DBTIME] = DataType::TIME; + aMap[DBTYPE_DBTIMESTAMP] = DataType::TIMESTAMP; + aMap[DBTYPE_HCHAPTER] = DataType::OTHER; + aMap[DBTYPE_PROPVARIANT] = DataType::OTHER; + aMap[DBTYPE_VARNUMERIC] = DataType::NUMERIC; + + m_aValueRange[10] = aMap; + + ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); + pMetaData->setProcedureColumnsMap(); + m_xMetaData = pMetaData; +} +// ------------------------------------------------------------------------- +void ODatabaseMetaDataResultSet::setPrimaryKeysMap() +{ + + sal_Int32 i=1; + for(;i<5;i++) + m_aColMapping.push_back(i); + m_aColMapping.push_back(7); + m_aColMapping.push_back(8); + + ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); + pMetaData->setProcedureColumnsMap(); + m_xMetaData = pMetaData; +} +// ------------------------------------------------------------------------- +void ODatabaseMetaDataResultSet::setIndexInfoMap() +{ + + sal_Int32 i=1; + for(;i<4;i++) + m_aColMapping.push_back(i); + m_aColMapping.push_back(8); + m_aColMapping.push_back(4); + m_aColMapping.push_back(6); + m_aColMapping.push_back(10); + m_aColMapping.push_back(17); + m_aColMapping.push_back(18); + m_aColMapping.push_back(21); + m_aColMapping.push_back(22); + m_aColMapping.push_back(23); + m_aColMapping.push_back(24); + + ::std::map<sal_Int32,sal_Int32> aMap; + aMap[DBPROPVAL_IT_HASH] = IndexType::HASHED; + aMap[DBPROPVAL_IT_CONTENT] = IndexType::OTHER; + aMap[DBPROPVAL_IT_OTHER] = IndexType::OTHER; + aMap[DBPROPVAL_IT_BTREE] = IndexType::OTHER; + + m_aValueRange[10] = aMap; + + ::std::map<sal_Int32,sal_Int32> aMap2; + aMap[0] = 1; + aMap[1] = 0; + m_aValueRange[8] = aMap2; + + ::std::map< sal_Int32,::rtl::OUString> aMap3; + aMap3[0] = ::rtl::OUString(); + aMap3[DB_COLLATION_ASC] = ::rtl::OUString::createFromAscii("A"); + aMap3[DB_COLLATION_DESC] = ::rtl::OUString::createFromAscii("D"); + + m_aIntValueRange[21] = aMap3; + + ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); + pMetaData->setIndexInfoMap(); + m_xMetaData = pMetaData; +} +// ------------------------------------------------------------------------- +void ODatabaseMetaDataResultSet::setTablePrivilegesMap() +{ + + sal_Int32 i=3; + for(;i<6;i++) + m_aColMapping.push_back(i); + m_aColMapping.push_back(1); + m_aColMapping.push_back(2); + m_aColMapping.push_back(6); + m_aColMapping.push_back(7); + + ::std::map< sal_Int32,::rtl::OUString> aMap; + aMap[0] = ::rtl::OUString::createFromAscii("YES"); + aMap[1] = ::rtl::OUString::createFromAscii("NO"); + m_aIntValueRange[7] = aMap; + + + ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); + pMetaData->setTablePrivilegesMap(); + m_xMetaData = pMetaData; +} +// ------------------------------------------------------------------------- +void ODatabaseMetaDataResultSet::setCrossReferenceMap() +{ + + sal_Int32 i=1; + for(;i<5;i++) + m_aColMapping.push_back(i); + for(i=7;i<11;i++) + m_aColMapping.push_back(i); + + m_aColMapping.push_back(13); + m_aColMapping.push_back(14); + m_aColMapping.push_back(15); + m_aColMapping.push_back(17); + m_aColMapping.push_back(16); + m_aColMapping.push_back(18); + + ::std::map< ::rtl::OUString,sal_Int32> aMap; + aMap[ ::rtl::OUString::createFromAscii("CASCADE")] = KeyRule::CASCADE; + aMap[ ::rtl::OUString::createFromAscii("RESTRICT")] = KeyRule::RESTRICT; + aMap[ ::rtl::OUString::createFromAscii("SET NULL")] = KeyRule::SET_NULL; + aMap[ ::rtl::OUString::createFromAscii("SET DEFAULT")] = KeyRule::SET_DEFAULT; + aMap[ ::rtl::OUString::createFromAscii("NO ACTION")] = KeyRule::NO_ACTION; + + m_aStrValueRange[14] = aMap; + m_aStrValueRange[15] = aMap; + + ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); + pMetaData->setCrossReferenceMap(); + m_xMetaData = pMetaData; +} +// ------------------------------------------------------------------------- +void ODatabaseMetaDataResultSet::setTypeInfoMap() +{ + sal_Int32 i=1; + for(;i<19;i++) + m_aColMapping.push_back(i); + + ::std::map< ::rtl::OUString,sal_Int32> aMap1; + aMap1[ ::rtl::OUString()] = 10; + + m_aStrValueRange[18] = aMap1; + + ::std::map<sal_Int32,sal_Int32> aMap; + aMap[DBTYPE_EMPTY] = DataType::SQLNULL; + aMap[DBTYPE_NULL] = DataType::SQLNULL; + aMap[DBTYPE_I2] = DataType::SMALLINT; + aMap[DBTYPE_I4] = DataType::INTEGER; + aMap[DBTYPE_R4] = DataType::FLOAT; + aMap[DBTYPE_R8] = DataType::DOUBLE; + aMap[DBTYPE_CY] = DataType::BIGINT; + aMap[DBTYPE_DATE] = DataType::DATE; + aMap[DBTYPE_BSTR] = DataType::VARCHAR; + aMap[DBTYPE_IDISPATCH] = DataType::OBJECT; + aMap[DBTYPE_ERROR] = DataType::OTHER; + aMap[DBTYPE_BOOL] = DataType::BIT; + aMap[DBTYPE_VARIANT] = DataType::STRUCT; + aMap[DBTYPE_IUNKNOWN] = DataType::OTHER; + aMap[DBTYPE_DECIMAL] = DataType::DECIMAL; + aMap[DBTYPE_UI1] = DataType::TINYINT; + aMap[DBTYPE_ARRAY] = DataType::ARRAY; + aMap[DBTYPE_BYREF] = DataType::REF; + aMap[DBTYPE_I1] = DataType::CHAR; + aMap[DBTYPE_UI2] = DataType::SMALLINT; + aMap[DBTYPE_UI4] = DataType::INTEGER; + + // aMap[The] = ; + // aMap[in] = ; + aMap[DBTYPE_I8] = DataType::BIGINT; + aMap[DBTYPE_UI8] = DataType::BIGINT; + aMap[DBTYPE_GUID] = DataType::OTHER; + aMap[DBTYPE_VECTOR] = DataType::OTHER; + aMap[DBTYPE_FILETIME] = DataType::OTHER; + aMap[DBTYPE_RESERVED] = DataType::OTHER; + + // aMap[The] = ; + aMap[DBTYPE_BYTES] = DataType::VARBINARY; + aMap[DBTYPE_STR] = DataType::LONGVARCHAR; + aMap[DBTYPE_WSTR] = DataType::LONGVARCHAR; + aMap[DBTYPE_NUMERIC] = DataType::NUMERIC; + aMap[DBTYPE_UDT] = DataType::OTHER; + aMap[DBTYPE_DBDATE] = DataType::DATE; + aMap[DBTYPE_DBTIME] = DataType::TIME; + aMap[DBTYPE_DBTIMESTAMP] = DataType::TIMESTAMP; + aMap[DBTYPE_HCHAPTER] = DataType::OTHER; + aMap[DBTYPE_PROPVARIANT] = DataType::OTHER; + aMap[DBTYPE_VARNUMERIC] = DataType::NUMERIC; + + m_aValueRange[2] = aMap; + + ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); + pMetaData->setTypeInfoMap(); + m_xMetaData = pMetaData; +} + diff --git a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx new file mode 100644 index 000000000000..ede0a0d5be02 --- /dev/null +++ b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx @@ -0,0 +1,515 @@ +/************************************************************************* + * + * $RCSfile: ADatabaseMetaDataResultSetMetaData.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_ADATABASEMETADATARESULTSETMETADATA_HXX_ +#include "ado/ADatabaseMetaDataResultSetMetaData.hxx" +#endif + +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_PROCEDURERESULT_HPP_ +#include <com/sun/star/sdbc/ProcedureResult.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif + +#ifndef _CONNECTIVITY_ADO_AWRAPADO_HXX_ +#include "ado/Awrapado.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif + +using namespace connectivity; +using namespace connectivity::ado; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; + +// ------------------------------------------------------------------------- +ODatabaseMetaDataResultSetMetaData::~ODatabaseMetaDataResultSetMetaData() +{ + if(m_pRecordSet) + m_pRecordSet->Release(); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) + return (*m_mColumnsIter).second.getColumnDisplaySize(); + + if(!m_pRecordSet) + return 0; + ADO_GETFIELD(m_vMapping[column]); + if(aField.IsValid()) + return aField.GetActualSize(); + return 0; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) + return (*m_mColumnsIter).second.getColumnType(); + if(!m_pRecordSet) + return 0; + ADO_GETFIELD(m_vMapping[column]); + return MapADOType2Jdbc(aField.GetADOType()); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException) +{ + if(!m_pRecordSet) + return 0; + if(m_nColCount != -1) + return m_nColCount; + + if(m_vMapping.size()) + return m_mColumns.size(); + + ADOFields* pFields = NULL; + m_pRecordSet->get_Fields(&pFields); + WpOLEAppendCollection<ADOFields, ADOField, WpADOField> aFields(pFields); + m_nColCount = aFields.GetItemCount(); + return m_nColCount; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) + return (*m_mColumnsIter).second.isCaseSensitive(); + return sal_True; +} +// ------------------------------------------------------------------------- + +::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getSchemaName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) + return (*m_mColumnsIter).second.getSchemaName(); + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- + +::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) + return (*m_mColumnsIter).second.getColumnName(); + if(!m_pRecordSet) + return ::rtl::OUString(); + ADO_GETFIELD(m_vMapping[column]); + if(aField.IsValid()) + return aField.GetName(); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) + return (*m_mColumnsIter).second.getTableName(); + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getCatalogName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) + return (*m_mColumnsIter).second.getCatalogName(); + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) + return (*m_mColumnsIter).second.getColumnTypeName(); + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) + return (*m_mColumnsIter).second.getColumnLabel(); + return getColumnName(column); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnServiceName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) + return (*m_mColumnsIter).second.getColumnServiceName(); + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) + return (*m_mColumnsIter).second.isCurrency(); + if(!m_pRecordSet) + return 0; + ADO_GETFIELD(m_vMapping[column]); + if(aField.IsValid()) + { + return (aField.GetAttributes() & adFldFixed) == adFldFixed; + } + return sal_False; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) + return (*m_mColumnsIter).second.isAutoIncrement(); + return sal_False; +} +// ------------------------------------------------------------------------- + + +sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) + return (*m_mColumnsIter).second.isSigned(); + if(!m_pRecordSet) + return 0; + ADO_GETFIELD(m_vMapping[column]); + if(aField.IsValid()) + { + return (aField.GetAttributes() & adFldNegativeScale) == adFldNegativeScale; + } + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) + return (*m_mColumnsIter).second.getPrecision(); + if(!m_pRecordSet) + return 0; + ADO_GETFIELD(m_vMapping[column]); + if(aField.IsValid()) + return aField.GetPrecision(); + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) + return (*m_mColumnsIter).second.getScale(); + + if(!m_pRecordSet) + return 0; + + ADO_GETFIELD(m_vMapping[column]); + if(aField.IsValid()) + return aField.GetNumericScale(); + return 0; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) + return (*m_mColumnsIter).second.isNullable(); + + if(!m_pRecordSet) + return 0; + + ADO_GETFIELD(m_vMapping[column]); + if(aField.IsValid()) + { + return (aField.GetAttributes() & adFldIsNullable) == adFldIsNullable; + } + return sal_False; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) + return (*m_mColumnsIter).second.isSearchable(); + return sal_True; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) + return (*m_mColumnsIter).second.isReadOnly(); + + if(!m_pRecordSet) + return 0; + + ADO_GETFIELD(m_vMapping[column]); + if(aField.IsValid()) + { + // return (aField.GetStatus() & adFieldReadOnly) == adFieldReadOnly; + } + return sal_False; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) + return (*m_mColumnsIter).second.isDefinitelyWritable(); + + if(!m_pRecordSet) + return 0; + + ADO_GETFIELD(m_vMapping[column]); + if(aField.IsValid()) + { + return (aField.GetAttributes() & adFldUpdatable) == adFldUpdatable; + } + return sal_False; +; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + if(m_mColumns.size() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end()) + return (*m_mColumnsIter).second.isWritable(); + return isDefinitelyWritable(column); +} +// ------------------------------------------------------------------------- +sal_Int32 ODatabaseMetaDataResultSetMetaData::MapADOType2Jdbc(DataTypeEnum eType) +{ + switch (eType) + { + case adUnsignedSmallInt: + case adSmallInt: return DataType::SMALLINT; break; + case adUnsignedInt: + case adInteger: return DataType::INTEGER; break; + case adUnsignedBigInt: + case adBigInt: return DataType::BIGINT; break; + case adSingle: return DataType::FLOAT; break; + case adDouble: return DataType::DOUBLE; break; + case adCurrency: return DataType::DOUBLE; break; + case adVarNumeric: + case adNumeric: return DataType::NUMERIC; break; + case adDecimal: return DataType::DECIMAL; break; + case adDate: + case adDBDate: return DataType::DATE; break; + case adDBTime: return DataType::TIME; break; + case adDBTimeStamp: return DataType::TIMESTAMP; break; + case adBoolean: return DataType::BIT; break; + case adBinary: + case adGUID: return DataType::BINARY; break; + case adBSTR: + case adVarWChar: + case adVarChar: return DataType::VARCHAR; break; + case adLongVarWChar: + case adLongVarChar: return DataType::LONGVARCHAR; break; + case adVarBinary: return DataType::VARBINARY; break; + case adLongVarBinary: return DataType::LONGVARBINARY; break; + case adWChar: + case adChar: return DataType::CHAR; break; + case adUnsignedTinyInt: + case adTinyInt: return DataType::TINYINT; break; + default: + ; + } +} +// ------------------------------------------------------------------------- +void ODatabaseMetaDataResultSetMetaData::setColumnPrivilegesMap() +{ + m_mColumns[8] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("IS_GRANTABLE"), + ColumnValue::NULLABLE, + 3,3,0, + DataType::VARCHAR); +} +// ------------------------------------------------------------------------- +void ODatabaseMetaDataResultSetMetaData::setColumnsMap() +{ + m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TYPE_NAME"), + ColumnValue::NO_NULLS, + 0,0,0, + DataType::VARCHAR); + m_mColumns[11] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NULLABLE"), + ColumnValue::NO_NULLS, + 1,1,0, + DataType::INTEGER); + m_mColumns[12] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("REMARKS"), + ColumnValue::NULLABLE, + 0,0,0, + DataType::VARCHAR); + m_mColumns[13] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("COLUMN_DEF"), + ColumnValue::NULLABLE, + 0,0,0, + DataType::VARCHAR); + m_mColumns[14] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SQL_DATA_TYPE"), + ColumnValue::NO_NULLS, + 1,1,0, + DataType::INTEGER); + m_mColumns[15] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SQL_DATETIME_SUB"), + ColumnValue::NO_NULLS, + 1,1,0, + DataType::INTEGER); + m_mColumns[16] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("CHAR_OCTET_LENGTH"), + ColumnValue::NO_NULLS, + 1,1,0, + DataType::INTEGER); +} +// ------------------------------------------------------------------------- +void ODatabaseMetaDataResultSetMetaData::setTablesMap() +{ + m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("REMARKS"), + ColumnValue::NULLABLE, + 0,0,0, + DataType::VARCHAR); +} +// ------------------------------------------------------------------------- +void ODatabaseMetaDataResultSetMetaData::setProcedureColumnsMap() +{ + m_mColumns[12] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NULLABLE"), + ColumnValue::NO_NULLS, + 1,1,0, + DataType::INTEGER); +} +// ------------------------------------------------------------------------- +void ODatabaseMetaDataResultSetMetaData::setPrimaryKeysMap() +{ + m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("KEY_SEQ"), + ColumnValue::NO_NULLS, + 1,1,0, + DataType::INTEGER); + m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PK_NAME"), + ColumnValue::NULLABLE, + 0,0,0, + DataType::VARCHAR); +} +// ------------------------------------------------------------------------- +void ODatabaseMetaDataResultSetMetaData::setIndexInfoMap() +{ + m_mColumns[4] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NON_UNIQUE"), + ColumnValue::NO_NULLS, + 1,1,0, + DataType::BIT); + m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("INDEX_QUALIFIER"), + ColumnValue::NULLABLE, + 0,0,0, + DataType::VARCHAR); + m_mColumns[10] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("ASC_OR_DESC"), + ColumnValue::NULLABLE, + 0,0,0, + DataType::VARCHAR); +} +// ------------------------------------------------------------------------- +void ODatabaseMetaDataResultSetMetaData::setTablePrivilegesMap() +{ + m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PRIVILEGE"), + ColumnValue::NULLABLE, + 0,0,0, + DataType::VARCHAR); + m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("IS_GRANTABLE"), + ColumnValue::NULLABLE, + 0,0,0, + DataType::VARCHAR); +} +// ------------------------------------------------------------------------- +void ODatabaseMetaDataResultSetMetaData::setCrossReferenceMap() +{ + m_mColumns[9] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("KEY_SEQ"), + ColumnValue::NO_NULLS, + 1,1,0, + DataType::INTEGER); +} +// ------------------------------------------------------------------------- +void ODatabaseMetaDataResultSetMetaData::setTypeInfoMap() +{ + m_mColumns[3] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PRECISION"), + ColumnValue::NO_NULLS, + 1,1,0, + DataType::INTEGER); + m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NULLABLE"), + ColumnValue::NO_NULLS, + 1,1,0, + DataType::INTEGER); + m_mColumns[12] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("AUTO_INCREMENT"), + ColumnValue::NO_NULLS, + 1,1,0, + DataType::BIT); + m_mColumns[16] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SQL_DATA_TYPE"), + ColumnValue::NO_NULLS, + 1,1,0, + DataType::INTEGER); + m_mColumns[17] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SQL_DATETIME_SUB"), + ColumnValue::NO_NULLS, + 1,1,0, + DataType::INTEGER); + m_mColumns[18] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NUM_PREC_RADIX"), + ColumnValue::NO_NULLS, + 1,1,0, + DataType::INTEGER); +} +// ------------------------------------------------------------------------- +void ODatabaseMetaDataResultSetMetaData::setProceduresMap() +{ + m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("REMARKS"), + ColumnValue::NULLABLE, + 0,0,0, + DataType::VARCHAR); +} +// ------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/ado/ADriver.cxx b/connectivity/source/drivers/ado/ADriver.cxx new file mode 100644 index 000000000000..f0b8ce81a1bf --- /dev/null +++ b/connectivity/source/drivers/ado/ADriver.cxx @@ -0,0 +1,265 @@ +/************************************************************************* + * + * $RCSfile: ADriver.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_ADRIVER_HXX_ +#include "ado/ADriver.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_ACONNECTION_HXX_ +#include "ado/AConnection.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_AWRAPADOX_HXX_ +#include "ado/Awrapadox.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_AWRAPADO_HXX_ +#include "ado/Awrapado.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_ADOIMP_HXX_ +#include "ado/adoimp.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_CATALOG_HXX_ +#include "ado/ACatalog.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif + + +using namespace connectivity::ado; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::sdbcx; +using namespace com::sun::star::lang; + +// -------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------- +ODriver::ODriver() : ODriver_BASE(m_aMutex) +{ + CoInitialize(NULL); +} +// ------------------------------------------------------------------------- +ODriver::~ODriver() +{ + CoUninitialize(); +} +//------------------------------------------------------------------------------ +void ODriver::disposing() +{ + ::osl::MutexGuard aGuard(m_aMutex); + + + for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i) + { + Reference< XComponent > xComp(i->get(), UNO_QUERY); + if (xComp.is()) + xComp->dispose(); + } + m_xConnections.clear(); + + ODriver_BASE::disposing(); +} +// static ServiceInfo +//------------------------------------------------------------------------------ +rtl::OUString ODriver::getImplementationName_Static( ) throw(RuntimeException) +{ + return rtl::OUString::createFromAscii("com.sun.star.sdbc.ADriver"); +} +//------------------------------------------------------------------------------ +Sequence< ::rtl::OUString > ODriver::getSupportedServiceNames_Static( ) throw (RuntimeException) +{ + Sequence< ::rtl::OUString > aSNS( 2 ); + aSNS[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.Driver"); + aSNS[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.Driver"); + return aSNS; +} +//------------------------------------------------------------------ +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL connectivity::ado::ODriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ) +{ + return *(new ODriver()); +} + +// -------------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODriver::getImplementationName( ) throw(RuntimeException) +{ + return getImplementationName_Static(); +} + +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL ODriver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) +{ + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + const ::rtl::OUString* pSupported = aSupported.getConstArray(); + for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) + if (pSupported->equals(_rServiceName)) + return sal_True; + + return sal_False; +} + +// -------------------------------------------------------------------------------- +Sequence< ::rtl::OUString > SAL_CALL ODriver::getSupportedServiceNames( ) throw(RuntimeException) +{ + return getSupportedServiceNames_Static(); +} + +// -------------------------------------------------------------------------------- +Reference< XConnection > SAL_CALL ODriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) +{ + OConnection* pCon = new OConnection(url,info,this); + pCon->construct(url,info); + Reference< XConnection > xCon = pCon; + m_xConnections.push_back(WeakReferenceHelper(*pCon)); + + return xCon; +} +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL ODriver::acceptsURL( const ::rtl::OUString& url ) + throw(SQLException, RuntimeException) +{ + if(!url.compareTo(::rtl::OUString::createFromAscii("sdbc:ado:"),9)) + { + return sal_True; + } + return sal_False; +} +// -------------------------------------------------------------------------------- +Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) +{ + return Sequence< DriverPropertyInfo >(); +} +// -------------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODriver::getMajorVersion( ) throw(RuntimeException) +{ + return 1; +} +// -------------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODriver::getMinorVersion( ) throw(RuntimeException) +{ + return 0; +} +// -------------------------------------------------------------------------------- +// XDataDefinitionSupplier +Reference< XTablesSupplier > SAL_CALL ODriver::getDataDefinitionByConnection( const Reference< ::com::sun::star::sdbc::XConnection >& connection ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODriver_BASE::rBHelper.bDisposed) + throw DisposedException(); + + OConnection* pConnection = NULL; + for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i) + { + if ((OConnection*) Reference< XConnection >::query(i->get().get()).get() == (OConnection*)connection.get()) + { + pConnection = (OConnection*)connection.get(); + break; + } + } + Reference< XTablesSupplier > xTab = NULL; + if(pConnection) + { + WpADOCatalog aCatalog; + aCatalog.Create(); + if(aCatalog.IsValid()) + { + aCatalog.putref_ActiveConnection(*pConnection->getConnection()); + xTab = new OCatalog(aCatalog,pConnection); + pConnection->setCatalog(xTab); + } + } + return xTab; +} +// -------------------------------------------------------------------------------- +Reference< XTablesSupplier > SAL_CALL ODriver::getDataDefinitionByURL( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) +{ + return getDataDefinitionByConnection(connect(url,info)); +} + +//#include <tools/prewin.h> +//namespace test__rr__ +//{ +// +//#import "c:\Program Files\Common Files\system\ado\msadox.dll" +// +//} +//#include <tools/postwin.h> + +void WpADOCatalog::Create() +{ + IClassFactory2* pIUnknown = NULL; + IUnknown *pOuter = NULL; + HRESULT hr = -1; + _ADOCatalog* pCommand; + hr = CoCreateInstance(ADOS::CLSID_ADOCATALOG_25, + NULL, + CLSCTX_INPROC_SERVER, + ADOS::IID_ADOCATALOG_25, + (void**)&pCommand ); + + + if( !FAILED( hr ) ) + { + pInterface = pCommand; + pInterface->AddRef(); + } +} + + diff --git a/connectivity/source/drivers/ado/AGroup.cxx b/connectivity/source/drivers/ado/AGroup.cxx new file mode 100644 index 000000000000..971922addf62 --- /dev/null +++ b/connectivity/source/drivers/ado/AGroup.cxx @@ -0,0 +1,342 @@ +/************************************************************************* + * + * $RCSfile: AGroup.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_GROUP_HXX_ +#include "ado/AGroup.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_USERS_HXX_ +#include "ado/AUsers.hxx" +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +#ifdef DELETE +#undef DELETE +#endif +#ifndef _COM_SUN_STAR_SDBCX_PRIVILEGE_HPP_ +#include <com/sun/star/sdbcx/Privilege.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_PRIVILEGEOBJECT_HPP_ +#include <com/sun/star/sdbcx/PrivilegeObject.hpp> +#endif + +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _CONNECTIVITY_ADO_BCONNECTION_HXX_ +#include "ado/AConnection.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +using namespace connectivity::ado; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::sdbcx; + +// ------------------------------------------------------------------------- +void WpADOGroup::Create() +{ + IClassFactory2* pIUnknown = NULL; + IUnknown *pOuter = NULL; + HRESULT hr = -1; + ADOGroup* pCommand; + hr = CoCreateInstance(ADOS::CLSID_ADOGROUP_25, + NULL, + CLSCTX_INPROC_SERVER, + ADOS::IID_ADOGROUP_25, + (void**)&pCommand ); + + + if( !FAILED( hr ) ) + { + pInterface = pCommand; + pInterface->AddRef(); + } +} +// ------------------------------------------------------------------------- +OAdoGroup::OAdoGroup(sal_Bool _bCase, ADOGroup* _pGroup) : OGroup_ADO(_bCase) +{ + construct(); + if(_pGroup) + m_aGroup = WpADOGroup(_pGroup); + else + m_aGroup.Create(); + + refreshUsers(); +} +// ------------------------------------------------------------------------- +OAdoGroup::OAdoGroup(sal_Bool _bCase, const ::rtl::OUString& _Name) : OGroup_ADO(_Name,_bCase) +{ + construct(); + m_aGroup.Create(); + m_aGroup.put_Name(_Name); + refreshUsers(); +} +// ------------------------------------------------------------------------- +void OAdoGroup::refreshUsers() +{ + ::std::vector< ::rtl::OUString> aVector; + + ADOUsers* pUsers = m_aGroup.get_Users(); + if(pUsers) + { + pUsers->Refresh(); + + sal_Int32 nCount = 0; + pUsers->get_Count(&nCount); + for(sal_Int32 i=0;i< nCount;++i) + { + ADOUser* pUser = NULL; + pUsers->get_Item(OLEVariant(i),&pUser); + if(pUser) + { + WpADOUser aUser(pUser); + aVector.push_back(aUser.get_Name()); + } + } + } + + if(m_pUsers) + delete m_pUsers; + m_pUsers = new OUsers(*this,m_aMutex,aVector,pUsers,isCaseSensitive()); +} +// ------------------------------------------------------------------------- +Any SAL_CALL OAdoGroup::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = ::cppu::queryInterface(rType,static_cast< ::com::sun::star::lang::XUnoTunnel*> (this)); + if(aRet.hasValue()) + return aRet; + return OGroup_ADO::queryInterface(rType); +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OAdoGroup::getTypes( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),OGroup_ADO::getTypes()); +} +//-------------------------------------------------------------------------- +Sequence< sal_Int8 > OAdoGroup::getUnoTunnelImplementationId() +{ + static ::cppu::OImplementationId * pId = 0; + if (! pId) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + if (! pId) + { + static ::cppu::OImplementationId aId; + pId = &aId; + } + } + return pId->getImplementationId(); +} + +// com::sun::star::lang::XUnoTunnel +//------------------------------------------------------------------ +sal_Int64 OAdoGroup::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException) +{ + if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + return (sal_Int64)this; + + return 0; +} + +// ------------------------------------------------------------------------- +void OAdoGroup::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)throw (Exception) +{ + if(m_aGroup.IsValid()) + { + + switch(nHandle) + { + case PROPERTY_ID_NAME: + { + ::rtl::OUString aVal; + rValue >>= aVal; + m_aGroup.put_Name(aVal); + } + break; + } + } +} +// ------------------------------------------------------------------------- +void OAdoGroup::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const +{ + if(m_aGroup.IsValid()) + { + switch(nHandle) + { + case PROPERTY_ID_NAME: + rValue <<= m_aGroup.get_Name(); + break; + } + } +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OAdoGroup::getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) +{ + return MapRight(m_aGroup.GetPermissions(objName,MapObjectType(objType))); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OAdoGroup::getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) +{ + RightsEnum eNum = m_aGroup.GetPermissions(objName,MapObjectType(objType)); + if(eNum & adRightWithGrant) + return MapRight(eNum); + return 0; +} +// ------------------------------------------------------------------------- +void SAL_CALL OAdoGroup::grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) +{ + m_aGroup.SetPermissions(objName,MapObjectType(objType),adAccessGrant,Map2Right(objPrivileges)); +} +// ------------------------------------------------------------------------- +void SAL_CALL OAdoGroup::revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) +{ + m_aGroup.SetPermissions(objName,MapObjectType(objType),adAccessDeny,Map2Right(objPrivileges)); +} +// ------------------------------------------------------------------------- +ObjectTypeEnum OAdoGroup::MapObjectType(sal_Int32 _ObjType) +{ + ObjectTypeEnum eNumType= adPermObjTable; + switch(_ObjType) + { + case PrivilegeObject::TABLE: + break; + case PrivilegeObject::VIEW: + eNumType = adPermObjView; + break; + case PrivilegeObject::COLUMN: + eNumType = adPermObjColumn; + break; + } + return eNumType; +} +// ------------------------------------------------------------------------- +sal_Int32 OAdoGroup::MapRight(RightsEnum _eNum) +{ + sal_Int32 nRight = 0; + if(_eNum & adRightRead) + nRight |= Privilege::SELECT; + if(_eNum & adRightInsert) + nRight |= Privilege::INSERT; + if(_eNum & adRightUpdate) + nRight |= Privilege::UPDATE; + if(_eNum & adRightDelete) + nRight |= Privilege::DELETE; + if(_eNum & adRightReadDesign) + nRight |= Privilege::READ; + if(_eNum & adRightCreate) + nRight |= Privilege::CREATE; + if(_eNum & adRightWriteDesign) + nRight |= Privilege::ALTER; + if(_eNum & adRightReference) + nRight |= Privilege::REFERENCE; + if(_eNum & adRightDrop) + nRight |= Privilege::DROP; + + return nRight; +} +// ------------------------------------------------------------------------- +RightsEnum OAdoGroup::Map2Right(sal_Int32 _eNum) +{ + sal_Int32 nRight = adRightNone; + if(_eNum & Privilege::SELECT) + nRight |= adRightRead; + + if(_eNum & Privilege::INSERT) + nRight |= adRightInsert; + + if(_eNum & Privilege::UPDATE) + nRight |= adRightUpdate; + + if(_eNum & Privilege::DELETE) + nRight |= adRightDelete; + + if(_eNum & Privilege::READ) + nRight |= adRightReadDesign; + + if(_eNum & Privilege::CREATE) + nRight |= adRightCreate; + + if(_eNum & Privilege::ALTER) + nRight |= adRightWriteDesign; + + if(_eNum & Privilege::REFERENCE) + nRight |= adRightReference; + + if(_eNum & Privilege::DROP) + nRight |= adRightDrop; + + return (RightsEnum)nRight; +} + + diff --git a/connectivity/source/drivers/ado/AGroups.cxx b/connectivity/source/drivers/ado/AGroups.cxx new file mode 100644 index 000000000000..d3e75885d029 --- /dev/null +++ b/connectivity/source/drivers/ado/AGroups.cxx @@ -0,0 +1,145 @@ +/************************************************************************* + * + * $RCSfile: AGroups.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_GROUPS_HXX_ +#include "ado/AGroups.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_GROUP_HXX_ +#include "ado/AGroup.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_TABLE_HXX_ +#include "ado/ATable.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_ +#include "connectivity/sdbcx/IRefreshable.hxx" +#endif + +using namespace connectivity::ado; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::container; + +typedef connectivity::sdbcx::OCollection OCollection_TYPE; +// ------------------------------------------------------------------------- +Reference< XNamed > OGroups::createObject(const ::rtl::OUString& _rName) +{ + Reference< XNamed > xRet = NULL; + OAdoGroup* pRet = new OAdoGroup(isCaseSensitive(),_rName); + xRet = pRet; + return xRet; +} +// ------------------------------------------------------------------------- +void OGroups::impl_refresh() throw(RuntimeException) +{ + m_pCollection->Refresh(); +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > OGroups::createEmptyObject() +{ + OAdoGroup* pNew = new OAdoGroup(isCaseSensitive()); + return pNew; +} +// ------------------------------------------------------------------------- +// XAppend +void SAL_CALL OGroups::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + + Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY); + if(xTunnel.is()) + { + OAdoGroup* pGroup = (OAdoGroup*)xTunnel->getSomething(OAdoGroup::getUnoTunnelImplementationId()); + m_pCollection->Append(OLEVariant(pGroup->getImpl())); + } + + OCollection_TYPE::appendByDescriptor(descriptor); +} +// ------------------------------------------------------------------------- +// XDrop +void SAL_CALL OGroups::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + + m_pCollection->Delete(OLEVariant(elementName)); + + OCollection_TYPE::dropByName(elementName); +} +// ------------------------------------------------------------------------- +void SAL_CALL OGroups::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + if (index < 0 || index >= getCount()) + throw IndexOutOfBoundsException(); + + m_pCollection->Delete(OLEVariant(index)); + + OCollection_TYPE::dropByIndex(index); +} + + diff --git a/connectivity/source/drivers/ado/AIndex.cxx b/connectivity/source/drivers/ado/AIndex.cxx new file mode 100644 index 000000000000..f5c60ea843b9 --- /dev/null +++ b/connectivity/source/drivers/ado/AIndex.cxx @@ -0,0 +1,283 @@ +/************************************************************************* + * + * $RCSfile: AIndex.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_INDEX_HXX_ +#include "ado/AIndex.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +#ifndef _CONNECTIVITY_ADO_COLUMNS_HXX_ +#include "ado/AColumns.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif + +using namespace connectivity::ado; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; + +// ------------------------------------------------------------------------- +void WpADOIndex::Create() +{ + IClassFactory2* pIUnknown = NULL; + IUnknown *pOuter = NULL; + HRESULT hr = -1; + _ADOIndex* pCommand; + hr = CoCreateInstance(ADOS::CLSID_ADOINDEX_25, + NULL, + CLSCTX_INPROC_SERVER, + ADOS::IID_ADOINDEX_25, + (void**)&pCommand ); + + + if( !FAILED( hr ) ) + { + pInterface = pCommand; + pInterface->AddRef(); + } +} +// ------------------------------------------------------------------------- +OAdoIndex::OAdoIndex(sal_Bool _bCase, ADOIndex* _pIndex) : OIndex_ADO(_bCase) +{ + construct(); + if(_pIndex) + m_aIndex = WpADOIndex(_pIndex); + else + m_aIndex.Create(); + + refreshColumns(); +} +// ------------------------------------------------------------------------- +OAdoIndex::OAdoIndex( const ::rtl::OUString& _Name, + const ::rtl::OUString& _Catalog, + sal_Bool _isUnique, + sal_Bool _isPrimaryKeyIndex, + sal_Bool _isClustered, + sal_Bool _bCase + ) : OIndex_ADO(_Name, + _Catalog, + _isUnique, + _isPrimaryKeyIndex, + _isClustered,_bCase) +{ + construct(); + m_aIndex.Create(); + m_aIndex.put_Name(_Name); + m_aIndex.put_Unique(_isUnique); + m_aIndex.put_PrimaryKey(_isPrimaryKeyIndex); + m_aIndex.put_Clustered(_isClustered); + + refreshColumns(); +} +// ------------------------------------------------------------------------- + +void OAdoIndex::refreshColumns() +{ + ::std::vector< ::rtl::OUString> aVector; + + ADOColumns* pColumns = m_aIndex.get_Columns(); + if(pColumns) + { + pColumns->Refresh(); + + sal_Int32 nCount = 0; + pColumns->get_Count(&nCount); + for(sal_Int32 i=0;i< nCount;++i) + { + ADOColumn* pColumn = NULL; + pColumns->get_Item(OLEVariant(i),&pColumn); + if(pColumn) + { + WpADOColumn aColumn(pColumn); + aVector.push_back(aColumn.get_Name()); + } + } + } + if(m_pColumns) + delete m_pColumns; + m_pColumns = new OColumns(*this,m_aMutex,aVector,pColumns,isCaseSensitive()); +} + +// ------------------------------------------------------------------------- +Any SAL_CALL OAdoIndex::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = ::cppu::queryInterface(rType,static_cast< ::com::sun::star::lang::XUnoTunnel*> (this)); + if(aRet.hasValue()) + return aRet; + return OIndex_ADO::queryInterface(rType); +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OAdoIndex::getTypes( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),OIndex_ADO::getTypes()); +} +//-------------------------------------------------------------------------- +Sequence< sal_Int8 > OAdoIndex::getUnoTunnelImplementationId() +{ + static ::cppu::OImplementationId * pId = 0; + if (! pId) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + if (! pId) + { + static ::cppu::OImplementationId aId; + pId = &aId; + } + } + return pId->getImplementationId(); +} + +// com::sun::star::lang::XUnoTunnel +//------------------------------------------------------------------ +sal_Int64 OAdoIndex::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException) +{ + if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + return (sal_Int64)this; + + return 0; +} +// ------------------------------------------------------------------------- +void SAL_CALL OAdoIndex::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)throw (Exception) +{ + if(m_aIndex.IsValid()) + { + + switch(nHandle) + { + case PROPERTY_ID_NAME: + { + ::rtl::OUString aVal; + rValue >>= aVal; + m_aIndex.put_Name(aVal); + } + break; + case PROPERTY_ID_CATALOG: + { + ::rtl::OUString aVal; + rValue >>= aVal; + m_aIndex.put_Name(aVal); + } + break; + case PROPERTY_ID_ISUNIQUE: + m_aIndex.put_Unique(getBOOL(rValue)); + break; + case PROPERTY_ID_ISPRIMARYKEYINDEX: + m_aIndex.put_PrimaryKey(getBOOL(rValue)); + break; + case PROPERTY_ID_ISCLUSTERED: + m_aIndex.put_Clustered(getBOOL(rValue)); + break; + } + } +} +// ------------------------------------------------------------------------- +void SAL_CALL OAdoIndex::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const +{ + if(m_aIndex.IsValid()) + { + switch(nHandle) + { + case PROPERTY_ID_NAME: + rValue <<= m_aIndex.get_Name(); + break; + case PROPERTY_ID_CATALOG: + // rValue <<= getResultSetType(); + break; + case PROPERTY_ID_ISUNIQUE: + { + sal_Bool _b = m_aIndex.get_Unique(); + rValue <<= Any(&_b, ::getBooleanCppuType()); + } + break; + case PROPERTY_ID_ISPRIMARYKEYINDEX: + { + sal_Bool _b = m_aIndex.get_PrimaryKey(); + rValue <<= Any(&_b, ::getBooleanCppuType()); + } + break; + case PROPERTY_ID_ISCLUSTERED: + { + sal_Bool _b = m_aIndex.get_Clustered(); + rValue <<= Any(&_b, ::getBooleanCppuType()); + } + break; + } + } +} + + + + diff --git a/connectivity/source/drivers/ado/AIndexes.cxx b/connectivity/source/drivers/ado/AIndexes.cxx new file mode 100644 index 000000000000..798f54916660 --- /dev/null +++ b/connectivity/source/drivers/ado/AIndexes.cxx @@ -0,0 +1,148 @@ +/************************************************************************* + * + * $RCSfile: AIndexes.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADO_INDEXES_HXX_ +#include "ado/AIndexes.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_INDEX_HXX_ +#include "ado/AIndex.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_INDEXTYPE_HPP_ +#include <com/sun/star/sdbc/IndexType.hpp> +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif + +using namespace connectivity::ado; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::container; + +typedef connectivity::sdbcx::OCollection OCollection_TYPE; + +Reference< XNamed > OIndexes::createObject(const ::rtl::OUString& _rName) +{ + ADOIndex* pIndex = NULL; + m_pCollection->get_Item(OLEVariant(_rName),&pIndex); + + Reference< XNamed > xRet = new OAdoIndex(isCaseSensitive(),pIndex); + + return xRet; +} +// ------------------------------------------------------------------------- +void OIndexes::impl_refresh() throw(RuntimeException) +{ + m_pCollection->Refresh(); +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > OIndexes::createEmptyObject() +{ + OAdoIndex* pNew = new OAdoIndex(isCaseSensitive()); + return pNew; +} +// ------------------------------------------------------------------------- +// XAppend +void SAL_CALL OIndexes::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + + Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY); + if(xTunnel.is()) + { + OAdoIndex* pIndex = (OAdoIndex*)xTunnel->getSomething(OAdoIndex:: getUnoTunnelImplementationId()); + m_pCollection->Append(OLEVariant(getString(descriptor->getPropertyValue(PROPERTY_NAME))), + OLEVariant(pIndex->getImpl())); + } + + OCollection_TYPE::appendByDescriptor(descriptor); +} +// ------------------------------------------------------------------------- +// XDrop +void SAL_CALL OIndexes::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + + m_pCollection->Delete(OLEVariant(elementName)); + + OCollection_TYPE::dropByName(elementName); +} +// ------------------------------------------------------------------------- +void SAL_CALL OIndexes::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + if (index < 0 || index >= getCount()) + throw IndexOutOfBoundsException(); + + m_pCollection->Delete(OLEVariant(index)); + + OCollection_TYPE::dropByIndex(index); +} +// ------------------------------------------------------------------------- + + diff --git a/connectivity/source/drivers/ado/AKey.cxx b/connectivity/source/drivers/ado/AKey.cxx new file mode 100644 index 000000000000..6a7f7a437cf7 --- /dev/null +++ b/connectivity/source/drivers/ado/AKey.cxx @@ -0,0 +1,326 @@ +/************************************************************************* + * + * $RCSfile: AKey.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_KEY_HXX_ +#include "ado/AKey.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +#ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_ +#include <com/sun/star/sdbc/KeyRule.hpp> +#endif +#ifndef _CONNECTIVITY_ADO_COLUMNS_HXX_ +#include "ado/AColumns.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +using namespace connectivity::ado; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; + +// ------------------------------------------------------------------------- +void WpADOKey::Create() +{ + IClassFactory2* pIUnknown = NULL; + IUnknown *pOuter = NULL; + HRESULT hr = -1; + _ADOKey* pCommand; + hr = CoCreateInstance(ADOS::CLSID_ADOKEY_25, + NULL, + CLSCTX_INPROC_SERVER, + ADOS::IID_ADOKEY_25, + (void**)&pCommand ); + + + if( !FAILED( hr ) ) + { + pInterface = pCommand; + pInterface->AddRef(); + } +} +// ------------------------------------------------------------------------- +OAdoKey::OAdoKey(sal_Bool _bCase, ADOKey* _pKey) : OKey_ADO(_bCase) +{ + construct(); + if(_pKey) + m_aKey = WpADOKey(_pKey); + else + m_aKey.Create(); + + refreshColumns(); +} +// ------------------------------------------------------------------------- +OAdoKey::OAdoKey( const ::rtl::OUString& _Name, + const ::rtl::OUString& _ReferencedTable, + sal_Int32 _Type, + sal_Int32 _UpdateRule, + sal_Int32 _DeleteRule, + sal_Bool _bCase + ) : OKey_ADO(_Name, + _ReferencedTable, + _Type, + _UpdateRule, + _DeleteRule,_bCase) +{ + construct(); + m_aKey.Create(); + m_aKey.put_Name(_Name); + m_aKey.put_UpdateRule(Map2Rule(_UpdateRule)); + m_aKey.put_DeleteRule(Map2Rule(_DeleteRule)); + m_aKey.put_RelatedTable(_ReferencedTable); + m_aKey.put_Type((KeyTypeEnum)_Type); + + refreshColumns(); +} +// ------------------------------------------------------------------------- +void OAdoKey::refreshColumns() +{ + ::std::vector< ::rtl::OUString> aVector; + + ADOColumns* pColumns = m_aKey.get_Columns(); + if(pColumns) + { + pColumns->Refresh(); + + sal_Int32 nCount = 0; + pColumns->get_Count(&nCount); + for(sal_Int32 i=0;i< nCount;++i) + { + ADOColumn* pColumn = NULL; + pColumns->get_Item(OLEVariant(i),&pColumn); + if(pColumn) + { + WpADOColumn aColumn(pColumn); + aVector.push_back(aColumn.get_Name()); + } + } + } + + m_pColumns = new OColumns(*this,m_aMutex,aVector,pColumns,isCaseSensitive()); +} +// ------------------------------------------------------------------------- +Any SAL_CALL OAdoKey::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = ::cppu::queryInterface(rType,static_cast< ::com::sun::star::lang::XUnoTunnel*> (this)); + if(aRet.hasValue()) + return aRet; + return OKey_ADO::queryInterface(rType); +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OAdoKey::getTypes( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),OKey_ADO::getTypes()); +} +//-------------------------------------------------------------------------- +Sequence< sal_Int8 > OAdoKey::getUnoTunnelImplementationId() +{ + static ::cppu::OImplementationId * pId = 0; + if (! pId) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + if (! pId) + { + static ::cppu::OImplementationId aId; + pId = &aId; + } + } + return pId->getImplementationId(); +} + +// com::sun::star::lang::XUnoTunnel +//------------------------------------------------------------------ +sal_Int64 OAdoKey::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException) +{ + if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + return (sal_Int64)this; + + return 0; +} +// ------------------------------------------------------------------------- +void OAdoKey::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)throw (Exception) +{ + if(m_aKey.IsValid()) + { + + switch(nHandle) + { + case PROPERTY_ID_NAME: + { + ::rtl::OUString aVal; + rValue >>= aVal; + m_aKey.put_Name(aVal); + } + break; + case PROPERTY_ID_TYPE: + { + sal_Int32 nVal=0; + rValue >>= nVal; + m_aKey.put_Type((KeyTypeEnum)nVal); + } + break; + case PROPERTY_ID_REFERENCEDTABLE: + { + ::rtl::OUString aVal; + rValue >>= aVal; + m_aKey.put_RelatedTable(aVal); + } + break; + case PROPERTY_ID_UPDATERULE: + { + sal_Int32 nVal=0; + rValue >>= nVal; + m_aKey.put_UpdateRule(Map2Rule(nVal)); + } + break; + case PROPERTY_ID_DELETERULE: + { + sal_Int32 nVal=0; + rValue >>= nVal; + m_aKey.put_DeleteRule(Map2Rule(nVal)); + } + break; + } + } +} +// ------------------------------------------------------------------------- +void OAdoKey::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const +{ + if(m_aKey.IsValid()) + { + switch(nHandle) + { + case PROPERTY_ID_NAME: + rValue <<= m_aKey.get_Name(); + break; + case PROPERTY_ID_TYPE: + rValue <<= (sal_Int32)m_aKey.get_Type(); + break; + case PROPERTY_ID_REFERENCEDTABLE: + rValue <<= m_aKey.get_RelatedTable(); + break; + case PROPERTY_ID_UPDATERULE: + rValue <<= MapRule(m_aKey.get_UpdateRule()); + break; + case PROPERTY_ID_DELETERULE: + rValue <<= MapRule(m_aKey.get_DeleteRule()); + break; + } + } +} +// ------------------------------------------------------------------------- +sal_Int32 OAdoKey::MapRule(const RuleEnum& _eNum) const +{ + sal_Int32 eNum = KeyRule::NO_ACTION; + switch(_eNum) + { + case adRICascade: + eNum = KeyRule::CASCADE; + break; + case adRISetNull: + eNum = KeyRule::SET_NULL; + break; + case adRINone: + eNum = KeyRule::NO_ACTION; + break; + case adRISetDefault: + eNum = KeyRule::SET_DEFAULT; + break; + } + return eNum; +} +// ------------------------------------------------------------------------- +RuleEnum OAdoKey::Map2Rule(const sal_Int32& _eNum) const +{ + RuleEnum eNum = adRINone; + switch(_eNum) + { + case KeyRule::CASCADE: + eNum = adRICascade; + break; + case KeyRule::SET_NULL: + eNum = adRISetNull; + break; + case KeyRule::NO_ACTION: + eNum = adRINone; + break; + case KeyRule::SET_DEFAULT: + eNum = adRISetDefault; + break; + } + return eNum; +} + + diff --git a/connectivity/source/drivers/ado/AKeyColumn.cxx b/connectivity/source/drivers/ado/AKeyColumn.cxx new file mode 100644 index 000000000000..2ed8f753acec --- /dev/null +++ b/connectivity/source/drivers/ado/AKeyColumn.cxx @@ -0,0 +1,101 @@ +/************************************************************************* + * + * $RCSfile: AKeyColumn.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_KEYCOLUMN_HXX_ +#include "adabas/BKeyColumn.hxx" +#endif + +using namespace connectivity::adabas; +namespace starbeans = ::com::sun::star::beans; +// ------------------------------------------------------------------------- +OKeyColumn::OKeyColumn() : OColumn() +{ + construct(); +} +// ------------------------------------------------------------------------- +OKeyColumn::OKeyColumn( const ::rtl::OUString& _ReferencedColumn, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _TypeName, + const ::rtl::OUString& _DefaultValue, + sal_Int32 _IsNullable, + sal_Int32 _Precision, + sal_Int32 _Scale, + sal_Int32 _Type, + sal_Bool _IsAutoIncrement + ) : OColumn(_Name, + _TypeName, + _DefaultValue, + _IsNullable, + _Precision, + _Scale, + _Type, + _IsAutoIncrement) + , m_ReferencedColumn(_ReferencedColumn) +{ + construct(); +} +// ------------------------------------------------------------------------- +void OKeyColumn::construct() +{ + sal_Int32 nAttrib = isNew() ? 0 : starbeans::PropertyAttribute::READONLY; + registerProperty(PROPERTY_REFERENCEDCOLUMN, PROPERTY_ID_REFERENCEDCOLUMN, nAttrib,&m_ReferencedColumn, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); +} + diff --git a/connectivity/source/drivers/ado/AKeyColumns.cxx b/connectivity/source/drivers/ado/AKeyColumns.cxx new file mode 100644 index 000000000000..251dfbe4ca6a --- /dev/null +++ b/connectivity/source/drivers/ado/AKeyColumns.cxx @@ -0,0 +1,142 @@ +/************************************************************************* + * + * $RCSfile: AKeyColumns.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_KEYCOLUMNS_HXX_ +#include "adabas/BKeyColumns.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_KEYCOLUMN_HXX_ +#include "adabas/BKeyColumn.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif +#ifndef _CONNECTIVITY_ADABAS_TABLE_HXX_ +#include "adabas/BTable.hxx" +#endif + +using namespace connectivity::adabas; +// ------------------------------------------------------------------------- +staruno::Reference< starcontainer::XNamed > OKeyColumns::createObject(const ::rtl::OUString& _rName) +{ + + staruno::Reference< starsdbc::XResultSet > + xResult = m_pTable->getConnection()->getMetaData()->getImportedKeys(staruno::Any(), + m_pTable->getSchema(),m_pTable->getName()); + + ::rtl::OUString aRefColumnName; + if(xResult.is()) + { + staruno::Reference< starsdbc::XRow > xRow(xResult,staruno::UNO_QUERY); + ::rtl::OUString aDot = ::rtl::OUString::createFromAscii("."); + while(xResult->next()) + { + if(xRow->getString(8) == _rName) + { + aRefColumnName = xRow->getString(4); + break; + } + } + } + + xResult = m_pTable->getConnection()->getMetaData()->getColumns(staruno::Any(), + m_pTable->getSchema(),m_pTable->getName(),_rName); + + staruno::Reference< starcontainer::XNamed > xRet = NULL; + if(xResult.is()) + { + staruno::Reference< starsdbc::XRow > xRow(xResult,staruno::UNO_QUERY); + if(xResult->next()) + { + if(xRow->getString(4) == _rName) + { + OKeyColumn* pRet = new OKeyColumn(aRefColumnName, + _rName, + xRow->getString(6), + xRow->getString(13), + xRow->getInt(11), + xRow->getInt(7), + xRow->getInt(9), + xRow->getInt(5), + sal_False); + xRet = pRet; + } + } + } + + return xRet; +} +// ------------------------------------------------------------------------- +staruno::Reference< starbeans::XPropertySet > OKeyColumns::createEmptyObject() +{ + OKeyColumn* pNew = new OKeyColumn(); + return pNew; +} +// ------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/ado/AKeys.cxx b/connectivity/source/drivers/ado/AKeys.cxx new file mode 100644 index 000000000000..e24988173ad3 --- /dev/null +++ b/connectivity/source/drivers/ado/AKeys.cxx @@ -0,0 +1,153 @@ +/************************************************************************* + * + * $RCSfile: AKeys.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_KEYS_HXX_ +#include "ado/AKeys.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_INDEX_HXX_ +#include "ado/AKey.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_ +#include <com/sun/star/sdbcx/KeyType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_ +#include <com/sun/star/sdbc/KeyRule.hpp> +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +using namespace connectivity::ado; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::container; + +typedef connectivity::sdbcx::OCollection OCollection_TYPE; + +Reference< XNamed > OKeys::createObject(const ::rtl::OUString& _rName) +{ + ADOKey* pKey = NULL; + m_pCollection->get_Item(OLEVariant(_rName),&pKey); + + Reference< XNamed > xRet = new OAdoKey(isCaseSensitive(),pKey); + + return xRet; +} +// ------------------------------------------------------------------------- +void OKeys::impl_refresh() throw(RuntimeException) +{ + m_pCollection->Refresh(); +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > OKeys::createEmptyObject() +{ + OAdoKey* pNew = new OAdoKey(isCaseSensitive()); + return pNew; +} +// ------------------------------------------------------------------------- +// XAppend +void SAL_CALL OKeys::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + + Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY); + if(xTunnel.is()) + { + OAdoKey* pKey = (OAdoKey*)xTunnel->getSomething(OAdoKey:: getUnoTunnelImplementationId()); + // To pass as column parameter to Key's Apppend method + OLEVariant vOptional; + vOptional.vt = VT_ERROR; + vOptional.scode = DISP_E_PARAMNOTFOUND; + + m_pCollection->Append(OLEVariant(pKey->getImpl()),(KeyTypeEnum)getINT32(descriptor->getPropertyValue(PROPERTY_TYPE)),vOptional); + } + + OCollection_TYPE::appendByDescriptor(descriptor); +} +// ------------------------------------------------------------------------- +// XDrop +void SAL_CALL OKeys::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + + m_pCollection->Delete(OLEVariant(elementName)); + + OCollection_TYPE::dropByName(elementName); +} +// ------------------------------------------------------------------------- +void SAL_CALL OKeys::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + if (index < 0 || index >= getCount()) + throw IndexOutOfBoundsException(); + + m_pCollection->Delete(OLEVariant(index)); + + OCollection_TYPE::dropByIndex(index); +} + diff --git a/connectivity/source/drivers/ado/APreparedStatement.cxx b/connectivity/source/drivers/ado/APreparedStatement.cxx new file mode 100644 index 000000000000..423bff42b47c --- /dev/null +++ b/connectivity/source/drivers/ado/APreparedStatement.cxx @@ -0,0 +1,446 @@ +/************************************************************************* + * + * $RCSfile: APreparedStatement.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADO_APREPAREDSTATEMENT_HXX_ +#include "ado/APreparedStatement.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _CONNECTIVITY_ADO_ARESULTSETMETADATA_HXX_ +#include "ado/AResultSetMetaData.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_ARESULTSET_HXX_ +#include "ado/AResultSet.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif + +#define CHECK_RETURN(x) \ + if(!x) \ + ADOS::ThrowException(*m_pConnection->getConnection(),*this); + +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +using namespace connectivity::ado; +using namespace connectivity; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::util; + + +IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.APreparedStatement","com.sun.star.sdbc.PreparedStatement"); + +OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const ::std::vector<OTypeInfo>& _TypeInfo,const ::rtl::OUString& sql) + : OStatement_Base( _pConnection ),m_aTypeInfo(_TypeInfo) +{ + osl_incrementInterlockedCount( &m_refCount ); + + CHECK_RETURN(m_Command.put_CommandText(sql)) + CHECK_RETURN(m_Command.put_Prepared(VARIANT_TRUE)) + m_pParameters = m_Command.get_Parameters(); + m_pParameters->AddRef(); + m_pParameters->Refresh(); + + osl_decrementInterlockedCount( &m_refCount ); +} +// ------------------------------------------------------------------------- + +Any SAL_CALL OPreparedStatement::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = OStatement_Base::queryInterface(rType); + if(!aRet.hasValue()) + aRet = ::cppu::queryInterface( rType, + static_cast< XPreparedStatement*>(this), + static_cast< XParameters*>(this), + static_cast< XPreparedBatchExecution*>(this), + static_cast< XResultSetMetaDataSupplier*>(this)); + return aRet; +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OPreparedStatement::getTypes( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< XPreparedStatement > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< XParameters > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< XResultSetMetaDataSupplier > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< XPreparedBatchExecution > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),OStatement_Base::getTypes()); +} +// ------------------------------------------------------------------------- + +Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( ) throw(SQLException, RuntimeException) +{ + Reference< XResultSetMetaData > xRef = new OResultSetMetaData(m_RecordSet); + return xRef; +} +// ------------------------------------------------------------------------- +void OPreparedStatement::disposing() +{ + if(m_RecordSet.IsValid()) + m_RecordSet.Close(); + if(m_pParameters) + m_pParameters->Release(); + OStatement_Base::disposing(); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::close( ) throw(SQLException, RuntimeException) +{ + + { + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + } + dispose(); + +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + SQLWarning warning; + + // Reset warnings + + clearWarnings (); + + // Reset the statement handle, warning and saved Resultset + + reset(); + + // Call SQLExecute + + try { + ADORecordset* pSet=NULL; + CHECK_RETURN(m_Command.Execute(m_RecordsAffected,m_Parameters,adCmdUnknown,&pSet)) + m_RecordSet = WpADORecordset(pSet); + } + catch (SQLWarning& ex) + { + + // Save pointer to warning and save with ResultSet + // object once it is created. + + warning = ex; + } + return m_RecordSet.IsValid(); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + ADORecordset* pSet=NULL; + CHECK_RETURN(m_Command.Execute(m_RecordsAffected,m_Parameters,adCmdUnknown,&pSet)) + m_RecordSet = WpADORecordset(pSet); + return m_RecordsAffected; +} + +// ------------------------------------------------------------------------- +void OPreparedStatement::setParameter(sal_Int32 parameterIndex, const DataTypeEnum& _eType, + const sal_Int32& _nSize,const OLEVariant& _Val) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + sal_Int32 nCount = 0; + m_pParameters->get_Count(&nCount); + if(!nCount) + { + + ADOParameter* pParam = m_Command.CreateParameter(::rtl::OUString(),_eType,adParamInput,_nSize,_Val); + if(pParam) + { + pParam->AddRef(); + m_pParameters->Append(pParam); + } + } + else + { + ADOParameter* pParam = NULL; + m_pParameters->get_Item(OLEVariant(parameterIndex-1),&pParam); + if(pParam) + pParam->put_Value(_Val); + } + ADOS::ThrowException(*m_pConnection->getConnection(),*this); +} +// ------------------------------------------------------------------------- +void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) +{ + setParameter(parameterIndex,adLongVarWChar,x.getLength(),x); +} +// ------------------------------------------------------------------------- + +Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return (Reference< XConnection >)m_pConnection; +} +// ------------------------------------------------------------------------- + +Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + WpADORecordset aSet; + aSet.Create(); + OLEVariant aCmd; + aCmd.setIDispatch(m_Command); + OLEVariant aCon; + aCon.setNoArg(); + CHECK_RETURN(aSet.put_CacheSize(m_nFetchSize)) + CHECK_RETURN(aSet.put_MaxRecords(m_nMaxRows)) + CHECK_RETURN(aSet.Open(aCmd,aCon,m_eCursorType,m_eLockType,adOpenUnspecified)) + + CHECK_RETURN(aSet.get_CacheSize(m_nFetchSize)) + CHECK_RETURN(aSet.get_MaxRecords(m_nMaxRows)) + CHECK_RETURN(aSet.get_CursorType(m_eCursorType)) + CHECK_RETURN(aSet.get_LockType(m_eLockType)) + + OResultSet* pSet = new OResultSet(aSet,this); + Reference< XResultSet > pRs = pSet; + m_xResultSet = WeakReference<XResultSet>(pRs); + + return m_xResultSet; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(SQLException, RuntimeException) +{ + setParameter(parameterIndex,adBoolean,sizeof(x),x); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(SQLException, RuntimeException) +{ + setParameter(parameterIndex,adTinyInt,sizeof(x),x); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const Date& x ) throw(SQLException, RuntimeException) +{ + setParameter(parameterIndex,adDBDate,sizeof(x),x); +} +// ------------------------------------------------------------------------- + + +void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const Time& x ) throw(SQLException, RuntimeException) +{ + setParameter(parameterIndex,adDBTime,sizeof(x),x); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const DateTime& x ) throw(SQLException, RuntimeException) +{ + setParameter(parameterIndex,adDBTimeStamp,sizeof(x),x); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x ) throw(SQLException, RuntimeException) +{ + setParameter(parameterIndex,adDouble,sizeof(x),x); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) throw(SQLException, RuntimeException) +{ + setParameter(parameterIndex,adSingle,sizeof(x),x); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(SQLException, RuntimeException) +{ + setParameter(parameterIndex,adInteger,sizeof(x),x); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(SQLException, RuntimeException) +{ + setParameter(parameterIndex,adBigInt,sizeof(x),x); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(SQLException, RuntimeException) +{ + OLEVariant aVal; + aVal.setNull(); + setParameter(parameterIndex,adEmpty,0,aVal); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Reference< XClob >& x ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Reference< XBlob >& x ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setArray( sal_Int32 parameterIndex, const Reference< XArray >& x ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setRef( sal_Int32 parameterIndex, const Reference< XRef >& x ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 sqlType, sal_Int32 scale ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(SQLException, RuntimeException) +{ + setNull(parameterIndex,sqlType); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException) +{ + // setObject (parameterIndex, x, sqlType, 0); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(SQLException, RuntimeException) +{ + setParameter(parameterIndex,adSmallInt,sizeof(x),x); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) +{ + setParameter(parameterIndex,adVarBinary,sizeof(sal_Int8)*x.getLength(),x); +} + +// ------------------------------------------------------------------------- + + +void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::clearParameters( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(m_pParameters) + { + sal_Int32 nCount = 0; + m_pParameters->get_Count(&nCount); + for(sal_Int32 i=nCount-1;i>=0;--i) + m_pParameters->Delete(OLEVariant(i)); + + } +} +// ------------------------------------------------------------------------- +void SAL_CALL OPreparedStatement::clearBatch( ) throw(SQLException, RuntimeException) +{ + // clearParameters( ); + // m_aBatchList.erase(); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::addBatch( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +Sequence< sal_Int32 > SAL_CALL OPreparedStatement::executeBatch( ) throw(SQLException, RuntimeException) +{ + return Sequence< sal_Int32 > (); +} + + diff --git a/connectivity/source/drivers/ado/AResultSet.cxx b/connectivity/source/drivers/ado/AResultSet.cxx new file mode 100644 index 000000000000..f85bed5f0207 --- /dev/null +++ b/connectivity/source/drivers/ado/AResultSet.cxx @@ -0,0 +1,1269 @@ +/************************************************************************* + * + * $RCSfile: AResultSet.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef _CONNECTIVITY_ADO_ARESULTSET_HXX_ +#include "ado/AResultSet.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_ARESULTSETMETADATA_HXX_ +#include "ado/AResultSetMetaData.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_ +#include <com/sun/star/sdbc/KeyRule.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_INDEXTYPE_HPP_ +#include <com/sun/star/sdbc/IndexType.hpp> +#endif +#ifndef _UTL_PROPERTY_HXX_ +#include <unotools/property.hxx> +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_ +#include <com/sun/star/sdbc/ResultSetConcurrency.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_ +#include <com/sun/star/sdbc/ResultSetType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_FETCHDIRECTION_HPP_ +#include <com/sun/star/sdbc/FetchDirection.hpp> +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ +#include <com/sun/star/beans/PropertyAttribute.hpp> +#endif + +#include <oledb.h> + +#define CHECK_RETURN(x) \ + if(!SUCCEEDED(x)) \ + ADOS::ThrowException(*m_pStmt->m_pConnection->getConnection(),*this); + +using namespace connectivity::ado; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; + +//------------------------------------------------------------------------------ +// IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.AResultSet","com.sun.star.sdbc.ResultSet"); +::rtl::OUString SAL_CALL OResultSet::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) \ +{ + return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.ado.ResultSet"); +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL OResultSet::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(2); + aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.ResultSet"); + aSupported[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.ResultSet"); + return aSupported; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + const ::rtl::OUString* pSupported = aSupported.getConstArray(); + for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) + if (pSupported->equals(_rServiceName)) + return sal_True; + + return sal_False; +} +// ------------------------------------------------------------------------- +OResultSet::OResultSet(ADORecordset* _pRecordSet,OStatement_Base* pStmt) : OResultSet_BASE(m_aMutex) + ,OPropertySetHelper(OResultSet_BASE::rBHelper) + ,m_aStatement((::cppu::OWeakObject*)pStmt) + ,m_pStmt(pStmt) + ,m_nRowPos(0) + ,m_xMetaData(NULL) + ,m_pRecordSet(_pRecordSet) + ,m_bEOF(sal_False) +{ + osl_incrementInterlockedCount( &m_refCount ); + OSL_ENSHURE(_pRecordSet,"No RecordSet !"); + if(!_pRecordSet) + throw SQLException(); + m_pRecordSet->AddRef(); + VARIANT_BOOL bIsAtBOF; + CHECK_RETURN(m_pRecordSet->get_BOF(&bIsAtBOF)) + m_bOnFirstAfterOpen = !(sal_Bool)bIsAtBOF; + osl_decrementInterlockedCount( &m_refCount ); +} +// ------------------------------------------------------------------------- +OResultSet::OResultSet(ADORecordset* _pRecordSet) : OResultSet_BASE(m_aMutex) + ,OPropertySetHelper(OResultSet_BASE::rBHelper) + ,m_aStatement(NULL) + ,m_xMetaData(NULL) + ,m_pRecordSet(_pRecordSet) + ,m_bEOF(sal_False) +{ + osl_incrementInterlockedCount( &m_refCount ); + OSL_ENSHURE(_pRecordSet,"No RecordSet !"); + if(!_pRecordSet) + throw SQLException(); + m_pRecordSet->AddRef(); + VARIANT_BOOL bIsAtBOF; + CHECK_RETURN(m_pRecordSet->get_BOF(&bIsAtBOF)) + m_bOnFirstAfterOpen = !(sal_Bool)bIsAtBOF; + osl_decrementInterlockedCount( &m_refCount ); + // allocBuffer(); +} + +// ------------------------------------------------------------------------- +OResultSet::~OResultSet() +{ + if(m_pRecordSet) + m_pRecordSet->Release(); +} +// ------------------------------------------------------------------------- +void OResultSet::disposing(void) +{ + OPropertySetHelper::disposing(); + + ::osl::MutexGuard aGuard(m_aMutex); + if(m_pRecordSet) + m_pRecordSet->Close(); + m_aStatement = NULL; + m_xMetaData = NULL; +} +// ------------------------------------------------------------------------- +Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = OPropertySetHelper::queryInterface(rType); + if(!aRet.hasValue()) + aRet = OResultSet_BASE::queryInterface(rType); + return aRet; +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OResultSet::getTypes( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),OResultSet_BASE::getTypes()); +} + +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + Reference< XResultSetMetaData > xMeta = getMetaData(); + sal_Int32 nLen = xMeta->getColumnCount(); + sal_Int32 i = 1; + for(;i<=nLen;++i) + if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) : columnName.equalsIgnoreCase(xMeta->getColumnName(i))) + break; + return i; +} +// ------------------------------------------------------------------------- +Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + return NULL; +} +// ------------------------------------------------------------------------- +Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + return NULL; +} + +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + ADO_GETFIELD(columnIndex); + aField.get_Value(m_aValue); + return m_aValue; +} +// ------------------------------------------------------------------------- + +sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + ADO_GETFIELD(columnIndex); + aField.get_Value(m_aValue); + return m_aValue; +} +// ------------------------------------------------------------------------- + +Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + ADO_GETFIELD(columnIndex); + aField.get_Value(m_aValue); + return m_aValue; +} +// ------------------------------------------------------------------------- + +::com::sun::star::util::Date SAL_CALL OResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + ADO_GETFIELD(columnIndex); + aField.get_Value(m_aValue); + return m_aValue; +} +// ------------------------------------------------------------------------- + +double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + ADO_GETFIELD(columnIndex); + aField.get_Value(m_aValue); + return m_aValue; +} +// ------------------------------------------------------------------------- + +float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + ADO_GETFIELD(columnIndex); + aField.get_Value(m_aValue); + return m_aValue; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + ADO_GETFIELD(columnIndex); + aField.get_Value(m_aValue); + return m_aValue; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + PositionEnum aPos; + m_pRecordSet->get_AbsolutePosition(&aPos); + return (aPos > 0) ? aPos : m_nRowPos; + // return the rowcount from driver if the driver doesn't support this return our count +} +// ------------------------------------------------------------------------- + +sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + ADO_GETFIELD(columnIndex); + return sal_Int64(0); +} +// ------------------------------------------------------------------------- + +Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(!m_xMetaData.is()) + m_xMetaData = new OResultSetMetaData(m_pRecordSet); + return m_xMetaData; +} +// ------------------------------------------------------------------------- +Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + + return NULL; +} + +// ------------------------------------------------------------------------- + +Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + + return NULL; +} +// ------------------------------------------------------------------------- + +Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + + return NULL; +} +// ------------------------------------------------------------------------- + +Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException) +{ + + return Any(); +} +// ------------------------------------------------------------------------- + +sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + ADO_GETFIELD(columnIndex); + aField.get_Value(m_aValue); + return m_aValue; +} +// ------------------------------------------------------------------------- + +::rtl::OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + ADO_GETFIELD(columnIndex); + m_aValue = aField.get_Value(); + return m_aValue; +} + +// ------------------------------------------------------------------------- + + +::com::sun::star::util::Time SAL_CALL OResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + ADO_GETFIELD(columnIndex); + aField.get_Value(m_aValue); + return m_aValue; +} +// ------------------------------------------------------------------------- + + +::com::sun::star::util::DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + ADO_GETFIELD(columnIndex); + aField.get_Value(m_aValue); + return m_aValue; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::isAfterLast( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + sal_Int16 bIsAtEOF; + CHECK_RETURN(m_pRecordSet->get_EOF(&bIsAtEOF)) + return bIsAtEOF; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::isFirst( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_nRowPos == 1; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::isLast( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return sal_True; +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::beforeFirst( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(first()) + previous(); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::afterLast( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(last()) + next(); + m_bEOF = sal_True; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException) +{ + { + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + } + dispose(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(SUCCEEDED(m_pRecordSet->MoveFirst())) + { + m_nRowPos = 1; + return sal_True; + } + return sal_False; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + sal_Bool bRet = SUCCEEDED(m_pRecordSet->MoveLast()); + if(bRet) + m_pRecordSet->get_RecordCount(&m_nRowPos); + return bRet; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(!row) // absolute with zero not allowed + throw SQLException(); + + sal_Bool bCheck = sal_True; + if(row < 0) + { + if(bCheck = SUCCEEDED(m_pRecordSet->MoveLast())) + { + while(++row < 0 && bCheck) + bCheck = m_pRecordSet->MovePrevious(); + } + } + else + { + first(); + OLEVariant aEmpty; + aEmpty.setNoArg(); + bCheck = SUCCEEDED(m_pRecordSet->Move(row-1,aEmpty)); // move to row -1 because we stand already on the first + if(bCheck) + m_nRowPos = row; + } + return bCheck; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + OLEVariant aEmpty; + aEmpty.setNoArg(); + sal_Bool bRet = SUCCEEDED(m_pRecordSet->Move(row,aEmpty)); + if(bRet) + m_nRowPos += row; + return bRet; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + sal_Bool bRet = SUCCEEDED(m_pRecordSet->MovePrevious()); + if(bRet) + --m_nRowPos; + return bRet; +} +// ------------------------------------------------------------------------- +Reference< XInterface > SAL_CALL OResultSet::getStatement( ) throw(SQLException, RuntimeException) +{ + return m_aStatement.get(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::rowDeleted( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + RecordStatusEnum eRec; + m_pRecordSet->get_Status((sal_Int32*)&eRec); + sal_Bool bRet = (eRec & adRecDeleted) == adRecDeleted; + if(bRet) + --m_nRowPos; + return bRet; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::rowInserted( ) throw(SQLException, RuntimeException) +{ ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + RecordStatusEnum eRec; + m_pRecordSet->get_Status((sal_Int32*)&eRec); + sal_Bool bRet = (eRec & adRecNew) == adRecNew; + if(bRet) + ++m_nRowPos; + return bRet; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::rowUpdated( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + RecordStatusEnum eRec; + m_pRecordSet->get_Status((sal_Int32*)&eRec); + return (eRec & adRecModified) == adRecModified; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + OSL_ENSHURE(!m_nRowPos,"OResultSet::isBeforeFirst: Error in setting m_nRowPos!"); + sal_Int16 bIsAtBOF; + m_pRecordSet->get_BOF(&bIsAtBOF); + return bIsAtBOF; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + sal_Bool bRet = sal_True; + if(m_bOnFirstAfterOpen) + { + m_bOnFirstAfterOpen = sal_False; + ++m_nRowPos; + } + else + { + bRet = SUCCEEDED(m_pRecordSet->MoveNext()); + + if(bRet) + { + VARIANT_BOOL bIsAtEOF; + CHECK_RETURN(m_pRecordSet->get_EOF(&bIsAtEOF)) + bRet = !(sal_Bool)bIsAtEOF; + ++m_nRowPos; + } + else + ADOS::ThrowException(*m_pStmt->m_pConnection->getConnection(),*this); + } + + return bRet; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::wasNull( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_aValue.isNull(); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::cancel( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_pRecordSet->Cancel(); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::clearWarnings( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- +Any SAL_CALL OResultSet::getWarnings( ) throw(SQLException, RuntimeException) +{ + return Any(); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + OLEVariant aEmpty; + aEmpty.setNoArg(); + m_pRecordSet->AddNew(aEmpty,aEmpty); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateRow( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + OLEVariant aEmpty; + aEmpty.setNoArg(); + m_pRecordSet->Update(aEmpty,aEmpty); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::deleteRow( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_pRecordSet->Delete(adAffectCurrent); + m_pRecordSet->UpdateBatch(adAffectCurrent); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::cancelRowUpdates( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_pRecordSet->CancelUpdate(); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::moveToInsertRow( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::moveToCurrentRow( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + + ADO_GETFIELD(columnIndex); + OLEVariant x; + x.setNull(); + aField.PutValue(x); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + + ADO_GETFIELD(columnIndex); + aField.PutValue(x); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + + ADO_GETFIELD(columnIndex); + aField.PutValue(x); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + + ADO_GETFIELD(columnIndex); + aField.PutValue(x); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + + ADO_GETFIELD(columnIndex); + aField.PutValue(x); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + + ADO_GETFIELD(columnIndex); + aField.PutValue(x); +} +// ----------------------------------------------------------------------- +void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + + ADO_GETFIELD(columnIndex); + aField.PutValue(x); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + + ADO_GETFIELD(columnIndex); + aField.PutValue(x); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + + ADO_GETFIELD(columnIndex); + aField.PutValue(x); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + + ADO_GETFIELD(columnIndex); + aField.PutValue(x); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + + ADO_GETFIELD(columnIndex); + aField.PutValue(x); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + + ADO_GETFIELD(columnIndex); + aField.PutValue(x); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + + ADO_GETFIELD(columnIndex); + aField.PutValue(x); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) +{ + +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) +{ + +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_pRecordSet->Resync(adAffectCurrent,adResyncAllValues); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException) +{ + +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 scale ) throw(SQLException, RuntimeException) +{ + + OSL_ENSHURE(0,"OResultSet::updateNumericObject: NYI"); +} +//------------------------------------------------------------------------------ +// XRowLocate +Any SAL_CALL OResultSet::getBookmark( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(m_nRowPos < m_aBookmarks.size()) // this bookmark was already fetched + return makeAny(sal_Int32(m_nRowPos-1)); + + OLEVariant aVar; + m_pRecordSet->get_Bookmark(&aVar); + m_aBookmarks.push_back(aVar); + return makeAny((sal_Int32)(m_aBookmarks.size()-1)); + +} +//------------------------------------------------------------------------------ +sal_Bool SAL_CALL OResultSet::moveToBookmark( const Any& bookmark ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + sal_Int32 nPos; + bookmark >>= nPos; + OSL_ENSHURE(nPos >= 0 && nPos < m_aBookmarks.size(),"Invalid Index for vector"); + if(nPos < 0 || nPos >= m_aBookmarks.size()) + throw SQLException(); + + return SUCCEEDED(m_pRecordSet->Move(0,m_aBookmarks[nPos])); +} +//------------------------------------------------------------------------------ +sal_Bool SAL_CALL OResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + sal_Int32 nPos; + bookmark >>= nPos; + nPos += rows; + OSL_ENSHURE(nPos >= 0 && nPos < m_aBookmarks.size(),"Invalid Index for vector"); + if(nPos < 0 || nPos >= m_aBookmarks.size()) + throw SQLException(); + return SUCCEEDED(m_pRecordSet->Move(rows,m_aBookmarks[nPos])); +} +//------------------------------------------------------------------------------ +sal_Int32 SAL_CALL OResultSet::compareBookmarks( const Any& first, const Any& second ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + sal_Int32 nPos1; + first >>= nPos1; + sal_Int32 nPos2; + second >>= nPos2; + if(nPos1 == nPos2) // they should be equal + return sal_True; + + OSL_ENSHURE((nPos1 >= 0 && nPos1 < m_aBookmarks.size()) || (nPos1 >= 0 && nPos2 < m_aBookmarks.size()),"Invalid Index for vector"); + + CompareEnum eNum; + m_pRecordSet->CompareBookmarks(m_aBookmarks[nPos1],m_aBookmarks[nPos2],&eNum); + return ((sal_Int32)eNum) +1; +} +//------------------------------------------------------------------------------ +sal_Bool SAL_CALL OResultSet::hasOrderedBookmarks( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + ADOProperties* pProps = NULL; + m_pRecordSet->get_Properties(&pProps); + WpOLEAppendCollection<ADOProperties, ADOProperty, WpADOProperty> aProps(pProps); + ADOS::ThrowException(*((OConnection*)m_pStmt->getConnection().get())->getConnection(),*this); + OSL_ENSHURE(aProps.IsValid(),"There are no properties at the connection"); + + WpADOProperty aProp(aProps.GetItem(::rtl::OUString::createFromAscii("Bookmarks Ordered"))); + OLEVariant aVar; + if(aProp.IsValid()) + aVar = aProp.GetValue(); + else + ADOS::ThrowException(*((OConnection*)m_pStmt->getConnection().get())->getConnection(),*this); + + sal_Bool bValue(sal_False); + if(!aVar.isNull() && !aVar.isEmpty()) + bValue = aVar; + return bValue; +} +//------------------------------------------------------------------------------ +sal_Int32 SAL_CALL OResultSet::hashBookmark( const Any& bookmark ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + sal_Int32 nPos; + bookmark >>= nPos; + return nPos; +} +//------------------------------------------------------------------------------ +// XDeleteRows +Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >& rows ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + OLEVariant aVar; + sal_Int32 nPos; + + // Create SafeArray Bounds and initialize the array + SAFEARRAYBOUND rgsabound[1]; + rgsabound[0].lLbound = 0; + rgsabound[0].cElements = rows.getLength(); + SAFEARRAY *psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound ); + + const Any* pBegin = rows.getConstArray(); + const Any* pEnd = pBegin + rows.getLength(); + for(sal_Int32 i=0;pBegin != pEnd ;++pBegin,++i) + { + *pBegin >>= nPos; + SafeArrayPutElement(psa,&i,&m_aBookmarks[nPos]); + } + + // Initialize and fill the SafeArray + OLEVariant vsa; + vsa.setArray(psa,VT_VARIANT); + + m_pRecordSet->put_Filter(vsa); + m_pRecordSet->Delete(adAffectGroup); + m_pRecordSet->UpdateBatch(adAffectGroup); + + Sequence< sal_Int32 > aSeq(rows.getLength()); + if(first()) + { + sal_Int32* pSeq = aSeq.getArray(); + sal_Int32 i=0; + do + { + OSL_ENSHURE(i<aSeq.getLength(),"Index greater than length of sequence"); + m_pRecordSet->get_Status(&pSeq[i]); + if(pSeq[i++] == adRecDeleted) + --m_nRowPos; + } + while(next()); + } + return aSeq; +} +//------------------------------------------------------------------------------ +sal_Int32 OResultSet::getResultSetConcurrency() const +{ + sal_Int32 nValue=0; + LockTypeEnum eRet; + if(!SUCCEEDED(m_pRecordSet->get_LockType(&eRet))) + { + switch(eRet) + { + case adLockReadOnly: + nValue = ResultSetConcurrency::READ_ONLY; + break; + default: + nValue = ResultSetConcurrency::UPDATABLE; + break; + } + } + return nValue; +} +//------------------------------------------------------------------------------ +sal_Int32 OResultSet::getResultSetType() const +{ + sal_Int32 nValue=0; + CursorTypeEnum eRet; + if(!SUCCEEDED(m_pRecordSet->get_CursorType(&eRet))) + { + switch(eRet) + { + case adOpenUnspecified: + case adOpenForwardOnly: + nValue = ResultSetType::FORWARD_ONLY; + break; + case adOpenStatic: + case adOpenKeyset: + nValue = ResultSetType::SCROLL_INSENSITIVE; + break; + case adOpenDynamic: + nValue = ResultSetType::SCROLL_SENSITIVE; + break; + } + } + return nValue; +} +//------------------------------------------------------------------------------ +sal_Int32 OResultSet::getFetchDirection() const +{ + return FetchDirection::FORWARD; +} +//------------------------------------------------------------------------------ +sal_Int32 OResultSet::getFetchSize() const +{ + sal_Int32 nValue=-1; + m_pRecordSet->get_CacheSize(&nValue); + return nValue; +} +//------------------------------------------------------------------------------ +::rtl::OUString OResultSet::getCursorName() const +{ + return ::rtl::OUString(); +} + +//------------------------------------------------------------------------------ +void OResultSet::setFetchDirection(sal_Int32 _par0) +{ +} +//------------------------------------------------------------------------------ +void OResultSet::setFetchSize(sal_Int32 _par0) +{ + m_pRecordSet->put_CacheSize(_par0); +} +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper* OResultSet::createArrayHelper( ) const +{ + Sequence< com::sun::star::beans::Property > aProps(5); + com::sun::star::beans::Property* pProperties = aProps.getArray(); + sal_Int32 nPos = 0; + + // DECL_PROP1IMPL(CURSORNAME, ::rtl::OUString) PropertyAttribute::READONLY); + DECL_PROP0(FETCHDIRECTION, sal_Int32); + DECL_PROP0(FETCHSIZE, sal_Int32); + DECL_BOOL_PROP1IMPL(ISBOOKMARKABLE) PropertyAttribute::READONLY); + DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY); + DECL_PROP1IMPL(RESULTSETTYPE, sal_Int32) PropertyAttribute::READONLY); + + return new ::cppu::OPropertyArrayHelper(aProps); +} +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper & OResultSet::getInfoHelper() +{ + return *const_cast<OResultSet*>(this)->getArrayHelper(); +} +// ------------------------------------------------------------------------- +sal_Bool OResultSet::convertFastPropertyValue( + Any & rConvertedValue, + Any & rOldValue, + sal_Int32 nHandle, + const Any& rValue ) + throw (::com::sun::star::lang::IllegalArgumentException) +{ + switch(nHandle) + { + case PROPERTY_ID_ISBOOKMARKABLE: + case PROPERTY_ID_CURSORNAME: + case PROPERTY_ID_RESULTSETCONCURRENCY: + case PROPERTY_ID_RESULTSETTYPE: + throw ::com::sun::star::lang::IllegalArgumentException(); + break; + case PROPERTY_ID_FETCHDIRECTION: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection()); + case PROPERTY_ID_FETCHSIZE: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize()); + default: + ; + } + return sal_False; +} +// ------------------------------------------------------------------------- +void OResultSet::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)throw (Exception) +{ + switch(nHandle) + { + case PROPERTY_ID_ISBOOKMARKABLE: + case PROPERTY_ID_CURSORNAME: + case PROPERTY_ID_RESULTSETCONCURRENCY: + case PROPERTY_ID_RESULTSETTYPE: + throw Exception(); + break; + case PROPERTY_ID_FETCHDIRECTION: + setFetchDirection(getINT32(rValue)); + break; + case PROPERTY_ID_FETCHSIZE: + setFetchSize(getINT32(rValue)); + break; + default: + ; + } +} +// ------------------------------------------------------------------------- +void OResultSet::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const +{ + switch(nHandle) + { + case PROPERTY_ID_ISBOOKMARKABLE: + { + VARIANT_BOOL bBool; + m_pRecordSet->Supports(adBookmark,&bBool); + sal_Bool bRet = bBool == VARIANT_TRUE; + rValue.setValue(&bRet, ::getCppuBooleanType() ); + } + break; + case PROPERTY_ID_CURSORNAME: + rValue <<= getCursorName(); + break; + case PROPERTY_ID_RESULTSETCONCURRENCY: + rValue <<= getResultSetConcurrency(); + break; + case PROPERTY_ID_RESULTSETTYPE: + rValue <<= getResultSetType(); + break; + case PROPERTY_ID_FETCHDIRECTION: + rValue <<= getFetchDirection(); + break; + case PROPERTY_ID_FETCHSIZE: + rValue <<= getFetchSize(); + break; + } +} + + diff --git a/connectivity/source/drivers/ado/AResultSetMetaData.cxx b/connectivity/source/drivers/ado/AResultSetMetaData.cxx new file mode 100644 index 000000000000..fa1161fd358a --- /dev/null +++ b/connectivity/source/drivers/ado/AResultSetMetaData.cxx @@ -0,0 +1,257 @@ +/************************************************************************* + * + * $RCSfile: AResultSetMetaData.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_ARESULTSETMETADATA_HXX_ +#include "ado/AResultSetMetaData.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif + +#ifndef _CONNECTIVITY_ADO_AWRAPADO_HXX_ +#include "ado/Awrapado.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif + +using namespace connectivity; +using namespace connectivity::ado; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; + +// ------------------------------------------------------------------------- +OResultSetMetaData::~OResultSetMetaData() +{ + m_pRecordSet->Release(); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + ADO_GETFIELD(column); + if(aField.IsValid() && aField.GetActualSize() != -1) + return aField.GetActualSize(); + return 0; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + ADO_GETFIELD(column); + return ADOS::MapADOType2Jdbc(aField.GetADOType()); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException) +{ + if(m_nColCount != -1) + return m_nColCount; + + ADOFields* pFields = NULL; + m_pRecordSet->get_Fields(&pFields); + WpOLEAppendCollection<ADOFields, ADOField, WpADOField> aFields(pFields); + m_nColCount = aFields.GetItemCount(); + return m_nColCount; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- + +::rtl::OUString SAL_CALL OResultSetMetaData::getSchemaName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- + +::rtl::OUString SAL_CALL OResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + ADO_GETFIELD(column); + if(aField.IsValid()) + return aField.GetName(); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getCatalogName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getColumnName(column); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getColumnServiceName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + ADO_GETFIELD(column); + if(aField.IsValid()) + { + return (aField.GetAttributes() & adFldFixed) == adFldFixed; + } + return sal_False; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- + + +sal_Bool SAL_CALL OResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + ADO_GETFIELD(column); + if(aField.IsValid()) + { + return (aField.GetAttributes() & adFldNegativeScale) == adFldNegativeScale; + } + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + ADO_GETFIELD(column); + if(aField.IsValid()) + return aField.GetPrecision(); + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + ADO_GETFIELD(column); + if(aField.IsValid()) + return aField.GetNumericScale(); + return 0; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + ADO_GETFIELD(column); + if(aField.IsValid()) + { + return (aField.GetAttributes() & adFldIsNullable) == adFldIsNullable; + } + return sal_False; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + ADO_GETFIELD(column); + if(aField.IsValid()) + { + // return (aField.GetStatus() & adFieldReadOnly) == adFieldReadOnly; + } + return sal_False; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + ADO_GETFIELD(column); + if(aField.IsValid()) + { + return (aField.GetAttributes() & adFldUpdatable) == adFldUpdatable; + } + return sal_False; +; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return isDefinitelyWritable(column); +} +// ------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/ado/AStatement.cxx b/connectivity/source/drivers/ado/AStatement.cxx new file mode 100644 index 000000000000..652b17b42c4a --- /dev/null +++ b/connectivity/source/drivers/ado/AStatement.cxx @@ -0,0 +1,840 @@ +/************************************************************************* + * + * $RCSfile: AStatement.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADO_ASTATEMENT_HXX_ +#include "ado/AStatement.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_ACONNECTION_HXX_ +#include "ado/AConnection.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_ARESULTSET_HXX_ +#include "ado/AResultSet.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +#ifndef _UTL_PROPERTY_HXX_ +#include <unotools/property.hxx> +#endif +#ifndef _UTL_UNO3_HXX_ +#include <unotools/uno3.hxx> +#endif +#ifndef _OSL_THREAD_H_ +#include <osl/thread.h> +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_ +#include <com/sun/star/sdbc/ResultSetConcurrency.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_ +#include <com/sun/star/sdbc/ResultSetType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_FETCHDIRECTION_HPP_ +#include <com/sun/star/sdbc/FetchDirection.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif + +#define CHECK_RETURN(x) \ + if(!x) \ + ADOS::ThrowException(*m_pConnection->getConnection(),*this); + +using namespace connectivity::ado; + +//------------------------------------------------------------------------------ +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; + +//------------------------------------------------------------------------------ +OStatement_Base::OStatement_Base(OConnection* _pConnection ) : OStatement_BASE(m_aMutex) + ,OPropertySetHelper(OStatement_BASE::rBHelper) + ,OSubComponent< OStatement_Base>((::cppu::OWeakObject*)_pConnection) + ,m_pConnection(_pConnection) + ,m_nFetchSize(1) + ,m_nMaxRows(0) + ,m_eLockType(adLockReadOnly) + ,m_eCursorType(adOpenForwardOnly) +{ + osl_incrementInterlockedCount( &m_refCount ); + + m_Command.Create(); + if(m_Command.IsValid()) + m_Command.putref_ActiveConnection(m_pConnection->getConnection()); + else + ADOS::ThrowException(*m_pConnection->getConnection(),*this); + + m_RecordsAffected.setNoArg(); + m_Parameters.setNoArg(); + + m_pConnection->acquire(); + + osl_decrementInterlockedCount( &m_refCount ); +} +//------------------------------------------------------------------------------ +void OStatement_Base::disposeResultSet() +{ + // free the cursor if alive + Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY); + if (xComp.is()) + xComp->dispose(); + m_xResultSet = Reference< XResultSet>(); +} + +//------------------------------------------------------------------------------ +void OStatement_Base::disposing() +{ + ::osl::MutexGuard aGuard(m_aMutex); + + + disposeResultSet(); + + m_Command.clear(); + m_RecordSet.clear(); + + if (m_pConnection) + m_pConnection->release(); + + dispose_ChildImpl(); + OStatement_BASE::disposing(); +} +//----------------------------------------------------------------------------- +void SAL_CALL OStatement_Base::release() throw(RuntimeException) +{ + relase_ChildImpl(); + OStatement_BASE::release(); +} +//----------------------------------------------------------------------------- +Any SAL_CALL OStatement_Base::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = OStatement_BASE::queryInterface(rType); + if(!aRet.hasValue()) + aRet = OPropertySetHelper::queryInterface(rType); + return aRet; +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OStatement_Base::getTypes( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),OStatement_BASE::getTypes()); +} + +// ------------------------------------------------------------------------- + +void SAL_CALL OStatement_Base::cancel( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + CHECK_RETURN(m_Command.Cancel()) +} +// ------------------------------------------------------------------------- + +void SAL_CALL OStatement_Base::close( ) throw(SQLException, RuntimeException) +{ + { + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + } + dispose(); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OStatement::clearBatch( ) throw(SQLException, RuntimeException) +{ + +} +// ------------------------------------------------------------------------- + +void OStatement_Base::reset() throw (SQLException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + clearWarnings (); + + if (m_xResultSet.get().is()) + clearMyResultSet(); + else + { + if(0) + { + m_Command.clear(); + m_Command.Create(); + if(m_Command.IsValid()) + m_Command.putref_ActiveConnection(m_pConnection->getConnection()); + else + ADOS::ThrowException(*m_pConnection->getConnection(),*this); + + m_RecordsAffected.setNoArg(); + m_Parameters.setNoArg(); + } + } +} +//-------------------------------------------------------------------- +// clearMyResultSet +// If a ResultSet was created for this Statement, close it +//-------------------------------------------------------------------- + +void OStatement_Base::clearMyResultSet () throw (SQLException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + Reference<XCloseable> xCloseable; + if(::utl::query_interface(m_xResultSet.get(),xCloseable)) + xCloseable->close(); + m_xResultSet = Reference< XResultSet>(); +} +//-------------------------------------------------------------------- +sal_Int32 OStatement_Base::getRowCount () throw( SQLException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_RecordsAffected; +} +//-------------------------------------------------------------------- +// getPrecision +// Given a SQL type, return the maximum precision for the column. +// Returns -1 if not known +//-------------------------------------------------------------------- + +sal_Int32 OStatement_Base::getPrecision ( sal_Int32 sqlType) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + sal_Int32 prec = -1; + OTypeInfo aInfo; + aInfo.nType = sqlType; + if (m_aTypeInfo.size()) + { + ::std::vector<OTypeInfo>::const_iterator aIter = ::std::find(m_aTypeInfo.begin(),m_aTypeInfo.end(),aInfo); + for(;aIter != m_aTypeInfo.end();++aIter) + { + prec = max(prec,(*aIter).nPrecision); + } + } + + return prec; +} +//-------------------------------------------------------------------- +// setWarning +// Sets the warning +//-------------------------------------------------------------------- + +void OStatement_Base::setWarning (const SQLWarning &ex) throw( SQLException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_aLastWarning = ex; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OStatement_Base::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + // Reset the statement handle and warning + + reset(); + + try { + ADORecordset* pSet = NULL; + CHECK_RETURN(m_Command.put_CommandText(sql)) + CHECK_RETURN(m_Command.Execute(m_RecordsAffected,m_Parameters,adCmdText,&pSet)) + m_RecordSet = WpADORecordset(pSet); + } + catch (SQLWarning& ex) { + + // Save pointer to warning and save with ResultSet + // object once it is created. + + m_aLastWarning = ex; + } + + return m_RecordSet.IsValid(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + reset(); + + m_xResultSet = WeakReference<XResultSet>(NULL); + + WpADORecordset aSet; + aSet.Create(); + CHECK_RETURN(m_Command.put_CommandText(sql)) + OLEVariant aCmd; + aCmd.setIDispatch(m_Command); + OLEVariant aCon; + aCon.setNoArg(); + CHECK_RETURN(aSet.put_CacheSize(m_nFetchSize)) + CHECK_RETURN(aSet.put_MaxRecords(m_nMaxRows)) + CHECK_RETURN(aSet.Open(aCmd,aCon,m_eCursorType,m_eLockType,adOpenUnspecified)) + + + CHECK_RETURN(aSet.get_CacheSize(m_nFetchSize)) + CHECK_RETURN(aSet.get_MaxRecords(m_nMaxRows)) + CHECK_RETURN(aSet.get_CursorType(m_eCursorType)) + CHECK_RETURN(aSet.get_LockType(m_eLockType)) + + OResultSet* pSet = new OResultSet(aSet,this); + Reference< XResultSet > pRs = pSet; + + m_xResultSet = WeakReference<XResultSet>(pRs); + + return m_xResultSet; +} +// ------------------------------------------------------------------------- + +Reference< XConnection > SAL_CALL OStatement_Base::getConnection( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return (Reference< XConnection >)m_pConnection; +} +// ------------------------------------------------------------------------- + +Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = ::cppu::queryInterface(rType,static_cast< XBatchExecution*> (this)); + if(!aRet.hasValue()) + aRet = OStatement_Base::queryInterface(rType); + return aRet; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OStatement::addBatch( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_aBatchList.push_back(sql); +} +// ------------------------------------------------------------------------- +Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + reset(); + + ::rtl::OUString aBatchSql; + sal_Int32 nLen = 0; + for(::std::list< ::rtl::OUString>::const_iterator i=m_aBatchList.begin();i != m_aBatchList.end();++i,++nLen) + aBatchSql = aBatchSql + *i + ::rtl::OUString::createFromAscii(";"); + + ADORecordset* pSet=NULL; + m_RecordSet.clear(); + m_RecordSet.Create(); + + CHECK_RETURN(m_Command.put_CommandText(aBatchSql)) + m_RecordSet.PutRefDataSource((IDispatch*)&m_Command); + + CHECK_RETURN(m_RecordSet.UpdateBatch(adAffectAll)) + + Sequence< sal_Int32 > aRet(nLen); + sal_Int32* pArray = aRet.getArray(); + for(sal_Int32 j=0;j<nLen;++j) + { + pSet = NULL; + OLEVariant aRecordsAffected; + if(m_RecordSet.NextRecordset(aRecordsAffected,&pSet) && pSet) + { + m_RecordSet = WpADORecordset(pSet); + sal_Int32 nValue; + if(m_RecordSet.get_RecordCount(nValue)) + pArray[j] = nValue; + } + } + return aRet; +} +// ------------------------------------------------------------------------- + + +sal_Int32 SAL_CALL OStatement_Base::executeUpdate( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + reset(); + + try { + ADORecordset* pSet = NULL; + CHECK_RETURN(m_Command.put_CommandText(sql)) + CHECK_RETURN(m_Command.Execute(m_RecordsAffected,m_Parameters,adCmdText|adExecuteNoRecords,&pSet)) + } + catch (SQLWarning& ex) { + + // Save pointer to warning and save with ResultSet + // object once it is created. + + m_aLastWarning = ex; + } + if(!m_RecordsAffected.isEmpty() && !m_RecordsAffected.isNull() && m_RecordsAffected.getType() != VT_ERROR) + return m_RecordsAffected; + + return 0; +} +// ------------------------------------------------------------------------- + +Reference< XResultSet > SAL_CALL OStatement_Base::getResultSet( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_xResultSet; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OStatement_Base::getUpdateCount( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + sal_Int32 nRet; + if(m_RecordSet.IsValid() && m_RecordSet.get_RecordCount(nRet)) + return nRet; + return -1; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OStatement_Base::getMoreResults( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + SQLWarning warning; + + // clear previous warnings + + clearWarnings (); + + // Call SQLMoreResults + + try { + ADORecordset* pSet=NULL; + OLEVariant aRecordsAffected; + if(m_RecordSet.IsValid() && m_RecordSet.NextRecordset(aRecordsAffected,&pSet) && pSet) + m_RecordSet = WpADORecordset(pSet); + } + catch (SQLWarning &ex) { + + // Save pointer to warning and save with ResultSet + // object once it is created. + + warning = ex; + } + return m_RecordSet.IsValid(); +} +// ------------------------------------------------------------------------- + +// ------------------------------------------------------------------------- +Any SAL_CALL OStatement_Base::getWarnings( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return makeAny(m_aLastWarning); +} +// ------------------------------------------------------------------------- + +// ------------------------------------------------------------------------- +void SAL_CALL OStatement_Base::clearWarnings( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_aLastWarning = SQLWarning(); +} +// ------------------------------------------------------------------------- +//------------------------------------------------------------------------------ +sal_Int32 OStatement_Base::getQueryTimeOut() const throw(SQLException, RuntimeException) +{ + return m_Command.get_CommandTimeout(); +} +//------------------------------------------------------------------------------ +sal_Int32 OStatement_Base::getMaxRows() const throw(SQLException, RuntimeException) +{ + sal_Int32 nRet=-1; + if(!m_RecordSet.IsValid() && m_RecordSet.get_MaxRecords(nRet)) + throw SQLException(); + return nRet; +} +//------------------------------------------------------------------------------ +sal_Int32 OStatement_Base::getResultSetConcurrency() const throw(SQLException, RuntimeException) +{ + return m_eLockType; + sal_Int32 nValue=0; + switch(m_eLockType) + { + case adLockReadOnly: + nValue = ResultSetConcurrency::READ_ONLY; + break; + default: + nValue = ResultSetConcurrency::UPDATABLE; + break; + } + + return nValue; +} +//------------------------------------------------------------------------------ +sal_Int32 OStatement_Base::getResultSetType() const throw(SQLException, RuntimeException) +{ + sal_Int32 nValue=0; + switch(m_eCursorType) + { + case adOpenUnspecified: + case adOpenForwardOnly: + nValue = ResultSetType::FORWARD_ONLY; + break; + case adOpenStatic: + case adOpenKeyset: + nValue = ResultSetType::SCROLL_INSENSITIVE; + break; + case adOpenDynamic: + nValue = ResultSetType::SCROLL_SENSITIVE; + break; + } + return nValue; +} +//------------------------------------------------------------------------------ +sal_Int32 OStatement_Base::getFetchDirection() const throw(SQLException, RuntimeException) +{ + return FetchDirection::FORWARD; +} +//------------------------------------------------------------------------------ +sal_Int32 OStatement_Base::getFetchSize() const throw(SQLException, RuntimeException) +{ + return m_nFetchSize; +} +//------------------------------------------------------------------------------ +sal_Int32 OStatement_Base::getMaxFieldSize() const throw(SQLException, RuntimeException) +{ + return 0; +} +//------------------------------------------------------------------------------ +::rtl::OUString OStatement_Base::getCursorName() const throw(SQLException, RuntimeException) +{ + return m_Command.GetName(); +} +//------------------------------------------------------------------------------ +void OStatement_Base::setQueryTimeOut(sal_Int32 seconds) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_Command.put_CommandTimeout(seconds); +} +//------------------------------------------------------------------------------ +void OStatement_Base::setMaxRows(sal_Int32 _par0) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_nMaxRows = _par0; +} +//------------------------------------------------------------------------------ +void OStatement_Base::setResultSetConcurrency(sal_Int32 _par0) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + switch(_par0) + { + case ResultSetConcurrency::READ_ONLY: + m_eLockType = adLockReadOnly; + break; + default: + m_eLockType = adLockOptimistic; + break; + } +} +//------------------------------------------------------------------------------ +void OStatement_Base::setResultSetType(sal_Int32 _par0) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + switch(_par0) + { + case ResultSetType::FORWARD_ONLY: + m_eCursorType = adOpenForwardOnly; + break; + case ResultSetType::SCROLL_INSENSITIVE: + m_eCursorType = adOpenKeyset; + break; + case ResultSetType::SCROLL_SENSITIVE: + m_eCursorType = adOpenDynamic; + break; + } +} +//------------------------------------------------------------------------------ +void OStatement_Base::setFetchDirection(sal_Int32 _par0) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); +} +//------------------------------------------------------------------------------ +void OStatement_Base::setFetchSize(sal_Int32 _par0) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_nFetchSize = _par0; + // m_RecordSet.put_CacheSize(_par0); +} +//------------------------------------------------------------------------------ +void OStatement_Base::setMaxFieldSize(sal_Int32 _par0) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + +} +//------------------------------------------------------------------------------ +void OStatement_Base::setCursorName(const ::rtl::OUString &_par0) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + m_Command.put_Name(_par0); +} + +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper* OStatement_Base::createArrayHelper( ) const +{ + Sequence< com::sun::star::beans::Property > aProps(10); + com::sun::star::beans::Property* pProperties = aProps.getArray(); + sal_Int32 nPos = 0; + DECL_PROP0(CURSORNAME, ::rtl::OUString); + DECL_BOOL_PROP0(ESCAPEPROCESSING); + DECL_PROP0(FETCHDIRECTION,sal_Int32); + DECL_PROP0(FETCHSIZE, sal_Int32); + DECL_PROP0(MAXFIELDSIZE,sal_Int32); + DECL_PROP0(MAXROWS, sal_Int32); + DECL_PROP0(QUERYTIMEOUT,sal_Int32); + DECL_PROP0(RESULTSETCONCURRENCY,sal_Int32); + DECL_PROP0(RESULTSETTYPE,sal_Int32); + DECL_BOOL_PROP0(USEBOOKMARKS); + + + return new ::cppu::OPropertyArrayHelper(aProps); +} + +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper & OStatement_Base::getInfoHelper() +{ + return *const_cast<OStatement_Base*>(this)->getArrayHelper(); +} +// ------------------------------------------------------------------------- +sal_Bool OStatement_Base::convertFastPropertyValue( + Any & rConvertedValue, + Any & rOldValue, + sal_Int32 nHandle, + const Any& rValue ) + throw (::com::sun::star::lang::IllegalArgumentException) +{ + switch(nHandle) + { + case PROPERTY_ID_QUERYTIMEOUT: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getQueryTimeOut()); + case PROPERTY_ID_MAXFIELDSIZE: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getMaxFieldSize()); + case PROPERTY_ID_MAXROWS: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getMaxRows()); + case PROPERTY_ID_CURSORNAME: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getCursorName()); + case PROPERTY_ID_RESULTSETCONCURRENCY: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getResultSetConcurrency()); + case PROPERTY_ID_RESULTSETTYPE: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getResultSetType()); + case PROPERTY_ID_FETCHDIRECTION: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection()); + case PROPERTY_ID_FETCHSIZE: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize()); + case PROPERTY_ID_ESCAPEPROCESSING: + // return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAsLink); + case PROPERTY_ID_USEBOOKMARKS: + // return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAsLink); + default: + ; + } + return sal_False; +} +// ------------------------------------------------------------------------- +void OStatement_Base::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception) +{ + switch(nHandle) + { + case PROPERTY_ID_QUERYTIMEOUT: + setQueryTimeOut(connectivity::getINT32(rValue)); + break; + case PROPERTY_ID_MAXFIELDSIZE: + setMaxFieldSize(connectivity::getINT32(rValue)); + break; + case PROPERTY_ID_MAXROWS: + setMaxRows(connectivity::getINT32(rValue)); + break; + case PROPERTY_ID_CURSORNAME: + setCursorName(connectivity::getString(rValue)); + break; + case PROPERTY_ID_RESULTSETCONCURRENCY: + setResultSetConcurrency(connectivity::getINT32(rValue)); + break; + case PROPERTY_ID_RESULTSETTYPE: + setResultSetType(connectivity::getINT32(rValue)); + break; + case PROPERTY_ID_FETCHDIRECTION: + setFetchDirection(connectivity::getINT32(rValue)); + break; + case PROPERTY_ID_FETCHSIZE: + setFetchSize(connectivity::getINT32(rValue)); + break; + case PROPERTY_ID_ESCAPEPROCESSING: + // return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAsLink); + case PROPERTY_ID_USEBOOKMARKS: + // return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAsLink); + default: + ; + } +} +// ------------------------------------------------------------------------- +void OStatement_Base::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const +{ + switch(nHandle) + { + case PROPERTY_ID_QUERYTIMEOUT: + rValue <<= getQueryTimeOut(); + break; + case PROPERTY_ID_MAXFIELDSIZE: + rValue <<= getMaxFieldSize(); + break; + case PROPERTY_ID_MAXROWS: + rValue <<= getMaxRows(); + break; + case PROPERTY_ID_CURSORNAME: + rValue <<= getCursorName(); + break; + case PROPERTY_ID_RESULTSETCONCURRENCY: + rValue <<= getResultSetConcurrency(); + break; + case PROPERTY_ID_RESULTSETTYPE: + rValue <<= getResultSetType(); + break; + case PROPERTY_ID_FETCHDIRECTION: + rValue <<= getFetchDirection(); + break; + case PROPERTY_ID_FETCHSIZE: + rValue <<= getFetchSize(); + break; + case PROPERTY_ID_ESCAPEPROCESSING: + case PROPERTY_ID_USEBOOKMARKS: + default: + ; + } +} +// ------------------------------------------------------------------------- +OStatement::~OStatement() +{ +} +IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbcx.AStatement","com.sun.star.sdbc.Statement"); + diff --git a/connectivity/source/drivers/ado/ATable.cxx b/connectivity/source/drivers/ado/ATable.cxx new file mode 100644 index 000000000000..7d106cfa5323 --- /dev/null +++ b/connectivity/source/drivers/ado/ATable.cxx @@ -0,0 +1,444 @@ +/************************************************************************* + * + * $RCSfile: ATable.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_TABLE_HXX_ +#include "ado/ATable.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_INDEXES_HXX_ +#include "ado/AIndexes.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_COLUMNS_HXX_ +#include "ado/AColumns.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_COLUMN_HXX_ +#include "ado/AColumn.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_KEYS_HXX_ +#include "ado/AKeys.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_ +#include <com/sun/star/sdbcx/KeyType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_ +#include <com/sun/star/sdbc/KeyRule.hpp> +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif +#ifndef _CONNECTIVITY_ADO_AWRAPADO_HXX_ +#include "ado/Awrapado.hxx" +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +using namespace connectivity::ado; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::container; +using namespace com::sun::star::lang; + +// ------------------------------------------------------------------------- +void WpADOTable::Create() +{ + IClassFactory2* pIUnknown = NULL; + IUnknown *pOuter = NULL; + HRESULT hr = -1; + _ADOTable* pCommand; + hr = CoCreateInstance(ADOS::CLSID_ADOTABLE_25, + NULL, + CLSCTX_INPROC_SERVER, + ADOS::IID_ADOTABLE_25, + (void**)&pCommand ); + + + if( !FAILED( hr ) ) + { + pInterface = pCommand; + pInterface->AddRef(); + } +} +// ------------------------------------------------------------------------- +OAdoTable::OAdoTable(sal_Bool _bCase,_ADOTable* _pTable) : OTable_TYPEDEF(_bCase) +{ + construct(); + if(_pTable) + m_aTable = WpADOTable(_pTable); + else + m_aTable.Create(); + + refreshColumns(); + refreshKeys(); + refreshIndexes(); +} +// ------------------------------------------------------------------------- +OAdoTable::OAdoTable(sal_Bool _bCase, const ::rtl::OUString& _Name, + const ::rtl::OUString& _Type, + const ::rtl::OUString& _Description , + const ::rtl::OUString& _SchemaName, + const ::rtl::OUString& _CatalogName + ) : OTable_TYPEDEF(_bCase,_Name, + _Type, + _Description, + _SchemaName, + _CatalogName) +{ + construct(); + m_aTable.Create(); + m_aTable.put_Name(_Name); + { + ADOProperties* pProps = m_aTable.get_Properties(); + pProps->AddRef(); + ADOProperty* pProp = NULL; + pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("Type")),&pProp); + WpADOProperty aProp(pProp); + if(pProp) + aProp.PutValue(_Type); + pProps->Release(); + } + { + ADOProperties* pProps = m_aTable.get_Properties(); + pProps->AddRef(); + ADOProperty* pProp = NULL; + pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("Description")),&pProp); + WpADOProperty aProp(pProp); + if(pProp) + aProp.PutValue(_Description); + pProps->Release(); + } + + + refreshColumns(); + refreshKeys(); + refreshIndexes(); +} +// ------------------------------------------------------------------------- +void OAdoTable::refreshColumns() +{ + ::std::vector< ::rtl::OUString> aVector; + + ADOColumns* pColumns = m_aTable.get_Columns(); + if(pColumns) + { + pColumns->Refresh(); + + sal_Int32 nCount = 0; + pColumns->get_Count(&nCount); + for(sal_Int32 i=0;i< nCount;++i) + { + ADOColumn* pColumn = NULL; + pColumns->get_Item(OLEVariant(i),&pColumn); + if(pColumn) + { + WpADOColumn aColumn(pColumn); + aVector.push_back(aColumn.get_Name()); + } + } + } + + m_pColumns = new OColumns(*this,m_aMutex,aVector,pColumns,isCaseSensitive()); +} +// ------------------------------------------------------------------------- +void OAdoTable::refreshKeys() +{ + ::std::vector< ::rtl::OUString> aVector; + + ADOKeys* pKeys = m_aTable.get_Keys(); + if(pKeys) + { + pKeys->Refresh(); + + sal_Int32 nCount = 0; + pKeys->get_Count(&nCount); + for(sal_Int32 i=0;i< nCount;++i) + { + ADOKey* pKey = NULL; + pKeys->get_Item(OLEVariant(i),&pKey); + if(pKey) + { + WpADOKey aKey(pKey); + aVector.push_back(aKey.get_Name()); + } + } + } + + m_pKeys = new OKeys(*this,m_aMutex,aVector,pKeys,isCaseSensitive()); +} +// ------------------------------------------------------------------------- +void OAdoTable::refreshIndexes() +{ + ::std::vector< ::rtl::OUString> aVector; + + ADOIndexes* pIndexes = m_aTable.get_Indexes(); + if(pIndexes) + { + pIndexes->Refresh(); + + sal_Int32 nCount = 0; + pIndexes->get_Count(&nCount); + for(sal_Int32 i=0;i< nCount;++i) + { + ADOIndex* pIndex = NULL; + pIndexes->get_Item(OLEVariant(i),&pIndex); + if(pIndex) + { + WpADOIndex aIndex(pIndex); + aVector.push_back(aIndex.get_Name()); + } + } + } + + m_pIndexes = new OIndexes(*this,m_aMutex,aVector,pIndexes,isCaseSensitive()); +} +// ------------------------------------------------------------------------- +Any SAL_CALL OAdoTable::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = ::cppu::queryInterface(rType,static_cast< ::com::sun::star::lang::XUnoTunnel*> (this)); + if(aRet.hasValue()) + return aRet; + return OTable_TYPEDEF::queryInterface(rType); +} + +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OAdoTable::getTypes( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),OTable_TYPEDEF::getTypes()); +} +//-------------------------------------------------------------------------- +Sequence< sal_Int8 > OAdoTable::getUnoTunnelImplementationId() +{ + static ::cppu::OImplementationId * pId = 0; + if (! pId) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + if (! pId) + { + static ::cppu::OImplementationId aId; + pId = &aId; + } + } + return pId->getImplementationId(); +} + +// com::sun::star::lang::XUnoTunnel +//------------------------------------------------------------------ +sal_Int64 OAdoTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException) +{ + if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + return (sal_Int64)this; + + return 0; +} +// ------------------------------------------------------------------------- +// XRename +void SAL_CALL OAdoTable::rename( const ::rtl::OUString& newName ) throw(SQLException, ElementExistException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (rBHelper.bDisposed) + throw DisposedException(); + + m_aTable.put_Name(newName); +} +// ------------------------------------------------------------------------- +// XAlterTable +void SAL_CALL OAdoTable::alterColumnByName( const ::rtl::OUString& colName, const Reference< XPropertySet >& descriptor ) throw(SQLException, NoSuchElementException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (rBHelper.bDisposed) + throw DisposedException(); + + Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY); + if(xTunnel.is()) + { + OAdoColumn* pColumn = (OAdoColumn*)xTunnel->getSomething(OAdoColumn:: getUnoTunnelImplementationId()); + m_aTable.get_Columns()->Delete(OLEVariant(colName)); + m_aTable.get_Columns()->Append(OLEVariant(pColumn->getColumnImpl())); + } + + refreshColumns(); + +} +// ------------------------------------------------------------------------- +void SAL_CALL OAdoTable::alterColumnByIndex( sal_Int32 index, const Reference< XPropertySet >& descriptor ) throw(SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (rBHelper.bDisposed) + throw DisposedException(); + + Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY); + if(xTunnel.is()) + { + OAdoColumn* pColumn = (OAdoColumn*)xTunnel->getSomething(OAdoColumn:: getUnoTunnelImplementationId()); + m_aTable.get_Columns()->Delete(OLEVariant(index)); + m_aTable.get_Columns()->Append(OLEVariant(pColumn->getColumnImpl())); + } +} +// ------------------------------------------------------------------------- +void OAdoTable::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)throw (Exception) +{ + if(m_aTable.IsValid()) + { + switch(nHandle) + { + case PROPERTY_ID_NAME: + m_aTable.put_Name(getString(rValue)); + break; + case PROPERTY_ID_TYPE: + { + ADOProperties* pProps = m_aTable.get_Properties(); + pProps->AddRef(); + ADOProperty* pProp = NULL; + pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("Type")),&pProp); + WpADOProperty aProp(pProp); + if(pProp) + aProp.PutValue(getString(rValue)); + pProps->Release(); + } + break; + case PROPERTY_ID_DESCRIPTION: + { + ADOProperties* pProps = m_aTable.get_Properties(); + pProps->AddRef(); + ADOProperty* pProp = NULL; + pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("Description")),&pProp); + WpADOProperty aProp(pProp); + if(pProp) + aProp.PutValue(getString(rValue)); + pProps->Release(); + } + break; + case PROPERTY_ID_SCHEMANAME: + break; + default: + throw Exception(); + } + } +} +// ------------------------------------------------------------------------- +void OAdoTable::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const +{ + if(m_aTable.IsValid()) + { + switch(nHandle) + { + case PROPERTY_ID_NAME: + rValue <<= m_aTable.get_Name(); + break; + case PROPERTY_ID_TYPE: + rValue <<= m_aTable.get_Type(); + break; + case PROPERTY_ID_CATALOGNAME: + { + WpADOCatalog aCat(m_aTable.get_ParentCatalog()); + if(aCat.IsValid()) + rValue <<= aCat.GetObjectOwner(m_aTable.get_Name(),adPermObjTable); + } + break; + case PROPERTY_ID_SCHEMANAME: + // rValue <<= m_aTable.get_Type(); + break; + case PROPERTY_ID_DESCRIPTION: + { + ADOProperties* pProps = m_aTable.get_Properties(); + pProps->AddRef(); + ADOProperty* pProp = NULL; + pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("Description")),&pProp); + WpADOProperty aProp(pProp); + if(pProp) + rValue <<= (::rtl::OUString)aProp.GetValue(); + pProps->Release(); + } + break; + } + } +} +// ------------------------------------------------------------------------- +::rtl::OUString WpADOCatalog::GetObjectOwner(const ::rtl::OUString& _rName, ObjectTypeEnum _eNum) +{ + OLEVariant _rVar; + _rVar.setNoArg(); + BSTR aBSTR; + pInterface->GetObjectOwner(SysAllocString(_rName.getStr()),_eNum,_rVar,&aBSTR); + rtl::OUString sRetStr((sal_Unicode*)aBSTR); + SysFreeString(aBSTR); + return sRetStr; +} + + + diff --git a/connectivity/source/drivers/ado/ATables.cxx b/connectivity/source/drivers/ado/ATables.cxx new file mode 100644 index 000000000000..3dd247d3f731 --- /dev/null +++ b/connectivity/source/drivers/ado/ATables.cxx @@ -0,0 +1,158 @@ +/************************************************************************* + * + * $RCSfile: ATables.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_TABLES_HXX_ +#include "ado/ATables.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_TABLE_HXX_ +#include "ado/ATable.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_ +#include <com/sun/star/sdbc/KeyRule.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_ +#include <com/sun/star/sdbcx/KeyType.hpp> +#endif +#ifndef _CONNECTIVITY_ADO_CATALOG_HXX_ +#include "ado/ACatalog.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_BCONNECTION_HXX_ +#include "ado/AConnection.hxx" +#endif + +using namespace connectivity::ado; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::container; +using namespace com::sun::star::lang; + +typedef connectivity::sdbcx::OCollection OCollection_TYPE; + +Reference< XNamed > OTables::createObject(const ::rtl::OUString& _rName) +{ + ADOTable* pTable = NULL; + m_pCollection->get_Item(OLEVariant(_rName),&pTable); + + Reference< XNamed > xRet = new OAdoTable(isCaseSensitive(),pTable); + + return xRet; +} +// ------------------------------------------------------------------------- +void OTables::impl_refresh( ) throw(RuntimeException) +{ + m_pCollection->Refresh(); +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > OTables::createEmptyObject() +{ + OAdoTable* pNew = new OAdoTable(isCaseSensitive()); + return pNew; +} +// ------------------------------------------------------------------------- +// XAppend +void SAL_CALL OTables::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + + Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY); + if(xTunnel.is()) + { + OAdoTable* pTable = (OAdoTable*)xTunnel->getSomething(OAdoTable:: getUnoTunnelImplementationId()); + m_pCollection->Append(OLEVariant(pTable->getImpl())); + } + + OCollection_TYPE::appendByDescriptor(descriptor); +} +// ------------------------------------------------------------------------- +// XDrop +void SAL_CALL OTables::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + + m_pCollection->Delete(OLEVariant(elementName)); + + OCollection_TYPE::dropByName(elementName); +} +// ------------------------------------------------------------------------- +void SAL_CALL OTables::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + if (index < 0 || index >= getCount()) + throw IndexOutOfBoundsException(); + + m_pCollection->Delete(OLEVariant(index)); + + OCollection_TYPE::dropByIndex(index); +} +// ------------------------------------------------------------------------- + + diff --git a/connectivity/source/drivers/ado/AUser.cxx b/connectivity/source/drivers/ado/AUser.cxx new file mode 100644 index 000000000000..c15770cca86c --- /dev/null +++ b/connectivity/source/drivers/ado/AUser.cxx @@ -0,0 +1,248 @@ +/************************************************************************* + * + * $RCSfile: AUser.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_USER_HXX_ +#include "ado/AUser.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_GROUPS_HXX_ +#include "ado/AGroups.hxx" +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _CONNECTIVITY_ADO_BCONNECTION_HXX_ +#include "ado/AConnection.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif + +using namespace connectivity::ado; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; + +// ------------------------------------------------------------------------- +void WpADOUser::Create() +{ + IClassFactory2* pIUnknown = NULL; + IUnknown *pOuter = NULL; + HRESULT hr = -1; + _ADOUser* pCommand; + hr = CoCreateInstance(ADOS::CLSID_ADOUSER_25, + NULL, + CLSCTX_INPROC_SERVER, + ADOS::IID_ADOUSER_25, + (void**)&pCommand ); + + + if( !FAILED( hr ) ) + { + pInterface = pCommand; + pInterface->AddRef(); + } +} +// ------------------------------------------------------------------------- +OAdoUser::OAdoUser(sal_Bool _bCase, ADOUser* _pUser) : OUser_TYPEDEF(_bCase) +{ + construct(); + + if(_pUser) + m_aUser = WpADOUser(_pUser); + else + m_aUser.Create(); + refreshGroups(); +} +// ------------------------------------------------------------------------- +OAdoUser::OAdoUser(sal_Bool _bCase, const ::rtl::OUString& _Name) : OUser_TYPEDEF(_Name,_bCase) +{ + construct(); + m_aUser.Create(); + m_aUser.put_Name(_Name); + refreshGroups(); +} +// ------------------------------------------------------------------------- +void OAdoUser::refreshGroups() +{ + + ::std::vector< ::rtl::OUString> aVector; + + ADOGroups* pGroups = m_aUser.get_Groups(); + if(pGroups) + { + pGroups->Refresh(); + + sal_Int32 nCount = 0; + pGroups->get_Count(&nCount); + for(sal_Int32 i=0;i< nCount;++i) + { + ADOGroup* pGroup = NULL; + pGroups->get_Item(OLEVariant(i),&pGroup); + if(pGroup) + { + WpADOGroup aGroup(pGroup); + aVector.push_back(aGroup.get_Name()); + } + } + } + + if(m_pGroups) + delete m_pGroups; + m_pGroups = new OGroups(*this,m_aMutex,aVector,pGroups,isCaseSensitive()); +} +// ------------------------------------------------------------------------- +Any SAL_CALL OAdoUser::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = ::cppu::queryInterface(rType,static_cast< ::com::sun::star::lang::XUnoTunnel*> (this)); + if(aRet.hasValue()) + return aRet; + return OUser_TYPEDEF::queryInterface(rType); +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OAdoUser::getTypes( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),OUser_TYPEDEF::getTypes()); +} +//-------------------------------------------------------------------------- +Sequence< sal_Int8 > OAdoUser::getUnoTunnelImplementationId() +{ + static ::cppu::OImplementationId * pId = 0; + if (! pId) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + if (! pId) + { + static ::cppu::OImplementationId aId; + pId = &aId; + } + } + return pId->getImplementationId(); +} + +// com::sun::star::lang::XUnoTunnel +//------------------------------------------------------------------ +sal_Int64 OAdoUser::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException) +{ + if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + return (sal_Int64)this; + + return 0; +} + +// ------------------------------------------------------------------------- +void OAdoUser::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)throw (Exception) +{ + if(m_aUser.IsValid()) + { + + switch(nHandle) + { + case PROPERTY_ID_NAME: + { + ::rtl::OUString aVal; + rValue >>= aVal; + m_aUser.put_Name(aVal); + } + break; + } + } +} +// ------------------------------------------------------------------------- +void OAdoUser::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const +{ + if(m_aUser.IsValid()) + { + switch(nHandle) + { + case PROPERTY_ID_NAME: + rValue <<= m_aUser.get_Name(); + break; + } + } +} +// ------------------------------------------------------------------------- +OUserExtend::OUserExtend(sal_Bool _bCase, ADOUser* _pUser) : OAdoUser(_bCase,_pUser) +{ +} +// ------------------------------------------------------------------------- +OUserExtend::OUserExtend(sal_Bool _bCase, const ::rtl::OUString& _Name) : OAdoUser(_bCase,_Name) +{ +} +// ------------------------------------------------------------------------- +void OUserExtend::construct() +{ + OUser_TYPEDEF::construct(); + registerProperty(PROPERTY_PASSWORD, PROPERTY_ID_PASSWORD,0,&m_Password,::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); +} + + diff --git a/connectivity/source/drivers/ado/AUsers.cxx b/connectivity/source/drivers/ado/AUsers.cxx new file mode 100644 index 000000000000..29a2c9bf3f56 --- /dev/null +++ b/connectivity/source/drivers/ado/AUsers.cxx @@ -0,0 +1,144 @@ +/************************************************************************* + * + * $RCSfile: AUsers.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_USERS_HXX_ +#include "ado/AUsers.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_USER_HXX_ +#include "ado/AUser.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_TABLE_HXX_ +#include "ado/ATable.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_ +#include "connectivity/sdbcx/IRefreshable.hxx" +#endif + +using namespace connectivity::ado; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::container; + +typedef connectivity::sdbcx::OCollection OCollection_TYPE; + +Reference< XNamed > OUsers::createObject(const ::rtl::OUString& _rName) +{ + OAdoUser* pRet = new OAdoUser(isCaseSensitive(),_rName); + Reference< XNamed > xRet = pRet; + return xRet; +} +// ------------------------------------------------------------------------- +void OUsers::impl_refresh() throw(RuntimeException) +{ + m_pCollection->Refresh(); +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > OUsers::createEmptyObject() +{ + OUserExtend* pNew = new OUserExtend(isCaseSensitive()); + return pNew; +} +// ------------------------------------------------------------------------- +// XAppend +void SAL_CALL OUsers::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + + Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY); + if(xTunnel.is()) + { + OUserExtend* pUser = (OUserExtend*)xTunnel->getSomething(OUserExtend::getUnoTunnelImplementationId()); + if(pUser) + m_pCollection->Append(OLEVariant(pUser->getImpl()),(BSTR)pUser->getPassword().getStr()); + } + + OCollection_TYPE::appendByDescriptor(descriptor); +} +// ------------------------------------------------------------------------- +// XDrop +void SAL_CALL OUsers::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + + m_pCollection->Delete(OLEVariant(elementName)); + + OCollection_TYPE::dropByName(elementName); +} +// ------------------------------------------------------------------------- +void SAL_CALL OUsers::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + if (index < 0 || index >= getCount()) + throw IndexOutOfBoundsException(); + + m_pCollection->Delete(OLEVariant(index)); + + OCollection_TYPE::dropByIndex(index); +} + diff --git a/connectivity/source/drivers/ado/AView.cxx b/connectivity/source/drivers/ado/AView.cxx new file mode 100644 index 000000000000..690eb3735e84 --- /dev/null +++ b/connectivity/source/drivers/ado/AView.cxx @@ -0,0 +1,222 @@ +/************************************************************************* + * + * $RCSfile: AView.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADO_VIEW_HXX_ +#include "ado/AView.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_ADOIMP_HXX_ +#include "ado/adoimp.hxx" +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _CONNECTIVITY_ADO_AWRAPADO_HXX_ +#include "ado/Awrapado.hxx" +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +// ------------------------------------------------------------------------- +using namespace connectivity::ado; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; + +// IMPLEMENT_SERVICE_INFO(OAdoView,"com.sun.star.sdbcx.AView","com.sun.star.sdbcx.View"); +// ------------------------------------------------------------------------- +void WpADOView::Create() +{ + IClassFactory2* pIUnknown = NULL; + IUnknown *pOuter = NULL; + HRESULT hr = -1; + ADOView* pCommand; + hr = CoCreateInstance(ADOS::CLSID_ADOVIEW_25, + NULL, + CLSCTX_INPROC_SERVER, + ADOS::IID_ADOVIEW_25, + (void**)&pCommand ); + + + if( !FAILED( hr ) ) + { + pInterface = pCommand; + pInterface->AddRef(); + } +} + +// ------------------------------------------------------------------------- +OAdoView::OAdoView(sal_Bool _bCase,ADOView* _pView) : OView_ADO(_bCase) +{ + construct(); + + if(_pView) + m_aView = WpADOView(_pView); + else + m_aView.Create(); +} +// ------------------------------------------------------------------------- +OAdoView::OAdoView(sal_Bool _bCase, const ::rtl::OUString& _Name, + sal_Int32 _CheckOption, + const ::rtl::OUString& _Command, + const ::rtl::OUString& _SchemaName, + const ::rtl::OUString& _CatalogName) + : OView_ADO( _bCase, + _Name, + _CheckOption, + _Command, + _SchemaName, + _CatalogName) +{ + construct(); + m_aView.Create(); + WpADOCommand aCommand; + aCommand.Create(); + aCommand.put_Name(_Name); + aCommand.put_CommandText(_Command); + + m_aView.put_Command(OLEVariant((IDispatch*)aCommand)); + +} +// ------------------------------------------------------------------------- +Any SAL_CALL OAdoView::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = ::cppu::queryInterface(rType,static_cast< ::com::sun::star::lang::XUnoTunnel*> (this)); + if(aRet.hasValue()) + return aRet; + return OView_ADO::queryInterface(rType); +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OAdoView::getTypes( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),OAdoView::getTypes()); +} +//-------------------------------------------------------------------------- +Sequence< sal_Int8 > OAdoView::getUnoTunnelImplementationId() +{ + static ::cppu::OImplementationId * pId = 0; + if (! pId) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + if (! pId) + { + static ::cppu::OImplementationId aId; + pId = &aId; + } + } + return pId->getImplementationId(); +} + +// com::sun::star::lang::XUnoTunnel +//------------------------------------------------------------------ +sal_Int64 OAdoView::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException) +{ + if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + return (sal_Int64)this; + + return 0; +} + +// ------------------------------------------------------------------------- +void OAdoView::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception) +{ + throw Exception(); +} +// ------------------------------------------------------------------------- +void OAdoView::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const +{ + if(m_aView.IsValid()) + { + switch(nHandle) + { + case PROPERTY_ID_NAME: + rValue <<= m_aView.get_Name(); + break; + case PROPERTY_ID_CATALOGNAME: + break; + case PROPERTY_ID_SCHEMANAME: + // rValue <<= m_aView.get_Type(); + break; + case PROPERTY_ID_COMMAND: + { + OLEVariant aVar; + m_aView.get_Command(aVar); + if(!aVar.isNull() && !aVar.isEmpty()) + { + ADOCommand* pCom = (ADOCommand*)aVar.getIDispatch(); + BSTR aBSTR; pCom->get_CommandText(&aBSTR); + ::rtl::OUString sRetStr(aBSTR); + SysFreeString(aBSTR); + rValue <<= sRetStr; + } + } + break; + } + } +} + diff --git a/connectivity/source/drivers/ado/AViews.cxx b/connectivity/source/drivers/ado/AViews.cxx new file mode 100644 index 000000000000..afabefabbfb5 --- /dev/null +++ b/connectivity/source/drivers/ado/AViews.cxx @@ -0,0 +1,158 @@ +/************************************************************************* + * + * $RCSfile: AViews.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADO_VIEWS_HXX_ +#include "ado/AViews.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_VIEW_HXX_ +#include "ado/AView.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_ +#include <com/sun/star/sdbc/KeyRule.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_ +#include <com/sun/star/sdbcx/KeyType.hpp> +#endif +#ifndef _CONNECTIVITY_ADO_CATALOG_HXX_ +#include "ado/ACatalog.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_BCONNECTION_HXX_ +#include "ado/AConnection.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +using namespace connectivity::ado; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::container; + +typedef connectivity::sdbcx::OCollection OCollection_TYPE; + +Reference< XNamed > OViews::createObject(const ::rtl::OUString& _rName) +{ + ADOView* pView = NULL; + m_pCollection->get_Item(OLEVariant(_rName),&pView); + + Reference< XNamed > xRet = new OAdoView(isCaseSensitive(),pView); + + return xRet; +} +// ------------------------------------------------------------------------- +void OViews::impl_refresh( ) throw(RuntimeException) +{ + m_pCollection->Refresh(); +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > OViews::createEmptyObject() +{ + OAdoView* pNew = new OAdoView(isCaseSensitive()); + return pNew; +} +// ------------------------------------------------------------------------- +// XAppend +void SAL_CALL OViews::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + + Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(descriptor,UNO_QUERY); + if(xTunnel.is()) + { + OAdoView* pView = (OAdoView*)xTunnel->getSomething(OAdoView:: getUnoTunnelImplementationId()); + m_pCollection->Append((BSTR)getString(descriptor->getPropertyValue(PROPERTY_NAME)).getStr(),(IDispatch *)pView->getImpl()); + } + + OCollection_TYPE::appendByDescriptor(descriptor); +} +// ------------------------------------------------------------------------- +// XDrop +void SAL_CALL OViews::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + + m_pCollection->Delete(OLEVariant(elementName)); + + OCollection_TYPE::dropByName(elementName); +} +// ------------------------------------------------------------------------- +void SAL_CALL OViews::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + if (index < 0 || index >= getCount()) + throw IndexOutOfBoundsException(); + + m_pCollection->Delete(OLEVariant(index)); + + OCollection_TYPE::dropByIndex(index); +} +// ------------------------------------------------------------------------- + + diff --git a/connectivity/source/drivers/ado/Aservices.cxx b/connectivity/source/drivers/ado/Aservices.cxx new file mode 100644 index 000000000000..b62d68b4c3d0 --- /dev/null +++ b/connectivity/source/drivers/ado/Aservices.cxx @@ -0,0 +1,212 @@ +/************************************************************************* + * + * $RCSfile: Aservices.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_ADRIVER_HXX_ +#include "ado/ADriver.hxx" +#endif +#ifndef _CPPUHELPER_FACTORY_HXX_ +#include <cppuhelper/factory.hxx> +#endif +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif + +using namespace connectivity::ado; +using ::rtl::OUString; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::registry::XRegistryKey; +using ::com::sun::star::lang::XSingleServiceFactory; +using ::com::sun::star::lang::XMultiServiceFactory; + +typedef Reference< XSingleServiceFactory > (SAL_CALL &createFactoryFunc) + ( + const Reference< XMultiServiceFactory > & rServiceManager, + const OUString & rComponentName, + ::cppu::ComponentInstantiation pCreateFunction, + const Sequence< OUString > & rServiceNames + ); + +//*************************************************************************************** +// +// Die vorgeschriebene C-Api muss erfuellt werden! +// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen. +// + +//--------------------------------------------------------------------------------------- +void REGISTER_PROVIDER( + const OUString& aServiceImplName, + const Sequence< OUString>& Services, + const Reference< ::com::sun::star::registry::XRegistryKey > & xKey) +{ + OUString aMainKeyName; + aMainKeyName = OUString::createFromAscii("/"); + aMainKeyName += aServiceImplName; + aMainKeyName += OUString::createFromAscii("/UNO/SERVICES"); + + Reference< ::com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) ); + OSL_ENSHURE(xNewKey.is(), "ADO::component_writeInfo : could not create a registry key !"); + + for (sal_uInt32 i=0; i<Services.getLength(); ++i) + xNewKey->createKey(Services[i]); +} + + +//--------------------------------------------------------------------------------------- +struct ProviderRequest +{ + Reference< XSingleServiceFactory > xRet; + Reference< XMultiServiceFactory > const xServiceManager; + OUString const sImplementationName; + + ProviderRequest( + void* pServiceManager, + sal_Char const* pImplementationName + ) + : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager)) + , sImplementationName(OUString::createFromAscii(pImplementationName)) + { + } + + inline + sal_Bool CREATE_PROVIDER( + const OUString& Implname, + const Sequence< OUString > & Services, + ::cppu::ComponentInstantiation Factory, + createFactoryFunc creator + ) + { + if (!xRet.is() && (Implname == sImplementationName)) + try + { + xRet = creator( xServiceManager, sImplementationName,Factory, Services); + } + catch(...) + { + } + return xRet.is(); + } + + void* getProvider() const { return xRet.get(); } +}; + +//--------------------------------------------------------------------------------------- + +extern "C" void SAL_CALL component_getImplementationEnvironment( + const sal_Char **ppEnvTypeName, + uno_Environment **ppEnv + ) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +//--------------------------------------------------------------------------------------- +extern "C" sal_Bool SAL_CALL component_writeInfo( + void* pServiceManager, + void* pRegistryKey + ) +{ + if (pRegistryKey) + try + { + Reference< ::com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast< ::com::sun::star::registry::XRegistryKey*>(pRegistryKey)); + + REGISTER_PROVIDER( + ODriver::getImplementationName_Static(), + ODriver::getSupportedServiceNames_Static(), xKey); + + return sal_True; + } + catch (::com::sun::star::registry::InvalidRegistryException& ) + { + OSL_ENSHURE(sal_False, "ODBC::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); + } + + return sal_False; +} + +//--------------------------------------------------------------------------------------- +extern "C" void* SAL_CALL component_getFactory( + const sal_Char* pImplementationName, + void* pServiceManager, + void* pRegistryKey) +{ + void* pRet = 0; + if (pServiceManager) + { + ProviderRequest aReq(pServiceManager,pImplementationName); + + aReq.CREATE_PROVIDER( + ODriver::getImplementationName_Static(), + ODriver::getSupportedServiceNames_Static(), + ODriver_CreateInstance, ::cppu::createSingleFactory) + ; + + if(aReq.xRet.is()) + aReq.xRet->acquire(); + + pRet = aReq.getProvider(); + } + + return pRet; +}; + + diff --git a/connectivity/source/drivers/ado/ado.xml b/connectivity/source/drivers/ado/ado.xml new file mode 100644 index 000000000000..1e923b53493f --- /dev/null +++ b/connectivity/source/drivers/ado/ado.xml @@ -0,0 +1,70 @@ +<?xml version='1.0' encoding="UTF-8"?> +<!DOCTYPE COMPONENTDESCRIPTION PUBLIC "-//W3C//DTD HTML 3.2//EN" "componentdependencies.dtd"> +<COMPONENTDESCRIPTION> + +<Name> com.sun.star.sdbc.ADODriver </Name> + +<Description> + This is the implementation of the sdbc-ado bridge. +</Description> + +<ModuleName> ado </ModuleName> + +<LoaderName> com.sun.star.loader.SharedLibrary </LoaderName> + +<SupportedService> com.sun.star.sdbc.Driver </SupportedService> + +<ServiceDependency> ... </ServiceDependency> + +<ProjectBuildDependency> cppuhelper </ProjectBuildDependency> +<ProjectBuildDependency> cppu </ProjectBuildDependency> +<ProjectBuildDependency> sal </ProjectBuildDependency> +<ProjectBuildDependency> vos </ProjectBuildDependency> + +<RuntimeModuleDependency> cppuhelper </RuntimeModuleDependency> +<RuntimeModuleDependency> cppu1 </RuntimeModuleDependency> +<RuntimeModuleDependency> sal1 </RuntimeModuleDependency> +<RuntimeModuleDependency> vos </RuntimeModuleDependency> + +<Language> c++ </Language> + +<Status StatusValue="final"/> + +<Type> com.sun.star.util.XCancellable </Type> +<Type> com.sun.star.util.XNumberFormatter </Type> +<Type> com.sun.star.uno.TypeClass </Type> +<Type> com.sun.star.uno.XWeak </Type> +<Type> com.sun.star.uno.XAggregation </Type> +<Type> com.sun.star.beans.XPropertyState </Type> +<Type> com.sun.star.beans.XPropertySet </Type> +<Type> com.sun.star.beans.PropertyValue </Type> +<Type> com.sun.star.beans.XMultiPropertySet </Type> +<Type> com.sun.star.beans.XFastPropertySet </Type> +<Type> com.sun.star.lang.XTypeProvider </Type> +<Type> com.sun.star.lang.EventObject </Type> +<Type> com.sun.star.lang.XComponent </Type> +<Type> com.sun.star.lang.IllegalArgumentException </Type> +<Type> com.sun.star.lang.XMultiServiceFactory </Type> +<Type> com.sun.star.java.XJavaThreadRegister_11 </Type> +<Type> com.sun.star.java.XJavaVM </Type> +<Type> com.sun.star.sdbc.XConnection </Type> +<Type> com.sun.star.sdbc.XStatement </Type> +<Type> com.sun.star.sdbc.XResultSet </Type> +<Type> com.sun.star.sdbc.XResultSetMetaDataSupplier</Type> +<Type> com.sun.star.sdbc.XColumnLocate </Type> +<Type> com.sun.star.sdbc.XResultSetUpdate </Type> +<Type> com.sun.star.sdbc.XWarningsSupplier </Type> +<Type> com.sun.star.sdbc.XRowUpdate </Type> +<Type> com.sun.star.sdbc.XMultipleResults </Type> +<Type> com.sun.star.sdbc.XBatchExecution </Type> +<Type> com.sun.star.sdbc.XPreparedBatchExecution </Type> +<Type> com.sun.star.sdbc.XParameters </Type> +<Type> com.sun.star.sdbc.XOutParameters </Type> +<Type> com.sun.star.sdbc.DriverPropertyInfo </Type> +<Type> com.sun.star.sdbc.XRow </Type> +<Type> com.sun.star.sdb.XColumnUpdate </Type> +<Type> com.sun.star.sdb.XColumn </Type> + +</COMPONENTDESCRIPTION> + + diff --git a/connectivity/source/drivers/ado/adoimp.cxx b/connectivity/source/drivers/ado/adoimp.cxx new file mode 100644 index 000000000000..f86752150032 --- /dev/null +++ b/connectivity/source/drivers/ado/adoimp.cxx @@ -0,0 +1,229 @@ +/************************************************************************* + * + * $RCSfile: adoimp.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_AWRAPADO_HXX_ +#include "ado/Awrapado.hxx" +#endif + +#ifndef _CONNECTIVITY_ADO_ADOIMP_HXX_ +#include "ado/adoimp.hxx" +#endif + +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif + +using namespace connectivity::ado; +using namespace com::sun::star::uno; +using namespace com::sun::star::sdbc; + + +#define MYADOID(l) {l, 0,0x10,0x80,0,0,0xAA,0,0x6D,0x2E,0xA4}; + +const CLSID ADOS::CLSID_ADOCONNECTION_21 = MYADOID(0x00000514); +const IID ADOS::IID_ADOCONNECTION_21 = MYADOID(0x00000550); + +const CLSID ADOS::CLSID_ADOCOMMAND_21 = MYADOID(0x00000507); +const IID ADOS::IID_ADOCOMMAND_21 = MYADOID(0x0000054E); + +const CLSID ADOS::CLSID_ADORECORDSET_21 = MYADOID(0x00000535); +const IID ADOS::IID_ADORECORDSET_21 = MYADOID(0x0000054F); + +const CLSID ADOS::CLSID_ADOCATALOG_25 = MYADOID(0x00000602); +const IID ADOS::IID_ADOCATALOG_25 = MYADOID(0x00000603); + +const CLSID ADOS::CLSID_ADOINDEX_25 = MYADOID(0x0000061E); +const IID ADOS::IID_ADOINDEX_25 = MYADOID(0x0000061F); + +const CLSID ADOS::CLSID_ADOTABLE_25 = MYADOID(0x00000609); +const IID ADOS::IID_ADOTABLE_25 = MYADOID(0x00000610); + +const CLSID ADOS::CLSID_ADOKEY_25 = MYADOID(0x00000621); +const IID ADOS::IID_ADOKEY_25 = MYADOID(0x00000622); + +const CLSID ADOS::CLSID_ADOCOLUMN_25 = MYADOID(0x0000061B); +const IID ADOS::IID_ADOCOLUMN_25 = MYADOID(0x0000061C); + +const CLSID ADOS::CLSID_ADOGROUP_25 = MYADOID(0x00000615); +const IID ADOS::IID_ADOGROUP_25 = MYADOID(0x00000616); + +const CLSID ADOS::CLSID_ADOUSER_25 = MYADOID(0x00000618); +const IID ADOS::IID_ADOUSER_25 = MYADOID(0x00000619); + +const CLSID ADOS::CLSID_ADOVIEW_25 = MYADOID(0x00000612); +const IID ADOS::IID_ADOVIEW_25 = MYADOID(0x00000613); + +void ADOS::ThrowException(ADOConnection* _pAdoCon,const Reference< XInterface >& _xInterface) throw(SQLException, RuntimeException) +{ + ADOErrors *pErrors = NULL; + _pAdoCon->get_Errors(&pErrors); + if(!pErrors) + return; // no error found + + pErrors->AddRef( ); + + // alle aufgelaufenen Fehler auslesen und ausgeben + sal_Int32 nLen; + pErrors->get_Count(&nLen); + if (nLen) + { + ::rtl::OUString sError; + ::rtl::OUString aSQLState; + SQLException aException; + for (sal_Int32 i = nLen-1; i>=0; i--) + { + ADOError *pError = NULL; + pErrors->get_Item(OLEVariant(i),&pError); + WpADOError aErr(pError); + OSL_ENSHURE(pError,"No error in collection found! BAD!"); + if(pError) + { + if(i==nLen-1) + aException = SQLException(aErr.GetDescription(),_xInterface,aErr.GetSQLState(),aErr.GetNumber(),Any()); + else + { + SQLException aTemp = SQLException(aErr.GetDescription(), + _xInterface,aErr.GetSQLState(),aErr.GetNumber(),makeAny(aException)); + aTemp.NextException <<= aException; + aException = aTemp; + } + } + } + pErrors->Release(); + throw aException; + } + pErrors->Release(); +} + +// ------------------------------------------------------------------------- +sal_Int32 ADOS::MapADOType2Jdbc(DataTypeEnum eType) +{ + switch (eType) + { + case adUnsignedSmallInt: + case adSmallInt: return DataType::SMALLINT; break; + case adUnsignedInt: + case adInteger: return DataType::INTEGER; break; + case adUnsignedBigInt: + case adBigInt: return DataType::BIGINT; break; + case adSingle: return DataType::FLOAT; break; + case adDouble: return DataType::DOUBLE; break; + case adCurrency: return DataType::DOUBLE; break; + case adVarNumeric: + case adNumeric: return DataType::NUMERIC; break; + case adDecimal: return DataType::DECIMAL; break; + case adDate: + case adDBDate: return DataType::DATE; break; + case adDBTime: return DataType::TIME; break; + case adDBTimeStamp: return DataType::TIMESTAMP; break; + case adBoolean: return DataType::BIT; break; + case adBinary: + case adGUID: return DataType::BINARY; break; + case adBSTR: + case adVarWChar: + case adVarChar: return DataType::VARCHAR; break; + case adLongVarWChar: + case adLongVarChar: return DataType::LONGVARCHAR; break; + case adVarBinary: return DataType::VARBINARY; break; + case adLongVarBinary: return DataType::LONGVARBINARY; break; + case adWChar: + case adChar: return DataType::CHAR; break; + case adUnsignedTinyInt: + case adTinyInt: return DataType::TINYINT; break; + default: + ; + } + return DataType::TINYINT; +} +// ------------------------------------------------------------------------- +DataTypeEnum ADOS::MapJdbc2ADOType(sal_Int32 _nType) +{ + switch (_nType) + { + case DataType::SMALLINT: return adSmallInt; break; + case DataType::INTEGER: return adInteger; break; + case DataType::BIGINT: return adBigInt; break; + case DataType::FLOAT: return adSingle; break; + case DataType::DOUBLE: return adDouble; break; + case DataType::NUMERIC: return adNumeric; break; + case DataType::DECIMAL: return adDecimal; break; + case DataType::DATE: return adDBDate; break; + case DataType::TIME: return adDBTime; break; + case DataType::TIMESTAMP: return adDBTimeStamp; break; + case DataType::BIT: return adBoolean; break; + case DataType::BINARY: return adBinary; break; + case DataType::VARCHAR: return adVarWChar; break; + case DataType::LONGVARCHAR: return adLongVarWChar; break; + case DataType::VARBINARY: return adVarBinary; break; + case DataType::LONGVARBINARY: return adLongVarBinary; break; + case DataType::CHAR: return adWChar; break; + case DataType::TINYINT: return adTinyInt; break; + default: + ; + } + return adEmpty; +} + + + diff --git a/connectivity/source/drivers/ado/exports.dxp b/connectivity/source/drivers/ado/exports.dxp new file mode 100644 index 000000000000..9630d7e06768 --- /dev/null +++ b/connectivity/source/drivers/ado/exports.dxp @@ -0,0 +1,3 @@ +component_getImplementationEnvironment +component_writeInfo +component_getFactory diff --git a/connectivity/source/drivers/ado/makefile.mk b/connectivity/source/drivers/ado/makefile.mk new file mode 100644 index 000000000000..649e0c507b40 --- /dev/null +++ b/connectivity/source/drivers/ado/makefile.mk @@ -0,0 +1,226 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* +.IF "$(GUI)"=="WNT" + +PRJ=..$/..$/.. +PRJINC=..$/.. +PRJNAME=connectivity +TARGET=ado + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ---------------------------------- +.IF "$(DBGUTIL_OJ)"!="" +ENVCFLAGS+=/FR$(SLO)$/ +.ENDIF + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/version.mk + +# --- Types ------------------------------------- + + +UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb +UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb + +UNOUCROUT=$(OUT)$/inc +INCPRE+=$(UNOUCROUT) + +# --- Types ------------------------------------- + +UNOTYPES+= \ + com.sun.star.util.XCancellable \ + com.sun.star.util.XNumberFormatter \ + com.sun.star.uno.TypeClass \ + com.sun.star.uno.XWeak \ + com.sun.star.uno.XAggregation \ + com.sun.star.beans.XPropertyState \ + com.sun.star.beans.XPropertySet \ + com.sun.star.beans.PropertyValue \ + com.sun.star.beans.XMultiPropertySet \ + com.sun.star.beans.XFastPropertySet \ + com.sun.star.container.XIndexAccess \ + com.sun.star.lang.XTypeProvider \ + com.sun.star.lang.EventObject \ + com.sun.star.lang.XComponent \ + com.sun.star.lang.IllegalArgumentException \ + com.sun.star.lang.DisposedException \ + com.sun.star.lang.XMultiServiceFactory \ + com.sun.star.lang.XSingleServiceFactory \ + com.sun.star.registry.XRegistryKey \ + com.sun.star.java.XJavaThreadRegister_11 \ + com.sun.star.java.XJavaVM \ + com.sun.star.sdbc.XConnection \ + com.sun.star.sdbc.XStatement \ + com.sun.star.sdbc.XResultSet \ + com.sun.star.sdbc.XResultSetMetaDataSupplier \ + com.sun.star.sdbc.XColumnLocate \ + com.sun.star.sdbc.XResultSetUpdate \ + com.sun.star.sdbc.XWarningsSupplier \ + com.sun.star.sdbc.XRowUpdate \ + com.sun.star.sdbc.XMultipleResults \ + com.sun.star.sdbc.XBatchExecution \ + com.sun.star.sdbc.XPreparedBatchExecution \ + com.sun.star.sdbc.XParameters \ + com.sun.star.sdbc.XOutParameters \ + com.sun.star.sdbc.DriverPropertyInfo \ + com.sun.star.sdbc.XDriver \ + com.sun.star.sdbc.XRow \ + com.sun.star.sdbc.SQLWarning \ + com.sun.star.sdbc.ColumnSearch \ + com.sun.star.sdbc.DataType \ + com.sun.star.sdbc.ResultSetConcurrency \ + com.sun.star.sdbc.ResultSetType \ + com.sun.star.sdbc.ColumnValue \ + com.sun.star.sdbc.TransactionIsolation \ + com.sun.star.sdbc.FetchDirection \ + com.sun.star.sdbc.KeyRule \ + com.sun.star.sdbc.IndexType \ + com.sun.star.sdbc.ProcedureResult \ + com.sun.star.sdb.XColumnUpdate \ + com.sun.star.sdb.XColumn \ + com.sun.star.sdbcx.XDataDescriptorFactory \ + com.sun.star.sdbcx.XColumnsSupplier \ + com.sun.star.sdbcx.XIndexesSupplier \ + com.sun.star.sdbcx.XKeysSupplier \ + com.sun.star.sdbcx.XRename \ + com.sun.star.sdbcx.XAlterTable \ + com.sun.star.sdbcx.XDataDefinitionSupplier \ + com.sun.star.sdbcx.XViewsSupplier \ + com.sun.star.sdbcx.XUsersSupplier \ + com.sun.star.sdbcx.XGroupsSupplier \ + com.sun.star.sdbcx.XAuthorizable \ + com.sun.star.sdbcx.Privilege \ + com.sun.star.sdbcx.PrivilegeObject \ + com.sun.star.sdbcx.XUser \ + com.sun.star.sdbcx.XRowLocate \ + com.sun.star.sdbcx.XDeleteRows \ + com.sun.star.lang.XServiceInfo + + + +# --- Files ------------------------------------- + +SLOFILES=\ + $(SLO)$/AColumn.obj \ + $(SLO)$/AColumns.obj \ + $(SLO)$/AIndex.obj \ + $(SLO)$/AIndexes.obj \ + $(SLO)$/AKey.obj \ + $(SLO)$/AKeys.obj \ + $(SLO)$/AUser.obj \ + $(SLO)$/AUsers.obj \ + $(SLO)$/AGroup.obj \ + $(SLO)$/AGroups.obj \ + $(SLO)$/ACatalog.obj \ + $(SLO)$/AView.obj \ + $(SLO)$/AViews.obj \ + $(SLO)$/ATable.obj \ + $(SLO)$/ATables.obj \ + $(SLO)$/ACallableStatement.obj \ + $(SLO)$/ADatabaseMetaDataResultSetMetaData.obj \ + $(SLO)$/ADatabaseMetaDataResultSet.obj \ + $(SLO)$/AResultSet.obj \ + $(SLO)$/AConnection.obj \ + $(SLO)$/ADatabaseMetaData.obj \ + $(SLO)$/AStatement.obj \ + $(SLO)$/APreparedStatement.obj \ + $(SLO)$/AResultSetMetaData.obj \ + $(SLO)$/ADriver.obj \ + $(SLO)$/Aservices.obj \ + $(SLO)$/adoimp.obj + + +# --- Library ----------------------------------- + +SHL1TARGET= $(ADO_TARGET)$(ADO_MAJOR) +SHL1OBJS=$(SLOFILES) +SHL1STDLIBS=\ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(VOSLIB) \ + $(OSLLIB) \ + $(SALLIB) \ + ole32.lib \ + oleaut32.lib \ + uuid.lib + +SHL1DEPN= +SHL1IMPLIB= i$(SHL1TARGET) +SHL1LIBS= $(SLB)$/$(TARGET).lib \ + $(SLB)$/commontools.lib \ + $(SLB)$/resource.lib \ + $(SLB)$/sdbcx.lib + + +SHL1DEF= $(MISC)$/$(SHL1TARGET).def + +DEF1NAME= $(SHL1TARGET) +DEF1EXPORTFILE= exports.dxp + + +# --- Targets ---------------------------------- + +.INCLUDE : target.mk + +.ENDIF + diff --git a/connectivity/source/drivers/dbase/DCatalog.cxx b/connectivity/source/drivers/dbase/DCatalog.cxx new file mode 100644 index 000000000000..ece2f98db7d2 --- /dev/null +++ b/connectivity/source/drivers/dbase/DCatalog.cxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * $RCSfile: DCatalog.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef _CONNECTIVITY_DBASE_CATALOG_HXX_ +#include "dbase/DCatalog.hxx" +#endif + +#ifndef _CONNECTIVITY_DBASE_DCONNECTION_HXX_ +#include "dbase/DConnection.hxx" +#endif +#ifndef _CONNECTIVITY_DBASE_TABLES_HXX_ +#include "dbase/DTables.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; + +// ------------------------------------------------------------------------- +using namespace connectivity::dbase; +// ------------------------------------------------------------------------- +ODbaseCatalog::ODbaseCatalog(ODbaseConnection* _pCon) : file::OFileCatalog(_pCon) +{ + osl_incrementInterlockedCount( &m_refCount ); + refreshTables(); + osl_decrementInterlockedCount( &m_refCount ); +} +// ------------------------------------------------------------------------- +void ODbaseCatalog::refreshTables() +{ + ::std::vector< ::rtl::OUString> aVector; + Sequence< ::rtl::OUString > aTypes(1); + aTypes[0] = ::rtl::OUString::createFromAscii("%"); + Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), + ::rtl::OUString::createFromAscii("%"),::rtl::OUString::createFromAscii("%"),aTypes); + + if(xResult.is()) + { + Reference< XRow > xRow(xResult,UNO_QUERY); + while(xResult->next()) + aVector.push_back(xRow->getString(3)); + } + if(m_pTables) + delete m_pTables; + m_pTables = new ODbaseTables(m_xMetaData,*this,m_aMutex,aVector); +} + + diff --git a/connectivity/source/drivers/dbase/DColumns.cxx b/connectivity/source/drivers/dbase/DColumns.cxx new file mode 100644 index 000000000000..d375e517f602 --- /dev/null +++ b/connectivity/source/drivers/dbase/DColumns.cxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * $RCSfile: DColumns.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_COLUMNS_HXX_ +#include "dbase/DColumns.hxx" +#endif +#ifndef _CONNECTIVITY_DBASE_TABLE_HXX_ +#include "dbase/DTable.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ +#include "connectivity/sdbcx/VColumn.hxx" +#endif + +using namespace connectivity::dbase; +using namespace connectivity; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; + + +Reference< XNamed > ODbaseColumns::createObject(const ::rtl::OUString& _rName) +{ + + ODbaseTable* pTable = (ODbaseTable*)m_pTable; + + // Reference< XFastPropertySet> xCol(pTable->getColumns()[_rName],UNO_QUERY); + ::vos::ORef<OSQLColumns> aCols = pTable->getTableColumns(); + + Reference< XNamed > xRet(*find(aCols->begin(),aCols->end(),_rName,::utl::UStringMixEqual(isCaseSensitive())),UNO_QUERY); + return xRet; +} + +// ------------------------------------------------------------------------- +void ODbaseColumns::impl_refresh() throw(RuntimeException) +{ + m_pTable->refreshColumns(); +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > ODbaseColumns::createEmptyObject() +{ + sdbcx::OColumn* pRet = new sdbcx::OColumn(isCaseSensitive()); + Reference< XPropertySet > xRet = pRet; + return xRet; +} + diff --git a/connectivity/source/drivers/dbase/DConnection.cxx b/connectivity/source/drivers/dbase/DConnection.cxx new file mode 100644 index 000000000000..7756d01f637e --- /dev/null +++ b/connectivity/source/drivers/dbase/DConnection.cxx @@ -0,0 +1,141 @@ +/************************************************************************* + * + * $RCSfile: DConnection.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_OCONNECTION_HXX_ +#include "dbase/DConnection.hxx" +#endif +#ifndef _CONNECTIVITY_DBASE_ODATABASEMETADATA_HXX_ +#include "dbase/DDatabaseMetaData.hxx" +#endif +#ifndef _CONNECTIVITY_DBASE_CATALOG_HXX_ +#include "dbase/DCatalog.hxx" +#endif +#ifndef _CONNECTIVITY_RESOURCE_HRC_ +#include "Resource.hrc" +#endif +#ifndef _CONNECTIVITY_MODULECONTEXT_HXX_ +#include "ModuleContext.hxx" +#endif +#ifndef _CONNECTIVITY_DBASE_ODRIVER_HXX_ +#include "dbase/DDriver.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _URLOBJ_HXX //autogen wg. INetURLObject +#include <tools/urlobj.hxx> +#endif +//#ifndef _FSYS_HXX //autogen +//#include <tools/fsys.hxx> +//#endif + +using namespace connectivity::dbase; +using namespace connectivity::file; + +typedef connectivity::file::OConnection OConnection_B; + +//------------------------------------------------------------------------------ +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::lang; + +// -------------------------------------------------------------------------------- +ODbaseConnection::ODbaseConnection(ODriver* _pDriver) : OConnection(_pDriver) +{ + m_aFilenameExtension = String::CreateFromAscii("dbf"); +} +//----------------------------------------------------------------------------- +ODbaseConnection::~ODbaseConnection() +{ +} + +// XServiceInfo +// -------------------------------------------------------------------------------- +IMPLEMENT_SERVICE_INFO(ODbaseConnection, "com.sun.star.sdbc.drivers.dbase.Connection", "com.sun.star.sdbc.Connection") + +// -------------------------------------------------------------------------------- +Reference< XDatabaseMetaData > SAL_CALL ODbaseConnection::getMetaData( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_B::rBHelper.bDisposed) + throw DisposedException(); + + if(!m_xMetaData.is()) + m_xMetaData = new ODbaseDatabaseMetaData(this); + + return m_xMetaData; +} +//------------------------------------------------------------------------------ +::com::sun::star::uno::Reference< XTablesSupplier > ODbaseConnection::createCatalog() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + Reference< XTablesSupplier > xTab = m_xCatalog; + if(!m_xCatalog.get().is()) + { + ODbaseCatalog *pCat = new ODbaseCatalog(this); + xTab = pCat; + m_xCatalog = xTab; + } + return xTab; +} + diff --git a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx new file mode 100644 index 000000000000..40a12d9e234d --- /dev/null +++ b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx @@ -0,0 +1,457 @@ +/************************************************************************* + * + * $RCSfile: DDatabaseMetaData.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_ODATABASEMETADATA_HXX_ +#include "dbase/DDatabaseMetaData.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_ +#include <com/sun/star/sdbc/ResultSetType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XFASTPROPERTYSET_HPP_ +#include <com/sun/star/beans/XFastPropertySet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_ +#include <com/sun/star/sdbc/ResultSetConcurrency.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XINDEXESSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XIndexesSupplier.hpp> +#endif +#ifndef _URLOBJ_HXX //autogen wg. INetURLObject +#include <tools/urlobj.hxx> +#endif +//#ifndef _FSYS_HXX //autogen +//#include <tools/fsys.hxx> +//#endif +#ifndef _CONNECTIVITY_FILE_ADATABASEMETADATARESULTSET_HXX_ +#include "file/FDatabaseMetaDataResultSet.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ +#include <com/sun/star/lang/XUnoTunnel.hpp> +#endif +#ifndef _CONNECTIVITY_DBASE_INDEX_HXX_ +#include "dbase/DIndex.hxx" +#endif + +using namespace connectivity::dbase; +using namespace connectivity::file; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; + + + +ODbaseDatabaseMetaData::ODbaseDatabaseMetaData(OConnection* _pCon) :ODatabaseMetaData(_pCon) +{ +} +// ------------------------------------------------------------------------- +ODbaseDatabaseMetaData::~ODbaseDatabaseMetaData() +{ +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getTypeInfo( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(); + Reference< XResultSet > xRef = pResult; + pResult->setTypeInfoMap(); + ORows aRows; + ORow aRow; + + aRow.push_back(Any()); + aRow.push_back(makeAny(::rtl::OUString::createFromAscii("CHAR"))); + aRow.push_back(makeAny(DataType::CHAR)); + aRow.push_back(makeAny((sal_Int32)254)); + aRow.push_back(makeAny(::rtl::OUString::createFromAscii("'"))); + aRow.push_back(makeAny(::rtl::OUString::createFromAscii("'"))); + aRow.push_back(Any()); + aRow.push_back(makeAny((sal_Int32)ColumnValue::NULLABLE)); + aRow.push_back(makeAny((sal_Int32)1)); + aRow.push_back(makeAny((sal_Int32)ColumnSearch::CHAR)); + aRow.push_back(makeAny((sal_Int32)1)); + aRow.push_back(makeAny((sal_Int32)0)); + aRow.push_back(makeAny((sal_Int32)0)); + aRow.push_back(Any()); + aRow.push_back(makeAny((sal_Int32)0)); + aRow.push_back(makeAny((sal_Int32)0)); + aRow.push_back(Any()); + aRow.push_back(Any()); + aRow.push_back(makeAny((sal_Int32)10)); + aRows.push_back(aRow); + + aRow[1] = makeAny(::rtl::OUString::createFromAscii("VARCHAR")); + aRow[2] = makeAny(DataType::VARCHAR); + aRow[4] = makeAny(::rtl::OUString::createFromAscii("'")); + aRow[5] = makeAny(::rtl::OUString::createFromAscii("'")); + aRows.push_back(aRow); + + + aRow[1] = makeAny(::rtl::OUString::createFromAscii("LONGVARCHAR")); + aRow[2] = makeAny(DataType::LONGVARCHAR); + aRow[3] = makeAny((sal_Int32)65535); + aRow[4] = makeAny(::rtl::OUString::createFromAscii("'")); + aRow[5] = makeAny(::rtl::OUString::createFromAscii("'")); + aRows.push_back(aRow); + + aRow[1] = makeAny(::rtl::OUString::createFromAscii("BOOL")); + aRow[2] = makeAny(DataType::BIT); + aRow[3] = makeAny((sal_Int32)1); + aRow[9] = makeAny((sal_Int32)ColumnSearch::BASIC); + aRows.push_back(aRow); + + aRow[1] = makeAny(::rtl::OUString::createFromAscii("DATE")); + aRow[2] = makeAny(DataType::DATE); + aRow[3] = makeAny((sal_Int32)10); + aRow[4] = makeAny(::rtl::OUString::createFromAscii("'")); + aRow[5] = makeAny(::rtl::OUString::createFromAscii("'")); + aRows.push_back(aRow); + + aRow[1] = makeAny(::rtl::OUString::createFromAscii("DECIMAL")); + aRow[2] = makeAny(DataType::DECIMAL); + aRow[3] = makeAny((sal_Int32)20); + aRow[15] = makeAny((sal_Int32)15); + aRows.push_back(aRow); + + aRow[1] = makeAny(::rtl::OUString::createFromAscii("NUMERIC")); + aRow[2] = makeAny(DataType::NUMERIC); + aRow[3] = makeAny((sal_Int32)20); + aRow[15] = makeAny((sal_Int32)20); + aRows.push_back(aRow); + + pResult->setRows(aRows); + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getColumnPrivileges( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, + const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(); + Reference< XResultSet > xRef = pResult; + pResult->setColumnPrivilegesMap(); + return xRef; +} + +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getColumns( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, + const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + + Reference< XTablesSupplier > xTables = m_pConnection->createCatalog(); + if(!xTables.is()) + throw SQLException(); + + Reference< XNameAccess> xNames = xTables->getTables(); + if(!xNames.is()) + throw SQLException(); + + ORows aRows; + ORow aRow(19); + aRow[10] <<= (sal_Int32)10; + Sequence< ::rtl::OUString> aTabNames(xNames->getElementNames()); + const ::rtl::OUString* pTabBegin = aTabNames.getConstArray(); + const ::rtl::OUString* pTabEnd = pTabBegin + aTabNames.getLength(); + for(;pTabBegin != pTabEnd;++pTabBegin) + { + if(match(tableNamePattern,*pTabBegin,'\0')) + { + Reference< XColumnsSupplier> xTable; + xNames->getByName(*pTabBegin) >>= xTable; + aRow[3] <<= *pTabBegin; + + Reference< XNameAccess> xColumns = xTable->getColumns(); + if(!xColumns.is()) + throw SQLException(); + + Sequence< ::rtl::OUString> aColNames(xColumns->getElementNames()); + + const ::rtl::OUString* pBegin = aColNames.getConstArray(); + const ::rtl::OUString* pEnd = pBegin + aColNames.getLength(); + Reference< XFastPropertySet> xColumn; + for(sal_Int32 i=1;pBegin != pEnd;++pBegin,++i) + { + if(match(columnNamePattern,*pBegin,'\0')) + { + aRow[4] <<= *pBegin; + + xColumns->getByName(*pBegin) >>= xColumn; + OSL_ENSHURE(xColumn.is(),"Columns contains a column who isn't a fastpropertyset!"); + aRow[5] = xColumn->getFastPropertyValue(PROPERTY_ID_TYPE); + aRow[6] = xColumn->getFastPropertyValue(PROPERTY_ID_TYPENAME); + aRow[7] = xColumn->getFastPropertyValue(PROPERTY_ID_PRECISION); + // aRow[8] = xColumn->getFastPropertyValue(PROPERTY_ID_TYPENAME); + aRow[9] = xColumn->getFastPropertyValue(PROPERTY_ID_SCALE); + aRow[11] = xColumn->getFastPropertyValue(PROPERTY_ID_ISNULLABLE); + // aRow[12] = xColumn->getFastPropertyValue(PROPERTY_ID_TYPENAME); + aRow[13] = xColumn->getFastPropertyValue(PROPERTY_ID_DEFAULTVALUE); + // aRow[14] = xColumn->getFastPropertyValue(PROPERTY_ID_TYPENAME); + // aRow[15] = xColumn->getFastPropertyValue(PROPERTY_ID_TYPENAME); + switch(getINT32(aRow[5])) + { + case DataType::CHAR: + case DataType::VARCHAR: + aRow[16] <<= (sal_Int32)254; + break; + case DataType::LONGVARCHAR: + aRow[16] <<= (sal_Int32)65535; + break; + default: + aRow[16] <<= (sal_Int32)0; + } + aRow[17] <<= i; + switch(getINT32(aRow[11])) + { + case ColumnValue::NO_NULLS: + aRow[18] <<= ::rtl::OUString::createFromAscii("NO"); + break; + case ColumnValue::NULLABLE: + aRow[18] <<= ::rtl::OUString::createFromAscii("YES"); + break; + default: + aRow[18] <<= ::rtl::OUString(); + } + aRows.push_back(aRow); + } + } + } + } + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(); + Reference< XResultSet > xRef = pResult; + pResult->setColumnsMap(); + pResult->setRows(aRows); + + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getVersionColumns( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(); + Reference< XResultSet > xRef = pResult; + pResult->setVersionColumnsMap(); + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getExportedKeys( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(); + Reference< XResultSet > xRef = pResult; + pResult->setExportedKeysMap(); + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getImportedKeys( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(); + Reference< XResultSet > xRef = pResult; + pResult->setImportedKeysMap(); + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getPrimaryKeys( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(); + Reference< XResultSet > xRef = pResult; + pResult->setPrimaryKeysMap(); + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getIndexInfo( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, + sal_Bool unique, sal_Bool approximate ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + Reference< XTablesSupplier > xTables = m_pConnection->createCatalog(); + if(!xTables.is()) + throw SQLException(); + + Reference< XNameAccess> xNames = xTables->getTables(); + if(!xNames.is()) + throw SQLException(); + + ORows aRows; + ORow aRow(14); + aRow[5] <<= ::rtl::OUString(); + aRow[10] <<= ::rtl::OUString::createFromAscii("A"); + + Reference< XIndexesSupplier> xTable; + xNames->getByName(table) >>= xTable; + aRow[3] <<= table; + aRow[7] <<= (sal_Int32)3; + + Reference< XNameAccess> xIndexes = xTable->getIndexes(); + if(!xIndexes.is()) + throw SQLException(); + + Sequence< ::rtl::OUString> aIdxNames(xIndexes->getElementNames()); + + const ::rtl::OUString* pBegin = aIdxNames.getConstArray(); + const ::rtl::OUString* pEnd = pBegin + aIdxNames.getLength(); + Reference< XFastPropertySet> xIndex; + for(;pBegin != pEnd;++pBegin) + { + xIndexes->getByName(*pBegin) >>= xIndex; + OSL_ENSHURE(xIndex.is(),"Indexes contains a column who isn't a fastpropertyset!"); + + if(unique && !getBOOL(xIndex->getFastPropertyValue(PROPERTY_ID_ISUNIQUE))) + continue; + aRow[4] = xIndex->getFastPropertyValue(PROPERTY_ID_ISUNIQUE); + aRow[6] <<= *pBegin; + + Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(xIndex,UNO_QUERY); + if(xTunnel.is()) + { + ODbaseIndex* pIndex = (ODbaseIndex*)xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()); + if(pIndex) + { + aRow[11] <<= pIndex->getHeader().db_maxkeys; + aRow[12] <<= pIndex->getHeader().db_pagecount; + } + } + + Reference<XColumnsSupplier> xColumnsSup(xIndex,UNO_QUERY); + Reference< XNameAccess> xColumns = xColumnsSup->getColumns(); + Sequence< ::rtl::OUString> aColNames(xColumns->getElementNames()); + + const ::rtl::OUString* pColBegin = aColNames.getConstArray(); + const ::rtl::OUString* pColEnd = pColBegin + aColNames.getLength(); + Reference< XFastPropertySet> xColumn; + for(sal_Int32 j=1;pColBegin != pColEnd;++pColBegin,++j) + { + xColumns->getByName(*pColBegin) >>= xColumn; + aRow[8] <<= j; + aRow[9] <<= *pColBegin; + aRows.push_back(aRow); + } + } + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(); + Reference< XResultSet > xRef = pResult; + pResult->setIndexInfoMap(); + pResult->setRows(aRows); + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getBestRowIdentifier( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope, + sal_Bool nullable ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(); + Reference< XResultSet > xRef = pResult; + pResult->setBestRowIdentifierMap(); + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getTablePrivileges( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(); + Reference< XResultSet > xRef = pResult; + pResult->setTablePrivilegesMap(); + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getCrossReference( + const Any& primaryCatalog, const ::rtl::OUString& primarySchema, + const ::rtl::OUString& primaryTable, const Any& foreignCatalog, + const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(); + Reference< XResultSet > xRef = pResult; + pResult->setCrossReferenceMap(); + return xRef; +} + diff --git a/connectivity/source/drivers/dbase/DDriver.cxx b/connectivity/source/drivers/dbase/DDriver.cxx new file mode 100644 index 000000000000..66639239c8e3 --- /dev/null +++ b/connectivity/source/drivers/dbase/DDriver.cxx @@ -0,0 +1,151 @@ +/************************************************************************* + * + * $RCSfile: DDriver.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_DDRIVER_HXX_ +#include "dbase/DDriver.hxx" +#endif +#ifndef _CONNECTIVITY_DBASE_DCONNECTION_HXX_ +#include "dbase/DConnection.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif + +using namespace connectivity::dbase; +using namespace connectivity::file; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::lang; + + +// static ServiceInfo +//------------------------------------------------------------------------------ +rtl::OUString ODriver::getImplementationName_Static( ) throw(RuntimeException) +{ + return rtl::OUString::createFromAscii("com.sun.star.sdbc.driver.dbase.Driver"); +} +//------------------------------------------------------------------------------ +//Sequence< ::rtl::OUString > ODriver::getSupportedServiceNames_Static( ) throw (RuntimeException) +//{ +// Sequence< ::rtl::OUString > aSNS( 2 ); +// aSNS[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.Driver"); +// aSNS[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.Driver"); +// return aSNS; +//} + +//------------------------------------------------------------------ +::rtl::OUString SAL_CALL ODriver::getImplementationName( ) throw(RuntimeException) +{ + return getImplementationName_Static(); +} + +//------------------------------------------------------------------ +//sal_Bool SAL_CALL ODriver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) +//{ +// Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); +// const ::rtl::OUString* pSupported = aSupported.getConstArray(); +// for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) +// if (pSupported->equals(_rServiceName)) +// return sal_True; +// +// return sal_False; +//} + +//------------------------------------------------------------------ +//Sequence< ::rtl::OUString > SAL_CALL ODriver::getSupportedServiceNames( ) throw(RuntimeException) +//{ +// return getSupportedServiceNames_Static(); +//} + + +//------------------------------------------------------------------ +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL connectivity::dbase::ODriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ) +{ + return *(new ODriver(_rxFactory)); +} +// -------------------------------------------------------------------------------- +Reference< XConnection > SAL_CALL ODriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODriver_BASE::rBHelper.bDisposed) + throw DisposedException(); + + ODbaseConnection* pCon = new ODbaseConnection(this); + pCon->construct(url,info); + Reference< XConnection > xCon = pCon; + m_xConnections.push_back(WeakReferenceHelper(*pCon)); + + return xCon; +} +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL ODriver::acceptsURL( const ::rtl::OUString& url ) + throw(SQLException, RuntimeException) +{ + if(!url.compareTo(::rtl::OUString::createFromAscii("sdbc:dbase:"),11)) + { + return sal_True; + } + return sal_False; +} + + diff --git a/connectivity/source/drivers/dbase/DIndex.cxx b/connectivity/source/drivers/dbase/DIndex.cxx new file mode 100644 index 000000000000..62315ef98f88 --- /dev/null +++ b/connectivity/source/drivers/dbase/DIndex.cxx @@ -0,0 +1,701 @@ +/************************************************************************* + * + * $RCSfile: DIndex.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_INDEX_HXX_ +#include "dbase/DIndex.hxx" +#endif +#ifndef _CONNECTIVITY_DBASE_INDEXCOLUMNS_HXX_ +#include "dbase/DIndexColumns.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ +#include "connectivity/sdbcx/VColumn.hxx" +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +#ifndef _CONNECTIVITY_DBASE_TABLE_HXX_ +#include "dbase/DTable.hxx" +#endif +#ifndef _CONNECTIVITY_DBASE_INDEXITER_HXX_ +#include "dbase/DIndexIter.hxx" +#endif +//#ifndef _FSYS_HXX //autogen +//#include <tools/fsys.hxx> +//#endif +#ifndef _CONFIG_HXX //autogen +#include <vcl/config.hxx> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATA_HPP_ +#include <com/sun/star/sdbc/XResultSetMetaData.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _UCBHELPER_CONTENT_HXX +#include <ucbhelper/content.hxx> +#endif +#ifndef _CPPUHELPER_EXTRACT_HXX_ +#include <cppuhelper/extract.hxx> +#endif +// ------------------------------------------------------------------------- +using namespace connectivity; +using namespace ucb; +using namespace cppu; +using namespace connectivity::file; +using namespace connectivity::sdbcx; +using namespace connectivity::dbase; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::uno; +using namespace com::sun::star::beans; +using namespace com::sun::star::ucb; + + +IMPLEMENT_SERVICE_INFO(ODbaseIndex,"com.sun.star.sdbcx.driver.dbase.Index","com.sun.star.sdbcx.Index"); +// ------------------------------------------------------------------------- +ODbaseIndex::ODbaseIndex(ODbaseTable* _pTable) : OIndex(_pTable->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()) + , m_pTable(_pTable) +{ + construct(); +} +// ------------------------------------------------------------------------- +ODbaseIndex::ODbaseIndex( ODbaseTable* _pTable, + const NDXHeader& _rHeader, + const ::rtl::OUString& _rName) + : OIndex(_rName,::rtl::OUString(),_rHeader.db_unique,sal_False,sal_False,_pTable->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()) + , m_aHeader(_rHeader) + , m_pTable(_pTable) +{ + construct(); +} +// ------------------------------------------------------------------------- +void ODbaseIndex::refreshColumns() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + ::std::vector< ::rtl::OUString> aVector; + aVector.push_back(::rtl::OUString::createFromAscii(m_aHeader.db_name)); + + if(m_pColumns) + delete m_pColumns; + m_pColumns = new ODbaseIndexColumns(this,m_aMutex,aVector); +} +// ------------------------------------------------------------------------- +Any SAL_CALL ODbaseIndex::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = ::cppu::queryInterface(rType,static_cast< ::com::sun::star::lang::XUnoTunnel*> (this)); + if(aRet.hasValue()) + return aRet; + + return ODbaseIndex_BASE::queryInterface(rType); +} + +//-------------------------------------------------------------------------- +Sequence< sal_Int8 > ODbaseIndex::getUnoTunnelImplementationId() +{ + static ::cppu::OImplementationId * pId = 0; + if (! pId) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + if (! pId) + { + static ::cppu::OImplementationId aId; + pId = &aId; + } + } + return pId->getImplementationId(); +} + +// com::sun::star::lang::XUnoTunnel +//------------------------------------------------------------------ +sal_Int64 ODbaseIndex::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException) +{ + if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + return (sal_Int64)this; + + return 0; +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL ODbaseIndex::getTypes( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),ODbaseIndex_BASE::getTypes()); +} + +//------------------------------------------------------------------ +ONDXPagePtr ODbaseIndex::getRoot() +{ + openIndexFile(); + if (!m_aRoot.Is()) + { + m_nRootPage = m_aHeader.db_rootpage; + m_nPageCount = m_aHeader.db_pagecount; + m_aRoot = CreatePage(m_nRootPage,NULL,TRUE); + } + return m_aRoot; +} +//------------------------------------------------------------------ +sal_Bool ODbaseIndex::openIndexFile() +{ + if(!m_aFileStream.IsOpen()) + { + INetURLObject aURL; + aURL.SetSmartProtocol(INET_PROT_FILE); + aURL.SetSmartURL(m_pTable->getEntry(), INetURLObject::ENCODE_ALL); + + aURL.setName(m_Name); + aURL.setExtension(String::CreateFromAscii("ndx")); + + // Dir* pDir = m_pTable->getConnection()->getDir(); + // String aPath = pDir->GetName(); + // aPath += m_Name.getStr(); + // DirEntry aEntry(aPath); + // aEntry.setExtension(String::CreateFromAscii("ndx")); + m_aFileStream.Open(aURL.GetMainURL(), STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE); + + m_aFileStream.SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN); + m_aFileStream.SetBufferSize(512); + } + + return m_aFileStream.IsOpen(); +} +//------------------------------------------------------------------ +OIndexIterator* ODbaseIndex::createIterator(OBoolOperator* pOp, + const OOperand* pOperand) +{ + openIndexFile(); + return new OIndexIterator(this, pOp, pOperand); +} +//------------------------------------------------------------------ +BOOL ODbaseIndex::ConvertToKey(ONDXKey* rKey, sal_uInt32 nRec, const OFileValue& rValue) +{ + OSL_ENSHURE(m_aFileStream.IsOpen(),"FileStream is not opened!"); + // Sucht ein bestimmten Wert im Index + // Wenn der Index Unique ist, interssiert der Key nicht, sonst ja + try + { + if (m_aHeader.db_keytype == 0) + { + *rKey = ONDXKey(rValue.getString(), nRec ); + } + else + { + if (rValue.isNull()) + *rKey = ONDXKey(rValue.getDouble(), DataType::DOUBLE, nRec ); + else + *rKey = ONDXKey(rValue.getDouble(), nRec ); + } + } + catch (...) + { + return FALSE; + } + return TRUE; +} + +//------------------------------------------------------------------ +BOOL ODbaseIndex::Find(sal_uInt32 nRec, const OFileValue& rValue) +{ + openIndexFile(); + OSL_ENSHURE(m_aFileStream.IsOpen(),"FileStream is not opened!"); + // Sucht ein bestimmten Wert im Index + // Wenn der Index Unique ist, interssiert der Key nicht, sonst ja + ONDXKey aKey; + return ConvertToKey(&aKey, nRec, rValue) && getRoot()->Find(aKey); +} + +//------------------------------------------------------------------ +BOOL ODbaseIndex::Insert(sal_uInt32 nRec, const OFileValue& rValue) +{ + openIndexFile(); + OSL_ENSHURE(m_aFileStream.IsOpen(),"FileStream is not opened!"); + ONDXKey aKey; + + // Existiert der Wert bereits + // Find immer verwenden um das aktuelle Blatt zu bestimmen + if (!ConvertToKey(&aKey, nRec, rValue) || (getRoot()->Find(aKey) && isUnique())) + return FALSE; + + ONDXNode aNewNode(aKey); + + // einfuegen in das aktuelle Blatt + if (!m_aCurLeaf.Is()) + return FALSE; + + BOOL bResult = m_aCurLeaf->Insert(aNewNode); + Release(bResult); + + return bResult; +} + +//------------------------------------------------------------------ +BOOL ODbaseIndex::Update(sal_uInt32 nRec, const OFileValue& rOldValue, + const OFileValue& rNewValue) +{ + openIndexFile(); + OSL_ENSHURE(m_aFileStream.IsOpen(),"FileStream is not opened!"); + ONDXKey aKey; + if (!ConvertToKey(&aKey, nRec, rNewValue) || (isUnique() && getRoot()->Find(aKey))) + return FALSE; + else + return Delete(nRec, rOldValue) && Insert(nRec,rNewValue); +} + +//------------------------------------------------------------------ +BOOL ODbaseIndex::Delete(sal_uInt32 nRec, const OFileValue& rValue) +{ + openIndexFile(); + OSL_ENSHURE(m_aFileStream.IsOpen(),"FileStream is not opened!"); + // Existiert der Wert bereits + // Find immer verwenden um das aktuelle Blatt zu bestimmen + ONDXKey aKey; + if (!ConvertToKey(&aKey, nRec, rValue) || !getRoot()->Find(aKey)) + return FALSE; + + ONDXNode aNewNode(aKey); + + // einfuegen in das aktuelle Blatt + if (!m_aCurLeaf.Is()) + return FALSE; +#if DEBUG + m_aRoot->PrintPage(); +#endif + + return m_aCurLeaf->Delete(m_nCurNode); +} +//------------------------------------------------------------------ +void ODbaseIndex::Collect(ONDXPage* pPage) +{ + OSL_ENSHURE(m_aFileStream.IsOpen(),"FileStream is not opened!"); + if (pPage) + m_aCollector.push_back(pPage); +} +//------------------------------------------------------------------ +void ODbaseIndex::Release(BOOL bSave) +{ + // Freigeben der Indexressourcen + m_bUseCollector = FALSE; + + if (m_aCurLeaf.Is()) + { + m_aCurLeaf->Release(bSave); + m_aCurLeaf.Clear(); + } + + // Wurzel freigeben + if (m_aRoot.Is()) + { + m_aRoot->Release(bSave); + m_aRoot.Clear(); + } + // alle Referenzen freigeben, bevor der FileStream geschlossen wird + for (ULONG i = 0; i < m_aCollector.size(); i++) + m_aCollector[i]->QueryDelete(); + + m_aCollector.clear(); + + // Header modifiziert ? + if (bSave && (m_aHeader.db_rootpage != m_nRootPage || + m_aHeader.db_pagecount != m_nPageCount)) + { + m_aHeader.db_rootpage = m_nRootPage; + m_aHeader.db_pagecount = m_nPageCount; + m_aFileStream << *this; + } + m_nRootPage = m_nPageCount = 0; + m_nCurNode = NODE_NOTFOUND; +} +//------------------------------------------------------------------ +ONDXPage* ODbaseIndex::CreatePage(sal_uInt32 nPagePos, ONDXPage* pParent, BOOL bLoad) +{ + OSL_ENSHURE(m_aFileStream.IsOpen(),"FileStream is not opened!"); + + ONDXPage* pPage; + if (m_aCollector.size()) + { + pPage = *(m_aCollector.end() - 1); + m_aCollector.pop_back(); + pPage->SetPagePos(nPagePos); + pPage->SetParent(pParent); + } + else + pPage = new ONDXPage(*this, nPagePos, pParent); + + if (bLoad) + m_aFileStream >> *pPage; + + return pPage; +} + +//------------------------------------------------------------------ +SvStream& connectivity::dbase::operator >> (SvStream &rStream, ODbaseIndex& rIndex) +{ + rStream.Seek(0); + rStream.Read(&rIndex.m_aHeader,512); + + // Text convertierung + ByteString aText(rIndex.m_aHeader.db_name); + // aText.Convert(rIndex.GetDBFConnection()->GetCharacterSet(), gsl_getSystemTextEncoding()); + // aText.Convert(rIndex.GetDBFConnection()->GetCharacterSet(), gsl_getSystemTextEncoding()); + strcpy(rIndex.m_aHeader.db_name,aText.GetBuffer()); + + rIndex.m_nRootPage = rIndex.m_aHeader.db_rootpage; + rIndex.m_nPageCount = rIndex.m_aHeader.db_pagecount; + return rStream; +} +//------------------------------------------------------------------ +SvStream& connectivity::dbase::operator << (SvStream &rStream, ODbaseIndex& rIndex) +{ + rStream.Seek(0); + ByteString aText(rIndex.m_aHeader.db_name); + // aText.Convert(gsl_getSystemTextEncoding(), rIndex.GetDBFConnection()->GetCharacterSet()); + strcpy(rIndex.m_aHeader.db_name,aText.GetBuffer()); + sal_Int32 nWrites = rStream.Write(&rIndex.m_aHeader,512); + OSL_ENSHURE(nWrites == 512,"Write not successful: Wrong header size for dbase index!"); + return rStream; +} +// ------------------------------------------------------------------------- +INetURLObject ODbaseIndex::getEntry() +{ + INetURLObject aDir = m_pTable->getEntry(); + aDir.setName(m_Name); + return aDir; +} +//------------------------------------------------------------------ +void ODbaseIndex::createINFEntry() +{ + // inf Datei abgleichen + String aNDX; + // Dir* pDir = m_pTable->getConnection()->getDir(); + // String aPath = pDir->GetName(); + // aPath += m_Name.getStr(); + INetURLObject aEntry(getEntry()); + aEntry.setExtension(String::CreateFromAscii("ndx")); + + INetURLObject aInfEntry(m_pTable->getEntry()); + aInfEntry.setExtension(String::CreateFromAscii("inf")); + + Config aInfFile(aInfEntry.GetMainURL()); + aInfFile.SetGroup(dBASE_III_GROUP); + + USHORT nSuffix = aInfFile.GetKeyCount(); + ByteString aNewEntry,aKeyName; + BOOL bCase = isCaseSensitive(); + while (!aNewEntry.Len()) + { + aNewEntry = "NDX"; + aNewEntry += ByteString::CreateFromInt32(++nSuffix); + for (USHORT i = 0; i < aInfFile.GetKeyCount(); i++) + { + aKeyName = aInfFile.GetKeyName(i); + if (bCase ? aKeyName == aNewEntry : aKeyName.EqualsIgnoreCaseAscii(aNewEntry)) + { + aNewEntry.Erase(); + break; + } + } + } + aInfFile.WriteKey(aNewEntry,ByteString(aEntry.GetName(),gsl_getSystemTextEncoding())); +} +// ------------------------------------------------------------------------- +BOOL ODbaseIndex::DropImpl() +{ + if (m_aFileStream.IsOpen()) + m_aFileStream.Close(); + + INetURLObject aIndexEntry(getEntry()); + aIndexEntry.setExtension(String::CreateFromAscii("ndx")); + + Content aContent(aIndexEntry.GetMainURL(),Reference<XCommandEnvironment>()); + aContent.executeCommand( rtl::OUString::createFromAscii( "delete" ),bool2any( sal_True ) ); + +// ULONG nErrorCode = aIndexEntry.Kill(); +// if (nErrorCode != SVSTREAM_OK && nErrorCode != SVSTREAM_FILE_NOT_FOUND) +// { +// // aStatus.SetError(nErrorCode,INDEX,aName); +// return FALSE; +// } + + // InfDatei abgleichen + String aNDX; + INetURLObject aEntry( m_pTable->getEntry()); + aEntry.setExtension(String::CreateFromAscii("inf")); + + Config aInfFile(aEntry.GetMainURL()); + aInfFile.SetGroup(dBASE_III_GROUP); + USHORT nKeyCnt = aInfFile.GetKeyCount(); + ByteString aKeyName; + + INetURLObject aEntryToComp(getEntry()); + aEntryToComp.setExtension(String::CreateFromAscii("ndx")); + + for (USHORT nKey = 0; nKey < nKeyCnt; nKey++) + { + // Verweist der Key auf ein Indexfile?... + aKeyName = aInfFile.GetKeyName( nKey ); + //...wenn ja, Indexliste der Tabelle hinzufuegen + if (aEntry.IsCaseSensitive() ? aKeyName.Copy(0,3) == "NDX" : aKeyName.Copy(0,3).EqualsIgnoreCaseAscii("NDX")) + { + aEntryToComp.setName(String(aInfFile.ReadKey(aKeyName),gsl_getSystemTextEncoding())); + aEntryToComp.setExtension(String::CreateFromAscii("ndx")); + if (aEntryToComp == aIndexEntry) + { + aInfFile.DeleteKey(aKeyName); + break; + } + } + } + return TRUE; +} +// ------------------------------------------------------------------------- +//------------------------------------------------------------------ +BOOL ODbaseIndex::CreateImpl() +{ + // Anlegen des Index + INetURLObject aEntry(getEntry()); + aEntry.setExtension(String::CreateFromAscii("ndx")); + + Content aContent(aEntry.GetMainURL(),Reference<XCommandEnvironment>()); + if (aContent.isDocument()) + { + // aStatus.SetError(ERRCODE_IO_ALREADYEXISTS,INDEX,aEntry.GetFull()); + return FALSE; + } + + // Index ist nur einstufig + if (m_pColumns->getCount() != 2) + { + // aStatus.SetDriverNotCapableError(); + return FALSE; + } + + Reference<XFastPropertySet> xCol; + m_pColumns->getByIndex(1) >>= xCol; + + // ist die Spalte schon indiziert ? + if (!xCol.is()) + { +// String aText = String(OResId(STR_STAT_INDEX_COLUMN_NOT_FOUND)); +// aText.SearchAndReplace(String::CreateFromAscii("#"),pColumn->GetName()); +// aText.SearchAndReplace(String::CreateFromAscii("%"),GetTable()->Name()); +// aStatus.Set(SDB_STAT_ERROR, +// String::CreateFromAscii("01000"), +// aStatus.CreateErrorMessage(aText), +// 0, String() ); + return FALSE; + } +// else if (pColumn && pColumn->IsIndexed()) +// { +// String aText = String(OResId(STR_STAT_INDEX_COLUMN_ALREADY_INDEXED)); +// aText.SearchAndReplace(String::CreateFromAscii("#"),pColumn->GetName()); +// aStatus.Set(SDB_STAT_ERROR, +// String::CreateFromAscii("01000"), +// aStatus.CreateErrorMessage(aText), +// 0, String() ); +// return FALSE; +// } + + // Anlegen des Indexfiles + m_aFileStream.Open(aEntry.GetMainURL(), STREAM_READWRITE | STREAM_SHARE_DENYWRITE | STREAM_TRUNC); + if (!m_aFileStream.IsOpen()) + return FALSE; + + m_aFileStream.SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN); + m_aFileStream.SetBufferSize(512); + + // Zunächst muß das Ergebnis sortiert sein + Reference<XStatement> xStmt = m_pTable->getConnection()->createStatement(); + + String aName(getString(xCol->getFastPropertyValue(PROPERTY_ID_NAME))); + + String aQuote(m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString()); + String aStatement; + aStatement.AssignAscii("SELECT "); + aStatement += aQuote; + aStatement += aName; + aStatement += aQuote; + aStatement.AppendAscii(" FROM "); + aStatement += aQuote; + aStatement += m_pTable->getName().getStr(); + aStatement += aQuote; + aStatement.AppendAscii(" ORDER BY "); + aStatement += aQuote; + aStatement += aName; + aStatement += aQuote; + + if (!m_IsUnique) // zusaetzlich sortierung mit der bookmarkspalte + { + aStatement.AppendAscii(" ,"); + aStatement += aQuote; + aStatement.AppendAscii("[BOOKMARK]"); // this is a special column + aStatement += aQuote; + } + + Reference<XResultSet> xSet = xStmt->executeQuery(aStatement); + + if (!xSet.is()) + { + m_aFileStream.Close(); + // aEntry.Kill(); + aContent.executeCommand( rtl::OUString::createFromAscii( "delete" ),bool2any( sal_True ) ); + return FALSE; + } + + // Setzen der Headerinfo + memset(&m_aHeader,0,sizeof(m_aHeader)); + m_aFileStream.SetStreamSize(512); + + sal_Int32 nType = 0; + xCol->getFastPropertyValue(PROPERTY_ID_TYPE) >>= nType; + + m_aHeader.db_keytype = (nType == DataType::VARCHAR || nType == DataType::CHAR) ? 0 : 1; + m_aHeader.db_keylen = (m_aHeader.db_keytype) ? 8 : (USHORT)getINT32(xCol->getFastPropertyValue(PROPERTY_ID_PRECISION)); + m_aHeader.db_maxkeys = (512 - 8) / (8 + m_aHeader.db_keylen); + ByteString aCol(aName,gsl_getSystemTextEncoding()); + strcpy(m_aHeader.db_name,aCol.GetBuffer()); + m_aHeader.db_unique = m_IsUnique ? 1: 0; + m_aHeader.db_keyrec = m_aHeader.db_keylen + 8; + + // modifizierung am Header werden ueber Unterschiede zw. HeaderInfo und nRootPage + // bzw. nPageCout erkannt + + m_nRootPage = 1; + m_nPageCount = 2; + + // ODatabaseType eType = m_aHeader.db_keytype == 0 ? DataType::VARCHAR : DataType::DOUBLE; + m_aCurLeaf = m_aRoot = CreatePage(m_nRootPage); + m_aRoot->SetModified(TRUE); + + m_bUseCollector = TRUE; + + // ULONG nRowsLeft = pCursor->RowCount(); + Reference<XRow> xRow(xSet,UNO_QUERY); + + xSet->last(); + sal_Int32 nRowsLeft = xSet->getRow(); + xSet->beforeFirst(); + + // Erzeugen der Indexstruktur + while (xSet->next()) + { + // ODbRow& rRow = *pCursor->GetRow(); + // ueberpruefen auf doppelten eintrag + if (m_IsUnique && m_nCurNode != NODE_NOTFOUND) + { + ONDXKey aKey(m_aHeader.db_keytype ? OFileValue(xRow->getDouble(1)) : OFileValue(xRow->getString(1)), nType, 0); + if (aKey == (*m_aCurLeaf)[m_nCurNode].GetKey()) + { +// String aText = String(OResId(STR_STAT_INDEX_NOT_UNIQUE)); +// aText.SearchAndReplace(String::CreateFromAscii("#"),aName); +// aStatus.Set(SDB_STAT_ERROR, +// String::CreateFromAscii("01000"), +// aStatus.CreateErrorMessage(aText), +// 0, String() ); + break; + } + } + ONDXKey aKey(m_aHeader.db_keytype ? OFileValue(xRow->getDouble(1)) : OFileValue(xRow->getString(1)), nType, xSet->getRow()); + ONDXNode aNewNode(aKey); + if (!m_aCurLeaf->Insert(aNewNode, --nRowsLeft)) + break; + +#ifdef DEBUG + //DBG_TRACE1("SDB: %s", (const char*)pCursor->Variable(1)->GetString()); + // PrintTree(); +#endif + } + +// BOOL bResult = !pCursor->IsInRange(); +// if (!bResult) +// { +// m_aFileStream.Close(); +// aEntry.Kill(); +// Release(FALSE); +// } +// else +// { + + Release(); +// m_aFileStream.Close(); + // den FielStream NICHT schliessen, da per definitionem ein OObject nach dem Kreieren offen ist + + // inf Datei abgleichen + createINFEntry(); +// } +// + // pCursor->ReleaseRef(); + return sal_True; +} + + + diff --git a/connectivity/source/drivers/dbase/DIndexColumns.cxx b/connectivity/source/drivers/dbase/DIndexColumns.cxx new file mode 100644 index 000000000000..56d473a2ddff --- /dev/null +++ b/connectivity/source/drivers/dbase/DIndexColumns.cxx @@ -0,0 +1,119 @@ +/************************************************************************* + * + * $RCSfile: DIndexColumns.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_INDEXCOLUMNS_HXX_ +#include "dbase/DIndexColumns.hxx" +#endif +#ifndef _CONNECTIVITY_DBASE_TABLE_HXX_ +#include "dbase/DTable.hxx" +#endif + +#ifndef _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_ +#include "connectivity/sdbcx/VIndexColumn.hxx" +#endif + +using namespace connectivity::dbase; +using namespace connectivity; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; + + +Reference< XNamed > ODbaseIndexColumns::createObject(const ::rtl::OUString& _rName) +{ + const ODbaseTable* pTable = m_pIndex->getTable(); + + ::vos::ORef<OSQLColumns> aCols = pTable->getTableColumns(); + + Reference< XFastPropertySet > xCol(*find(aCols->begin(),aCols->end(),_rName,::utl::UStringMixEqual(isCaseSensitive()))); + if(!xCol.is()) + return Reference< XNamed >(); + + Reference< XNamed > xRet = new sdbcx::OIndexColumn(sal_True,_rName + ,getString(xCol->getFastPropertyValue(PROPERTY_ID_TYPENAME)) + ,::rtl::OUString() + ,getINT32(xCol->getFastPropertyValue(PROPERTY_ID_ISNULLABLE)) + ,getINT32(xCol->getFastPropertyValue(PROPERTY_ID_PRECISION)) + ,getINT32(xCol->getFastPropertyValue(PROPERTY_ID_SCALE)) + ,getINT32(xCol->getFastPropertyValue(PROPERTY_ID_TYPE)) + ,sal_False + ,sal_False + ,sal_False + ,pTable->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); + + return xRet; +} + +// ------------------------------------------------------------------------- +void ODbaseIndexColumns::impl_refresh() throw(RuntimeException) +{ + m_pIndex->refreshColumns(); +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > ODbaseIndexColumns::createEmptyObject() +{ + sdbcx::OColumn* pRet = new sdbcx::OIndexColumn(m_pIndex->getTable()->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); + Reference< XPropertySet > xRet = pRet; + return xRet; +} + diff --git a/connectivity/source/drivers/dbase/DIndexIter.cxx b/connectivity/source/drivers/dbase/DIndexIter.cxx new file mode 100644 index 000000000000..e5669df7d29f --- /dev/null +++ b/connectivity/source/drivers/dbase/DIndexIter.cxx @@ -0,0 +1,344 @@ +/************************************************************************* + * + * $RCSfile: DIndexIter.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_DBASE_INDEXITER_HXX_ +#include "dbase/DIndexIter.hxx" +#endif + +using namespace connectivity; +using namespace connectivity::dbase; +using namespace connectivity::file; +//================================================================== +// OIndexIterator +//================================================================== +//------------------------------------------------------------------ +OIndexIterator::~OIndexIterator() +{ + // m_pIndex->UnLock(); + m_pIndex->release(); +} + +//------------------------------------------------------------------ +ULONG OIndexIterator::First() +{ + return Find(TRUE); +} + +//------------------------------------------------------------------ +ULONG OIndexIterator::Next() +{ + return Find(FALSE); +} +//------------------------------------------------------------------ +ULONG OIndexIterator::Find(BOOL bFirst) +{ + // ONDXIndex* m_pIndex = GetNDXIndex(); + + ULONG nRes = STRING_NOTFOUND; +// if (!m_pIndex->IsOpen()) +// return nRes; + + if (bFirst) + { + m_aRoot = m_pIndex->getRoot(); + m_aCurLeaf = NULL; + } + + if (!m_pOperator) + { + // Vorbereitung , auf kleinstes Element positionieren + if (bFirst) + { + ONDXPage* pPage = m_aRoot.getBodyPtr(); + while (pPage && !pPage->IsLeaf()) + pPage = pPage->GetChild(m_pIndex).getBodyPtr(); + + m_aCurLeaf = pPage; + m_nCurNode = NODE_NOTFOUND; + } + ONDXKey* pKey = GetNextKey(); + nRes = pKey ? pKey->GetRecord() : STRING_NOTFOUND; + } + else if (m_pOperator->IsA(TYPE(OOp_ISNOTNULL))) + nRes = GetNotNull(bFirst); + else if (m_pOperator->IsA(TYPE(OOp_ISNULL))) + nRes = GetNull(bFirst); + else if (m_pOperator->IsA(TYPE(OOp_LIKE))) + nRes = GetLike(bFirst); + else if (m_pOperator->IsA(TYPE(OOp_COMPARE))) + nRes = GetCompare(bFirst); + + return nRes; +} + +//------------------------------------------------------------------ +ONDXKey* OIndexIterator::GetFirstKey(ONDXPage* pPage, const OOperand& rKey) +{ + // sucht den vorgegeben key + // Besonderheit: gelangt der Algorithmus ans Ende + // wird immer die aktuelle Seite und die Knotenposition vermerkt + // auf die die Bedingung <= zutrifft + // dieses findet beim Insert besondere Beachtung + // ONDXIndex* m_pIndex = GetNDXIndex(); + OOp_COMPARE aTempOp(SQL_PRED_GREATER); + USHORT i = 0; + + if (pPage->IsLeaf()) + { + // im blatt wird die eigentliche Operation ausgefuehrt, sonst die temp. (>) + while (i < pPage->Count() && !m_pOperator->operate(&((*pPage)[i]).GetKey(),&rKey)) + i++; + } + else + while (i < pPage->Count() && !aTempOp.operate(&((*pPage)[i]).GetKey(),&rKey)) + i++; + + + ONDXKey* pFoundKey = NULL; + if (!pPage->IsLeaf()) + { + // weiter absteigen + ONDXPagePtr aPage = (i==0) ? pPage->GetChild(m_pIndex) + : ((*pPage)[i-1]).GetChild(m_pIndex, pPage); + pFoundKey = aPage.Is() ? GetFirstKey(aPage.getBodyPtr(), rKey) : NULL; + } + else if (i == pPage->Count()) + { + pFoundKey = NULL; + } + else + { + pFoundKey = &(*pPage)[i].GetKey(); + if (!m_pOperator->operate(pFoundKey,&rKey)) + pFoundKey = NULL; + + m_aCurLeaf = pPage; + m_nCurNode = pFoundKey ? i : i - 1; + } + return pFoundKey; +} + +//------------------------------------------------------------------ +ULONG OIndexIterator::GetCompare(BOOL bFirst) +{ + ONDXKey* pKey = NULL; + // ONDXIndex* m_pIndex = GetNDXIndex(); + OSQLPredicateType ePredicateType = PTR_CAST(file::OOp_COMPARE,m_pOperator)->getPredicateType(); + + if (bFirst) + { + // Vorbereitung , auf kleinstes Element positionieren + ONDXPage* pPage = m_aRoot.getBodyPtr(); + switch (ePredicateType) + { + case SQL_PRED_NOTEQUAL: + case SQL_PRED_LESS: + case SQL_PRED_LESSOREQUAL: + while (pPage && !pPage->IsLeaf()) + pPage = pPage->GetChild(m_pIndex).getBodyPtr(); + + m_aCurLeaf = pPage; + m_nCurNode = NODE_NOTFOUND; + } + + + switch (ePredicateType) + { + case SQL_PRED_NOTEQUAL: + while ((pKey = GetNextKey()) && !m_pOperator->operate(pKey,m_pOperand)); + break; + case SQL_PRED_LESS: + while ((pKey = GetNextKey()) && !pKey->getValue().hasValue()); + break; + case SQL_PRED_LESSOREQUAL: + while (pKey = GetNextKey()); + break; + case SQL_PRED_GREATEROREQUAL: + case SQL_PRED_EQUAL: + pKey = GetFirstKey(m_aRoot.getBodyPtr(),*m_pOperand); + break; + case SQL_PRED_GREATER: + if (!(pKey = GetFirstKey(m_aRoot.getBodyPtr(),*m_pOperand))) + while ((pKey = GetNextKey()) && !m_pOperator->operate(pKey,m_pOperand)); + } + } + else + { + switch (ePredicateType) + { + case SQL_PRED_NOTEQUAL: + while ((pKey = GetNextKey()) && !m_pOperator->operate(pKey,m_pOperand)) + ; + break; + case SQL_PRED_LESS: + case SQL_PRED_LESSOREQUAL: + case SQL_PRED_EQUAL: + if (!(pKey = GetNextKey()) || !m_pOperator->operate(pKey,m_pOperand)) + { + pKey = NULL; + m_aCurLeaf = NULL; + } + break; + case SQL_PRED_GREATEROREQUAL: + case SQL_PRED_GREATER: + pKey = GetNextKey(); + } + } + + return pKey ? pKey->GetRecord() : STRING_NOTFOUND; +} + +//------------------------------------------------------------------ +ULONG OIndexIterator::GetLike(BOOL bFirst) +{ + // ONDXIndex* m_pIndex = GetNDXIndex(); + if (bFirst) + { + ONDXPage* pPage = m_aRoot.getBodyPtr(); + + while (pPage && !pPage->IsLeaf()) + pPage = pPage->GetChild(m_pIndex).getBodyPtr(); + + m_aCurLeaf = pPage; + m_nCurNode = NODE_NOTFOUND; + } + + ONDXKey* pKey; + while ((pKey = GetNextKey()) && !m_pOperator->operate(pKey,m_pOperand)) + ; + return pKey ? pKey->GetRecord() : STRING_NOTFOUND; +} + +//------------------------------------------------------------------ +ULONG OIndexIterator::GetNull(BOOL bFirst) +{ + // ONDXIndex* m_pIndex = GetNDXIndex(); + if (bFirst) + { + ONDXPage* pPage = m_aRoot.getBodyPtr(); + while (pPage && !pPage->IsLeaf()) + pPage = pPage->GetChild(m_pIndex).getBodyPtr(); + + m_aCurLeaf = pPage; + m_nCurNode = NODE_NOTFOUND; + } + + ONDXKey* pKey; + if (!(pKey = GetNextKey()) || pKey->getValue().hasValue()) + { + pKey = NULL; + m_aCurLeaf = NULL; + } + return pKey ? pKey->GetRecord() : STRING_NOTFOUND; +} + +//------------------------------------------------------------------ +ULONG OIndexIterator::GetNotNull(BOOL bFirst) +{ + ONDXKey* pKey; + // ONDXIndex* m_pIndex = GetNDXIndex(); + if (bFirst) + { + // erst alle NULL werte abklappern + for (ULONG nRec = GetNull(bFirst); + nRec != STRING_NOTFOUND; + nRec = GetNull(FALSE)) + ; + pKey = m_aCurLeaf.Is() ? &(*m_aCurLeaf)[m_nCurNode].GetKey() : NULL; + } + else + pKey = GetNextKey(); + + return pKey ? pKey->GetRecord() : STRING_NOTFOUND; +} + +//------------------------------------------------------------------ +ONDXKey* OIndexIterator::GetNextKey() +{ + // ONDXIndex* m_pIndex = GetNDXIndex(); + if (m_aCurLeaf.Is() && ((++m_nCurNode) >= m_aCurLeaf->Count())) + { + ONDXPage* pPage = m_aCurLeaf.getBodyPtr(); + // naechste Seite suchen + while (pPage) + { + ONDXPage* pParentPage = pPage->GetParent().getBodyPtr(); + if (pParentPage) + { + USHORT nPos = pParentPage->Search(pPage); + if (nPos != pParentPage->Count() - 1) + { // Seite gefunden + pPage = (*pParentPage)[nPos+1].GetChild(m_pIndex,pParentPage).getBodyPtr(); + break; + } + } + pPage = pParentPage; + } + + // jetzt wieder zum Blatt + while (pPage && !pPage->IsLeaf()) + pPage = pPage->GetChild(m_pIndex).getBodyPtr(); + + m_aCurLeaf = pPage; + m_nCurNode = 0; + } + return m_aCurLeaf.Is() ? &(*m_aCurLeaf)[m_nCurNode].GetKey() : NULL; +} + diff --git a/connectivity/source/drivers/dbase/DIndexes.cxx b/connectivity/source/drivers/dbase/DIndexes.cxx new file mode 100644 index 000000000000..0ad5cd4127d6 --- /dev/null +++ b/connectivity/source/drivers/dbase/DIndexes.cxx @@ -0,0 +1,172 @@ +/************************************************************************* + * + * $RCSfile: DIndexes.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_DBASE_INDEXES_HXX_ +#include "dbase/DIndexes.hxx" +#endif +//#ifndef _FSYS_HXX //autogen +//#include <tools/fsys.hxx> +//#endif +#ifndef _CONNECTIVITY_DBASE_INDEX_HXX_ +#include "dbase/DIndex.hxx" +#endif + + +using namespace connectivity::dbase; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + +namespace starutil = ::com::sun::star::util; + +Reference< XNamed > ODbaseIndexes::createObject(const ::rtl::OUString& _rName) +{ + // Dir* pDir = m_pTable->getConnection()->getDir(); + // String aPath = pDir->GetName(); + // aPath += _rName.getStr(); + INetURLObject aEntry(m_pTable->getEntry()); + aEntry.setName(_rName); + aEntry.setExtension(String::CreateFromAscii("ndx")); + SvFileStream aFileStream; + aFileStream.Open(aEntry.GetMainURL(), STREAM_READ | STREAM_NOCREATE| STREAM_SHARE_DENYWRITE); + + + // Anlegen des Indexfiles + // aFileStream.Open(aEntry.GetFull(), STREAM_READWRITE | STREAM_NOCREATE| STREAM_SHARE_DENYWRITE); + + aFileStream.SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN); + aFileStream.SetBufferSize(512); + ODbaseIndex::NDXHeader aHeader; + + aFileStream.Seek(0); + aFileStream.Read(&aHeader,512); + + ODbaseIndex* pIndex = new ODbaseIndex(m_pTable,aHeader,_rName); + + Reference< XNamed > xRet = pIndex; + return xRet; +} +// ------------------------------------------------------------------------- +void ODbaseIndexes::impl_refresh( ) throw(RuntimeException) +{ + if(m_pTable) + m_pTable->refreshIndexes(); +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > ODbaseIndexes::createEmptyObject() +{ + ODbaseIndex* pRet = new ODbaseIndex(m_pTable); + Reference< XPropertySet > xRet = pRet; + return xRet; +} +typedef connectivity::sdbcx::OCollection ODbaseTables_BASE_BASE; +// ------------------------------------------------------------------------- +// XAppend +void SAL_CALL ODbaseIndexes::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + + ::rtl::OUString aName = getString(descriptor->getPropertyValue(PROPERTY_NAME)); + ObjectMap::iterator aIter = m_aNameMap.find(aName); + if( aIter != m_aNameMap.end()) + throw ElementExistException(aName,*this); + + Reference<XUnoTunnel> xTunnel(descriptor,UNO_QUERY); + if(xTunnel.is()) + { + ODbaseIndex* pIndex = (ODbaseIndex*)xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()); + if(pIndex && pIndex->CreateImpl()) + ODbaseIndexes_BASE::appendByDescriptor(descriptor); + } +} +// ------------------------------------------------------------------------- +// XDrop +void SAL_CALL ODbaseIndexes::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + + ObjectMap::iterator aIter = m_aNameMap.find(elementName); + if( aIter == m_aNameMap.end()) + throw NoSuchElementException(elementName,*this); + + Reference< XUnoTunnel> xTunnel(aIter->second.get(),UNO_QUERY); + if(xTunnel.is()) + { + ODbaseIndex* pIndex = (ODbaseIndex*)xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()); + if(pIndex && pIndex->DropImpl()) + ODbaseIndexes_BASE::dropByName(elementName); + } + +} +// ------------------------------------------------------------------------- +void SAL_CALL ODbaseIndexes::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + if (index < 0 || index >= getCount()) + throw IndexOutOfBoundsException(); + + dropByName((*m_aElements[index]).first); +} +// ------------------------------------------------------------------------- + + diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx new file mode 100644 index 000000000000..268792404cd6 --- /dev/null +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -0,0 +1,1861 @@ +/************************************************************************* + * + * $RCSfile: DTable.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_TABLE_HXX_ +#include "dbase/DTable.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _COM_SUN_STAR_UCB_XCONTENTACCESS_HPP_ +#include <com/sun/star/ucb/XContentAccess.hpp> +#endif +#ifndef _COM_SUN_STAR_SQLC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _SV_CONVERTER_HXX_ +#include <svtools/converter.hxx> +#endif +#ifndef _CONNECTIVITY_DBASE_DCONNECTION_HXX_ +#include "dbase/DConnection.hxx" +#endif +#ifndef _CONNECTIVITY_DBASE_COLUMNS_HXX_ +#include "dbase/DColumns.hxx" +#endif +#ifndef _OSL_THREAD_H_ +#include <osl/thread.h> +#endif +#ifndef _CONFIG_HXX //autogen +#include <vcl/config.hxx> +#endif +#ifndef _CONNECTIVITY_DBASE_INDEX_HXX_ +#include "dbase/DIndex.hxx" +#endif +#ifndef _CONNECTIVITY_DBASE_INDEXES_HXX_ +#include "dbase/DIndexes.hxx" +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +#ifndef _CONNECTIVITY_DATECONVERSION_HXX_ +#include "DateConversion.hxx" +#endif +#ifndef _INTN_HXX //autogen +#include <tools/intn.hxx> +#endif +#ifndef _ZFORLIST_HXX //autogen +#include <svtools/zforlist.hxx> +#endif +#ifndef _SOLMATH_HXX //autogen wg. SolarMath +#include <tools/solmath.hxx> +#endif +#include <stdio.h> //sprintf +#ifndef _UCBHELPER_CONTENT_HXX +#include <ucbhelper/content.hxx> +#endif +#ifndef _CPPUHELPER_EXTRACT_HXX_ +#include <cppuhelper/extract.hxx> +#endif + +using namespace connectivity; +using namespace connectivity::dbase; +using namespace connectivity::file; +using namespace ucb; +using namespace cppu; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::ucb; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + +// ------------------------------------------------------------------------- +void ODbaseTable::readHeader() +{ + m_aFileStream.RefreshBuffer(); // sicherstellen, dass die Kopfinformationen tatsaechlich neu gelesen werden + m_aFileStream.Seek(STREAM_SEEK_TO_BEGIN); + + BYTE aTyp; + m_aFileStream >> aTyp; + m_aFileStream.Read((char*)m_aHeader.db_aedat, 3*sizeof(BYTE)); + m_aFileStream >> m_aHeader.db_anz; + m_aFileStream >> m_aHeader.db_kopf; + m_aFileStream >> m_aHeader.db_slng; + m_aFileStream.Read((char*)m_aHeader.db_frei, 20*sizeof(BYTE)); + + if (m_aHeader.db_anz < 0 || + m_aHeader.db_kopf <= 0 || + m_aHeader.db_slng <= 0 || + ((m_aHeader.db_kopf - 1) / 32 - 1) <= 0) // anzahl felder + { + // Dies ist keine DBase Datei + } + else + { + // Konsistenzpruefung des Header: + m_aHeader.db_typ = (DBFType)aTyp; + switch (m_aHeader.db_typ) + { + case dBaseIII: + case dBaseIV: + case dBaseV: + case dBaseFS: + case dBaseFSMemo: + case dBaseIVMemoSQL: + case dBaseIIIMemo: + case dBaseIVMemo: + case FoxProMemo: + m_aFileStream.SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN); + break; + default: + { // Dies ist keine DBase Datei + } + } + } +} +// ------------------------------------------------------------------------- +void ODbaseTable::fillColumns() +{ + m_aFileStream.Seek(STREAM_SEEK_TO_BEGIN); + m_aFileStream.Seek(32L); + + // Anzahl Felder: + sal_uInt32 nFieldCount = (m_aHeader.db_kopf - 1) / 32 - 1; + + String aStrFieldName;aStrFieldName.AssignAscii("Column"); + sal_Int32 nFieldCnt = 0; + ::rtl::OUString aTypeName; + + for (sal_uInt32 i = 0; i < nFieldCount; i++) + { + DBFColumn aDBFColumn; + m_aFileStream.Read((char*)&aDBFColumn, sizeof(aDBFColumn)); + + // Info auslesen und in SdbColumn packen: + String aColumnName((const char *)aDBFColumn.db_fnm,osl_getThreadTextEncoding()); + +// while (aOriginalColumns->ColumnNumber(aColumnName) != SDB_COLUMN_NOTFOUND) +// (aColumnName = aStrFieldName) += String::CreateFromsal_Int32(++nFieldCnt); + + sal_Int32 nPrecision = aDBFColumn.db_flng; + sal_Int32 eType; + + switch (aDBFColumn.db_typ) + { + case 'C': + eType = DataType::VARCHAR; + aTypeName = ::rtl::OUString::createFromAscii("VARCHAR"); + break; + case 'F': + case 'N': + eType = DataType::DECIMAL; + aTypeName = ::rtl::OUString::createFromAscii("DECIMAL"); + + // Bei numerischen Feldern werden zwei Zeichen mehr geschrieben, als die Precision der Spaltenbeschreibung eigentlich + // angibt, um Platz fuer das eventuelle Vorzeichen und das Komma zu haben. Das muss ich jetzt aber wieder rausrechnen. + nPrecision = SvDbaseConverter::ConvertPrecisionToOdbc(nPrecision,aDBFColumn.db_dez); + // leider gilt das eben Gesagte nicht fuer aeltere Versionen .... + ; + break; + case 'L': + eType = DataType::BIT; + aTypeName = ::rtl::OUString::createFromAscii("BIT"); + break; + case 'D': + eType = DataType::DATE; + aTypeName = ::rtl::OUString::createFromAscii("DATE"); + break; + case 'M': + eType = DataType::LONGVARCHAR; + aTypeName = ::rtl::OUString::createFromAscii("LONGVARCHAR"); + nPrecision = 0; + break; + default: + aTypeName = ::rtl::OUString::createFromAscii("OTHER"); + eType = DataType::OTHER; + + } + + sal_Int32 nFlags = 0; + switch (aDBFColumn.db_typ) + { + case 'C': + case 'D': + case 'L': nFlags = ColumnSearch::FULL; break; + case 'F': + case 'N': nFlags = ColumnSearch::BASIC; break; + case 'M': nFlags = ColumnSearch::CHAR; break; + default: + nFlags = ColumnSearch::NONE; + + } + sdbcx::OColumn* pColumn = new sdbcx::OColumn(aColumnName,aTypeName,::rtl::OUString(), + ColumnValue::NULLABLE,nPrecision,aDBFColumn.db_dez,eType,sal_False,sal_False,sal_False, + getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); + Reference< XFastPropertySet> xCol = pColumn; + m_aColumns->push_back(xCol); + } +} +// ------------------------------------------------------------------------- +//void ODbaseTable::fillIndexes() +//{ +// Dir* pDir = m_pConnection->getDir(); +// String aPath = pDir->GetName(); +// aPath += _Name.getStr(); +// DirEntry aEntry(aPath); +// aEntry.SetExtension(String::CreateFromAscii("inf")); +// +// Config aInfFile(aEntry.GetFull()); +// aInfFile.SetGroup(dBASE_III_GROUP); +// sal_Int32 nKeyCnt = aInfFile.GetKeyCount(); +// ByteString aKeyName; +// ByteString aIndexName; +// +// for (sal_Int32 nKey = 0,nPos=0; nKey < nKeyCnt; nKey++) +// { +// // Verweist der Key auf ein Indexfile?... +// aKeyName = aInfFile.GetKeyName( nKey ); +// //...wenn ja, Indexliste der Tabelle hinzufuegen +// if (aKeyName.Copy(0,3) == ByteString("NDX") ) +// { +// aIndexName = aInfFile.ReadKey(aKeyName); +// aEntry.SetName(String(aIndexName,osl_getThreadTextEncoding())); +// if (aEntry.Exists()) +// { +// readIndex(aEntry.GetBase()); +// } +// // _rList.Insert(new String(aEntry.GetBase()), nPos++); +// } +// } +//} +// ------------------------------------------------------------------------- +//void ODbaseTable::readIndex(const String& _rName) +//{ +//} +// ------------------------------------------------------------------------- +ODbaseTable::ODbaseTable(ODbaseConnection* _pConnection) : ODbaseTable_BASE(_pConnection) + // , m_aColumns(_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers()) +{ + +} +// ------------------------------------------------------------------------- +ODbaseTable::ODbaseTable(ODbaseConnection* _pConnection, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _Type, + const ::rtl::OUString& _Description , + const ::rtl::OUString& _SchemaName, + const ::rtl::OUString& _CatalogName + ) : ODbaseTable_BASE(_pConnection,_Name, + _Type, + _Description, + _SchemaName, + _CatalogName) + // , m_aColumns(_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers()) +{ + INetURLObject aURL; + aURL.SetSmartProtocol(INET_PROT_FILE); + aURL.SetSmartURL(getEntry(), INetURLObject::ENCODE_ALL); + + if(aURL.getExtension() != m_pConnection->getExtension()) + aURL.setExtension(m_pConnection->getExtension()); + + // Content aContent(aURL.GetMainURL()); + + m_aFileStream.Open(aURL.GetMainURL(), STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE); + if(!m_aFileStream.IsOpen()) + m_aFileStream.Open(aURL.GetMainURL(), STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYNONE ); + + if(m_aFileStream.IsOpen()) + { + readHeader(); + + if (HasMemoFields()) + { + // Memo-Dateinamen bilden (.DBT): + // nyi: Unschoen fuer Unix und Mac! + + if (m_aHeader.db_typ == FoxProMemo) // foxpro verwendet andere extension + aURL.SetExtension(String::CreateFromAscii("fpt")); // nyi: Gross-/Kleinschreibung bei Unix? Klein ist sicherlich schoener. + else + aURL.SetExtension(String::CreateFromAscii("dbt")); // nyi: Gross-/Kleinschreibung bei Unix? Klein ist sicherlich schoener. + + // Wenn die Memodatei nicht gefunden wird, werden die Daten trotzdem angezeigt + // allerdings koennen keine Updates durchgefuehrt werden + // jedoch die Operation wird ausgefuehrt + m_aMemoStream.Open(aURL.GetMainURL(), STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE); + if (m_aMemoStream.IsOpen()) + ReadMemoHeader(); + + // if (aStatus.IsError()) + // { + // String aText = String(SdbResId(STR_STAT_FILE_NOT_FOUND)); + // aText.SearchAndReplace(String::CreateFromAscii("%%d"),aFileEntry.GetName()); + // aText.SearchAndReplace(String::CreateFromAscii("%%t"),aStatus.TypeToString(MEMO)); + // aStatus.Set(SDB_STAT_SUCCESS_WITH_INFO, + // String::CreateFromAscii("01000"), + // aStatus.CreateErrorMessage(aText), + // 0, String() ); + // m_aMemoStream.Close(); + // } + } + // if (aStatus.IsError()) + // FileClose(); + // + fillColumns(); + + m_aFileStream.Seek(STREAM_SEEK_TO_END); + UINT32 nFileSize = m_aFileStream.Tell(); + m_aFileStream.Seek(STREAM_SEEK_TO_BEGIN); + + // Buffersize abhaengig von der Filegroesse + m_aFileStream.SetBufferSize(nFileSize > 1000000 ? 32768 : + nFileSize > 100000 ? 16384 : + nFileSize > 10000 ? 4096 : 1024); + + if (m_aMemoStream.IsOpen()) + { + // Puffer genau auf Laenge eines Satzes stellen + m_aMemoStream.Seek(STREAM_SEEK_TO_END); + nFileSize = m_aMemoStream.Tell(); + m_aMemoStream.Seek(STREAM_SEEK_TO_BEGIN); + + // Buffersize abhaengig von der Filegroesse + m_aMemoStream.SetBufferSize(nFileSize > 1000000 ? 32768 : + nFileSize > 100000 ? 16384 : + nFileSize > 10000 ? 4096 : + m_aMemoHeader.db_size); + } + + AllocBuffer(); + + refreshColumns(); + refreshIndexes(); + } +} +//------------------------------------------------------------------ +BOOL ODbaseTable::ReadMemoHeader() +{ + m_aMemoStream.SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN); + m_aMemoStream.RefreshBuffer(); // sicherstellen das die Kopfinformationen tatsaechlich neu gelesen werden + m_aMemoStream.Seek(0L); + + m_aMemoStream >> m_aMemoHeader.db_next; + switch (m_aHeader.db_typ) + { + case dBaseIIIMemo: // dBase III: feste Blockgröße + case dBaseIVMemo: + // manchmal wird aber auch dBase3 dBase4 Memo zugeordnet + m_aMemoStream.Seek(20L); + m_aMemoStream >> m_aMemoHeader.db_size; + if (m_aMemoHeader.db_size > 1 && m_aMemoHeader.db_size != 512) // 1 steht auch fuer dBase 3 + m_aMemoHeader.db_typ = MemodBaseIV; + else if (m_aMemoHeader.db_size > 1 && m_aMemoHeader.db_size == 512) + { + // nun gibt es noch manche Dateien, die verwenden eine Gößenangabe, + // sind aber dennoch dBase Dateien + char sHeader[4]; + m_aMemoStream.Seek(m_aMemoHeader.db_size); + m_aMemoStream.Read(sHeader,4); + + if ((m_aMemoStream.GetErrorCode() != ERRCODE_NONE) || ((BYTE)sHeader[0]) != 0xFF || ((BYTE)sHeader[1]) != 0xFF || ((BYTE)sHeader[2]) != 0x08) + m_aMemoHeader.db_typ = MemodBaseIII; + else + m_aMemoHeader.db_typ = MemodBaseIV; + } + else + { + m_aMemoHeader.db_typ = MemodBaseIII; + m_aMemoHeader.db_size = 512; + } + break; + case FoxProMemo: + m_aMemoHeader.db_typ = MemoFoxPro; + m_aMemoStream.Seek(6L); + m_aMemoStream.SetNumberFormatInt(NUMBERFORMAT_INT_BIGENDIAN); + m_aMemoStream >> m_aMemoHeader.db_size; + } + return TRUE; +} +// ------------------------------------------------------------------------- +::rtl::OUString ODbaseTable::getEntry() +{ + ::rtl::OUString aURL; + Reference< XResultSet > xDir = m_pConnection->getDir(); + Reference< XRow> xRow(xDir,UNO_QUERY); + while(xDir->next()) + { + if(xRow->getString(1) == m_Name) + { + Reference< XContentAccess > xContentAccess( xDir, UNO_QUERY ); + aURL = xContentAccess->queryContentIdentfierString(); + break; + } + } + xDir->beforeFirst(); // move back to before first record + return aURL; +} +// ------------------------------------------------------------------------- +void ODbaseTable::refreshColumns() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + ::std::vector< ::rtl::OUString> aVector; + + for(OSQLColumns::const_iterator aIter = m_aColumns->begin();aIter != m_aColumns->end();++aIter) + aVector.push_back(Reference< XNamed>(*aIter,UNO_QUERY)->getName()); + + if(m_pColumns) + delete m_pColumns; + m_pColumns = new ODbaseColumns(this,m_aMutex,aVector); +} +// ------------------------------------------------------------------------- +void ODbaseTable::refreshIndexes() +{ +// Dir* pDir = m_pConnection->getDir(); +// String aPath = pDir->GetName(); +// aPath += m_Name.getStr(); + INetURLObject aURL; + aURL.SetSmartProtocol(INET_PROT_FILE); + aURL.SetSmartURL(getEntry(), INetURLObject::ENCODE_ALL); + + aURL.setExtension(String::CreateFromAscii("inf")); + + Config aInfFile(aURL.GetMainURL()); + aInfFile.SetGroup(dBASE_III_GROUP); + sal_Int32 nKeyCnt = aInfFile.GetKeyCount(); + ByteString aKeyName; + ByteString aIndexName; + + ::std::vector< ::rtl::OUString> aVector; + + for (sal_Int32 nKey = 0,nPos=0; nKey < nKeyCnt; nKey++) + { + // Verweist der Key auf ein Indexfile?... + aKeyName = aInfFile.GetKeyName( nKey ); + //...wenn ja, Indexliste der Tabelle hinzufuegen + if (aKeyName.Copy(0,3) == ByteString("NDX") ) + { + aIndexName = aInfFile.ReadKey(aKeyName); + aURL.setName(String(aIndexName,osl_getThreadTextEncoding())); + Content aCnt(aURL.GetMainURL(),Reference<XCommandEnvironment>()); + if (aCnt.isDocument()) + { + aVector.push_back(aURL.getBase()); + } + } + } + if(m_pIndexes) + delete m_pIndexes; + m_pIndexes = new ODbaseIndexes(this,m_aMutex,aVector); +} + +// ------------------------------------------------------------------------- +void SAL_CALL ODbaseTable::disposing(void) +{ + OFileTable::disposing(); + ::osl::MutexGuard aGuard(m_aMutex); + m_aColumns->clear(); +} +// ------------------------------------------------------------------------- +Sequence< Type > SAL_CALL ODbaseTable::getTypes( ) throw(RuntimeException) +{ + Sequence< Type > aTypes = OTable_TYPEDEF::getTypes(); + Sequence< Type > aRet(aTypes.getLength()-3); + const Type* pBegin = aTypes.getConstArray(); + const Type* pEnd = pBegin + aTypes.getLength(); + sal_Int32 i=0; + for(;pBegin != pEnd;++pBegin,++i) + { + if(!(*pBegin == ::getCppuType((const Reference<XKeysSupplier>*)0) || + *pBegin == ::getCppuType((const Reference<XRename>*)0) || + *pBegin == ::getCppuType((const Reference<XAlterTable>*)0) || + *pBegin == ::getCppuType((const Reference<XDataDescriptorFactory>*)0))) + { + aRet.getArray()[i] = *pBegin; + } + } + aRet.getArray()[i] = ::getCppuType( (const Reference< ::com::sun::star::lang::XUnoTunnel > *)0 ); + + return aRet; +} + +// ------------------------------------------------------------------------- +Any SAL_CALL ODbaseTable::queryInterface( const Type & rType ) throw(RuntimeException) +{ + if( rType == ::getCppuType((const Reference<XKeysSupplier>*)0) || + rType == ::getCppuType((const Reference<XRename>*)0) || + rType == ::getCppuType((const Reference<XAlterTable>*)0) || + rType == ::getCppuType((const Reference<XDataDescriptorFactory>*)0)) + return Any(); + + Any aRet = ::cppu::queryInterface(rType,static_cast< ::com::sun::star::lang::XUnoTunnel*> (this)); + if(aRet.hasValue()) + return aRet; + + return OTable_TYPEDEF::queryInterface(rType); +} + +//-------------------------------------------------------------------------- +Sequence< sal_Int8 > ODbaseTable::getUnoTunnelImplementationId() +{ + static ::cppu::OImplementationId * pId = 0; + if (! pId) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + if (! pId) + { + static ::cppu::OImplementationId aId; + pId = &aId; + } + } + return pId->getImplementationId(); +} + +// com::sun::star::lang::XUnoTunnel +//------------------------------------------------------------------ +sal_Int64 ODbaseTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException) +{ + if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + return (sal_Int64)this; + + return ODbaseTable_BASE::getSomething(rId); +} +//------------------------------------------------------------------ +sal_Bool ODbaseTable::seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) +{ + // ---------------------------------------------------------- + // Positionierung vorbereiten: + + sal_uInt32 nNumberOfRecords = (sal_uInt32)m_aHeader.db_anz; + sal_uInt32 nTempPos = m_nFilePos; + m_nFilePos = nCurPos; + + switch(eCursorPosition) + { + case FILE_NEXT: + m_nFilePos++; + break; + case FILE_PRIOR: + if (m_nFilePos > 0) + m_nFilePos--; + break; + case FILE_FIRST: + m_nFilePos = 1; + break; + case FILE_LAST: + m_nFilePos = nNumberOfRecords; + break; + case FILE_RELATIVE: + m_nFilePos = (((sal_Int32)m_nFilePos) + nOffset < 0) ? 0L + : (sal_uInt32)(((sal_Int32)m_nFilePos) + nOffset); + break; + case FILE_ABSOLUTE: + case FILE_BOOKMARK: + m_nFilePos = (sal_uInt32)nOffset; + break; + } + + if (m_nFilePos > (sal_Int32)nNumberOfRecords) + m_nFilePos = (sal_Int32)nNumberOfRecords + 1; + + if (m_nFilePos == 0 || m_nFilePos == (sal_Int32)nNumberOfRecords + 1) + goto Error; + else + { + sal_uInt16 nEntryLen = m_aHeader.db_slng; + + OSL_ENSHURE(m_nFilePos >= 1,"SdbDBFCursor::FileFetchRow: ungueltige Record-Position"); + sal_Int32 nPos = m_aHeader.db_kopf + (sal_Int32)(m_nFilePos-1) * nEntryLen; + + m_aFileStream.Seek(nPos); +// if (aStatus.SetError(m_aFileStream) +// goto Error; + + m_aFileStream.Read((char*)m_pBuffer, nEntryLen); +// if (aStatus.SetError(m_aFileStream) +// goto Error; + } + goto End; + +Error: + switch(eCursorPosition) + { + case FILE_PRIOR: + case FILE_FIRST: + m_nFilePos = 0; + break; + case FILE_LAST: + case FILE_NEXT: + case FILE_ABSOLUTE: + case FILE_RELATIVE: + if (nOffset > 0) + m_nFilePos = nNumberOfRecords + 1; + else if (nOffset < 0) + m_nFilePos = 0; + break; + case FILE_BOOKMARK: + m_nFilePos = nTempPos; // vorherige Position + } + // aStatus.Set(SDB_STAT_NO_DATA_FOUND); + return sal_False; + +End: + nCurPos = m_nFilePos; + return sal_True; +} +//------------------------------------------------------------------ +sal_Bool ODbaseTable::fetchRow(file::OValueRow _rRow,const OSQLColumns & _rCols, sal_Bool bRetrieveData) +{ + // Einlesen der Daten + BOOL bIsCurRecordDeleted = ((char)m_pBuffer[0] == '*') ? TRUE : FALSE; + + // only read the bookmark + + // Satz als geloescht markieren + // rRow.setState(bIsCurRecordDeleted ? ROW_DELETED : ROW_CLEAN ); + _rRow->setDeleted(bIsCurRecordDeleted); + (*_rRow)[0] = m_nFilePos; + + if (!bRetrieveData) + return TRUE; + + sal_Int32 nByteOffset = 1; + // Felder: + OSQLColumns::const_iterator aIter = _rCols.begin(); + for (sal_Int32 i = 1; aIter != _rCols.end();++aIter, i++) + { + // pVal = (*_rRow)[i].getBodyPtr(); + Reference< XFastPropertySet> xColumn = *aIter; + + // Laengen je nach Datentyp: + // nyi: eine zentrale Funktion, die die Laenge liefert! + sal_Int32 nLen; + xColumn->getFastPropertyValue(PROPERTY_ID_PRECISION) >>= nLen; + sal_Int32 nType = getINT32(xColumn->getFastPropertyValue(PROPERTY_ID_TYPE)); + switch(nType) + { + case DataType::DATE: nLen = 8; break; + case DataType::DECIMAL: + nLen = SvDbaseConverter::ConvertPrecisionToDbase(nLen,getINT32(xColumn->getFastPropertyValue(PROPERTY_ID_SCALE))); + break; // das Vorzeichen und das Komma + case DataType::BIT: nLen = 1; break; + case DataType::LONGVARCHAR: nLen = 10; break; + case DataType::OTHER: + nByteOffset += nLen; + continue; + default: break; + } + + // Ist die Variable ueberhaupt gebunden? + if (!(*_rRow)[i].isBound()) + { + // Nein - naechstes Feld. + nByteOffset += nLen; + continue; + } + + char *pData = (char *) (m_pBuffer + nByteOffset); + + (*_rRow)[i].setType(nType); + + if (nType == DataType::CHAR || nType == DataType::VARCHAR) + { + char cLast = pData[nLen]; + pData[nLen] = 0; + String aStr(pData,osl_getThreadTextEncoding()); + aStr.EraseTrailingChars(); + + if (!aStr.Len()) // keine StringLaenge, dann NULL + (*_rRow)[i].setNull(); + else + { + ::rtl::OUString aStr2(aStr); + (*_rRow)[i] = aStr2; + } + pData[nLen] = cLast; + } + else + { + // Falls Nul-Zeichen im String enthalten sind, in Blanks umwandeln! + for (sal_Int32 k = 0; k < nLen; k++) + { + if (pData[k] == '\0') + pData[k] = ' '; + } + + String aStr(pData, nLen); // Spaces am Anfang und am Ende entfernen: + aStr.EraseLeadingChars(); + aStr.EraseTrailingChars(); + + if (!aStr.Len()) + { + nByteOffset += nLen; + (*_rRow)[i].setNull(); // keine Werte -> fertig + continue; + } + + switch (nType) + { + case DataType::DATE: + { + if (aStr.Len() != nLen) + { + (*_rRow)[i].setNull(); + break; + } + sal_Int32 nYear = aStr.Copy( 0, 4 ).ToInt32(); + sal_Int32 nMonth = aStr.Copy( 4, 2 ).ToInt32(); + sal_Int32 nDay = aStr.Copy( 6, 2 ).ToInt32(); + + ::com::sun::star::util::Date aDate(nDay,nMonth,nYear); + (*_rRow)[i] = DateConversion::toDouble(aDate); + } + break; + case DataType::DECIMAL: + (*_rRow)[i] = aStr.ToDouble(); + // pVal->setDouble(SdbTools::ToDouble(aStr)); + break; + case DataType::BIT: + { + BOOL b; + switch (* ((const char *)pData)) + { + case 'T': + case 'Y': + case 'J': b = TRUE; break; + default: b = FALSE; break; + } + (*_rRow)[i] = b; + // pVal->setDouble(b); + } + break; + case DataType::LONGVARCHAR: + { + long nBlockNo = aStr.ToInt32(); // Blocknummer lesen + if (nBlockNo > 0 && m_aMemoStream.IsOpen()) // Daten aus Memo-Datei lesen, nur wenn + { + if (!ReadMemo(nBlockNo, (*_rRow)[i])) + break; + } + else + (*_rRow)[i].setNull(); + } break; + default: + OSL_ASSERT("Falscher Type"); + } + } + +// if (aStatus.IsError()) +// break; + // Und weiter ... + nByteOffset += nLen; + } + return sal_True; +} +//------------------------------------------------------------------ +BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, OFileValue& aVariable) +{ + BOOL bIsText = TRUE; + // SdbConnection* pConnection = GetConnection(); + + m_aMemoStream.Seek(nBlockNo * m_aMemoHeader.db_size); + switch (m_aMemoHeader.db_typ) + { + case MemodBaseIII: // dBase III-Memofeld, endet mit Ctrl-Z + { + const char cEOF = (char) 0x1a; + ByteString aStr; + static char aBuf[514]; + aBuf[512] = 0; // sonst kann der Zufall uebel mitspielen + BOOL bReady = FALSE; + + do + { + m_aMemoStream.Read(&aBuf,512); + + USHORT i = 0; + while (aBuf[i] != cEOF && ++i < 512) + ; + bReady = aBuf[i] == cEOF; + + aBuf[i] = 0; + aStr += aBuf; + + } while (!bReady && !m_aMemoStream.IsEof() && aStr.Len() < STRING_MAXLEN); + + aVariable = ::rtl::OUString(aStr.GetBuffer(), aStr.Len(),osl_getThreadTextEncoding()); + } break; + case MemoFoxPro: + case MemodBaseIV: // dBase IV-Memofeld mit Laengenangabe + { + char sHeader[4]; + m_aMemoStream.Read(sHeader,4); + // Foxpro stores text and binary data + if (m_aMemoHeader.db_typ == MemoFoxPro) + { + if (((BYTE)sHeader[0]) != 0 || ((BYTE)sHeader[1]) != 0 || ((BYTE)sHeader[2]) != 0) + { +// String aText = String(SdbResId(STR_STAT_FILE_INVALID)); +// aText.SearchAndReplace(String::CreateFromAscii("%%d"),m_aMemoStream.GetFileName()); +// aText.SearchAndReplace(String::CreateFromAscii("%%t"),aStatus.TypeToString(MEMO)); +// aStatus.Set(SDB_STAT_ERROR, +// String::CreateFromAscii("01000"), +// aStatus.CreateErrorMessage(aText), +// 0, String() ); + return FALSE; + } + + bIsText = sHeader[3] != 0; + } + else if (((BYTE)sHeader[0]) != 0xFF || ((BYTE)sHeader[1]) != 0xFF || ((BYTE)sHeader[2]) != 0x08) + { +// String aText = String(SdbResId(STR_STAT_FILE_INVALID)); +// aText.SearchAndReplace(String::CreateFromAscii("%%d"),m_aMemoStream.GetFileName()); +// aText.SearchAndReplace(String::CreateFromAscii("%%t"),aStatus.TypeToString(MEMO)); +// aStatus.Set(SDB_STAT_ERROR, +// String::CreateFromAscii("01000"), +// aStatus.CreateErrorMessage(aText), +// 0, String() ); + return FALSE; + } + + ULONG nLength; + m_aMemoStream >> nLength; + + if (m_aMemoHeader.db_typ == MemodBaseIV) + nLength -= 8; + + // char cChar; + if (nLength < STRING_MAXLEN && bIsText) + { + ByteString aStr; + aStr.Expand(USHORT (nLength)); + m_aMemoStream.Read(aStr.AllocBuffer((USHORT)nLength),nLength); + aStr.ReleaseBufferAccess(); + aVariable = ::rtl::OUString(aStr.GetBuffer(),aStr.Len(), osl_getThreadTextEncoding()); + } + else + { +// ::Sequence<sal_Int8> aText(nLength); +// sal_Int8* pData = aText.getArray(); +// for (ULONG i = 0; i < nLength; i++) +// { +// m_aMemoStream.Read(&cChar,1); +// (*pData++) = cChar; +// } +// aVariable.setBytes(aText); + return sal_False; + } + } + } + return sal_True; +} +// ------------------------------------------------------------------------- +void ODbaseTable::FileClose() +{ + // falls noch nicht alles geschrieben wurde + if (m_aMemoStream.IsOpen() && m_aMemoStream.IsWritable()) + m_aMemoStream.Flush(); + + m_aMemoStream.Close(); + + if (m_aFileStream.IsOpen() && m_aFileStream.IsWritable()) + m_aFileStream.Flush(); + + m_aFileStream.Close(); + + if (m_pBuffer != NULL) + { + delete m_pBuffer; + m_pBuffer = NULL; + } +} +// ------------------------------------------------------------------------- +BOOL ODbaseTable::CreateImpl() +{ + OSL_ENSHURE(!m_aFileStream.IsOpen(), "SequenceError"); + + INetURLObject aURL; + aURL.SetSmartProtocol(INET_PROT_FILE); + aURL.SetSmartURL(getEntry(), INetURLObject::ENCODE_ALL); + + if(aURL.getExtension() != m_pConnection->getExtension()) + aURL.setExtension(m_pConnection->getExtension()); + + Content aContent(aURL.GetMainURL(),Reference<XCommandEnvironment>()); + + if (aContent.isDocument()) + { + // Hack fuer Bug #30609 , nur wenn das File existiert und die Laenge > 0 gibt es einen Fehler + SvFileStream m_aFileStream; + m_aFileStream.Open(aURL.GetMainURL(),STREAM_STD_READ); + + if (m_aFileStream.IsOpen() && m_aFileStream.Seek(STREAM_SEEK_TO_END)) + { + // aStatus.SetError(ERRCODE_IO_ALREADYEXISTS,TABLE,aFile.GetFull()); + return FALSE; + } + m_aFileStream.Close(); + } + + BOOL bMemoFile = FALSE; + + sal_Bool bOk = CreateFile(aURL, bMemoFile); + + FileClose(); + + if (!bOk) + { + aContent.executeCommand( rtl::OUString::createFromAscii( "delete" ),bool2any( sal_True ) ); + return FALSE; + } + + if (bMemoFile) + { + String aExt = aURL.getExtension(); + aURL.setExtension(String::CreateFromAscii("dbt")); // extension for memo file + Content aMemo1Content(aURL.GetMainURL(),Reference<XCommandEnvironment>()); + + if (aMemo1Content.isDocument()) + { + // aStatus.SetError(ERRCODE_IO_ALREADYEXISTS,MEMO,aFile.GetFull()); + aURL.setExtension(aExt); // kill dbf file + Content aMemoContent(aURL.GetMainURL(),Reference<XCommandEnvironment>()); + aMemoContent.executeCommand( rtl::OUString::createFromAscii( "delete" ),bool2any( sal_True ) ); + return FALSE; + } + if (!CreateMemoFile(aURL)) + { + aURL.setExtension(aExt); // kill dbf file + Content aMemoContent(aURL.GetMainURL(),Reference<XCommandEnvironment>()); + aMemoContent.executeCommand( rtl::OUString::createFromAscii( "delete" ),bool2any( sal_True ) ); + return FALSE; + } + m_aHeader.db_typ = dBaseIIIMemo; + } + else + m_aHeader.db_typ = dBaseIII; + +// if (GetDBFConnection()->GetShowDeleted()) +// nPrivileges = SDB_PR_READ | SDB_PR_INSERT | SDB_PR_UPDATE | +// SDB_PR_ALTER | SDB_PR_DROP; +// else + // nPrivileges = SDB_PR_READ | SDB_PR_INSERT | SDB_PR_UPDATE | + // SDB_PR_DELETE | SDB_PR_ALTER | SDB_PR_DROP; + + return TRUE; +} + +//------------------------------------------------------------------ +// erzeugt grundsätzlich dBase IV Datei Format +BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) +{ + bCreateMemo = FALSE; + Date aDate; // aktuelles Datum + + m_aFileStream.Open(aFile.GetMainURL(), STREAM_READWRITE | STREAM_SHARE_DENYWRITE | STREAM_TRUNC); + if (!m_aFileStream.IsOpen()) + return FALSE; + + char aBuffer[21]; // write buffer + memset(aBuffer,0,sizeof(aBuffer)); + + m_aFileStream.Seek(0L); + m_aFileStream << (BYTE) dBaseIII; // dBase format + m_aFileStream << (BYTE) (aDate.GetYear() % 100); // aktuelles Datum + + + m_aFileStream << (BYTE) aDate.GetMonth(); + m_aFileStream << (BYTE) aDate.GetDay(); + m_aFileStream << 0L; // Anzahl der Datensätze + m_aFileStream << (USHORT)(m_pColumns->getCount() * 32 + 1); // Kopfinformationen, + // pColumns erhält immer eine Spalte mehr + m_aFileStream << (USHORT) 0; // Satzlänge wird später bestimmt + m_aFileStream.Write(aBuffer, 20); + + USHORT nRecLength = 1; // Länge 1 für deleted flag + ULONG nMaxFieldLength = m_pConnection->getMetaData()->getMaxColumnNameLength(); + Reference<XIndexAccess> xColumns(getColumns(),UNO_QUERY); + + ::rtl::OUString aName; + Reference<XFastPropertySet> xCol; + for(sal_Int32 i=0;i<xColumns->getCount();++i) + { + xColumns->getByIndex(i) >>= xCol; + OSL_ENSHURE(xCol.is(),"This should be a column!"); + + char cTyp; + + xCol->getFastPropertyValue(PROPERTY_ID_NAME) >>= aName; + + if (aName.getLength() > nMaxFieldLength) + { +// String aText = String(SdbResId(STR_DBF_INVALIDFIELDNAMELENGTH)); +// aText.SearchAndReplace(String::CreateFromAscii("#"),rColumn.GetName()); +// aStatus.Set(SDB_STAT_ERROR, +// String::CreateFromAscii("01000"), +// aStatus.CreateErrorMessage(aText), +// 0, String() ); + break; + } + + ByteString aCol(aName.getStr(),gsl_getSystemTextEncoding()); + m_aFileStream << aCol.GetBuffer(); + m_aFileStream.Write(aBuffer, 11 - aCol.Len()); + + switch (getINT32(xCol->getFastPropertyValue(PROPERTY_ID_TYPE))) + { + case DataType::CHAR: + case DataType::VARCHAR: + cTyp = 'C'; + break; + case DataType::TINYINT: + case DataType::SMALLINT: + case DataType::INTEGER: + case DataType::BIGINT: + case DataType::DECIMAL: + case DataType::NUMERIC: + case DataType::REAL: + case DataType::DOUBLE: + cTyp = 'N'; // nur dBase 3 format + break; + case DataType::DATE: + cTyp = 'D'; + break; + case DataType::BIT: + cTyp = 'L'; + break; + case DataType::LONGVARBINARY: + case DataType::LONGVARCHAR: + cTyp = 'M'; + break; + default: + { +// aStatus.Set(SDB_STAT_ERROR, +// String::CreateFromAscii("01000"), +// aStatus.CreateErrorMessage(String(SdbResId(STR_DBF_INVALIDFORMAT))), +// 0, String() ); + break; + } + } + + m_aFileStream << cTyp; + m_aFileStream.Write(aBuffer, 4); + + sal_Int32 nPrecision = 0; + xCol->getFastPropertyValue(PROPERTY_ID_PRECISION) >>= nPrecision; + sal_Int32 nScale = 0; + xCol->getFastPropertyValue(PROPERTY_ID_SCALE) >>= nScale; + + switch(cTyp) + { + case 'C': + OSL_ENSHURE(nPrecision < 255, "ODbaseTable::Create: Column zu lang!"); + if (nPrecision > 254) + { +// String aText = String(SdbResId(STR_DBF_INVALIDFIELDLENGTH)); +// aText.SearchAndReplace(String::CreateFromAscii("#"),rColumn.GetName()); +// aStatus.Set(SDB_STAT_ERROR, +// String::CreateFromAscii("01000"), +// aStatus.CreateErrorMessage(aText), +// 0, String() ); + // break; + } + m_aFileStream << (BYTE) min(nPrecision, 255UL); //Feldlänge + nRecLength += (USHORT)min(nPrecision, 255UL); + m_aFileStream << (BYTE)0; //Nachkommastellen + break; + case 'F': + case 'N': + OSL_ENSHURE(nPrecision >= nScale, + "ODbaseTable::Create: Feldlänge muß größer Nachkommastellen sein!"); + if (nPrecision < nScale) + { +// aStatus.Set(SDB_STAT_ERROR, +// String::CreateFromAscii("01000"), +// aStatus.CreateErrorMessage(String(SdbResId(STR_DBF_INVALIDFORMAT))), +// 0, String() ); + break; + } + if (getBOOL(xCol->getFastPropertyValue(PROPERTY_ID_ISCURRENCY))) // Currency wird gesondert behandelt + { + m_aFileStream << (BYTE)10; // Standard Laenge + m_aFileStream << (BYTE)4; + nRecLength += 10; + } + else + { + UINT16 nPrec = SvDbaseConverter::ConvertPrecisionToDbase(nPrecision,nScale); + + m_aFileStream << (BYTE)( nPrec); + m_aFileStream << (BYTE)nScale; + nRecLength += (USHORT)nPrec; + } + break; + case 'L': + m_aFileStream << (BYTE)1; + m_aFileStream << (BYTE)0; + nRecLength++; + break; + case 'D': + m_aFileStream << (BYTE)8; + m_aFileStream << (BYTE)0; + nRecLength += 8; + break; + case 'M': + bCreateMemo = TRUE; + m_aFileStream << (BYTE)10; + m_aFileStream << (BYTE)0; + nRecLength += 10; + break; + default: +// aStatus.Set(SDB_STAT_ERROR, +// String::CreateFromAscii("01000"), +// aStatus.CreateErrorMessage(String(SdbResId(STR_DBF_INVALIDFORMAT))), +// 0, String() ); + break; + } + m_aFileStream.Write(aBuffer, 14); + } + +// if (aStatus.IsError()) +// return FALSE; + + m_aFileStream << (BYTE)0x0d; // kopf ende + m_aFileStream.Seek(10L); + m_aFileStream << nRecLength; // satzlänge nachträglich eintragen + + if (bCreateMemo) + { + m_aFileStream.Seek(0L); + m_aFileStream << (BYTE) dBaseIIIMemo; + } + return TRUE; +} + +//------------------------------------------------------------------ +// erzeugt grundsätzlich dBase III Datei Format +BOOL ODbaseTable::CreateMemoFile(const INetURLObject& aFile) +{ + // Makro zum Filehandling fürs Erzeugen von Tabellen + m_aMemoStream.Open(aFile.GetMainURL(), STREAM_READWRITE | STREAM_SHARE_DENYWRITE); + if (!m_aMemoStream.IsOpen()) + return FALSE; + + char aBuffer[512]; // write buffer + memset(aBuffer,0,sizeof(aBuffer)); + +#ifdef WIN + m_aMemoStream.Seek(0L); + for (UINT16 i = 0; i < 512; i++) + { + m_aMemoStream << BYTE(0); + } +#else + m_aMemoStream.SetFiller('\0'); + m_aMemoStream.SetStreamSize(512); +#endif + + m_aMemoStream.Seek(0L); + m_aMemoStream << long(1); // Zeiger auf ersten freien Block + + m_aMemoStream.Close(); + return TRUE; +} +//------------------------------------------------------------------ +BOOL ODbaseTable::DropImpl() +{ +// NAMESPACE_VOS(OGuard) aGuard(m_pLock); +// +// if (InUse()) +// { +// aStatus.SetError(ERRCODE_IO_LOCKVIOLATION,TABLE,aName); +// return FALSE; +// } + + FileClose(); + + INetURLObject aURL; + aURL.SetSmartProtocol(INET_PROT_FILE); + aURL.SetSmartURL(getEntry(), INetURLObject::ENCODE_ALL); + + Content aContent(aURL.GetMainURL(),Reference<XCommandEnvironment>()); + aContent.executeCommand( rtl::OUString::createFromAscii( "delete" ), + makeAny( sal_Bool( sal_True ) ) ); + + if (HasMemoFields()) + { + aURL.setExtension(String::CreateFromAscii("dbt")); + Content aMemoContent(aURL.GetMainURL(),Reference<XCommandEnvironment>()); + aMemoContent.executeCommand( rtl::OUString::createFromAscii( "delete" ),bool2any( sal_True ) ); + } + + // jetzt noch die Indices loeschen + String aIndexName; + // aFile.SetExtension(String::CreateFromAscii("ndx")); + USHORT nCount = m_pIndexes->getCount(), + i = 0; + while (i < nCount) + { + m_pIndexes->dropByIndex(i); + } + // aFile.SetBase(m_Name); + aURL.setExtension(String::CreateFromAscii("inf")); + Content aInfContent(aURL.GetMainURL(),Reference<XCommandEnvironment>()); + aInfContent.executeCommand( rtl::OUString::createFromAscii( "delete" ),bool2any( sal_True ) ); + return TRUE; +} +//------------------------------------------------------------------ +BOOL ODbaseTable::InsertRow(ORefAssignValues& rRow, BOOL bFlush,const Reference<XIndexAccess>& _xCols) +{ + // Buffer mit Leerzeichen füllen + AllocBuffer(); + memset(m_pBuffer, ' ', m_aHeader.db_slng); + + // Gesamte neue Row uebernehmen: + // ... und am Ende als neuen Record hinzufuegen: + UINT32 nTempPos = m_nFilePos, + nFileSize, + nMemoFileSize; + + m_nFilePos = (ULONG)m_aHeader.db_anz + 1; + if (!UpdateBuffer(rRow.getBody(),NULL,_xCols)) + { + m_nFilePos = nTempPos; + return FALSE; + } + + String aName = m_aFileStream.GetFileName(); + + m_aFileStream.Seek(STREAM_SEEK_TO_END); + nFileSize = m_aFileStream.Tell(); + + if (HasMemoFields() && m_aMemoStream.IsOpen()) + { + m_aMemoStream.Seek(STREAM_SEEK_TO_END); + nMemoFileSize = m_aMemoStream.Tell(); + } + + if (!WriteBuffer()) + { + m_aFileStream.SetStreamSize(nFileSize); // alte Größe restaurieren + + if (HasMemoFields() && m_aMemoStream.IsOpen()) + m_aMemoStream.SetStreamSize(nMemoFileSize); // alte Größe restaurieren + m_nFilePos = nTempPos; // Fileposition restaurieren + } + else + { + // Anzahl Datensaetze im Header erhoehen: + m_aFileStream.Seek( 4L ); + m_aFileStream << (m_aHeader.db_anz + 1); + + // beim AppendOnly kein Flush! + if (bFlush) + m_aFileStream.Flush(); + + // bei Erfolg # erhöhen + m_aHeader.db_anz++; + (*rRow)[0] = m_nFilePos; // BOOKmark setzen + m_nFilePos = nTempPos; + } + + return sal_True;; +} + +//------------------------------------------------------------------ +BOOL ODbaseTable::UpdateRow(file::OValueVector& rRow, OValueRow pOrgRow,const Reference<XIndexAccess>& _xCols) +{ + // Buffer mit Leerzeichen füllen + AllocBuffer(); + + // Auf gewuenschten Record positionieren: + long nPos = m_aHeader.db_kopf + (long)(m_nFilePos-1) * m_aHeader.db_slng; + m_aFileStream.Seek(nPos); + m_aFileStream.Read((char*)m_pBuffer, m_aHeader.db_slng); + + UINT32 nMemoFileSize; + if (HasMemoFields() && m_aMemoStream.IsOpen()) + { + m_aMemoStream.Seek(STREAM_SEEK_TO_END); + nMemoFileSize = m_aMemoStream.Tell(); + } + if (!UpdateBuffer(rRow, pOrgRow,_xCols) || !WriteBuffer()) + { + if (HasMemoFields() && m_aMemoStream.IsOpen()) + m_aMemoStream.SetStreamSize(nMemoFileSize); // alte Größe restaurieren + } + else + { + m_aFileStream.Flush(); + } + return sal_True; +} + +//------------------------------------------------------------------ +BOOL ODbaseTable::DeleteRow(const OSQLColumns& _rCols) +{ + // Einfach das Loesch-Flag setzen (egal, ob es schon gesetzt war + // oder nicht): + // Auf gewuenschten Record positionieren: + long nPos = m_aHeader.db_kopf + (long)(m_nFilePos-1) * m_aHeader.db_slng; + m_aFileStream.Seek(nPos); + + OValueRow aRow = new OValueVector(_rCols.size()); + + if (!fetchRow(aRow,_rCols,TRUE)) + return FALSE; + + Reference<XFastPropertySet> xCol; + ::rtl::OUString aColName; + ::utl::UStringMixEqual aCase(isCaseSensitive()); + for (USHORT i = 0; i < m_pColumns->getCount(); i++) + { + m_pColumns->getByIndex(i) >>= xCol; + // const SdbFILEColumn *pColumn = (const SdbFILEColumn *)(*aOriginalColumns)[i]; + + xCol->getFastPropertyValue(PROPERTY_ID_NAME) >>= aColName; + Reference<XFastPropertySet> xIndex = isUniqueByColumnName(aColName); + if (xIndex.is()) + { + Reference<XUnoTunnel> xTunnel(xIndex,UNO_QUERY); + OSL_ENSHURE(xTunnel.is(),"No TunnelImplementation!"); + ODbaseIndex* pIndex = (ODbaseIndex*)xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()); + OSL_ENSHURE(pIndex,"ODbaseTable::UpdateBuffer: No Index returned!"); + + OSQLColumns::const_iterator aIter = _rCols.begin(); + // sal_Int32 nPos = 0; + for(;aIter != _rCols.end();++aIter,++nPos) + { +// Reference<XFastPropertySet> xFindCol; +// _xCols->getByIndex(nPos) >>= xFindCol; + if(aCase(getString((*aIter)->getFastPropertyValue(PROPERTY_ID_REALNAME)),aColName)) + break; + } + if (aIter == _rCols.end()) + continue; + + pIndex->Delete(m_nFilePos,(*aRow)[nPos]); + } + } + + m_aFileStream.Seek(nPos); + m_aFileStream << (BYTE)'*'; + m_aFileStream.Flush(); + return sal_True;; +} + +//------------------------------------------------------------------ +BOOL ODbaseTable::WriteMemo(OFileValue& aVariable, ULONG& rBlockNr) +{ + // wird die BlockNr 0 vorgegeben, wird der block ans Ende gehaengt + char cChar = 0; + BOOL bIsText = TRUE; + // SdbConnection* pConnection = GetConnection(); + + ULONG nSize = 0; + ULONG nStreamSize; + BYTE nHeader[4]; + + ByteString aStr; + // ::Sequence<sal_Int8>* pData = NULL; +// if (aVariable.getValueType() == ::getCppuType((const ::com::sun::star::uno::Sequence< sal_Int8 > *)0)) +// { +// pData = (::Sequence<sal_Int8>*)aVariable.get(); +// nSize = pData->getLength(); +// } +// else +// { + aStr = ByteString(aVariable.getString().getStr(), osl_getThreadTextEncoding()); + nSize = aStr.Len(); + // } + + // Anhaengen oder ueberschreiben + BOOL bAppend = rBlockNr == 0; + + if (!bAppend) + { + switch (m_aMemoHeader.db_typ) + { + case MemodBaseIII: // dBase III-Memofeld, endet mit 2 * Ctrl-Z + bAppend = nSize > (512 - 2); + break; + case MemoFoxPro: + case MemodBaseIV: // dBase IV-Memofeld mit Laengenangabe + { + char sHeader[4]; + m_aMemoStream.Seek(rBlockNr * m_aMemoHeader.db_size); + m_aMemoStream.SeekRel(4L); + m_aMemoStream.Read(sHeader,4); + + ULONG nOldSize; + if (m_aMemoHeader.db_typ == MemoFoxPro) + nOldSize = ((((unsigned char)sHeader[0]) * 256 + + (unsigned char)sHeader[1]) * 256 + + (unsigned char)sHeader[2]) * 256 + + (unsigned char)sHeader[3]; + else + nOldSize = ((((unsigned char)sHeader[3]) * 256 + + (unsigned char)sHeader[2]) * 256 + + (unsigned char)sHeader[1]) * 256 + + (unsigned char)sHeader[0] - 8; + + // passt die neue Laenge in die belegten Bloecke + ULONG nUsedBlocks = ((nSize + 8) / m_aMemoHeader.db_size) + (((nSize + 8) % m_aMemoHeader.db_size > 0) ? 1 : 0), + nOldUsedBlocks = ((nOldSize + 8) / m_aMemoHeader.db_size) + (((nOldSize + 8) % m_aMemoHeader.db_size > 0) ? 1 : 0); + bAppend = nUsedBlocks > nOldUsedBlocks; + } + } + } + + if (bAppend) + { + ULONG nStreamSize; + nStreamSize = m_aMemoStream.Seek(STREAM_SEEK_TO_END); + // letzten block auffuellen + rBlockNr = (nStreamSize / m_aMemoHeader.db_size) + ((nStreamSize % m_aMemoHeader.db_size) > 0 ? 1 : 0); + + m_aMemoStream.SetStreamSize(rBlockNr * m_aMemoHeader.db_size); + m_aMemoStream.Seek(STREAM_SEEK_TO_END); + } + else + { + m_aMemoStream.Seek(rBlockNr * m_aMemoHeader.db_size); + } + + switch (m_aMemoHeader.db_typ) + { + case MemodBaseIII: // dBase III-Memofeld, endet mit Ctrl-Z + { + const char cEOF = (char) 0x1a; + nSize++; + +// if (pData) +// { +// m_aMemoStream.Write((const char*) pData->getConstArray(), pData->getLength()); +// } +// else +// { + m_aMemoStream.Write(aStr.GetBuffer(), aStr.Len()); + // } + + m_aMemoStream << cEOF << cEOF; + } break; + case MemoFoxPro: + case MemodBaseIV: // dBase IV-Memofeld mit Laengenangabe + { + m_aMemoStream << (BYTE)0xFF + << (BYTE)0xFF + << (BYTE)0x08; + + UINT32 nWriteSize = nSize; + if (m_aMemoHeader.db_typ == MemoFoxPro) + { + m_aMemoStream << (BYTE) 0x01; // ((pData = NULL) ? 0x01 : 0x00); + for (int i = 4; i > 0; nWriteSize >>= 8) + nHeader[--i] = (BYTE) (nWriteSize % 256); + } + else + { + m_aMemoStream << (BYTE) 0x00; + nWriteSize += 8; + for (int i = 0; i < 4; nWriteSize >>= 8) + nHeader[i++] = (BYTE) (nWriteSize % 256); + } + + m_aMemoStream.Write(nHeader,4); +// if (pData) +// { +// m_aMemoStream.Write((const char*) pData->getConstArray(), pData->getLength()); +// } +// else +// { + m_aMemoStream.Write(aStr.GetBuffer(), aStr.Len()); + // } + m_aMemoStream.Flush(); + } + } + + + // Schreiben der neuen Blocknummer + if (bAppend) + { + nStreamSize = m_aMemoStream.Seek(STREAM_SEEK_TO_END); + m_aMemoHeader.db_next = (nStreamSize / m_aMemoHeader.db_size) + ((nStreamSize % m_aMemoHeader.db_size) > 0 ? 1 : 0); + + // Schreiben der neuen Blocknummer + m_aMemoStream.Seek(0L); + m_aMemoStream << m_aMemoHeader.db_next; + m_aMemoStream.Flush(); + } + return sal_True; +} +//------------------------------------------------------------------ +void ODbaseTable::AllocBuffer() +{ + UINT16 nSize = m_aHeader.db_slng; + OSL_ENSHURE(nSize > 0, "Size too small"); + + if (m_nBufferSize != nSize) + { + delete m_pBuffer; + m_pBuffer = NULL; + } + + // Falls noch kein Puffer vorhanden: allozieren: + if (m_pBuffer == NULL && nSize) + { + m_nBufferSize = nSize; + m_pBuffer = new BYTE[m_nBufferSize+1]; + } +} +// ------------------------------------------------------------------------- +Reference<XFastPropertySet> ODbaseTable::isUniqueByColumnName(const ::rtl::OUString& _rColName) +{ + if(!m_pIndexes) + refreshIndexes(); + Reference<XFastPropertySet> xIndex; + for(sal_Int32 i=0;i<m_pIndexes->getCount();++i) + { + m_pIndexes->getByIndex(i) >>= xIndex; + if(getBOOL(xIndex->getFastPropertyValue(PROPERTY_ID_ISUNIQUE))) + { + Reference<XNameAccess> xCols(Reference<XColumnsSupplier>(xIndex,UNO_QUERY)->getColumns()); + if(xCols->hasByName(_rColName)) + return xIndex; + + } + } + return Reference<XFastPropertySet>(); +} +//------------------------------------------------------------------ +double toDouble(const ByteString& rString) +{ + static International aInter(LANGUAGE_ENGLISH); + static int nErrno=0; + BOOL bInitialized = FALSE; + if (!bInitialized) + { // ensure that the two members we're interested in are really set + // (if the system doesn't know the locale en_US aIntl would be initialized with the + // system language which may be anything - which we don't want ...) + // 74342 - 21.03.00 - FS + aInter.SetNumThousandSep(','); + aInter.SetNumDecimalSep('.'); + bInitialized = TRUE; + } + return SolarMath::StringToDouble(UniString(rString,gsl_getSystemTextEncoding()).GetBuffer(),aInter,nErrno); +} + +//------------------------------------------------------------------ +BOOL ODbaseTable::UpdateBuffer(OValueVector& rRow, OValueRow pOrgRow,const Reference<XIndexAccess>& _xCols) +{ + USHORT nByteOffset = 1; + + // Felder aktualisieren: + Reference<XFastPropertySet> xCol; + Reference<XFastPropertySet> xIndex; + USHORT i; + ::rtl::OUString aColName; + ::std::vector< Reference<XFastPropertySet> > aIndexedCols(m_pColumns->getCount()); + + ::utl::UStringMixEqual aCase(isCaseSensitive()); + + // first search a key that exist already in the table + for (i = 0; i < m_pColumns->getCount(); i++) + { + m_pColumns->getByIndex(i) >>= xCol; + xCol->getFastPropertyValue(PROPERTY_ID_NAME) >>= aColName; + + // const SdbFILEColumn *pColumn = (const SdbFILEColumn *)(*aOriginalColumns)[i]; + sal_Int32 nPos = 0; + for(;nPos<_xCols->getCount();++nPos) + { + Reference<XFastPropertySet> xFindCol; + _xCols->getByIndex(nPos) >>= xFindCol; + if(aCase(getString(xFindCol->getFastPropertyValue(PROPERTY_ID_NAME)),aColName)) + break; + } + if (nPos >= _xCols->getCount()) + continue; + + ++nPos; + // ODbVariant* pVal = (*rRow)[nPos].getBodyPtr(); + xIndex = isUniqueByColumnName(aColName); + aIndexedCols[i] = xIndex; + if (xIndex.is()) + { + // Update !! + if(pOrgRow.isValid() && (rRow[nPos].isNull() || rRow[nPos] == (*pOrgRow)[nPos])) +// +// if (pOrgRow && (pVal == NULL || +// !pVal->isModified() || +// *pVal == *(*pOrgRow)[nPos])) + continue; + else + { + // ODbVariantRef xVar = (pVal == NULL) ? new ODbVariant() : pVal; + Reference<XUnoTunnel> xTunnel(xIndex,UNO_QUERY); + OSL_ENSHURE(xTunnel.is(),"No TunnelImplementation!"); + ODbaseIndex* pIndex = (ODbaseIndex*)xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()); + OSL_ENSHURE(pIndex,"ODbaseTable::UpdateBuffer: No Index returned!"); + + if (pIndex->Find(0,rRow[nPos])) + { + // es existiert kein eindeutiger Wert +// String aText = String(SdbResId(STR_VALUE_NOTUNIQUE)); +// aText.SearchAndReplace(String::CreateFromAscii("#"),pColumn->GetName()); +// String strDetailed = String(SdbResId(STR_DBF_DUPL_VALUE_INFO)); +// strDetailed.SearchAndReplace(String::CreateFromAscii("$col$"),pColumn->GetName()); +// aStatus.Set(SDB_STAT_ERROR, +// String::CreateFromAscii("01000"), +// aStatus.CreateErrorMessage(aText), +// 0, strDetailed ); + return FALSE; + } + } + } + } + + // when we are here there is no double key in the table + + for (i = 0; i < m_pColumns->getCount(); i++) + { + m_pColumns->getByIndex(i) >>= xCol; + xCol->getFastPropertyValue(PROPERTY_ID_NAME) >>= aColName; + + // Laengen je nach Datentyp: + // nyi: eine zentrale Funktion, die die Laenge liefert! + USHORT nLen = (USHORT)getINT32(xCol->getFastPropertyValue(PROPERTY_ID_PRECISION)); + sal_Int32 nType = getINT32(xCol->getFastPropertyValue(PROPERTY_ID_TYPE)); + switch (nType) + { + case DataType::DATE: nLen = 8; break; + case DataType::DECIMAL: + nLen = SvDbaseConverter::ConvertPrecisionToDbase(nLen,getINT32(xCol->getFastPropertyValue(PROPERTY_ID_SCALE))); + break; // das Vorzeichen und das Komma + case DataType::BIT: nLen = 1; break; + case DataType::LONGVARCHAR:nLen = 10; break; + default: break; + + } + + sal_Int32 nPos = 0; + for(;nPos<_xCols->getCount();++nPos) + { + Reference<XFastPropertySet> xFindCol; + _xCols->getByIndex(nPos) >>= xFindCol; + if(aCase(getString(xFindCol->getFastPropertyValue(PROPERTY_ID_NAME)),aColName)) + break; + } + + if (nPos >= _xCols->getCount()) + { + nByteOffset += nLen; + continue; + } + + ++nPos; // the row values start at 1 + // ODbVariant* pVal = (*rRow)[nPos].getBodyPtr(); + if (aIndexedCols[i].is()) + { + Reference<XUnoTunnel> xTunnel(aIndexedCols[i],UNO_QUERY); + OSL_ENSHURE(xTunnel.is(),"No TunnelImplementation!"); + ODbaseIndex* pIndex = (ODbaseIndex*)xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()); + OSL_ENSHURE(pIndex,"ODbaseTable::UpdateBuffer: No Index returned!"); + // Update !! + if (pOrgRow.isValid() && !rRow[nPos].isNull() )//&& pVal->isModified()) + pIndex->Update(m_nFilePos,(*pOrgRow)[nPos],rRow[nPos]); + else + { + // ODbVariantRef xVar = (pVal == NULL) ? new ODbVariant() : pVal; + pIndex->Insert(m_nFilePos,rRow[nPos]); + } + } + + // Ist die Variable ueberhaupt gebunden? + if (!rRow[nPos].isBound() )//|| !pVal->isModified()) + { + // Nein - naechstes Feld. + nByteOffset += nLen; + continue; + } + + char* pData = (char *)(m_pBuffer + nByteOffset); + if (rRow[nPos].isNull()) + { + memset(pData,' ',nLen); // Zuruecksetzen auf NULL + nByteOffset += nLen; + continue; + } + try + { + switch (nType) + { + case DataType::DATE: + { + ::com::sun::star::util::Date aDate = DateConversion::toDate(rRow[nPos]); + char s[9]; + sprintf(s,"%04d%02d%02d", + (int)aDate.Year, + (int)aDate.Month, + (int)aDate.Day); + + // Genau 8 Byte kopieren: + strncpy(pData,s,sizeof s - 1); + } break; + case DataType::DECIMAL: + { + memset(pData,' ',nLen); // Zuruecksetzen auf NULL + + double n = rRow[nPos]; + + int nPrecision = (int)getINT32(xCol->getFastPropertyValue(PROPERTY_ID_PRECISION)); + int nScale = (int)getINT32(xCol->getFastPropertyValue(PROPERTY_ID_SCALE)); + // ein const_cast, da GetFormatPrecision am SvNumberFormat nicht const ist, obwohl es das eigentlich + // sein koennte und muesste + + String aString; + SolarMath::DoubleToString(aString,n,'F',nScale,'.'); + ByteString aDefaultValue(aString,gsl_getSystemTextEncoding()); + BOOL bValidLength = FALSE; + if (aDefaultValue.Len() <= nLen) + { + strncpy(pData,aDefaultValue.GetBuffer(),nLen); + // write the resulting double back + rRow[nPos] = toDouble(aDefaultValue); + bValidLength = TRUE; + } + if (!bValidLength) + { +// String strError(SdbResId(STR_DBF_INVALID_FIELD_VALUE)); +// strError.SearchAndReplace(String::CreateFromAscii("$name$"), pColumn->GetName()); +// +// String strDetailedInformation(SdbResId(STR_DBF_INVALID_FIELD_VALUE_DECIMAL)); +// strDetailedInformation.SearchAndReplace(String::CreateFromAscii("$name$"), pColumn->GetName()); +// strDetailedInformation.SearchAndReplace(String::CreateFromAscii("#length#"), nPrecision); +// strDetailedInformation.SearchAndReplace(String::CreateFromAscii("#scale#"), nScale); +// aStatus.Set(SDB_STAT_ERROR, String::CreateFromAscii("S1000"), aStatus.CreateErrorMessage(strError), 0, strDetailedInformation); + } + } break; + case DataType::BIT: + *pData = rRow[nPos].getBool() ? 'T' : 'F'; + break; + case DataType::LONGVARCHAR: + { + char cNext = pData[nLen]; // merken und temporaer durch 0 ersetzen + pData[nLen] = '\0'; // das geht, da der Puffer immer ein Zeichen groesser ist ... + + ULONG nBlockNo = strtol((const char *)pData,NULL,10); // Blocknummer lesen + + // Naechstes Anfangszeichen wieder restaurieren: + pData[nLen] = cNext; + if (!m_aMemoStream.IsOpen() || !WriteMemo(rRow[nPos], nBlockNo)) + break; + + ByteString aStr; + ByteString aBlock(ByteString::CreateFromInt32(nBlockNo)); + aStr.Expand(nLen - aBlock.Len(), '0'); + aStr += aBlock; + aStr.Convert(gsl_getSystemTextEncoding(),osl_getThreadTextEncoding()); + // Zeichen kopieren: + memset(pData,' ',nLen); // Zuruecksetzen auf NULL + memcpy(pData, aStr.GetBuffer(), nLen); + } break; + default: + { + memset(pData,' ',nLen); // Zuruecksetzen auf NULL + ByteString aStr(rRow[nPos].getString().getStr(),osl_getThreadTextEncoding()); + // Zeichen kopieren: + memcpy(pData, aStr.GetBuffer(), min(nLen,aStr.Len())); + } break; + } + } + catch ( ... ) + { +// String strError(SdbResId(STR_DBF_INVALID_FIELD_VALUE)); +// strError.SearchAndReplace(String::CreateFromAscii("$name$"), pColumn->GetName()); +// aStatus.Set(SDB_STAT_ERROR, String::CreateFromAscii("S1000"), aStatus.CreateErrorMessage(strError), 0, String()); + } +// if (aStatus.IsError()) +// break; + // Und weiter ... + nByteOffset += nLen; + } + return sal_True; +} + + +//------------------------------------------------------------------ +BOOL ODbaseTable::WriteBuffer() +{ + OSL_ENSHURE(m_nFilePos >= 1,"SdbDBFCursor::FileFetchRow: ungueltige Record-Position"); + + // Auf gewuenschten Record positionieren: + long nPos = m_aHeader.db_kopf + (long)(m_nFilePos-1) * m_aHeader.db_slng; + m_aFileStream.Seek(nPos); + return m_aFileStream.Write((char*) m_pBuffer, m_aHeader.db_slng) > 0; +} + + diff --git a/connectivity/source/drivers/dbase/DTables.cxx b/connectivity/source/drivers/dbase/DTables.cxx new file mode 100644 index 000000000000..2585efa8a5c0 --- /dev/null +++ b/connectivity/source/drivers/dbase/DTables.cxx @@ -0,0 +1,176 @@ +/************************************************************************* + * + * $RCSfile: DTables.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_TABLES_HXX_ +#include "dbase/DTables.hxx" +#endif +#ifndef _CONNECTIVITY_DBASE_TABLE_HXX_ +#include "dbase/DTable.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_ +#include <com/sun/star/sdbc/KeyRule.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_ +#include <com/sun/star/sdbcx/KeyType.hpp> +#endif +#ifndef _CONNECTIVITY_FILE_CATALOG_HXX_ +#include "file/FCatalog.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_BCONNECTION_HXX_ +#include "file/FConnection.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ +#include <com/sun/star/lang/XUnoTunnel.hpp> +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +using namespace connectivity::dbase; +using namespace connectivity::file; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::container; +namespace starutil = ::com::sun::star::util; + +Reference< XNamed > ODbaseTables::createObject(const ::rtl::OUString& _rName) +{ + ::rtl::OUString aName,aSchema; + ODbaseTable* pRet = new ODbaseTable((ODbaseConnection*)static_cast<OFileCatalog&>(m_rParent).getConnection(), + _rName,::rtl::OUString::createFromAscii("TABLE")); + + Reference< XNamed > xRet = pRet; + + return xRet; +} +// ------------------------------------------------------------------------- +void ODbaseTables::impl_refresh( ) throw(RuntimeException) +{ + // static_cast<OFileCatalog&>(m_rParent).refreshTables(); +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > ODbaseTables::createEmptyObject() +{ + ODbaseTable* pRet = new ODbaseTable((ODbaseConnection*)static_cast<OFileCatalog&>(m_rParent).getConnection()); + Reference< XPropertySet > xRet = pRet; + return xRet; +} +typedef connectivity::sdbcx::OCollection ODbaseTables_BASE_BASE; +// ------------------------------------------------------------------------- +// XAppend +void SAL_CALL ODbaseTables::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + + ::rtl::OUString aName = getString(descriptor->getPropertyValue(PROPERTY_NAME)); + ObjectMap::iterator aIter = m_aNameMap.find(aName); + if( aIter != m_aNameMap.end()) + throw ElementExistException(aName,*this); + + Reference<XUnoTunnel> xTunnel(descriptor,UNO_QUERY); + if(xTunnel.is()) + { + ODbaseTable* pTable = (ODbaseTable*)xTunnel->getSomething(ODbaseTable::getUnoTunnelImplementationId()); + if(pTable && pTable->CreateImpl()) + ODbaseTables_BASE_BASE::appendByDescriptor(descriptor); + } +} +// ------------------------------------------------------------------------- +// XDrop +void SAL_CALL ODbaseTables::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + + ObjectMap::iterator aIter = m_aNameMap.find(elementName); + if( aIter == m_aNameMap.end()) + throw NoSuchElementException(elementName,*this); + + Reference< XUnoTunnel> xTunnel(aIter->second.get(),UNO_QUERY); + if(xTunnel.is()) + { + ODbaseTable* pTable = (ODbaseTable*)xTunnel->getSomething(ODbaseTable::getUnoTunnelImplementationId()); + if(pTable && pTable->DropImpl()) + ODbaseTables_BASE_BASE::dropByName(elementName); + } + +} +// ------------------------------------------------------------------------- +void SAL_CALL ODbaseTables::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + if (index < 0 || index >= getCount()) + throw IndexOutOfBoundsException(); + + dropByName((*m_aElements[index]).first); +} +// ------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/dbase/Dservices.cxx b/connectivity/source/drivers/dbase/Dservices.cxx new file mode 100644 index 000000000000..8a0c200523f0 --- /dev/null +++ b/connectivity/source/drivers/dbase/Dservices.cxx @@ -0,0 +1,211 @@ +/************************************************************************* + * + * $RCSfile: Dservices.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_DDRIVER_HXX_ +#include "dbase/DDriver.hxx" +#endif +#ifndef _CPPUHELPER_FACTORY_HXX_ +#include <cppuhelper/factory.hxx> +#endif +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif + +using namespace connectivity::dbase; +using ::rtl::OUString; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::registry::XRegistryKey; +using ::com::sun::star::lang::XSingleServiceFactory; +using ::com::sun::star::lang::XMultiServiceFactory; + +typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) + ( + const Reference< XMultiServiceFactory > & rServiceManager, + const OUString & rComponentName, + ::cppu::ComponentInstantiation pCreateFunction, + const Sequence< OUString > & rServiceNames + ); + +//*************************************************************************************** +// +// Die vorgeschriebene C-Api muss erfuellt werden! +// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen. +// + +//--------------------------------------------------------------------------------------- +void REGISTER_PROVIDER( + const OUString& aServiceImplName, + const Sequence< OUString>& Services, + const Reference< ::com::sun::star::registry::XRegistryKey > & xKey) +{ + OUString aMainKeyName; + aMainKeyName = OUString::createFromAscii("/"); + aMainKeyName += aServiceImplName; + aMainKeyName += OUString::createFromAscii("/UNO/SERVICES"); + + Reference< ::com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) ); + OSL_ENSHURE(xNewKey.is(), "FILE::component_writeInfo : could not create a registry key !"); + + for (sal_uInt32 i=0; i<Services.getLength(); ++i) + xNewKey->createKey(Services[i]); +} + + +//--------------------------------------------------------------------------------------- +struct ProviderRequest +{ + Reference< XSingleServiceFactory > xRet; + Reference< XMultiServiceFactory > const xServiceManager; + OUString const sImplementationName; + + ProviderRequest( + void* pServiceManager, + sal_Char const* pImplementationName + ) + : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager)) + , sImplementationName(OUString::createFromAscii(pImplementationName)) + { + } + + inline + sal_Bool CREATE_PROVIDER( + const OUString& Implname, + const Sequence< OUString > & Services, + ::cppu::ComponentInstantiation Factory, + createFactoryFunc creator + ) + { + if (!xRet.is() && (Implname == sImplementationName)) + try + { + xRet = creator( xServiceManager, sImplementationName,Factory, Services); + } + catch(...) + { + } + return xRet.is(); + } + + void* getProvider() const { return xRet.get(); } +}; + +//--------------------------------------------------------------------------------------- + +extern "C" void SAL_CALL component_getImplementationEnvironment( + const sal_Char **ppEnvTypeName, + uno_Environment **ppEnv + ) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +//--------------------------------------------------------------------------------------- +extern "C" sal_Bool SAL_CALL component_writeInfo( + void* pServiceManager, + void* pRegistryKey + ) +{ + if (pRegistryKey) + try + { + Reference< ::com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast< ::com::sun::star::registry::XRegistryKey*>(pRegistryKey)); + + REGISTER_PROVIDER( + ODriver::getImplementationName_Static(), + ODriver::getSupportedServiceNames_Static(), xKey); + + return sal_True; + } + catch (::com::sun::star::registry::InvalidRegistryException& ) + { + OSL_ENSHURE(sal_False, "FILE::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); + } + + return sal_False; +} + +//--------------------------------------------------------------------------------------- +extern "C" void* SAL_CALL component_getFactory( + const sal_Char* pImplementationName, + void* pServiceManager, + void* pRegistryKey) +{ + void* pRet = 0; + if (pServiceManager) + { + ProviderRequest aReq(pServiceManager,pImplementationName); + + aReq.CREATE_PROVIDER( + ODriver::getImplementationName_Static(), + ODriver::getSupportedServiceNames_Static(), + ODriver_CreateInstance, ::cppu::createSingleFactory) + ; + + if(aReq.xRet.is()) + aReq.xRet->acquire(); + + pRet = aReq.getProvider(); + } + + return pRet; +}; + diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx new file mode 100644 index 000000000000..5401bc213d8c --- /dev/null +++ b/connectivity/source/drivers/dbase/dindexnode.cxx @@ -0,0 +1,1006 @@ +/************************************************************************* + * + * $RCSfile: dindexnode.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_INDEXNODE_HXX_ +#include "dbase/dindexnode.hxx" +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _OSL_THREAD_H_ +#include <osl/thread.h> +#endif +#ifndef _CONNECTIVITY_DBASE_INDEX_HXX_ +#include "dbase/DIndex.hxx" +#endif + + +using namespace connectivity; +using namespace connectivity::dbase; +using namespace connectivity::file; +using namespace com::sun::star::sdbc; +//================================================================== +// Index Seite +//================================================================== +ONDXPage::ONDXPage(ODbaseIndex& rInd, sal_uInt32 nPos, ONDXPage* pParent) + :rIndex(rInd) + ,nPagePos(nPos) + ,nCount(0) + ,bModified(FALSE) + ,ppNodes(NULL) + ,m_refCount(0) +{ + sal_uInt16 nT=rIndex.getHeader().db_maxkeys; + ppNodes = new ONDXNode[nT]; + aParent = new ONDXPagePtr(pParent); + aChild = new ONDXPagePtr(); +} + +//------------------------------------------------------------------ +ONDXPage::~ONDXPage() +{ + delete[] ppNodes; + delete aParent; + delete aChild; +} +// ------------------------------------------------------------------------- +void ONDXPage::release() +{ + if (! osl_decrementInterlockedCount( &m_refCount )) + { + QueryDelete(); + delete this; + } +} +//------------------------------------------------------------------ +void ONDXPage::QueryDelete() +{ + // Ablegen im GarbageCollector + if (IsModified()) + rIndex.m_aFileStream << *this; + + bModified = FALSE; + if (rIndex.UseCollector()) + { + if ((*aChild).Is()) + (*aChild)->Release(FALSE); + + for (USHORT i = 0; i < rIndex.getHeader().db_maxkeys;i++) + { + if (ppNodes[i].GetChild().Is()) + ppNodes[i].GetChild()->Release(FALSE); + + ppNodes[i] = ONDXNode(); + } + // RestoreNoDelete(); + + nCount = 0; + (*aParent).Clear(); + rIndex.Collect(this); + } +// else +// SvRefBase::QueryDelete(); +} +//------------------------------------------------------------------ +ONDXPagePtr& ONDXPage::GetChild(ODbaseIndex* pIndex) +{ + if (!(*aChild).Is() && pIndex) + { + (*aChild) = rIndex.CreatePage((*aChild).GetPagePos(),this,(*aChild).HasPage()); + } + return (*aChild); +} + +//------------------------------------------------------------------ +USHORT ONDXPage::FindPos(const ONDXKey& rKey) const +{ + // sucht nach Platz fuer den vorgegeben key auf einer Seite + USHORT i = 0; + while (i < nCount && rKey > ((*this)[i]).GetKey()) + i++; + + return i; +} + +//------------------------------------------------------------------ +BOOL ONDXPage::Find(const ONDXKey& rKey) +{ + // sucht den vorgegeben key + // Besonderheit: gelangt der Algorithmus ans Ende + // wird immer die aktuelle Seite und die Knotenposition vermerkt + // auf die die Bedingung <= zutrifft + // dieses findet beim Insert besondere Beachtung + USHORT i = 0; + while (i < nCount && rKey > ((*this)[i]).GetKey()) + i++; + + BOOL bResult = FALSE; + + if (!IsLeaf()) + { + // weiter absteigen + ONDXPagePtr aPage = (i==0) ? GetChild(&rIndex) : ((*this)[i-1]).GetChild(&rIndex, this); + bResult = aPage.Is() && aPage->Find(rKey); + } + else if (i == nCount) + { + rIndex.m_aCurLeaf = this; + rIndex.m_nCurNode = i - 1; + bResult = FALSE; + } + else + { + bResult = rKey == ((*this)[i]).GetKey(); + rIndex.m_aCurLeaf = this; + rIndex.m_nCurNode = bResult ? i : i - 1; + } + return bResult; +} + +//------------------------------------------------------------------ +BOOL ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft) +{ + // beim Erzeugen eines Index koennen auch mehrere Knoten eingefuegt werden + // diese sin dann aufsteigend sortiert + BOOL bAppend = nRowsLeft > 0; + if (IsFull()) + { + BOOL bResult = TRUE; + ONDXNode aSplitNode; + if (bAppend) + aSplitNode = rNode; + else + { + // merken des letzten Knotens + aSplitNode = (*this)[nCount-1]; + if(rNode.GetKey() <= aSplitNode.GetKey()) + { + + // und damit habe ich im folgenden praktisch eine Node weniger + if (IsLeaf() && this == rIndex.m_aCurLeaf.getBodyPtr()) + { + // geht davon aus, dass der Knoten, auf dem die Bedingung (<=) + // zutrifft, als m_nCurNode gesetzt ist + --nCount; // (sonst bekomme ich u.U. Assertions und GPFs - 60593) + bResult = Insert(rIndex.m_nCurNode + 1, rNode); + } + else // Position unbekannt + { + USHORT nPos = NODE_NOTFOUND; + while (++nPos < nCount && rNode.GetKey() > ((*this)[nPos]).GetKey()); + + --nCount; // (sonst bekomme ich u.U. Assertions und GPFs - 60593) + bResult = Insert(nPos, rNode); + } + + // konnte der neue Knoten eingefuegt werden + if (!bResult) + { + nCount++; + aSplitNode = rNode; + } + } + else + aSplitNode = rNode; + } + + sal_uInt32 nNewPagePos = rIndex.GetPageCount(); + sal_uInt32 nNewPageCount = nNewPagePos + 1; + + // Herausgeloesten Knoten beim Vater einfuegen + if (!HasParent()) + { + // Kein Vater, dann neue Wurzel + ONDXPagePtr aNewRoot = rIndex.CreatePage(nNewPagePos + 1); + aNewRoot->SetChild(this); + + rIndex.m_aRoot = aNewRoot; + rIndex.SetRootPos(nNewPagePos + 1); + rIndex.SetPageCount(++nNewPageCount); + } + + // neues blatt erzeugen und Seite aufteilen + ONDXPagePtr aNewPage = rIndex.CreatePage(nNewPagePos,(*aParent).getBodyPtr()); + rIndex.SetPageCount(nNewPageCount); + + // wieviele Knoten weren noch eingefuegt + // kommen noch ausreichend, dann koennen die Seiten bis zum Rand vollgestopft werden + + ONDXNode aInnerNode; + if (!IsLeaf() || nRowsLeft < (sal_uInt32)(rIndex.GetMaxNodes() / 2)) + aInnerNode = Split(*aNewPage); + else + { + aInnerNode = (*this)[nCount - 1]; + //aInnerNode = aSplitNode; + + // Knoten zeigt auf neue Seite + aInnerNode.SetChild(aNewPage); + + // innere Knoten haben keine Recordnummer + if (rIndex.isUnique()) + aInnerNode.GetKey().ResetRecord(); + + // neue Seite zeigt nun auf Seite des herausgelösten Knoten + if (!IsLeaf()) + aNewPage->SetChild(aInnerNode.GetChild()); + } + + aNewPage->Append(aSplitNode); + ONDXPagePtr aTempParent = (*aParent); + if (IsLeaf()) + { + rIndex.m_aCurLeaf = aNewPage; + rIndex.m_nCurNode = rIndex.m_aCurLeaf->Count() - 1; + + // Freigeben nicht benoetigter Seiten, danach besteht keine Referenz + // mehr auf die Seite, danach kann 'this' nicht mehr gueltig sein!!! + ReleaseFull(); + } + + // Einfuegen des herausgeloesten Knotens + return aTempParent->Insert(aInnerNode); + } + else // Seite einfach weiter auffuellen + { + if (bAppend) + { + if (IsLeaf()) + rIndex.m_nCurNode = nCount - 1; + return Append(rNode); + } + else + { + USHORT nNodePos = FindPos(rNode.GetKey()); + if (IsLeaf()) + rIndex.m_nCurNode = nNodePos; + + return Insert(nNodePos, rNode); + } + } +} + +//------------------------------------------------------------------ +BOOL ONDXPage::Insert(USHORT nPos, ONDXNode& rNode) +{ + USHORT nMaxCount = rIndex.getHeader().db_maxkeys; + if (nPos >= nMaxCount) + return FALSE; + + if (nCount) + { + ++nCount; + // nach rechts verschieben + for (USHORT i = min(nMaxCount-1, nCount-1); nPos < i; i--) + (*this)[i] = (*this)[i-1]; + } + else + if (nCount < nMaxCount) + nCount++; + + // einfuegen an der Position + ONDXNode& rInsertNode = (*this)[nPos]; + rInsertNode = rNode; + if (rInsertNode.GetChild().Is()) + { + rInsertNode.GetChild()->SetParent(this); + rNode.GetChild()->SetParent(this); + } + + bModified = TRUE; + + return TRUE; +} + +//------------------------------------------------------------------ +BOOL ONDXPage::Append(ONDXNode& rNode) +{ + DBG_ASSERT(!IsFull(), "kein Append moeglich"); + return Insert(nCount, rNode); +} + +//------------------------------------------------------------------ +void ONDXPage::Remove(USHORT nPos) +{ + DBG_ASSERT(nCount > nPos, "falscher Indexzugriff"); + + for (USHORT i = nPos; i < (nCount-1); i++) + (*this)[i] = (*this)[i+1]; + + nCount--; + bModified = TRUE; +} + +//------------------------------------------------------------------ +void ONDXPage::Release(BOOL bSave) +{ + // freigeben der Pages + if ((*aChild).Is()) + (*aChild)->Release(bSave); + + // Pointer freigeben + (*aChild).Clear(); + + for (USHORT i = 0; i < rIndex.getHeader().db_maxkeys;i++) + { + if (ppNodes[i].GetChild().isValid()) + ppNodes[i].GetChild()->Release(bSave); + + ppNodes[i].GetChild().Clear(); + } + (*aParent) = NULL; +} +//------------------------------------------------------------------ +void ONDXPage::ReleaseFull(BOOL bSave) +{ + ONDXPagePtr aTempParent = (*aParent); + Release(bSave); + + if (aTempParent.Is()) + { + // Freigeben nicht benoetigter Seiten, danach besteht keine Referenz + // mehr auf die Seite, danach kann 'this' nicht mehr gueltig sein!!! + USHORT nParentPos = aTempParent->Search(this); + if (nParentPos != NODE_NOTFOUND) + (*aTempParent)[nParentPos].GetChild().Clear(); + else + aTempParent->GetChild().Clear(); + } +} + + +//------------------------------------------------------------------ +ONDXNode& ONDXPage::operator[] (USHORT nPos) +{ + DBG_ASSERT(nCount > nPos, "falscher Indexzugriff"); + return ppNodes[nPos]; +} + +//------------------------------------------------------------------ +const ONDXNode& ONDXPage::operator[] (USHORT nPos) const +{ + DBG_ASSERT(nCount > nPos, "falscher Indexzugriff"); + return ppNodes[nPos]; +} + +//------------------------------------------------------------------ +// laeuft rekursiv +void ONDXPage::SearchAndReplace(const ONDXKey& rSearch, + ONDXKey& rReplace) +{ + if (rSearch == rReplace) + return; + + USHORT nPos = NODE_NOTFOUND; + ONDXPage* pPage = this; + + while (pPage && (nPos = pPage->Search(rSearch)) == NODE_NOTFOUND) + pPage = pPage->aParent->getBodyPtr(); + + if (pPage) + { + (*pPage)[nPos].GetKey() = rReplace; + pPage->SetModified(TRUE); + } +} + +//------------------------------------------------------------------ +USHORT ONDXPage::Search(const ONDXKey& rSearch) +{ + // binare Suche spaeter + USHORT i = 0xFFFF; + while (++i < Count()) + if ((*this)[i].GetKey() == rSearch) + break; + + return (i < Count()) ? i : NODE_NOTFOUND; +} + +//------------------------------------------------------------------ +USHORT ONDXPage::Search(const ONDXPage* pPage) +{ + USHORT i = 0xFFFF; + while (++i < Count()) + if (((*this)[i]).GetChild().getBodyPtr() == pPage) + break; + + // wenn nicht gefunden, dann wird davon ausgegangen, dass die Seite selbst + // auf die Page zeigt + return (i < Count()) ? i : NODE_NOTFOUND; +} + +//------------------------------------------------------------------ +BOOL ONDXPage::Delete(USHORT nNodePos) +{ + if (IsLeaf()) + { + // Letztes Element wird geloescht + if (nNodePos == (nCount - 1)) + { + ONDXNode aNode = (*this)[nNodePos]; + + // beim Parent muss nun der KeyValue ausgetauscht werden + if (HasParent()) + (*aParent)->SearchAndReplace(aNode.GetKey(), + (*this)[nNodePos-1].GetKey()); + } + } + + // Loeschen des Knoten + Remove(nNodePos); + + // Unterlauf + if (HasParent() && nCount < (rIndex.GetMaxNodes() / 2)) + { + // Feststellen, welcher Knoten auf die Seite zeigt + USHORT nParentNodePos = (*aParent)->Search(this); + // letzte Element auf Vaterseite + // -> zusammenlegen mit vorletzter Seite + if (nParentNodePos == ((*aParent)->Count() - 1)) + { + if (!nParentNodePos) + // zusammenlegen mit linken nachbarn + Merge(nParentNodePos,(*aParent)->GetChild(&rIndex)); + else + Merge(nParentNodePos,(*(*aParent))[nParentNodePos-1].GetChild(&rIndex,(*aParent).getBodyPtr())); + } + // sonst Seite mit naechster Seite zusammenlegen + else + { + // zusammenlegen mit rechten nachbarn + Merge(nParentNodePos + 1,((*(*aParent))[nParentNodePos + 1].GetChild(&rIndex,(*aParent).getBodyPtr()))); + nParentNodePos++; + } + if (HasParent() && !(*(*aParent))[nParentNodePos].HasChild()) + (*aParent)->Delete(nParentNodePos); +/* + // letzte Element auf Vaterseite + // -> zusammenlegen mit vorletzter Seite + if (nParentNodePos == ((*aParent)->Count() - 1)) + { + if (!nParentNodePos) + // zusammenlegen mit linken nachbarn + Merge(nParentNodePos,(*aParent)->GetChild(&rIndex)); + else + Merge(nParentNodePos,(*(*aParent))[nParentNodePos-1].GetChild(&rIndex,(*aParent))); + } + // sonst Seite mit naechster Seite zusammenlegen + else if(nParentNodePos != NODE_NOTFOUND) + { + // zusammenlegen mit rechten nachbarn + Merge(nParentNodePos + 1,((*(*aParent))[nParentNodePos + 1].GetChild(&rIndex,(*aParent)))); + nParentNodePos++; + } + else // Sonderbehandlung + { + // Page ist (*aChild) Page vom Parent => erste Page aus ppNodes an (*aChild) anhängen + Merge(0,(*(*aParent))[0].GetChild(&rIndex,(*aParent))); + nParentNodePos = 0; + } + + if (HasParent() && !(*(*aParent))[nParentNodePos].HasChild()) + (*aParent)->Delete(nParentNodePos); +*/ + + } + else if (IsRoot()) + // Sicherstellen das die Position der Wurzel festgehalten wird + rIndex.SetRootPos(nPagePos); + return TRUE; +} + + +//------------------------------------------------------------------ +ONDXNode ONDXPage::Split(ONDXPage& rPage) +{ + DBG_ASSERT(IsFull(), "Falsches Splitting"); + /* Aufteilen einer Seite auf zwei + Blatt: + Seite 1 behaelt (n - (n/2)) + Seite 2 erhaelt (n/2) + Knoten n/2 wird dupliziert + Innerer Knoten: + Seite 1 behaelt (n+1)/2 + Seite 2 erhaelt (n/2-1) + Knoten ((n+1)/2 + 1) : wird herausgenommen + */ + ONDXNode aResultNode; + if (IsLeaf()) + { + for (USHORT i = (nCount - (nCount / 2)), j = 0 ; i < nCount; i++) + rPage.Insert(j++,(*this)[i]); + + // dieser Knoten enthaelt einen Schluessel der noch einmal im Tree vorkommt + // und ersetzt werden muss + ONDXNode aLastNode = (*this)[nCount - 1]; + nCount = nCount - (nCount / 2); + aResultNode = (*this)[nCount - 1]; + + if (HasParent()) + (*aParent)->SearchAndReplace(aLastNode.GetKey(), + aResultNode.GetKey()); + } + else + { + for (USHORT i = (nCount + 1) / 2 + 1, j = 0 ; i < nCount; i++) + rPage.Insert(j++,(*this)[i]); + + aResultNode = (*this)[(nCount + 1) / 2]; + nCount = (nCount + 1) / 2; + + // neue Seite zeigt nun auf Seite des herausgelösten Knoten + rPage.SetChild(aResultNode.GetChild()); + } + // Knoten zeigt auf neue Seite + aResultNode.SetChild(&rPage); + + // innere Knoten haben keine Recordnummer + if (rIndex.isUnique()) + aResultNode.GetKey().ResetRecord(); + bModified = TRUE; + return aResultNode; +} + +//------------------------------------------------------------------ +void ONDXPage::Merge(USHORT nParentNodePos, ONDXPagePtr xPage) +{ + DBG_ASSERT(HasParent(), "kein Vater vorhanden"); + DBG_ASSERT(nParentNodePos != NODE_NOTFOUND, "Falscher Indexaufbau"); + + /* Zusammenlegen zweier Seiten */ + ONDXNode aResultNode; + USHORT nMaxNodes = rIndex.GetMaxNodes(), + nMaxNodes_2 = nMaxNodes / 2; + + // Feststellen ob Seite rechter oder linker Nachbar + BOOL bRight = ((*xPage)[0].GetKey() > (*this)[0].GetKey()); // TRUE, wenn xPage die rechte Seite ist + USHORT nNewCount = (*xPage).Count() + Count(); + + if (IsLeaf()) + { + // Bedingung fuers zusammenlegen + if (nNewCount < (nMaxNodes_2 * 2)) + { + USHORT nLastNode = bRight ? Count() - 1 : xPage->Count() - 1; + if (bRight) + { + DBG_ASSERT(xPage.getBodyPtr() != this,"xPage und THIS dürfen nicht gleich sein: Endlosschleife"); + // alle Knoten aus xPage auf den linken Knoten verschieben (anhängen) + while (xPage->Count()) + { + Append((*xPage)[0]); + xPage->Remove(0); + } + } + else + { + DBG_ASSERT(xPage.getBodyPtr() != this,"xPage und THIS dürfen nicht gleich sein: Endlosschleife"); + // xPage ist die linke Page und THIS die rechte + while (xPage->Count()) + { + Insert(0,(*xPage)[xPage->Count()-1]); + xPage->Remove(xPage->Count()-1); + } + // alte Position von xPage beim Parent mit this ersetzen + if (nParentNodePos) + (*(*aParent))[nParentNodePos-1].SetChild(this,(*aParent).getBodyPtr()); + else // oder als rechten Knoten setzen + (*aParent)->SetChild(this); + (*aParent)->SetModified(TRUE); + + } + + // Child beziehung beim Vaterknoten aufheben + (*(*aParent))[nParentNodePos].SetChild(); + // Austauschen des KnotenWertes, nur wenn geaenderte Page + // die linke ist, ansonsten werde + + if((*aParent)->IsRoot() && (*aParent)->Count() == 1) + { + (*(*aParent))[0].SetChild(); + (*aParent)->ReleaseFull(); + (*aParent) = NULL; + rIndex.SetRootPos(nPagePos); + rIndex.m_aRoot = this; + SetModified(TRUE); + } + else + (*aParent)->SearchAndReplace((*this)[nLastNode].GetKey(),(*this)[nCount-1].GetKey()); + + xPage->SetModified(FALSE); + xPage->ReleaseFull(); // wird nicht mehr benoetigt + } + // Ausgleichen der Elemente nNewCount >= (nMaxNodes_2 * 2) + else + { + if (bRight) + { + // alle Knoten aus xPage auf den linken Knoten verschieben (anhängen) + ONDXNode aReplaceNode = (*this)[nCount - 1]; + while (nCount < nMaxNodes_2) + { + Append((*xPage)[0]); + xPage->Remove(0); + } + // Austauschen des KnotenWertes: Setzt alten letzten Wert durch den letzten von xPage + (*aParent)->SearchAndReplace(aReplaceNode.GetKey(),(*this)[nCount-1].GetKey()); + } + else + { + // alle Knoten aus this vor die xPage Knoten einfügen + ONDXNode aReplaceNode = (*this)[nCount - 1]; + while (xPage->Count() < nMaxNodes_2) + { + xPage->Insert(0,(*this)[nCount-1]); + Remove(nCount-1); + } + // Austauschen des KnotenWertes + (*aParent)->SearchAndReplace(aReplaceNode.GetKey(),(*this)[Count()-1].GetKey()); + } + } + } + else // !IsLeaf() + { + // Bedingung fuers zusammenlegen + if (nNewCount < nMaxNodes_2 * 2) + { + if (bRight) + { + DBG_ASSERT(xPage.getBodyPtr() != this,"xPage und THIS dürfen nicht gleich sein: Endlosschleife"); + // Vaterknoten wird mit integriert + // erhaelt zunaechst Child von xPage + (*(*aParent))[nParentNodePos].SetChild(xPage->GetChild(),(*aParent).getBodyPtr()); + Append((*(*aParent))[nParentNodePos]); + for (USHORT i = 0 ; i < xPage->Count(); i++) + Append((*xPage)[i]); + } + else + { + DBG_ASSERT(xPage.getBodyPtr() != this,"xPage und THIS dürfen nicht gleich sein: Endlosschleife"); + // Vaterknoten wird mit integriert + // erhaelt zunaechst Child + (*(*aParent))[nParentNodePos].SetChild(GetChild(),(*aParent).getBodyPtr()); // Parent merkt sich mein Child + Insert(0,(*(*aParent))[nParentNodePos]); // Node vom Parent bei mir einfügen + while (xPage->Count()) + { + Insert(0,(*xPage)[xPage->Count()-1]); + xPage->Remove(xPage->Count()-1); + } + SetChild(xPage->GetChild()); + + if (nParentNodePos) + (*(*aParent))[nParentNodePos-1].SetChild(this,(*aParent).getBodyPtr()); + else + (*aParent)->SetChild(this); + } + + // danach wird der Vaterknoten zurueckgesetzt + (*(*aParent))[nParentNodePos].SetChild(); + (*aParent)->SetModified(TRUE); + + if((*aParent)->IsRoot() && (*aParent)->Count() == 1) + { + (*(*aParent)).SetChild(); + (*aParent)->ReleaseFull(); + (*aParent) = NULL; + rIndex.SetRootPos(nPagePos); + rIndex.m_aRoot = this; + SetModified(TRUE); + } + else if(nParentNodePos) + // Austauschen des KnotenWertes + // beim Append wird der Bereich erweitert, beim INsert verweist der alte Knoten von xPage auf this + // deshalb muß der Knoten auch hier aktualisiert werden + (*aParent)->SearchAndReplace((*(*aParent))[nParentNodePos-1].GetKey(),(*(*aParent))[nParentNodePos].GetKey()); + + xPage->SetModified(FALSE); + xPage->ReleaseFull(); + } + // Ausgleichen der Elemente + else + { + if (bRight) + { + while (nCount < nMaxNodes_2) + { + (*(*aParent))[nParentNodePos].SetChild(xPage->GetChild(),(*aParent).getBodyPtr()); + Append((*(*aParent))[nParentNodePos]); + (*(*aParent))[nParentNodePos] = (*xPage)[0]; + xPage->Remove(0); + } + xPage->SetChild((*(*aParent))[nParentNodePos].GetChild()); + (*(*aParent))[nParentNodePos].SetChild(xPage,(*aParent).getBodyPtr()); + } + else + { + while (nCount < nMaxNodes_2) + { + (*(*aParent))[nParentNodePos].SetChild(GetChild(),(*aParent).getBodyPtr()); + Insert(0,(*(*aParent))[nParentNodePos]); + (*(*aParent))[nParentNodePos] = (*xPage)[xPage->Count()-1]; + xPage->Remove(xPage->Count()-1); + } + SetChild((*(*aParent))[nParentNodePos].GetChild()); + (*(*aParent))[nParentNodePos].SetChild(this,(*aParent).getBodyPtr()); + + } + (*aParent)->SetModified(TRUE); + } + } +} +// ------------------------------------------------------------------------- +BOOL ONDXPage::IsFull() const +{ + return Count() == rIndex.getHeader().db_maxkeys; +} + +#ifdef DEBUG +//------------------------------------------------------------------ +void ONDXPage::PrintPage() +{ + DBG_TRACE4("\nSDB: -----------Page: %d Parent: %d Count: %d Child: %d-----", + nPagePos, HasParent() ? (*aParent)->GetPagePos() : 0 ,nCount, (*aChild).GetPagePos()); + + for (USHORT i = 0; i < nCount; i++) + { + ONDXNode rNode = (*this)[i]; + ONDXKey& rKey = rNode.GetKey(); + if (!IsLeaf()) + rNode.GetChild(&rIndex, this); + + if (!rKey.getValue().hasValue()) + { + DBG_TRACE2("SDB: [%d,NULL,%d]",rKey.GetRecord(), rNode.GetChild().GetPagePos()); + } + else if (rIndex.getHeader().db_keytype) + { + DBG_TRACE3("SDB: [%d,%f,%d]",rKey.GetRecord(), getDouble(rKey.getValue()),rNode.GetChild().GetPagePos()); + } + else + { + DBG_TRACE3("SDB: [%d,%s,%d]",rKey.GetRecord(), (const char* )ByteString(getString(rKey.getValue()).getStr(), gsl_getSystemTextEncoding()).GetBuffer(),rNode.GetChild().GetPagePos()); + } + } + DBG_TRACE("SDB: -----------------------------------------------\n"); + if (!IsLeaf()) + { + GetChild(&rIndex)->PrintPage(); + for (USHORT i = 0; i < nCount; i++) + { + ONDXNode rNode = (*this)[i]; + rNode.GetChild(&rIndex,this)->PrintPage(); + } + } + DBG_TRACE("SDB: ===============================================\n"); +} +#endif + + +static UINT32 nValue; +//------------------------------------------------------------------ +SvStream& connectivity::dbase::operator >> (SvStream &rStream, ONDXPage& rPage) +{ + rStream.Seek(rPage.GetPagePos() * 512); + rStream >> nValue >> (*rPage.aChild); + rPage.nCount = USHORT(nValue); + +// DBG_ASSERT(rPage.nCount && rPage.nCount < rPage.GetIndex().GetMaxNodes(), "Falscher Count"); + for (USHORT i = 0; i < rPage.nCount; i++) + rPage[i].Read(rStream, rPage.GetIndex()); + return rStream; +} + +//------------------------------------------------------------------ +SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPage& rPage) +{ + // Seite existiert noch nicht + if ((rPage.GetPagePos() + 1) * 512 > rStream.Seek(STREAM_SEEK_TO_END)) + rStream.SetStreamSize((rPage.GetPagePos() + 1) * 512); + rStream.Seek(rPage.GetPagePos() * 512); + + nValue = rPage.nCount; + rStream << nValue << (*rPage.aChild); + + for (USHORT i = 0; i < rPage.nCount; i++) + rPage[i].Write(rStream, rPage); + return rStream; +} + +//================================================================== +// ONDXNode +//================================================================== + +//------------------------------------------------------------------ +void ONDXNode::Read(SvStream &rStream, ODbaseIndex& rIndex) +{ + rStream >> aKey.nRecord; // schluessel + if (rIndex.getHeader().db_keytype) + { + double aDbl; + rStream >> aDbl; + aKey = ONDXKey(aDbl,aKey.nRecord); + } + else + { + ByteString aBuf; + USHORT nLen = rIndex.getHeader().db_keylen; + char* pStr = aBuf.AllocBuffer(nLen+1); + + rStream.Read(pStr,nLen); + pStr[nLen] = 0; + aBuf.ReleaseBufferAccess(); + aBuf.EraseTrailingChars(); + + // aKey = ONDXKey((aBuf,rIndex.GetDBFConnection()->GetCharacterSet()) ,aKey.nRecord); + aKey = ONDXKey((aBuf,osl_getThreadTextEncoding()) ,aKey.nRecord); + } + rStream >> aChild; +} + +union +{ + double aDbl; + char aData[128]; +} aNodeData; +//------------------------------------------------------------------ +void ONDXNode::Write(SvStream &rStream, const ONDXPage& rPage) const +{ + const ODbaseIndex& rIndex = rPage.GetIndex(); + if (!rIndex.isUnique() || rPage.IsLeaf()) + rStream << aKey.nRecord; // schluessel + else + rStream << (sal_uInt32)0; // schluessel + + if (rIndex.getHeader().db_keytype) // double + { + if (!aKey.getValue().hasValue()) + { + memset(aNodeData.aData,0,rIndex.getHeader().db_keylen); + rStream.Write((BYTE*)aNodeData.aData,rIndex.getHeader().db_keylen); + } + else + rStream << (double) getDouble(aKey.getValue()); + } + else + { + memset(aNodeData.aData,0x20,rIndex.getHeader().db_keylen); + if (aKey.getValue().hasValue()) + { + // ODBFConnection *pCon = rIndex.GetDBFConnection(); + if (NULL) + { + ByteString aText(getString(aKey.getValue()).getStr(), gsl_getSystemTextEncoding());//pCon->GetCharacterSet()); + strncpy(aNodeData.aData,aText.GetBuffer(),min(rIndex.getHeader().db_keylen, aText.Len())); + } + else + { + DBG_ERROR("No Connection"); + ByteString aText(getString(aKey.getValue()).getStr(), gsl_getSystemTextEncoding()); + strncpy(aNodeData.aData,aText.GetBuffer(),min(rIndex.getHeader().db_keylen, aText.Len())); + } + } + rStream.Write((BYTE*)aNodeData.aData,rIndex.getHeader().db_keylen); + } + rStream << aChild; +} + + +//------------------------------------------------------------------ +ONDXPagePtr& ONDXNode::GetChild(ODbaseIndex* pIndex, ONDXPage* pParent) +{ + if (!aChild.Is() && pIndex) + { + aChild = pIndex->CreatePage(aChild.GetPagePos(),pParent,aChild.HasPage()); + } + return aChild; +} + +//================================================================== +// ONDXKey +//================================================================== +//------------------------------------------------------------------ +BOOL ONDXKey::IsText(sal_Int32 eType) +{ + return eType == DataType::VARCHAR || eType == DataType::CHAR; +} + +//------------------------------------------------------------------ +StringCompare ONDXKey::Compare(const ONDXKey& rKey) const +{ + // DBG_ASSERT(is(), "Falscher Indexzugriff"); + StringCompare eResult; + + if (!getValue().getValue() || !getValue().hasValue()) + { + if (!rKey.getValue().getValue() || !rKey.getValue().hasValue() || (rKey.IsText(getDBType()) && !getString(rKey.getValue()).getLength())) + eResult = COMPARE_EQUAL; + else + eResult = COMPARE_LESS; + } + else if (!rKey.getValue().getValue() || !rKey.getValue().hasValue()) + { + if (!getValue().getValue() || !getValue().hasValue() || (IsText(getDBType()) && !getString(getValue()).getLength())) + eResult = COMPARE_EQUAL; + else + eResult = COMPARE_GREATER; + } + else if (IsText(getDBType())) + { + INT32 nRes = getString(getValue()).compareTo(getString(rKey.getValue())); + eResult = (nRes > 0) ? COMPARE_GREATER : (nRes == 0) ? COMPARE_EQUAL : COMPARE_LESS; + } + else + { + double m,n; + getValue() >>= m; + rKey.getValue() >>= n; + + eResult = (m > n) ? COMPARE_GREATER : (n == m) ? COMPARE_EQUAL : COMPARE_LESS; + } + + // Record vergleich, wenn Index !Unique + if (eResult == COMPARE_EQUAL && nRecord && rKey.nRecord) + eResult = (nRecord > rKey.nRecord) ? COMPARE_GREATER : + (nRecord == rKey.nRecord) ? COMPARE_EQUAL : COMPARE_LESS; + + return eResult; +} + diff --git a/connectivity/source/drivers/dbase/exports.dxp b/connectivity/source/drivers/dbase/exports.dxp new file mode 100644 index 000000000000..9630d7e06768 --- /dev/null +++ b/connectivity/source/drivers/dbase/exports.dxp @@ -0,0 +1,3 @@ +component_getImplementationEnvironment +component_writeInfo +component_getFactory diff --git a/connectivity/source/drivers/dbase/makefile.mk b/connectivity/source/drivers/dbase/makefile.mk new file mode 100644 index 000000000000..0de686b1f257 --- /dev/null +++ b/connectivity/source/drivers/dbase/makefile.mk @@ -0,0 +1,132 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/..$/.. +PRJINC=..$/.. +PRJNAME=connectivity +TARGET=dbase + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ---------------------------------- +.IF "$(DBGUTIL_OJ)"!="" +ENVCFLAGS+=/FR$(SLO)$/ +.ENDIF + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/version.mk + + +# --- Files ------------------------------------- + +SLOFILES=\ + $(SLO)$/dindexnode.obj \ + $(SLO)$/DIndexPage.obj \ + $(SLO)$/DIndexIter.obj \ + $(SLO)$/DDatabaseMetaData.obj \ + $(SLO)$/DCatalog.obj \ + $(SLO)$/DColumns.obj \ + $(SLO)$/DIndexColumns.obj \ + $(SLO)$/DIndex.obj \ + $(SLO)$/DIndexes.obj \ + $(SLO)$/DTable.obj \ + $(SLO)$/DTables.obj \ + $(SLO)$/DConnection.obj \ + $(SLO)$/Dservices.obj \ + $(SLO)$/DDriver.obj + + + +# --- Library ----------------------------------- + +SHL1TARGET= $(DBASE_TARGET)$(DBASE_MAJOR) +SHL1OBJS=$(SLOFILES) +SHL1STDLIBS=\ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(VOSLIB) \ + $(OSLLIB) \ + $(SVLLIB) \ + $(SVLIB) \ + $(TOOLSLIB) \ + $(UCBHELPERLIB) \ + $(SALLIB) + +SHL1DEPN= +SHL1IMPLIB= i$(DBASE_TARGET) +SHL1LIBS= $(SLB)$/commontools.lib \ + $(SLB)$/resource.lib \ + $(SLB)$/sdbcx.lib \ + $(SLB)$/file.lib \ + $(SLB)$/sql.lib + +SHL1DEF= $(MISC)$/$(SHL1TARGET).def + +DEF1NAME= $(SHL1TARGET) +DEF1EXPORTFILE= exports.dxp + + +# --- Targets ---------------------------------- + +.INCLUDE : target.mk + + diff --git a/connectivity/source/drivers/file/FCatalog.cxx b/connectivity/source/drivers/file/FCatalog.cxx new file mode 100644 index 000000000000..7e7a38415d8d --- /dev/null +++ b/connectivity/source/drivers/file/FCatalog.cxx @@ -0,0 +1,136 @@ +/************************************************************************* + * + * $RCSfile: FCatalog.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_CATALOG_HXX_ +#include "file/FCatalog.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_BCONNECTION_HXX_ +#include "file/FConnection.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_TABLES_HXX_ +#include "file/FTables.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +//#ifndef _CONNECTIVITY_FILE_OEMPTYCOLLECTION_HXX_ +//#include "file/FEmptyCollection.hxx" +//#endif + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; + +// ------------------------------------------------------------------------- +using namespace connectivity::file; +// ------------------------------------------------------------------------- +OFileCatalog::OFileCatalog(OConnection* _pCon) : connectivity::sdbcx::OCatalog(_pCon) + ,m_pConnection(_pCon) + ,m_xMetaData(m_pConnection->getMetaData( )) +{ +} +// ------------------------------------------------------------------------- +void SAL_CALL OFileCatalog::disposing() +{ + ::osl::MutexGuard aGuard(m_aMutex); + + typedef connectivity::sdbcx::OCatalog OFileCatalog_BASE; + m_xMetaData = NULL; + OFileCatalog_BASE::disposing(); +} +// ------------------------------------------------------------------------- +void OFileCatalog::refreshTables() +{ + ::std::vector< ::rtl::OUString> aVector; + Sequence< ::rtl::OUString > aTypes(1); + aTypes[0] = ::rtl::OUString::createFromAscii("%"); + Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), + ::rtl::OUString::createFromAscii("%"),::rtl::OUString::createFromAscii("%"),aTypes); + + if(xResult.is()) + { + Reference< XRow > xRow(xResult,UNO_QUERY); + while(xResult->next()) + aVector.push_back(xRow->getString(3)); + } + if(m_pTables) + delete m_pTables; + m_pTables = new OTables(m_xMetaData,*this,m_aMutex,aVector); +} + +// ------------------------------------------------------------------------- +Any SAL_CALL OFileCatalog::queryInterface( const Type & rType ) throw(RuntimeException) +{ + if( rType == ::getCppuType((const Reference<XGroupsSupplier>*)0) || + rType == ::getCppuType((const Reference<XUsersSupplier>*)0) || + rType == ::getCppuType((const Reference<XViewsSupplier>*)0)) + return Any(); + + + typedef sdbcx::OCatalog OFileCatalog_BASE; + return OFileCatalog_BASE::queryInterface(rType); +} + diff --git a/connectivity/source/drivers/file/FColumns.cxx b/connectivity/source/drivers/file/FColumns.cxx new file mode 100644 index 000000000000..a80367236e50 --- /dev/null +++ b/connectivity/source/drivers/file/FColumns.cxx @@ -0,0 +1,142 @@ +/************************************************************************* + * + * $RCSfile: FColumns.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_COLUMNS_HXX_ +#include "file/FColumns.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ +#include "connectivity/sdbcx/VColumn.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif +#ifndef _CONNECTIVITY_FILE_TABLE_HXX_ +#include "file/FTable.hxx" +#endif + +using namespace connectivity::file; +using namespace connectivity; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + +typedef connectivity::sdbcx::OCollection OCollection_TYPE; + +Reference< XNamed > OColumns::createObject(const ::rtl::OUString& _rName) +{ + + Reference< XResultSet > xResult = m_pTable->getConnection()->getMetaData()->getColumns(Any(), + m_pTable->getSchema(),m_pTable->getName(),_rName); + + Reference< XNamed > xRet = NULL; + if(xResult.is()) + { + Reference< XRow > xRow(xResult,UNO_QUERY); + while(xResult->next()) + { + if(xRow->getString(4) == _rName) + { + sdbcx::OColumn* pRet = new sdbcx::OColumn(_rName, + xRow->getString(6), + xRow->getString(13), + xRow->getInt(11), + xRow->getInt(7), + xRow->getInt(9), + xRow->getInt(5), + sal_False, + sal_False, + sal_False, + m_pTable->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); + xRet = pRet; + break; + } + } + } + + return xRet; +} + +// ------------------------------------------------------------------------- +void OColumns::impl_refresh() throw(RuntimeException) +{ + m_pTable->refreshColumns(); +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > OColumns::createEmptyObject() +{ + sdbcx::OColumn* pRet = new sdbcx::OColumn(m_pTable->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); + Reference< XPropertySet > xRet = pRet; + return xRet; +} + + diff --git a/connectivity/source/drivers/file/FConnection.cxx b/connectivity/source/drivers/file/FConnection.cxx new file mode 100644 index 000000000000..13295d74c3bb --- /dev/null +++ b/connectivity/source/drivers/file/FConnection.cxx @@ -0,0 +1,451 @@ +/************************************************************************* + * + * $RCSfile: FConnection.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_OCONNECTION_HXX_ +#include "file/FConnection.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_ODATABASEMETADATA_HXX_ +#include "file/FDatabaseMetaData.hxx" +#endif +#ifndef _CONNECTIVITY_RESOURCE_HRC_ +#include "Resource.hrc" +#endif +#ifndef _CONNECTIVITY_MODULECONTEXT_HXX_ +#include "ModuleContext.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_ODRIVER_HXX_ +#include "file/FDriver.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_OSTATEMENT_HXX_ +#include "file/FStatement.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_OPREPAREDSTATEMENT_HXX_ +#include "file/FPreparedStatement.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_ +#include <com/sun/star/container/XChild.hpp> +#endif +#ifndef _COM_SUN_STAR_UCB_XCONTENT_HPP_ +#include <com/sun/star/ucb/XContent.hpp> +#endif +#ifndef _COM_SUN_STAR_UCB_XCONTENTIDENTIFIER_HPP_ +#include <com/sun/star/ucb/XContentIdentifier.hpp> +#endif +#ifndef _URLOBJ_HXX //autogen wg. INetURLObject +#include <tools/urlobj.hxx> +#endif +#ifndef _FSYS_HXX //autogen +#include <tools/fsys.hxx> +#endif +#ifndef _CONNECTIVITY_FILE_CATALOG_HXX_ +#include "file/FCatalog.hxx" +#endif +#ifndef _COM_SUN_STAR_FRAME_XCONFIGMANAGER_HPP_ +#include <com/sun/star/frame/XConfigManager.hpp> +#endif +#ifndef _UCBHELPER_CONTENT_HXX +#include <ucbhelper/content.hxx> +#endif + +using namespace connectivity::file; + +//------------------------------------------------------------------------------ +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::sdbcx; +using namespace com::sun::star::container; +using namespace com::sun::star::ucb; +using namespace rtl; +// -------------------------------------------------------------------------------- +OConnection::OConnection(OFileDriver* _pDriver) + : OConnection_BASE(m_aMutex), + OSubComponent<OConnection>((::cppu::OWeakObject*)_pDriver), + m_pDriver(_pDriver), + m_bClosed(sal_False), + m_xMetaData(NULL) +{ + ModuleContext::AddRef(); +} +//----------------------------------------------------------------------------- +OConnection::~OConnection() +{ + if(!isClosed( )) + close(); + ModuleContext::ReleaseRef(); +} +//----------------------------------------------------------------------------- +void SAL_CALL OConnection::release() throw(RuntimeException) +{ + relase_ChildImpl(); + OConnection_BASE::release(); +} + +//----------------------------------------------------------------------------- +void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyValue >& info) throw(SQLException) +{ + osl_incrementInterlockedCount( &m_refCount ); + + sal_Int32 nLen = url.indexOf(':'); + nLen = url.indexOf(':',nLen+1); + ::rtl::OUString aDSN(url.copy(nLen+1)),aUID,aPWD; + + INetURLObject aURL; + aURL.SetSmartProtocol(INET_PROT_FILE); + aURL.SetURL(aDSN, INetURLObject::ENCODE_ALL); + + + // String aFileName = aURL.PathToFileName(); + String aFileName = aURL.GetMainURL(); + + if(!aFileName.Len()) + aFileName = aDSN; + String aWildcard; + + if (aURL.GetProtocol() == INET_PROT_FILE) + { + // $Inst muß gesetzt sein + // sehr umstaendlicher weg, um an den Inimanager zu kommen + // aber ohne Arme(Sfx) keine Kekse + Reference< ::com::sun::star::frame::XConfigManager > xSofficeIni( + m_pDriver->getFactory()->createInstance(rtl::OUString::createFromAscii("com.sun.star.config.SpecialConfigManager")), UNO_QUERY); + + aFileName = xSofficeIni->substituteVariables(aDSN); + } + + ::rtl::OUString aExt; + const PropertyValue *pBegin = info.getConstArray(); + const PropertyValue *pEnd = pBegin + info.getLength(); + for(;pBegin != pEnd;++pBegin) + { + if(!pBegin->Name.compareToAscii("EXTENSTION")) + pBegin->Value >>= aExt; + } + + m_aFilenameExtension = aExt; + + ::ucb::Content aFile(aFileName,Reference< ::com::sun::star::ucb::XCommandEnvironment >()); + +// if (aFileStat.IsKind(FSYS_KIND_WILD)) +// { +// m_aDirectoryName = (DirEntry(aFileName).GetPath()).GetFull(); +// m_aFilenameExtension = DirEntry(aFileName).GetExtension(); +// +// // nyi: Verschiedene Extensions (aufgrund des angegebenen Wildcard) +// // (bisher keine Wildcard in der Extension moeglich!) +// aWildcard = DirEntry(aFileName).GetName(); +// } else + + // set fields to fetch + Sequence< OUString > aProps(1); + OUString* pProps = aProps.getArray(); + pProps[ 0 ] = OUString::createFromAscii( "Title" ); + + if (aFile.isFolder()) + { + m_xDir = aFile.createCursor(aProps, ::ucb::INCLUDE_DOCUMENTS_ONLY ); + m_xContent = aFile.get(); + } + else if (aFile.isDocument()) + { + Reference<XContent> xParent(Reference<XChild>(aFile.get(),UNO_QUERY)->getParent(),UNO_QUERY); + Reference<XContentIdentifier> xIdent = xParent->getIdentifier(); + m_xContent = xParent; + + ::ucb::Content aParent(xIdent->getContentIdentifier(),Reference< XCommandEnvironment >()); + m_xDir = aParent.createCursor(aProps, ::ucb::INCLUDE_DOCUMENTS_ONLY ); + } + else + throw SQLException(); + + if (m_aFilenameExtension.Search('*') != STRING_NOTFOUND || m_aFilenameExtension.Search('?') != STRING_NOTFOUND) + throw SQLException(); + + osl_decrementInterlockedCount( &m_refCount ); +} +// XServiceInfo +// -------------------------------------------------------------------------------- +IMPLEMENT_SERVICE_INFO(OConnection, "com.sun.star.sdbc.drivers.file.Connection", "com.sun.star.sdbc.Connection") + +// -------------------------------------------------------------------------------- +Reference< XStatement > SAL_CALL OConnection::createStatement( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + OStatement* pStmt = new OStatement(this); + + m_aStatements.push_back(WeakReferenceHelper(*pStmt)); + return pStmt; +} +// -------------------------------------------------------------------------------- +Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + OPreparedStatement* pStmt = new OPreparedStatement(this,m_aTypeInfo); + pStmt->construct(sql); + m_aStatements.push_back(WeakReferenceHelper(*pStmt)); + return pStmt; +} +// -------------------------------------------------------------------------------- +Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + return NULL; +} +// -------------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OConnection::nativeSQL( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sql; +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::setAutoCommit( sal_Bool autoCommit ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_bAutoCommit = autoCommit; +} +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL OConnection::getAutoCommit( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_bAutoCommit; +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::commit( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::rollback( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + +} +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL OConnection::isClosed( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return OConnection_BASE::rBHelper.bDisposed; +} +// -------------------------------------------------------------------------------- +Reference< XDatabaseMetaData > SAL_CALL OConnection::getMetaData( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(!m_xMetaData.is()) + m_xMetaData = new ODatabaseMetaData(this); + + return m_xMetaData; +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::setReadOnly( sal_Bool readOnly ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_bReadOnly = readOnly; +} +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL OConnection::isReadOnly( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_bReadOnly; +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::setCatalog( const ::rtl::OUString& catalog ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); +} +// -------------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OConnection::getCatalog( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return ::rtl::OUString(); +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 level ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + +} +// -------------------------------------------------------------------------------- +sal_Int32 SAL_CALL OConnection::getTransactionIsolation( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return 0; +} +// -------------------------------------------------------------------------------- +Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OConnection::getTypeMap( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return NULL; +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::setTypeMap( const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException) +{ +} +// -------------------------------------------------------------------------------- +// XCloseable +void SAL_CALL OConnection::close( ) throw(SQLException, RuntimeException) +{ + { + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + } + dispose(); +} +// -------------------------------------------------------------------------------- +// XWarningsSupplier +Any SAL_CALL OConnection::getWarnings( ) throw(SQLException, RuntimeException) +{ + return Any(); +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::clearWarnings( ) throw(SQLException, RuntimeException) +{ +} +//------------------------------------------------------------------------------ +void OConnection::disposing() +{ + ::osl::MutexGuard aGuard(m_aMutex); + + + // m_aTables.disposing(); + for (OWeakRefArray::iterator i = m_aStatements.begin(); m_aStatements.end() != i; ++i) + { + Reference< XComponent > xComp(i->get(), UNO_QUERY); + if (xComp.is()) + xComp->dispose(); + } + m_aStatements.clear(); + + m_bClosed = sal_True; + m_xMetaData = NULL; + m_xDir = NULL; + + dispose_ChildImpl(); + OConnection_BASE::disposing(); +} +//------------------------------------------------------------------------------ +::com::sun::star::uno::Reference< XTablesSupplier > OConnection::createCatalog() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + Reference< XTablesSupplier > xTab = m_xCatalog; + if(!m_xCatalog.get().is()) + { + OFileCatalog *pCat = new OFileCatalog(this); + xTab = pCat; + m_xCatalog = xTab; + } + return xTab; +} + + diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx b/connectivity/source/drivers/file/FDatabaseMetaData.cxx new file mode 100644 index 000000000000..393273b485c4 --- /dev/null +++ b/connectivity/source/drivers/file/FDatabaseMetaData.cxx @@ -0,0 +1,1327 @@ +/************************************************************************* + * + * $RCSfile: FDatabaseMetaData.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_ODATABASEMETADATA_HXX_ +#include "file/FDatabaseMetaData.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_ORESULTSET_HXX_ +#include "file/FDatabaseMetaDataResultSet.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_ +#include <com/sun/star/sdbc/ResultSetType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_ +#include <com/sun/star/sdbc/ResultSetConcurrency.hpp> +#endif +#ifndef _COM_SUN_STAR_UCB_SEARCHRECURSION_HPP_ +#include <com/sun/star/ucb/SearchRecursion.hpp> +#endif +#ifndef _COM_SUN_STAR_UCB_SEARCHCOMMANDARGUMENT_HPP_ +#include <com/sun/star/ucb/SearchCommandArgument.hpp> +#endif +#ifndef _URLOBJ_HXX //autogen wg. INetURLObject +#include <tools/urlobj.hxx> +#endif + +using namespace com::sun::star::ucb; +using namespace connectivity::file; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::sdbcx; +using namespace com::sun::star::container; + +ODatabaseMetaData::ODatabaseMetaData(OConnection* _pCon) + : m_pConnection(_pCon) +{ + m_pConnection->acquire(); +} +// ------------------------------------------------------------------------- +ODatabaseMetaData::~ODatabaseMetaData() +{ + if (m_pConnection) + m_pConnection->release(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openTypeInfo(); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openCatalogs(); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogSeparator( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + ::rtl::OUString aVal; + return aVal; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openSchemas(); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, + const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openColumnPrivileges(catalog,schema,table,columnNamePattern); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, + const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openColumns(catalog,schemaPattern,tableNamePattern,columnNamePattern); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( + const Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(); + Reference< XResultSet > xRef = pResult; + pResult->setTablesMap(); +#if 0 + ORows aRows; + + Reference<XContent> xContent = m_pConnection->getContent(); + + Sequence<RuleTerm> aRules(1); + aRules[0].Property = OUString::createFromAscii( "Title" ); + aRules[0].Operand <<= tableNamePattern; + aRules[0].Operator = + aRules[0].CaseSensitive + aRules[0].RegularExpression = sal_False; + + SearchCriterium aCrit(aRules); + + SearchInfo aInfo; + aInfo.Recursion = 0; + aInfo.IncludeBase = sal_False; + aInfo.RespectFolderViewRestrictions = sal_False; + aInfo.RespectDocViewRestrictions = sal_False; + aInfo.FollowIndirections = sal_False; + + Sequence<Property> aProps(1); + aProps[0].Name = OUString::createFromAscii( "Title" ); + aProps[0].Type = ::getCppuType((OUString*)0); + + SearchCommandArgument aArg(aInfo,aProps); + + String aFilenameExtension = m_pConnection->getExtension(); + + + pDir->SetSort(FSYS_SORT_NAME | FSYS_SORT_ASCENDING | FSYS_SORT_END); + pDir->Update(); + + ::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE")); + for (sal_uInt16 nDirPos = 0; nDirPos < pDir->Count(); nDirPos++) + { + ORow aRow(3); + if (aFilenameExtension.Len()) + { + if(match(tableNamePattern,(*pDir)[nDirPos].GetBase().GetBuffer(),'\0')) + aRow.push_back(makeAny(::rtl::OUString((*pDir)[nDirPos].GetBase()))); + } + else // keine extension, dann selbst filtern + { + do + { + DirEntry aEntry = (*pDir)[nDirPos]; + if (!(*pDir)[nDirPos].GetExtension().Len()) + { + if(match(tableNamePattern,(*pDir)[nDirPos].GetBase().GetBuffer(),'\0')) + aRow.push_back(makeAny(::rtl::OUString((*pDir)[nDirPos].GetBase()))); + break; + } + else + nDirPos++; + } while ((unsigned int)nDirPos < pDir->Count()); + } + aRow.push_back(makeAny(aTable)); + aRow.push_back(Any()); + aRows.push_back(aRow); + } + + pResult->setRows(aRows); +#endif + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns( + const Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openProcedureColumns(catalog,schemaPattern,procedureNamePattern,columnNamePattern); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures( + const Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& procedureNamePattern ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openProcedures(catalog,schemaPattern,procedureNamePattern); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getVersionColumns( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openVersionColumns(catalog,schema,table); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return STRING_MAXLEN; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTablesInSelect( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 1; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openExportedKeys(catalog,schema,table); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openImportedKeys(catalog,schema,table); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openPrimaryKeys(catalog,schema,table); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, + sal_Bool unique, sal_Bool approximate ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openIndexInfo(catalog,schema,table,unique,approximate); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getBestRowIdentifier( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope, + sal_Bool nullable ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openBestRowIdentifier(catalog,schema,table,scope,nullable); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openTablePrivileges(catalog,schemaPattern,tableNamePattern); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference( + const Any& primaryCatalog, const ::rtl::OUString& primarySchema, + const ::rtl::OUString& primaryTable, const Any& foreignCatalog, + const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +// OResultSet* pResult = new OResultSet(hStmt); +// Reference< XResultSet > xRef = pResult; +// pResult->openForeignKeys(primaryCatalog,primarySchema.toChar() == '%' ? &primarySchema : NULL,&primaryTable, +// foreignCatalog, foreignSchema.toChar() == '%' ? &foreignSchema : NULL,&foreignTable); +// return xRef; + return Reference< XResultSet >(); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsAlterTableWithAddColumn( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsAlterTableWithDropColumn( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getIdentifierQuoteString( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString::createFromAscii("\""); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::isCatalogAtStart( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInDataManipulation( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInTableDefinitions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInTableDefinitions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInDataManipulation( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(); + Reference< XResultSet > xRef = pResult; + pResult->setTableTypes(); + ORows aRows; + ORow aRow; + aRow.push_back(Any()); + aRow.push_back(makeAny(::rtl::OUString::createFromAscii("TABLE"))); + aRows.push_back(aRow); + pResult->setRows(aRows); + return xRef; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatements( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getURL( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + ::rtl::OUString aValue = ::rtl::OUString::createFromAscii("sdbc:file:"); + return aValue; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverVersion( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString::valueOf((sal_Int32)1); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString::valueOf((sal_Int32)0); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + switch(setType) + { + case ResultSetType::FORWARD_ONLY: + return sal_True; + break; + case ResultSetType::SCROLL_INSENSITIVE: + break; + case ResultSetType::SCROLL_SENSITIVE: + break; + } + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const Sequence< sal_Int32 >& types ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XConnection > SAL_CALL ODatabaseMetaData::getConnection( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return (Reference< XConnection >)m_pConnection;//new OConnection(m_aConnectionHandle); +} +// ------------------------------------------------------------------------- + + diff --git a/connectivity/source/drivers/file/FDriver.cxx b/connectivity/source/drivers/file/FDriver.cxx new file mode 100644 index 000000000000..254fd36a9238 --- /dev/null +++ b/connectivity/source/drivers/file/FDriver.cxx @@ -0,0 +1,219 @@ +/************************************************************************* + * + * $RCSfile: FDriver.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_ODRIVER_HXX_ +#include "file/FDriver.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_OCONNECTION_HXX_ +#include "file/FConnection.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif + +using namespace connectivity::file; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::sdbcx; +using namespace com::sun::star::container; +// -------------------------------------------------------------------------------- +OFileDriver::OFileDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) + : ODriver_BASE(m_aMutex) + ,m_xFactory(_rxFactory) +{ +} +// -------------------------------------------------------------------------------- +void OFileDriver::disposing() +{ + ::osl::MutexGuard aGuard(m_aMutex); + + + for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i) + { + Reference< XComponent > xComp(i->get(), UNO_QUERY); + if (xComp.is()) + xComp->dispose(); + } + m_xConnections.clear(); + + ODriver_BASE::disposing(); +} + +// static ServiceInfo +//------------------------------------------------------------------------------ +rtl::OUString OFileDriver::getImplementationName_Static( ) throw(RuntimeException) +{ + return rtl::OUString::createFromAscii("com.sun.star.sdbc.driver.file.Driver"); +} +//------------------------------------------------------------------------------ +Sequence< ::rtl::OUString > OFileDriver::getSupportedServiceNames_Static( ) throw (RuntimeException) +{ + Sequence< ::rtl::OUString > aSNS( 2 ); + aSNS[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.Driver"); + aSNS[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.Driver"); + return aSNS; +} + +//------------------------------------------------------------------ +::rtl::OUString SAL_CALL OFileDriver::getImplementationName( ) throw(RuntimeException) +{ + return getImplementationName_Static(); +} + +//------------------------------------------------------------------ +sal_Bool SAL_CALL OFileDriver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) +{ + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + const ::rtl::OUString* pSupported = aSupported.getConstArray(); + for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) + if (pSupported->equals(_rServiceName)) + return sal_True; + + return sal_False; +} + +//------------------------------------------------------------------ +Sequence< ::rtl::OUString > SAL_CALL OFileDriver::getSupportedServiceNames( ) throw(RuntimeException) +{ + return getSupportedServiceNames_Static(); +} + +// -------------------------------------------------------------------------------- +Reference< XConnection > SAL_CALL OFileDriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODriver_BASE::rBHelper.bDisposed) + throw DisposedException(); + + OConnection* pCon = new OConnection(this); + pCon->construct(url,info); + Reference< XConnection > xCon = pCon; + m_xConnections.push_back(WeakReferenceHelper(*pCon)); + + return xCon; +} +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL OFileDriver::acceptsURL( const ::rtl::OUString& url ) + throw(SQLException, RuntimeException) +{ + if(!url.compareTo(::rtl::OUString::createFromAscii("sdbc:file:"),10)) + { + return sal_True; + } + return sal_False; +} +// -------------------------------------------------------------------------------- +Sequence< DriverPropertyInfo > SAL_CALL OFileDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) +{ + return Sequence< DriverPropertyInfo >(); +} +// -------------------------------------------------------------------------------- +sal_Int32 SAL_CALL OFileDriver::getMajorVersion( ) throw(RuntimeException) +{ + return 1; +} +// -------------------------------------------------------------------------------- +sal_Int32 SAL_CALL OFileDriver::getMinorVersion( ) throw(RuntimeException) +{ + return 0; +} +// -------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------- +// XDataDefinitionSupplier +Reference< XTablesSupplier > SAL_CALL OFileDriver::getDataDefinitionByConnection( const Reference< ::com::sun::star::sdbc::XConnection >& connection ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (ODriver_BASE::rBHelper.bDisposed) + throw DisposedException(); + + OConnection* pConnection = NULL; + for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i) + { + if ((OConnection*) Reference< XConnection >::query(i->get().get()).get() == (OConnection*)connection.get()) + { + pConnection = (OConnection*)connection.get(); + break; + } + } + + Reference< XTablesSupplier > xTab = NULL; + if(pConnection) + xTab = pConnection->createCatalog(); + return xTab; +} + +//------------------------------------------------------------------ +Any SAL_CALL OFileDriver::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = ::cppu::queryInterface(rType, static_cast<XDataDefinitionSupplier*>(this)); + if(aRet.hasValue()) + return aRet; + return ODriver_BASE::queryInterface(rType); +} +// -------------------------------------------------------------------------------- +Reference< XTablesSupplier > SAL_CALL OFileDriver::getDataDefinitionByURL( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) +{ + return getDataDefinitionByConnection(connect(url,info)); +} + + diff --git a/connectivity/source/drivers/file/FPreparedStatement.cxx b/connectivity/source/drivers/file/FPreparedStatement.cxx new file mode 100644 index 000000000000..20203d7b643c --- /dev/null +++ b/connectivity/source/drivers/file/FPreparedStatement.cxx @@ -0,0 +1,473 @@ +/************************************************************************* + * + * $RCSfile: FPreparedStatement.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif +#ifndef _CONNECTIVITY_FILE_OPREPAREDSTATEMENT_HXX_ +#include "file/FPreparedStatement.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _CONNECTIVITY_FILE_ORESULTSETMETADATA_HXX_ +#include "file/FResultSetMetaData.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +#ifndef _CONNECTIVITY_DATECONVERSION_HXX_ +#include "DateConversion.hxx" +#endif + +using namespace connectivity; +using namespace connectivity::file; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::sdbcx; +using namespace com::sun::star::container; +using namespace com::sun::star::util; + +IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbc.driver.file.PreparedStatement","com.sun.star.sdbc.PreparedStatement"); + +OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const ::std::vector<OTypeInfo>& _TypeInfo) + : OStatement_BASE2( _pConnection ) + ,m_pResultSet(NULL) +{ +} +// ------------------------------------------------------------------------- +void OPreparedStatement::construct(const ::rtl::OUString& sql) throw(SQLException, RuntimeException) +{ + String aErr; + m_pParseTree = m_aParser.parseTree(aErr,sql); + if(m_pParseTree) + { + m_aSQLIterator.setParseTree(m_pParseTree); + m_aSQLIterator.traverseAll(); + const OSQLTables& xTabs = m_aSQLIterator.getTables(); + if(xTabs.begin() == xTabs.end()) + throw SQLException(aErr,*this,::rtl::OUString(),0,Any()); + + m_pResultSet = new OResultSet(this,m_aSQLIterator); + if(m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT || + m_aSQLIterator.getStatementType() == SQL_STATEMENT_UPDATE) + m_pResultSet->describeParameter(); + m_aRow = new OValueVector(); + m_xRS = m_pResultSet; + + } + else + throw SQLException(aErr,*this,::rtl::OUString(),0,Any()); +} +// ------------------------------------------------------------------------- + +Any SAL_CALL OPreparedStatement::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = OStatement_BASE2::queryInterface(rType); + if(!aRet.hasValue()) + aRet = ::cppu::queryInterface( rType, + static_cast< XPreparedStatement*>(this), + static_cast< XParameters*>(this), + static_cast< XResultSetMetaDataSupplier*>(this)); + return aRet; +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OPreparedStatement::getTypes( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< XPreparedStatement > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< XParameters > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< XResultSetMetaDataSupplier > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),OStatement_BASE2::getTypes()); +} +// ------------------------------------------------------------------------- + +Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( ) throw(SQLException, RuntimeException) +{ + if(m_xMetaData.is()) + m_xMetaData = new OResultSetMetaData(m_aSQLIterator.getSelectColumns().getBody(),m_aSQLIterator.getTables().begin()->first); + return m_xMetaData; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::close( ) throw(SQLException, RuntimeException) +{ + m_xRS = NULL; + clearMyResultSet(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeException) +{ + sal_Bool hasResultSet = sal_False; + SQLWarning warning; + sal_Bool needData = sal_False; + + m_pResultSet->setParameterRow(m_aRow); + m_pResultSet->OpenImpl(); + return m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT || m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT_COUNT; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, RuntimeException) +{ + m_pResultSet->setParameterRow(m_aRow); + m_pResultSet->OpenImpl(); + return m_pResultSet->getRowCountResult(); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + if(parameterIndex >= m_aRow->size()) + m_aRow->push_back(x); + else + (*m_aRow)[parameterIndex] = x; +} +// ------------------------------------------------------------------------- + +Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQLException, RuntimeException) +{ + return (Reference< XConnection >)m_pConnection; +} +// ------------------------------------------------------------------------- + +Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLException, RuntimeException) +{ + Reference< XResultSet > rs = m_pResultSet; + m_pResultSet->setParameterRow(m_aRow); + m_pResultSet->OpenImpl(); + return rs; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + if(parameterIndex >= m_aRow->size()) + m_aRow->push_back(x); + else + (*m_aRow)[parameterIndex] = x; +} +// ------------------------------------------------------------------------- +void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + if(parameterIndex >= m_aRow->size()) + m_aRow->push_back((sal_Int32)x); + else + (*m_aRow)[parameterIndex] = (sal_Int32)x; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const Date& aData ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + if(parameterIndex >= m_aRow->size()) + m_aRow->push_back(DateConversion::toDouble(aData)); + else + (*m_aRow)[parameterIndex] = DateConversion::toDouble(aData); +} +// ------------------------------------------------------------------------- + + +void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const Time& aVal ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + if(parameterIndex >= m_aRow->size()) + m_aRow->push_back(DateConversion::toDouble(aVal)); + else + (*m_aRow)[parameterIndex] = DateConversion::toDouble(aVal); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const DateTime& aVal ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + if(parameterIndex >= m_aRow->size()) + m_aRow->push_back(DateConversion::toDouble(aVal)); + else + (*m_aRow)[parameterIndex] = DateConversion::toDouble(aVal); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + if(parameterIndex >= m_aRow->size()) + m_aRow->push_back(x); + else + (*m_aRow)[parameterIndex] = x; +} + +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + if(parameterIndex >= m_aRow->size()) + m_aRow->push_back((double)x); + else + (*m_aRow)[parameterIndex] = (double)x; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + if(parameterIndex >= m_aRow->size()) + m_aRow->push_back(x); + else + (*m_aRow)[parameterIndex] = x; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 aVal ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex || parameterIndex > m_aRow->size()) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(SQLException, RuntimeException) +{ + // Get the buffer needed for the length + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + if(parameterIndex >= m_aRow->size()) + m_aRow->push_back(OFileValue()); + else + (*m_aRow)[parameterIndex].setNull(); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Reference< XClob >& x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex || parameterIndex >= m_aRow->size()) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Reference< XBlob >& x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex || parameterIndex >= m_aRow->size()) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setArray( sal_Int32 parameterIndex, const Reference< XArray >& x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex || parameterIndex >= m_aRow->size()) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setRef( sal_Int32 parameterIndex, const Reference< XRef >& x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex || parameterIndex >= m_aRow->size()) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 sqlType, sal_Int32 scale ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + // For each known SQL Type, call the appropriate + // set routine + + switch (sqlType) + { + case DataType::CHAR: + case DataType::VARCHAR: + case DataType::LONGVARCHAR: + (*m_aRow)[parameterIndex] = *(::rtl::OUString*) x.getValue(); + break; + case DataType::BIT: + (*m_aRow)[parameterIndex] = *(sal_Bool*) x.getValue(); + break; + + case DataType::TINYINT: + case DataType::SMALLINT: + case DataType::INTEGER: + (*m_aRow)[parameterIndex] = *(sal_Int32*)x.getValue(); + break; + + case DataType::BIGINT: + case DataType::REAL: + case DataType::FLOAT: + case DataType::DOUBLE: + (*m_aRow)[parameterIndex] = *(double*)x.getValue(); + break; + + case DataType::BINARY: + break; + + case DataType::VARBINARY: + case DataType::LONGVARBINARY: + break; + + case DataType::DATE: + (*m_aRow)[parameterIndex] = DateConversion::toDouble(*(Date*) x.getValue()); + break; + + case DataType::TIME: + (*m_aRow)[parameterIndex] = DateConversion::toDouble(*(Time*)x.getValue()); + break; + + case DataType::TIMESTAMP: + (*m_aRow)[parameterIndex] = DateConversion::toDouble(*(DateTime*)x.getValue()); + break; + + default: + { + ::rtl::OUString aVal = ::rtl::OUString::createFromAscii("Unknown SQL Type for PreparedStatement.setObject (SQL Type="); + aVal += ::rtl::OUString::valueOf(sqlType); + throw SQLException( aVal,*this,::rtl::OUString(),0,Any()); + } + + } +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + if(parameterIndex >= m_aRow->size()) + m_aRow->push_back(OFileValue()); + else + (*m_aRow)[parameterIndex].setNull(); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex || parameterIndex >= m_aRow->size()) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + // setObject (parameterIndex, x, sqlType, 0); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + setInt(parameterIndex,x); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex || parameterIndex >= m_aRow->size()) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); +} +// ------------------------------------------------------------------------- + + +void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex || parameterIndex >= m_aRow->size()) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) +{ + if( !parameterIndex || parameterIndex >= m_aRow->size()) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::clearParameters( ) throw(SQLException, RuntimeException) +{ + m_aRow->clear(); +} + + diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx new file mode 100644 index 000000000000..ee25dfe374a3 --- /dev/null +++ b/connectivity/source/drivers/file/FResultSet.cxx @@ -0,0 +1,2297 @@ +/************************************************************************* + * + * $RCSfile: FResultSet.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef _CONNECTIVITY_FILE_ORESULTSET_HXX_ +#include "file/FResultSet.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_ORESULTSETMETADATA_HXX_ +#include "file/FResultSetMetaData.hxx" +#endif +#ifndef _COM_SUN_STAR_SQLC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif +#ifndef _UTL_PROPERTY_HXX_ +#include <unotools/property.hxx> +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ +#include <com/sun/star/beans/PropertyAttribute.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_ +#include <com/sun/star/container/XIndexAccess.hpp> +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _CONNECTIVITY_DATECONVERSION_HXX_ +#include "DateConversion.hxx" +#endif +#ifndef _CONNECTIVITY_DBASE_INDEX_HXX_ +#include "dbase/DIndex.hxx" +#endif +#ifndef _CONNECTIVITY_DBASE_INDEXITER_HXX_ +#include "dbase/DIndexIter.hxx" +#endif +#ifndef _ITERATOR_ +#include <iterator> +#endif +using namespace connectivity; +using namespace connectivity::file; +using namespace cppu; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::sdbcx; +using namespace com::sun::star::container; + +// Maximale Anzahl von Rows, die mit ORDER BY sortiert durchlaufen werden koennen: +#if defined (WIN) +#define MAX_KEYSET_SIZE 0x3ff0 // Etwas weniger als ein Segment, damit + // noch Platz fuer Memory Debug-Informationen +#else +#define MAX_KEYSET_SIZE 0x40000 // 256K +#endif +//------------------------------------------------------------------------------ +IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.drivers.file.ResultSet","com.sun.star.sdbc.ResultSet"); +// ------------------------------------------------------------------------- +OResultSet::OResultSet(OStatement_Base* pStmt,OSQLParseTreeIterator& _aSQLIterator) : OResultSet_BASE(m_aMutex) + ,connectivity::OSimplePropertyContainer(OResultSet_BASE::rBHelper) + ,m_aStatement((OWeakObject*)pStmt) + ,m_nRowPos(-1) + ,m_bLastRecord(sal_False) + ,m_bEOF(sal_False) + ,m_xDBMetaData(pStmt->getConnection()->getMetaData()) + ,m_xMetaData(NULL) + ,m_aSQLIterator(_aSQLIterator) + ,m_pTable(NULL) + ,m_nRowCountResult(-1) + ,m_nFilePos(0) + ,m_nLastVisitedPos(-1) + ,m_pParseTree(pStmt->getParseTree()) + ,m_pFileSet(NULL) + ,m_pEvaluationKeySet(NULL) + ,m_pSortIndex(NULL) + ,m_aAssignValues(NULL) +{ + osl_incrementInterlockedCount( &m_refCount ); + + + for (int jj = 0; jj < sizeof nOrderbyColumnNumber / sizeof (* nOrderbyColumnNumber); jj++) + { + nOrderbyColumnNumber[jj] = SQL_COLUMN_NOTFOUND; + bOrderbyAscending[jj] = TRUE; + } + construct(); + osl_decrementInterlockedCount( &m_refCount ); +} + +// ------------------------------------------------------------------------- +OResultSet::~OResultSet() +{ +} +// ------------------------------------------------------------------------- +void OResultSet::construct() +{ + registerProperty(PROPERTY_FETCHSIZE, PROPERTY_ID_FETCHSIZE, 0,&m_nFetchSize, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(PROPERTY_RESULTSETTYPE, PROPERTY_ID_RESULTSETTYPE, PropertyAttribute::READONLY,&m_nResultSetType, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(PROPERTY_FETCHDIRECTION, PROPERTY_ID_FETCHDIRECTION, 0,&m_nFetchDirection, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(PROPERTY_RESULTSETCONCURRENCY, PROPERTY_ID_RESULTSETCONCURRENCY, PropertyAttribute::READONLY,&m_nResultSetConcurrency, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); +} +// ------------------------------------------------------------------------- +void OResultSet::disposing(void) +{ + OPropertySetHelper::disposing(); + + ::osl::MutexGuard aGuard(m_aMutex); + m_aStatement = NULL; + m_xMetaData = NULL; + m_pParseTree = NULL; + if(m_pTable) + { + m_pTable->release(); + m_pTable = NULL; + } + DELETEZ(m_pFileSet); + DELETEZ(m_pEvaluationKeySet); + DELETEZ(m_pSortIndex); + + m_aRow->clear(); + m_aEvaluateRow->clear(); + m_aAssignValues->clear(); + m_xParamColumns->clear(); +} +// ------------------------------------------------------------------------- +Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + Any aRet = OPropertySetHelper::queryInterface(rType); + if(!aRet.hasValue()) + aRet = OResultSet_BASE::queryInterface(rType); + return aRet; +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OResultSet::getTypes( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),OResultSet_BASE::getTypes()); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + Reference< XResultSetMetaData > xMeta = getMetaData(); + sal_Int32 nLen = xMeta->getColumnCount(); + sal_Int32 i = 1; + for(;i<=nLen;++i) + if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) : columnName.equalsIgnoreCase(xMeta->getColumnName(i))) + break; + return i; +} +// ------------------------------------------------------------------------- +Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + return NULL; +} +// ------------------------------------------------------------------------- +Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + return NULL; +} + +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + m_bWasNull = (*m_aRow)[columnIndex].isNull(); + return (*m_aRow)[columnIndex]; +} +// ------------------------------------------------------------------------- + +sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + m_bWasNull = (*m_aRow)[columnIndex].isNull(); + return (*m_aRow)[columnIndex].getInt32(); +} +// ------------------------------------------------------------------------- + +Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + return Sequence< sal_Int8 >(); +} +// ------------------------------------------------------------------------- + +::com::sun::star::util::Date SAL_CALL OResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + m_bWasNull = (*m_aRow)[columnIndex].isNull(); + + return DateConversion::toDate((*m_aRow)[columnIndex]); +} +// ------------------------------------------------------------------------- + +double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + m_bWasNull = (*m_aRow)[columnIndex].isNull(); + return (*m_aRow)[columnIndex]; +} +// ------------------------------------------------------------------------- + +float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + m_bWasNull = (*m_aRow)[columnIndex].isNull(); + return (*m_aRow)[columnIndex].getDouble(); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + m_bWasNull = (*m_aRow)[columnIndex].isNull(); + return (*m_aRow)[columnIndex]; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_nRowPos; +} +// ------------------------------------------------------------------------- + +sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + return sal_Int64(); +} +// ------------------------------------------------------------------------- + +Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if(!m_xMetaData.is()) + m_xMetaData = new OResultSetMetaData(m_xColumns.getBody(),m_aSQLIterator.getTables().begin()->first); + return m_xMetaData; +} +// ------------------------------------------------------------------------- +Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + return NULL; +} + +// ------------------------------------------------------------------------- + +Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + return NULL; +} +// ------------------------------------------------------------------------- + +Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + return NULL; +} +// ------------------------------------------------------------------------- + +Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + return Any(); +} +// ------------------------------------------------------------------------- + +sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + m_bWasNull = (*m_aRow)[columnIndex].isNull(); + return (*m_aRow)[columnIndex].getInt32(); +} +// ------------------------------------------------------------------------- + + +::rtl::OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + m_bWasNull = (*m_aRow)[columnIndex].isNull(); + return (*m_aRow)[columnIndex]; +} + +// ------------------------------------------------------------------------- + + +::com::sun::star::util::Time SAL_CALL OResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + return DateConversion::toTime((*m_aRow)[columnIndex]); +} +// ------------------------------------------------------------------------- + + +::com::sun::star::util::DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + columnIndex = mapColumn(columnIndex); + return DateConversion::toDateTime((*m_aRow)[columnIndex]); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::isAfterLast( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::isFirst( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_nRowPos == 1; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::isLast( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_bEOF; +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::beforeFirst( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(first()) + previous(); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::afterLast( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(last()) + next(); + m_bEOF = sal_True; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException) +{ + { + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + } + dispose(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return Move(OFileTable::FILE_FIRST,1,sal_True); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + // here I know definitely that I stand on the last record + return Move(OFileTable::FILE_LAST,1,sal_True); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return Move(OFileTable::FILE_ABSOLUTE,row,sal_True); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return Move(OFileTable::FILE_RELATIVE,row,sal_True); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + --m_nRowPos; + return sal_True; +} +// ------------------------------------------------------------------------- +Reference< XInterface > SAL_CALL OResultSet::getStatement( ) throw(SQLException, RuntimeException) +{ + return m_aStatement.get(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::rowDeleted( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::rowInserted( ) throw(SQLException, RuntimeException) +{ ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::rowUpdated( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return sal_False; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_nRowPos == 0; +} +// ------------------------------------------------------------------------- +sal_Bool OResultSet::evaluate() +{ + sal_Bool bRet = sal_True; + while(!m_aSQLAnalyzer.evaluateRestriction()) + { + if(m_pEvaluationKeySet) + { + if(m_aEvaluateIter == m_pEvaluationKeySet->end()) + return sal_False; + bRet = m_pTable->seekRow(OFileTable::FILE_BOOKMARK,(*m_aEvaluateIter),m_nRowPos); + ++m_aEvaluateIter; + } + else + bRet = m_pTable->seekRow(OFileTable::FILE_NEXT,1,m_nRowPos); + if(bRet) + { + if(m_pEvaluationKeySet) + { + bRet = m_pTable->fetchRow(m_aEvaluateRow,m_pTable->getTableColumns().getBody(),sal_True); + evaluate(); + + } + else + bRet = m_pTable->fetchRow(m_aRow,m_xColumns.getBody(),sal_True); + } + } + + return bRet; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(!m_pTable) + return sal_False; + + return Move(OFileTable::FILE_NEXT,1,sal_True); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::wasNull( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_bWasNull; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::cancel( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::clearWarnings( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- +Any SAL_CALL OResultSet::getWarnings( ) throw(SQLException, RuntimeException) +{ + return Any(); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateRow( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::deleteRow( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::cancelRowUpdates( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::moveToInsertRow( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::moveToCurrentRow( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); + throw RuntimeException(); +} +// ----------------------------------------------------------------------- +void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 scale ) throw(SQLException, RuntimeException) +{ + columnIndex = mapColumn(columnIndex); + OSL_ENSHURE(0,"OResultSet::updateNumericObject: NYI"); +} +// ------------------------------------------------------------------------- +IPropertyArrayHelper* OResultSet::createArrayHelper( ) const +{ + Sequence< Property > aProps; + describeProperties(aProps); + return new ::cppu::OPropertyArrayHelper(aProps); +} +// ------------------------------------------------------------------------- +IPropertyArrayHelper & OResultSet::getInfoHelper() +{ + return *const_cast<OResultSet*>(this)->getArrayHelper(); +} + +//------------------------------------------------------------------ +BOOL OResultSet::ExecuteRow(OFileTable::FilePosition eFirstCursorPosition, + INT32 nFirstOffset, + BOOL bRebind, + BOOL bEvaluate, + BOOL bRetrieveData) +{ + + // Fuer weitere Fetch-Operationen werden diese Angaben ggf. veraendert ... + OFileTable::FilePosition eCursorPosition = eFirstCursorPosition; + INT32 nOffset = nFirstOffset; + UINT32 nLoopCount = 0; + +again: + + // protect from reading over the end when someboby is inserting while we are reading + // this method works only for dBase at the moment !!!! + if (eCursorPosition == OFileTable::FILE_NEXT && m_nFilePos == m_nLastVisitedPos) + { + return sal_False; + } + + if (!m_pTable->seekRow(eCursorPosition, nOffset, m_nFilePos)) + { + return sal_False; + } + + if (!bEvaluate) // Laeuft keine Auswertung, dann nur Ergebniszeile fuellen + { + m_pTable->fetchRow(m_aRow,m_pTable->getTableColumns().getBody(), bRetrieveData); + + // if (bShowDeleted && m_aRow->isDeleted()) + // m_aRow->setState(ROW_DELETED); + } + else + { + m_pTable->fetchRow(m_aEvaluateRow, m_pTable->getTableColumns().getBody(), TRUE); + + if (m_aSQLAnalyzer.hasRestriction() && //!bShowDeleted && m_aEvaluateRow->isDeleted() ||// keine Anzeige von geloeschten Sätzen + !m_aSQLAnalyzer.evaluateRestriction()) // Auswerten der Bedingungen + { // naechsten Satz auswerten + // aktuelle Zeile loeschen im Keyset + OSL_ENSHURE(!m_pFileSet || + // !m_pFileSet->IsFrozen() || + eCursorPosition == OFileTable::FILE_NEXT, "Falsche CursorPosition!"); + + if (m_pEvaluationKeySet) + { + ++m_aEvaluateIter; + if (m_pEvaluationKeySet->end() != m_aEvaluateIter) + nOffset = (*m_aEvaluateIter); + else + { + return sal_False; + } + } + else if (m_pFileSet) + { + OSL_ENSHURE(//!m_pFileSet->IsFrozen() && + eCursorPosition == OFileTable::FILE_NEXT, "Falsche CursorPosition!"); + eCursorPosition = OFileTable::FILE_NEXT; + nOffset = 1; + } + else if (eCursorPosition == OFileTable::FILE_FIRST || + eCursorPosition == OFileTable::FILE_NEXT || + eCursorPosition == OFileTable::FILE_ABSOLUTE) + { + eCursorPosition = OFileTable::FILE_NEXT; + nOffset = 1; + } + else if (eCursorPosition == OFileTable::FILE_LAST || + eCursorPosition == OFileTable::FILE_PRIOR) + { + eCursorPosition = OFileTable::FILE_PRIOR; + nOffset = 1; + } + else if (eCursorPosition == OFileTable::FILE_RELATIVE) + { + eCursorPosition = (nOffset >= 0) ? OFileTable::FILE_NEXT : OFileTable::FILE_PRIOR; + } + else + { + // aStatus.Set(SQL_STAT_NO_DATA_FOUND); + return sal_False; + } + // Nochmal probieren ... + goto again; + } + } + // Evaluate darf nur gesetzt sein, + // wenn der Keyset weiter aufgebaut werden soll + if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT && + (m_pFileSet || m_pSortIndex) && bEvaluate) + { + if (m_pSortIndex) + { + OFILEKeyValue* pKeyValue = GetOrderbyKeyValue(m_aEvaluateRow); + if (!m_pSortIndex->AddKeyValue(pKeyValue)) + { + // Ueberwachung auf Ueberschreitung der Index-Kapazitaet: + } + } + else if (m_pFileSet) + { + // OSL_ENSHURE(!m_pFileSet->IsFrozen() , "Falsche CursorPosition!"); + sal_uInt32 nBookmarkValue = Abs((sal_Int32)(*m_aEvaluateRow)[0]); + m_pFileSet->push_back(nBookmarkValue); + } + } + else if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_UPDATE) + { + sal_Bool bOK = sal_True; + if (bEvaluate) + { + // jetzt die eigentliche Ergebniszeile Lesen + bOK = m_pTable->fetchRow(m_aEvaluateRow, m_pTable->getTableColumns().getBody(), TRUE); + } + + if (bOK) + { + // Nur die zu aendernden Werte uebergeben: + if(!m_pTable->UpdateRow(m_aAssignValues.getBody(),m_aEvaluateRow,Reference<XIndexAccess>(m_xColNames,UNO_QUERY))) + return sal_False; + } + } + else if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_DELETE) + { + sal_Bool bOK = sal_True; + if (bEvaluate) + { + bOK = m_pTable->fetchRow(m_aEvaluateRow, m_pTable->getTableColumns().getBody(), TRUE); + } + if (bOK) + { + if(!m_pTable->DeleteRow(m_xColumns.getBody())) + return sal_False; + } + } + return sal_True; +} + +//------------------------------------------------------------------- +BOOL OResultSet::Move(OFileTable::FilePosition eCursorPosition, INT32 nOffset, BOOL bRetrieveData) +{ + +IgnoreDeletedRows: + + INT32 nTempPos = m_nRowPos; + // exclusiver zugriff auf die Tabelle + // NAMESPACE_VOS(OGuard)* pGuard = m_pTable->Lock(); + + if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT) + { + if (m_pFileSet == NULL) // kein Index verfuegbar + { + // Normales FETCH + ExecuteRow(eCursorPosition,nOffset,TRUE,FALSE,bRetrieveData); + + // now set the bookmark for outside + (*m_aRow->begin()) = sal_Int32(m_nRowPos + 1); + } + else + { + switch(eCursorPosition) + { + case OFileTable::FILE_NEXT: + m_nRowPos++; + break; + case OFileTable::FILE_PRIOR: + if (m_nRowPos >= 0) + m_nRowPos--; + break; + case OFileTable::FILE_FIRST: + m_nRowPos = 0; + break; + case OFileTable::FILE_LAST: + // OSL_ENSHURE(IsRowCountFinal(), "Fehler im Keyset!"); // muß eingefroren sein, sonst Fehler beim SQLCursor + m_nRowPos = m_pFileSet->size() - 1; + break; + case OFileTable::FILE_RELATIVE: + m_nRowPos += nOffset; + break; + case OFileTable::FILE_ABSOLUTE: + m_nRowPos = nOffset - 1; + break; + case OFileTable::FILE_BOOKMARK: + m_nRowPos = nOffset - 1; + break; + } + + // OffRange? + // Der FileCursor ist außerhalb des gueltigen Bereichs, wenn + // a.) m_nRowPos < 1 + // b.) Ein KeySet besteht und m_nRowPos > m_pFileSet->size() + if (m_nRowPos < 0 || (m_pFileSet->isFrozen() && eCursorPosition != OFileTable::FILE_BOOKMARK && m_nRowPos >= (INT32)m_pFileSet->size() )) // && m_pFileSet->IsFrozen() + { + // aStatus.Set(SQL_STAT_NO_DATA_FOUND); + goto Error; + } + else + { + if (m_nRowPos < (INT32)m_pFileSet->size()) + { + // Fetch ueber Index + ExecuteRow(OFileTable::FILE_BOOKMARK,(*m_pFileSet)[m_nRowPos],TRUE,FALSE,bRetrieveData); + + // now set the bookmark for outside + (*m_aRow->begin()) = sal_Int32(m_nRowPos + 1); + } + else // Index muß weiter aufgebaut werden + { + // Zunaechst auf die letzte bekannte Zeile setzen + if (m_pFileSet->size()) + { + m_aFileSetIter = m_pFileSet->end()-1; + // m_pFileSet->SeekPos(m_pFileSet->size()-1); + m_pTable->seekRow(OFileTable::FILE_BOOKMARK, *m_aFileSetIter, m_nFilePos); + } + sal_Bool bOK = sal_True; + // Ermitteln der Anzahl weiterer Fetches + while (bOK && m_nRowPos >= (INT32)m_pFileSet->size()) + { + if (m_pEvaluationKeySet) + { + if (m_nRowPos >= (INT32)m_pEvaluationKeySet->size()) + return sal_False; + // aStatus.Set(SQL_STAT_NO_DATA_FOUND); + else if (m_nRowPos == 0) + { + m_aEvaluateIter = m_pEvaluationKeySet->begin(); + bOK = ExecuteRow(OFileTable::FILE_BOOKMARK,*m_aEvaluateIter,FALSE,TRUE, bRetrieveData); + } + else + { + ++m_aEvaluateIter; + bOK = ExecuteRow(OFileTable::FILE_BOOKMARK,*m_aEvaluateIter,FALSE,TRUE, bRetrieveData); + } + } + else + bOK = ExecuteRow(OFileTable::FILE_NEXT,1,FALSE,TRUE, bRetrieveData); + } + + if (bOK) + { + // jetzt nochmal die Ergebnisse lesen + m_pTable->fetchRow(m_aRow, m_pTable->getTableColumns().getBody(), bRetrieveData); + + // now set the bookmark for outside + (*m_aRow->begin()) = sal_Int32(m_nRowPos + 1); + } + else if (!m_pFileSet->isFrozen()) // keinen gueltigen Satz gefunden + { + //m_pFileSet->Freeze(); + m_pFileSet->setFrozen(); + + DELETEZ(m_pEvaluationKeySet); + // aStatus.Set(SQL_STAT_NO_DATA_FOUND); + goto Error; + } + } + } + } + } + else if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT_COUNT) + { + // Fetch des COUNT(*) + switch (eCursorPosition) + { + case OFileTable::FILE_NEXT: + m_nRowPos++; + break; + case OFileTable::FILE_PRIOR: + m_nRowPos--; + break; + case OFileTable::FILE_FIRST: + m_nRowPos = 0; + break; + case OFileTable::FILE_LAST: + m_nRowPos = 0; + break; + case OFileTable::FILE_RELATIVE: + m_nRowPos += nOffset; + break; + case OFileTable::FILE_BOOKMARK: + case OFileTable::FILE_ABSOLUTE: + m_nRowPos = nOffset - 1; + break; + } + + if (m_nRowPos == 0) + { + // COUNT(*) in Ergebnisrow packen + // (muss die erste und einzige Variable in der Row sein) + if (m_aRow->size() == 2) + { + (*m_aRow)[1] = m_nRowCountResult; + (*m_aRow)[0] = sal_Int32(1); + } + } + else + { + goto Error; + } + } + else + // Fetch nur bei SELECT moeglich! + return sal_False; + + if(m_aRow->isDeleted()) + goto IgnoreDeletedRows; + return sal_True; + +Error: + // steht der Cursor vor dem ersten Satz + // dann wird die position beibehalten + if (nTempPos == -1) + m_nRowPos = nTempPos; + else + { + switch(eCursorPosition) + { + case OFileTable::FILE_PRIOR: + case OFileTable::FILE_FIRST: + m_nRowPos = -1; + break; + case OFileTable::FILE_LAST: + case OFileTable::FILE_NEXT: + case OFileTable::FILE_ABSOLUTE: + case OFileTable::FILE_RELATIVE: + if (nOffset > 0) + m_nRowPos = (m_pFileSet) ? m_pFileSet->size() : -1; + else if (nOffset < 0) + m_nRowPos = -1; + break; + case OFileTable::FILE_BOOKMARK: + m_nRowPos = nTempPos; // vorherige Position + } + } + // delete pGuard; + // rMode = (!bShowDeleted && aStatus.IsSuccessful() && m_aRow->isDeleted()) ? // keine Anzeige von gelöschten Sätzen + // OCursor::SQL_MOD_INVALID : OCursor::SQL_MOD_NONE; + return sal_False; +} +// ------------------------------------------------------------------------- +OFILEKeyValue* OResultSet::GetOrderbyKeyValue(OValueRow _rRow) +{ + UINT32 nBookmarkValue = Abs((sal_Int32)(*_rRow)[0]); + + OFILEKeyValue* pKeyValue = new OFILEKeyValue((UINT32)nBookmarkValue); + for (int i = 0; i < sizeof nOrderbyColumnNumber / sizeof (* nOrderbyColumnNumber); i++) + { + if (nOrderbyColumnNumber[i] == SQL_COLUMN_NOTFOUND) break; + + OFileValue xKey = (*_rRow)[nOrderbyColumnNumber[i]]; + switch (xKey.getType()) + { + case ::com::sun::star::sdbc::DataType::VARCHAR: + case ::com::sun::star::sdbc::DataType::CHAR: + pKeyValue->SetKey(i,(rtl::OUString)xKey); + break; + default: + pKeyValue->SetKey(i,(double)xKey); + break; + } + } + return pKeyValue; +} +OFILESortIndex * OFILESortIndex::pCurrentIndex; +CharSet OFILESortIndex::eCurrentCharSet; +//------------------------------------------------------------------ +OFILESortIndex::OFILESortIndex(const OKeyType eKeyType2[], // Genau 3 Eintraege! + const BOOL bAscending2[], // Genau 3 Eintraege! + INT32 nMaxNumberOfRows, CharSet eSet) // Obere Schranke fuer die Anzahl indizierbarer Zeilen + : nMaxCount(nMaxNumberOfRows), + nCount(0), + bFrozen(FALSE), eCharSet(eSet) +{ + for (int j = 0; j < SQL_ORDERBYKEYS; j++) + { + eKeyType[j] = eKeyType2[j]; + bAscending[j] = bAscending2[j]; + } + +#if defined MAX_KEYSET_SIZE + // Zur Sicherheit Maximalgroesse nochmal pruefen: + if (nMaxCount > MAX_KEYSET_SIZE) + { + DBG_WARNING("OFILESortIndex::OFILESortIndex: nMaxNumberOfRows zur Zeit auf <16K beschraenkt!"); + nMaxCount = MAX_KEYSET_SIZE; + } +#endif + + ppKeyValueArray = new OFILEKeyValuePtr[nMaxCount]; + + for (INT32 i = 0; i < nMaxCount; i++) + ppKeyValueArray[i] = NULL; +} + +//------------------------------------------------------------------ +OFILESortIndex::~OFILESortIndex() +{ + +// Nicht mehr noetig - wird durch Freeze() erledigt ... +// for (INT32 i = 0; i < nCount; i++) { +// delete ppKeyValueArray[i]; +// } + + __DELETE(nMaxCount) ppKeyValueArray; +} + + +//------------------------------------------------------------------ +BOOL OFILESortIndex::AddKeyValue(OFILEKeyValue * pKeyValue) +{ + if (nCount < nMaxCount) + { + if (bFrozen) // wenn der Index schon eingefroren + // dann wird der Key einfach ans Ende gehaengt + { + OSL_ENSHURE(pKeyValue != NULL,"OFILESortIndex::Freeze: pKeyValue == NULL"); + INT32 nValue = pKeyValue->GetValue(); // Wert holen ... + + // Strings in KeyValue freigeben! + for (int j = 0; j < SQL_ORDERBYKEYS; j++) + { + if (eKeyType[j] == SQL_ORDERBYKEY_STRING) + delete pKeyValue->GetKeyString(j); + } + delete pKeyValue; + ppKeyValueArray[nCount++] = (OFILEKeyValuePtr) nValue; + } + else + ppKeyValueArray[nCount++] = pKeyValue; + return TRUE; + } + else + return FALSE; +} + + +//------------------------------------------------------------------ +void OFILESortIndex::Freeze() +{ + OSL_ENSHURE(! bFrozen,"OFILESortIndex::Freeze: already frozen!"); + + // Kritischer Bereich: Hinterlegung von this in statischer Variable. + // Zugriff auf diese Variable von der OFILECompare-Funktion aus. + // Da dies NUR waehrend der Ausfuehrung der qsort-Funktion stattfindet, + // ist dies aber unkritisch: unter Windows 3.x ist diese Ausfuehrung + // UNUNTERBRECHBAR; unter NT, OS/2, Unix, ... hat jede DLL ihr + // eigenes Datensegment. + pCurrentIndex = this; + eCurrentCharSet = eCharSet; + + // Sortierung: + if (eKeyType[0] != SQL_ORDERBYKEY_NONE) + // Sortierung, wenn mindestens nach dem ersten Key sortiert werden soll: + qsort(ppKeyValueArray,nCount,sizeof(void *),&OFILEKeyCompare); + + + // Ende des kritischen Bereiches + pCurrentIndex = NULL; + + // Wert auslesen, KeyValue loeschen und in den void * den Value + // reinschreiben (uebler Trick mit Typecast!) + for (INT32 i = 0; i < nCount; i++) + { + OFILEKeyValuePtr pKeyValue = ppKeyValueArray[i]; + + OSL_ENSHURE(pKeyValue != NULL,"OFILESortIndex::Freeze: pKeyValue == NULL"); + INT32 nValue = pKeyValue->GetValue(); // Wert holen ... + + // Strings in KeyValue freigeben! + for (int j = 0; j < SQL_ORDERBYKEYS; j++) + { + if (eKeyType[j] == SQL_ORDERBYKEY_STRING) + delete pKeyValue->GetKeyString(j); + } + delete pKeyValue; + ppKeyValueArray[i] = (OFILEKeyValuePtr) nValue; + } + + bFrozen = TRUE; +} + +//------------------------------------------------------------------ +INT32 OFILESortIndex::GetValue(INT32 nPos) const +{ + OSL_ENSHURE(nPos > 0,"OFILESortIndex::GetValue: nPos == 0"); + OSL_ENSHURE(nPos <= nCount,"OFILESortIndex::GetValue: Zugriff ausserhalb der Array-Grenzen"); + +// OSL_ENSHURE(ppKeyValueArray[nPos-1] != NULL,"OFILESortIndex::GetValue: interner Fehler: kein KeyValue an dieser Stelle"); +// return ppKeyValueArray[nPos-1]->GetValue(); + + if (!bFrozen) + { + if (eKeyType[0] == SQL_ORDERBYKEY_NONE) // wenn keine Sortierung vorliegt + // darf auf die Values schon vorher zugegriffen werden + return ppKeyValueArray[nPos-1]->GetValue(); + else + { + OSL_ASSERT("OFILESortIndex::GetValue: Invalid use of index!"); + return 0; + } + } + else + return (INT32) ppKeyValueArray[nPos-1]; // Trick: nach Freeze sind hier nur noch Values, keine KeyValue-Strukturen mehr! + +} + +//------------------------------------------------------------------ +OKeySet* OFILESortIndex::CreateKeySet() +{ + + OSL_ENSHURE(! bFrozen,"OFILESortIndex::Freeze: already frozen!"); + + // Kritischer Bereich: Hinterlegung von this in statischer Variable. + // Zugriff auf diese Variable von der OFILECompare-Funktion aus. + // Da dies NUR waehrend der Ausfuehrung der qsort-Funktion stattfindet, + // ist dies aber unkritisch: unter Windows 3.x ist diese Ausfuehrung + // UNUNTERBRECHBAR; unter NT, OS/2, Unix, ... hat jede DLL ihr + // eigenes Datensegment. + pCurrentIndex = this; + eCurrentCharSet = eCharSet; + + // Sortierung: + if (eKeyType[0] != SQL_ORDERBYKEY_NONE) + // Sortierung, wenn mindestens nach dem ersten Key sortiert werden soll: + qsort(ppKeyValueArray,nCount,sizeof(void *),&OFILEKeyCompare); + + + // Ende des kritischen Bereiches + pCurrentIndex = NULL; + + + OKeySet* pKeySet = new OKeySet(nCount); + OKeySet::iterator aIter = pKeySet->begin(); + for (INT32 i = 0; i < nCount; i++,++aIter) + { + OFILEKeyValuePtr pKeyValue = ppKeyValueArray[i]; + + OSL_ENSHURE(pKeyValue != NULL,"OFILESortIndex::Freeze: pKeyValue == NULL"); + (*aIter) = pKeyValue->GetValue(); // Wert holen ... + + // Strings in KeyValue freigeben! + for (int j = 0; j < SQL_ORDERBYKEYS; j++) + { + if (eKeyType[j] == SQL_ORDERBYKEY_STRING) + delete pKeyValue->GetKeyString(j); + } + delete pKeyValue; + } + bFrozen = TRUE; + pKeySet->setFrozen(); + return pKeySet; +} + +//------------------------------------------------------------------ +int +#if defined(WIN) || defined(WNT) +__cdecl +#endif +#if defined(ICC) && defined(OS2) +_Optlink +#endif +connectivity::file::OFILEKeyCompare(const void * elem1, const void * elem2) +{ + const OFILESortIndex * pIndex = OFILESortIndex::pCurrentIndex; + const OFILEKeyValue * pKeyValue1 = (OFILEKeyValue *) * (OFILEKeyValue **) elem1; + const OFILEKeyValue * pKeyValue2 = (OFILEKeyValue *) * (OFILEKeyValue **) elem2; + + // Ueber die (max.) drei ORDER BY-Columns iterieren. Abbruch des Vergleiches, wenn Ungleichheit erkannt + // oder alle Columns gleich. + for (UINT16 i = 0; i < SQL_ORDERBYKEYS && pIndex->eKeyType[i] != SQL_ORDERBYKEY_NONE; i++) + { + const int nGreater = (pIndex->bAscending[i]) ? 1 : -1; + const int nLess = - nGreater; + + // Vergleich (je nach Datentyp): + switch (pIndex->eKeyType[i]) + { + case SQL_ORDERBYKEY_STRING: + { + INT32 nRes = pKeyValue1->GetKeyString(i)->compareTo(*pKeyValue2->GetKeyString(i)); + if (nRes < 0) + return nLess; + else if (nRes > 0) + return nGreater; + } + break; + case SQL_ORDERBYKEY_DOUBLE: + { + double d1 = pKeyValue1->GetKeyDouble(i); + double d2 = pKeyValue2->GetKeyDouble(i); + + if (d1 < d2) + return nLess; + else if (d1 > d2) + return nGreater; + } + break; + } + } + + // Wenn wir bis hierher gekommen sind, waren alle Werte gleich: + return 0; +} +//------------------------------------------------------------------ +BOOL OResultSet::OpenImpl() +{ + const OSQLTables& xTabs = m_aSQLIterator.getTables(); + OSL_ENSHURE(xTabs.begin() != xTabs.end(),"NO table in statement!"); + + OSQLTable xTable = xTabs.begin()->second; + m_xColumns = m_aSQLIterator.getSelectColumns(); + + m_xColNames = xTable->getColumns(); + + Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY); + + m_aRow = new OValueVector(xNames->getCount()); + m_aEvaluateRow = new OValueVector(xNames->getCount()); + // m_aParameterRow = new OValueVector(); + m_aAssignValues = new OAssignValues(); + + if(!m_xParamColumns.isValid()) + m_xParamColumns = new OSQLColumns(); + + m_aSQLAnalyzer.clean(); + + Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(xTable,UNO_QUERY); + if(xTunnel.is()) + { + m_pTable = (OFileTable*)xTunnel->getSomething(OFileTable::getUnoTunnelImplementationId()); + if(m_pTable) + m_pTable->acquire(); + } + + GetAssignValues(); // assign values and describe parameter columns + m_aSQLAnalyzer.setParameterColumns(m_xParamColumns); + anylizeSQL(); + // m_aSQLAnalyzer.describeParam(m_xParamColumns); + + + // now check which columns are bound + OValueVector::iterator aRowIter = m_aRow->begin(); + ::utl::UStringMixEqual aCase(m_xDBMetaData->storesMixedCaseQuotedIdentifiers()); + sal_Int32 i=0; + Reference<XFastPropertySet> xProp; + ++aRowIter; + for(OSQLColumns::iterator aIter = m_xColumns->begin();aIter != m_xColumns->end();++aIter,++i,++aRowIter) + { + xNames->getByIndex(i) >>= xProp; + try + { + aRowIter->setBound(aCase(connectivity::getString(xProp->getFastPropertyValue(PROPERTY_ID_NAME)),connectivity::getString((*aIter)->getFastPropertyValue(PROPERTY_ID_REALNAME)))); + sal_Int32 nType; + xProp->getFastPropertyValue(PROPERTY_ID_TYPE) >>= nType; + aRowIter->setType(nType); + } + catch(...) + { + } + } + + + + + // Parameter substituieren (AssignValues und Kriterien): + if (m_xParamColumns->size()) + { + // Zunächst AssignValues + USHORT nParaCount=0; // gibt die aktuelle Anzahl der bisher gesetzen Parameter an + + // Nach zu substituierenden Parametern suchen: + UINT16 nCount = m_aAssignValues.isValid() ? m_aAssignValues->size() : 1; // 1 ist wichtig für die Kriterien + for (UINT16 j = 1; j < nCount; j++) + { +// if ((*m_aAssignValues)[j].isNull()) +// continue; + + UINT32 nParameter = (*m_aAssignValues).getParameterIndex(j); + if (nParameter == SQL_NO_PARAMETER) + continue; // dieser AssignValue ist kein Parameter + + ++nParaCount; // ab hier ist der Parameter gueltig + // Parameter ersetzen. Wenn Parameter nicht verfuegbar, + // Value auf NULL setzen. + (*m_aAssignValues)[j] = (*m_aParameterRow)[(UINT16)nParameter]; + } + + if (m_aParameterRow.isValid() && nParaCount < m_aParameterRow->size()) + m_aSQLAnalyzer.bindParameterRow(m_aParameterRow); + } + + // Neuen Index aufbauen: + DELETEZ(m_pFileSet); + DELETEZ(m_pEvaluationKeySet); + + // if (!aEvaluateRow.Is()) + { + // aEvaluateRow = new ODbRow(*aFileColumns, FALSE); + // (*aEvaluateRow)[0] = new ODbVariant(); + + // Row zur Auswertung binden, wenn Preprocessing erfolg, dann bereits ein Keyset + m_pEvaluationKeySet = m_aSQLAnalyzer.bindResultRow(m_aEvaluateRow); // Werte im Code des Compilers setzen + // (Verbindung zur ResultRow herstellen) + } + + // An den Anfang positionieren + m_nRowPos = -1; + m_nFilePos = 0; + m_nRowCountResult = -1; + + // exclusiver zugriff auf die Tabelle + // NAMESPACE_VOS(OGuard)* pGuard = pTable->Lock(); + m_nLastVisitedPos = m_pTable->getCurrentLastPos(); + + UINT32 nLoopCount = 0; + switch(m_aSQLIterator.getStatementType()) + { + case SQL_STATEMENT_SELECT: + { + INT32 nMaxRowCount = m_pTable->getCurrentLastPos(); + + BOOL bDistinct = FALSE; + BOOL bWasSorted = FALSE; + OSQLParseNode *pDistinct = m_pParseTree->getChild(1); + if (pDistinct && pDistinct->getTokenID() == SQL_TOKEN_DISTINCT ) + { + if(!IsSorted()) + { + nOrderbyColumnNumber[0] = 1; + bOrderbyAscending[0] = FALSE; + } + else + bWasSorted = TRUE; + bDistinct = TRUE; + } + // Ohne Restriction und Sortierung RowCount bekannt. + // if (!HasRestriction() && !IsSorted() && bShowDeleted) + // SetRowCount(MaxRowCount()); + + OSL_ENSHURE(sizeof nOrderbyColumnNumber / sizeof (* nOrderbyColumnNumber) == SQL_ORDERBYKEYS,"Maximale Anzahl der ORDER BY Columns muss derzeit genau 3 sein!"); + OKeyType eKeyType[SQL_ORDERBYKEYS]; + aRowIter = m_aRow->begin(); + for (int i = 0; i < SQL_ORDERBYKEYS; i++) + { + if (nOrderbyColumnNumber[i] == SQL_COLUMN_NOTFOUND) + eKeyType[i] = SQL_ORDERBYKEY_NONE; + else + { + switch (aRowIter->getType()) + { + case DataType::CHAR: + case DataType::VARCHAR: + eKeyType[i] = SQL_ORDERBYKEY_STRING; + break; + + case DataType::OTHER: + case DataType::TINYINT: + case DataType::SMALLINT: + case DataType::INTEGER: + case DataType::DECIMAL: + case DataType::NUMERIC: + case DataType::REAL: + case DataType::DOUBLE: + case DataType::DATE: + case DataType::TIME: + case DataType::TIMESTAMP: + case DataType::BIT: + eKeyType[i] = SQL_ORDERBYKEY_DOUBLE; + break; + + // Andere Typen sind nicht implementiert (und damit immer FALSE) + default: + eKeyType[i] = SQL_ORDERBYKEY_NONE; + OSL_ASSERT("OFILECursor::Execute: Datentyp nicht implementiert"); + break; + } + (*m_aEvaluateRow)[nOrderbyColumnNumber[i]].setBound(sal_True); + } + } + + // Nur wenn Sortierung gewuenscht, ueber alle Datensaetze iterieren und + // dabei den "Key", nach dem sortiert werden soll, in den Index eintragen: + if (IsSorted()) + { + if (!m_aSQLAnalyzer.hasRestriction() && nOrderbyColumnNumber[1] == SQL_COLUMN_NOTFOUND) + { + // Ist nur ein Feld fuer die Sortierung angegeben + // Und diese Feld ist indiziert, dann den Index ausnutzen + Reference<XIndexesSupplier> xIndexSup(xTable,UNO_QUERY); + Reference<XIndexAccess> xIndexes; + if(xIndexSup.is()) + { + xIndexes = Reference<XIndexAccess>(xIndexSup->getIndexes(),UNO_QUERY); + Reference<XFastPropertySet> xColProp; + xNames->getByIndex(nOrderbyColumnNumber[0]) >>= xColProp; + // iterate through the indexes to find the matching column + for(sal_Int32 i=0;i<xIndexes->getCount();++i) + { + Reference<XColumnsSupplier> xIndex; + xIndexes->getByIndex(i) >>= xIndex; + Reference<XNameAccess> xIndexCols = xIndex->getColumns(); + if(xIndexCols->hasByName(connectivity::getString(xColProp->getFastPropertyValue(PROPERTY_ID_NAME)))) + { + m_pFileSet = new OKeySet(); + + Reference<XUnoTunnel> xTunnel(xIndex,UNO_QUERY); + if(xTunnel.is()) + { + dbase::ODbaseIndex* pIndex = (dbase::ODbaseIndex*)xTunnel->getSomething(dbase::ODbaseIndex::getUnoTunnelImplementationId()); + if(pIndex) + { + dbase::OIndexIterator* pIter = pIndex->createIterator(NULL,NULL); + + if (pIter) + { + sal_uInt32 nRec = pIter->First(); + while (nRec != SQL_COLUMN_NOTFOUND) + { + if (bOrderbyAscending[0]) + m_pFileSet->push_back(nRec); + else + m_pFileSet->insert(m_pFileSet->begin(),nRec); + nRec = pIter->Next(); + } + m_pFileSet->setFrozen(); + // m_bFileSetFrozen = sal_True; + // if(!bDistinct) + // SetRowCount(pFileSet->count()); + goto DISTINCT; + } + + delete pIter; + } + } + } + } + } + } + + m_pSortIndex = new OFILESortIndex(eKeyType, + bOrderbyAscending, + nMaxRowCount,RTL_TEXTENCODING_MS_1252); + + sal_Bool bOK = sal_True; + if (m_pEvaluationKeySet) + { + if (m_pEvaluationKeySet->size()) + m_aEvaluateIter = m_pEvaluationKeySet->begin(); + + } + while (bOK) + { + if (m_pEvaluationKeySet) + { + ExecuteRow(OFileTable::FILE_BOOKMARK,(*m_aEvaluateIter),FALSE,TRUE); + ++m_aEvaluateIter; + bOK = m_aEvaluateIter == m_pEvaluationKeySet->end(); + } + else + bOK = ExecuteRow(OFileTable::FILE_NEXT,1,FALSE,TRUE); + } + + // Sortiertes Keyset erzeugen + DELETEZ(m_pEvaluationKeySet); + m_pFileSet = m_pSortIndex->CreateKeySet(); + // if(!bDistinct) + // SetRowCount(pFileSet->count()); + DELETEZ(m_pSortIndex); + // Nun kann ueber den Index sortiert zugegriffen werden. + } + + if (!m_pFileSet) + { + m_pFileSet = new OKeySet(); + + if (!m_aSQLAnalyzer.hasRestriction()) + // jetzt kann das Keyset schon gefuellt werden! + // Aber Achtung: es wird davon ausgegangen, das die FilePositionen als Folge 1..n + // abgelegt werden! + { + for (sal_uInt32 i = 0; i < m_pTable->getCurrentLastPos(); i++) + m_pFileSet->push_back(i + 1); + } + } + OSL_ENSHURE(m_pFileSet,"Kein KeySet vorhanden! :-("); +DISTINCT: if(bDistinct && m_pFileSet) // sicher ist sicher + { + OValueRow aSearchRow;//(m_aRow); + // ODbRowRef aSearchRow = new ODbRow(*aFileRow); // nach dieser wird gesucht + // const ODbRow &rSearchRow = *aSearchRow, + // &rFileRow = *aFileRow; + INT32 nPos; + UINT16 nMaxRow = m_pFileSet->size(); + if (nMaxRow) + { +#if DEBUG + INT32 nFound=0; +#endif + vector<BOOL> nWasAllwaysFound(nMaxRow,FALSE); + INT32 nPrev_i; + for(INT32 j= nMaxRow-1;j >= 0;j--) + { + nPos = (*m_pFileSet)[j]; // aktuell zu löschender Key + if(!nWasAllwaysFound[j] && nPos) // nur falls noch nicht nach dieser Row gesucht wurde + { + ExecuteRow(OFileTable::FILE_BOOKMARK,nPos,TRUE,FALSE); + aSearchRow = m_aRow; + // jetzt den Rest nach doppelten durchsuchen + INT32 nKey; + nPrev_i = j; + for(INT32 i = j-1; i >= 0 ;i--) + { + nKey = (*m_pFileSet)[i]; + ExecuteRow(OFileTable::FILE_BOOKMARK,nKey ,TRUE,FALSE); + if(!nWasAllwaysFound[i] && aSearchRow == m_aRow) + { + // gefunden + // Key an der Stelle 0 setzen. + (*m_pFileSet)[nPrev_i] = 0; + // und altes i merken + nPrev_i = i; + nPos = nKey; // auf naechste gültige Position setzen + nWasAllwaysFound[i] = TRUE; + + } + } + } +#if DEBUG + else + nFound++; +#endif + } + vector<INT32>::iterator aIter = m_pFileSet->end()-1; + while(aIter != m_pFileSet->begin()) + { + if(!(*aIter)) + m_pFileSet->erase(aIter); + aIter--; + } + if (!bWasSorted) + { + nOrderbyColumnNumber[0] = SQL_COLUMN_NOTFOUND; + sort(m_pFileSet->begin(),m_pFileSet->end()); + } + } + // SetRowCount(m_pFileSet->count()); + } + } break; + + case SQL_STATEMENT_SELECT_COUNT: + case SQL_STATEMENT_UPDATE: + case SQL_STATEMENT_DELETE: + // waehrend der Bearbeitung die Anzahl der bearbeiteten Rows zaehlen: + m_nRowCountResult = 0; + // Vorlaeufig einfach ueber alle Datensaetze iterieren und + // dabei die Aktionen bearbeiten (bzw. einfach nur zaehlen): + { + + sal_Bool bOK = sal_True; + if (m_pEvaluationKeySet) + { + m_aEvaluateIter = m_pEvaluationKeySet->begin(); + bOK = m_aEvaluateIter == m_pEvaluationKeySet->end(); + + } + while (bOK) + { + if (m_pEvaluationKeySet) + ExecuteRow(OFileTable::FILE_BOOKMARK,(*m_aEvaluateIter),FALSE,TRUE); + else + bOK = ExecuteRow(OFileTable::FILE_NEXT,1,FALSE,TRUE); + + if (bOK) + { + m_nRowCountResult++; + if(m_pEvaluationKeySet) + { + ++m_aEvaluateIter; + bOK = m_aEvaluateIter == m_pEvaluationKeySet->end(); + } + } + } + + // Ergebnis von COUNT(*) in nRowCountResult merken. + // nRowCount, also die Anzahl der Rows in der Ergebnismenge, ist bei dieser + // Anfrage = 1! + DELETEZ(m_pEvaluationKeySet); + } + // SetRowCount(1); + break; + case SQL_STATEMENT_INSERT: + m_nRowCountResult = 0; + + if(!m_pTable->InsertRow(m_aAssignValues, TRUE,Reference<XIndexAccess>(m_xColNames,UNO_QUERY))) + { + m_nFilePos = 0; + return sal_False; + } + + m_nRowCountResult = 1; + break; + } + + // FilePos zuruecksetzen + m_nFilePos = 0; + + return sal_True; +} +//------------------------------------------------------------------ +void OResultSet::anylizeSQL() +{ + // start analysing the statement + m_aSQLAnalyzer.setOrigColumns(m_xColNames); + m_aSQLAnalyzer.start(m_pParseTree); + + const OSQLParseNode* pOrderbyClause = m_aSQLIterator.getOrderTree(); + if(pOrderbyClause) + { + OSQLParseNode * pOrderingSpecCommalist = pOrderbyClause->getChild(2); + OSL_ENSHURE(SQL_ISRULE(pOrderingSpecCommalist,ordering_spec_commalist),"OResultSet: Fehler im Parse Tree"); + + for (sal_uInt32 m = 0; m < pOrderingSpecCommalist->count(); m++) + { + OSQLParseNode * pOrderingSpec = pOrderingSpecCommalist->getChild(m); + OSL_ENSHURE(SQL_ISRULE(pOrderingSpec,ordering_spec),"OResultSet: Fehler im Parse Tree"); + OSL_ENSHURE(pOrderingSpec->count() == 2,"OResultSet: Fehler im Parse Tree"); + + OSQLParseNode * pColumnRef = pOrderingSpec->getChild(0); + if(!SQL_ISRULE(pColumnRef,column_ref)) + { + // aStatus.SetStatementTooComplex(); + return; + } + OSQLParseNode * pAscendingDescending = pOrderingSpec->getChild(1); + setOrderbyColumn((UINT16)m,pColumnRef,pAscendingDescending); + } + } +} + + +//------------------------------------------------------------------ +void OResultSet::setOrderbyColumn(UINT16 nOrderbyColumnNo, + OSQLParseNode* pColumnRef, + OSQLParseNode* pAscendingDescending) +{ + if (nOrderbyColumnNo >= (sizeof nOrderbyColumnNumber / sizeof (* nOrderbyColumnNumber))) + { + // aStatus.SetStatementTooComplex(); + return; + } + + String aColumnName; + if (pColumnRef->count() == 1) + aColumnName = pColumnRef->getChild(0)->getTokenValue(); + else if (pColumnRef->count() == 3) + { + // Nur die Table Range-Variable darf hier vorkommen: +// if (!(pColumnRef->getChild(0)->getTokenValue() == aTableRange)) +// { +// aStatus.Set(SQL_STAT_ERROR, +// String::CreateFromAscii("S1000"), +// aStatus.CreateErrorMessage(String(SdbResId(STR_STAT_INVALID_RANGE_VAR))), +// 0, String() ); + // return; + // } + aColumnName = pColumnRef->getChild(2)->getTokenValue(); + } + else + { + // aStatus.SetStatementTooComplex(); + return; + } + + Reference<XColumnLocate> xColLocate(m_xColNames,UNO_QUERY); + if(!xColLocate.is()) + return; + // Alles geprueft und wir haben den Namen der Column. + // Die wievielte Column ist das? + nOrderbyColumnNumber[nOrderbyColumnNo] = xColLocate->findColumn(aColumnName)-1; + + // Ascending or Descending? + bOrderbyAscending[nOrderbyColumnNo] = (SQL_ISTOKEN(pAscendingDescending,DESC)) ? + FALSE : TRUE; +} + +//-------------------------------------------------------------------------- +Sequence< sal_Int8 > OResultSet::getUnoTunnelImplementationId() +{ + static ::cppu::OImplementationId * pId = 0; + if (! pId) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + if (! pId) + { + static ::cppu::OImplementationId aId; + pId = &aId; + } + } + return pId->getImplementationId(); +} + +// com::sun::star::lang::XUnoTunnel +//------------------------------------------------------------------ +sal_Int64 OResultSet::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException) +{ + if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + return (sal_Int64)this; + + return 0; +} +//------------------------------------------------------------------ +void OResultSet::GetAssignValues() +{ + if (m_pParseTree == NULL) + { + // aStatus.SetInvalidStatement(); + return; + } + + if (SQL_ISRULE(m_pParseTree,select_statement)) + // Keine zu setzenden Werte bei SELECT + return; + else if (SQL_ISRULE(m_pParseTree,insert_statement)) + { + // Row fuer die zu setzenden Werte anlegen (Referenz durch new) + m_aAssignValues = new OAssignValues(Reference<XIndexAccess>(m_xColNames,UNO_QUERY)->getCount()); + + // Liste der Columns-Namen, die in der column_commalist vorkommen (mit ; getrennt): + ::std::vector<String> aColumnNameList; + + OSL_ENSHURE(m_pParseTree->count() >= 4,"OResultSet: Fehler im Parse Tree"); + + OSQLParseNode * pOptColumnCommalist = m_pParseTree->getChild(3); + OSL_ENSHURE(pOptColumnCommalist != NULL,"OResultSet: Fehler im Parse Tree"); + OSL_ENSHURE(SQL_ISRULE(pOptColumnCommalist,opt_column_commalist),"OResultSet: Fehler im Parse Tree"); + if (pOptColumnCommalist->count() == 0) + { + const Sequence< ::rtl::OUString>& aNames = m_xColNames->getElementNames(); + const ::rtl::OUString* pBegin = aNames.getConstArray(); + aColumnNameList.insert(aColumnNameList.begin(),::std::vector<String>::const_iterator(pBegin),::std::vector<String>::const_iterator(pBegin + aNames.getLength())); + } + else + { + OSL_ENSHURE(pOptColumnCommalist->count() == 3,"OResultSet: Fehler im Parse Tree"); + + OSQLParseNode * pColumnCommalist = pOptColumnCommalist->getChild(1); + OSL_ENSHURE(pColumnCommalist != NULL,"OResultSet: Fehler im Parse Tree"); + OSL_ENSHURE(SQL_ISRULE(pColumnCommalist,column_commalist),"OResultSet: Fehler im Parse Tree"); + OSL_ENSHURE(pColumnCommalist->count() > 0,"OResultSet: Fehler im Parse Tree"); + + // Alle Columns in der column_commalist ... + for (sal_uInt32 i = 0; i < pColumnCommalist->count(); i++) + { + OSQLParseNode * pCol = pColumnCommalist->getChild(i); + OSL_ENSHURE(pCol != NULL,"OResultSet: Fehler im Parse Tree"); + aColumnNameList.push_back(pCol->getTokenValue()); + } + } + if(!aColumnNameList.size()) + throw SQLException(); + + // Werte ... + OSQLParseNode * pValuesOrQuerySpec = m_pParseTree->getChild(4); + OSL_ENSHURE(pValuesOrQuerySpec != NULL,"OResultSet: pValuesOrQuerySpec darf nicht NULL sein!"); + OSL_ENSHURE(SQL_ISRULE(pValuesOrQuerySpec,values_or_query_spec),"OResultSet: ! SQL_ISRULE(pValuesOrQuerySpec,values_or_query_spec)"); + OSL_ENSHURE(pValuesOrQuerySpec->count() > 0,"OResultSet: pValuesOrQuerySpec->count() <= 0"); + + // nur "VALUES" ist erlaubt ... + if (! SQL_ISTOKEN(pValuesOrQuerySpec->getChild(0),VALUES)) + throw SQLException(); + + OSL_ENSHURE(pValuesOrQuerySpec->count() == 2,"OResultSet: pValuesOrQuerySpec->count() != 2"); + + // Liste von Werten + OSQLParseNode * pInsertAtomCommalist = pValuesOrQuerySpec->getChild(1); + OSL_ENSHURE(pInsertAtomCommalist != NULL,"OResultSet: pInsertAtomCommalist darf nicht NULL sein!"); + OSL_ENSHURE(pInsertAtomCommalist->count() > 0,"OResultSet: pInsertAtomCommalist <= 0"); + + String aColumnName; + OSQLParseNode * pRow_Value_Const; + xub_StrLen nIndex=0; + for (sal_uInt32 i = 0; i < pInsertAtomCommalist->count(); i++) + { + pRow_Value_Const = pInsertAtomCommalist->getChild(i); // row_value_constructor + if(pRow_Value_Const->count() == 3) // '(' row_value_const_list ')' + { + pRow_Value_Const = pRow_Value_Const->getChild(1); // row_value_const_list + OSL_ENSHURE(pRow_Value_Const != NULL,"OResultSet: pRow_Value_Const darf nicht NULL sein!"); + if(pRow_Value_Const->count() == 0) + { + if(pRow_Value_Const->count() == (aColumnNameList.size()-1)) + ParseAssignValues(aColumnNameList,pRow_Value_Const,nIndex++); // kann nur ein Columnname vorhanden sein pro Schleife + else + { +// aStatus.Set(SQL_STAT_ERROR, +// String::CreateFromAscii("S1000"), +// aStatus.CreateErrorMessage(String(SdbResId(STR_STAT_SYNTAX_ERROR))), +// 0, String() ); + throw SQLException(); + } + } + else + { + if(pRow_Value_Const->count() == aColumnNameList.size()) + { + for (sal_uInt32 j = 0; j < pRow_Value_Const->count(); ++j) + ParseAssignValues(aColumnNameList,pRow_Value_Const->getChild(j),nIndex++); + } + else + { +// aStatus.Set(SQL_STAT_ERROR, +// String::CreateFromAscii("S1000"), +// aStatus.CreateErrorMessage(String(SdbResId(STR_STAT_SYNTAX_ERROR))), +// 0, String() ); + throw SQLException(); + } + + } + } + else + { + // aStatus.SetStatementTooComplex(); + throw SQLException(); + } + } + } + else if (SQL_ISRULE(m_pParseTree,update_statement_positioned) || + SQL_ISRULE(m_pParseTree,update_statement_searched)) + { + m_aAssignValues = new OAssignValues(Reference<XIndexAccess>(m_xColNames,UNO_QUERY)->getCount()); + + OSL_ENSHURE(m_pParseTree->count() >= 4,"OResultSet: Fehler im Parse Tree"); + + OSQLParseNode * pAssignmentCommalist = m_pParseTree->getChild(3); + OSL_ENSHURE(pAssignmentCommalist != NULL,"OResultSet: pAssignmentCommalist == NULL"); + OSL_ENSHURE(SQL_ISRULE(pAssignmentCommalist,assignment_commalist),"OResultSet: Fehler im Parse Tree"); + OSL_ENSHURE(pAssignmentCommalist->count() > 0,"OResultSet: pAssignmentCommalist->count() <= 0"); + + // Alle Zuweisungen (Kommaliste) bearbeiten ... + ::std::vector< String> aList(1); + for (sal_uInt32 i = 0; i < pAssignmentCommalist->count(); i++) + { + OSQLParseNode * pAssignment = pAssignmentCommalist->getChild(i); + OSL_ENSHURE(pAssignment != NULL,"OResultSet: pAssignment == NULL"); + OSL_ENSHURE(SQL_ISRULE(pAssignment,assignment),"OResultSet: Fehler im Parse Tree"); + OSL_ENSHURE(pAssignment->count() == 3,"OResultSet: pAssignment->count() != 3"); + + OSQLParseNode * pCol = pAssignment->getChild(0); + OSL_ENSHURE(pCol != NULL,"OResultSet: pCol == NULL"); + + OSQLParseNode * pComp = pAssignment->getChild(1); + OSL_ENSHURE(pComp != NULL,"OResultSet: pComp == NULL"); + OSL_ENSHURE(pComp->getNodeType() == SQL_NODE_EQUAL,"OResultSet: pComp->getNodeType() != SQL_NODE_COMPARISON"); + if (pComp->getTokenValue().GetChar(0) != '=') + { + // aStatus.SetInvalidStatement(); + throw SQLException(); + } + + OSQLParseNode * pVal = pAssignment->getChild(2); + OSL_ENSHURE(pVal != NULL,"OResultSet: pVal == NULL"); + aList[0] = pCol->getTokenValue(); + ParseAssignValues(aList,pVal,0); + } + + } +} +// ------------------------------------------------------------------------- +void OResultSet::ParseAssignValues(const ::std::vector< String>& aColumnNameList,OSQLParseNode* pRow_Value_Constructor_Elem,xub_StrLen nIndex) +{ + OSL_ENSHURE(nIndex <= aColumnNameList.size(),"SdbFileCursor::ParseAssignValues: nIndex > aColumnNameList.GetTokenCount()"); + String aColumnName(aColumnNameList[nIndex]); + OSL_ENSHURE(aColumnName.Len() > 0,"OResultSet: Column-Name nicht gefunden"); + OSL_ENSHURE(pRow_Value_Constructor_Elem != NULL,"OResultSet: pRow_Value_Constructor_Elem darf nicht NULL sein!"); + + if (pRow_Value_Constructor_Elem->getNodeType() == SQL_NODE_STRING || + pRow_Value_Constructor_Elem->getNodeType() == SQL_NODE_INTNUM || + pRow_Value_Constructor_Elem->getNodeType() == SQL_NODE_APPROXNUM) + { + // Wert setzen: + SetAssignValue(aColumnName, pRow_Value_Constructor_Elem->getTokenValue()); + } + else if (SQL_ISTOKEN(pRow_Value_Constructor_Elem,NULL)) + { + // NULL setzen + SetAssignValue(aColumnName, String(), TRUE); + } + else if (SQL_ISRULE(pRow_Value_Constructor_Elem,parameter)) + { + // Parameter hinzufuegen, Typ ... entsprechend der Column, der der Wert zugewiesen wird + Reference<XFastPropertySet> xCol; + m_xColNames->getByName(aColumnName) >>= xCol; + sal_Int32 nParameter = -1; + if(m_xParamColumns.isValid()) + { + OSQLColumns::const_iterator aIter = find(m_xParamColumns->begin(),m_xParamColumns->end(),aColumnName,::utl::UStringMixEqual(m_pTable->isCaseSensitive())); + if(aIter != m_xParamColumns->end()) + nParameter = m_xParamColumns->size() - (m_xParamColumns->end() - aIter) +1;// +1 because the rows start at 1 + } + if(nParameter == -1) + nParameter = AddParameter(pRow_Value_Constructor_Elem,xCol); + // Nr. des Parameters in der Variablen merken: + SetAssignValue(aColumnName, String(), TRUE, nParameter); + } + else + { + // aStatus.SetStatementTooComplex(); + throw SQLException(); + } +} +//------------------------------------------------------------------ +void OResultSet::SetAssignValue(const String& aColumnName, + const String& aValue, + BOOL bSetNull, + UINT32 nParameter) +{ + Reference<XFastPropertySet> xCol; + m_xColNames->getByName(aColumnName) >>= xCol; + sal_Int32 nId = Reference<XColumnLocate>(m_xColNames,UNO_QUERY)->findColumn(aColumnName); + // Kommt diese Column ueberhaupt in der Datei vor? + + if (!xCol.is()) + { + // Diese Column gibt es nicht! +// aStatus.Set(SQL_STAT_ERROR, +// String::CreateFromAscii("S0022"), +// aStatus.CreateErrorMessage(String(SdbResId(STR_STAT_COLUMN_NOT_FOUND))), +// 0, String() ); + throw SQLException(); + } + + // Value an die Row mit den zuzuweisenden Werten binden: + // const ODbVariantRef& xValue = (*aAssignValues)[pFileColumn->GetId()]; + + // Alles geprueft und wir haben den Namen der Column. + // Jetzt eine Value allozieren, den Wert setzen und die Value an die Row binden. + if (bSetNull) + (*m_aAssignValues)[nId].setNull(); + else + { + switch (getINT32(xCol->getFastPropertyValue(PROPERTY_ID_TYPE))) + { + // Kriterium je nach Typ als String oder double in die Variable packen ... + case DataType::CHAR: + case DataType::VARCHAR: + (*m_aAssignValues)[nId] = aValue; + // Zeichensatz ist bereits konvertiert, da ja das gesamte Statement konvertiert wurde + break; + + case DataType::BIT: + { + // nyi: gemischte Gross-/Kleinschreibung??? + if (aValue.EqualsIgnoreCaseAscii("TRUE") || aValue.GetChar(0) == '1') + (*m_aAssignValues)[nId] = sal_True; + else if (aValue.EqualsIgnoreCaseAscii("FALSE") || aValue.GetChar(0) == '0') + (*m_aAssignValues)[nId] = sal_False; + else + { + // aStatus.Set(SQL_STAT_ERROR); // nyi: genauer! + throw SQLException(); + } + } + break; + case DataType::TINYINT: + case DataType::SMALLINT: + case DataType::INTEGER: + case DataType::DECIMAL: + case DataType::NUMERIC: + case DataType::REAL: + case DataType::DOUBLE: + case DataType::DATE: + case DataType::TIME: + case DataType::TIMESTAMP: + { + (*m_aAssignValues)[nId] = aValue.ToDouble(); +// try +// { +// double n = xValue->toDouble(); +// xValue->setDouble(n); +// } +// catch ( ... ) +// { +// aStatus.SetDriverNotCapableError(); +// } + } break; + default: + throw SQLException(); + } + } + + // Parameter-Nr. merken (als User Data) + // SQL_NO_PARAMETER = kein Parameter. + m_aAssignValues->setParameterIndex(nId,nParameter); + // ((ODbAssignRow*)aAssignValues.getBodyPtr())->setAssignedIndex(pFileColumn->GetId(), nParameter); +} + +//------------------------------------------------------------------ +UINT32 OResultSet::AddParameter(OSQLParseNode * pParameter, const Reference<XFastPropertySet>& _xCol) +{ + + // Nr. des neu hinzuzufuegenden Parameters: + UINT32 nParameter = m_xParamColumns->size()+1; + + OSL_ENSHURE(SQL_ISRULE(pParameter,parameter),"OResultSet::AddParameter: Argument ist kein Parameter"); + OSL_ENSHURE(pParameter->count() > 0,"OResultSet: Fehler im Parse Tree"); + OSQLParseNode * pMark = pParameter->getChild(0); + + String aParameterName; + if (SQL_ISPUNCTUATION(pMark,"?")) + aParameterName = '?'; + else if (SQL_ISPUNCTUATION(pMark,":")) + aParameterName = pParameter->getChild(1)->getTokenValue(); + else if (SQL_ISPUNCTUATION(pMark,"[")) + aParameterName = pParameter->getChild(1)->getTokenValue(); + else + { + OSL_ASSERT("OResultSet: Fehler im Parse Tree"); + } + + // Parameter-Column aufsetzen: + sal_Int32 eType = DataType::VARCHAR; + UINT32 nPrecision = 255; + UINT16 nScale = 0; + sal_Int32 nNullable = ColumnValue::NULLABLE; + + if (_xCol.is()) + { + // Typ, Precision, Scale ... der angegebenen Column verwenden, + // denn dieser Column wird der Wert zugewiesen bzw. mit dieser + // Column wird der Wert verglichen. + eType = getINT32(_xCol->getFastPropertyValue(PROPERTY_ID_TYPE)); + nPrecision = getINT32(_xCol->getFastPropertyValue(PROPERTY_ID_PRECISION)); + nScale = getINT32(_xCol->getFastPropertyValue(PROPERTY_ID_SCALE)); + nNullable = getINT32(_xCol->getFastPropertyValue(PROPERTY_ID_ISNULLABLE));; + } + + Reference<XFastPropertySet> xParaColumn; + sdbcx::OColumn* pRet = new sdbcx::OColumn(aParameterName + ,::rtl::OUString() + ,::rtl::OUString() + ,nNullable + , nPrecision + ,nScale + ,eType + ,sal_False + ,sal_False + ,sal_False + ,m_aSQLIterator.isCaseSensitive()); + xParaColumn = pRet; + m_xParamColumns->push_back(xParaColumn); + return nParameter; +} +// ------------------------------------------------------------------------- +void OResultSet::describeParameter() +{ + ::std::vector< OSQLParseNode*> aParseNodes; + scanParameter(m_pParseTree,aParseNodes); + if(aParseNodes.size()) + { + m_xParamColumns = new OSQLColumns(); + const OSQLTables& xTabs = m_aSQLIterator.getTables(); + OSQLTable xTable = xTabs.begin()->second; + + String aTabName,aTmp,aColName,aParameterName; + ::std::vector< OSQLParseNode*>::iterator aIter = aParseNodes.begin(); + for(;aIter != aParseNodes.end();++aIter) + { + BOOL bNotFound(TRUE); + OSQLParseNode* pParseNode = *aIter; + pParseNode = pParseNode->getParent(); + pParseNode = pParseNode->getChild(0); + + m_aSQLIterator.getColumnRange(pParseNode,aColName,aTabName); + Reference<XFastPropertySet> xCol; + xTable->getColumns()->getByName(aColName) >>= xCol; + m_xParamColumns->push_back(xCol); + } + } +} +//------------------------------------------------------------------ +void OResultSet::scanParameter(OSQLParseNode* pParseNode,::std::vector< OSQLParseNode*>& _rParaNodes) +{ + DBG_ASSERT(pParseNode != NULL,"SdbCursor: interner Fehler: ungueltiger ParseNode"); + + // Parameter Name-Regel gefunden? + if (SQL_ISRULE(pParseNode,parameter)) + { + DBG_ASSERT(pParseNode->count() >= 1,"OResultSet: Parse Tree fehlerhaft"); + DBG_ASSERT(pParseNode->getChild(0)->getNodeType() == SQL_NODE_PUNCTUATION,"OResultSet: Parse Tree fehlerhaft"); + + _rParaNodes.push_back(pParseNode); + // Weiterer Abstieg nicht erforderlich + return; + } + + // Weiter absteigen im Parse Tree + for (UINT32 i = 0; i < pParseNode->count(); i++) + scanParameter(pParseNode->getChild(i),_rParaNodes); +} + + diff --git a/connectivity/source/drivers/file/FResultSetMetaData.cxx b/connectivity/source/drivers/file/FResultSetMetaData.cxx new file mode 100644 index 000000000000..d595da005387 --- /dev/null +++ b/connectivity/source/drivers/file/FResultSetMetaData.cxx @@ -0,0 +1,201 @@ +/************************************************************************* + * + * $RCSfile: FResultSetMetaData.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_ORESULTSETMETADATA_HXX_ +#include "file/FResultSetMetaData.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +using namespace connectivity; +using namespace connectivity::file; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +// ------------------------------------------------------------------------- +OResultSetMetaData::~OResultSetMetaData() +{ +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getINT32(m_rColumns[column-1]->getFastPropertyValue(PROPERTY_ID_PRECISION)); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getINT32(m_rColumns[column-1]->getFastPropertyValue(PROPERTY_ID_TYPE)); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException) +{ + return m_rColumns.size(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- + +::rtl::OUString SAL_CALL OResultSetMetaData::getSchemaName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- + +::rtl::OUString SAL_CALL OResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + Any aName(m_rColumns[column-1]->getFastPropertyValue(PROPERTY_ID_REALNAME)); + return aName.hasValue() ? getString(aName) : getString(m_rColumns[column-1]->getFastPropertyValue(PROPERTY_ID_NAME)); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return m_aTableName; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getCatalogName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getString(m_rColumns[column-1]->getFastPropertyValue(PROPERTY_ID_TYPENAME)); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getString(m_rColumns[column-1]->getFastPropertyValue(PROPERTY_ID_NAME)); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getColumnServiceName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getBOOL(m_rColumns[column-1]->getFastPropertyValue(PROPERTY_ID_TYPE)); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getBOOL(m_rColumns[column-1]->getFastPropertyValue(PROPERTY_ID_ISAUTOINCREMENT)); +} +// ------------------------------------------------------------------------- + + +sal_Bool SAL_CALL OResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getINT32(m_rColumns[column-1]->getFastPropertyValue(PROPERTY_ID_PRECISION)); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + return getINT32(m_rColumns[column-1]->getFastPropertyValue(PROPERTY_ID_SCALE)); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getINT32(m_rColumns[column-1]->getFastPropertyValue(PROPERTY_ID_ISNULLABLE)); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return sal_True; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return sal_False; +; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx new file mode 100644 index 000000000000..8dfbb1fd9521 --- /dev/null +++ b/connectivity/source/drivers/file/FStatement.cxx @@ -0,0 +1,358 @@ +/************************************************************************* + * + * $RCSfile: FStatement.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif +#ifndef _CONNECTIVITY_FILE_OSTATEMENT_HXX_ +#include "file/FStatement.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_OCONNECTION_HXX_ +#include "file/FConnection.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_ORESULTSET_HXX_ +#include "file/FResultSet.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +#ifndef _UTL_PROPERTY_HXX_ +#include <unotools/property.hxx> +#endif +#ifndef _UTL_UNO3_HXX_ +#include <unotools/uno3.hxx> +#endif +#ifndef _OSL_THREAD_H_ +#include <osl/thread.h> +#endif + +#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_ +#include <com/sun/star/sdbc/ResultSetConcurrency.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_ +#include <com/sun/star/sdbc/ResultSetType.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif + +#define THROW_SQL(x) \ + OTools::ThrowException(x,m_aStatementHandle,SQL_HANDLE_STMT,*this) + +using namespace connectivity::file; +using namespace connectivity; +//------------------------------------------------------------------------------ +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::sdbcx; +using namespace com::sun::star::container; +//------------------------------------------------------------------------------ +OStatement_Base::OStatement_Base(OConnection* _pConnection ) : OStatement_BASE(m_aMutex) + ,connectivity::OSimplePropertyContainer(OStatement_BASE::rBHelper) + ,rBHelper(OStatement_BASE::rBHelper) + ,m_pConnection(_pConnection) + ,m_pParseTree(NULL) + ,m_aSQLIterator(_pConnection->createCatalog()->getTables(),_pConnection->getMetaData(),NULL) +{ + m_pConnection->acquire(); + + sal_Int32 nAttrib = 0; + + registerProperty(PROPERTY_CURSORNAME, PROPERTY_ID_CURSORNAME, nAttrib,&m_aCursorName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(PROPERTY_MAXFIELDSIZE, PROPERTY_ID_MAXFIELDSIZE, nAttrib,&m_nMaxFieldSize, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(PROPERTY_MAXROWS, PROPERTY_ID_MAXROWS, nAttrib,&m_nMaxRows, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(PROPERTY_QUERYTIMEOUT, PROPERTY_ID_QUERYTIMEOUT, nAttrib,&m_nQueryTimeOut, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(PROPERTY_FETCHSIZE, PROPERTY_ID_FETCHSIZE, nAttrib,&m_nFetchSize, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(PROPERTY_RESULTSETTYPE, PROPERTY_ID_RESULTSETTYPE, nAttrib,&m_nResultSetType, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(PROPERTY_FETCHDIRECTION, PROPERTY_ID_FETCHDIRECTION, nAttrib,&m_nFetchDirection, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(PROPERTY_ESCAPEPROCESSING, PROPERTY_ID_ESCAPEPROCESSING, nAttrib,&m_bEscapeProcessing,::getCppuBooleanType()); + + registerProperty(PROPERTY_RESULTSETCONCURRENCY, PROPERTY_ID_RESULTSETCONCURRENCY, nAttrib,&m_nResultSetConcurrency, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); +} +//------------------------------------------------------------------------------ +void OStatement_Base::disposeResultSet() +{ + // free the cursor if alive + Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY); + if (xComp.is()) + xComp->dispose(); + m_xResultSet = Reference< XResultSet>(); +} +//------------------------------------------------------------------------------ +void OStatement_BASE2::disposing() +{ + ::osl::MutexGuard aGuard(m_aMutex); + + disposeResultSet(); + + if (m_pConnection) + m_pConnection->release(); + + dispose_ChildImpl(); + OStatement_Base::disposing(); +} +//----------------------------------------------------------------------------- +void SAL_CALL OStatement_BASE2::release() throw(RuntimeException) +{ + relase_ChildImpl(); +} +//----------------------------------------------------------------------------- +Any SAL_CALL OStatement_Base::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = OStatement_BASE::queryInterface(rType); + if(!aRet.hasValue()) + aRet = OPropertySetHelper::queryInterface(rType); + return aRet; +} +// ------------------------------------------------------------------------- +Sequence< Type > SAL_CALL OStatement_Base::getTypes( ) throw(RuntimeException) +{ + ::cppu::OTypeCollection aTypes( ::getCppuType( (const Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ), + ::getCppuType( (const Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ), + ::getCppuType( (const Reference< ::com::sun::star::beans::XPropertySet > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),OStatement_BASE::getTypes()); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OStatement_Base::cancel( ) throw(RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +void SAL_CALL OStatement_Base::close( ) throw(SQLException, RuntimeException) +{ + { + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + } + dispose(); +} +// ------------------------------------------------------------------------- + +void OStatement_Base::reset() throw (SQLException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + clearWarnings (); + + if (m_xResultSet.get().is()) + clearMyResultSet(); +} +//-------------------------------------------------------------------- +// clearMyResultSet +// If a ResultSet was created for this Statement, close it +//-------------------------------------------------------------------- + +void OStatement_Base::clearMyResultSet () throw (SQLException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + Reference<XCloseable> xCloseable; + if(::utl::query_interface(m_xResultSet.get(),xCloseable)) + xCloseable->close(); + m_xResultSet = Reference< XResultSet>(); +} +//-------------------------------------------------------------------- +// setWarning +// Sets the warning +//-------------------------------------------------------------------- + +void OStatement_Base::setWarning (const SQLWarning &ex) throw( SQLException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_aLastWarning = ex; +} + +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OStatement_Base::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + // ::rtl::OString aSql(::rtl::OUStringToOString(sql,osl_getThreadTextEncoding())); + Reference< XResultSet > xRS = executeQuery(sql); + + return m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT || m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT_COUNT; +} + +// ------------------------------------------------------------------------- + +Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + Reference< XResultSet > xRS = NULL; + + String aErr; + m_pParseTree = m_aParser.parseTree(aErr,sql); + if(m_pParseTree) + { + m_aSQLIterator.setParseTree(m_pParseTree); + m_aSQLIterator.traverseAll(); + const OSQLTables& xTabs = m_aSQLIterator.getTables(); + if(xTabs.begin() == xTabs.end()) + throw SQLException(aErr,*this,::rtl::OUString(),0,Any()); + + OResultSet* pResult = new OResultSet(this,m_aSQLIterator); + pResult->OpenImpl(); + xRS = pResult; + + } + else + throw SQLException(aErr,*this,::rtl::OUString(),0,Any()); + + + + // Execute the statement. If execute returns true, a result + // set exists. + return xRS; +} +// ------------------------------------------------------------------------- +Reference< XConnection > SAL_CALL OStatement_Base::getConnection( ) throw(SQLException, RuntimeException) +{ + return (Reference< XConnection >)m_pConnection; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OStatement_Base::executeUpdate( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + Reference< XResultSet > xRS = NULL; + + String aErr; + m_pParseTree = m_aParser.parseTree(aErr,sql); + if(m_pParseTree) + { + m_aSQLIterator.setParseTree(m_pParseTree); + m_aSQLIterator.traverseAll(); + const OSQLTables& xTabs = m_aSQLIterator.getTables(); + if(xTabs.begin() == xTabs.end()) + throw SQLException(aErr,*this,::rtl::OUString(),0,Any()); + + OResultSet* pResult = new OResultSet(this,m_aSQLIterator); + pResult->OpenImpl(); + xRS = pResult; + return pResult->getRowCountResult(); + } + else + throw SQLException(aErr,*this,::rtl::OUString(),0,Any()); + + return 0; +} +// ------------------------------------------------------------------------- +Any SAL_CALL OStatement_Base::getWarnings( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return makeAny(m_aLastWarning); +} +// ------------------------------------------------------------------------- + +// ------------------------------------------------------------------------- +void SAL_CALL OStatement_Base::clearWarnings( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_aLastWarning = SQLWarning(); +} +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper* OStatement_Base::createArrayHelper( ) const +{ + Sequence< Property > aProps; + describeProperties(aProps); + return new ::cppu::OPropertyArrayHelper(aProps); +} + +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper & OStatement_Base::getInfoHelper() +{ + return *const_cast<OStatement_Base*>(this)->getArrayHelper(); +} +// ------------------------------------------------------------------------- +IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbc.driver.file.Statement","com.sun.star.sdbc.Statement"); + diff --git a/connectivity/source/drivers/file/FTable.cxx b/connectivity/source/drivers/file/FTable.cxx new file mode 100644 index 000000000000..9036acdde05c --- /dev/null +++ b/connectivity/source/drivers/file/FTable.cxx @@ -0,0 +1,201 @@ +/************************************************************************* + * + * $RCSfile: FTable.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_TABLE_HXX_ +#include "file/FTable.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_COLUMNS_HXX_ +#include "file/FColumns.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif + +using namespace connectivity::file; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; + +OFileTable::OFileTable(OConnection* _pConnection) : OTable_TYPEDEF(_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers()) + ,m_pConnection(_pConnection) + ,m_nFilePos(0) + ,m_nBufferSize(0) + ,m_pBuffer(NULL) +{ + construct(); + ::std::vector< ::rtl::OUString> aVector; + m_pColumns = new OColumns(this,m_aMutex,aVector); + m_aColumns = new OSQLColumns(); +} +// ------------------------------------------------------------------------- +OFileTable::OFileTable( OConnection* _pConnection, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _Type, + const ::rtl::OUString& _Description , + const ::rtl::OUString& _SchemaName, + const ::rtl::OUString& _CatalogName + ) : OTable_TYPEDEF(_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers(), + _Name, + _Type, + _Description, + _SchemaName, + _CatalogName) + ,m_pConnection(_pConnection) + ,m_nFilePos(0) + ,m_nBufferSize(0) + ,m_pBuffer(NULL) +{ + m_aColumns = new OSQLColumns(); + construct(); + // refreshColumns(); +} +// ------------------------------------------------------------------------- +void OFileTable::refreshColumns() +{ + ::std::vector< ::rtl::OUString> aVector; + Reference< XResultSet > xResult = m_pConnection->getMetaData()->getColumns(Any(), + m_SchemaName,m_Name,::rtl::OUString::createFromAscii("%")); + + if(xResult.is()) + { + Reference< XRow > xRow(xResult,UNO_QUERY); + while(xResult->next()) + aVector.push_back(xRow->getString(4)); + } + + if(m_pColumns) + delete m_pColumns; + m_pColumns = new OColumns(this,m_aMutex,aVector); +} +// ------------------------------------------------------------------------- +void OFileTable::refreshKeys() +{ +} +// ------------------------------------------------------------------------- +void OFileTable::refreshIndexes() +{ +} +// ------------------------------------------------------------------------- +Any SAL_CALL OFileTable::queryInterface( const Type & rType ) throw(RuntimeException) +{ + if( rType == ::getCppuType((const Reference<XKeysSupplier>*)0) || + rType == ::getCppuType((const Reference<XRename>*)0) || + rType == ::getCppuType((const Reference<XAlterTable>*)0) || + rType == ::getCppuType((const Reference<XIndexesSupplier>*)0) || + rType == ::getCppuType((const Reference<XDataDescriptorFactory>*)0)) + return Any(); + + Any aRet = ::cppu::queryInterface(rType,static_cast< ::com::sun::star::lang::XUnoTunnel*> (this)); + if(aRet.hasValue()) + return aRet; + + return OTable_TYPEDEF::queryInterface(rType); +} +// ------------------------------------------------------------------------- +void SAL_CALL OFileTable::disposing(void) +{ + OTable::disposing(); + ::osl::MutexGuard aGuard(m_aMutex); + m_xMetaData = NULL; + delete m_pBuffer; + m_pBuffer = NULL; +} +//-------------------------------------------------------------------------- +Sequence< sal_Int8 > OFileTable::getUnoTunnelImplementationId() +{ + static ::cppu::OImplementationId * pId = 0; + if (! pId) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + if (! pId) + { + static ::cppu::OImplementationId aId; + pId = &aId; + } + } + return pId->getImplementationId(); +} + +// com::sun::star::lang::XUnoTunnel +//------------------------------------------------------------------ +sal_Int64 OFileTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException) +{ + if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + return (sal_Int64)this; + + return 0; +} + + diff --git a/connectivity/source/drivers/file/FTables.cxx b/connectivity/source/drivers/file/FTables.cxx new file mode 100644 index 000000000000..6150ed228b39 --- /dev/null +++ b/connectivity/source/drivers/file/FTables.cxx @@ -0,0 +1,161 @@ +/************************************************************************* + * + * $RCSfile: FTables.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_TABLES_HXX_ +#include "file/FTables.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_TABLE_HXX_ +#include "file/FTable.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_ +#include <com/sun/star/sdbc/KeyRule.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_ +#include <com/sun/star/sdbcx/KeyType.hpp> +#endif +#ifndef _CONNECTIVITY_FILE_CATALOG_HXX_ +#include "file/FCatalog.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_BCONNECTION_HXX_ +#include "file/FConnection.hxx" +#endif +//#ifndef _CONNECTIVITY_FILE_OEMPTYCOLLECTION_HXX_ +//#include "file/FEmptyCollection.hxx" +//#endif + +using namespace connectivity::file; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; + +namespace starutil = ::com::sun::star::util; +typedef connectivity::sdbcx::OCollection OCollection_TYPE; + +Reference< XNamed > OTables::createObject(const ::rtl::OUString& _rName) +{ +// ::rtl::OUString aName,aSchema; +// sal_Int32 nLen = _rName.indexOf('.'); +// aSchema = _rName.copy(0,nLen); +// aName = _rName.copy(nLen+1); +// +// Sequence< ::rtl::OUString > aTypes(1); +// aTypes[0] = ::rtl::OUString::createFromAscii("%"); +// // aTypes[0] = ::rtl::OUString::createFromAscii("TABLE"); +// // aTypes[1] = ::rtl::OUString::createFromAscii("SYSTEMTABLE"); +// +// Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), +// aSchema,aName,aTypes); + + Reference< XNamed > xRet = NULL; +// if(xResult.is()) +// { +// Reference< XRow > xRow(xResult,UNO_QUERY); +// if(xResult->next()) // there can be only one table with this name +// { +// OFileTable* pRet = new OFileTable(static_cast<OFileCatalog&>(m_rParent).getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers(), +// static_cast<OFileCatalog&>(m_rParent).getConnection(), +// aName,xRow->getString(4),xRow->getString(5),aSchema); +// xRet = pRet; +// } +// } +// + return xRet; +} +// ------------------------------------------------------------------------- +void OTables::impl_refresh( ) throw(RuntimeException) +{ + static_cast<OFileCatalog&>(m_rParent).refreshTables(); +} +// ------------------------------------------------------------------------- +void OTables::disposing(void) +{ + m_xMetaData = NULL; + OCollection::disposing(); +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > OTables::createEmptyObject() +{ + return Reference< XPropertySet >(); +} +//------------------------------------------------------------------ +Any SAL_CALL OTables::queryInterface( const Type & rType ) throw(RuntimeException) +{ + if( rType == ::getCppuType((const Reference<XColumnLocate>*)0) || + rType == ::getCppuType((const Reference<XDataDescriptorFactory>*)0) || + rType == ::getCppuType((const Reference<XAppend>*)0) || + rType == ::getCppuType((const Reference<XDrop>*)0)) + return Any(); + + typedef sdbcx::OCollection OTables_BASE; + return OTables_BASE::queryInterface(rType); +} + diff --git a/connectivity/source/drivers/file/file.xml b/connectivity/source/drivers/file/file.xml new file mode 100644 index 000000000000..253bccb84c4c --- /dev/null +++ b/connectivity/source/drivers/file/file.xml @@ -0,0 +1,70 @@ +<?xml version='1.0' encoding="UTF-8"?> +<!DOCTYPE COMPONENTDESCRIPTION PUBLIC "-//W3C//DTD HTML 3.2//EN" "componentdependencies.dtd"> +<COMPONENTDESCRIPTION> + +<Name> com.sun.star.sdbc.ODBCDriver </Name> + +<Description> + This is the implementation of the sdbc-odbc bridge. +</Description> + +<ModuleName> odbc </ModuleName> + +<LoaderName> com.sun.star.loader.SharedLibrary </LoaderName> + +<SupportedService> com.sun.star.sdbc.Driver </SupportedService> + +<ServiceDependency> ... </ServiceDependency> + +<ProjectBuildDependency> cppuhelper </ProjectBuildDependency> +<ProjectBuildDependency> cppu </ProjectBuildDependency> +<ProjectBuildDependency> sal </ProjectBuildDependency> +<ProjectBuildDependency> vos </ProjectBuildDependency> + +<RuntimeModuleDependency> cppuhelper </RuntimeModuleDependency> +<RuntimeModuleDependency> cppu1 </RuntimeModuleDependency> +<RuntimeModuleDependency> sal1 </RuntimeModuleDependency> +<RuntimeModuleDependency> vos </RuntimeModuleDependency> + +<Language> c++ </Language> + +<Status StatusValue="final"/> + +<Type> com.sun.star.util.XCancellable </Type> +<Type> com.sun.star.util.XNumberFormatter </Type> +<Type> com.sun.star.uno.TypeClass </Type> +<Type> com.sun.star.uno.XWeak </Type> +<Type> com.sun.star.uno.XAggregation </Type> +<Type> com.sun.star.beans.XPropertyState </Type> +<Type> com.sun.star.beans.XPropertySet </Type> +<Type> com.sun.star.beans.PropertyValue </Type> +<Type> com.sun.star.beans.XMultiPropertySet </Type> +<Type> com.sun.star.beans.XFastPropertySet </Type> +<Type> com.sun.star.lang.XTypeProvider </Type> +<Type> com.sun.star.lang.EventObject </Type> +<Type> com.sun.star.lang.XComponent </Type> +<Type> com.sun.star.lang.IllegalArgumentException </Type> +<Type> com.sun.star.lang.XMultiServiceFactory </Type> +<Type> com.sun.star.java.XJavaThreadRegister_11 </Type> +<Type> com.sun.star.java.XJavaVM </Type> +<Type> com.sun.star.sdbc.XConnection </Type> +<Type> com.sun.star.sdbc.XStatement </Type> +<Type> com.sun.star.sdbc.XResultSet </Type> +<Type> com.sun.star.sdbc.XResultSetMetaDataSupplier</Type> +<Type> com.sun.star.sdbc.XColumnLocate </Type> +<Type> com.sun.star.sdbc.XResultSetUpdate </Type> +<Type> com.sun.star.sdbc.XWarningsSupplier </Type> +<Type> com.sun.star.sdbc.XRowUpdate </Type> +<Type> com.sun.star.sdbc.XMultipleResults </Type> +<Type> com.sun.star.sdbc.XBatchExecution </Type> +<Type> com.sun.star.sdbc.XPreparedBatchExecution </Type> +<Type> com.sun.star.sdbc.XParameters </Type> +<Type> com.sun.star.sdbc.XOutParameters </Type> +<Type> com.sun.star.sdbc.DriverPropertyInfo </Type> +<Type> com.sun.star.sdbc.XRow </Type> +<Type> com.sun.star.sdb.XColumnUpdate </Type> +<Type> com.sun.star.sdb.XColumn </Type> + +</COMPONENTDESCRIPTION> + + diff --git a/connectivity/source/drivers/file/makefile.mk b/connectivity/source/drivers/file/makefile.mk new file mode 100644 index 000000000000..6497fcde76d3 --- /dev/null +++ b/connectivity/source/drivers/file/makefile.mk @@ -0,0 +1,158 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/..$/.. +PRJINC=..$/.. +PRJNAME=connectivity +TARGET=file + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ---------------------------------- +.IF "$(DBGUTIL_OJ)"!="" +ENVCFLAGS+=/FR$(SLO)$/ +.ENDIF + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/version.mk + +# --- Types ------------------------------------- + + +UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb +UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb + +UNOUCROUT=$(OUT)$/inc +INCPRE+=$(UNOUCROUT) + +# --- Types ------------------------------------- + +UNOTYPES+= \ + com.sun.star.util.XCancellable \ + com.sun.star.util.XNumberFormatter \ + com.sun.star.uno.TypeClass \ + com.sun.star.uno.XWeak \ + com.sun.star.uno.XAggregation \ + com.sun.star.beans.XPropertyState \ + com.sun.star.beans.XPropertySet \ + com.sun.star.beans.PropertyValue \ + com.sun.star.beans.XMultiPropertySet \ + com.sun.star.beans.XFastPropertySet \ + com.sun.star.lang.XTypeProvider \ + com.sun.star.lang.EventObject \ + com.sun.star.lang.XComponent \ + com.sun.star.lang.IllegalArgumentException \ + com.sun.star.lang.DisposedException \ + com.sun.star.lang.XMultiServiceFactory \ + com.sun.star.lang.XSingleServiceFactory \ + com.sun.star.registry.XRegistryKey \ + com.sun.star.java.XJavaThreadRegister_11 \ + com.sun.star.java.XJavaVM \ + com.sun.star.sdbc.XConnection \ + com.sun.star.sdbc.XStatement \ + com.sun.star.sdbc.XResultSet \ + com.sun.star.sdbc.XResultSetMetaDataSupplier \ + com.sun.star.sdbc.XColumnLocate \ + com.sun.star.sdbc.XResultSetUpdate \ + com.sun.star.sdbc.XWarningsSupplier \ + com.sun.star.sdbc.XRowUpdate \ + com.sun.star.sdbc.XMultipleResults \ + com.sun.star.sdbc.XBatchExecution \ + com.sun.star.sdbc.XPreparedBatchExecution \ + com.sun.star.sdbc.XParameters \ + com.sun.star.sdbc.XOutParameters \ + com.sun.star.sdbc.DriverPropertyInfo \ + com.sun.star.sdbc.XDriver \ + com.sun.star.sdbc.XRow \ + com.sun.star.sdbc.SQLWarning \ + com.sun.star.sdbc.ColumnSearch \ + com.sun.star.sdbc.DataType \ + com.sun.star.sdbc.ResultSetConcurrency \ + com.sun.star.sdbc.ResultSetType \ + com.sun.star.sdbc.ColumnValue \ + com.sun.star.sdb.XColumnUpdate \ + com.sun.star.sdb.XColumn \ + com.sun.star.lang.XServiceInfo + +# --- Files ------------------------------------- + +SLOFILES=\ + $(SLO)$/FConnection.obj \ + $(SLO)$/FValue.obj \ + $(SLO)$/FDatabaseMetaDataResultSetMetaData.obj \ + $(SLO)$/FDatabaseMetaDataResultSet.obj \ + $(SLO)$/FResultSetMetaData.obj \ + $(SLO)$/FColumns.obj \ + $(SLO)$/FTables.obj \ + $(SLO)$/FTable.obj \ + $(SLO)$/FCatalog.obj \ + $(SLO)$/FResultSet.obj \ + $(SLO)$/FStatement.obj \ + $(SLO)$/FPreparedStatement.obj \ + $(SLO)$/FDatabaseMetaData.obj \ + $(SLO)$/FDriver.obj + +# --- Targets ---------------------------------- + +.INCLUDE : target.mk + + diff --git a/connectivity/source/drivers/jdbc/Array.cxx b/connectivity/source/drivers/jdbc/Array.cxx new file mode 100644 index 000000000000..21566a30afc3 --- /dev/null +++ b/connectivity/source/drivers/jdbc/Array.cxx @@ -0,0 +1,238 @@ +/************************************************************************* + * + * $RCSfile: Array.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_ARRAY_HXX_ +#include "java/sql/Array.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_RESULTSET_HXX_ +#include "java/sql/ResultSet.hxx" +#endif + +using namespace connectivity; +//************************************************************** +//************ Class: java.sql.Array +//************************************************************** + +jclass java_sql_Array::theClass = 0; + +java_sql_Array::~java_sql_Array() +{} + +jclass java_sql_Array::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass( "java/sql/Array" ); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_sql_Array::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} +::rtl::OUString SAL_CALL java_sql_Array::getBaseTypeName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jstring out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/lang/String;"; + char * cMethodName = "getBaseTypeName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} + +sal_Int32 SAL_CALL java_sql_Array::getBaseType( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getBaseType"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int32)out; +} + +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL java_sql_Array::getArray( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jobjectArray out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + jobject obj = XNameAccess2Map(t.pEnv,typeMap); + char * cSignature = "(Ljava/util/Map;)[Ljava/lang/Object;"; + char * cMethodName = "getArray"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jobjectArray)t.pEnv->CallObjectMethod( object, mID, obj); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + t.pEnv->DeleteLocalRef(obj); + } //mID + } //t.pEnv + return ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >();//copyArrayAndDelete< ::com::sun::star::uno::Any,jobject>(t.pEnv,out); +} + +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL java_sql_Array::getArrayAtIndex( sal_Int32 index, sal_Int32 count, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jobjectArray out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + jobject obj = XNameAccess2Map(t.pEnv,typeMap); + char * cSignature = "(IILjava/util/Map;)[Ljava/lang/Object;"; + char * cMethodName = "getArray"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jobjectArray)t.pEnv->CallObjectMethod( object, mID, index,count,obj); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + t.pEnv->DeleteLocalRef(obj); + } //mID + } //t.pEnv + return ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >();//copyArrayAndDelete< ::com::sun::star::uno::Any,jobject>(t.pEnv,out); +} + +::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL java_sql_Array::getResultSet( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].l = XNameAccess2Map(t.pEnv,typeMap); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/util/Map;)Ljava/sql/ResultSet;"; + char * cMethodName = "getResultSet"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + t.pEnv->DeleteLocalRef((jobjectArray)args[0].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); + return NULL; +} + +::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL java_sql_Array::getResultSetAtIndex( sal_Int32 index, sal_Int32 count, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].l = XNameAccess2Map(t.pEnv,typeMap); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/util/Map;)Ljava/sql/ResultSet;"; + char * cMethodName = "getResultSet"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, index,count,args[0].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + t.pEnv->DeleteLocalRef((jobjectArray)args[0].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); + return NULL; +} + + + diff --git a/connectivity/source/drivers/jdbc/Blob.cxx b/connectivity/source/drivers/jdbc/Blob.cxx new file mode 100644 index 000000000000..7a2b3ab808a5 --- /dev/null +++ b/connectivity/source/drivers/jdbc/Blob.cxx @@ -0,0 +1,221 @@ +/************************************************************************* + * + * $RCSfile: Blob.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_BLOB_HXX_ +#include "java/sql/Blob.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_IO_INPUTSTREAM_HXX_ +#include "java/io/InputStream.hxx" +#endif +#ifndef _INC_MEMORY +#include <memory.h> +#endif + +using namespace connectivity; +//************************************************************** +//************ Class: java.sql.Blob +//************************************************************** + +jclass java_sql_Blob::theClass = 0; + +java_sql_Blob::~java_sql_Blob() +{} + +jclass java_sql_Blob::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass( "java/sql/Blob" ); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_sql_Blob::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +sal_Int64 SAL_CALL java_sql_Blob::length( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jlong out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()J"; + char * cMethodName = "length"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallLongMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int64)out; +} +::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL java_sql_Blob::getBytes( sal_Int64 pos, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + ::com::sun::star::uno::Sequence< sal_Int8 > aSeq; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(JI)[B"; + char * cMethodName = "getBytes"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jbyteArray out = (jbyteArray)t.pEnv->CallObjectMethod( object, mID,pos,length); + ThrowSQLException(t.pEnv,*this); + if(out) + { + jboolean p = sal_False; + aSeq.realloc(t.pEnv->GetArrayLength(out)); + memcpy(aSeq.getArray(),t.pEnv->GetByteArrayElements(out,&p),aSeq.getLength()); + t.pEnv->DeleteLocalRef(out); + } + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aSeq; +} + +::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_Blob::getBinaryStream( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()Ljava/io/InputStream;"; + char * cMethodName = "getBinaryStream"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_io_InputStream( t.pEnv, out ); +} + +sal_Int64 SAL_CALL java_sql_Blob::position( const ::com::sun::star::uno::Sequence< sal_Int8 >& pattern, sal_Int64 start ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jlong out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + jvalue args[1]; + // Parameter konvertieren + jbyteArray pByteArray = t.pEnv->NewByteArray(pattern.getLength()); + t.pEnv->SetByteArrayRegion(pByteArray,0,pattern.getLength(),(jbyte*)pattern.getConstArray()); + args[0].l = pByteArray; + // temporaere Variable initialisieren + char * cSignature = "([BI)J"; + char * cMethodName = "position"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallLongMethod( object, mID, args[0].l,start ); + ThrowSQLException(t.pEnv,*this); + t.pEnv->DeleteLocalRef((jbyteArray)args[0].l); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int64)out; +} + +sal_Int64 SAL_CALL java_sql_Blob::positionOfBlob( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& pattern, sal_Int64 start ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jlong out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + jvalue args[1]; + // Parameter konvertieren + args[0].l = 0; + // temporaere Variable initialisieren + char * cSignature = "(Ljava/sql/Blob;I)J"; + char * cMethodName = "position"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallLongMethod( object, mID,args[0].l,start ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int64)out; +} + diff --git a/connectivity/source/drivers/jdbc/Boolean.cxx b/connectivity/source/drivers/jdbc/Boolean.cxx new file mode 100644 index 000000000000..0d72ac908689 --- /dev/null +++ b/connectivity/source/drivers/jdbc/Boolean.cxx @@ -0,0 +1,114 @@ +/************************************************************************* + * + * $RCSfile: Boolean.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_LANG_BOOLEAN_HXX_ +#include "java/lang/Boolean.hxx" +#endif +using namespace connectivity; +//************************************************************** +//************ Class: java.lang.Boolean +//************************************************************** + +jclass java_lang_Boolean::theClass = 0; + +java_lang_Boolean::~java_lang_Boolean() +{} + +jclass java_lang_Boolean::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass("java/lang/Boolean"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_lang_Boolean::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +java_lang_Boolean::java_lang_Boolean( sal_Bool _par0 ): java_lang_Object( NULL, (jobject)NULL ){ + SDBThreadAttach t; + if( !t.pEnv ) + return; + jvalue args[1]; + // Parameter konvertieren + args[0].z = _par0; + // Java-Call fuer den Konstruktor absetzen + // temporaere Variable initialisieren + char * cSignature = "(Z)V"; + jobject tempObj; + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), "<init>", cSignature ); + tempObj = t.pEnv->NewObjectA( getMyClass(), mID, args ); + saveRef( t.pEnv, tempObj ); + t.pEnv->DeleteLocalRef( tempObj ); + // und aufraeumen +} + + diff --git a/connectivity/source/drivers/jdbc/CallableStatement.cxx b/connectivity/source/drivers/jdbc/CallableStatement.cxx new file mode 100644 index 000000000000..be6616d4b0ae --- /dev/null +++ b/connectivity/source/drivers/jdbc/CallableStatement.cxx @@ -0,0 +1,590 @@ +/************************************************************************* + * + * $RCSfile: CallableStatement.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_CALLABLESTATEMENT_HXX_ +#include "java/sql/CallableStatement.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_ARRAY_HXX_ +#include "java/sql/Array.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_CLOB_HXX_ +#include "java/sql/Clob.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_BLOB_HXX_ +#include "java/sql/Blob.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_REF_HXX_ +#include "java/sql/Ref.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_TIMESTAMP_HXX_ +#include "java/sql/Timestamp.hxx" +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif + +using namespace connectivity; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + + +IMPLEMENT_SERVICE_INFO(java_sql_CallableStatement,"com.sun.star.sdbcx.ACallableStatement","com.sun.star.sdbc.CallableStatement"); + +//************************************************************** +//************ Class: java.sql.CallableStatement +//************************************************************** +Any SAL_CALL java_sql_CallableStatement::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = java_sql_PreparedStatement::queryInterface(rType); + if(!aRet.hasValue()) + aRet = ::cppu::queryInterface(rType,static_cast< starsdbc::XRow*>(this),static_cast< starsdbc::XOutParameters*>(this)); + return aRet; +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL java_sql_CallableStatement::getTypes( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< starsdbc::XRow > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< starsdbc::XOutParameters > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),java_sql_PreparedStatement::getTypes()); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_CallableStatement::wasNull( ) throw(starsdbc::SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "wasNull"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} + +sal_Bool SAL_CALL java_sql_CallableStatement::getBoolean( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "getBoolean"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID, columnIndex ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +sal_Int8 SAL_CALL java_sql_CallableStatement::getByte( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jbyte out; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "(I)B"; + char * cMethodName = "getByte"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallByteMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +Sequence< sal_Int8 > SAL_CALL java_sql_CallableStatement::getBytes( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + Sequence< sal_Int8 > aSeq; + + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + char * cSignature = "(I)[B"; + char * cMethodName = "getBytes"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jbyteArray out(0); + out = (jbyteArray)t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + if (out) + { + jboolean p = sal_False; + aSeq.realloc(t.pEnv->GetArrayLength(out)); + memcpy(aSeq.getArray(),t.pEnv->GetByteArrayElements(out,&p),aSeq.getLength()); + t.pEnv->DeleteLocalRef(out); + } + // und aufraeumen + } //mID + } //t.pEnv + return aSeq; +} +::com::sun::star::util::Date SAL_CALL java_sql_CallableStatement::getDate( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Date;"; + char * cMethodName = "getDate"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return java_sql_Date( t.pEnv, out ); +} +double SAL_CALL java_sql_CallableStatement::getDouble( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jdouble out; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + + { + jvalue args[1]; + args[0].i = (sal_Int32)columnIndex; + // temporaere Variable initialisieren + char * cSignature = "(I)D"; + char * cMethodName = "getDouble"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallDoubleMethod( object, mID, args[0].i); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} + +float SAL_CALL java_sql_CallableStatement::getFloat( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jfloat out; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "(I)F"; + char * cMethodName = "getFloat"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallFloatMethod( object, mID, columnIndex ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} + +sal_Int32 SAL_CALL java_sql_CallableStatement::getInt( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "(I)I"; + char * cMethodName = "getInt"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID, columnIndex ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int32)out; +} + +sal_Int64 SAL_CALL java_sql_CallableStatement::getLong( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jlong out; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)columnIndex; + // temporaere Variable initialisieren + char * cSignature = "(I)J"; + char * cMethodName = "getLong"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallLongMethod( object, mID, args[0].i ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} + +Any SAL_CALL java_sql_CallableStatement::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(starsdbc::SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)columnIndex; + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/lang/Object;"; + char * cMethodName = "getObject"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].i); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return Any(); //out==0 ? 0 : new java_lang_Object( t.pEnv, out ); +} + +sal_Int16 SAL_CALL java_sql_CallableStatement::getShort( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jshort out; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)columnIndex; + // temporaere Variable initialisieren + char * cSignature = "(I)S"; + char * cMethodName = "getShort"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallShortMethod( object, mID, args[0].i); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int16)out; +} + +::rtl::OUString SAL_CALL java_sql_CallableStatement::getString( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jstring out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)columnIndex; + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/lang/String;"; + char * cMethodName = "getString"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID, columnIndex ); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} + + ::com::sun::star::util::Time SAL_CALL java_sql_CallableStatement::getTime( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Time;"; + char * cMethodName = "getTime"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return java_sql_Time( t.pEnv, out ); +} + + ::com::sun::star::util::DateTime SAL_CALL java_sql_CallableStatement::getTimestamp( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)columnIndex; + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Timestamp;"; + char * cMethodName = "getTimestamp"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].i); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return java_sql_Timestamp( t.pEnv, out ); +} + +void SAL_CALL java_sql_CallableStatement::registerOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(starsdbc::SQLException, RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + jvalue args[3]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].i = (sal_Int32)sqlType; + args[2].l = convertwchar_tToJavaString(t.pEnv,typeName); + // temporaere Variable initialisieren + char * cSignature = "(IILjava/lang/String;)V"; + char * cMethodName = "registerOutParameter"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].i,args[2].l); + ThrowSQLException(t.pEnv,*this); + t.pEnv->DeleteLocalRef((jstring)args[2].l); + } + } +} +void SAL_CALL java_sql_CallableStatement::registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + jvalue args[3]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].i = (sal_Int32)sqlType; + args[2].i = scale; + // temporaere Variable initialisieren + char * cSignature = "(III)V"; + char * cMethodName = "registerOutParameter"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].i,args[2].i); + ThrowSQLException(t.pEnv,*this); + } + } +} + +jclass java_sql_CallableStatement::theClass = 0; + +jclass java_sql_CallableStatement::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( !t.pEnv ) return (jclass)0; + jclass tempClass = t.pEnv->FindClass("java/sql/CallableStatement"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_sql_CallableStatement::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==0 ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_CallableStatement::getBinaryStream( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + Reference< starsdbc::XBlob > xBlob = getBlob(columnIndex); + return xBlob.is() ? xBlob->getBinaryStream() : Reference< ::com::sun::star::io::XInputStream >(); +} +Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_CallableStatement::getCharacterStream( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + Reference< starsdbc::XClob > xClob = getClob(columnIndex); + return xClob.is() ? xClob->getCharacterStream() : Reference< ::com::sun::star::io::XInputStream >(); +} + +Reference< starsdbc::XArray > SAL_CALL java_sql_CallableStatement::getArray( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Ref;"; + char * cMethodName = "getArray"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_Array( t.pEnv, out ); +} + +Reference< starsdbc::XClob > SAL_CALL java_sql_CallableStatement::getClob( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Ref;"; + char * cMethodName = "getClob"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_Clob( t.pEnv, out ); +} +Reference< starsdbc::XBlob > SAL_CALL java_sql_CallableStatement::getBlob( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Ref;"; + char * cMethodName = "getBlob"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_Blob( t.pEnv, out ); +} + +Reference< starsdbc::XRef > SAL_CALL java_sql_CallableStatement::getRef( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Ref;"; + char * cMethodName = "getRef"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_Ref( t.pEnv, out ); +} + + diff --git a/connectivity/source/drivers/jdbc/Class.cxx b/connectivity/source/drivers/jdbc/Class.cxx new file mode 100644 index 000000000000..e11dbd3a3b15 --- /dev/null +++ b/connectivity/source/drivers/jdbc/Class.cxx @@ -0,0 +1,185 @@ +/************************************************************************* + * + * $RCSfile: Class.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_LANG_CLASS_HXX_ +#include "java/lang/Class.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif + +using namespace connectivity; +//************************************************************** +//************ Class: java.lang.Class +//************************************************************** + +jclass java_lang_Class::theClass = 0; + +java_lang_Class::~java_lang_Class() +{} + +jclass java_lang_Class::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass("java/lang/Class"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_lang_Class::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +java_lang_Class * java_lang_Class::forName( const ::rtl::OUString& _par0 ) +{ + jobject out(NULL); + SDBThreadAttach t; + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].l = convertwchar_tToJavaString(t.pEnv,_par0); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;)Ljava/lang/Class;"; + char * cMethodName = "forName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetStaticMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallStaticObjectMethod( getMyClass(), mID, args[0].l ); + ThrowSQLException(t.pEnv,0); + // und aufraeumen + t.pEnv->DeleteLocalRef((jstring)args[0].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? NULL : new java_lang_Class( t.pEnv, out ); +} + +sal_Bool java_lang_Class::isAssignableFrom( java_lang_Class * _par0 ) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].l = _par0 != NULL ? ((java_lang_Object *)_par0)->getJavaObject() : NULL; + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/Class;)Z"; + char * cMethodName = "isAssignableFrom"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID, args[0].l ); + ThrowSQLException(t.pEnv,0); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} + +java_lang_Object * java_lang_Class::newInstance() +{ + jobject out(NULL); + SDBThreadAttach t; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/Object;"; + char * cMethodName = "newInstance"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,0); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? NULL : new java_lang_Object( t.pEnv, out ); +} + +::rtl::OUString java_lang_Class::getName() +{ + jstring out = (jstring)NULL; + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,0); + aStr = JavaString2String(t.pEnv, (jstring)out ); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} + diff --git a/connectivity/source/drivers/jdbc/Clob.cxx b/connectivity/source/drivers/jdbc/Clob.cxx new file mode 100644 index 000000000000..661b86541385 --- /dev/null +++ b/connectivity/source/drivers/jdbc/Clob.cxx @@ -0,0 +1,212 @@ +/************************************************************************* + * + * $RCSfile: Clob.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_CLOB_HXX_ +#include "java/sql/Clob.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_IO_READER_HXX_ +#include "java/io/Reader.hxx" +#endif +using namespace connectivity; +//************************************************************** +//************ Class: java.sql.Clob +//************************************************************** + +jclass java_sql_Clob::theClass = 0; + +java_sql_Clob::~java_sql_Clob() +{} + +jclass java_sql_Clob::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass( "java/sql/Clob" ); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_sql_Clob::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +sal_Int64 SAL_CALL java_sql_Clob::length( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jlong out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()J"; + char * cMethodName = "length"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallLongMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int64)out; +} + +::rtl::OUString SAL_CALL java_sql_Clob::getSubString( sal_Int64 pos, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jstring out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(JI)Ljava/lang/String;"; + char * cMethodName = "getBaseTypeName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID,pos,length); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} + +::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_Clob::getCharacterStream( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()Ljava/io/Reader;"; + char * cMethodName = "getCharacterStream"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_io_Reader( t.pEnv, out ); +} + +sal_Int64 SAL_CALL java_sql_Clob::position( const ::rtl::OUString& searchstr, sal_Int32 start ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jlong out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + jvalue args[1]; + // Parameter konvertieren + args[0].l = convertwchar_tToJavaString(t.pEnv,searchstr); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;I)J"; + char * cMethodName = "position"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallLongMethod( object, mID, args[0].l,start ); + ThrowSQLException(t.pEnv,*this); + t.pEnv->DeleteLocalRef((jstring)args[0].l); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int64)out; +} + +sal_Int64 SAL_CALL java_sql_Clob::positionOfClob( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& pattern, sal_Int64 start ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jlong out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + jvalue args[1]; + // Parameter konvertieren + args[0].l = 0; + // temporaere Variable initialisieren + char * cSignature = "(Ljava/sql/Clob;I)J"; + char * cMethodName = "position"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallLongMethod( object, mID,args[0].l,start ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int64)out; +} + + diff --git a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx new file mode 100644 index 000000000000..ff93e7751a38 --- /dev/null +++ b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx @@ -0,0 +1,3269 @@ +/************************************************************************* + * + * $RCSfile: DatabaseMetaData.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_DATABASEMETADATA_HXX_ +#include "java/sql/DatabaseMetaData.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_CONNECTION_HXX_ +#include "java/sql/Connection.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_RESULTSET_HXX_ +#include "java/sql/ResultSet.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_LANG_STRING_HXX_ +#include "java/lang/String.hxx" +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +//#ifndef _UTL_TYPES_HXX_ +//#include <unotools/types.hxx> +//#endif + +using namespace connectivity; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + +//************************************************************** +//************ Class: java.sql.DatabaseMetaData +//************************************************************** + +jclass java_sql_DatabaseMetaData::theClass = 0; + +java_sql_DatabaseMetaData::~java_sql_DatabaseMetaData() +{} + +jclass java_sql_DatabaseMetaData::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( !t.pEnv ) return (jclass)0; + jclass tempClass = t.pEnv->FindClass("java/sql/DatabaseMetaData"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} +// ------------------------------------------------------------------------- + + +void java_sql_DatabaseMetaData::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==0 ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTypeInfo( ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()Ljava/sql/ResultSet;"; + char * cMethodName = "getTypeInfo"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getCatalogs( ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()Ljava/sql/ResultSet;"; + char * cMethodName = "getCatalogs"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getCatalogSeparator( ) throw(SQLException, RuntimeException) +{ + jstring out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getCatalogSeparator"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getSchemas( ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + char * cSignature = "()Ljava/sql/ResultSet;"; + char * cMethodName = "getSchemas"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out ? new java_sql_ResultSet( t.pEnv, out ) : 0; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getColumnPrivileges( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[4]; + // temporaere Variable initialisieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema); + args[2].l = convertwchar_tToJavaString(t.pEnv,table); + args[3].l = convertwchar_tToJavaString(t.pEnv,columnNamePattern); + + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getTables"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = t.pEnv->CallObjectMethod( object, mID, args[0].l, args[1].l,args[2].l,args[3].l); + ThrowSQLException(t.pEnv,*this); + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(table.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + if(columnNamePattern.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[3].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out ? new java_sql_ResultSet( t.pEnv, out ) : 0; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getColumns( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[3]; + // temporaere Variable initialisieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schemaPattern.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schemaPattern); + args[2].l = convertwchar_tToJavaString(t.pEnv,tableNamePattern); + + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getTables"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = t.pEnv->CallObjectMethod( object, mID, args[0].l, args[1].l,args[2].l); + ThrowSQLException(t.pEnv,*this); + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(tableNamePattern.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out ? new java_sql_ResultSet( t.pEnv, out ) : 0; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[4]; + sal_Int32 len = types.getLength(); + if(len) + { + jobjectArray pObjArray = t.pEnv->NewObjectArray((jsize) len, java_lang_String::getMyClass(), 0); + const ::rtl::OUString* pBegin = types.getConstArray(); + for(sal_Int32 i=0;i<len;i++,++pBegin) + { + jstring aT = convertwchar_tToJavaString(t.pEnv,*pBegin); + //jstring aT = t.pEnv->NewStringUTF(_par3.GetToken(i)); + t.pEnv->SetObjectArrayElement(pObjArray,(jsize)i,aT); + } + args[3].l = pObjArray; + }else + args[3].l = 0; + // temporaere Variable initialisieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schemaPattern.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schemaPattern); + args[2].l = convertwchar_tToJavaString(t.pEnv,tableNamePattern); + + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getTables"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = t.pEnv->CallObjectMethod( object, mID, args[0].l, args[1].l,args[2].l,args[3].l); + ThrowSQLException(t.pEnv,*this); + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(tableNamePattern.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + //for(INT16 i=0;i<len;i++) + t.pEnv->DeleteLocalRef((jobjectArray)args[3].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out ? new java_sql_ResultSet( t.pEnv, out ) : 0; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getProcedureColumns( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + jvalue args[4]; + // Parameter konvertieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schemaPattern.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schemaPattern); + args[2].l = convertwchar_tToJavaString(t.pEnv,procedureNamePattern); + args[3].l = convertwchar_tToJavaString(t.pEnv,columnNamePattern); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getProcedures"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(procedureNamePattern.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + if(columnNamePattern.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[3].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getProcedures( const Any& + catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + jvalue args[3]; + // Parameter konvertieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schemaPattern.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schemaPattern); + args[2].l = convertwchar_tToJavaString(t.pEnv,procedureNamePattern); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getProcedures"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(procedureNamePattern.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getVersionColumns( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[3]; + // Parameter konvertieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema); + args[2].l = convertwchar_tToJavaString(t.pEnv,table); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getVersionColumns"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(table.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxBinaryLiteralLength"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxRowSize"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxCatalogNameLength"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxCharLiteralLength"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxColumnNameLength"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxColumnsInIndex"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxCursorNameLength"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxConnections"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxColumnsInTable"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxStatementLength"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxTableNameLength"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxTablesInSelect( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxTablesInSelect"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getExportedKeys( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[3]; + // Parameter konvertieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema); + args[2].l = convertwchar_tToJavaString(t.pEnv,table); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getExportedKeys"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(table.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getImportedKeys( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[3]; + // Parameter konvertieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema); + args[2].l = convertwchar_tToJavaString(t.pEnv,table); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getImportedKeys"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(table.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getPrimaryKeys( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[3]; + // Parameter konvertieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema); + args[2].l = convertwchar_tToJavaString(t.pEnv,table); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getPrimaryKeys"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(table.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getIndexInfo( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, + sal_Bool unique, sal_Bool approximate ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[5]; + // Parameter konvertieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema); + args[2].l = convertwchar_tToJavaString(t.pEnv,table); + args[3].z = unique; + args[4].z = approximate; + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZ)Ljava/sql/ResultSet;"; + char * cMethodName = "getIndexInfo"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l,args[3].z,args[4].z ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(table.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getBestRowIdentifier( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope, + sal_Bool nullable ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[3]; + // Parameter konvertieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema); + args[2].l = convertwchar_tToJavaString(t.pEnv,table); + + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getTablePrivileges"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l,scope,nullable); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(table.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTablePrivileges( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[3]; + // Parameter konvertieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schemaPattern.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schemaPattern); + args[2].l = convertwchar_tToJavaString(t.pEnv,tableNamePattern); + + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getTablePrivileges"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(tableNamePattern.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getCrossReference( + const Any& primaryCatalog, const ::rtl::OUString& primarySchema, + const ::rtl::OUString& primaryTable, const Any& foreignCatalog, + const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[6]; + // Parameter konvertieren + args[0].l = primaryCatalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(primaryCatalog)) : 0; + args[1].l = primarySchema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,primarySchema); + args[2].l = convertwchar_tToJavaString(t.pEnv,primaryTable); + args[3].l = foreignCatalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(foreignCatalog)) : 0; + args[4].l = foreignSchema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,foreignSchema); + args[5].l = convertwchar_tToJavaString(t.pEnv,foreignTable); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getCrossReference"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[2].l,args[2].l,args[3].l,args[4].l,args[5].l ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + if(primaryCatalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(args[1].l) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(primaryTable.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + if(foreignCatalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[3].l); + if(args[4].l) + t.pEnv->DeleteLocalRef((jstring)args[4].l); + if(foreignTable.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[5].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "doesMaxRowSizeIncludeBlobs"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "storesLowerCaseQuotedIdentifiers"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "storesLowerCaseIdentifiers"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "storesMixedCaseQuotedIdentifiers"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "storesMixedCaseIdentifiers"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "storesUpperCaseQuotedIdentifiers"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "storesUpperCaseIdentifiers"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsAlterTableWithAddColumn( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsAlterTableWithAddColumn"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsAlterTableWithDropColumn( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsAlterTableWithDropColumn"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxIndexLength"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsNonNullableColumns"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)0; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getCatalogTerm"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getIdentifierQuoteString( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)0; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getIdentifierQuoteString"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)0; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getExtraNameCharacters"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsDifferentTableCorrelationNames"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::isCatalogAtStart( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "isCatalogAtStart"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "dataDefinitionIgnoredInTransactions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "dataDefinitionCausesTransactionCommit"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsDataManipulationTransactionsOnly"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsDataDefinitionAndDataManipulationTransactions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsPositionedDelete"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsPositionedUpdate"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsOpenStatementsAcrossRollback"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsOpenStatementsAcrossCommit"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsOpenCursorsAcrossCommit"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsOpenCursorsAcrossRollback"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "supportsTransactionIsolationLevel"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID, level); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSchemasInDataManipulation( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsSchemasInDataManipulation"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsANSI92FullSQL"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsANSI92EntryLevelSQL"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsIntegrityEnhancementFacility"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsSchemasInIndexDefinitions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSchemasInTableDefinitions( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsSchemasInTableDefinitions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCatalogsInTableDefinitions( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsCatalogsInTableDefinitions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsCatalogsInIndexDefinitions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCatalogsInDataManipulation( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsCatalogsInDataManipulation"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsOuterJoins"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/sql/ResultSet;"; + char * cMethodName = "getTableTypes"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxStatements( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxStatements"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxProcedureNameLength"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxSchemaNameLength"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsTransactions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "allProceduresAreCallable"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsStoredProcedures"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsSelectForUpdate"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "allTablesAreSelectable"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "isReadOnly"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "usesLocalFiles"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "usesLocalFilePerTable"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsTypeConversion"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "nullPlusNonNullIsNull"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsColumnAliasing"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsTableCorrelationNames"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)fromType; + args[1].i = (sal_Int32)toType; + // temporaere Variable initialisieren + char * cSignature = "(II)Z"; + char * cMethodName = "supportsConvert"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID, args[0].i,args[0].i ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsExpressionsInOrderBy"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsGroupBy"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsGroupByBeyondSelect"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsGroupByUnrelated"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsMultipleTransactions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsMultipleResultSets"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsLikeEscapeClause"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsOrderByUnrelated"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsUnion"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsUnionAll"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsMixedCaseIdentifiers"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsMixedCaseQuotedIdentifiers"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "nullsAreSortedAtEnd"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "nullsAreSortedAtStart"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "nullsAreSortedHigh"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "nullsAreSortedLow"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsSchemasInProcedureCalls"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsSchemasInPrivilegeDefinitions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsCatalogsInProcedureCalls"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsCatalogsInPrivilegeDefinitions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsCorrelatedSubqueries"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsSubqueriesInComparisons"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsSubqueriesInExists"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsSubqueriesInIns"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsSubqueriesInQuantifieds"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsANSI92IntermediateSQL"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getURL( ) throw(SQLException, RuntimeException) +{ + + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getURL"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getUserName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)NULL; + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getDriverName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getDriverVersion( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)NULL; + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getDriverVersion"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getDatabaseProductVersion"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getDatabaseProductName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)NULL; + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getProcedureTerm"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)NULL; + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getSchemaTerm"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException) +{ + jint out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getDriverMajorVersion"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException) +{ + jint out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getDefaultTransactionIsolation"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException) +{ + jint out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getDriverMinorVersion"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)NULL; + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getSQLKeywords"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)NULL; + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getSearchStringEscape"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)NULL; + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getStringFunctions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)NULL; + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getTimeDateFunctions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)NULL; + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getSystemFunctions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_DatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException) +{ + jstring out = (jstring)NULL; + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getNumericFunctions"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsExtendedSQLGrammar"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsCoreSQLGrammar"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsMinimumSQLGrammar"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsFullOuterJoins"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException) +{ + jboolean out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsLimitedOuterJoins"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException) +{ + jint out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxColumnsInGroupBy"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException) +{ + jint out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxColumnsInOrderBy"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException) +{ + jint out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxColumnsInSelect"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_DatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException) +{ + jint out; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMaxUserNameLength"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "supportsResultSetType"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,setType); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(II)Z"; + char * cMethodName = "supportsResultSetConcurrency"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,setType,concurrency); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "ownUpdatesAreVisible"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,setType); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "ownDeletesAreVisible"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,setType); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "ownInsertsAreVisible"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,setType); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::othersUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "othersUpdatesAreVisible"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,setType); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::othersDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "othersDeletesAreVisible"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,setType); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::othersInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "othersInsertsAreVisible"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,setType); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::updatesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "updatesAreDetected"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,setType); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::deletesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "deletesAreDetected"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,setType); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::insertsAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "insertsAreDetected"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,setType); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_DatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "supportsBatchUpdates"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getUDTs( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, + const Sequence< sal_Int32 >& types ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[4]; + // temporaere Variable initialisieren + args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,connectivity::getString(catalog)) : 0; + args[1].l = schemaPattern.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schemaPattern); + args[2].l = convertwchar_tToJavaString(t.pEnv,typeNamePattern); + jintArray pArray = t.pEnv->NewIntArray(types.getLength()); + t.pEnv->SetIntArrayRegion(pArray,0,types.getLength(),(jint*)types.getConstArray()); + args[3].l = pArray; + + char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)Ljava/sql/ResultSet;"; + char * cMethodName = "getTables"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = t.pEnv->CallObjectMethod( object, mID, args[0].l, args[1].l,args[2].l,args[3].l); + ThrowSQLException(t.pEnv,*this); + if(catalog.hasValue()) + t.pEnv->DeleteLocalRef((jstring)args[0].l); + if(schemaPattern.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[1].l); + if(typeNamePattern.getLength()) + t.pEnv->DeleteLocalRef((jstring)args[2].l); + if(args[3].l) + t.pEnv->DeleteLocalRef((jintArray)args[3].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out ? new java_sql_ResultSet( t.pEnv, out ) : 0; +} +// ------------------------------------------------------------------------- +Reference< XConnection > SAL_CALL java_sql_DatabaseMetaData::getConnection( ) throw(SQLException, RuntimeException) +{ +// jobject out(0); +// SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); +// if( t.pEnv ){ +// char * cSignature = "()Ljava/sql/Connection;"; +// char * cMethodName = "getConnection"; +// // Java-Call absetzen +// jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); +// if( mID ) +// { +// out = t.pEnv->CallObjectMethod( object, mID); +// ThrowSQLException(t.pEnv,*this); +// } //mID +// } //t.pEnv +// // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! +// return out ? new java_sql_Connection( t.pEnv, out,this ) : 0; + return (Reference< XConnection >)m_pConnection; +} +// ------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/jdbc/Date.cxx b/connectivity/source/drivers/jdbc/Date.cxx new file mode 100644 index 000000000000..d024ae0ddbed --- /dev/null +++ b/connectivity/source/drivers/jdbc/Date.cxx @@ -0,0 +1,225 @@ +/************************************************************************* + * + * $RCSfile: Date.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_UTIL_DATE_HXX_ +#include "java/util/Date.hxx" +#endif + +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _CONNECTIVITY_DATECONVERSION_HXX_ +#include "DateConversion.hxx" +#endif + +using namespace connectivity; +//************************************************************** +//************ Class: java.util.Date +//************************************************************** + +jclass java_util_Date::theClass = 0; + +java_util_Date::java_util_Date( const ::com::sun::star::util::Date& _rOut ) //: java_lang_Object( NULL, (jobject)NULL ){ +{ + SDBThreadAttach t; + if( !t.pEnv ) + return; + jvalue args[1]; + // Parameter konvertieren + args[0].j = DateConversion::toINT32(_rOut); + // Java-Call fuer den Konstruktor absetzen + // temporaere Variable initialisieren + char * cSignature = "(J)V"; + jobject tempObj; + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), "<init>", cSignature ); + tempObj = t.pEnv->NewObjectA( getMyClass(), mID, args ); + saveRef( t.pEnv, tempObj ); + t.pEnv->DeleteLocalRef( tempObj ); + // und aufraeumen +} + +java_util_Date::~java_util_Date() +{} + +jclass java_util_Date::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass( "java/util/Date" ); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_util_Date::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +sal_Int32 java_util_Date::getMinutes() +{ + jint out(0); + SDBThreadAttach t; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMinutes"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + } //mID + } //t.pEnv + return (sal_Int32)out; +} + +sal_Int32 java_util_Date::getMonth() +{ + jint out(0); + SDBThreadAttach t; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMonth"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + } //mID + } //t.pEnv + return (sal_Int32)out; +} + +sal_Int32 java_util_Date::getSeconds() +{ + jint out(0); + SDBThreadAttach t; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getSeconds"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + } //mID + } //t.pEnv + return (sal_Int32)out; +} + +sal_Int32 java_util_Date::getYear() +{ + jint out(0); + SDBThreadAttach t; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getYear"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + } //mID + } //t.pEnv + return (sal_Int32)out; +} + +sal_Int32 java_util_Date::getDate() +{ + jint out(0); + SDBThreadAttach t; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getDate"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + } //mID + } //t.pEnv + return (sal_Int32)out; +} + +sal_Int32 java_util_Date::getHours() +{ + jint out(0); + SDBThreadAttach t; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getHours"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + } //mID + } //t.pEnv + return (sal_Int32)out; +} + diff --git a/connectivity/source/drivers/jdbc/DriverManager.cxx b/connectivity/source/drivers/jdbc/DriverManager.cxx new file mode 100644 index 000000000000..bc20c0147e97 --- /dev/null +++ b/connectivity/source/drivers/jdbc/DriverManager.cxx @@ -0,0 +1,147 @@ +/************************************************************************* + * + * $RCSfile: DriverManager.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_DRIVERMANAGER_HXX_ +#include "java/sql/DriverManager.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif + +using namespace connectivity; +//************************************************************** +//************ Class: java.sql.DriverManager +//************************************************************** + +jclass java_sql_DriverManager::theClass = 0; + +java_sql_DriverManager::~java_sql_DriverManager() +{} + +jclass java_sql_DriverManager::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( !t.pEnv ) return (jclass)0; + jclass tempClass = t.pEnv->FindClass("java/sql/DriverManager"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_sql_DriverManager::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==0 ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +jobject java_sql_DriverManager::getDriver(const ::rtl::OUString &url) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + jvalue args[1]; + // Parameter konvertieren + args[0].l = convertwchar_tToJavaString(t.pEnv,url); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;)Ljava/sql/Driver;"; + char * cMethodName = "getDriver"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetStaticMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = t.pEnv->CallStaticObjectMethod( getMyClass(), mID, args[0].l ); + ThrowSQLException(t.pEnv,0); + // und aufraeumen + t.pEnv->DeleteLocalRef((jstring)args[0].l); + } //mID + return t.pEnv->NewGlobalRef( out ); + } //t.pEnv + + return out; +} + + +void java_sql_DriverManager::setLoginTimeout(sal_Int32 _par0) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + jobject out(0); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)V"; + char * cMethodName = "setLoginTimeout"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + t.pEnv->CallStaticVoidMethod(getMyClass(), mID, _par0); + ThrowSQLException(t.pEnv,0); + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! +} + + diff --git a/connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx b/connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx new file mode 100644 index 000000000000..b38b2dbfb92b --- /dev/null +++ b/connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx @@ -0,0 +1,191 @@ +/************************************************************************* + * + * $RCSfile: DriverPropertyInfo.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_DRIVERPOPERTYINFO_HXX_ +#include "java/sql/DriverPropertyInfo.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_LANG_BOOLEAN_HXX_ +#include "java/lang/Boolean.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_LANG_STRING_HXX_ +#include "java/lang/String.hxx" +#endif +using namespace connectivity; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + + +//************************************************************** +//************ Class: java.sql.Driver +//************************************************************** + +jclass java_sql_DriverPropertyInfo::theClass = 0; +// -------------------------------------------------------------------------------- +java_sql_DriverPropertyInfo::~java_sql_DriverPropertyInfo() +{} +// -------------------------------------------------------------------------------- +jclass java_sql_DriverPropertyInfo::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ) + { + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( !t.pEnv ) return (jclass)0; + jclass tempClass = t.pEnv->FindClass("java/sql/DriverPropertyInfo"); + OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} +// -------------------------------------------------------------------------------- +void java_sql_DriverPropertyInfo::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==0 ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} +// -------------------------------------------------------------------------------- +java_sql_DriverPropertyInfo::operator starsdbc::DriverPropertyInfo() +{ + starsdbc::DriverPropertyInfo aInfo; + aInfo.Name = name(); + aInfo.Description = description(); + aInfo.IsRequired = required(); + aInfo.Value = value(); + aInfo.Choices = choices(); + + return aInfo; +} +// -------------------------------------------------------------------------------- +::rtl::OUString java_sql_DriverPropertyInfo::name() const +{ + ::rtl::OUString aStr; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + jfieldID id = t.pEnv->GetFieldID(java_lang_Boolean::getMyClass(),"name","Ljava/lang/String;"); + if(id) + aStr = JavaString2String(t.pEnv,(jstring)t.pEnv->GetObjectField( object, id)); + } //t.pEnv + return aStr; +} +// -------------------------------------------------------------------------------- +::rtl::OUString java_sql_DriverPropertyInfo::description() const +{ + ::rtl::OUString aStr; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + jfieldID id = t.pEnv->GetFieldID(java_lang_Boolean::getMyClass(),"description","Ljava/lang/String;"); + if(id) + aStr = JavaString2String(t.pEnv,(jstring)t.pEnv->GetObjectField( object, id)); + } //t.pEnv + return aStr; +} +// -------------------------------------------------------------------------------- +::rtl::OUString java_sql_DriverPropertyInfo::value() const +{ + ::rtl::OUString aStr; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + jfieldID id = t.pEnv->GetFieldID(java_lang_Boolean::getMyClass(),"value","Ljava/lang/String;"); + if(id) + aStr = JavaString2String(t.pEnv,(jstring)t.pEnv->GetObjectField( object, id)); + } //t.pEnv + return aStr; +} +// -------------------------------------------------------------------------------- +sal_Bool java_sql_DriverPropertyInfo::required() const +{ + jboolean out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + jfieldID id = t.pEnv->GetFieldID(java_lang_Boolean::getMyClass(),"required","B"); + if(id) + out = t.pEnv->GetBooleanField( object, id); + } //t.pEnv + return out; +} +// -------------------------------------------------------------------------------- +Sequence< ::rtl::OUString> java_sql_DriverPropertyInfo::choices() const +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + jfieldID id = t.pEnv->GetFieldID(java_lang_Boolean::getMyClass(),"choices","[Ljava/lang/String"); + if(id) + return copyArrayAndDelete(t.pEnv,(jobjectArray)t.pEnv->GetObjectField( object, id), ::rtl::OUString(),java_lang_String(NULL,NULL)); + } //t.pEnv + return Sequence< ::rtl::OUString>(); +} +// -------------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/jdbc/Exception.cxx b/connectivity/source/drivers/jdbc/Exception.cxx new file mode 100644 index 000000000000..9d579b2f226f --- /dev/null +++ b/connectivity/source/drivers/jdbc/Exception.cxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * $RCSfile: Exception.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#include "java/lang/Exception.hxx" +using namespace connectivity; +//************************************************************** +//************ Class: java.lang.Exception +//************************************************************** + +jclass java_lang_Exception::theClass = 0; + +java_lang_Exception::~java_lang_Exception() +{} + +jclass java_lang_Exception::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass("java/lang/Exception"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_lang_Exception::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + diff --git a/connectivity/source/drivers/jdbc/InputStream.cxx b/connectivity/source/drivers/jdbc/InputStream.cxx new file mode 100644 index 000000000000..566c0dd02df7 --- /dev/null +++ b/connectivity/source/drivers/jdbc/InputStream.cxx @@ -0,0 +1,187 @@ +/************************************************************************* + * + * $RCSfile: InputStream.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_IO_INPUTSTREAM_HXX_ +#include "java/io/InputStream.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _INC_MEMORY +#include <memory.h> +#endif + +using namespace connectivity; +//************************************************************** +//************ Class: java.io.InputStream +//************************************************************** + +jclass java_io_InputStream::theClass = 0; + +java_io_InputStream::~java_io_InputStream() +{} + +jclass java_io_InputStream::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass( "java/io/InputStream" ); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_io_InputStream::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +sal_Int32 SAL_CALL java_io_InputStream::readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + return readBytes(aData,nMaxBytesToRead); +} + +void SAL_CALL java_io_InputStream::skipBytes( sal_Int32 nBytesToSkip ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + char * cSignature = "(I)I"; + char * cMethodName = "skip"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = t.pEnv->CallIntMethod( object, mID,nBytesToSkip); + ThrowSQLException(t.pEnv,*this); + } + } //t.pEnv +} + +sal_Int32 SAL_CALL java_io_InputStream::available( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + char * cSignature = "()Z"; + char * cMethodName = "available"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } + } //t.pEnv + return out; +} +void SAL_CALL java_io_InputStream::closeInput( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + char * cSignature = "()V"; + char * cMethodName = "close"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } + } //t.pEnv +} +// ----------------------------------------------------- +sal_Int32 SAL_CALL java_io_InputStream::readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + jbyteArray pByteArray = t.pEnv->NewByteArray(nBytesToRead); + char * cSignature = "([BII)I"; + char * cMethodName = "read"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + while(!(out = t.pEnv->CallIntMethod( object, mID,pByteArray,0,nBytesToRead))) + ThrowSQLException(t.pEnv,*this); + if(out > 0) + { + jboolean p = sal_False; + memcpy(aData.getArray(),t.pEnv->GetByteArrayElements(pByteArray,&p),out); + } + } + t.pEnv->DeleteLocalRef((jbyteArray)pByteArray); + } //t.pEnv + return out; +} + + diff --git a/connectivity/source/drivers/jdbc/JDriver.cxx b/connectivity/source/drivers/jdbc/JDriver.cxx new file mode 100644 index 000000000000..80e1a7013623 --- /dev/null +++ b/connectivity/source/drivers/jdbc/JDriver.cxx @@ -0,0 +1,295 @@ +/************************************************************************* + * + * $RCSfile: JDriver.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_DRIVER_HXX_ +#include "java/sql/Driver.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_LANG_OBJECT_HXX_ +#include "java/lang/Object.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_DRIVERMANAGER_HXX_ +#include "java/sql/DriverManager.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_DRIVERPOPERTYINFO_HXX_ +#include "java/sql/DriverPropertyInfo.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_CONNECTION_HXX_ +#include "java/sql/Connection.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif + +using namespace connectivity; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + +// ------------------------------------------------------------------------- +java_sql_Driver::java_sql_Driver(const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) + : java_lang_Object(_rxFactory) +{ +} +// -------------------------------------------------------------------------------- +jclass java_sql_Driver::theClass = 0; +// -------------------------------------------------------------------------------- +java_sql_Driver::~java_sql_Driver() +{} +// static ServiceInfo +//------------------------------------------------------------------------------ +rtl::OUString java_sql_Driver::getImplementationName_Static( ) throw(RuntimeException) +{ + return ::rtl::OUString::createFromAscii("com.sun.star.sdbc.JDriver"); +} +//------------------------------------------------------------------------------ +Sequence< ::rtl::OUString > java_sql_Driver::getSupportedServiceNames_Static( ) throw (RuntimeException) +{ + Sequence< ::rtl::OUString > aSNS( 1 ); + aSNS[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.Driver"); + return aSNS; +} +//------------------------------------------------------------------ +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL connectivity::java_sql_Driver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ) +{ + return *(new java_sql_Driver(_rxFactory)); +} +// -------------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_Driver::getImplementationName( ) throw(RuntimeException) +{ + return getImplementationName_Static(); +} + +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_Driver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) +{ + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + const ::rtl::OUString* pSupported = aSupported.getConstArray(); + for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) + if (pSupported->equals(_rServiceName)) + return sal_True; + + return sal_False; +} + +// -------------------------------------------------------------------------------- +Sequence< ::rtl::OUString > SAL_CALL java_sql_Driver::getSupportedServiceNames( ) throw(RuntimeException) +{ + return getSupportedServiceNames_Static(); +} + +// -------------------------------------------------------------------------------- +jclass java_sql_Driver::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ) + { + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( !t.pEnv ) return (jclass)0; + jclass tempClass = t.pEnv->FindClass("java/sql/Driver"); + OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} +// -------------------------------------------------------------------------------- +void java_sql_Driver::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==0 ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} +// ------------------------------------------------------------------------- +Reference< starsdbc::XConnection > SAL_CALL java_sql_Driver::connect( const ::rtl::OUString& url, const + Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(starsdbc::SQLException, RuntimeException) +{ + Reference< starsdbc::XConnection > xRet; + + object = java_sql_DriverManager::getDriver(url); + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + jvalue args[2]; + // Parameter konvertieren + args[0].l = convertwchar_tToJavaString(t.pEnv,url); + args[1].l = createStringPropertyArray(t.pEnv,info); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;Ljava/util/Properties)Ljava/sql/Connection;"; + char * cMethodName = "connect"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = t.pEnv->CallObjectMethodA( getMyClass(), mID, args ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + t.pEnv->DeleteLocalRef((jstring)args[0].l); + t.pEnv->DeleteLocalRef((jstring)args[1].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + Reference< starsdbc::XConnection > xOut; + return out==0 ? 0 : new java_sql_Connection( t.pEnv, out,this ); + // return xOut; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_Driver::acceptsURL( const ::rtl::OUString& url ) throw(starsdbc::SQLException, RuntimeException) +{ + if(!object) + object = java_sql_DriverManager::getDriver(url); + + jboolean out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + if(!object) + ThrowSQLException(t.pEnv,*this); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;)Z"; + char * cMethodName = "acceptsURL"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +Sequence< starsdbc::DriverPropertyInfo > SAL_CALL java_sql_Driver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(starsdbc::SQLException, RuntimeException) +{ + if(!object) + object = java_sql_DriverManager::getDriver(url); + + jobjectArray out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + jvalue args[2]; + // Parameter konvertieren + args[0].l = convertwchar_tToJavaString(t.pEnv,url); + args[1].l = createStringPropertyArray(t.pEnv,info); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;Ljava/util/Properties)[Ljava/sql/DriverPropertyInfo;"; + char * cMethodName = "getPropertyInfo"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = (jobjectArray)t.pEnv->CallObjectMethodA( getMyClass(), mID, args ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + t.pEnv->DeleteLocalRef((jstring)args[0].l); + t.pEnv->DeleteLocalRef((jstring)args[1].l); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return copyArrayAndDelete( t.pEnv, out, starsdbc::DriverPropertyInfo(),java_sql_DriverPropertyInfo(NULL,NULL)); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_Driver::getMajorVersion( ) throw(RuntimeException) +{ + if(!object) + throw RuntimeException(); + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMajorVersion"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_Driver::getMinorVersion( ) throw(RuntimeException) +{ + if(!object) + throw RuntimeException(); + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getMinorVersion"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + + diff --git a/connectivity/source/drivers/jdbc/Object.cxx b/connectivity/source/drivers/jdbc/Object.cxx new file mode 100644 index 000000000000..c1caef75578e --- /dev/null +++ b/connectivity/source/drivers/jdbc/Object.cxx @@ -0,0 +1,396 @@ +/************************************************************************* + * + * $RCSfile: Object.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef _CONNECTIVITY_JAVA_LANG_OBJJECT_HXX_ +#include "java/lang/Class.hxx" +#endif + +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_UNO_EXCEPTION_HPP_ +#include <com/sun/star/uno/Exception.hpp> +#endif +#ifndef _COM_SUN_STAR_JAVA_XJAVATHREADREGISTER_11_HPP_ +#include <com/sun/star/java/XJavaThreadRegister_11.hpp> +#endif +#ifndef _COM_SUN_STAR_JAVA_XJAVAVM_HPP_ +#include <com/sun/star/java/XJavaVM.hpp> +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_SQLEXCEPTION_HXX_ +#include "java/sql/SQLException.hxx" +#endif +#ifndef _VOS_MODULE_HXX_ +#include <vos/module.hxx> +#endif +#ifndef _VOS_PROCESS_HXX_ +#include <vos/process.hxx> +#endif +#ifndef _VOS_MUTEX_HXX_ +#include <vos/mutex.hxx> +#endif +#ifndef _VOS_DYNLOAD_HXX_ +#include <vos/dynload.hxx> +#endif + +#ifndef _RTL_PROCESS_H_ +#include <rtl/process.h> +#endif + +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_ +#include <com/sun/star/uno/Sequence.hxx> +#endif + +using namespace connectivity; + +namespace starjava = com::sun::star::java; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + + +JavaVM * pJVM; +Reference< ::starjava::XJavaThreadRegister_11 > xRG11Ref; +sal_Bool bJRE_Error = sal_False; +JavaVM_ * pJRE_javaVM = NULL; + +int SDB_JRE_InitJava(const Reference<XMultiServiceFactory >& _rxFactory) +{ + int result = 0; + JNIEnv * pEnv = NULL; + + try + { + Reference< ::starjava::XJavaVM > xVM(_rxFactory->createInstance( + rtl::OUString::createFromAscii("com.sun.star.java.JavaVirtualMachine")), UNO_QUERY); + + OSL_ENSHURE(_rxFactory.is(),"SDB_JRE_InitJava: I have no factory!"); + if (!xVM.is() || !_rxFactory.is()) + throw Exception(); // -2; + + Sequence<sal_Int8> processID(16); + rtl_getGlobalProcessId( (sal_uInt8*) processID.getArray() ); + + Any uaJVM = xVM->getJavaVM( processID ); + + if (!uaJVM.hasValue()) + throw Exception(); // -5 + else + { + sal_Int32 nValue; + uaJVM >>= nValue; + pJVM = (JavaVM *)nValue; + } + + xRG11Ref = Reference< ::starjava::XJavaThreadRegister_11 >(xVM, UNO_QUERY); + if (xRG11Ref.is()) + xRG11Ref->registerThread(); + + pJVM->AttachCurrentThread(reinterpret_cast<void**>(&pEnv), NULL); + + /** + * Ist zur Zeit nicht funktionsfaehig, wegen Solaris Deadlock. + */ +// initStreamObserver(pEnv); +// if(pEnv->ExceptionOccurred()) +// { +// pEnv->ExceptionDescribe(); +// pEnv->ExceptionClear(); +// } + + } + catch (Exception e) + { + if (pEnv && pEnv->ExceptionOccurred()) + { + pEnv->ExceptionDescribe(); + pEnv->ExceptionClear(); + } + + result = -1; + } + + if(pEnv) + { + if(xRG11Ref.is()) + xRG11Ref->revokeThread(); + + if(!xRG11Ref.is() || !xRG11Ref->isThreadAttached()) + pJVM->DetachCurrentThread(); + } + + return result; +} + +SDBThreadAttach::SDBThreadAttach() : bDetach(sal_False), pEnv(NULL) +{ + attachThread(pEnv); +} + +SDBThreadAttach::SDBThreadAttach(const Reference<XMultiServiceFactory >& _rxFactory) : bDetach(sal_False), pEnv(NULL) +{ + attachThread(pEnv,_rxFactory); +} + +SDBThreadAttach::~SDBThreadAttach() +{ + detachThread(); +} + +void SDBThreadAttach::attachThread(JNIEnv * &pEnv,const Reference<XMultiServiceFactory >& _rxFactory) +{ + xInit(_rxFactory); + + if(xRG11Ref.is()) + { + xRG11Ref->registerThread(); + pJVM->AttachCurrentThread(reinterpret_cast<void**>(&pEnv), NULL); + } +} + +void SDBThreadAttach::detachThread() +{ + xInit(); + + if(xRG11Ref.is()) + { + xRG11Ref->revokeThread(); + if(!xRG11Ref->isThreadAttached()) + pJVM->DetachCurrentThread(); + } +} + +void SDBThreadAttach::xInit(const Reference<XMultiServiceFactory >& _rxFactory) +{ + StartJava(_rxFactory); +} + +sal_Bool SDBThreadAttach::IsJavaErrorOccured() +{ + return bJRE_Error; +} + +void SDBThreadAttach::setError() +{ + bJRE_Error = sal_True; +} + +static sal_Bool bStarted = sal_False; +int SDBThreadAttach::StartJava(const Reference<XMultiServiceFactory >& _rxFactory) +{ + static sal_Bool bRecFlag = sal_False; + static int err = 0; + if( !bStarted ) + { + vos::OGuard aGuard( vos::OMutex::getGlobalMutex() ); + if( !bStarted && !bRecFlag) + { + bRecFlag = sal_True; + // Application::EnterMultiThread(); + // bStarted = sal_True must set after the VM is complete initialized + err = SDB_JRE_InitJava(_rxFactory); + if(err) + setError(); + bStarted = sal_True; + } + } +// return bJRE_Error ? -1 : 0; + return err; +} + +// statische Variablen der Klasse: +jclass java_lang_Object::theClass = 0; +sal_uInt32 java_lang_Object::nObjCount = 0; + +jclass java_lang_Object::getMyClass() +{ + if( !theClass ) + { +// JNIEnv * pEnv = SDBThreadAttach::GetEnv(); + SDBThreadAttach t; + + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass( "java/lang/Object" ); + theClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + } + return theClass; +} +// der eigentliche Konstruktor +java_lang_Object::java_lang_Object(const Reference<XMultiServiceFactory >& _rxFactory) + : object( 0 ),m_xFactory(_rxFactory) +{ + SDBThreadAttach t(m_xFactory); + if( !t.pEnv ) + return; + + // Java-Call fuer den Konstruktor absetzen + // temporaere Variable initialisieren + char * cSignature = "()V"; + jclass tempClass; + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), "<init>", cSignature ); + tempClass = (jclass)t.pEnv->NewObjectA( getMyClass(), mID, NULL ); + saveRef( t.pEnv, tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); +} + +// der protected-Konstruktor fuer abgeleitete Klassen +java_lang_Object::java_lang_Object( JNIEnv * pXEnv, jobject myObj ) + : object( NULL ) +{ + SDBThreadAttach t; + if( t.pEnv && myObj ) + object = t.pEnv->NewGlobalRef( myObj ); +} + +java_lang_Object::~java_lang_Object() +{ + if( object ) + { + SDBThreadAttach t; + if( t.pEnv ) + t.pEnv->DeleteGlobalRef( object ); + } +} + +// der protected-Konstruktor fuer abgeleitete Klassen +void java_lang_Object::saveRef( JNIEnv * pXEnv, jobject myObj ) +{ + OSL_ENSHURE( myObj, "object in c++ -> Java Wrapper" ); + SDBThreadAttach t; + if( t.pEnv && myObj ) + object = t.pEnv->NewGlobalRef( myObj ); +} + + +java_lang_Class * java_lang_Object::getClass() +{ + jobject out; + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/Class;"; + char * cMethodName = "getClass"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = t.pEnv->CallObjectMethodA( object, mID, NULL ); + + return new java_lang_Class( t.pEnv, out ); + } //mID + } //pEnv + return NULL; +} + +::rtl::OUString java_lang_Object::toString() +{ + + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "toString"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + jstring out(0); + out = (jstring)t.pEnv->CallObjectMethod( object, mID); + + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //pEnv + return aStr; +} +// -------------------------------------------------------------------------------- +void java_lang_Object::ThrowSQLException(JNIEnv * pEnv,const Reference< XInterface> & _rContext) throw(SQLException, RuntimeException) +{ + jthrowable jThrow = NULL; + if(pEnv && (jThrow = pEnv->ExceptionOccurred())) + { + if(pEnv->IsInstanceOf(jThrow,java_sql_SQLException_BASE::getMyClass())) + { + throw java_sql_SQLException(java_sql_SQLException_BASE(pEnv,jThrow),_rContext); + } + else if(pEnv->IsInstanceOf(jThrow,java_lang_Throwable::getMyClass())) + { + java_lang_Throwable *pThrow = new java_lang_Throwable(pEnv,jThrow); + ::rtl::OUString aMsg = pThrow->getMessage(); + delete pThrow; + throw RuntimeException(aMsg,_rContext); + } + pEnv->ExceptionClear(); + } +} + + diff --git a/connectivity/source/drivers/jdbc/PreparedStatement.cxx b/connectivity/source/drivers/jdbc/PreparedStatement.cxx new file mode 100644 index 000000000000..4b7a5dd70e07 --- /dev/null +++ b/connectivity/source/drivers/jdbc/PreparedStatement.cxx @@ -0,0 +1,842 @@ +/************************************************************************* + * + * $RCSfile: PreparedStatement.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_PREPAREDSTATEMENT_HXX_ +#include "java/sql/PreparedStatement.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_RESULTSET_HXX_ +#include "java/sql/ResultSet.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_CONNECTION_HXX_ +#include "java/sql/Connection.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_TIMESTAMP_HXX_ +#include "java/sql/Timestamp.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif + +using namespace connectivity; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + +//************************************************************** +//************ Class: java.sql.PreparedStatement +//************************************************************** +IMPLEMENT_SERVICE_INFO(java_sql_PreparedStatement,"com.sun.star.sdbcx.JPreparedStatement","com.sun.star.sdbc.PreparedStatement"); + +jclass java_sql_PreparedStatement::theClass = 0; + +java_sql_PreparedStatement::~java_sql_PreparedStatement() +{} + +jclass java_sql_PreparedStatement::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( !t.pEnv ) return (jclass)0; + jclass tempClass = t.pEnv->FindClass("java/sql/PreparedStatement"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} +// ------------------------------------------------------------------------- + +void java_sql_PreparedStatement::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==0 ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} +// ------------------------------------------------------------------------- + +::com::sun::star::uno::Any SAL_CALL java_sql_PreparedStatement::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aRet = OStatement_BASE2::queryInterface(rType); + if(!aRet.hasValue()) + aRet = ::cppu::queryInterface( rType, + static_cast< XPreparedStatement*>(this), + static_cast< XParameters*>(this), + static_cast< XPreparedBatchExecution*>(this)); + return aRet; +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL java_sql_PreparedStatement::getTypes( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< XPreparedStatement > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< XParameters > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< XPreparedBatchExecution > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),OStatement_BASE2::getTypes()); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_PreparedStatement::execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "execute"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL java_sql_PreparedStatement::executeUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "executeUpdate"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = parameterIndex; + args[1].l = convertwchar_tToJavaString(t.pEnv,x); + // temporaere Variable initialisieren + char * cSignature = "(ILjava/lang/String;)V"; + char * cMethodName = "setString"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + t.pEnv->DeleteLocalRef((jstring)args[1].l); + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL java_sql_PreparedStatement::getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ +// jobject out(0); +// SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); +// if( t.pEnv ){ +// +// // temporaere Variable initialisieren +// char * cSignature = "()Ljava/sql/Connection;"; +// char * cMethodName = "getConnection"; +// // Java-Call absetzen +// jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); +// if( mID ){ +// out = t.pEnv->CallObjectMethod( object, mID); +// ThrowSQLException(t.pEnv,*this); +// } //mID +// } //t.pEnv +// // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! +// return out==0 ? 0 : new java_sql_Connection( t.pEnv, out ); + return (Reference< XConnection >)m_pConnection; +} +// ------------------------------------------------------------------------- + +::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL java_sql_PreparedStatement::executeQuery( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/sql/ResultSet;"; + char * cMethodName = "executeQuery"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].z = x; + // temporaere Variable initialisieren + char * cSignature = "(IZ)V"; + char * cMethodName = "setBoolean"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].z); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].b = x; + // temporaere Variable initialisieren + char * cSignature = "(IB)V"; + char * cMethodName = "setByte"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].b); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = parameterIndex; + java_sql_Date aT(x); + args[1].l = aT.getJavaObject(); + // temporaere Variable initialisieren + char * cSignature = "(ILjava/sql/Date;)V"; + char * cMethodName = "setDate"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + + +void SAL_CALL java_sql_PreparedStatement::setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + java_sql_Time aT(x); + args[1].l = aT.getJavaObject(); + // temporaere Variable initialisieren + char * cSignature = "(ILjava/sql/Time;)V"; + char * cMethodName = "setTime"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + java_sql_Timestamp aT(x); + args[1].l = aT.getJavaObject(); + // temporaere Variable initialisieren + char * cSignature = "(ILjava/sql/Timestamp;)V"; + char * cMethodName = "setTimestamp"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + + + +void SAL_CALL java_sql_PreparedStatement::setDouble( sal_Int32 parameterIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].d = x; + // temporaere Variable initialisieren + char * cSignature = "(ID)V"; + char * cMethodName = "setDouble"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].d); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].f = x; + // temporaere Variable initialisieren + char * cSignature = "(IF)V"; + char * cMethodName = "setFloat"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ +t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].f); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].i = (sal_Int32)x; + // temporaere Variable initialisieren + char * cSignature = "(II)V"; + char * cMethodName = "setInt"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].i); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].j = x; + // temporaere Variable initialisieren + char * cSignature = "(IJ)V"; + char * cMethodName = "setLong"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ +t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].j); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].i = (sal_Int32)sqlType; + // temporaere Variable initialisieren + char * cSignature = "(II)V"; + char * cMethodName = "setNull"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].i); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setClob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].l = 0; + // temporaere Variable initialisieren + char * cSignature = "(ILjava/sql/Clob;)V"; + char * cMethodName = "setClob"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setBlob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].l = 0; + // temporaere Variable initialisieren + char * cSignature = "(ILjava/sql/Blob;)V"; + char * cMethodName = "setBlob"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setArray( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].l = 0; + // temporaere Variable initialisieren + char * cSignature = "(ILjava/sql/Array;)V"; + char * cMethodName = "setArray"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setRef( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].l = 0; + // temporaere Variable initialisieren + char * cSignature = "(ILjava/sql/Ref;)V"; + char * cMethodName = "setRef"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].l = 0; + // temporaere Variable initialisieren + char * cSignature = "(ILjava/lang/Object;II)V"; + char * cMethodName = "setObject"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l,targetSqlType,scale); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].l = 0; + // temporaere Variable initialisieren + char * cSignature = "(ILjava/lang/Object;)V"; + char * cMethodName = "setObject"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setObject( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].l = 0; + // temporaere Variable initialisieren + char * cSignature = "(ILjava/lang/Object;)V"; + char * cMethodName = "setObject"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + args[1].s = (sal_Int16)x; + // temporaere Variable initialisieren + char * cSignature = "(IS)V"; + char * cMethodName = "setShort"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].s); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setBytes( sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + jbyteArray pByteArray = t.pEnv->NewByteArray(x.getLength()); + t.pEnv->SetByteArrayRegion(pByteArray,0,x.getLength(),(jbyte*)x.getConstArray()); + args[1].l = pByteArray; + // temporaere Variable initialisieren + char * cSignature = "(I[B)V"; + char * cMethodName = "setBytes"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i,args[1].l); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + t.pEnv->DeleteLocalRef(pByteArray); + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setCharacterStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + jvalue args2[3]; + jbyteArray pByteArray = t.pEnv->NewByteArray(length); + Sequence< sal_Int8> aSeq; + x->readBytes(aSeq,length); + t.pEnv->SetByteArrayRegion(pByteArray,0,length,(jbyte*)aSeq.getConstArray()); + args2[0].l = pByteArray; + args2[1].i = 0; + args2[2].i = (sal_Int32)length; + + // temporaere Variable initialisieren + char * cSignatureStream = "([BII)V"; + // Java-Call absetzen + jclass aClass = t.pEnv->FindClass("java/io/CharArrayInputStream"); + jmethodID mID2 = t.pEnv->GetMethodID( aClass, "<init>", cSignatureStream ); + jobject tempObj = NULL; + if(mID2) + tempObj = t.pEnv->NewObjectA( aClass, mID2, args2 ); + + // + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + // temporaere Variable initialisieren + char * cSignature = "(ILjava/io/InputStream;I)V"; + char * cMethodName = "setCharacterStream"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + t.pEnv->CallVoidMethod( object, mID, args[0].i,tempObj,length); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + t.pEnv->DeleteLocalRef(pByteArray); + t.pEnv->DeleteLocalRef(tempObj); + t.pEnv->DeleteLocalRef(aClass); + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + jvalue args2[3]; + jbyteArray pByteArray = t.pEnv->NewByteArray(length); + Sequence< sal_Int8> aSeq; + x->readBytes(aSeq,length); + t.pEnv->SetByteArrayRegion(pByteArray,0,length,(jbyte*)aSeq.getConstArray()); + args2[0].l = pByteArray; + args2[1].i = 0; + args2[2].i = (sal_Int32)length; + + // temporaere Variable initialisieren + char * cSignatureStream = "([BII)V"; + // Java-Call absetzen + jclass aClass = t.pEnv->FindClass("java/io/ByteArrayInputStream"); + jmethodID mID2 = t.pEnv->GetMethodID( aClass, "<init>", cSignatureStream ); + jobject tempObj = NULL; + if(mID2) + tempObj = t.pEnv->NewObjectA( aClass, mID2, args2 ); + + // + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)parameterIndex; + // temporaere Variable initialisieren + char * cSignature = "(ILjava/io/InputStream;I)V"; + char * cMethodName = "setBinaryStream"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + t.pEnv->CallVoidMethod( object, mID, args[0].i,tempObj,(sal_Int32)length); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + t.pEnv->DeleteLocalRef(pByteArray); + t.pEnv->DeleteLocalRef(tempObj); + t.pEnv->DeleteLocalRef(aClass); + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "clearParameters"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- +void SAL_CALL java_sql_PreparedStatement::clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "clearBatch"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_PreparedStatement::addBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "addBatch"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL java_sql_PreparedStatement::executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Sequence< sal_Int32 > aSeq; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()[I"; + char * cMethodName = "executeBatch"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jintArray out = (jintArray)t.pEnv->CallObjectMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + if(out) + { + jboolean p = sal_False; + aSeq.realloc(t.pEnv->GetArrayLength(out)); + memcpy(aSeq.getArray(),t.pEnv->GetIntArrayElements(out,&p),aSeq.getLength()); + t.pEnv->DeleteLocalRef(out); + } + } //mID + } //t.pEnv + return aSeq; +} +// ------------------------------------------------------------------------- + + diff --git a/connectivity/source/drivers/jdbc/Reader.cxx b/connectivity/source/drivers/jdbc/Reader.cxx new file mode 100644 index 000000000000..11ba4fa816e2 --- /dev/null +++ b/connectivity/source/drivers/jdbc/Reader.cxx @@ -0,0 +1,187 @@ +/************************************************************************* + * + * $RCSfile: Reader.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_IO_READER_HXX_ +#include "java/io/Reader.hxx" +#endif +#ifndef _INC_MEMORY +#include <memory.h> +#endif +using namespace connectivity; +//************************************************************** +//************ Class: java.io.Reader +//************************************************************** + +jclass java_io_Reader::theClass = 0; + +java_io_Reader::~java_io_Reader() +{} + +jclass java_io_Reader::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass( "java/io/Reader" ); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_io_Reader::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +sal_Int32 SAL_CALL java_io_Reader::readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + return readBytes(aData,nMaxBytesToRead); +} + +void SAL_CALL java_io_Reader::skipBytes( sal_Int32 nBytesToSkip ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + char * cSignature = "(I)I"; + char * cMethodName = "skip"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = t.pEnv->CallIntMethod( object, mID,nBytesToSkip); + ThrowSQLException(t.pEnv,*this); + } + } //t.pEnv +} + +sal_Int32 SAL_CALL java_io_Reader::available( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + char * cSignature = "()Z"; + char * cMethodName = "available"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } + } //t.pEnv + return out; +} +void SAL_CALL java_io_Reader::closeInput( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + char * cSignature = "()V"; + char * cMethodName = "close"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } + } //t.pEnv +} +// ----------------------------------------------------- +sal_Int32 SAL_CALL java_io_Reader::readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) +{ + OSL_ENSHURE(aData.getLength() < nBytesToRead," Sequence is smaller than BytesToRead"); + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + jcharArray pCharArray = t.pEnv->NewCharArray(nBytesToRead); + char * cSignature = "([CII)I"; + char * cMethodName = "read"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + while(!(out = t.pEnv->CallIntMethod( object, mID,pCharArray,0,nBytesToRead))) + ThrowSQLException(t.pEnv,*this); + if(out > 0) + { + jboolean p = sal_False; + if(aData.getLength() < out) + aData.realloc(out-aData.getLength()); + + memcpy(aData.getArray(),t.pEnv->GetCharArrayElements(pCharArray,&p),out); + } + } + t.pEnv->DeleteLocalRef((jcharArray)pCharArray); + } //t.pEnv + return out; +} + diff --git a/connectivity/source/drivers/jdbc/Ref.cxx b/connectivity/source/drivers/jdbc/Ref.cxx new file mode 100644 index 000000000000..50d9c39bb548 --- /dev/null +++ b/connectivity/source/drivers/jdbc/Ref.cxx @@ -0,0 +1,121 @@ +/************************************************************************* + * + * $RCSfile: Ref.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_REF_HXX_ +#include "java/sql/Ref.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +using namespace connectivity; +//************************************************************** +//************ Class: java.sql.Ref +//************************************************************** + +jclass java_sql_Ref::theClass = 0; + +java_sql_Ref::~java_sql_Ref() +{} + +jclass java_sql_Ref::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass( "java/sql/Ref" ); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_sql_Ref::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +::rtl::OUString SAL_CALL java_sql_Ref::getBaseTypeName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getBaseTypeName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} + diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx new file mode 100644 index 000000000000..94bd7aa197b4 --- /dev/null +++ b/connectivity/source/drivers/jdbc/ResultSet.cxx @@ -0,0 +1,1842 @@ +/************************************************************************* + * + * $RCSfile: ResultSet.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_RESULTSET_HXX_ +#include "java/sql/ResultSet.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_STATEMENT_HXX_ +#include "java/sql/Statement.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_SQLWARNING_HXX_ +#include "java/sql/SQLWarning.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_ARRAY_HXX_ +#include "java/sql/Array.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_REF_HXX_ +#include "java/sql/Ref.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_CLOB_HXX_ +#include "java/sql/Clob.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_TIMESTAMP_HXX_ +#include "java/sql/Timestamp.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_BLOB_HXX_ +#include "java/sql/Blob.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_RESULTSETMETADATA_HXX_ +#include "java/sql/ResultSetMetaData.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_IO_INPUTSTREAM_HXX_ +#include "java/io/InputStream.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +#ifndef _UTL_PROPERTY_HXX_ +#include <unotools/property.hxx> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ +#include <com/sun/star/beans/PropertyAttribute.hpp> +#endif + + +using namespace connectivity; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + +IMPLEMENT_SERVICE_INFO(java_sql_ResultSet,"com.sun.star.sdbcx.JResultSet","com.sun.star.sdbc.ResultSet"); +//************************************************************** +//************ Class: java.sql.ResultSet +//************************************************************** + +jclass java_sql_ResultSet::theClass = 0; + +java_sql_ResultSet::~java_sql_ResultSet() +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + char * cSignature = "()V"; + char * cMethodName = "close"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + t.pEnv->CallVoidMethod( object, mID); + } +} + +jclass java_sql_ResultSet::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( !t.pEnv ) return (jclass)0; + jclass tempClass = t.pEnv->FindClass("java/sql/ResultSet"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_sql_ResultSet::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==0 ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} +// ------------------------------------------------------------------------- +void java_sql_ResultSet::disposing(void) +{ + OPropertySetHelper::disposing(); + + ::osl::MutexGuard aGuard(m_aMutex); + m_xMetaData = NULL; +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Any SAL_CALL java_sql_ResultSet::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aRet = OPropertySetHelper::queryInterface(rType); + if(!aRet.hasValue()) + aRet = java_sql_ResultSet_BASE::queryInterface(rType); + return aRet; +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL java_sql_ResultSet::getTypes( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),java_sql_ResultSet_BASE::getTypes()); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL java_sql_ResultSet::findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].l = convertwchar_tToJavaString(t.pEnv,columnName); + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;)I"; + char * cMethodName = "findColumn"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID, args[0].l ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + t.pEnv->DeleteLocalRef((jstring)args[0].l); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- + + +Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_ResultSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/io/InputStream;"; + char * cMethodName = "getBinaryStream"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_io_InputStream( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_ResultSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/io/InputStream;"; + char * cMethodName = "getCharacterStream"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_io_InputStream( t.pEnv, out ); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "getBoolean"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID, columnIndex ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +sal_Int8 SAL_CALL java_sql_ResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jbyte out; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)B"; + char * cMethodName = "getByte"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallByteMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +Sequence< sal_Int8 > SAL_CALL java_sql_ResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + Sequence< sal_Int8 > aSeq; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + char * cSignature = "(I)[B"; + char * cMethodName = "getBytes"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jbyteArray out = (jbyteArray)t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + if (out) + { + jboolean p = sal_False; + aSeq.realloc(t.pEnv->GetArrayLength(out)); + memcpy(aSeq.getArray(),t.pEnv->GetByteArrayElements(out,&p),aSeq.getLength()); + t.pEnv->DeleteLocalRef(out); + } + // und aufraeumen + } //mID + } //t.pEnv + return aSeq; +} +// ------------------------------------------------------------------------- + +::com::sun::star::util::Date SAL_CALL java_sql_ResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Date;"; + char * cMethodName = "getDate"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return java_sql_Date( t.pEnv, out ); +} +// ------------------------------------------------------------------------- + +double SAL_CALL java_sql_ResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jdouble out; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)D"; + char * cMethodName = "getDouble"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallDoubleMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +float SAL_CALL java_sql_ResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jfloat out; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)F"; + char * cMethodName = "getFloat"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallFloatMethod( object, mID, columnIndex ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL java_sql_ResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)I"; + char * cMethodName = "getInt"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID, columnIndex ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL java_sql_ResultSet::getRow( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getRow"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- + +sal_Int64 SAL_CALL java_sql_ResultSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jlong out; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)J"; + char * cMethodName = "getLong"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallLongMethod( object, mID, columnIndex ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL java_sql_ResultSet::getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()Ljava/sql/ResultSetMetaData;"; + char * cMethodName = "getMetaData"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_ResultSetMetaData( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +Reference< XArray > SAL_CALL java_sql_ResultSet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Ref;"; + char * cMethodName = "getArray"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_Array( t.pEnv, out ); +} +// ------------------------------------------------------------------------- + +Reference< XClob > SAL_CALL java_sql_ResultSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Ref;"; + char * cMethodName = "getClob"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_Clob( t.pEnv, out ); +} +// ------------------------------------------------------------------------- +Reference< XBlob > SAL_CALL java_sql_ResultSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Ref;"; + char * cMethodName = "getBlob"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_Blob( t.pEnv, out ); +} +// ------------------------------------------------------------------------- + +Reference< XRef > SAL_CALL java_sql_ResultSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Ref;"; + char * cMethodName = "getRef"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? 0 : new java_sql_Ref( t.pEnv, out ); +} +// ------------------------------------------------------------------------- + +Any SAL_CALL java_sql_ResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[2]; + // Parameter konvertieren + args[0].i = (sal_Int32)columnIndex; + args[1].l = XNameAccess2Map(t.pEnv,typeMap); + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/lang/Object;"; + char * cMethodName = "getObject"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethodA( object, mID, args); + ThrowSQLException(t.pEnv,*this); + t.pEnv->DeleteLocalRef((jstring)args[1].l); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out==0 ? Any() : Any();//new java_lang_Object( t.pEnv, out ); +} +// ------------------------------------------------------------------------- + +sal_Int16 SAL_CALL java_sql_ResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jshort out; + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)S"; + char * cMethodName = "getShort"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallShortMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int16)out; +} +// ------------------------------------------------------------------------- + + +::rtl::OUString SAL_CALL java_sql_ResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jstring out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/lang/String;"; + char * cMethodName = "getString"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring)t.pEnv->CallObjectMethod( object, mID, columnIndex ); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +// ------------------------------------------------------------------------- + + +::com::sun::star::util::Time SAL_CALL java_sql_ResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Time;"; + char * cMethodName = "getTime"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, columnIndex); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return java_sql_Time( t.pEnv, out ); +} +// ------------------------------------------------------------------------- + + +::com::sun::star::util::DateTime SAL_CALL java_sql_ResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + jobject out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)columnIndex; + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/sql/Timestamp;"; + char * cMethodName = "getTimestamp"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID, args[0].i); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return java_sql_Timestamp( t.pEnv, out ); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSet::isAfterLast( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "isAfterLast"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_ResultSet::isFirst( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "isFirst"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_ResultSet::isLast( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "isLast"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +void SAL_CALL java_sql_ResultSet::beforeFirst( ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "isBeforeFirst"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- +void SAL_CALL java_sql_ResultSet::afterLast( ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "afterLast"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "close"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSet::first( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "first"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSet::last( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "last"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_ResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "absolute"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,row); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_ResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "relative"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID,row); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_ResultSet::previous( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "previous"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +Reference< XInterface > SAL_CALL java_sql_ResultSet::getStatement( ) throw(SQLException, RuntimeException) +{ +// jobject out(0); +// SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); +// if( t.pEnv ) +// { +// // temporaere Variable initialisieren +// char * cSignature = "()Ljava/sql/Statement;"; +// char * cMethodName = "getStatement"; +// // Java-Call absetzen +// jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); +// if( mID ){ +// out = t.pEnv->CallObjectMethod( object, mID ); +// ThrowSQLException(t.pEnv,*this); +// } //mID +// } //t.pEnv +// // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! +// return out==0 ? 0 : (::cppu::OWeakObject*)new java_sql_Statement( t.pEnv, out ); + return m_aStatement.get(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSet::rowDeleted( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "rowDeleted"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_ResultSet::rowInserted( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "rowInserted"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_ResultSet::rowUpdated( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "rowUpdated"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "isBeforeFirst"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSet::next( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "next"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSet::wasNull( ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Z"; + char * cMethodName = "wasNull"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::cancel( ) throw(::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "cancel"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID ); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv +} +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +void SAL_CALL java_sql_ResultSet::clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "clearWarnings"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Any SAL_CALL java_sql_ResultSet::getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jobject out(NULL); + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Ljava/sql/SQLWarning;"; + char * cMethodName = "getWarnings"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out ? makeAny(java_sql_SQLWarning(java_sql_SQLWarning_BASE( t.pEnv, out ),*this)) : ::com::sun::star::uno::Any(); +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "insertRow"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- +void SAL_CALL java_sql_ResultSet::updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "updateRow"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- +void SAL_CALL java_sql_ResultSet::deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "deleteRow"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "cancelRowUpdates"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "moveToInsertRow"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "moveToCurrentRow"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(I)V"; + char * cMethodName = "updateNull"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(IZ)V"; + char * cMethodName = "updateNull"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,x); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- +void SAL_CALL java_sql_ResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(IB)V"; + char * cMethodName = "updateByte"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,x); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(IS)V"; + char * cMethodName = "updateShort"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,x); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- +void SAL_CALL java_sql_ResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(II)V"; + char * cMethodName = "updateInt"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,x); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- +void SAL_CALL java_sql_ResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(IJ)V"; + char * cMethodName = "updateLong"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,x); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- + +// ----------------------------------------------------------------------- +void SAL_CALL java_sql_ResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(IF)V"; + char * cMethodName = "updateFloat"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,x); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "(ID)V"; + char * cMethodName = "updateDouble"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,x); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + jvalue args[1]; + // Parameter konvertieren + args[0].l = convertwchar_tToJavaString(t.pEnv,x); + // temporaere Variable initialisieren + char * cSignature = "(ILjava/lang/String)V"; + char * cMethodName = "updateString"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l); + ThrowSQLException(t.pEnv,*this); + t.pEnv->DeleteLocalRef((jstring)args[0].l); + } + } +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + jvalue args[1]; + jbyteArray aArray = t.pEnv->NewByteArray(x.getLength()); + t.pEnv->SetByteArrayRegion(aArray,0,x.getLength(),(jbyte*)x.getConstArray()); + + // Parameter konvertieren + args[0].l = aArray; + // temporaere Variable initialisieren + char * cSignature = "(I[B)V"; + char * cMethodName = "updateBytes"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l); + ThrowSQLException(t.pEnv,*this); + t.pEnv->DeleteLocalRef((jbyteArray)args[0].l); + } + } +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + jvalue args[1]; + // Parameter konvertieren + java_sql_Date aD(x); + args[0].l = aD.getJavaObject(); + // temporaere Variable initialisieren + char * cSignature = "(ILjava/sql/Date;)V"; + char * cMethodName = "updateDate"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + jvalue args[1]; + // Parameter konvertieren + java_sql_Time aD(x); + args[0].l = aD.getJavaObject(); + // temporaere Variable initialisieren + char * cSignature = "(ILjava/sql/Time;)V"; + char * cMethodName = "updateTime"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + jvalue args[1]; + java_sql_Timestamp aD(x); + // Parameter konvertieren + args[0].l = aD.getJavaObject(); + // temporaere Variable initialisieren + char * cSignature = "(I;Ljava/sql/Timestamp;)V"; + char * cMethodName = "updateTimestamp"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l); + ThrowSQLException(t.pEnv,*this); + } + } +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + jvalue args[1]; + // Parameter konvertieren + args[0].l = 0; + // temporaere Variable initialisieren + char * cSignature = "(ILjava/io/InputStream;I)V"; + char * cMethodName = "updateBinaryStream"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l,length); + ThrowSQLException(t.pEnv,*this); + t.pEnv->DeleteLocalRef((jobject)args[0].l); + } + } +} +// ------------------------------------------------------------------------- +void SAL_CALL java_sql_ResultSet::updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + jvalue args[1]; + // Parameter konvertieren + args[0].l = 0; + // temporaere Variable initialisieren + char * cSignature = "(ILjava/io/InputStream;I)V"; + char * cMethodName = "updateCharacterStream"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l,length); + ThrowSQLException(t.pEnv,*this); + t.pEnv->DeleteLocalRef((jobject)args[0].l); + } + } +} +// ------------------------------------------------------------------------- +void SAL_CALL java_sql_ResultSet::updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; + if( t.pEnv ) + { + jvalue args[1]; + switch(x.getValueTypeClass()) + { + case TypeClass_VOID: + args[0].l = NULL; + break; + + case TypeClass_BOOLEAN: + { + sal_Bool f; + x >>= f; + updateBoolean(columnIndex,f); + } + break; + case TypeClass_BYTE: + { + sal_Int8 f; + x >>= f; + updateByte(columnIndex,f); + } + break; + case TypeClass_SHORT: + case TypeClass_UNSIGNED_SHORT: + { + sal_Int16 f; + x >>= f; + updateShort(columnIndex,f); + } + break; + case TypeClass_LONG: + case TypeClass_UNSIGNED_LONG: + { + sal_Int32 f; + x >>= f; + updateInt(columnIndex,f); + } + break; + case TypeClass_HYPER: + case TypeClass_UNSIGNED_HYPER: + { + sal_Int64 f; + x >>= f; + updateLong(columnIndex,f); + } + break; + case TypeClass_FLOAT: + { + float f; + x >>= f; + updateFloat(columnIndex,f); + } + break; + case TypeClass_DOUBLE: + updateDouble(columnIndex,connectivity::getDouble(x)); + break; + case TypeClass_CHAR: + case TypeClass_STRING: + updateString(columnIndex,connectivity::getString(x)); + break; + case TypeClass_ENUM: + default: + OSL_ENSHURE(0,"UNKOWN TYPE for java_sql_ResultSet::updateObject"); + } + return; + // Parameter konvertieren + // temporaere Variable initialisieren + char * cSignature = "(ILjava/lang/Object;)V"; + char * cMethodName = "updateObject"; + // Java-Call absetzen +// jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); +// if( mID ){ +// t.pEnv->CallVoidMethodA( object, mID,columnIndex,args); + ThrowSQLException(t.pEnv,*this); +// switch(x.getValueTypeClass()) +// { +// case TypeClass_CHAR: +// case TypeClass_STRING: +// t.pEnv->DeleteLocalRef((jobject)args[0].l); +// break; +// } +// } + } +} +// ------------------------------------------------------------------------- + +void SAL_CALL java_sql_ResultSet::updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + OSL_ENSHURE(0,"java_sql_ResultSet::updateNumericObject: NYI"); +// SDBThreadAttach t; +// if( t.pEnv ) +// { +// jvalue args[1]; +// // Parameter konvertieren +// args[0].l = +// // temporaere Variable initialisieren +// char * cSignature = "(I;Ljava/lang/Object;I)V"; +// char * cMethodName = "updateObject"; +// // Java-Call absetzen +// jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); +// if( mID ){ +// t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l,scale); + // ThrowSQLException(t.pEnv,*this); +// t.pEnv->DeleteLocalRef((jobject)args[0].l); +// } +// } +} +// ------------------------------------------------------------------------- +//------------------------------------------------------------------------------ +sal_Int32 java_sql_ResultSet::getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getResultSetConcurrency"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*(::cppu::OWeakObject*)this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +//------------------------------------------------------------------------------ +sal_Int32 java_sql_ResultSet::getResultSetType() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getResultSetType"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*(::cppu::OWeakObject*)this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +//------------------------------------------------------------------------------ +sal_Int32 java_sql_ResultSet::getFetchDirection() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getFetchDirection"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*(::cppu::OWeakObject*)this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +//------------------------------------------------------------------------------ +sal_Int32 java_sql_ResultSet::getFetchSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getFetchSize"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*(::cppu::OWeakObject*)this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +//------------------------------------------------------------------------------ +::rtl::OUString java_sql_ResultSet::getCursorName() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getCursorName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,*(::cppu::OWeakObject*)this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} + +//------------------------------------------------------------------------------ +void java_sql_ResultSet::setFetchDirection(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)V"; + char * cMethodName = "setFetchDirection"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,_par0); + ThrowSQLException(t.pEnv,*(::cppu::OWeakObject*)this); + } //mID + } //t.pEnv + +} +//------------------------------------------------------------------------------ +void SAL_CALL java_sql_ResultSet::refreshRow( ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ) + { + // temporaere Variable initialisieren + char * cSignature = "()V"; + char * cMethodName = "refreshRow"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID); + ThrowSQLException(t.pEnv,*(::cppu::OWeakObject*)this); + } //mID + } //t.pEnv +} +//------------------------------------------------------------------------------ +void java_sql_ResultSet::setFetchSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)V"; + char * cMethodName = "setFetchSize"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID,_par0); + ThrowSQLException(t.pEnv,*(::cppu::OWeakObject*)this); + } //mID + } //t.pEnv + +} +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper* java_sql_ResultSet::createArrayHelper( ) const +{ + Sequence< Property > aProps(5); + Property* pProperties = aProps.getArray(); + sal_Int32 nPos = 0; + DECL_PROP1IMPL(CURSORNAME, ::rtl::OUString) PropertyAttribute::READONLY); + DECL_PROP0(FETCHDIRECTION, sal_Int32); + DECL_PROP0(FETCHSIZE, sal_Int32); + DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY); + DECL_PROP1IMPL(RESULTSETTYPE, sal_Int32) PropertyAttribute::READONLY); + + return new ::cppu::OPropertyArrayHelper(aProps); +} +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper & java_sql_ResultSet::getInfoHelper() +{ + return *const_cast<java_sql_ResultSet*>(this)->getArrayHelper(); +} +// ------------------------------------------------------------------------- +sal_Bool java_sql_ResultSet::convertFastPropertyValue( + ::com::sun::star::uno::Any & rConvertedValue, + ::com::sun::star::uno::Any & rOldValue, + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue ) + throw (::com::sun::star::lang::IllegalArgumentException) +{ + switch(nHandle) + { + case PROPERTY_ID_CURSORNAME: + case PROPERTY_ID_RESULTSETCONCURRENCY: + case PROPERTY_ID_RESULTSETTYPE: + throw ::com::sun::star::lang::IllegalArgumentException(); + break; + case PROPERTY_ID_FETCHDIRECTION: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection()); + case PROPERTY_ID_FETCHSIZE: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize()); + default: + ; + } + return sal_False; +} +// ------------------------------------------------------------------------- +void java_sql_ResultSet::setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue + ) + throw (::com::sun::star::uno::Exception) +{ + switch(nHandle) + { + case PROPERTY_ID_CURSORNAME: + case PROPERTY_ID_RESULTSETCONCURRENCY: + case PROPERTY_ID_RESULTSETTYPE: + throw ::com::sun::star::uno::Exception(); + break; + case PROPERTY_ID_FETCHDIRECTION: + setFetchDirection(connectivity::getINT32(rValue)); + break; + case PROPERTY_ID_FETCHSIZE: + setFetchSize(connectivity::getINT32(rValue)); + break; + default: + ; + } +} +// ------------------------------------------------------------------------- +void java_sql_ResultSet::getFastPropertyValue( + ::com::sun::star::uno::Any& rValue, + sal_Int32 nHandle + ) const +{ + switch(nHandle) + { + case PROPERTY_ID_CURSORNAME: + rValue <<= getCursorName(); + break; + case PROPERTY_ID_RESULTSETCONCURRENCY: + rValue <<= getResultSetConcurrency(); + break; + case PROPERTY_ID_RESULTSETTYPE: + rValue <<= getResultSetType(); + break; + case PROPERTY_ID_FETCHDIRECTION: + rValue <<= getFetchDirection(); + break; + case PROPERTY_ID_FETCHSIZE: + rValue <<= getFetchSize(); + break; + } +} + + + diff --git a/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx b/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx new file mode 100644 index 000000000000..b44bc920b6ef --- /dev/null +++ b/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx @@ -0,0 +1,563 @@ +/************************************************************************* + * + * $RCSfile: ResultSetMetaData.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_RESULTSETMETADATA_HXX_ +#include "java/sql/ResultSetMetaData.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +using namespace connectivity; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +//************************************************************** +//************ Class: java.sql.ResultSetMetaData +//************************************************************** + +jclass java_sql_ResultSetMetaData::theClass = 0; + +java_sql_ResultSetMetaData::~java_sql_ResultSetMetaData() +{} + +jclass java_sql_ResultSetMetaData::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( !t.pEnv ) return (jclass)0; + jclass tempClass = t.pEnv->FindClass("java/sql/ResultSetMetaData"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} +// ------------------------------------------------------------------------- + +void java_sql_ResultSetMetaData::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==0 ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "(I)I"; + char * cMethodName = "getColumnDisplaySize"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID,column); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "(I)I"; + char * cMethodName = "getColumnType"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID,column); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getColumnCount"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,*this); + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)column; + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "isCaseSensitive"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + out = (sal_Bool)t.pEnv->CallIntMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getSchemaName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/lang/String;"; + char * cMethodName = "getSchemaName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } + + // und aufraeumen + } //t.pEnv + return aStr; +} +// ------------------------------------------------------------------------- + +::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/lang/String;"; + char * cMethodName = "getColumnName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } + + // und aufraeumen + } //t.pEnv + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/lang/String;"; + char * cMethodName = "getTableName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } + + // und aufraeumen + } //t.pEnv + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getCatalogName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/lang/String;"; + char * cMethodName = "getCatalogName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } + + // und aufraeumen + } //t.pEnv + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/lang/String;"; + char * cMethodName = "getColumnTypeName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } + + // und aufraeumen + } //t.pEnv + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/lang/String;"; + char * cMethodName = "getColumnLabel"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } + + // und aufraeumen + } //t.pEnv + return aStr; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL java_sql_ResultSetMetaData::getColumnServiceName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + ::rtl::OUString aStr; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Ljava/lang/String;"; + char * cMethodName = "getColumnClassName"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + { + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + if(out) + aStr = JavaString2String(t.pEnv,out); + } + + // und aufraeumen + } //t.pEnv + return aStr; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)column; + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "isCurrency"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + out = (sal_Bool)t.pEnv->CallIntMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)column; + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "isAutoIncrement"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + out = (sal_Bool)t.pEnv->CallIntMethod( object, mID, column); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + + +sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)column; + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "isSigned"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ) + out = (sal_Bool)t.pEnv->CallIntMethod( object, mID, column); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)column; + // temporaere Variable initialisieren + char * cSignature = "(I)I"; + char * cMethodName = "getPrecision"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_ResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)column; + // temporaere Variable initialisieren + char * cSignature = "(I)I"; + char * cMethodName = "getScale"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL java_sql_ResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)column; + // temporaere Variable initialisieren + char * cSignature = "(I)I"; + char * cMethodName = "isNullable"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return (sal_Int32)out; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "isSearchable"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "isReadOnly"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL java_sql_ResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "isDefinitelyWritable"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL java_sql_ResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + jboolean out(sal_False); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "(I)Z"; + char * cMethodName = "isWritable"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallBooleanMethod( object, mID, column ); + ThrowSQLException(t.pEnv,*this); + // und aufraeumen + } //mID + } //t.pEnv + return out; +} +// ------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/jdbc/SQLException.cxx b/connectivity/source/drivers/jdbc/SQLException.cxx new file mode 100644 index 000000000000..1a83ce996314 --- /dev/null +++ b/connectivity/source/drivers/jdbc/SQLException.cxx @@ -0,0 +1,186 @@ +/************************************************************************* + * + * $RCSfile: SQLException.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:22 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_SQLEXCEPTION_HXX_ +#include "java/sql/SQLException.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif + +using namespace connectivity; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +//************************************************************** +//************ Class: java.sql.SQLException +//************************************************************** +java_sql_SQLException::java_sql_SQLException( const java_sql_SQLException_BASE& _rException,const Reference< XInterface> & _rContext) + : starsdbc::SQLException( _rException.getMessage(), + _rContext, + _rException.getSQLState(), + _rException.getErrorCode(), + makeAny(_rException.getNextException()) + ) +{ +} + +java_sql_SQLException_BASE::java_sql_SQLException_BASE( JNIEnv * pEnv, jobject myObj ) : java_lang_Exception( pEnv, myObj ) +{ +} + +jclass java_sql_SQLException_BASE::theClass = 0; + +java_sql_SQLException_BASE::~java_sql_SQLException_BASE() +{} + + +jclass java_sql_SQLException_BASE::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass("java/sql/SQLException"); + OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + if(!tempClass) + { + t.pEnv->ExceptionDescribe(); + t.pEnv->ExceptionClear(); + } + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_sql_SQLException_BASE::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +starsdbc::SQLException java_sql_SQLException_BASE::getNextException() const +{ + jobject out = NULL; + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/sql/Exception;"; + char * cMethodName = "getNextException"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,0); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return out ? (starsdbc::SQLException)java_sql_SQLException(java_sql_SQLException_BASE(t.pEnv,out),0) : starsdbc::SQLException(); +} + +::rtl::OUString java_sql_SQLException_BASE::getSQLState() const +{ + jstring out = (jstring)NULL; + SDBThreadAttach t; + ::rtl::OUString aStr; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getSQLState"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = (jstring) t.pEnv->CallObjectMethod( object, mID); + ThrowSQLException(t.pEnv,0); + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +sal_Int32 java_sql_SQLException_BASE::getErrorCode() const +{ + jint out(0); + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getErrorCode"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + ThrowSQLException(t.pEnv,0); + } //mID + } //t.pEnv + return (sal_Int32)out; +} + diff --git a/connectivity/source/drivers/jdbc/SQLWarning.cxx b/connectivity/source/drivers/jdbc/SQLWarning.cxx new file mode 100644 index 000000000000..aec20eeeb495 --- /dev/null +++ b/connectivity/source/drivers/jdbc/SQLWarning.cxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * $RCSfile: SQLWarning.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_SQLWARNING_HXX_ +#include "java/sql/SQLWarning.hxx" +#endif +using namespace connectivity; +//************************************************************** +//************ Class: java.sql.SQLWarning +//************************************************************** + +jclass java_sql_SQLWarning_BASE::theClass = 0; + +java_sql_SQLWarning_BASE::~java_sql_SQLWarning_BASE() +{} + +jclass java_sql_SQLWarning_BASE::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass( "java/sql/SQLWarning" ); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_sql_SQLWarning_BASE::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + diff --git a/connectivity/source/drivers/jdbc/String.cxx b/connectivity/source/drivers/jdbc/String.cxx new file mode 100644 index 000000000000..a25472d00a52 --- /dev/null +++ b/connectivity/source/drivers/jdbc/String.cxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * $RCSfile: String.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_LANG_STRING_HXX_ +#include "java/lang/String.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +using namespace connectivity; +//************************************************************** +//************ Class: java.lang.String +//************************************************************** + +jclass java_lang_String::theClass = 0; + +java_lang_String::~java_lang_String() +{} + +jclass java_lang_String::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass("java/lang/String"); + OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} +//-------------------------------------------------------------------------- +void java_lang_String::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} +//-------------------------------------------------------------------------- +java_lang_String::java_lang_String( const ::rtl::OUString& _par0 ): java_lang_Object( NULL, (jobject)NULL ) +{ + SDBThreadAttach t; + if( !t.pEnv ) + return; + jvalue args[1]; + // Parameter konvertieren + args[0].l = convertwchar_tToJavaString(t.pEnv,_par0); + // Java-Call fuer den Konstruktor absetzen + // temporaere Variable initialisieren + char * cSignature = "(Ljava/lang/String;)V"; + jobject tempObj; + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), "<init>", cSignature ); + tempObj = t.pEnv->NewObjectA( getMyClass(), mID, args ); + saveRef( t.pEnv, tempObj ); + t.pEnv->DeleteLocalRef( tempObj ); + t.pEnv->DeleteLocalRef((jstring)args[0].l); +} +//-------------------------------------------------------------------------- +java_lang_String::operator ::rtl::OUString() +{ + SDBThreadAttach t; + if(!t.pEnv) + return ::rtl::OUString(); + return JavaString2String(t.pEnv,(jstring)object); +} + diff --git a/connectivity/source/drivers/jdbc/Throwable.cxx b/connectivity/source/drivers/jdbc/Throwable.cxx new file mode 100644 index 000000000000..336425836cb6 --- /dev/null +++ b/connectivity/source/drivers/jdbc/Throwable.cxx @@ -0,0 +1,160 @@ +/************************************************************************* + * + * $RCSfile: Throwable.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_LANG_THROWABLE_HXX_ +#include "java/lang/Throwable.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +using namespace connectivity; +//************************************************************** +//************ Class: java.lang.Throwable +//************************************************************** + +jclass java_lang_Throwable::theClass = 0; + +java_lang_Throwable::~java_lang_Throwable() +{} + +jclass java_lang_Throwable::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; + if( !t.pEnv ) return (jclass)NULL; + jclass tempClass = t.pEnv->FindClass("java/lang/Throwable"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_lang_Throwable::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==NULL ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +::rtl::OUString java_lang_Throwable::getMessage() const +{ + ::rtl::OUString aStr; + SDBThreadAttach t; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getMessage"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); + + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} + +::rtl::OUString java_lang_Throwable::getLocalizedMessage() const +{ + ::rtl::OUString aStr; + SDBThreadAttach t; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "getLocalizedMessage"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); + + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} +::rtl::OUString java_lang_Throwable::toString() const +{ + ::rtl::OUString aStr; + SDBThreadAttach t; + if( t.pEnv ){ + // temporaere Variable initialisieren + char * cSignature = "()Ljava/lang/String;"; + char * cMethodName = "toString"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID); + + if(out) + aStr = JavaString2String(t.pEnv,out); + } //mID + } //t.pEnv + // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + return aStr; +} + diff --git a/connectivity/source/drivers/jdbc/Timestamp.cxx b/connectivity/source/drivers/jdbc/Timestamp.cxx new file mode 100644 index 000000000000..6da40bc40653 --- /dev/null +++ b/connectivity/source/drivers/jdbc/Timestamp.cxx @@ -0,0 +1,240 @@ +/************************************************************************* + * + * $RCSfile: Timestamp.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_TIMESTAMP_HXX_ +#include "java/sql/Timestamp.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _CONNECTIVITY_DATECONVERSION_HXX_ +#include "DateConversion.hxx" +#endif +using namespace connectivity; +//************************************************************** +//************ Class: java.sql.Date +//************************************************************** + +jclass java_sql_Date::theClass = 0; + +java_sql_Date::~java_sql_Date() +{} + +jclass java_sql_Date::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( !t.pEnv ) return (jclass)0; + jclass tempClass = t.pEnv->FindClass("java/sql/Date"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_sql_Date::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==0 ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +//************************************************************** +//************ Class: java.sql.Time +//************************************************************** + +jclass java_sql_Time::theClass = 0; + +java_sql_Time::~java_sql_Time() +{} + +jclass java_sql_Time::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( !t.pEnv ) return (jclass)0; + jclass tempClass = t.pEnv->FindClass("java/sql/Time"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_sql_Time::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==0 ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +java_sql_Time::java_sql_Time( const ::com::sun::star::util::Time& _rOut ): java_util_Date( NULL, (jobject)NULL ) +{ + SDBThreadAttach t; + if( !t.pEnv ) + return; + jvalue args[1]; + // Parameter konvertieren + args[0].j = DateConversion::toINT32(_rOut); + // Java-Call fuer den Konstruktor absetzen + // temporaere Variable initialisieren + char * cSignature = "(J)V"; + jobject tempObj; + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), "<init>", cSignature ); + tempObj = t.pEnv->NewObjectA( getMyClass(), mID, args ); + saveRef( t.pEnv, tempObj ); + t.pEnv->DeleteLocalRef( tempObj ); + // und aufraeumen +} + +//************************************************************** +//************ Class: java.sql.Timestamp +//************************************************************** + +jclass java_sql_Timestamp::theClass = 0; + +java_sql_Timestamp::~java_sql_Timestamp() +{} + +jclass java_sql_Timestamp::getMyClass() +{ + // die Klasse muss nur einmal geholt werden, daher statisch + if( !theClass ){ + SDBThreadAttach t; OSL_ENSHURE(t.pEnv,"Java Enviroment gelöscht worden!"); + if( !t.pEnv ) return (jclass)0; + jclass tempClass = t.pEnv->FindClass("java/sql/Timestamp"); OSL_ENSHURE(tempClass,"Java : FindClass nicht erfolgreich!"); + jclass globClass = (jclass)t.pEnv->NewGlobalRef( tempClass ); + t.pEnv->DeleteLocalRef( tempClass ); + saveClassRef( globClass ); + } + return theClass; +} + +void java_sql_Timestamp::saveClassRef( jclass pClass ) +{ + if( SDBThreadAttach::IsJavaErrorOccured() || pClass==0 ) + return; + // der uebergebe Klassen-Handle ist schon global, daher einfach speichern + theClass = pClass; +} + +java_sql_Timestamp::java_sql_Timestamp(const ::com::sun::star::util::DateTime& _rOut) + :java_util_Date( NULL, (jobject)NULL ) +{ + SDBThreadAttach t; + if( !t.pEnv ) + return; + jvalue args[1]; + // Parameter konvertieren + args[0].j = (jlong)DateConversion::toINT64(_rOut); + // Java-Call fuer den Konstruktor absetzen + // temporaere Variable initialisieren + char * cSignature = "(J)V"; + jobject tempObj; + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), "<init>", cSignature ); + tempObj = t.pEnv->NewObjectA( getMyClass(), mID, args ); + saveRef( t.pEnv, tempObj ); + t.pEnv->DeleteLocalRef( tempObj ); + // und aufraeumen +} + +sal_Int32 java_sql_Timestamp::getNanos() +{ + jint out(0); + SDBThreadAttach t; + if( t.pEnv ){ + + // temporaere Variable initialisieren + char * cSignature = "()I"; + char * cMethodName = "getNanos"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + out = t.pEnv->CallIntMethod( object, mID); + } //mID + } //t.pEnv + return (sal_Int32)out; +} + +void java_sql_Timestamp::setNanos( sal_Int32 _par0 ) +{ + SDBThreadAttach t; + if( t.pEnv ){ + jvalue args[1]; + // Parameter konvertieren + args[0].i = (sal_Int32)_par0; + // temporaere Variable initialisieren + char * cSignature = "(I)V"; + char * cMethodName = "setNanos"; + // Java-Call absetzen + jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); + if( mID ){ + t.pEnv->CallVoidMethod( object, mID, args[0].i ); + // und aufraeumen + } //mID + } //t.pEnv +} + diff --git a/connectivity/source/drivers/jdbc/exports.dxp b/connectivity/source/drivers/jdbc/exports.dxp new file mode 100644 index 000000000000..9630d7e06768 --- /dev/null +++ b/connectivity/source/drivers/jdbc/exports.dxp @@ -0,0 +1,3 @@ +component_getImplementationEnvironment +component_writeInfo +component_getFactory diff --git a/connectivity/source/drivers/jdbc/jdbc.xml b/connectivity/source/drivers/jdbc/jdbc.xml new file mode 100644 index 000000000000..5ed71581fd54 --- /dev/null +++ b/connectivity/source/drivers/jdbc/jdbc.xml @@ -0,0 +1,69 @@ +<?xml version='1.0' encoding="UTF-8"?> +<!DOCTYPE COMPONENTDESCRIPTION PUBLIC "-//W3C//DTD HTML 3.2//EN" "componentdependencies.dtd"> +<COMPONENTDESCRIPTION> + +<Name> com.sun.star.sdbc.JDBCDriver </Name> + +<Description> + This component provides ... +</Description> + +<ModuleName> jdbc </ModuleName> + +<LoaderName> com.sun.star.loader.SharedLibrary </LoaderName> + +<SupportedService> com.sun.star.sdbc.Driver </SupportedService> + +<ServiceDependency> ... </ServiceDependency> + +<ProjectBuildDependency> cppuhelper </ProjectBuildDependency> +<ProjectBuildDependency> cppu </ProjectBuildDependency> +<ProjectBuildDependency> sal </ProjectBuildDependency> +<ProjectBuildDependency> vos </ProjectBuildDependency> + +<RuntimeModuleDependency> cppuhelper </RuntimeModuleDependency> +<RuntimeModuleDependency> cppu1 </RuntimeModuleDependency> +<RuntimeModuleDependency> sal1 </RuntimeModuleDependency> +<RuntimeModuleDependency> vos </RuntimeModuleDependency> + +<Language> c++ </Language> + +<Status StatusValue="final"/> + +<Type> com.sun.star.util.XCancellable </Type> +<Type> com.sun.star.util.XNumberFormatter </Type> +<Type> com.sun.star.uno.TypeClass </Type> +<Type> com.sun.star.uno.XWeak </Type> +<Type> com.sun.star.uno.XAggregation </Type> +<Type> com.sun.star.beans.XPropertyState </Type> +<Type> com.sun.star.beans.XPropertySet </Type> +<Type> com.sun.star.beans.PropertyValue </Type> +<Type> com.sun.star.beans.XMultiPropertySet </Type> +<Type> com.sun.star.beans.XFastPropertySet </Type> +<Type> com.sun.star.lang.XTypeProvider </Type> +<Type> com.sun.star.lang.EventObject </Type> +<Type> com.sun.star.lang.XComponent </Type> +<Type> com.sun.star.lang.IllegalArgumentException </Type> +<Type> com.sun.star.lang.XMultiServiceFactory </Type> +<Type> com.sun.star.java.XJavaThreadRegister_11 </Type> +<Type> com.sun.star.java.XJavaVM </Type> +<Type> com.sun.star.sdbc.XConnection </Type> +<Type> com.sun.star.sdbc.XStatement </Type> +<Type> com.sun.star.sdbc.XResultSet </Type> +<Type> com.sun.star.sdbc.XResultSetMetaDataSupplier</Type> +<Type> com.sun.star.sdbc.XColumnLocate </Type> +<Type> com.sun.star.sdbc.XResultSetUpdate </Type> +<Type> com.sun.star.sdbc.XWarningsSupplier </Type> +<Type> com.sun.star.sdbc.XRowUpdate </Type> +<Type> com.sun.star.sdbc.XMultipleResults </Type> +<Type> com.sun.star.sdbc.XBatchExecution </Type> +<Type> com.sun.star.sdbc.XPreparedBatchExecution </Type> +<Type> com.sun.star.sdbc.XParameters </Type> +<Type> com.sun.star.sdbc.XOutParameters </Type> +<Type> com.sun.star.sdbc.DriverPropertyInfo </Type> +<Type> com.sun.star.sdbc.XRow </Type> +<Type> com.sun.star.sdb.XColumnUpdate </Type> +<Type> com.sun.star.sdb.XColumn </Type> + +</COMPONENTDESCRIPTION> + diff --git a/connectivity/source/drivers/jdbc/jservices.cxx b/connectivity/source/drivers/jdbc/jservices.cxx new file mode 100644 index 000000000000..a24b49c290ec --- /dev/null +++ b/connectivity/source/drivers/jdbc/jservices.cxx @@ -0,0 +1,209 @@ +/************************************************************************* + * + * $RCSfile: jservices.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_DRIVER_HXX_ +#include "java/sql/Driver.hxx" +#endif +#ifndef _CPPUHELPER_FACTORY_HXX_ +#include <cppuhelper/factory.hxx> +#endif + +using namespace connectivity; +using ::rtl::OUString; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::registry::XRegistryKey; +using ::com::sun::star::lang::XSingleServiceFactory; +using ::com::sun::star::lang::XMultiServiceFactory; + +typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) + ( + const Reference< XMultiServiceFactory > & rServiceManager, + const OUString & rComponentName, + ::cppu::ComponentInstantiation pCreateFunction, + const Sequence< OUString > & rServiceNames + ); + +//*************************************************************************************** +// +// Die vorgeschriebene C-Api muss erfuellt werden! +// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen. +// + +//--------------------------------------------------------------------------------------- +void REGISTER_PROVIDER( + const OUString& aServiceImplName, + const Sequence< OUString>& Services, + const Reference< ::com::sun::star::registry::XRegistryKey > & xKey) +{ + OUString aMainKeyName; + aMainKeyName = OUString::createFromAscii("/"); + aMainKeyName += aServiceImplName; + aMainKeyName += OUString::createFromAscii("/UNO/SERVICES"); + + Reference< ::com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) ); + OSL_ENSHURE(xNewKey.is(), "SBA::component_writeInfo : could not create a registry key !"); + + for (sal_uInt32 i=0; i<Services.getLength(); ++i) + xNewKey->createKey(Services[i]); +} + + +//--------------------------------------------------------------------------------------- +struct ProviderRequest +{ + Reference< XSingleServiceFactory > xRet; + Reference< XMultiServiceFactory > const xServiceManager; + OUString const sImplementationName; + + ProviderRequest( + void* pServiceManager, + sal_Char const* pImplementationName + ) + : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager)) + , sImplementationName(OUString::createFromAscii(pImplementationName)) + { + } + + inline + sal_Bool CREATE_PROVIDER( + const OUString& Implname, + const Sequence< OUString > & Services, + ::cppu::ComponentInstantiation Factory, + createFactoryFunc creator + ) + { + if (!xRet.is() && (Implname == sImplementationName)) + try + { + xRet = creator( xServiceManager, sImplementationName,Factory, Services); + } + catch(...) + { + } + return xRet.is(); + } + + void* getProvider() const { return xRet.get(); } +}; + +//--------------------------------------------------------------------------------------- + +extern "C" void SAL_CALL component_getImplementationEnvironment( + const sal_Char **ppEnvTypeName, + uno_Environment **ppEnv + ) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +//--------------------------------------------------------------------------------------- +extern "C" sal_Bool SAL_CALL component_writeInfo( + void* pServiceManager, + void* pRegistryKey + ) +{ + if (pRegistryKey) + try + { + Reference< ::com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast< ::com::sun::star::registry::XRegistryKey*>(pRegistryKey)); + + REGISTER_PROVIDER( + java_sql_Driver::getImplementationName_Static(), + java_sql_Driver::getSupportedServiceNames_Static(), xKey); + + return sal_True; + } + catch (::com::sun::star::registry::InvalidRegistryException& ) + { + OSL_ENSHURE(sal_False, "SBA::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); + } + + return sal_False; +} + +//--------------------------------------------------------------------------------------- +extern "C" void* SAL_CALL component_getFactory( + const sal_Char* pImplementationName, + void* pServiceManager, + void* pRegistryKey) +{ + void* pRet = 0; + if (pServiceManager) + { + ProviderRequest aReq(pServiceManager,pImplementationName); + + aReq.CREATE_PROVIDER( + java_sql_Driver::getImplementationName_Static(), + java_sql_Driver::getSupportedServiceNames_Static(), + java_sql_Driver_CreateInstance, + ::cppu::createSingleFactory); + + if(aReq.xRet.is()) + aReq.xRet->acquire(); + pRet = aReq.getProvider(); + } + + return pRet; +}; + + + diff --git a/connectivity/source/drivers/jdbc/makefile.mk b/connectivity/source/drivers/jdbc/makefile.mk new file mode 100644 index 000000000000..00621c73d2ee --- /dev/null +++ b/connectivity/source/drivers/jdbc/makefile.mk @@ -0,0 +1,187 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/..$/.. +PRJINC=..$/.. +PRJNAME=connectivity +TARGET=jdbc + +USE_DEFFILE=TRUE +NO_BSYMBOLIC=TRUE + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ---------------------------------- +.IF "$(DBGUTIL_OJ)"!="" +ENVCFLAGS+=/FR$(SLO)$/ +.ENDIF + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/version.mk + +# --- Types ------------------------------------- + + +UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb +UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb + +UNOUCROUT=$(OUT)$/inc +INCPRE+=$(UNOUCROUT) + +# --- Types ------------------------------------- + +UNOTYPES+= \ + com.sun.star.util.XCancellable \ + com.sun.star.util.XNumberFormatter \ + com.sun.star.uno.TypeClass \ + com.sun.star.uno.XWeak \ + com.sun.star.uno.XAggregation \ + com.sun.star.beans.XPropertyState \ + com.sun.star.beans.XPropertySet \ + com.sun.star.beans.PropertyValue \ + com.sun.star.beans.XMultiPropertySet \ + com.sun.star.beans.XFastPropertySet \ + com.sun.star.lang.XTypeProvider \ + com.sun.star.lang.EventObject \ + com.sun.star.lang.XComponent \ + com.sun.star.lang.IllegalArgumentException \ + com.sun.star.lang.XMultiServiceFactory \ + com.sun.star.java.XJavaThreadRegister_11 \ + com.sun.star.java.XJavaVM \ + com.sun.star.sdbc.XConnection \ + com.sun.star.sdbc.XStatement \ + com.sun.star.sdbc.XResultSet \ + com.sun.star.sdbc.XResultSetMetaDataSupplier \ + com.sun.star.sdbc.XColumnLocate \ + com.sun.star.sdbc.XResultSetUpdate \ + com.sun.star.sdbc.XWarningsSupplier \ + com.sun.star.sdbc.XRowUpdate \ + com.sun.star.sdbc.XMultipleResults \ + com.sun.star.sdbc.XBatchExecution \ + com.sun.star.sdbc.XPreparedBatchExecution \ + com.sun.star.sdbc.XParameters \ + com.sun.star.sdbc.XOutParameters \ + com.sun.star.sdbc.DriverPropertyInfo \ + com.sun.star.sdbc.XRow \ + com.sun.star.sdb.XColumnUpdate \ + com.sun.star.sdb.XColumn + + + +# --- Files ------------------------------------- + +SLOFILES=\ + $(SLO)$/Array.obj \ + $(SLO)$/Blob.obj \ + $(SLO)$/Boolean.obj \ + $(SLO)$/CallableStatement.obj \ + $(SLO)$/Class.obj \ + $(SLO)$/Clob.obj \ + $(SLO)$/Connection.obj \ + $(SLO)$/DatabaseMetaData.obj \ + $(SLO)$/Date.obj \ + $(SLO)$/DriverManager.obj \ + $(SLO)$/DriverPropertyInfo.obj \ + $(SLO)$/Exception.obj \ + $(SLO)$/InputStream.obj \ + $(SLO)$/JDriver.obj \ + $(SLO)$/Object.obj \ + $(SLO)$/PreparedStatement.obj \ + $(SLO)$/Reader.obj \ + $(SLO)$/Ref.obj \ + $(SLO)$/ResultSet.obj \ + $(SLO)$/ResultSetMetaData.obj \ + $(SLO)$/SQLException.obj \ + $(SLO)$/SQLWarning.obj \ + $(SLO)$/Statement.obj \ + $(SLO)$/String.obj \ + $(SLO)$/Throwable.obj \ + $(SLO)$/Timestamp.obj \ + $(SLO)$/tools.obj \ + $(SLO)$/jservices.obj + +# --- Library ----------------------------------- + +SHL1TARGET= $(JDBC_TARGET)$(JDBC_MAJOR) +SHL1STDLIBS=\ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(VOSLIB) \ + $(OSLLIB) \ + $(SALLIB) + +SHL1DEPN= +SHL1IMPLIB= i$(SHL1TARGET) +SHL1LIBS= $(SLB)$/$(TARGET).lib \ + $(SLB)$/commontools.lib \ + $(SLB)$/resource.lib + +SHL1DEF= $(MISC)$/$(SHL1TARGET).def + +DEF1NAME= $(SHL1TARGET) +DEF1EXPORTFILE= exports.dxp + +# --- Targets ---------------------------------- + +.INCLUDE : target.mk + + diff --git a/connectivity/source/drivers/jdbc/tools.cxx b/connectivity/source/drivers/jdbc/tools.cxx new file mode 100644 index 000000000000..c8e0f97c351c --- /dev/null +++ b/connectivity/source/drivers/jdbc/tools.cxx @@ -0,0 +1,159 @@ +/************************************************************************* + * + * $RCSfile: tools.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#include "java/tools.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_LANG_STRING_HXX_ +#include "java/lang/String.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_LANG_CLASS_HXX_ +#include "java/lang/Class.hxx" +#endif + +#ifndef _COM_SUN_STAR_SDBC_DRIVERPROPERTYINFO_HPP_ +#include <com/sun/star/sdbc/DriverPropertyInfo.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ +#include <com/sun/star/container/XNameAccess.hpp> +#endif + +using namespace connectivity; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + +// -------------------------------------------------------------------------------- +jstring connectivity::convertwchar_tToJavaString(JNIEnv *pEnv,const ::rtl::OUString& Temp) +{ + if (pEnv) + { + ::rtl::OString aT = ::rtl::OUStringToOString(Temp,RTL_TEXTENCODING_UTF8); + return pEnv->NewString((const unsigned short *)aT.getStr(), aT.getLength()); + } + return NULL; +} + +// -------------------------------------------------------------------------------- +jobjectArray connectivity::createStringPropertyArray(JNIEnv *pEnv,const Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(starsdbc::SQLException, RuntimeException) +{ + jobjectArray aArray = pEnv->NewObjectArray(info.getLength(),java_lang_String::getMyClass(),pEnv->NewStringUTF("")); + + const ::com::sun::star::beans::PropertyValue* pBegin = info.getConstArray(); + const ::com::sun::star::beans::PropertyValue* pEnd = pBegin + info.getLength(); + + sal_Bool bFound = sal_False; + for(jsize i=0;pBegin != pEnd;++pBegin) + { + if(!bFound || pBegin->Name.compareToAscii("JDBCDRV")) + { + java_sql_SQLException_BASE::getMyClass(); + java_lang_Throwable::getMyClass(); + + ::rtl::OUString aStr; + pBegin->Value >>= aStr; + //Datenbanktreiber wird ueber einen Klassennamen erzeugt + java_lang_Class *pDrvClass = java_lang_Class::forName(aStr); + bFound = sal_True; + } + else + { + ::rtl::OUString aStr; + pBegin->Value >>= aStr; + jstring a = convertwchar_tToJavaString(pEnv,aStr.getStr()); + pEnv->SetObjectArrayElement(aArray,i++,a); + } + } + return aArray; +} +// -------------------------------------------------------------------------------- +::rtl::OUString connectivity::JavaString2String(JNIEnv *pEnv,jstring _Str) +{ + ::rtl::OUString aStr; + if(_Str) + { + jboolean bCopy(sal_True); + const jchar* pChar = pEnv->GetStringChars(_Str,&bCopy); + jsize len = pEnv->GetStringLength(_Str); + aStr = ::rtl::OUString(pChar,RTL_TEXTENCODING_UTF8); + + if(bCopy) + pEnv->ReleaseStringChars(_Str,pChar); + pEnv->DeleteLocalRef(_Str); + } + return aStr; +} +// -------------------------------------------------------------------------------- +jobject connectivity::XNameAccess2Map(JNIEnv *pEnv,const Reference< ::com::sun::star::container::XNameAccess > & _rMap) +{ + ::com::sun::star::uno::Sequence< ::rtl::OUString > aSeq = _rMap->getElementNames(); + const ::rtl::OUString *pBegin = aSeq.getConstArray(); + const ::rtl::OUString *pEnd = pBegin + aSeq.getLength(); + for(;pBegin != pEnd;++pBegin) + { + } + return 0; +} + + diff --git a/connectivity/source/drivers/odbc/OConnection.cxx b/connectivity/source/drivers/odbc/OConnection.cxx new file mode 100644 index 000000000000..db68e9948559 --- /dev/null +++ b/connectivity/source/drivers/odbc/OConnection.cxx @@ -0,0 +1,539 @@ +/************************************************************************* + * + * $RCSfile: OConnection.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_OTOOLS_HXX_ +#include "odbc/OTools.hxx" +#endif +#ifndef _CONNECTIVITY_ODBC_OCONNECTION_HXX_ +#include "odbc/OConnection.hxx" +#endif +#ifndef _CONNECTIVITY_ODBC_ODATABASEMETADATA_HXX_ +#include "odbc/ODatabaseMetaData.hxx" +#endif +#ifndef _CONNECTIVITY_RESOURCE_HRC_ +#include "Resource.hrc" +#endif +#ifndef _CONNECTIVITY_MODULECONTEXT_HXX_ +#include "ModuleContext.hxx" +#endif +#ifndef _CONNECTIVITY_ODBC_OFUNCTIONS_HXX_ +#include "odbc/OFunctions.hxx" +#endif +#ifndef _CONNECTIVITY_ODBC_ODRIVER_HXX_ +#include "odbc/ODriver.hxx" +#endif +#ifndef _CONNECTIVITY_ODBC_OSTATEMENT_HXX_ +#include "odbc/OStatement.hxx" +#endif +#ifndef _CONNECTIVITY_ODBC_OPREPAREDSTATEMENT_HXX_ +#include "odbc/OPreparedStatement.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif + +using namespace connectivity::odbc; + +//------------------------------------------------------------------------------ +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +// -------------------------------------------------------------------------------- +OConnection::OConnection(const SQLHANDLE _pDriverHandle,ODBCDriver* _pDriver) + : OConnection_BASE(m_aMutex), + OSubComponent<OConnection>((::cppu::OWeakObject*)_pDriver), + m_pDriverHandleCopy(_pDriverHandle), + m_pDriver(_pDriver), + m_bClosed(sal_False), + m_xMetaData(NULL) +{ + ModuleContext::AddRef(); +} +//----------------------------------------------------------------------------- +OConnection::~OConnection() +{ + if(!isClosed( )) + close(); + ModuleContext::ReleaseRef(); +} +//----------------------------------------------------------------------------- +void SAL_CALL OConnection::release() throw(RuntimeException) +{ + relase_ChildImpl(); + OConnection_BASE::release(); +} + +//----------------------------------------------------------------------------- +SQLRETURN OConnection::OpenConnection(const ::rtl::OUString& aConnectStr,sal_Int32 nTimeOut, sal_Bool bSilent) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if (m_aConnectionHandle == SQL_NULL_HANDLE) + return -1; + + sal_Bool bReadOnly; //weil Methode statisch hier noch einmal ein lokales bReadOnly + SQLRETURN nSQLRETURN = 0; + SDB_ODBC_CHAR szConnStrOut[4096]; + SDB_ODBC_CHAR szConnStrIn[2048]; + SWORD cbConnStrOut; + memset(szConnStrOut,'\0',4096); + memset(szConnStrIn,'\0',2048); + ::rtl::OString aConStr(::rtl::OUStringToOString(aConnectStr,osl_getThreadTextEncoding())); + memcpy(szConnStrIn, (SDB_ODBC_CHAR*) aConStr.getStr(), ::std::min<sal_Int32>((sal_Int32)2048,aConStr.getLength())); + + + N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_LOGIN_TIMEOUT,(SQLPOINTER)nTimeOut,SQL_IS_INTEGER); + // Verbindung aufbauen + +#ifdef LINUX + + nSQLRETURN = N3SQLDriverConnect(m_aConnectionHandle, + NULL, + szConnStrIn, + (SQLSMALLINT) ::std::min((sal_Int32)2048,aConStr.getLength()), + szConnStrOut, + (SQLSMALLINT) sizeof szConnStrOut, + &cbConnStrOut, + SQL_DRIVER_NOPROMPT); + if (nSQLRETURN == SQL_ERROR || nSQLRETURN == SQL_NO_DATA || SQL_SUCCESS_WITH_INFO == nSQLRETURN) + return nSQLRETURN; +#else + + SQLUSMALLINT nSilent = bSilent ? SQL_DRIVER_NOPROMPT : SQL_DRIVER_COMPLETE; + nSQLRETURN = N3SQLDriverConnect(m_aConnectionHandle, + NULL, + szConnStrIn, + (SQLSMALLINT) ::std::min<sal_Int32>((sal_Int32)2048,aConStr.getLength()), + szConnStrOut, + (SQLSMALLINT) sizeof szConnStrOut, + &cbConnStrOut, + nSilent); + if (nSQLRETURN == SQL_ERROR || nSQLRETURN == SQL_NO_DATA) + return nSQLRETURN; + +#endif //LINUX + + try + { + ::rtl::OUString aVal; + OTools::GetInfo(m_aConnectionHandle,SQL_DATA_SOURCE_READ_ONLY,aVal,*this); + bReadOnly = !aVal.compareToAscii("Y"); + } + catch(...) + { + bReadOnly = sal_True; + } + +#ifndef MAC + // autocoomit ist immer default + + if (!bReadOnly) + N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_AUTOCOMMIT,(SQLPOINTER)SQL_AUTOCOMMIT_ON,SQL_IS_INTEGER); +#endif + + return nSQLRETURN; +} +//----------------------------------------------------------------------------- +SQLRETURN OConnection::Construct(const ::rtl::OUString& url,const Sequence< PropertyValue >& info) throw(SQLException) +{ + osl_incrementInterlockedCount( &m_refCount ); + m_aConnectionHandle = SQL_NULL_HANDLE; + + // Connection allozieren + N3SQLAllocHandle(SQL_HANDLE_DBC,m_pDriverHandleCopy,&m_aConnectionHandle); + if(m_aConnectionHandle == SQL_NULL_HANDLE) + throw SQLException(); + + sal_Int32 nLen = url.indexOf(':'); + nLen = url.indexOf(':',nLen+1); + ::rtl::OUString aDSN(url.copy(nLen+1)),aUID,aPWD; + + sal_Int32 nTimeout = 20; + sal_Bool bSilent = sal_True; + const PropertyValue *pBegin = info.getConstArray(); + const PropertyValue *pEnd = pBegin + info.getLength(); + for(;pBegin != pEnd;++pBegin) + { + if(!pBegin->Name.compareToAscii("Timeout")) + pBegin->Value >>= nTimeout; + else if(!pBegin->Name.compareToAscii("Silent")) + pBegin->Value >>= bSilent; + else if(!pBegin->Name.compareToAscii("user")) + { + pBegin->Value >>= aUID; + aDSN = aDSN + ::rtl::OUString::createFromAscii(";UID=") + aUID; + } + else if(!pBegin->Name.compareToAscii("password")) + { + pBegin->Value >>= aPWD; + aDSN = aDSN + ::rtl::OUString::createFromAscii(";PWD=") + aPWD; + } + } + + SQLRETURN nSQLRETURN = OpenConnection(aDSN,nTimeout, bSilent); + if (nSQLRETURN == SQL_ERROR || nSQLRETURN == SQL_NO_DATA) + { + OTools::ThrowException(nSQLRETURN,m_aConnectionHandle,SQL_HANDLE_DBC,*this); + } + else if(SQL_SUCCESS_WITH_INFO == nSQLRETURN) // this driver does not support odbc3 + { + } + osl_decrementInterlockedCount( &m_refCount ); + return nSQLRETURN; +} +// XServiceInfo +// -------------------------------------------------------------------------------- +IMPLEMENT_SERVICE_INFO(OConnection, "com.sun.star.sdbc.drivers.odbc.OConnection", "com.sun.star.sdbc.Connection") + +// -------------------------------------------------------------------------------- +Reference< XStatement > SAL_CALL OConnection::createStatement( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + OStatement* pStmt = new OStatement(this); + m_aStatements.push_back(WeakReferenceHelper(*pStmt)); + return pStmt; +} +// -------------------------------------------------------------------------------- +Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(m_aTypeInfo.empty()) + buildTypeInfo(); + OPreparedStatement* pStmt = new OPreparedStatement(this,m_aTypeInfo,sql); + m_aStatements.push_back(WeakReferenceHelper(*pStmt)); + return pStmt; +} +// -------------------------------------------------------------------------------- +Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + return NULL; +} +// -------------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OConnection::nativeSQL( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + ::rtl::OString aSql(::rtl::OUStringToOString(sql.getStr(),osl_getThreadTextEncoding())); + char pOut[2048]; + SQLINTEGER nOutLen; + OTools::ThrowException(N3SQLNativeSql(m_aConnectionHandle,(SDB_ODBC_CHAR*)aSql.getStr(),aSql.getLength(),(SDB_ODBC_CHAR*)pOut,2048,&nOutLen),m_aConnectionHandle,SQL_HANDLE_DBC,*this); + return ::rtl::OUString(pOut,nOutLen,osl_getThreadTextEncoding()); +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::setAutoCommit( sal_Bool autoCommit ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + OTools::ThrowException(N3SQLSetConnectAttr(m_aConnectionHandle, + SQL_ATTR_AUTOCOMMIT, + (SQLPOINTER)((autoCommit) ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF) ,SQL_IS_INTEGER), + m_aConnectionHandle,SQL_HANDLE_DBC,*this); +} +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL OConnection::getAutoCommit( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + sal_uInt32 nOption = 0; + OTools::ThrowException(N3SQLGetConnectAttr(m_aConnectionHandle, + SQL_ATTR_AUTOCOMMIT, &nOption,0,0),m_aConnectionHandle,SQL_HANDLE_DBC,*this); + return nOption == SQL_AUTOCOMMIT_ON ; +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::commit( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + OTools::ThrowException(N3SQLEndTran(SQL_HANDLE_DBC,m_aConnectionHandle,SQL_COMMIT),m_aConnectionHandle,SQL_HANDLE_DBC,*this); +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::rollback( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + OTools::ThrowException(N3SQLEndTran(SQL_HANDLE_DBC,m_aConnectionHandle,SQL_ROLLBACK),m_aConnectionHandle,SQL_HANDLE_DBC,*this); +} +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL OConnection::isClosed( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return OConnection_BASE::rBHelper.bDisposed; +} +// -------------------------------------------------------------------------------- +Reference< XDatabaseMetaData > SAL_CALL OConnection::getMetaData( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(!m_xMetaData.is()) + m_xMetaData = new ODatabaseMetaData(m_aConnectionHandle,this); + + return m_xMetaData; +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::setReadOnly( sal_Bool readOnly ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + OTools::ThrowException( + N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_ACCESS_MODE,(SQLPOINTER)readOnly,SQL_IS_INTEGER), + m_aConnectionHandle,SQL_HANDLE_DBC,*this); +} +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL OConnection::isReadOnly( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + ::rtl::OUString aValue; + OTools::GetInfo(m_aConnectionHandle,SQL_DATA_SOURCE_READ_ONLY,aValue,*this); + return aValue == ::rtl::OUString::createFromAscii("Y"); +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::setCatalog( const ::rtl::OUString& catalog ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + ::rtl::OString aCat(::rtl::OUStringToOString(catalog.getStr(),osl_getThreadTextEncoding())); + OTools::ThrowException( + N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_CURRENT_CATALOG,(SDB_ODBC_CHAR*)aCat.getStr(),SQL_NTS), + m_aConnectionHandle,SQL_HANDLE_DBC,*this); +} +// -------------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OConnection::getCatalog( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + sal_Int32 nValueLen; + char pCat[1024]; + OTools::ThrowException( + N3SQLGetConnectAttr(m_aConnectionHandle,SQL_ATTR_CURRENT_CATALOG,(SDB_ODBC_CHAR*)pCat,1024,&nValueLen), + m_aConnectionHandle,SQL_HANDLE_DBC,*this); + + return ::rtl::OUString(pCat,nValueLen,osl_getThreadTextEncoding()); +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 level ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + OTools::ThrowException(N3SQLSetConnectAttr(m_aConnectionHandle, + SQL_ATTR_TXN_ISOLATION, + (SQLPOINTER)level,SQL_IS_INTEGER), + m_aConnectionHandle,SQL_HANDLE_DBC,*this); +} +// -------------------------------------------------------------------------------- +sal_Int32 SAL_CALL OConnection::getTransactionIsolation( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + sal_Int32 nTxn = 0; + SQLINTEGER nValueLen; + OTools::ThrowException( + N3SQLGetConnectAttr(m_aConnectionHandle,SQL_ATTR_TXN_ISOLATION,&nTxn,sizeof nTxn,&nValueLen), + m_aConnectionHandle,SQL_HANDLE_DBC,*this); + return nTxn; +} +// -------------------------------------------------------------------------------- +Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OConnection::getTypeMap( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return NULL; +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::setTypeMap( const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException) +{ +} +// -------------------------------------------------------------------------------- +// XCloseable +void SAL_CALL OConnection::close( ) throw(SQLException, RuntimeException) +{ + { + ::osl::MutexGuard aGuard( m_aMutex ); + if (OConnection_BASE::rBHelper.bDisposed) + throw DisposedException(); + } + dispose(); +} +// -------------------------------------------------------------------------------- +// XWarningsSupplier +Any SAL_CALL OConnection::getWarnings( ) throw(SQLException, RuntimeException) +{ + return Any(); +} +// -------------------------------------------------------------------------------- +void SAL_CALL OConnection::clearWarnings( ) throw(SQLException, RuntimeException) +{ +} +//-------------------------------------------------------------------- +void OConnection::buildTypeInfo() throw( SQLException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + Reference< XResultSet> xRs = getMetaData ()->getTypeInfo (); + Reference< XRow> xRow(xRs,UNO_QUERY); + // Information for a single SQL type + + // Loop on the result set until we reach end of file + + while (xRs->next ()) + { + OTypeInfo aInfo; + aInfo.aTypeName = xRow->getString (1); + aInfo.nType = xRow->getShort (2); + aInfo.nPrecision = xRow->getInt (3); + aInfo.aLiteralPrefix = xRow->getString (4); + aInfo.aLiteralSuffix = xRow->getString (5); + aInfo.aCreateParams = xRow->getString (6); + aInfo.bNullable = xRow->getBoolean (7) == ColumnValue::NULLABLE; + aInfo.bCaseSensitive = xRow->getBoolean (8); + aInfo.nSearchType = xRow->getShort (9); + aInfo.bUnsigned = xRow->getBoolean (10); + aInfo.bCurrency = xRow->getBoolean (11); + aInfo.bAutoIncrement = xRow->getBoolean (12); + aInfo.aLocalTypeName = xRow->getString (13); + aInfo.nMinimumScale = xRow->getShort (14); + aInfo.nMaximumScale = xRow->getShort (15); + aInfo.nNumPrecRadix = xRow->getInt (18); + + + + // Now that we have the type info, save it + // in the Hashtable if we don't already have an + // entry for this SQL type. + + m_aTypeInfo.push_back(aInfo); + } + + // Close the result set/statement. + + Reference< XCloseable> xClose(xRs,UNO_QUERY); + xClose->close(); +} +//------------------------------------------------------------------------------ +void OConnection::disposing() +{ + ::osl::MutexGuard aGuard(m_aMutex); + + + // m_aTables.disposing(); + for (OWeakRefArray::iterator i = m_aStatements.begin(); m_aStatements.end() != i; ++i) + { + Reference< XComponent > xComp(i->get(), UNO_QUERY); + if (xComp.is()) + xComp->dispose(); + } + m_aStatements.clear(); + + OTools::ThrowException(N3SQLDisconnect(m_aConnectionHandle),m_aConnectionHandle,SQL_HANDLE_DBC,*this); + m_bClosed = sal_True; + m_xMetaData = NULL; + + dispose_ChildImpl(); + OConnection_BASE::disposing(); + +// for (OWeakRefArray::iterator j = m_aComposers.begin(); m_aComposers.end() != j; j++) +// { +// Reference< XComponent > xComp(j->get(), UNO_QUERY); +// if (xComp.is()) +// xComp->dispose(); +// } +// m_aComposers.clear(); +} + + diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx b/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx new file mode 100644 index 000000000000..e9b81e3dd70f --- /dev/null +++ b/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx @@ -0,0 +1,1593 @@ +/************************************************************************* + * + * $RCSfile: ODatabaseMetaData.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ODBC_ODATABASEMETADATA_HXX_ +#include "odbc/ODatabaseMetaData.hxx" +#endif +#ifndef _CONNECTIVITY_OTOOLS_HXX_ +#include "odbc/OTools.hxx" +#endif +#ifndef _CONNECTIVITY_ODBC_ORESULTSET_HXX_ +#include "odbc/OResultSet.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_ +#include <com/sun/star/sdbc/ResultSetType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_ +#include <com/sun/star/sdbc/ResultSetConcurrency.hpp> +#endif +#ifndef _CONNECTIVITY_OFUNCTIONDEFS_HXX_ +#include "odbc/OFunctiondefs.hxx" +#endif + + +using namespace connectivity::odbc; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; + +ODatabaseMetaData::ODatabaseMetaData(const SQLHANDLE _pHandle,OConnection* _pCon) + : m_aConnectionHandle(_pHandle),m_pConnection(_pCon) +{ + m_pConnection->acquire(); +} +// ------------------------------------------------------------------------- +ODatabaseMetaData::~ODatabaseMetaData() +{ + if (m_pConnection) + m_pConnection->release(); +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo( ) throw(SQLException, RuntimeException) +{ + SQLHANDLE hStmt; + N3SQLAllocHandle(SQL_HANDLE_STMT,m_pConnection->getConnection(),&hStmt); + + OResultSet* pResult = new OResultSet(hStmt); + Reference< XResultSet > xRef = pResult; + pResult->openTypeInfo(); + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs( ) throw(SQLException, RuntimeException) +{ + SQLHANDLE hStmt; + N3SQLAllocHandle(SQL_HANDLE_STMT,m_pConnection->getConnection(),&hStmt); + + OResultSet* pResult = new OResultSet(hStmt); + Reference< XResultSet > xRef = pResult; + pResult->openCatalogs(); + return xRef; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogSeparator( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aVal; + OTools::GetInfo(m_aConnectionHandle,SQL_CATALOG_NAME_SEPARATOR,aVal,*this); + + return aVal; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas( ) throw(SQLException, RuntimeException) +{ + SQLHANDLE hStmt; + N3SQLAllocHandle(SQL_HANDLE_STMT,m_pConnection->getConnection(),&hStmt); + + OResultSet* pResult = new OResultSet(hStmt); + Reference< XResultSet > xRef = pResult; + pResult->openSchemas(); + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, + const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) +{ + SQLHANDLE hStmt; + N3SQLAllocHandle(SQL_HANDLE_STMT,m_pConnection->getConnection(),&hStmt); + + OResultSet* pResult = new OResultSet(hStmt); + Reference< XResultSet > xRef = pResult; + pResult->openColumnPrivileges(catalog,schema,table,columnNamePattern); + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, + const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) +{ + SQLHANDLE hStmt; + N3SQLAllocHandle(SQL_HANDLE_STMT,m_pConnection->getConnection(),&hStmt); + + OResultSet* pResult = new OResultSet(hStmt); + Reference< XResultSet > xRef = pResult; + pResult->openColumns(catalog,schemaPattern,tableNamePattern,columnNamePattern); + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( + const Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException) +{ + SQLHANDLE hStmt; + N3SQLAllocHandle(SQL_HANDLE_STMT,m_pConnection->getConnection(),&hStmt); + + OResultSet* pResult = new OResultSet(hStmt); + Reference< XResultSet > xRef = pResult; + pResult->openTables(catalog,schemaPattern,tableNamePattern,types); + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns( + const Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) +{ + SQLHANDLE hStmt; + N3SQLAllocHandle(SQL_HANDLE_STMT,m_pConnection->getConnection(),&hStmt); + + OResultSet* pResult = new OResultSet(hStmt); + Reference< XResultSet > xRef = pResult; + pResult->openProcedureColumns(catalog,schemaPattern,procedureNamePattern,columnNamePattern); + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures( + const Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& procedureNamePattern ) throw(SQLException, RuntimeException) +{ + SQLHANDLE hStmt; + N3SQLAllocHandle(SQL_HANDLE_STMT,m_pConnection->getConnection(),&hStmt); + + OResultSet* pResult = new OResultSet(hStmt); + Reference< XResultSet > xRef = pResult; + pResult->openProcedures(catalog,schemaPattern,procedureNamePattern); + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getVersionColumns( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + SQLHANDLE hStmt; + N3SQLAllocHandle(SQL_HANDLE_STMT,m_pConnection->getConnection(),&hStmt); + + OResultSet* pResult = new OResultSet(hStmt); + Reference< XResultSet > xRef = pResult; + pResult->openVersionColumns(catalog,schema,table); + return xRef; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_MAX_BINARY_LITERAL_LEN,nValue,*this); + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_MAX_ROW_SIZE,nValue,*this); + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_MAX_CATALOG_NAME_LEN,nValue,*this); + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_MAX_CHAR_LITERAL_LEN,nValue,*this); + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_MAX_COLUMN_NAME_LEN,nValue,*this); + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_MAX_COLUMNS_IN_INDEX,nValue,*this); + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_MAX_CURSOR_NAME_LEN,nValue,*this); + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_ACTIVE_CONNECTIONS,nValue,*this); + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_MAX_COLUMNS_IN_TABLE,nValue,*this); + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_MAX_STATEMENT_LEN,nValue,*this); + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_MAX_TABLE_NAME_LEN,nValue,*this); + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTablesInSelect( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_MAX_TABLES_IN_SELECT,nValue,*this); + return nValue; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + SQLHANDLE hStmt; + N3SQLAllocHandle(SQL_HANDLE_STMT,m_pConnection->getConnection(),&hStmt); + + OResultSet* pResult = new OResultSet(hStmt); + Reference< XResultSet > xRef = pResult; + pResult->openExportedKeys(catalog,schema,table); + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + SQLHANDLE hStmt; + N3SQLAllocHandle(SQL_HANDLE_STMT,m_pConnection->getConnection(),&hStmt); + + OResultSet* pResult = new OResultSet(hStmt); + Reference< XResultSet > xRef = pResult; + pResult->openImportedKeys(catalog,schema,table); + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) +{ + SQLHANDLE hStmt; + N3SQLAllocHandle(SQL_HANDLE_STMT,m_pConnection->getConnection(),&hStmt); + + OResultSet* pResult = new OResultSet(hStmt); + Reference< XResultSet > xRef = pResult; + pResult->openPrimaryKeys(catalog,schema,table); + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, + sal_Bool unique, sal_Bool approximate ) throw(SQLException, RuntimeException) +{ + SQLHANDLE hStmt; + N3SQLAllocHandle(SQL_HANDLE_STMT,m_pConnection->getConnection(),&hStmt); + + OResultSet* pResult = new OResultSet(hStmt); + Reference< XResultSet > xRef = pResult; + pResult->openIndexInfo(catalog,schema,table,unique,approximate); + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getBestRowIdentifier( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope, + sal_Bool nullable ) throw(SQLException, RuntimeException) +{ + SQLHANDLE hStmt; + N3SQLAllocHandle(SQL_HANDLE_STMT,m_pConnection->getConnection(),&hStmt); + + OResultSet* pResult = new OResultSet(hStmt); + Reference< XResultSet > xRef = pResult; + pResult->openBestRowIdentifier(catalog,schema,table,scope,nullable); + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException) +{ + SQLHANDLE hStmt; + N3SQLAllocHandle(SQL_HANDLE_STMT,m_pConnection->getConnection(),&hStmt); + + OResultSet* pResult = new OResultSet(hStmt); + Reference< XResultSet > xRef = pResult; + pResult->openTablePrivileges(catalog,schemaPattern,tableNamePattern); + return xRef; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference( + const Any& primaryCatalog, const ::rtl::OUString& primarySchema, + const ::rtl::OUString& primaryTable, const Any& foreignCatalog, + const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(SQLException, RuntimeException) +{ + SQLHANDLE hStmt; + N3SQLAllocHandle(SQL_HANDLE_STMT,m_pConnection->getConnection(),&hStmt); + + OResultSet* pResult = new OResultSet(hStmt); + Reference< XResultSet > xRef = pResult; + pResult->openForeignKeys(primaryCatalog,primarySchema.toChar() == '%' ? &primarySchema : NULL,&primaryTable, + foreignCatalog, foreignSchema.toChar() == '%' ? &foreignSchema : NULL,&foreignTable); + return xRef; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aVal; + OTools::GetInfo(m_aConnectionHandle,SQL_MAX_ROW_SIZE_INCLUDES_LONG,aVal,*this); + return aVal.toChar() == 'Y'; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this); + return nValue == SQL_IC_LOWER; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this); + return nValue == SQL_IC_LOWER; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this); + return nValue == SQL_IC_MIXED; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this); + return nValue == SQL_IC_MIXED; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this); + return nValue == SQL_IC_UPPER; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this); + return nValue == SQL_IC_UPPER; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsAlterTableWithAddColumn( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_ALTER_TABLE,nValue,*this); + return nValue == SQL_AT_ADD_COLUMN; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsAlterTableWithDropColumn( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_ALTER_TABLE,nValue,*this); + return nValue == SQL_AT_DROP_COLUMN; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_MAX_INDEX_SIZE,nValue,*this); + return nValue; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_NON_NULLABLE_COLUMNS,nValue,*this); + return nValue == SQL_NNC_NON_NULL; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aVal; + OTools::GetInfo(m_aConnectionHandle,SQL_CATALOG_TERM,aVal,*this); + return aVal; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getIdentifierQuoteString( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aVal; + OTools::GetInfo(m_aConnectionHandle,SQL_IDENTIFIER_QUOTE_CHAR,aVal,*this); + return aVal; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aVal; + OTools::GetInfo(m_aConnectionHandle,SQL_SPECIAL_CHARACTERS,aVal,*this); + return aVal; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this); + return nValue != SQL_CN_NONE; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::isCatalogAtStart( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_CATALOG_LOCATION,nValue,*this); + return nValue == SQL_CL_START; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this); + return nValue == SQL_TC_DDL_IGNORE; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this); + return nValue == SQL_TC_DDL_COMMIT; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this); + return nValue == SQL_TC_DML; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this); + return nValue == SQL_TC_ALL; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_DYNAMIC_CURSOR_ATTRIBUTES1,nValue,*this); + return (nValue & SQL_CA1_POS_DELETE) == SQL_CA1_POS_DELETE; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_DYNAMIC_CURSOR_ATTRIBUTES1,nValue,*this); + return (nValue & SQL_CA1_POS_UPDATE) == SQL_CA1_POS_UPDATE; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_CURSOR_ROLLBACK_BEHAVIOR,nValue,*this); + return nValue == SQL_CB_PRESERVE || nValue == SQL_CB_CLOSE; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_CURSOR_COMMIT_BEHAVIOR,nValue,*this); + return nValue == SQL_CB_PRESERVE || nValue == SQL_CB_CLOSE; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_CURSOR_COMMIT_BEHAVIOR,nValue,*this); + return nValue == SQL_CB_PRESERVE; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_CURSOR_ROLLBACK_BEHAVIOR,nValue,*this); + return nValue == SQL_CB_PRESERVE; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_TXN_ISOLATION_OPTION,nValue,*this); + return (nValue & level) == level; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInDataManipulation( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this); + return (nValue & SQL_SU_DML_STATEMENTS) == SQL_SU_DML_STATEMENTS; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_SQL_CONFORMANCE,nValue,*this); + return nValue == SQL_SC_SQL92_FULL; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_SQL_CONFORMANCE,nValue,*this); + return nValue == SQL_SC_SQL92_ENTRY; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aStr; + OTools::GetInfo(m_aConnectionHandle,SQL_INTEGRITY,aStr,*this); + return aStr.toChar() == 'Y'; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this); + return (nValue & SQL_SU_INDEX_DEFINITION) == SQL_SU_INDEX_DEFINITION; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInTableDefinitions( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this); + return (nValue & SQL_SU_TABLE_DEFINITION) == SQL_SU_TABLE_DEFINITION; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInTableDefinitions( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this); + return (nValue & SQL_CU_TABLE_DEFINITION) == SQL_CU_TABLE_DEFINITION; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this); + return (nValue & SQL_CU_INDEX_DEFINITION) == SQL_CU_INDEX_DEFINITION; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInDataManipulation( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this); + return (nValue & SQL_CU_DML_STATEMENTS) == SQL_CU_DML_STATEMENTS; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_OJ_CAPABILITIES,nValue,*this); + return nValue; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException) +{ + SQLHANDLE hStmt; + N3SQLAllocHandle(SQL_HANDLE_STMT,m_pConnection->getConnection(),&hStmt); + + OResultSet* pResult = new OResultSet(hStmt); + Reference< XResultSet > xRef = pResult; + pResult->openTablesTypes(); + return xRef; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatements( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_MAX_CONCURRENT_ACTIVITIES,nValue,*this); + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_MAX_PROCEDURE_NAME_LEN,nValue,*this); + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_MAX_SCHEMA_NAME_LEN,nValue,*this); + return nValue; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_TXN_CAPABLE,nValue,*this); + return nValue != SQL_TC_NONE; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + OTools::GetInfo(m_aConnectionHandle,SQL_ACCESSIBLE_PROCEDURES,aValue,*this); + return aValue.toChar() == 'Y'; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + OTools::GetInfo(m_aConnectionHandle,SQL_PROCEDURES,aValue,*this); + return aValue.toChar() == 'Y'; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_DYNAMIC_CURSOR_ATTRIBUTES1,nValue,*this); + return (nValue & SQL_CA1_POSITIONED_UPDATE) == SQL_CA1_POSITIONED_UPDATE; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + OTools::GetInfo(m_aConnectionHandle,SQL_ACCESSIBLE_TABLES,aValue,*this); + return aValue.toChar() == 'Y'; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException) +{ + sal_Bool bValue; + OTools::GetInfo(m_aConnectionHandle,SQL_DATA_SOURCE_READ_ONLY,bValue,*this); + return bValue; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_FILE_USAGE,nValue,*this); + return nValue == SQL_FILE_CATALOG; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_FILE_USAGE,nValue,*this); + return nValue == SQL_FILE_TABLE; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_CONVERT_FUNCTIONS,nValue,*this); + return (nValue & SQL_FN_CVT_CONVERT) == SQL_FN_CVT_CONVERT; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_CONCAT_NULL_BEHAVIOR,nValue,*this); + return nValue == SQL_CB_NULL; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + OTools::GetInfo(m_aConnectionHandle,SQL_COLUMN_ALIAS,aValue,*this); + return aValue.toChar() == 'Y'; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this); + return nValue != SQL_CN_NONE; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(SQLException, RuntimeException) +{ + if(fromType == toType) + return sal_True; + + sal_Int32 nValue=0; + switch(fromType) + { + case DataType::BIT: + OTools::GetInfo(m_aConnectionHandle,SQL_CONVERT_BIT,nValue,*this); + break; + case DataType::TINYINT: + OTools::GetInfo(m_aConnectionHandle,SQL_CONVERT_TINYINT,nValue,*this); + break; + case DataType::SMALLINT: + OTools::GetInfo(m_aConnectionHandle,SQL_CONVERT_SMALLINT,nValue,*this); + break; + case DataType::INTEGER: + OTools::GetInfo(m_aConnectionHandle,SQL_CONVERT_INTEGER,nValue,*this); + break; + case DataType::BIGINT: + OTools::GetInfo(m_aConnectionHandle,SQL_CONVERT_BIGINT,nValue,*this); + break; + case DataType::FLOAT: + OTools::GetInfo(m_aConnectionHandle,SQL_CONVERT_FLOAT,nValue,*this); + break; + case DataType::REAL: + OTools::GetInfo(m_aConnectionHandle,SQL_CONVERT_REAL,nValue,*this); + break; + case DataType::DOUBLE: + OTools::GetInfo(m_aConnectionHandle,SQL_CONVERT_DOUBLE,nValue,*this); + break; + case DataType::NUMERIC: + OTools::GetInfo(m_aConnectionHandle,SQL_CONVERT_NUMERIC,nValue,*this); + break; + case DataType::DECIMAL: + OTools::GetInfo(m_aConnectionHandle,SQL_CONVERT_DECIMAL,nValue,*this); + break; + case DataType::CHAR: + OTools::GetInfo(m_aConnectionHandle,SQL_CONVERT_CHAR,nValue,*this); + break; + case DataType::VARCHAR: + OTools::GetInfo(m_aConnectionHandle,SQL_CONVERT_VARCHAR,nValue,*this); + break; + case DataType::LONGVARCHAR: + OTools::GetInfo(m_aConnectionHandle,SQL_CONVERT_LONGVARCHAR,nValue,*this); + break; + case DataType::DATE: + OTools::GetInfo(m_aConnectionHandle,SQL_CONVERT_DATE,nValue,*this); + break; + case DataType::TIME: + OTools::GetInfo(m_aConnectionHandle,SQL_CONVERT_TIME,nValue,*this); + break; + case DataType::TIMESTAMP: + OTools::GetInfo(m_aConnectionHandle,SQL_CONVERT_TIMESTAMP,nValue,*this); + break; + case DataType::BINARY: + OTools::GetInfo(m_aConnectionHandle,SQL_CONVERT_BINARY,nValue,*this); + break; + case DataType::VARBINARY: + OTools::GetInfo(m_aConnectionHandle,SQL_CONVERT_VARBINARY,nValue,*this); + break; + case DataType::LONGVARBINARY: + OTools::GetInfo(m_aConnectionHandle,SQL_CONVERT_LONGVARBINARY,nValue,*this); + break; + case DataType::SQLNULL: + // OTools::GetInfo(m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this); + break; + case DataType::OTHER: + // OTools::GetInfo(m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this); + break; + case DataType::OBJECT: + // OTools::GetInfo(m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this); + break; + case DataType::DISTINCT: + // OTools::GetInfo(m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this); + break; + case DataType::STRUCT: + // OTools::GetInfo(m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this); + break; + case DataType::ARRAY: + // OTools::GetInfo(m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this); + break; + case DataType::BLOB: + // OTools::GetInfo(m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this); + break; + case DataType::CLOB: + // OTools::GetInfo(m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this); + break; + case DataType::REF: + // OTools::GetInfo(m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this); + break; + } + sal_Bool bConvert = sal_False; + switch(toType) + { + case DataType::BIT: + bConvert = (nValue & SQL_CVT_BIT) == SQL_CVT_BIT; + break; + case DataType::TINYINT: + bConvert = (nValue & SQL_CVT_TINYINT) == SQL_CVT_TINYINT; + break; + case DataType::SMALLINT: + bConvert = (nValue & SQL_CVT_SMALLINT) == SQL_CVT_SMALLINT; + break; + case DataType::INTEGER: + bConvert = (nValue & SQL_CVT_INTEGER) == SQL_CVT_INTEGER; + break; + case DataType::BIGINT: + bConvert = (nValue & SQL_CVT_BIGINT) == SQL_CVT_BIGINT; + break; + case DataType::FLOAT: + bConvert = (nValue & SQL_CVT_FLOAT) == SQL_CVT_FLOAT; + break; + case DataType::REAL: + bConvert = (nValue & SQL_CVT_REAL) == SQL_CVT_REAL; + break; + case DataType::DOUBLE: + bConvert = (nValue & SQL_CVT_DOUBLE) == SQL_CVT_DOUBLE; + break; + case DataType::NUMERIC: + bConvert = (nValue & SQL_CVT_NUMERIC) == SQL_CVT_NUMERIC; + break; + case DataType::DECIMAL: + bConvert = (nValue & SQL_CVT_DECIMAL) == SQL_CVT_DECIMAL; + break; + case DataType::CHAR: + bConvert = (nValue & SQL_CVT_CHAR) == SQL_CVT_CHAR; + break; + case DataType::VARCHAR: + bConvert = (nValue & SQL_CVT_VARCHAR) == SQL_CVT_VARCHAR; + break; + case DataType::LONGVARCHAR: + bConvert = (nValue & SQL_CVT_LONGVARCHAR) == SQL_CVT_LONGVARCHAR; + break; + case DataType::DATE: + bConvert = (nValue & SQL_CVT_DATE) == SQL_CVT_DATE; + break; + case DataType::TIME: + bConvert = (nValue & SQL_CVT_TIME) == SQL_CVT_TIME; + break; + case DataType::TIMESTAMP: + bConvert = (nValue & SQL_CVT_TIMESTAMP) == SQL_CVT_TIMESTAMP; + break; + case DataType::BINARY: + bConvert = (nValue & SQL_CVT_BINARY) == SQL_CVT_BINARY; + break; + case DataType::VARBINARY: + bConvert = (nValue & SQL_CVT_VARBINARY) == SQL_CVT_VARBINARY; + break; + case DataType::LONGVARBINARY: + bConvert = (nValue & SQL_CVT_LONGVARBINARY) == SQL_CVT_LONGVARBINARY; + break; + } + + return bConvert; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + OTools::GetInfo(m_aConnectionHandle,SQL_EXPRESSIONS_IN_ORDERBY,aValue,*this); + return aValue.toChar() == 'Y'; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_GROUP_BY,nValue,*this); + return nValue != SQL_GB_NOT_SUPPORTED; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_GROUP_BY,nValue,*this); + return nValue != SQL_GB_GROUP_BY_CONTAINS_SELECT; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_GROUP_BY,nValue,*this); + return nValue == SQL_GB_NO_RELATION; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + OTools::GetInfo(m_aConnectionHandle,SQL_MULTIPLE_ACTIVE_TXN,aValue,*this); + return aValue.toChar() == 'Y'; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + OTools::GetInfo(m_aConnectionHandle,SQL_MULT_RESULT_SETS,aValue,*this); + return aValue.toChar() == 'Y'; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + OTools::GetInfo(m_aConnectionHandle,SQL_LIKE_ESCAPE_CLAUSE,aValue,*this); + return aValue.toChar() == 'Y'; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + OTools::GetInfo(m_aConnectionHandle,SQL_ORDER_BY_COLUMNS_IN_SELECT,aValue,*this); + return aValue.toChar() == 'N'; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_UNION,nValue,*this); + return (nValue & SQL_U_UNION) == SQL_U_UNION; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_UNION,nValue,*this); + return (nValue & SQL_U_UNION_ALL) == SQL_U_UNION_ALL; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this); + return nValue == SQL_IC_MIXED; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this); + return nValue == SQL_IC_MIXED; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this); + return nValue == SQL_NC_END; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this); + return nValue == SQL_NC_START; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this); + return nValue == SQL_NC_HIGH; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this); + return nValue == SQL_NC_LOW; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this); + return nValue & SQL_SU_PROCEDURE_INVOCATION; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this); + return nValue & SQL_SU_PRIVILEGE_DEFINITION; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this); + return nValue & SQL_CU_PROCEDURE_INVOCATION; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this); + return nValue & SQL_CU_PRIVILEGE_DEFINITION; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this); + return (nValue & SQL_SQ_CORRELATED_SUBQUERIES) == SQL_SQ_CORRELATED_SUBQUERIES; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this); + return (nValue & SQL_SQ_COMPARISON) == SQL_SQ_COMPARISON; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this); + return (nValue & SQL_SQ_EXISTS) == SQL_SQ_EXISTS; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this); + return (nValue & SQL_SQ_IN) == SQL_SQ_IN; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this); + return (nValue & SQL_SQ_QUANTIFIED) == SQL_SQ_QUANTIFIED; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_SQL_CONFORMANCE,nValue,*this); + return nValue == SQL_SC_SQL92_INTERMEDIATE; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getURL( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue = ::rtl::OUString::createFromAscii("sdbc:odbc:"); + OTools::GetInfo(m_aConnectionHandle,SQL_DATA_SOURCE_NAME,aValue,*this); + return aValue; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + OTools::GetInfo(m_aConnectionHandle,SQL_USER_NAME,aValue,*this); + return aValue; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + OTools::GetInfo(m_aConnectionHandle,SQL_DRIVER_NAME,aValue,*this); + return aValue; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverVersion( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + OTools::GetInfo(m_aConnectionHandle,SQL_DRIVER_ODBC_VER,aValue,*this); + return aValue; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + OTools::GetInfo(m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this); + return aValue; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + OTools::GetInfo(m_aConnectionHandle,SQL_DBMS_NAME,aValue,*this); + return aValue; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + OTools::GetInfo(m_aConnectionHandle,SQL_PROCEDURE_TERM,aValue,*this); + return aValue; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + OTools::GetInfo(m_aConnectionHandle,SQL_SCHEMA_TERM,aValue,*this); + return aValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException) +{ + ::rtl::OUString aValue; + OTools::GetInfo(m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this); + return aValue.copy(0,aValue.indexOf('.')).toInt32(); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_SUBQUERIES,nValue,*this); + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException) +{ + ::rtl::OUString aValue; + OTools::GetInfo(m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this); + return aValue.copy(0,aValue.lastIndexOf('.')).toInt32(); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + OTools::GetInfo(m_aConnectionHandle,SQL_KEYWORDS,aValue,*this); + return aValue; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aValue; + OTools::GetInfo(m_aConnectionHandle,SQL_SEARCH_PATTERN_ESCAPE,aValue,*this); + return aValue; +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + ::rtl::OUString aValue; + OTools::GetInfo(m_aConnectionHandle,SQL_STRING_FUNCTIONS,nValue,*this); + if(nValue & SQL_FN_STR_ASCII) + aValue = ::rtl::OUString::createFromAscii("ASCII,"); + if(nValue & SQL_FN_STR_BIT_LENGTH) + aValue += ::rtl::OUString::createFromAscii("BIT_LENGTH,"); + if(nValue & SQL_FN_STR_CHAR) + aValue += ::rtl::OUString::createFromAscii("CHAR,"); + if(nValue & SQL_FN_STR_CHAR_LENGTH) + aValue += ::rtl::OUString::createFromAscii("CHAR_LENGTH,"); + if(nValue & SQL_FN_STR_CHARACTER_LENGTH) + aValue += ::rtl::OUString::createFromAscii("CHARACTER_LENGTH,"); + if(nValue & SQL_FN_STR_CONCAT) + aValue += ::rtl::OUString::createFromAscii("CONCAT,"); + if(nValue & SQL_FN_STR_DIFFERENCE) + aValue += ::rtl::OUString::createFromAscii("DIFFERENCE,"); + if(nValue & SQL_FN_STR_INSERT) + aValue += ::rtl::OUString::createFromAscii("INSERT,"); + if(nValue & SQL_FN_STR_LCASE) + aValue += ::rtl::OUString::createFromAscii("LCASE,"); + if(nValue & SQL_FN_STR_LEFT) + aValue += ::rtl::OUString::createFromAscii("LEFT,"); + if(nValue & SQL_FN_STR_LENGTH) + aValue += ::rtl::OUString::createFromAscii("LENGTH,"); + if(nValue & SQL_FN_STR_LOCATE) + aValue += ::rtl::OUString::createFromAscii("LOCATE,"); + if(nValue & SQL_FN_STR_LOCATE_2) + aValue += ::rtl::OUString::createFromAscii("LOCATE_2,"); + if(nValue & SQL_FN_STR_LTRIM) + aValue += ::rtl::OUString::createFromAscii("LTRIM,"); + if(nValue & SQL_FN_STR_OCTET_LENGTH) + aValue += ::rtl::OUString::createFromAscii("OCTET_LENGTH,"); + if(nValue & SQL_FN_STR_POSITION) + aValue += ::rtl::OUString::createFromAscii("POSITION,"); + if(nValue & SQL_FN_STR_REPEAT) + aValue += ::rtl::OUString::createFromAscii("REPEAT,"); + if(nValue & SQL_FN_STR_REPLACE) + aValue += ::rtl::OUString::createFromAscii("REPLACE,"); + if(nValue & SQL_FN_STR_RIGHT) + aValue += ::rtl::OUString::createFromAscii("RIGHT,"); + if(nValue & SQL_FN_STR_RTRIM) + aValue += ::rtl::OUString::createFromAscii("RTRIM,"); + if(nValue & SQL_FN_STR_SOUNDEX) + aValue += ::rtl::OUString::createFromAscii("SOUNDEX,"); + if(nValue & SQL_FN_STR_SPACE) + aValue += ::rtl::OUString::createFromAscii("SPACE,"); + if(nValue & SQL_FN_STR_SUBSTRING) + aValue += ::rtl::OUString::createFromAscii("SUBSTRING,"); + if(nValue & SQL_FN_STR_UCASE) + aValue += ::rtl::OUString::createFromAscii("UCASE,"); + + + return aValue.copy(0,aValue.lastIndexOf(',')); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + ::rtl::OUString aValue; + OTools::GetInfo(m_aConnectionHandle,SQL_TIMEDATE_FUNCTIONS,nValue,*this); + + if(nValue & SQL_FN_TD_CURRENT_DATE) + aValue = ::rtl::OUString::createFromAscii("CURRENT_DATE,"); + if(nValue & SQL_FN_TD_CURRENT_TIME) + aValue += ::rtl::OUString::createFromAscii("CURRENT_TIME,"); + if(nValue & SQL_FN_TD_CURRENT_TIMESTAMP) + aValue += ::rtl::OUString::createFromAscii("CURRENT_TIMESTAMP,"); + if(nValue & SQL_FN_TD_CURDATE) + aValue += ::rtl::OUString::createFromAscii("CURDATE,"); + if(nValue & SQL_FN_TD_CURTIME) + aValue += ::rtl::OUString::createFromAscii("CURTIME,"); + if(nValue & SQL_FN_TD_DAYNAME) + aValue += ::rtl::OUString::createFromAscii("DAYNAME,"); + if(nValue & SQL_FN_TD_DAYOFMONTH) + aValue += ::rtl::OUString::createFromAscii("DAYOFMONTH,"); + if(nValue & SQL_FN_TD_DAYOFWEEK) + aValue += ::rtl::OUString::createFromAscii("DAYOFWEEK,"); + if(nValue & SQL_FN_TD_DAYOFYEAR) + aValue += ::rtl::OUString::createFromAscii("DAYOFYEAR,"); + if(nValue & SQL_FN_TD_EXTRACT) + aValue += ::rtl::OUString::createFromAscii("EXTRACT,"); + if(nValue & SQL_FN_TD_HOUR) + aValue += ::rtl::OUString::createFromAscii("HOUR,"); + if(nValue & SQL_FN_TD_MINUTE) + aValue += ::rtl::OUString::createFromAscii("MINUTE,"); + if(nValue & SQL_FN_TD_MONTH) + aValue += ::rtl::OUString::createFromAscii("MONTH,"); + if(nValue & SQL_FN_TD_MONTHNAME) + aValue += ::rtl::OUString::createFromAscii("MONTHNAME,"); + if(nValue & SQL_FN_TD_NOW) + aValue += ::rtl::OUString::createFromAscii("NOW,"); + if(nValue & SQL_FN_TD_QUARTER) + aValue += ::rtl::OUString::createFromAscii("QUARTER,"); + if(nValue & SQL_FN_TD_SECOND) + aValue += ::rtl::OUString::createFromAscii("SECOND,"); + if(nValue & SQL_FN_TD_TIMESTAMPADD) + aValue += ::rtl::OUString::createFromAscii("TIMESTAMPADD,"); + if(nValue & SQL_FN_TD_TIMESTAMPDIFF) + aValue += ::rtl::OUString::createFromAscii("TIMESTAMPDIFF,"); + if(nValue & SQL_FN_TD_WEEK) + aValue += ::rtl::OUString::createFromAscii("WEEK,"); + if(nValue & SQL_FN_TD_YEAR) + aValue += ::rtl::OUString::createFromAscii("YEAR,"); + + return aValue.copy(0,aValue.lastIndexOf(',')); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + ::rtl::OUString aValue; + OTools::GetInfo(m_aConnectionHandle,SQL_SYSTEM_FUNCTIONS,nValue,*this); + + if(nValue & SQL_FN_SYS_DBNAME) + aValue += ::rtl::OUString::createFromAscii("DBNAME,"); + if(nValue & SQL_FN_SYS_IFNULL) + aValue += ::rtl::OUString::createFromAscii("IFNULL,"); + if(nValue & SQL_FN_SYS_USERNAME) + aValue += ::rtl::OUString::createFromAscii("USERNAME,"); + + return aValue.copy(0,aValue.lastIndexOf(',')); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + ::rtl::OUString aValue; + OTools::GetInfo(m_aConnectionHandle,SQL_NUMERIC_FUNCTIONS,nValue,*this); + + if(nValue & SQL_FN_NUM_ABS) + aValue += ::rtl::OUString::createFromAscii("ABS,"); + if(nValue & SQL_FN_NUM_ACOS) + aValue += ::rtl::OUString::createFromAscii("ACOS,"); + if(nValue & SQL_FN_NUM_ASIN) + aValue += ::rtl::OUString::createFromAscii("ASIN,"); + if(nValue & SQL_FN_NUM_ATAN) + aValue += ::rtl::OUString::createFromAscii("ATAN,"); + if(nValue & SQL_FN_NUM_ATAN2) + aValue += ::rtl::OUString::createFromAscii("ATAN2,"); + if(nValue & SQL_FN_NUM_CEILING) + aValue += ::rtl::OUString::createFromAscii("CEILING,"); + if(nValue & SQL_FN_NUM_COS) + aValue += ::rtl::OUString::createFromAscii("COS,"); + if(nValue & SQL_FN_NUM_COT) + aValue += ::rtl::OUString::createFromAscii("COT,"); + if(nValue & SQL_FN_NUM_DEGREES) + aValue += ::rtl::OUString::createFromAscii("DEGREES,"); + if(nValue & SQL_FN_NUM_EXP) + aValue += ::rtl::OUString::createFromAscii("EXP,"); + if(nValue & SQL_FN_NUM_FLOOR) + aValue += ::rtl::OUString::createFromAscii("FLOOR,"); + if(nValue & SQL_FN_NUM_LOG) + aValue += ::rtl::OUString::createFromAscii("LOGF,"); + if(nValue & SQL_FN_NUM_LOG10) + aValue += ::rtl::OUString::createFromAscii("LOG10,"); + if(nValue & SQL_FN_NUM_MOD) + aValue += ::rtl::OUString::createFromAscii("MOD,"); + if(nValue & SQL_FN_NUM_PI) + aValue += ::rtl::OUString::createFromAscii("PI,"); + if(nValue & SQL_FN_NUM_POWER) + aValue += ::rtl::OUString::createFromAscii("POWER,"); + if(nValue & SQL_FN_NUM_RADIANS) + aValue += ::rtl::OUString::createFromAscii("RADIANS,"); + if(nValue & SQL_FN_NUM_RAND) + aValue += ::rtl::OUString::createFromAscii("RAND,"); + if(nValue & SQL_FN_NUM_ROUND) + aValue += ::rtl::OUString::createFromAscii("ROUND,"); + if(nValue & SQL_FN_NUM_SIGN) + aValue += ::rtl::OUString::createFromAscii("SIGN,"); + if(nValue & SQL_FN_NUM_SIN) + aValue += ::rtl::OUString::createFromAscii("SIN,"); + if(nValue & SQL_FN_NUM_SQRT) + aValue += ::rtl::OUString::createFromAscii("SQRT,"); + if(nValue & SQL_FN_NUM_TAN) + aValue += ::rtl::OUString::createFromAscii("TAN,"); + if(nValue & SQL_FN_NUM_TRUNCATE) + aValue += ::rtl::OUString::createFromAscii("TRUNCATE,"); + + + return aValue.copy(0,aValue.lastIndexOf(',')); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_ODBC_INTERFACE_CONFORMANCE,nValue,*this); + return nValue == SQL_OIC_LEVEL2; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_ODBC_INTERFACE_CONFORMANCE,nValue,*this); + return nValue == SQL_OIC_CORE; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_ODBC_INTERFACE_CONFORMANCE,nValue,*this); + return nValue == SQL_OIC_LEVEL1; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_OJ_CAPABILITIES,nValue,*this); + return (nValue & SQL_OJ_FULL) == SQL_OJ_FULL; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException) +{ + return supportsFullOuterJoins( ); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_MAX_COLUMNS_IN_GROUP_BY,nValue,*this); + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_MAX_COLUMNS_IN_ORDER_BY,nValue,*this); + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_MAX_COLUMNS_IN_SELECT,nValue,*this); + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_MAX_USER_NAME_LEN,nValue,*this); + return nValue; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + OTools::GetInfo(m_aConnectionHandle,SQL_CURSOR_SENSITIVITY,nValue,*this); + return (nValue & setType) == setType; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + SQLUSMALLINT nAskFor; + switch(setType) + { + case ResultSetType::FORWARD_ONLY: + nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2; + break; + case ResultSetType::SCROLL_INSENSITIVE: + nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2; + break; + case ResultSetType::SCROLL_SENSITIVE: + nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2; + break; + } + + OTools::GetInfo(m_aConnectionHandle,nAskFor,nValue,*this); + sal_Bool bRet = sal_False; + switch(concurrency) + { + case ResultSetConcurrency::READ_ONLY: + bRet = (nValue & SQL_CA2_READ_ONLY_CONCURRENCY) == SQL_CA2_READ_ONLY_CONCURRENCY; + break; + case ResultSetConcurrency::UPDATABLE: + bRet = (nValue & SQL_CA2_OPT_VALUES_CONCURRENCY) == SQL_CA2_OPT_VALUES_CONCURRENCY; + break; + } + return bRet; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + SQLUSMALLINT nAskFor; + switch(setType) + { + case ResultSetType::FORWARD_ONLY: + nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2; + break; + case ResultSetType::SCROLL_INSENSITIVE: + nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2; + break; + case ResultSetType::SCROLL_SENSITIVE: + nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2; + break; + } + + OTools::GetInfo(m_aConnectionHandle,nAskFor,nValue,*this); + return (nValue & SQL_CA2_SENSITIVITY_UPDATES) == SQL_CA2_SENSITIVITY_UPDATES; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + SQLUSMALLINT nAskFor; + switch(setType) + { + case ResultSetType::FORWARD_ONLY: + nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2; + break; + case ResultSetType::SCROLL_INSENSITIVE: + nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2; + break; + case ResultSetType::SCROLL_SENSITIVE: + nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2; + break; + } + + OTools::GetInfo(m_aConnectionHandle,nAskFor,nValue,*this); + return (nValue & SQL_CA2_SENSITIVITY_DELETIONS) == SQL_CA2_SENSITIVITY_DELETIONS; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + sal_Int32 nValue; + SQLUSMALLINT nAskFor; + switch(setType) + { + case ResultSetType::FORWARD_ONLY: + nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2; + break; + case ResultSetType::SCROLL_INSENSITIVE: + nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2; + break; + case ResultSetType::SCROLL_SENSITIVE: + nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2; + break; + } + + OTools::GetInfo(m_aConnectionHandle,nAskFor,nValue,*this); + return (nValue & SQL_CA2_SENSITIVITY_ADDITIONS) == SQL_CA2_SENSITIVITY_ADDITIONS; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return ownUpdatesAreVisible(setType); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return ownDeletesAreVisible(setType); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return ownInsertsAreVisible(setType); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const Sequence< sal_Int32 >& types ) throw(SQLException, RuntimeException) +{ + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XConnection > SAL_CALL ODatabaseMetaData::getConnection( ) throw(SQLException, RuntimeException) +{ + return (Reference< XConnection >)m_pConnection;//new OConnection(m_aConnectionHandle); +} +// ------------------------------------------------------------------------- + + diff --git a/connectivity/source/drivers/odbc/ODriver.cxx b/connectivity/source/drivers/odbc/ODriver.cxx new file mode 100644 index 000000000000..c3f1c3489082 --- /dev/null +++ b/connectivity/source/drivers/odbc/ODriver.cxx @@ -0,0 +1,209 @@ +/************************************************************************* + * + * $RCSfile: ODriver.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ODBC_ODRIVER_HXX_ +#include "odbc/ODriver.hxx" +#endif +#ifndef _CONNECTIVITY_ODBC_OCONNECTION_HXX_ +#include "odbc/OConnection.hxx" +#endif +#ifndef _CONNECTIVITY_ODBC_OFUNCTIONS_HXX_ +#include "odbc/OFunctions.hxx" +#endif + +using namespace connectivity::odbc; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +// -------------------------------------------------------------------------------- +ODBCDriver::ODBCDriver() : ODriver_BASE(m_aMutex),m_pDriverHandle(SQL_NULL_HANDLE) +{ +} +// -------------------------------------------------------------------------------- +void ODBCDriver::disposing() +{ + ::osl::MutexGuard aGuard(m_aMutex); + + + for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i) + { + Reference< XComponent > xComp(i->get(), UNO_QUERY); + if (xComp.is()) + xComp->dispose(); + } + m_xConnections.clear(); + + ODriver_BASE::disposing(); +} + +// static ServiceInfo +//------------------------------------------------------------------------------ +rtl::OUString ODBCDriver::getImplementationName_Static( ) throw(RuntimeException) +{ + return rtl::OUString::createFromAscii("com.sun.star.sdbc.ODBCDriver"); +} +//------------------------------------------------------------------------------ +Sequence< ::rtl::OUString > ODBCDriver::getSupportedServiceNames_Static( ) throw (RuntimeException) +{ + Sequence< ::rtl::OUString > aSNS( 1 ); + aSNS[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.Driver"); + return aSNS; +} + +//------------------------------------------------------------------ +::rtl::OUString SAL_CALL ODBCDriver::getImplementationName( ) throw(RuntimeException) +{ + return getImplementationName_Static(); +} + +//------------------------------------------------------------------ +sal_Bool SAL_CALL ODBCDriver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) +{ + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + const ::rtl::OUString* pSupported = aSupported.getConstArray(); + for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) + if (pSupported->equals(_rServiceName)) + return sal_True; + + return sal_False; +} + +//------------------------------------------------------------------ +Sequence< ::rtl::OUString > SAL_CALL ODBCDriver::getSupportedServiceNames( ) throw(RuntimeException) +{ + return getSupportedServiceNames_Static(); +} + +//------------------------------------------------------------------ +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL connectivity::odbc::ODBCDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ) +{ + return *(new ODBCDriver()); +} +// -------------------------------------------------------------------------------- +Reference< XConnection > SAL_CALL ODBCDriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) +{ + if(!m_pDriverHandle) + { + ::rtl::OUString aPath; + if(!EnvironmentHandle(aPath)) + throw SQLException(aPath,*this,::rtl::OUString(),1000,Any()); + } + OConnection* pCon = new OConnection(m_pDriverHandle,this); + pCon->Construct(url,info); + Reference< XConnection > xCon = pCon; + m_xConnections.push_back(WeakReferenceHelper(*pCon)); + + return xCon; +} +// -------------------------------------------------------------------------------- +sal_Bool SAL_CALL ODBCDriver::acceptsURL( const ::rtl::OUString& url ) + throw(SQLException, RuntimeException) +{ + if(!url.compareTo(::rtl::OUString::createFromAscii("sdbc:odbc:"),10)) + { + return sal_True; + } + return sal_False; +} +// -------------------------------------------------------------------------------- +Sequence< DriverPropertyInfo > SAL_CALL ODBCDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) +{ + return Sequence< DriverPropertyInfo >(); +} +// -------------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODBCDriver::getMajorVersion( ) throw(RuntimeException) +{ + return 1; +} +// -------------------------------------------------------------------------------- +sal_Int32 SAL_CALL ODBCDriver::getMinorVersion( ) throw(RuntimeException) +{ + return 0; +} +// -------------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +// ODBC Environment (gemeinsam fuer alle Connections): +SQLHANDLE ODBCDriver::EnvironmentHandle(::rtl::OUString &_rPath) +{ + // Ist (fuer diese Instanz) bereits ein Environment erzeugt worden? + if (!m_pDriverHandle) + { + SQLHANDLE h = SQL_NULL_HANDLE; + // Environment allozieren + + // ODBC-DLL jetzt laden: + if (!LoadLibrary_ODBC3(_rPath)) + return SQL_NULL_HANDLE; + + if (N3SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&h) != SQL_SUCCESS) + return SQL_NULL_HANDLE; + + // In globaler Struktur merken ... + m_pDriverHandle = (void *) h; + SQLRETURN nError = N3SQLSetEnvAttr(h, SQL_ATTR_ODBC_VERSION,(SQLPOINTER) SQL_OV_ODBC3, SQL_IS_UINTEGER); + //N3SQLSetEnvAttr(h, SQL_ATTR_CONNECTION_POOLING,(SQLPOINTER) SQL_CP_ONE_PER_HENV, SQL_IS_INTEGER); + } + + return m_pDriverHandle; +} + + diff --git a/connectivity/source/drivers/odbc/OFunctions.cxx b/connectivity/source/drivers/odbc/OFunctions.cxx new file mode 100644 index 000000000000..5a50bf38bc7d --- /dev/null +++ b/connectivity/source/drivers/odbc/OFunctions.cxx @@ -0,0 +1,338 @@ +/************************************************************************* + * + * $RCSfile: OFunctions.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +//-------------------------------------------------------------------------- +#ifndef _CONNECTIVITY_ODBC_OFUNCTIONS_HXX_ +#include "odbc/OFunctions.hxx" +#endif + +// Implib-Definitionen fuer ODBC-DLL/shared library: + +using namespace connectivity; + +// ------------------------------------------------------------------------- +sal_Bool connectivity::LoadLibrary_ADABAS(::rtl::OUString &_rPath) +{ + static sal_Bool bLoaded = sal_False; + static oslModule pODBCso = NULL; + + if (bLoaded) + return TRUE; + + char *pPath =getenv("DBROOT"); + if(pPath) + { + +#if ( defined(SOLARIS) && defined(SPARC)) || defined(LINUX) + _rPath = ::rtl::OUString::createFromAscii(pPath); + _rPath += ::rtl::OUString::createFromAscii("/lib/"); +#endif + } +#if defined(WIN) || defined(WNT) + _rPath += ::rtl::OUString::createFromAscii("SQLOD32.DLL"); +#elif ( defined(SOLARIS) && defined(SPARC)) || defined(LINUX) + _rPath += ::rtl::OUString::createFromAscii("odbclib.so"); +#else + return sal_False; +#endif + + pODBCso = osl_loadModule( _rPath.pData,SAL_LOADMODULE_NOW ); + if( !pODBCso) + return sal_False; + + + return bLoaded = LoadFunctions(pODBCso,sal_False); +} +// ------------------------------------------------------------------------- +// Dynamisches Laden der DLL/shared lib und Adressen der Funktionen besorgen: +// Liefert TRUE bei Erfolg. +sal_Bool connectivity::LoadLibrary_ODBC3(::rtl::OUString &_rPath) +{ + static sal_Bool bLoaded = sal_False; + static oslModule pODBCso = NULL; + + if (bLoaded) + return TRUE; +#ifdef WIN + _rPath = ::rtl::OUString::createFromAscii("ODBC.DLL"); + +#endif +#ifdef WNT + _rPath = ::rtl::OUString::createFromAscii("ODBC32.DLL"); +#endif +#ifdef UNX + _rPath = ::rtl::OUString::createFromAscii("libodbc.so"); +#endif +#ifdef OS2 + _rPath = ::rtl::OUString::createFromAscii("ODBC"); +#endif + + pODBCso = osl_loadModule( _rPath.pData,SAL_LOADMODULE_NOW ); + if( !pODBCso) +#ifdef OS2 + { + delete pODBCso; + _rPath = ::rtl::OUString::createFromAscii("WOD402"); + pODBCso = osl_loadModule( _rPath.pData,SAL_LOADMODULE_NOW ); + if( !pODBCso) + return sal_False; + } +#else + return sal_False; +#endif + + return bLoaded = connectivity::LoadFunctions(pODBCso); +} +// ------------------------------------------------------------------------- + +sal_Bool connectivity::LoadFunctions(oslModule pODBCso, sal_Bool _bDS) +{ + + if( ( connectivity::pODBC3SQLAllocHandle = (T3SQLAllocHandle)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLAllocHandle").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLConnect = (T3SQLConnect)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLConnect").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLDriverConnect = (T3SQLDriverConnect)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLDriverConnect").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLBrowseConnect = (T3SQLBrowseConnect)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLBrowseConnect").pData )) == NULL ) + return sal_False; + if(_bDS && ( connectivity::pODBC3SQLDataSources = (T3SQLDataSources)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLDataSources").pData )) == NULL ) + return sal_False; + if(_bDS && ( connectivity::pODBC3SQLDrivers = (T3SQLDrivers)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLDrivers").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLGetInfo = (T3SQLGetInfo)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetInfo").pData )) == NULL ) + return sal_False; + if(_bDS && ( connectivity::pODBC3SQLGetFunctions = (T3SQLGetFunctions)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetFunctions").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLGetTypeInfo = (T3SQLGetTypeInfo)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetTypeInfo").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLSetConnectAttr = (T3SQLSetConnectAttr)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLSetConnectAttr").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLGetConnectAttr = (T3SQLGetConnectAttr)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetConnectAttr").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLSetEnvAttr = (T3SQLSetEnvAttr)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLSetEnvAttr").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLGetEnvAttr = (T3SQLGetEnvAttr)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetEnvAttr").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLSetStmtAttr = (T3SQLSetStmtAttr)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLSetStmtAttr").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLGetStmtAttr = (T3SQLGetStmtAttr)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetStmtAttr").pData )) == NULL ) + return sal_False; + /*if( ( connectivity::pODBC3SQLSetDescField = (T3SQLSetDescField)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLSetDescField").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLGetDescField = (T3SQLGetDescField)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetDescField").pData )) == NULL ) + return sal_False;*/ + /*if( ( connectivity::pODBC3SQLGetDescRec = (T3SQLGetDescRec)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetDescRec").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLSetDescRec = (T3SQLSetDescRec)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLSetDescRec").pData )) == NULL ) + return sal_False;*/ + if( ( connectivity::pODBC3SQLPrepare = (T3SQLPrepare)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLPrepare").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLBindParameter = (T3SQLBindParameter)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLBindParameter").pData )) == NULL ) + return sal_False; +// if( ( connectivity::pODBC3SQLGetCursorName = (T3SQLGetCursorName)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetCursorName").pData )) == NULL ) +// return sal_False; + if( ( connectivity::pODBC3SQLSetCursorName = (T3SQLSetCursorName)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLSetCursorName").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLExecute = (T3SQLExecute)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLExecute").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLExecDirect = (T3SQLExecDirect)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLExecDirect").pData )) == NULL ) + return sal_False; + /*if( ( connectivity::pODBC3SQLNativeSql = (T3SQLNativeSql)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLNativeSql").pData )) == NULL ) + return sal_False;*/ + if( ( connectivity::pODBC3SQLDescribeParam = (T3SQLDescribeParam)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLDescribeParam").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLNumParams = (T3SQLNumParams)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLNumParams").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLParamData = (T3SQLParamData)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLParamData").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLPutData = (T3SQLPutData)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLPutData").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLRowCount = (T3SQLRowCount)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLRowCount").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLNumResultCols = (T3SQLNumResultCols)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLNumResultCols").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLDescribeCol = (T3SQLDescribeCol)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLDescribeCol").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLColAttribute = (T3SQLColAttribute)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLColAttribute").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLBindCol = (T3SQLBindCol)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLBindCol").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLFetch = (T3SQLFetch)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLFetch").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLFetchScroll = (T3SQLFetchScroll)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLFetchScroll").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLGetData = (T3SQLGetData)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetData").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLSetPos = (T3SQLSetPos)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLSetPos").pData )) == NULL ) + return sal_False; + if( _bDS && ( connectivity::pODBC3SQLBulkOperations = (T3SQLBulkOperations)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLBulkOperations").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLMoreResults = (T3SQLMoreResults)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLMoreResults").pData )) == NULL ) + return sal_False; + /*if( ( connectivity::pODBC3SQLGetDiagField = (T3SQLGetDiagField)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetDiagField").pData )) == NULL ) + return sal_False;*/ + if( ( connectivity::pODBC3SQLGetDiagRec = (T3SQLGetDiagRec)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetDiagRec").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLColumnPrivileges = (T3SQLColumnPrivileges)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLColumnPrivileges").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLColumns = (T3SQLColumns)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLColumns").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLForeignKeys = (T3SQLForeignKeys)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLForeignKeys").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLPrimaryKeys = (T3SQLPrimaryKeys)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLPrimaryKeys").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLProcedureColumns = (T3SQLProcedureColumns)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLProcedureColumns").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLProcedures = (T3SQLProcedures)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLProcedures").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLSpecialColumns = (T3SQLSpecialColumns)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLSpecialColumns").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLStatistics = (T3SQLStatistics)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLStatistics").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLTablePrivileges = (T3SQLTablePrivileges)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLTablePrivileges").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLTables = (T3SQLTables)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLTables").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLFreeStmt = (T3SQLFreeStmt)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLFreeStmt").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLCloseCursor = (T3SQLCloseCursor)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLCloseCursor").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLCancel = (T3SQLCancel)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLCancel").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLEndTran = (T3SQLEndTran)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLEndTran").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLDisconnect = (T3SQLDisconnect)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLDisconnect").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLFreeHandle = (T3SQLFreeHandle)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLFreeHandle").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLGetCursorName = (T3SQLGetCursorName)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetCursorName").pData )) == NULL ) + return sal_False; + if( ( connectivity::pODBC3SQLNativeSql = (T3SQLNativeSql)osl_getSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLNativeSql").pData )) == NULL ) + return sal_False; + + return sal_True; +} +// ------------------------------------------------------------------------- + +connectivity::T3SQLAllocHandle connectivity::pODBC3SQLAllocHandle; +connectivity::T3SQLConnect connectivity::pODBC3SQLConnect; +connectivity::T3SQLDriverConnect connectivity::pODBC3SQLDriverConnect; +connectivity::T3SQLBrowseConnect connectivity::pODBC3SQLBrowseConnect; +connectivity::T3SQLDataSources connectivity::pODBC3SQLDataSources; +connectivity::T3SQLDrivers connectivity::pODBC3SQLDrivers; +connectivity::T3SQLGetInfo connectivity::pODBC3SQLGetInfo; +connectivity::T3SQLGetFunctions connectivity::pODBC3SQLGetFunctions; +connectivity::T3SQLGetTypeInfo connectivity::pODBC3SQLGetTypeInfo; +connectivity::T3SQLSetConnectAttr connectivity::pODBC3SQLSetConnectAttr; +connectivity::T3SQLGetConnectAttr connectivity::pODBC3SQLGetConnectAttr; +connectivity::T3SQLSetEnvAttr connectivity::pODBC3SQLSetEnvAttr; +connectivity::T3SQLGetEnvAttr connectivity::pODBC3SQLGetEnvAttr; +connectivity::T3SQLSetStmtAttr connectivity::pODBC3SQLSetStmtAttr; +connectivity::T3SQLGetStmtAttr connectivity::pODBC3SQLGetStmtAttr; +//connectivity::T3SQLSetDescField connectivity::pODBC3SQLSetDescField; +//connectivity::T3SQLGetDescField connectivity::pODBC3SQLGetDescField; +//connectivity::T3SQLGetDescRec connectivity::pODBC3SQLGetDescRec; +//connectivity::T3SQLSetDescRec connectivity::pODBC3SQLSetDescRec; +connectivity::T3SQLPrepare connectivity::pODBC3SQLPrepare; +connectivity::T3SQLBindParameter connectivity::pODBC3SQLBindParameter; +//connectivity::T3SQLGetCursorName connectivity::pODBC3SQLGetCursorName; +connectivity::T3SQLSetCursorName connectivity::pODBC3SQLSetCursorName; +connectivity::T3SQLExecute connectivity::pODBC3SQLExecute; +connectivity::T3SQLExecDirect connectivity::pODBC3SQLExecDirect; +//connectivity::T3SQLNativeSql connectivity::pODBC3SQLNativeSql; +connectivity::T3SQLDescribeParam connectivity::pODBC3SQLDescribeParam; +connectivity::T3SQLNumParams connectivity::pODBC3SQLNumParams; +connectivity::T3SQLParamData connectivity::pODBC3SQLParamData; +connectivity::T3SQLPutData connectivity::pODBC3SQLPutData; +connectivity::T3SQLRowCount connectivity::pODBC3SQLRowCount; +connectivity::T3SQLNumResultCols connectivity::pODBC3SQLNumResultCols; +connectivity::T3SQLDescribeCol connectivity::pODBC3SQLDescribeCol; +connectivity::T3SQLColAttribute connectivity::pODBC3SQLColAttribute; +connectivity::T3SQLBindCol connectivity::pODBC3SQLBindCol; +connectivity::T3SQLFetch connectivity::pODBC3SQLFetch; +connectivity::T3SQLFetchScroll connectivity::pODBC3SQLFetchScroll; +connectivity::T3SQLGetData connectivity::pODBC3SQLGetData; +connectivity::T3SQLSetPos connectivity::pODBC3SQLSetPos; +connectivity::T3SQLBulkOperations connectivity::pODBC3SQLBulkOperations; +connectivity::T3SQLMoreResults connectivity::pODBC3SQLMoreResults; +//connectivity::T3SQLGetDiagField connectivity::pODBC3SQLGetDiagField; +connectivity::T3SQLGetDiagRec connectivity::pODBC3SQLGetDiagRec; +connectivity::T3SQLColumnPrivileges connectivity::pODBC3SQLColumnPrivileges; +connectivity::T3SQLColumns connectivity::pODBC3SQLColumns; +connectivity::T3SQLForeignKeys connectivity::pODBC3SQLForeignKeys; +connectivity::T3SQLPrimaryKeys connectivity::pODBC3SQLPrimaryKeys; +connectivity::T3SQLProcedureColumns connectivity::pODBC3SQLProcedureColumns; +connectivity::T3SQLProcedures connectivity::pODBC3SQLProcedures; +connectivity::T3SQLSpecialColumns connectivity::pODBC3SQLSpecialColumns; +connectivity::T3SQLStatistics connectivity::pODBC3SQLStatistics; +connectivity::T3SQLTablePrivileges connectivity::pODBC3SQLTablePrivileges; +connectivity::T3SQLTables connectivity::pODBC3SQLTables; +connectivity::T3SQLFreeStmt connectivity::pODBC3SQLFreeStmt; +connectivity::T3SQLCloseCursor connectivity::pODBC3SQLCloseCursor; +connectivity::T3SQLCancel connectivity::pODBC3SQLCancel; +connectivity::T3SQLEndTran connectivity::pODBC3SQLEndTran; +connectivity::T3SQLDisconnect connectivity::pODBC3SQLDisconnect; +connectivity::T3SQLFreeHandle connectivity::pODBC3SQLFreeHandle; +connectivity::T3SQLGetCursorName connectivity::pODBC3SQLGetCursorName; +connectivity::T3SQLNativeSql connectivity::pODBC3SQLNativeSql; + + diff --git a/connectivity/source/drivers/odbc/OPreparedStatement.cxx b/connectivity/source/drivers/odbc/OPreparedStatement.cxx new file mode 100644 index 000000000000..40da2368fb93 --- /dev/null +++ b/connectivity/source/drivers/odbc/OPreparedStatement.cxx @@ -0,0 +1,1063 @@ +/************************************************************************* + * + * $RCSfile: OPreparedStatement.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif +#ifndef _CONNECTIVITY_ODBC_OPREPAREDSTATEMENT_HXX_ +#include "odbc/OPreparedStatement.hxx" +#endif +#ifndef _CONNECTIVITY_OBOUNPARAM_HXX_ +#include "odbc/OBoundParam.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _CONNECTIVITY_OTOOLS_HXX_ +#include "odbc/OTools.hxx" +#endif +#ifndef _CONNECTIVITY_ODBC_ORESULTSETMETADATA_HXX_ +#include "odbc/OResultSetMetaData.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif + +using namespace connectivity; +using namespace connectivity::odbc; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::sdbcx; +using namespace com::sun::star::container; +using namespace com::sun::star::io; +using namespace com::sun::star::util; + +int OBoundParam::ASCII = 1; +int OBoundParam::UNICODE = 2; +int OBoundParam::BINARY = 3; + +IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.OPreparedStatement","com.sun.star.sdbc.PreparedStatement"); + +OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const ::std::vector<OTypeInfo>& _TypeInfo,const ::rtl::OUString& sql) + : OStatement_BASE2( _pConnection ),m_aTypeInfo(_TypeInfo) +{ + ::rtl::OString aSql(::rtl::OUStringToOString(sql,osl_getThreadTextEncoding())); + N3SQLPrepare(m_aStatementHandle,(SDB_ODBC_CHAR *) aSql.getStr(),aSql.getLength()); + initBoundParam(); +} +// ------------------------------------------------------------------------- + +Any SAL_CALL OPreparedStatement::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = OStatement_BASE2::queryInterface(rType); + if(!aRet.hasValue()) + aRet = ::cppu::queryInterface( rType, + static_cast< XPreparedStatement*>(this), + static_cast< XParameters*>(this), + static_cast< XPreparedBatchExecution*>(this), + static_cast< XResultSetMetaDataSupplier*>(this)); + return aRet; +} +// ------------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OPreparedStatement::getTypes( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< XPreparedStatement > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< XParameters > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< XResultSetMetaDataSupplier > *)0 ), + ::getCppuType( (const ::com::sun::star::uno::Reference< XPreparedBatchExecution > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),OStatement_BASE2::getTypes()); +} +// ------------------------------------------------------------------------- + +Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( ) throw(SQLException, RuntimeException) +{ + if(m_xMetaData.is()) + m_xMetaData = new OResultSetMetaData(m_aStatementHandle); + return m_xMetaData; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::close( ) throw(SQLException, RuntimeException) +{ + // Close/clear our result set + clearMyResultSet (); + + // Reset last warning message + + try { + clearWarnings (); + if (m_aStatementHandle != SQL_NULL_HSTMT) + { + N3SQLFreeStmt (m_aStatementHandle, SQL_DROP); + m_aStatementHandle = SQL_NULL_HSTMT; + FreeParams(); + } + } + catch (SQLException & ex) { + // If we get an error, ignore + } + + // Remove this Statement object from the Connection object's + // list +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeException) +{ + sal_Bool hasResultSet = sal_False; + SQLWarning warning; + sal_Bool needData = sal_False; + + // Reset warnings + + clearWarnings (); + + // Reset the statement handle, warning and saved Resultset + + reset(); + + // Call SQLExecute + + try + { + SQLRETURN nReturn = N3SQLExecute(m_aStatementHandle); + + OTools::ThrowException(nReturn,m_aStatementHandle,SQL_HANDLE_STMT,*this); + needData = nReturn == SQL_NEED_DATA; + + // Now loop while more data is needed (i.e. a data-at- + // execution parameter was given). For each parameter + // that needs data, put the data from the input stream. + + while (needData) { + + // Get the parameter number that requires data + + sal_Int32* paramIndex = 0; + nReturn = N3SQLParamData(m_aStatementHandle,(SQLPOINTER*)¶mIndex); + + // If the parameter index is -1, there is no + // more data required + + if (*paramIndex == -1) + needData = sal_False; + else + { + // Now we have the proper parameter + // index, get the data from the input + // stream and do a SQLPutData + putParamData (*paramIndex); + } + } + + } + catch (SQLWarning& ex) + { + + // Save pointer to warning and save with ResultSet + // object once it is created. + + warning = ex; + } + + // Now loop while more data is needed (i.e. a data-at- + // execution parameter was given). For each parameter + // that needs data, put the data from the input stream. + + while (needData) { + + // Get the parameter number that requires data + + sal_Int32* paramIndex = 0; + N3SQLParamData (m_aStatementHandle,(SQLPOINTER*)¶mIndex); + + // If the parameter index is -1, there is no more + // data required + + if (*paramIndex == -1) { + needData = sal_False; + } + else { + // Now we have the proper parameter index, + // get the data from the input stream + // and do a SQLPutData + putParamData(*paramIndex); + } + } + + // Now determine if there is a result set associated with + // the SQL statement that was executed. Get the column + // count, and if it is not zero, there is a result set. + + if (getColumnCount () > 0) + hasResultSet = sal_True; + + + return hasResultSet; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, RuntimeException) +{ + sal_Int32 numRows = -1; + + // Execute the statement. If execute returns sal_False, a + // row count exists. + + if (!execute()) + numRows = getUpdateCount (); + else { + + // No update count was produced (a ResultSet was). Raise + // an exception + + throw SQLException(::rtl::OUString::createFromAscii("No row count was produced"), + *this, + ::rtl::OUString(),0,Any()); + } + return numRows; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) +{ + setChar(parameterIndex, DataType::CHAR, 0, x); +} +// ------------------------------------------------------------------------- + +Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQLException, RuntimeException) +{ + return (Reference< XConnection >)m_pConnection; +} +// ------------------------------------------------------------------------- + +Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLException, RuntimeException) +{ + Reference< XResultSet > rs = NULL; + + if (execute()) + rs = getResultSet(sal_False); + + else { + + // No ResultSet was produced. Raise an exception + + throw SQLException(::rtl::OUString::createFromAscii("No ResultSet was produced"), + *this, + ::rtl::OUString(),0,Any()); + } + return rs; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(SQLException, RuntimeException) +{ + sal_Int32 value = 0; + + // If the parameter is sal_True, set the value to 1 + if (x) { + value = 1; + } + + // Set the parameter as if it were an integer + setInt (parameterIndex, value); +} +// ------------------------------------------------------------------------- +#define PREP_BIND_PARAM(_ty,_jt) \ + bindParameter( m_aStatementHandle, \ + parameterIndex, \ + bindBuf,getLengthBuf(parameterIndex), \ + _jt, \ + sal_False,sal_False,&x,(Reference <XInterface>)*this) + + + +void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(SQLException, RuntimeException) +{ + // Allocate a buffer to be used in binding. This will be + // a 'permanent' buffer that the bridge will fill in with + // the bound data in native format. + if( !parameterIndex || parameterIndex > numParams) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + sal_Int8* bindBuf = allocBindBuf(parameterIndex, 4); + PREP_BIND_PARAM(sal_Int8,SQL_TINYINT); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const Date& aData ) throw(SQLException, RuntimeException) +{ + // Allocate a buffer to be used in binding. This will be + // a 'permanent' buffer that the bridge will fill in with + // the bound data in native format. + + if( !parameterIndex || parameterIndex > numParams) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + sal_Int8* bindBuf = allocBindBuf (parameterIndex, 32); + + + DATE_STRUCT x = OTools::DateToOdbcDate(aData); + PREP_BIND_PARAM(DATE_STRUCT,DataType::DATE); +} +// ------------------------------------------------------------------------- + + +void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const Time& aVal ) throw(SQLException, RuntimeException) +{ + // Allocate a buffer to be used in binding. This will be + // a 'permanent' buffer that the bridge will fill in with + // the bound data in native format. + if( !parameterIndex || parameterIndex > numParams) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + sal_Int8* bindBuf = allocBindBuf (parameterIndex, 32); + + TIME_STRUCT x = OTools::TimeToOdbcTime(aVal); + PREP_BIND_PARAM(TIME_STRUCT,DataType::TIME); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const DateTime& aVal ) throw(SQLException, RuntimeException) +{ + // Allocate a buffer to be used in binding. This will be + // a 'permanent' buffer that the bridge will fill in with + // the bound data in native format. + if( !parameterIndex || parameterIndex > numParams) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + sal_Int8* bindBuf = allocBindBuf (parameterIndex, 32); + + TIMESTAMP_STRUCT x = OTools::DateTimeToTimestamp(aVal); + PREP_BIND_PARAM(TIMESTAMP_STRUCT,DataType::TIMESTAMP); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x ) throw(SQLException, RuntimeException) +{ + // Allocate a buffer to be used in binding. This will be + // a 'permanent' buffer that the bridge will fill in with + // the bound data in native format. + if( !parameterIndex || parameterIndex > numParams) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + sal_Int8* bindBuf = allocBindBuf (parameterIndex, 8); + PREP_BIND_PARAM(double,DataType::DOUBLE); +} + +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) throw(SQLException, RuntimeException) +{ + // Allocate a buffer to be used in binding. This will be + // a 'permanent' buffer that the bridge will fill in with + // the bound data in native format. + if( !parameterIndex || parameterIndex > numParams) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + sal_Int8* bindBuf = allocBindBuf (parameterIndex, 8); + PREP_BIND_PARAM(float,DataType::FLOAT); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(SQLException, RuntimeException) +{ + // Allocate a buffer to be used in binding. This will be + // a 'permanent' buffer that the bridge will fill in with + // the bound data in native format. + if( !parameterIndex || parameterIndex > numParams) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + sal_Int8* bindBuf = allocBindBuf (parameterIndex, 4); + PREP_BIND_PARAM(sal_Int32,DataType::INTEGER); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 aVal ) throw(SQLException, RuntimeException) +{ + // Allocate a buffer to be used in binding. This will be + // a 'permanent' buffer that the bridge will fill in with + // the bound data in native format. + + if( !parameterIndex || parameterIndex > numParams) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + sal_Int8 *bindBuf = allocBindBuf (parameterIndex, 8); + float x = (float)aVal; + PREP_BIND_PARAM(float,DataType::BIGINT); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(SQLException, RuntimeException) +{ + // Get the buffer needed for the length + if( !parameterIndex || parameterIndex > numParams) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + sal_Int8* lenBuf = getLengthBuf (parameterIndex); + *lenBuf = SQL_NULL_DATA; + UDWORD prec = 0; + if (sqlType == SQL_CHAR) + prec = 1; + + N3SQLBindParameter(m_aStatementHandle, + parameterIndex, + SQL_PARAM_INPUT, + SQL_C_DEFAULT, + sqlType, + prec, + 0, + NULL, + 0, + (SDWORD*)lenBuf + ); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Reference< XClob >& x ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Reference< XBlob >& x ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setArray( sal_Int32 parameterIndex, const Reference< XArray >& x ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setRef( sal_Int32 parameterIndex, const Reference< XRef >& x ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 sqlType, sal_Int32 scale ) throw(SQLException, RuntimeException) +{ + // For each known SQL Type, call the appropriate + // set routine + + switch (sqlType) + { + case DataType::CHAR: + setString (parameterIndex, *(::rtl::OUString*) x.getValue()); + break; + + case DataType::VARCHAR: + setChar (parameterIndex, sqlType, 0, *(::rtl::OUString*) x.getValue()); + break; + + case DataType::LONGVARCHAR: + setChar (parameterIndex, sqlType, 0, *(::rtl::OUString*) x.getValue()); + break; + + case DataType::BIT: + setBoolean (parameterIndex,*(sal_Bool*) x.getValue()); + break; + + case DataType::TINYINT: + setByte (parameterIndex, *(sal_Int8*)x.getValue()); + break; + + case DataType::SMALLINT: + setShort (parameterIndex, *(short*)x.getValue()); + break; + + case DataType::INTEGER: + setInt (parameterIndex,*(sal_Int32*)x.getValue ()); + break; + + case DataType::BIGINT: + // setLong (parameterIndex,((sal_Int32) x).longValue ()); + break; + + case DataType::REAL: + setFloat (parameterIndex, *(float*)x.getValue ()); + break; + + case DataType::FLOAT: + setFloat (parameterIndex, *(float*)x.getValue ()); + break; + + case DataType::DOUBLE: + setDouble (parameterIndex,*(double*)x.getValue ()); + break; + + case DataType::BINARY: + setBytes (parameterIndex, *(Sequence<sal_Int8>*)x.getValue()); + break; + + case DataType::VARBINARY: + case DataType::LONGVARBINARY: + { + Sequence<sal_Int8> y; + x >>= y; + + if ( y.getLength() > 2000 ) + { + // setBinaryStream (parameterIndex, y, y.getLength()); + } + else + { + setBinary (parameterIndex, sqlType, y); + } + } + + break; + + case DataType::DATE: + setDate (parameterIndex,*(Date*) x.getValue()); + break; + + case DataType::TIME: + setTime (parameterIndex, *(Time*)x.getValue()); + break; + + case DataType::TIMESTAMP: + setTimestamp (parameterIndex,*(DateTime*)x.getValue()); + break; + + default: + { + ::rtl::OUString aVal = ::rtl::OUString::createFromAscii("Unknown SQL Type for PreparedStatement.setObject (SQL Type="); + aVal += ::rtl::OUString::valueOf(sqlType); + throw SQLException( aVal, + *this, + ::rtl::OUString(),0,Any()); + } + + } +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(SQLException, RuntimeException) +{ + setNull(parameterIndex,sqlType); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException) +{ + // setObject (parameterIndex, x, sqlType, 0); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(SQLException, RuntimeException) +{ + // Allocate a buffer to be used in binding. This will be + // a 'permanent' buffer that the bridge will fill in with + // the bound data in native format. + if( !parameterIndex || parameterIndex > numParams) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + sal_Int8* bindBuf = allocBindBuf (parameterIndex, 4); + PREP_BIND_PARAM(sal_Int16,DataType::SMALLINT); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) +{ + if ( x.getLength() > 2000 ) + { + // setBinaryStream (parameterIndex, new java.io.ByteArrayInputStream(x), x.length); + } + else + { + setBinary (parameterIndex, DataType::BINARY, x); + } +} +// ------------------------------------------------------------------------- + + +void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) +{ + setStream (parameterIndex, x, length, DataType::LONGVARCHAR,OBoundParam::ASCII); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) +{ + setStream (parameterIndex, x, length, DataType::LONGVARBINARY,OBoundParam::BINARY); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::clearParameters( ) throw(SQLException, RuntimeException) +{ + N3SQLFreeStmt (m_aStatementHandle, SQL_RESET_PARAMS); +} +// ------------------------------------------------------------------------- +void SAL_CALL OPreparedStatement::clearBatch( ) throw(SQLException, RuntimeException) +{ + // clearParameters( ); + // m_aBatchList.erase(); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::addBatch( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +Sequence< sal_Int32 > SAL_CALL OPreparedStatement::executeBatch( ) throw(SQLException, RuntimeException) +{ + return Sequence< sal_Int32 > (); +} +// ------------------------------------------------------------------------- + +//==================================================================== +// methods +//==================================================================== + +//-------------------------------------------------------------------- +// initBoundParam +// Initialize the bound parameter objects +//-------------------------------------------------------------------- + +void OPreparedStatement::initBoundParam () throw(SQLException) +{ + // Get the number of parameters + numParams = 0; + N3SQLNumParams (m_aStatementHandle,(short*)&numParams); + + // There are parameter markers, allocate the bound + // parameter objects + + if (numParams > 0) + { + // Allocate an array of bound parameter objects + + boundParams = new OBoundParam[numParams]; + + // Allocate and initialize each bound parameter + + for (sal_Int32 i = 0; i < numParams; i++) + { + boundParams[i] = OBoundParam(); + boundParams[i].initialize (); + } + } +} +// ------------------------------------------------------------------------- + +//-------------------------------------------------------------------- +// allocBindBuf +// Allocate storage for the permanent data buffer for the bound +// parameter. +//-------------------------------------------------------------------- + +sal_Int8* OPreparedStatement::allocBindBuf( sal_Int32 index,sal_Int32 bufLen) +{ + sal_Int8* b = NULL; + + // Sanity check the parameter number + + if ((index >= 1) && + (index <= numParams)) + { + b = boundParams[index - 1].allocBindDataBuffer(bufLen); + } + + return b; +} +// ------------------------------------------------------------------------- + +//-------------------------------------------------------------------- +// getDataBuf +// Gets the data buffer for the given parameter index +//-------------------------------------------------------------------- + +sal_Int8* OPreparedStatement::getDataBuf (sal_Int32 index) +{ + sal_Int8* b = NULL; + + // Sanity check the parameter number + + if ((index >= 1) && + (index <= numParams)) + { + b = boundParams[index - 1].getBindDataBuffer (); + } + + return b; +} +// ------------------------------------------------------------------------- + +//-------------------------------------------------------------------- +// getLengthBuf +// Gets the length buffer for the given parameter index +//-------------------------------------------------------------------- + +sal_Int8* OPreparedStatement::getLengthBuf (sal_Int32 index) +{ + sal_Int8* b = NULL; + + // Sanity check the parameter number + + if ((index >= 1) && + (index <= numParams)) + { + b = boundParams[index - 1].getBindLengthBuffer (); + } + + return b; +} +// ------------------------------------------------------------------------- + +//-------------------------------------------------------------------- +// getParamLength +// Returns the length of the given parameter number. When each +// parameter was bound, a 4-sal_Int8 buffer was given to hold the +// length (stored in native format). Get the buffer, convert the +// buffer from native format, and return it. If the length is -1, +// the column is considered to be NULL. +//-------------------------------------------------------------------- + +sal_Int32 OPreparedStatement::getParamLength ( sal_Int32 index) +{ + sal_Int32 paramLen = SQL_NULL_DATA; + + // Sanity check the parameter number + + if ((index >= 1) && + (index <= numParams)) { + + // Now get the length of the parameter from the + // bound param array. -1 is returned if it is NULL. + long n = 0; + memcpy (&n, boundParams[index -1].getBindLengthBuffer (), sizeof (n)); + paramLen = n; + } + return paramLen; +} +// ------------------------------------------------------------------------- + +//-------------------------------------------------------------------- +// putParamData +// Puts parameter data from a previously bound input stream. The +// input stream was bound using SQL_LEN_DATA_AT_EXEC. +//-------------------------------------------------------------------- + +void OPreparedStatement::putParamData (sal_Int32 index) throw(SQLException) +{ + // We'll transfer up to maxLen at a time + sal_Int32 maxLen = MAX_PUT_DATA_LENGTH; + sal_Int32 bufLen; + sal_Int32 realLen; + // sal_Int8* buf = new sal_Int8[maxLen]; + Sequence< sal_Int8 > buf(maxLen); + sal_Bool endOfStream = sal_False; + + // Sanity check the parameter index + if ((index < 1) || + (index > numParams)) + { + return; + } + + // Get the information about the input stream + + Reference< XInputStream> inputStream = boundParams[index - 1].getInputStream (); + sal_Int32 inputStreamLen = boundParams[index - 1].getInputStreamLen (); + sal_Int32 inputStreamType = boundParams[index - 1].getStreamType (); + + // Loop while more data from the input stream + + while (!endOfStream) + { + + // Read some data from the input stream + + try { + bufLen = inputStream->readBytes(buf,maxLen); + } + catch (IOException& ex) { + + // If an I/O exception was generated, turn + // it into a SQLException + + throw SQLException(ex.Message,*this,::rtl::OUString(),0,Any()); + } + + // -1 as the number of bytes read indicates that + // there is no more data in the input stream + + if (bufLen == -1) + { + + // Sanity check to ensure that all the data we said we + // had was read. If not, raise an exception + + if (inputStreamLen != 0) { + throw SQLException (::rtl::OUString::createFromAscii("End of InputStream reached before satisfying length specified when InputStream was set"), + *this, + ::rtl::OUString(),0,Any()); + } + endOfStream = sal_True; + break; + } + + // If we got more bytes than necessary, truncate + // the buffer by re-setting the buffer length. Also, + // indicate that we don't need to read any more. + + if (bufLen > inputStreamLen) + { + bufLen = inputStreamLen; + endOfStream = sal_True; + } + + realLen = bufLen; + + // For UNICODE streams, strip off the high sal_Int8 and set the + // number of actual bytes present. It is assumed that + // there are 2 bytes present for every UNICODE character - if + // not, then that's not our problem + + if (inputStreamType == OBoundParam::UNICODE) + { + realLen = bufLen / 2; + + for (sal_Int32 ii = 0; ii < realLen; ii++) + buf[ii] = buf[(ii * 2) + 1]; + } + + // Put the data + + N3SQLPutData (m_aStatementHandle, buf.getArray(), realLen); + + // Decrement the number of bytes still needed + + inputStreamLen -= bufLen; + + + // If there is no more data to be read, exit loop + + if (inputStreamLen == 0) + endOfStream = sal_True; + } +} +// ------------------------------------------------------------------------- +//-------------------------------------------------------------------- +// getPrecision +// Given a SQL type, return the maximum precision for the column. +// Returns -1 if not known +//-------------------------------------------------------------------- + +sal_Int32 OPreparedStatement::getPrecision ( sal_Int32 sqlType) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + sal_Int32 prec = -1; + OTypeInfo aInfo; + aInfo.nType = sqlType; + if (m_aTypeInfo.size()) + { + ::std::vector<OTypeInfo>::const_iterator aIter = ::std::find(m_aTypeInfo.begin(),m_aTypeInfo.end(),aInfo); + if(aIter != m_aTypeInfo.end()) + prec = (*aIter).nPrecision; + } + return prec; +} + +//-------------------------------------------------------------------- +// setStream +// Sets an input stream as a parameter, using the given SQL type +//-------------------------------------------------------------------- + +void OPreparedStatement::setStream ( + sal_Int32 ParameterIndex, + const Reference< XInputStream>& x, + sal_Int32 length, + sal_Int32 SQLtype, + sal_Int32 streamType) + throw(SQLException) +{ + if( !ParameterIndex || ParameterIndex > numParams) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + // Get the buffer needed for the length + + sal_Int8* lenBuf = getLengthBuf(ParameterIndex); + + // Allocate a new buffer for the parameter data. This buffer + // will be returned by SQLParamData (it is set to the parameter + // number, a 4-sal_Int8 integer) + + sal_Int8* dataBuf = allocBindBuf (ParameterIndex, 4); + + // Bind the parameter with SQL_LEN_DATA_AT_EXEC + SWORD Ctype = SQL_C_CHAR; + SDWORD atExec = SQL_LEN_DATA_AT_EXEC (length); + memcpy (dataBuf, &ParameterIndex, sizeof(ParameterIndex)); + memcpy (lenBuf, &atExec, sizeof (atExec)); + + if ((SQLtype == SQL_BINARY) || (SQLtype == SQL_VARBINARY) || (SQLtype == SQL_LONGVARBINARY)) + Ctype = SQL_C_BINARY; + + + N3SQLBindParameter(m_aStatementHandle, ParameterIndex,SQL_PARAM_INPUT,Ctype, + SQLtype, length,0, dataBuf, sizeof(ParameterIndex),(SDWORD*)lenBuf); + + // Save the input stream + + boundParams[ParameterIndex - 1].setInputStream (x, length); + + // Set the stream type + + boundParams[ParameterIndex - 1].setStreamType (streamType); +} +// ------------------------------------------------------------------------- + +//-------------------------------------------------------------------- +// setChar +// Binds the given string to the given SQL type +//-------------------------------------------------------------------- +void OPreparedStatement::setChar(sal_Int32 parameterIndex, + sal_Int32 SQLtype, + sal_Int32 scale, + const ::rtl::OUString& x) + throw(SQLException) +{ + // ::rtl::OString x1(::rtl::OUStringToOString(x,osl_getThreadTextEncoding())); + + if( !parameterIndex || parameterIndex > numParams) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + sal_Int8* bindBuf = allocBindBuf (parameterIndex,x.getLength()); + + // Get the precision for this SQL type. If the precision + // is out of bounds, set it to our default + +// sal_Int32 precision = getPrecision (SQLtype); +// +// if ((precision < 0) || (precision > 2000)) +// precision = 2000; +// + // bindParameter(m_aStatementHandle,parameterIndex,bindBuf); + PREP_BIND_PARAM(char*,SQLtype); + +// // Make a copy of the data +// SDWORD lBuf = x.getLength(); +// memcpy (bindBuf, x.getStr(), lBuf); +// bindBuf[lBuf] = '\0'; +// precision = lBuf; +// +// SQLINTEGER nNTS = SQL_NTS; +// +// SQLRETURN nRet = N3SQLBindParameter(m_aStatementHandle, parameterIndex,SQL_PARAM_INPUT, +// SQLtype,SQL_C_CHAR, precision, scale, bindBuf,lBuf, &nNTS); +// +} +// ------------------------------------------------------------------------- + +//-------------------------------------------------------------------- +// setBinary +// Binds the given sal_Int8 array to the given SQL type +//-------------------------------------------------------------------- + +void OPreparedStatement::setBinary (sal_Int32 parameterIndex,sal_Int32 SQLtype, + const Sequence< sal_Int8 >& x) throw(SQLException) +{ + // Allocate a buffer to be used in binding. This will be + // a 'permanent' buffer that the bridge will fill in with + // the bound data in native format. + if( !parameterIndex || parameterIndex > numParams) + throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any()); + + sal_Int8* bindBuf = allocBindBuf (parameterIndex,x.getLength()); + + // Get the buffer needed for the length + + // sal_Int8* lenBuf = getLengthBuf (parameterIndex); + bindParameter< Sequence< sal_Int8 > >( m_aStatementHandle, + parameterIndex, + bindBuf,getLengthBuf(parameterIndex), + SQLtype, + sal_False,sal_False,&x,(Reference <XInterface>)*this); + + + // N3SQLBindInParameterBinary (m_aStatementHandle, parameterIndex, + // SQLtype, x.getConstArray(), bindBuf, lenBuf, buffers); + +} +// ------------------------------------------------------------------------- + +void OPreparedStatement::FreeParams() +{ + delete boundParams; +} +// ------------------------------------------------------------------------- + + diff --git a/connectivity/source/drivers/odbc/OResultSet.cxx b/connectivity/source/drivers/odbc/OResultSet.cxx new file mode 100644 index 000000000000..fbf4538f6d56 --- /dev/null +++ b/connectivity/source/drivers/odbc/OResultSet.cxx @@ -0,0 +1,2051 @@ +/************************************************************************* + * + * $RCSfile: OResultSet.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ODBC_ORESULTSET_HXX_ +#include "odbc/OResultSet.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +#ifndef _CONNECTIVITY_OTOOLS_HXX_ +#include "odbc/OTools.hxx" +#endif +#ifndef _CONNECTIVITY_ODBC_ORESULTSETMETADATA_HXX_ +#include "odbc/OResultSetMetaData.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ +#include <com/sun/star/beans/PropertyAttribute.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_COMPAREBOOKMARK_HPP_ +#include <com/sun/star/sdbcx/CompareBookmark.hpp> +#endif +#ifndef _UTL_PROPERTY_HXX_ +#include <unotools/property.hxx> +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _CPPUHELPER_EXTRACT_HXX_ +#include <cppuhelper/extract.hxx> +#endif +//#ifndef _CONNECTIVITY_OTOOLS_HXX_ +//#include "odbc/OTools.hxx" +//#endif + +using namespace connectivity::odbc; +using namespace cppu; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::sdbcx; +using namespace com::sun::star::container; +using namespace com::sun::star::io; +using namespace com::sun::star::util; +//------------------------------------------------------------------------------ +// IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.OResultSet","com.sun.star.sdbc.ResultSet"); +::rtl::OUString SAL_CALL OResultSet::getImplementationName( ) throw ( RuntimeException) \ +{ + return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.odbc.ResultSet"); +} +// ------------------------------------------------------------------------- + Sequence< ::rtl::OUString > SAL_CALL OResultSet::getSupportedServiceNames( ) throw( RuntimeException) +{ + Sequence< ::rtl::OUString > aSupported(2); + aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.ResultSet"); + aSupported[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.ResultSet"); + return aSupported; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw( RuntimeException) +{ + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + const ::rtl::OUString* pSupported = aSupported.getConstArray(); + for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) + if (pSupported->equals(_rServiceName)) + return sal_True; + + return sal_False; +} + +// ------------------------------------------------------------------------- +OResultSet::OResultSet(SQLHANDLE _pStatementHandle ,OStatement_Base* pStmt) : OResultSet_BASE(m_aMutex) + ,OPropertySetHelper(OResultSet_BASE::rBHelper) + ,m_aStatement((OWeakObject*)pStmt) + ,m_aStatementHandle(_pStatementHandle) + ,m_aConnectionHandle(pStmt->getConnectionHandle()) + ,m_nRowPos(0) + ,m_bLastRecord(sal_False) + ,m_bEOF(sal_False) + ,m_bFreeHandle(sal_False) + ,m_xMetaData(NULL) + ,m_bInserting(sal_False) + ,m_nLastColumnPos(0) +{ + osl_incrementInterlockedCount( &m_refCount ); + m_pRowStatusArray = new SQLUSMALLINT[1]; // the default value + N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_STATUS_PTR,m_pRowStatusArray,SQL_IS_POINTER); + + SQLSMALLINT nValueLen = 0; + N3SQLGetInfo(m_aConnectionHandle,SQL_GETDATA_EXTENSIONS,&nValueLen,sizeof nValueLen,&nValueLen); + SQLINTEGER nCurType = 0; + N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_TYPE,&nCurType,SQL_IS_UINTEGER,0); + + allocBuffer((SQL_GD_ANY_ORDER & nValueLen) != SQL_GD_ANY_ORDER && nCurType != SQL_CURSOR_FORWARD_ONLY); + osl_decrementInterlockedCount( &m_refCount ); +} +// ------------------------------------------------------------------------- +OResultSet::OResultSet(SQLHANDLE _pStatementHandle ) : OResultSet_BASE(m_aMutex) + ,OPropertySetHelper(OResultSet_BASE::rBHelper) + ,m_aStatement(NULL) + ,m_aStatementHandle(_pStatementHandle) + ,m_aConnectionHandle(NULL) + ,m_nRowPos(0) + ,m_bLastRecord(sal_False) + ,m_bEOF(sal_False) + ,m_bFreeHandle(sal_False) + ,m_xMetaData(NULL) + ,m_bInserting(sal_False) + ,m_nLastColumnPos(0) +{ + osl_incrementInterlockedCount( &m_refCount ); + m_pRowStatusArray = new SQLUSMALLINT[1]; // the default value + osl_decrementInterlockedCount( &m_refCount ); + // allocBuffer(); +} + +// ------------------------------------------------------------------------- +OResultSet::~OResultSet() +{ + delete m_pRowStatusArray; + if(m_aBindVector.size()) + releaseBuffer(); +} +// ------------------------------------------------------------------------- +void OResultSet::disposing(void) +{ + OPropertySetHelper::disposing(); + + ::osl::MutexGuard aGuard(m_aMutex); + if(m_bFreeHandle) + { + N3SQLFreeStmt(m_aStatementHandle,SQL_CLOSE); + N3SQLFreeHandle(SQL_HANDLE_STMT,m_aStatementHandle); + m_aStatementHandle = NULL; + } + m_aStatement = NULL; + m_xMetaData = NULL; +} +// ------------------------------------------------------------------------- +void OResultSet::allocBuffer(sal_Bool _bAllocRow) +{ + m_bFetchData = !_bAllocRow; + m_aBindVector.push_back(NULL); // the first is reserved for the bookmark + Reference< XResultSetMetaData > xMeta = getMetaData(); + sal_Int32 nLen = xMeta->getColumnCount(); + for(sal_Int32 i = 1;i<=nLen;++i) + { + switch (xMeta->getColumnType(i)) + { + case DataType::CHAR: + case DataType::VARCHAR: + m_aBindVector.push_back(new ::rtl::OString()); + break; + case DataType::DECIMAL: + case DataType::NUMERIC: + case DataType::BIGINT: + m_aBindVector.push_back(new ::rtl::OString()); + break; + case DataType::DOUBLE: + m_aBindVector.push_back(new double(0.0)); + break; + case DataType::LONGVARCHAR: + m_aBindVector.push_back(new char[2]); // dient nur zum auffinden + break; + case DataType::LONGVARBINARY: + m_aBindVector.push_back(new char[2]); // dient nur zum auffinden + break; + case DataType::DATE: + m_aBindVector.push_back(new DATE_STRUCT); + break; + case DataType::TIME: + m_aBindVector.push_back(new TIME_STRUCT); + break; + case DataType::TIMESTAMP: + m_aBindVector.push_back(new TIMESTAMP_STRUCT); + break; + case DataType::BIT: + m_aBindVector.push_back(new sal_Int8(0)); + break; + case DataType::TINYINT: + case DataType::SMALLINT: + m_aBindVector.push_back(new sal_Int16(0)); + break; + case DataType::INTEGER: + m_aBindVector.push_back(new sal_Int32(0)); + break; + case DataType::REAL: + m_aBindVector.push_back(new float(0)); + break; + case DataType::BINARY: + case DataType::VARBINARY: + m_aBindVector.push_back(new sal_Int8[xMeta->getPrecision(i)]); + break; + } + } + m_aLengthVector.resize(nLen + 1); +// if(_bAllocRow) +// m_aRow.resize(nLen + 1); +} +// ------------------------------------------------------------------------- +void OResultSet::releaseBuffer() +{ + Reference< XResultSetMetaData > xMeta = getMetaData(); + sal_Int32 nLen = xMeta->getColumnCount(); + for(sal_Int32 i = 0;i<nLen;++i) + { + switch (xMeta->getColumnType(i+1)) + { + case DataType::CHAR: + case DataType::VARCHAR: + delete (::rtl::OString*) m_aBindVector[i]; + break; + case DataType::DECIMAL: + case DataType::NUMERIC: + case DataType::BIGINT: + delete (::rtl::OString*) m_aBindVector[i]; + break; + case DataType::DOUBLE: + m_aBindVector.push_back(new double(0.0)); + break; + case DataType::LONGVARCHAR: + delete (char*) m_aBindVector[i]; + break; + case DataType::LONGVARBINARY: + delete (char*) m_aBindVector[i]; + break; + case DataType::DATE: + delete (DATE_STRUCT*) m_aBindVector[i]; + break; + case DataType::TIME: + delete (TIME_STRUCT*) m_aBindVector[i]; + break; + case DataType::TIMESTAMP: + delete (TIMESTAMP_STRUCT*) m_aBindVector[i]; + break; + case DataType::BIT: + delete (sal_Int8*) m_aBindVector[i]; + break; + case DataType::TINYINT: + case DataType::SMALLINT: + delete (sal_Int16*) m_aBindVector[i]; + break; + case DataType::INTEGER: + delete (sal_Int32*) m_aBindVector[i]; + break; + case DataType::REAL: + delete (float*) m_aBindVector[i]; + break; + case DataType::BINARY: + case DataType::VARBINARY: + delete (sal_Int8*) m_aBindVector[i]; + break; + } + } + m_aLengthVector.clear(); +} +// ------------------------------------------------------------------------- +Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = OPropertySetHelper::queryInterface(rType); + if(!aRet.hasValue()) + aRet = OResultSet_BASE::queryInterface(rType); + return aRet; +} +// ------------------------------------------------------------------------- + Sequence< Type > SAL_CALL OResultSet::getTypes( ) throw( RuntimeException) +{ + OTypeCollection aTypes( ::getCppuType( (const Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ), + ::getCppuType( (const Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ), + ::getCppuType( (const Reference< ::com::sun::star::beans::XPropertySet > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),OResultSet_BASE::getTypes()); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + Reference< XResultSetMetaData > xMeta = getMetaData(); + sal_Int32 nLen = xMeta->getColumnCount(); + sal_Int32 i = 1; + for(;i<=nLen;++i) + if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) : columnName.equalsIgnoreCase(xMeta->getColumnName(i))) + break; + return i; +} +// ------------------------------------------------------------------------- +Reference< XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); + // TODO use getBytes instead of + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); + // TODO use getBytes instead of + return NULL; +} + +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); + +// if(m_bFetchData) +// { +// if(columnIndex > m_nLastColumnPos) +// fillRow(columnIndex); +// return any2bool(m_aRow[columnIndex]); +// } + + + return getValue(m_aStatementHandle,columnIndex,SQL_C_BIT,m_bWasNull,**this,sal_Int8(0)); +} +// ------------------------------------------------------------------------- + +sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); +// if(!m_bFetchData) +// { +// if(columnIndex > m_nLastColumnPos) +// fillRow(columnIndex); +// return getINT16(m_aRow[columnIndex]); +// } + + + return getValue(m_aStatementHandle,columnIndex,SQL_C_CHAR,m_bWasNull,**this,sal_Int8(0)); +} +// ------------------------------------------------------------------------- + +Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); +// if(!m_bFetchData) +// { +// if(columnIndex > m_nLastColumnPos) +// fillRow(columnIndex); +// return *(Sequence< sal_Int8 >*)m_aRow[columnIndex].getValue(); // no assignment because this is very expensive +// } + return OTools::getBytesValue(m_aStatementHandle,columnIndex,getMetaData()->getColumnType(columnIndex),m_bWasNull,**this); +} +// ------------------------------------------------------------------------- + +Date SAL_CALL OResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); +// if(!m_bFetchData) +// { +// if(columnIndex > m_nLastColumnPos) +// fillRow(columnIndex); +// Date aRet; +// m_aRow[columnIndex] >>= aRet; +// return aRet; +// } + + DATE_STRUCT aDate; + aDate.day = 0; + aDate.month = 0; + aDate.year = 0; + aDate = getValue(m_aStatementHandle,columnIndex,SQL_C_DATE,m_bWasNull,**this,aDate); + return Date(aDate.day,aDate.month,aDate.year); +} +// ------------------------------------------------------------------------- + +double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); +// if(!m_bFetchData) +// { +// if(columnIndex > m_nLastColumnPos) +// fillRow(columnIndex); +// return connectivity::getDouble(m_aRow[columnIndex]); +// } + return getValue(m_aStatementHandle,columnIndex,SQL_C_DOUBLE,m_bWasNull,**this,double(0.0)); +} +// ------------------------------------------------------------------------- + +float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); +// if(!m_bFetchData) +// { +// if(columnIndex > m_nLastColumnPos) +// fillRow(columnIndex); +// float nRet = 0.0; +// m_aRow[columnIndex] >>= nRet; +// return nRet; +// } + return getValue(m_aStatementHandle,columnIndex,SQL_C_FLOAT,m_bWasNull,**this,float(0)); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); +// if(!m_bFetchData) +// { +// if(columnIndex > m_nLastColumnPos) +// fillRow(columnIndex); +// return getINT32(m_aRow[columnIndex]); +// } + return getValue(m_aStatementHandle,columnIndex,SQL_C_LONG,m_bWasNull,**this,sal_Int32(0)); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + sal_Int32 nValue = 0; + N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_NUMBER,&nValue,SQL_IS_UINTEGER,0); + return nValue; +} +// ------------------------------------------------------------------------- + +sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); + return sal_Int64(); +} +// ------------------------------------------------------------------------- + +Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(!m_xMetaData.is()) + m_xMetaData = new OResultSetMetaData(m_aStatementHandle); + return m_xMetaData; +} +// ------------------------------------------------------------------------- +Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); + return NULL; +} + +// ------------------------------------------------------------------------- + +Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); + return NULL; +} +// ------------------------------------------------------------------------- +Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); + return NULL; +} +// ------------------------------------------------------------------------- + +Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); + return NULL; +} +// ------------------------------------------------------------------------- + +Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); + return Any(); +} +// ------------------------------------------------------------------------- + +sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); +// if(!m_bFetchData) +// { +// if(columnIndex > m_nLastColumnPos) +// fillRow(columnIndex); +// return getINT16(m_aRow[columnIndex]); +// } + return getValue(m_aStatementHandle,columnIndex,SQL_C_SHORT,m_bWasNull,**this,sal_Int16(0)); +} +// ------------------------------------------------------------------------- + + +::rtl::OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); +// if(!m_bFetchData) +// { +// if(columnIndex > m_nLastColumnPos) +// fillRow(columnIndex); +// ::rtl::OUString aRet; +// m_aRow[columnIndex] >>= aRet; +// return aRet; +// } + return OTools::getStringValue(m_aStatementHandle,columnIndex,getMetaData()->getColumnType(columnIndex),m_bWasNull,**this); +} +// ------------------------------------------------------------------------- + + +Time SAL_CALL OResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); +// if(!m_bFetchData) +// { +// if(columnIndex > m_nLastColumnPos) +// fillRow(columnIndex); +// Time aRet; +// m_aRow[columnIndex] >>= aRet; +// return aRet; +// } + TIME_STRUCT aTime={0,0,0}; + aTime = getValue(m_aStatementHandle,columnIndex,SQL_C_TIME,m_bWasNull,**this,aTime); + return Time(0,aTime.second,aTime.minute,aTime.hour); +} +// ------------------------------------------------------------------------- + + +DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); +// if(!m_bFetchData) +// { +// if(columnIndex > m_nLastColumnPos) +// fillRow(columnIndex); +// DateTime aRet; +// m_aRow[columnIndex] >>= aRet; +// return aRet; +// } + TIMESTAMP_STRUCT aTime={0,0,0,0,0,0,0}; + aTime = getValue(m_aStatementHandle,columnIndex,SQL_C_TIMESTAMP,m_bWasNull,**this,aTime); + return DateTime(aTime.fraction*1000,aTime.second,aTime.minute,aTime.hour,aTime.day,aTime.month,aTime.year); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::isAfterLast( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_nCurrentFetchState == SQL_NO_DATA; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::isFirst( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_nRowPos == 1; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::isLast( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_bEOF && m_nCurrentFetchState != SQL_NO_DATA; +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::beforeFirst( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(first()) + previous(); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::afterLast( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(last()) + next(); + m_bEOF = sal_True; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException) +{ + { + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + } + dispose(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_FIRST,0); + OTools::ThrowException(m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); + sal_Bool bRet; + if(bRet = (m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO)) + m_nRowPos = 1; + return bRet; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_LAST,0); + OTools::ThrowException(m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); + // here I know definitely that I stand on the last record + return m_bLastRecord = (m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_ABSOLUTE,row); + OTools::ThrowException(m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); + sal_Bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO; + if(bRet) + m_nRowPos = row; + return bRet; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,row); + OTools::ThrowException(m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); + sal_Bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO; + if(bRet) + m_nRowPos += row; + return bRet; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_PRIOR,0); + OTools::ThrowException(m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); + sal_Bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO; + if(bRet) + --m_nRowPos; + return bRet; +} +// ------------------------------------------------------------------------- +Reference< XInterface > SAL_CALL OResultSet::getStatement( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_aStatement.get(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::rowDeleted( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_pRowStatusArray[0] == SQL_ROW_DELETED; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::rowInserted( ) throw(SQLException, RuntimeException) +{ ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_pRowStatusArray[0] == SQL_ROW_ADDED; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::rowUpdated( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_pRowStatusArray[0] == SQL_ROW_UPDATED; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return m_nRowPos == 0; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + // m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_NEXT,0); + m_nCurrentFetchState = N3SQLFetch(m_aStatementHandle); + OTools::ThrowException(m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); + return m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSet::wasNull( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(!m_bFetchData) + return !m_aRow[m_nLastColumnPos].hasValue(); + + return m_bWasNull; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::cancel( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + OTools::ThrowException(N3SQLCancel(m_aStatementHandle),m_aStatementHandle,SQL_HANDLE_STMT,*this); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::clearWarnings( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- +Any SAL_CALL OResultSet::getWarnings( ) throw(SQLException, RuntimeException) +{ + return Any(); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + SQLRETURN nRet; + if(pODBC3SQLBulkOperations) + nRet = N3SQLBulkOperations(m_aStatementHandle, SQL_ADD); + else + { + if(isBeforeFirst()) + next(); // must be done + nRet = N3SQLSetPos(m_aStatementHandle,1,SQL_ADD,SQL_LOCK_NO_CHANGE); + } + OTools::ThrowException(nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this); + nRet = N3SQLFreeStmt(m_aStatementHandle,SQL_UNBIND); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateRow( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + SQLRETURN nRet; + nRet = N3SQLSetPos(m_aStatementHandle,1,SQL_UPDATE,SQL_LOCK_NO_CHANGE); + if( nRet == SQL_NEED_DATA) + { + void * pData = NULL; + nRet = N3SQLParamData(m_aStatementHandle,&pData); + do + { + if (nRet != SQL_SUCCESS && nRet != SQL_SUCCESS_WITH_INFO && nRet != SQL_NEED_DATA) + break; + + ::std::vector<void*>::const_iterator aFound = ::std::find(m_aBindVector.begin(),m_aBindVector.end(),pData); + sal_Int32 nPos = m_aBindVector.size() - (m_aBindVector.end() - aFound); + + // TODO transfer long data + // N3SQLPutData(m_aStatementHandle,,); + nRet = N3SQLParamData(m_aStatementHandle,&pData); + } + while (nRet == SQL_NEED_DATA); + + } + OTools::ThrowException(nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this); + // now unbind all columns so we can fetch all columns again with SQLGetData + nRet = N3SQLFreeStmt(m_aStatementHandle,SQL_UNBIND); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::deleteRow( ) throw(SQLException, RuntimeException) +{ + SQLRETURN nRet = N3SQLSetPos(m_aStatementHandle,1,SQL_DELETE,SQL_LOCK_NO_CHANGE); + OTools::ThrowException(nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::cancelRowUpdates( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::moveToInsertRow( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + // first unbound all columns + N3SQLFreeStmt(m_aStatementHandle,SQL_UNBIND); + // SQLRETURN nRet = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE ,(SQLPOINTER)1,SQL_IS_INTEGER); + m_bInserting = sal_True; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::moveToCurrentRow( ) throw(SQLException, RuntimeException) +{ +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); + bindValue(m_aStatementHandle,columnIndex,SQL_CHAR,0,0,(sal_Int8*)NULL,NULL,&m_aLengthVector[columnIndex],**this); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); + void* pData = m_aBindVector[columnIndex]; + bindValue<sal_Bool>(m_aStatementHandle,columnIndex,SQL_BIT,0,0,&x,pData,&m_aLengthVector[columnIndex],**this); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); + void* pData = m_aBindVector[columnIndex]; + bindValue(m_aStatementHandle,columnIndex,SQL_CHAR,0,0,&x,pData,&m_aLengthVector[columnIndex],**this); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); + void* pData = m_aBindVector[columnIndex]; + bindValue(m_aStatementHandle,columnIndex,SQL_TINYINT,0,0,&x,pData,&m_aLengthVector[columnIndex],**this); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); + void* pData = m_aBindVector[columnIndex]; + bindValue(m_aStatementHandle,columnIndex,SQL_INTEGER,0,0,&x,pData,&m_aLengthVector[columnIndex],**this); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); + throw RuntimeException(); +} +// ----------------------------------------------------------------------- +void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); + void* pData = m_aBindVector[columnIndex]; + bindValue(m_aStatementHandle,columnIndex,SQL_REAL,0,0,&x,pData,&m_aLengthVector[columnIndex],**this); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); + void* pData = m_aBindVector[columnIndex]; + bindValue(m_aStatementHandle,columnIndex,SQL_DOUBLE,0,0,&x,pData,&m_aLengthVector[columnIndex],**this); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); + void* pData = m_aBindVector[columnIndex]; + bindValue(m_aStatementHandle,columnIndex,SQL_VARCHAR,0,0,&x,pData,&m_aLengthVector[columnIndex],**this); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); + void* pData = m_aBindVector[columnIndex]; + bindValue(m_aStatementHandle,columnIndex,SQL_BINARY,0,0,&x,pData,&m_aLengthVector[columnIndex],**this); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const Date& x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); + void* pData = m_aBindVector[columnIndex]; + DATE_STRUCT aVal = OTools::DateToOdbcDate(x); + bindValue(m_aStatementHandle,columnIndex,SQL_DATE,0,0,&aVal,pData,&m_aLengthVector[columnIndex],**this); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const Time& x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); + void* pData = m_aBindVector[columnIndex]; + TIME_STRUCT aVal = OTools::TimeToOdbcTime(x); + bindValue(m_aStatementHandle,columnIndex,SQL_TIME,0,0,&aVal,pData,&m_aLengthVector[columnIndex],**this); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const DateTime& x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); + void* pData = m_aBindVector[columnIndex]; + TIMESTAMP_STRUCT aVal = OTools::DateTimeToTimestamp(x); + bindValue(m_aStatementHandle,columnIndex,SQL_TIMESTAMP,0,0,&aVal,pData,&m_aLengthVector[columnIndex],**this); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + SQLRETURN nRet = N3SQLSetPos(m_aStatementHandle,1,SQL_REFRESH,SQL_LOCK_NO_CHANGE); + // m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,0); + OTools::ThrowException(nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this); +} +// ------------------------------------------------------------------------- +void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); +// switch(x.getValueTypeClass()) +// { +// case TypeClass_VOID: +// args[0].l = NULL; +// break; +// +// case TypeClass_BOOLEAN: +// { +// sal_Bool f; +// x >>= f; +// updateBoolean(columnIndex,f); +// } +// break; +// case TypeClass_BYTE: +// { +// sal_Int8 f; +// x >>= f; +// updateByte(columnIndex,f); +// } +// break; +// case TypeClass_SHORT: +// case TypeClass_UNSIGNED_SHORT: +// { +// sal_Int16 f; +// x >>= f; +// updateShort(columnIndex,f); +// } +// break; +// case TypeClass_LONG: +// case TypeClass_UNSIGNED_LONG: +// { +// sal_Int32 f; +// x >>= f; +// updateInt(columnIndex,f); +// } +// break; +// case TypeClass_HYPER: +// case TypeClass_UNSIGNED_HYPER: +// { +// sal_Int64 f; +// x >>= f; +// updateLong(columnIndex,f); +// } +// break; +// case TypeClass_FLOAT: +// { +// float f; +// x >>= f; +// updateFloat(columnIndex,f); +// } +// break; +// case TypeClass_DOUBLE: +// updateDouble(columnIndex,::utl::getDouble(x)); +// break; +// case TypeClass_CHAR: +// case TypeClass_STRING: +// updateString(columnIndex,::utl::getString(x)); +// break; +// case TypeClass_ENUM: +// default: +// OSL_ENSHURE(0,"UNKOWN TYPE for OResultSet::updateObject"); +// } +// return; +// // Parameter konvertieren +// // temporaere Variable initialisieren +// char * cSignature = "(ILjava/lang/Object;)V"; +// char * cMethodName = "updateObject"; +// // Java-Call absetzen +// } +} +// ------------------------------------------------------------------------- + +void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 scale ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + columnIndex = mapColumn(columnIndex); + OSL_ENSHURE(0,"OResultSet::updateNumericObject: NYI"); +// SDBThreadAttach t; +// if( t.pEnv ) +// { +// jvalue args[1]; +// // Parameter konvertieren +// args[0].l = +// // temporaere Variable initialisieren +// char * cSignature = "(I;Ljava/lang/Object;I)V"; +// char * cMethodName = "updateObject"; +// // Java-Call absetzen +// jmethodID mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature ); +// if( mID ){ +// t.pEnv->CallVoidMethod( object, mID,columnIndex,args[0].l,scale); + // ThrowSQLException(t.pEnv,*this); +// t.pEnv->DeleteLocalRef((jobject)args[0].l); +// } +// } +} +// ------------------------------------------------------------------------- +// XRowLocate +Any SAL_CALL OResultSet::getBookmark( ) throw( SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + sal_uInt32 nValue = SQL_UB_OFF; + N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_USE_BOOKMARKS,&nValue,SQL_IS_UINTEGER,NULL); + if(nValue == SQL_UB_OFF) + throw SQLException(); + + + return makeAny(OTools::getBytesValue(m_aStatementHandle,0,SQL_BINARY,m_bWasNull,**this)); +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::moveToBookmark( const Any& bookmark ) throw( SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + Sequence<sal_Int8> aBookmark; + bookmark >>= aBookmark; + SQLRETURN nReturn = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_FETCH_BOOKMARK_PTR,aBookmark.getArray(),SQL_IS_POINTER); + + m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_BOOKMARK,0); + OTools::ThrowException(m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); + return m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw( SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + Sequence<sal_Int8> aBookmark; + bookmark >>= aBookmark; + SQLRETURN nReturn = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_FETCH_BOOKMARK_PTR,aBookmark.getArray(),SQL_IS_POINTER); + + m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_BOOKMARK,rows); + OTools::ThrowException(m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); + return m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OResultSet::compareBookmarks( const Any& first, const Any& second ) throw( SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return (first == second) ? CompareBookmark::EQUAL : CompareBookmark::NOT_EQUAL; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSet::hasOrderedBookmarks( ) throw( SQLException, RuntimeException) +{ + return sal_False; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OResultSet::hashBookmark( const Any& bookmark ) throw( SQLException, RuntimeException) +{ + throw SQLException(); +} +// ------------------------------------------------------------------------- +// XDeleteRows +Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >& rows ) throw( SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OResultSet_BASE::rBHelper.bDisposed) + throw DisposedException(); + + SQLRETURN nReturn; + + const Any* pBegin = rows.getConstArray(); + const Any* pEnd = pBegin + rows.getLength(); + + typedef sal_Int8* sal_INT8; + sal_Int8** pArray = new sal_INT8[rows.getLength()]; + for(sal_Int32 i=0;pBegin != pEnd;++i,++pBegin) + { + pArray[i] = ((Sequence<sal_Int8>*)pBegin->getValue())->getArray(); + } + + sal_Int32* pStatusArray = new sal_Int32[rows.getLength()]; + + + nReturn = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_STATUS_PTR ,(SQLPOINTER)pStatusArray,SQL_IS_POINTER); + nReturn = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE ,(SQLPOINTER)rows.getLength(),SQL_IS_INTEGER); + sal_Int32 nLen = rows.getLength(); + nReturn = N3SQLBindCol(m_aStatementHandle,0,SQL_C_VARBOOKMARK,pArray,rows.getLength(),&nLen); + nReturn = N3SQLBulkOperations(m_aStatementHandle,SQL_DELETE_BY_BOOKMARK); + + delete [] pArray; + + Sequence< sal_Int32 > aRet(rows.getLength()); + for(sal_Int32 j=0;j<rows.getLength();++j) + { + aRet.getArray()[j] = pStatusArray[j] == SQL_ROW_SUCCESS; + } + delete pStatusArray; + delete pArray; + return aRet; +} +//------------------------------------------------------------------------------ +sal_Int32 OResultSet::getResultSetConcurrency() const throw( SQLException, RuntimeException) +{ + sal_uInt32 nValue; + N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_CONCURRENCY,&nValue,SQL_IS_UINTEGER,0); + return nValue; +} +//------------------------------------------------------------------------------ +sal_Int32 OResultSet::getResultSetType() const throw( SQLException, RuntimeException) +{ + sal_uInt32 nValue; + N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_SENSITIVITY,&nValue,SQL_IS_UINTEGER,0); + return nValue; +} +//------------------------------------------------------------------------------ +sal_Int32 OResultSet::getFetchDirection() const throw( SQLException, RuntimeException) +{ + sal_uInt32 nValue; + N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_TYPE,&nValue,SQL_IS_UINTEGER,0); + return nValue; +} +//------------------------------------------------------------------------------ +sal_Int32 OResultSet::getFetchSize() const throw( SQLException, RuntimeException) +{ + sal_uInt32 nValue; + N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE,&nValue,SQL_IS_UINTEGER,0); + return nValue; +} +//------------------------------------------------------------------------------ +::rtl::OUString OResultSet::getCursorName() const throw( SQLException, RuntimeException) +{ + SQLCHAR pName[258]; + SQLSMALLINT nRealLen = 0; + N3SQLGetCursorName(m_aStatementHandle,(SQLCHAR*)pName,256,&nRealLen); + return ::rtl::OUString::createFromAscii((const char*)pName); +} +// ------------------------------------------------------------------------- +sal_Bool OResultSet::isBookmarkable() const throw( SQLException, RuntimeException) +{ + if(!m_aConnectionHandle) + return sal_False; + + sal_uInt32 nValue; + N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_TYPE,&nValue,SQL_IS_UINTEGER,0); + + sal_Int32 nAttr = 0; + switch(nValue) + { + case SQL_CURSOR_FORWARD_ONLY: + return sal_False; + break; + case SQL_CURSOR_STATIC: + OTools::GetInfo(m_aConnectionHandle,SQL_STATIC_CURSOR_ATTRIBUTES1,nAttr,*(Reference< XInterface >*)this); + break; + case SQL_CURSOR_KEYSET_DRIVEN: + OTools::GetInfo(m_aConnectionHandle,SQL_KEYSET_CURSOR_ATTRIBUTES1,nAttr,*(Reference< XInterface >*)this); + break; + case SQL_CURSOR_DYNAMIC: + OTools::GetInfo(m_aConnectionHandle,SQL_DYNAMIC_CURSOR_ATTRIBUTES1,nAttr,*(Reference< XInterface >*)this); + break; + } + sal_uInt32 nUseBookmark = SQL_UB_OFF; + N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_USE_BOOKMARKS,&nUseBookmark,SQL_IS_UINTEGER,NULL); + + return (nUseBookmark != SQL_UB_OFF) && (nAttr & SQL_CA1_BOOKMARK) == SQL_CA1_BOOKMARK; +} +//------------------------------------------------------------------------------ +void OResultSet::setFetchDirection(sal_Int32 _par0) throw( SQLException, RuntimeException) +{ + N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_TYPE,(SQLPOINTER)_par0,SQL_IS_UINTEGER); +} +//------------------------------------------------------------------------------ +void OResultSet::setFetchSize(sal_Int32 _par0) throw( SQLException, RuntimeException) +{ + N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)_par0,SQL_IS_UINTEGER); + delete m_pRowStatusArray; + m_pRowStatusArray = new SQLUSMALLINT[_par0]; + N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_STATUS_PTR,m_pRowStatusArray,SQL_IS_POINTER); +} +// ------------------------------------------------------------------------- +IPropertyArrayHelper* OResultSet::createArrayHelper( ) const +{ + Sequence< Property > aProps(6); + Property* pProperties = aProps.getArray(); + sal_Int32 nPos = 0; + DECL_PROP1IMPL(CURSORNAME, ::rtl::OUString) PropertyAttribute::READONLY); + DECL_PROP0(FETCHDIRECTION, sal_Int32); + DECL_PROP0(FETCHSIZE, sal_Int32); + DECL_BOOL_PROP1IMPL(ISBOOKMARKABLE) PropertyAttribute::READONLY); + DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY); + DECL_PROP1IMPL(RESULTSETTYPE, sal_Int32) PropertyAttribute::READONLY); + + return new OPropertyArrayHelper(aProps); +} +// ------------------------------------------------------------------------- +IPropertyArrayHelper & OResultSet::getInfoHelper() +{ + return *const_cast<OResultSet*>(this)->getArrayHelper(); +} +// ------------------------------------------------------------------------- +sal_Bool OResultSet::convertFastPropertyValue( + Any & rConvertedValue, + Any & rOldValue, + sal_Int32 nHandle, + const Any& rValue ) + throw (::com::sun::star::lang::IllegalArgumentException) +{ + switch(nHandle) + { + case PROPERTY_ID_ISBOOKMARKABLE: + case PROPERTY_ID_CURSORNAME: + case PROPERTY_ID_RESULTSETCONCURRENCY: + case PROPERTY_ID_RESULTSETTYPE: + throw ::com::sun::star::lang::IllegalArgumentException(); + break; + case PROPERTY_ID_FETCHDIRECTION: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection()); + case PROPERTY_ID_FETCHSIZE: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize()); + default: + ; + } + return sal_False; +} +// ------------------------------------------------------------------------- +void OResultSet::setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const Any& rValue + ) + throw (Exception) +{ + switch(nHandle) + { + case PROPERTY_ID_ISBOOKMARKABLE: + case PROPERTY_ID_CURSORNAME: + case PROPERTY_ID_RESULTSETCONCURRENCY: + case PROPERTY_ID_RESULTSETTYPE: + throw Exception(); + break; + case PROPERTY_ID_FETCHDIRECTION: + setFetchDirection(getINT32(rValue)); + break; + case PROPERTY_ID_FETCHSIZE: + setFetchSize(getINT32(rValue)); + break; + default: + ; + } +} +// ------------------------------------------------------------------------- +void OResultSet::getFastPropertyValue( + Any& rValue, + sal_Int32 nHandle + ) const +{ + switch(nHandle) + { + case PROPERTY_ID_ISBOOKMARKABLE: + rValue = bool2any(isBookmarkable()); + break; + case PROPERTY_ID_CURSORNAME: + rValue <<= getCursorName(); + break; + case PROPERTY_ID_RESULTSETCONCURRENCY: + rValue <<= getResultSetConcurrency(); + break; + case PROPERTY_ID_RESULTSETTYPE: + rValue <<= getResultSetType(); + break; + case PROPERTY_ID_FETCHDIRECTION: + rValue <<= getFetchDirection(); + break; + case PROPERTY_ID_FETCHSIZE: + rValue <<= getFetchSize(); + break; + } +} +// ------------------------------------------------------------------------- +void OResultSet::openTypeInfo() throw(SQLException, RuntimeException) +{ + m_bFreeHandle = sal_True; + OTools::ThrowException(N3SQLGetTypeInfo(m_aStatementHandle, SQL_ALL_TYPES),m_aStatementHandle,SQL_HANDLE_STMT,*this); +} +//----------------------------------------------------------------------------- +void OResultSet::openTables(const Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& tableNamePattern, + const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException) +{ + m_bFreeHandle = sal_True; + ::rtl::OString aPKQ,aPKO,aPKN,aCOL; + const ::rtl::OUString *pSchemaPat = NULL; + + if(schemaPattern.toChar() != '%') + pSchemaPat = &schemaPattern; + else + pSchemaPat = NULL; + + const char *pPKQ = catalog.hasValue() ? (aPKQ = ::rtl::OUStringToOString(connectivity::getString(catalog), + osl_getThreadTextEncoding() + )).getStr() : NULL, + *pPKO = pSchemaPat ? (aPKO = ::rtl::OUStringToOString(schemaPattern, + osl_getThreadTextEncoding() + )).getStr() : NULL, + *pPKN = aPKN = ::rtl::OUStringToOString(tableNamePattern, + osl_getThreadTextEncoding() + ).getStr(); + + + const char *pCOL = NULL; + const ::rtl::OUString* pBegin = types.getConstArray(); + const ::rtl::OUString* pEnd = pBegin + types.getLength(); + for(;pBegin != pEnd;++pBegin) + { + aCOL += ::rtl::OUStringToOString(*pBegin, + osl_getThreadTextEncoding() + ); + aCOL += ","; + } + if(aCOL.getLength()) + pCOL = aCOL.getStr(); + + SQLRETURN nRetcode = N3SQLTables(m_aStatementHandle, + (SDB_ODBC_CHAR *) pPKQ, catalog.hasValue() ? SQL_NTS : 0, + (SDB_ODBC_CHAR *) pPKO, SQL_NTS , + (SDB_ODBC_CHAR *) pPKN, SQL_NTS, + (SDB_ODBC_CHAR *) pCOL, pCOL ? SQL_NTS : 0); + OTools::ThrowException(nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); + +} +//----------------------------------------------------------------------------- +void OResultSet::openTablesTypes( ) throw(SQLException, RuntimeException) +{ + m_bFreeHandle = sal_True; + SQLRETURN nRetcode = N3SQLTables(m_aStatementHandle, + 0,0, + 0,0, + 0,0, + (SDB_ODBC_CHAR *) SQL_ALL_TABLE_TYPES,SQL_NTS); + OTools::ThrowException(nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); + + m_aColMapping.clear(); + m_aColMapping.push_back(-1); + m_aColMapping.push_back(4); + m_xMetaData = new OResultSetMetaData(m_aStatementHandle,m_aColMapping); +} +// ------------------------------------------------------------------------- +void OResultSet::openCatalogs() throw(SQLException, RuntimeException) +{ + m_bFreeHandle = sal_True; + SQLRETURN nRetcode = N3SQLTables(m_aStatementHandle, + (SDB_ODBC_CHAR *) SQL_ALL_CATALOGS,SQL_NTS, + 0,0, + 0,0, + (SDB_ODBC_CHAR *) "",SQL_NTS); + + OTools::ThrowException(nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); + + m_aColMapping.clear(); + m_aColMapping.push_back(-1); + m_aColMapping.push_back(1); + m_xMetaData = new OResultSetMetaData(m_aStatementHandle,m_aColMapping); +} +// ------------------------------------------------------------------------- +void OResultSet::openSchemas() throw(SQLException, RuntimeException) +{ + m_bFreeHandle = sal_True; + SQLRETURN nRetcode = N3SQLTables(m_aStatementHandle, + 0,0, + (SDB_ODBC_CHAR *) SQL_ALL_SCHEMAS,SQL_NTS, + 0,0, + (SDB_ODBC_CHAR *) "",SQL_NTS); + OTools::ThrowException(nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); + + m_aColMapping.clear(); + m_aColMapping.push_back(-1); + m_aColMapping.push_back(2); + m_xMetaData = new OResultSetMetaData(m_aStatementHandle,m_aColMapping); +} +// ------------------------------------------------------------------------- +void OResultSet::openColumnPrivileges( const Any& catalog, const ::rtl::OUString& schema, + const ::rtl::OUString& table, const ::rtl::OUString& columnNamePattern ) + throw(SQLException, RuntimeException) +{ + const ::rtl::OUString *pSchemaPat = NULL; + + if(schema.toChar() != '%') + pSchemaPat = &schema; + else + pSchemaPat = NULL; + + m_bFreeHandle = sal_True; + ::rtl::OString aPKQ,aPKO,aPKN,aCOL; + + const char *pPKQ = catalog.hasValue() ? (aPKQ = ::rtl::OUStringToOString(connectivity::getString(catalog), + osl_getThreadTextEncoding() + )).getStr() : NULL, + *pPKO = pSchemaPat ? (aPKO = ::rtl::OUStringToOString(schema, + osl_getThreadTextEncoding() + )).getStr() : NULL, + *pPKN = aPKN = ::rtl::OUStringToOString(table, + osl_getThreadTextEncoding() + ).getStr(), + *pCOL = aCOL = ::rtl::OUStringToOString(columnNamePattern, + osl_getThreadTextEncoding() + ).getStr(); + + + SQLRETURN nRetcode = N3SQLColumnPrivileges(m_aStatementHandle, + (SDB_ODBC_CHAR *) pPKQ, catalog.hasValue() ? SQL_NTS : 0, + (SDB_ODBC_CHAR *) pPKO, SQL_NTS , + (SDB_ODBC_CHAR *) pPKN, SQL_NTS, + (SDB_ODBC_CHAR *) pCOL, SQL_NTS); + OTools::ThrowException(nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); + + +} +// ------------------------------------------------------------------------- +void OResultSet::openColumns( const Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) + throw(SQLException, RuntimeException) +{ + const ::rtl::OUString *pSchemaPat = NULL; + + if(schemaPattern.toChar() != '%') + pSchemaPat = &schemaPattern; + else + pSchemaPat = NULL; + + m_bFreeHandle = sal_True; + ::rtl::OString aPKQ,aPKO,aPKN,aCOL; + + const char *pPKQ = catalog.hasValue() ? (aPKQ = ::rtl::OUStringToOString(connectivity::getString(catalog), + osl_getThreadTextEncoding() + )).getStr() : NULL, + *pPKO = pSchemaPat ? (aPKO = ::rtl::OUStringToOString(schemaPattern, + osl_getThreadTextEncoding() + )).getStr() : NULL, + *pPKN = aPKN = ::rtl::OUStringToOString(tableNamePattern, + osl_getThreadTextEncoding() + ).getStr(), + *pCOL = aCOL = ::rtl::OUStringToOString(columnNamePattern, + osl_getThreadTextEncoding() + ).getStr(); + + + SQLRETURN nRetcode = N3SQLColumns(m_aStatementHandle, + (SDB_ODBC_CHAR *) pPKQ, catalog.hasValue() ? SQL_NTS : 0, + (SDB_ODBC_CHAR *) pPKO, SQL_NTS , + (SDB_ODBC_CHAR *) pPKN, SQL_NTS, + (SDB_ODBC_CHAR *) pCOL, SQL_NTS); + + OTools::ThrowException(nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); +} +// ------------------------------------------------------------------------- +void OResultSet::openProcedureColumns( const Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& procedureNamePattern,const ::rtl::OUString& columnNamePattern ) + throw(SQLException, RuntimeException) +{ + const ::rtl::OUString *pSchemaPat = NULL; + + if(schemaPattern.toChar() != '%') + pSchemaPat = &schemaPattern; + else + pSchemaPat = NULL; + + m_bFreeHandle = sal_True; + ::rtl::OString aPKQ,aPKO,aPKN,aCOL; + + const char *pPKQ = catalog.hasValue() ? (aPKQ = ::rtl::OUStringToOString(connectivity::getString(catalog), + osl_getThreadTextEncoding() + )).getStr() : NULL, + *pPKO = pSchemaPat ? (aPKO = ::rtl::OUStringToOString(schemaPattern, + osl_getThreadTextEncoding() + )).getStr() : NULL, + *pPKN = aPKN = ::rtl::OUStringToOString(procedureNamePattern, + osl_getThreadTextEncoding() + ).getStr(), + *pCOL = aCOL = ::rtl::OUStringToOString(columnNamePattern, + osl_getThreadTextEncoding() + ).getStr(); + + + SQLRETURN nRetcode = N3SQLProcedureColumns(m_aStatementHandle, + (SDB_ODBC_CHAR *) pPKQ, catalog.hasValue() ? SQL_NTS : 0, + (SDB_ODBC_CHAR *) pPKO, SQL_NTS , + (SDB_ODBC_CHAR *) pPKN, SQL_NTS, + (SDB_ODBC_CHAR *) pCOL, SQL_NTS); + + OTools::ThrowException(nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); +} +// ------------------------------------------------------------------------- +void OResultSet::openProcedures(const Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& procedureNamePattern) + throw(SQLException, RuntimeException) +{ + const ::rtl::OUString *pSchemaPat = NULL; + + if(schemaPattern.toChar() != '%') + pSchemaPat = &schemaPattern; + else + pSchemaPat = NULL; + + m_bFreeHandle = sal_True; + ::rtl::OString aPKQ,aPKO,aPKN,aCOL; + + const char *pPKQ = catalog.hasValue() ? (aPKQ = ::rtl::OUStringToOString(connectivity::getString(catalog), + osl_getThreadTextEncoding() + )).getStr() : NULL, + *pPKO = pSchemaPat ? (aPKO = ::rtl::OUStringToOString(schemaPattern, + osl_getThreadTextEncoding() + )).getStr() : NULL, + *pPKN = aPKN = ::rtl::OUStringToOString(procedureNamePattern, + osl_getThreadTextEncoding() + ).getStr(); + + + SQLRETURN nRetcode = N3SQLProcedures(m_aStatementHandle, + (SDB_ODBC_CHAR *) pPKQ, catalog.hasValue() ? SQL_NTS : 0, + (SDB_ODBC_CHAR *) pPKO, SQL_NTS , + (SDB_ODBC_CHAR *) pPKN, SQL_NTS); + OTools::ThrowException(nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); +} +// ------------------------------------------------------------------------- +void OResultSet::openSpecialColumns(sal_Bool _bRowVer,const Any& catalog, const ::rtl::OUString& schema, + const ::rtl::OUString& table,sal_Int32 scope, sal_Bool nullable ) + throw(SQLException, RuntimeException) +{ + const ::rtl::OUString *pSchemaPat = NULL; + + if(schema.toChar() != '%') + pSchemaPat = &schema; + else + pSchemaPat = NULL; + + m_bFreeHandle = sal_True; + ::rtl::OString aPKQ,aPKO,aPKN,aCOL; + + const char *pPKQ = catalog.hasValue() ? (aPKQ = ::rtl::OUStringToOString(connectivity::getString(catalog), + osl_getThreadTextEncoding() + )).getStr() : NULL, + *pPKO = pSchemaPat ? (aPKO = ::rtl::OUStringToOString(schema, + osl_getThreadTextEncoding() + )).getStr() : NULL, + *pPKN = aPKN = ::rtl::OUStringToOString(table, + osl_getThreadTextEncoding() + ).getStr(); + + + SQLRETURN nRetcode = N3SQLSpecialColumns(m_aStatementHandle,_bRowVer ? SQL_ROWVER : SQL_BEST_ROWID, + (SDB_ODBC_CHAR *) pPKQ, catalog.hasValue() ? SQL_NTS : 0, + (SDB_ODBC_CHAR *) pPKO, SQL_NTS , + (SDB_ODBC_CHAR *) pPKN, SQL_NTS, + scope, + nullable ? SQL_NULLABLE : SQL_NO_NULLS); + OTools::ThrowException(nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); +} +// ------------------------------------------------------------------------- +void OResultSet::openVersionColumns(const Any& catalog, const ::rtl::OUString& schema, + const ::rtl::OUString& table) throw(SQLException, RuntimeException) +{ + openSpecialColumns(sal_True,catalog,schema,table,SQL_SCOPE_TRANSACTION,sal_False); +} +// ------------------------------------------------------------------------- +void OResultSet::openBestRowIdentifier( const Any& catalog, const ::rtl::OUString& schema, + const ::rtl::OUString& table,sal_Int32 scope,sal_Bool nullable ) throw(SQLException, RuntimeException) +{ + openSpecialColumns(sal_False,catalog,schema,table,scope,nullable); +} +// ------------------------------------------------------------------------- +void OResultSet::openForeignKeys( const Any& catalog, const ::rtl::OUString* schema, + const ::rtl::OUString* table, + const Any& catalog2, const ::rtl::OUString* schema2, + const ::rtl::OUString* table2) throw(SQLException, RuntimeException) +{ + m_bFreeHandle = sal_True; + + ::rtl::OString aPKQ,aPKO,aPKN, aFKQ, aFKO, aFKN; + + const char *pPKQ = catalog.hasValue() ? (aPKQ = ::rtl::OUStringToOString(connectivity::getString(catalog), + osl_getThreadTextEncoding() + )).getStr() : NULL, + *pPKO = schema ? (aPKO = ::rtl::OUStringToOString(*schema, + osl_getThreadTextEncoding() + )).getStr() : NULL, + *pPKN = table ? (aPKN = ::rtl::OUStringToOString(*table, + osl_getThreadTextEncoding() + )).getStr(): NULL, + *pFKQ = catalog2.hasValue() ? (aFKQ = ::rtl::OUStringToOString(connectivity::getString(catalog), + osl_getThreadTextEncoding() + )).getStr() : NULL, + *pFKO = schema2 ? (aFKO = ::rtl::OUStringToOString(*schema2, + osl_getThreadTextEncoding() + )).getStr() : NULL, + *pFKN = table2 ? (aFKN = ::rtl::OUStringToOString(*table2, + osl_getThreadTextEncoding() + )).getStr() : NULL; + + + SQLRETURN nRetcode = N3SQLForeignKeys(m_aStatementHandle, + (SDB_ODBC_CHAR *) pPKQ, catalog.hasValue() ? SQL_NTS : 0, + (SDB_ODBC_CHAR *) pPKO, SQL_NTS , + (SDB_ODBC_CHAR *) pPKN, pPKN ? SQL_NTS : 0, + (SDB_ODBC_CHAR *) pFKQ, catalog2.hasValue() ? SQL_NTS : 0, + (SDB_ODBC_CHAR *) pFKO, SQL_NTS , + (SDB_ODBC_CHAR *) pFKN, SQL_NTS + ); + OTools::ThrowException(nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); +} +// ------------------------------------------------------------------------- +void OResultSet::openImportedKeys(const Any& catalog, const ::rtl::OUString& schema, + const ::rtl::OUString& table) throw(SQLException, RuntimeException) +{ + openForeignKeys(catalog,!schema.compareToAscii("%") ? &schema : NULL,&table,Any(),NULL,NULL); +} +// ------------------------------------------------------------------------- +void OResultSet::openExportedKeys(const Any& catalog, const ::rtl::OUString& schema, + const ::rtl::OUString& table) throw(SQLException, RuntimeException) +{ + openForeignKeys(Any(),NULL,NULL,catalog,!schema.compareToAscii("%") ? &schema : NULL,&table); +} +// ------------------------------------------------------------------------- +void OResultSet::openPrimaryKeys(const Any& catalog, const ::rtl::OUString& schema, + const ::rtl::OUString& table) throw(SQLException, RuntimeException) +{ + const ::rtl::OUString *pSchemaPat = NULL; + + if(schema.toChar() != '%') + pSchemaPat = &schema; + else + pSchemaPat = NULL; + + m_bFreeHandle = sal_True; + ::rtl::OString aPKQ,aPKO,aPKN,aCOL; + + const char *pPKQ = catalog.hasValue() ? (aPKQ = ::rtl::OUStringToOString(connectivity::getString(catalog), + osl_getThreadTextEncoding() + )).getStr() : NULL, + *pPKO = pSchemaPat ? (aPKO = ::rtl::OUStringToOString(schema, + osl_getThreadTextEncoding() + )).getStr() : NULL, + *pPKN = (aPKN = ::rtl::OUStringToOString(table, + osl_getThreadTextEncoding() + )).getStr(); + + + SQLRETURN nRetcode = N3SQLPrimaryKeys(m_aStatementHandle, + (SDB_ODBC_CHAR *) pPKQ, catalog.hasValue() ? SQL_NTS : 0, + (SDB_ODBC_CHAR *) pPKO, SQL_NTS , + (SDB_ODBC_CHAR *) pPKN, SQL_NTS); + OTools::ThrowException(nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); +} +// ------------------------------------------------------------------------- +void OResultSet::openTablePrivileges(const Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& tableNamePattern) throw(SQLException, RuntimeException) +{ + const ::rtl::OUString *pSchemaPat = NULL; + + if(schemaPattern.toChar() != '%') + pSchemaPat = &schemaPattern; + else + pSchemaPat = NULL; + + m_bFreeHandle = sal_True; + ::rtl::OString aPKQ,aPKO,aPKN; + + const char *pPKQ = catalog.hasValue() ? (aPKQ = ::rtl::OUStringToOString(connectivity::getString(catalog), + osl_getThreadTextEncoding() + )).getStr() : NULL, + *pPKO = pSchemaPat ? (aPKO = ::rtl::OUStringToOString(schemaPattern, + osl_getThreadTextEncoding() + )).getStr() : NULL, + *pPKN = (aPKN = ::rtl::OUStringToOString(tableNamePattern, + osl_getThreadTextEncoding() + )).getStr(); + + + SQLRETURN nRetcode = N3SQLTablePrivileges(m_aStatementHandle, + (SDB_ODBC_CHAR *) pPKQ, catalog.hasValue() ? SQL_NTS : 0, + (SDB_ODBC_CHAR *) pPKO, SQL_NTS , + (SDB_ODBC_CHAR *) pPKN, SQL_NTS); + OTools::ThrowException(nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); +} +// ------------------------------------------------------------------------- +void OResultSet::openIndexInfo( const Any& catalog, const ::rtl::OUString& schema, + const ::rtl::OUString& table,sal_Bool unique,sal_Bool approximate ) + throw(SQLException, RuntimeException) +{ + const ::rtl::OUString *pSchemaPat = NULL; + + if(schema.toChar() != '%') + pSchemaPat = &schema; + else + pSchemaPat = NULL; + + m_bFreeHandle = sal_True; + ::rtl::OString aPKQ,aPKO,aPKN; + + const char *pPKQ = catalog.hasValue() ? (aPKQ = ::rtl::OUStringToOString(connectivity::getString(catalog), + osl_getThreadTextEncoding() + )).getStr() : NULL, + *pPKO = pSchemaPat ? (aPKO = ::rtl::OUStringToOString(schema, + osl_getThreadTextEncoding() + )).getStr() : NULL, + *pPKN = (aPKN = ::rtl::OUStringToOString(table, + osl_getThreadTextEncoding() + )).getStr(); + + + SQLRETURN nRetcode = N3SQLStatistics(m_aStatementHandle, + (SDB_ODBC_CHAR *) pPKQ, catalog.hasValue() ? SQL_NTS : 0, + (SDB_ODBC_CHAR *) pPKO, SQL_NTS , + (SDB_ODBC_CHAR *) pPKN, SQL_NTS, + unique, + approximate); + OTools::ThrowException(nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); +} +// ------------------------------------------------------------------------- +void OResultSet::fillRow(sal_Int32 _nToColumn) +{ + m_bFetchData = sal_True; + Reference< XResultSetMetaData > xMeta = getMetaData(); + for(sal_Int32 i=m_nLastColumnPos+1;i <= _nToColumn; ++i) + { + switch (xMeta->getColumnType(i)) + { + case DataType::CHAR: + case DataType::VARCHAR: + m_aRow[i] <<= getString(i); + break; + case DataType::DECIMAL: + case DataType::NUMERIC: + case DataType::BIGINT: + m_aRow[i] <<= getString(i); + break; + case DataType::DOUBLE: + m_aRow[i] <<= getDouble(i); + break; + case DataType::LONGVARCHAR: + m_aRow[i] <<= getString(i); + break; + case DataType::LONGVARBINARY: + m_aRow[i] <<= getBytes(i); + break; + case DataType::DATE: + m_aRow[i] <<= getDate(i); + break; + case DataType::TIME: + m_aRow[i] <<= getTime(i); + break; + case DataType::TIMESTAMP: + m_aRow[i] <<= getTimestamp(i); + break; + case DataType::BIT: + m_aRow[i] = bool2any(getBoolean(i)); + break; + case DataType::TINYINT: + m_aRow[i] <<= getByte(i); + break; + case DataType::SMALLINT: + m_aRow[i] <<= getShort(i); + break; + case DataType::INTEGER: + m_aRow[i] <<= getInt(i); + break; + case DataType::REAL: + m_aRow[i] <<= getFloat(i); + break; + case DataType::BINARY: + case DataType::VARBINARY: + m_aRow[i] <<= getBytes(i); + break; + } + } + m_nLastColumnPos = _nToColumn; + m_bFetchData = sal_False; +} + + diff --git a/connectivity/source/drivers/odbc/OResultSetMetaData.cxx b/connectivity/source/drivers/odbc/OResultSetMetaData.cxx new file mode 100644 index 000000000000..ae35669da768 --- /dev/null +++ b/connectivity/source/drivers/odbc/OResultSetMetaData.cxx @@ -0,0 +1,254 @@ +/************************************************************************* + * + * $RCSfile: OResultSetMetaData.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ODBC_ORESULTSETMETADATA_HXX_ +#include "odbc/OResultSetMetaData.hxx" +#endif +#ifndef _CONNECTIVITY_OTOOLS_HXX_ +#include "odbc/OTools.hxx" +#endif + +using namespace connectivity::odbc; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::sdbc; + +// ------------------------------------------------------------------------- +OResultSetMetaData::~OResultSetMetaData() +{ +} +// ------------------------------------------------------------------------- +::rtl::OUString OResultSetMetaData::getCharColAttrib(sal_Int32 _column,sal_Int32 ident) throw(SQLException, RuntimeException) +{ + sal_Int32 column = _column; + if(_column < m_vMapping.size()) // use mapping + column = m_vMapping[_column]; + + sal_Int32 BUFFER_LEN = 128; + char *pName = new char[BUFFER_LEN]; + SQLSMALLINT nRealLen=0; + OTools::ThrowException(N3SQLColAttribute(m_aStatementHandle, + column, + ident, + (SQLPOINTER)pName, + BUFFER_LEN, + &nRealLen, + NULL + ),m_aStatementHandle,SQL_HANDLE_STMT,*this); + if(nRealLen > BUFFER_LEN) + { + delete pName; + pName = new char[nRealLen]; + OTools::ThrowException(N3SQLColAttribute(m_aStatementHandle, + column, + ident, + (SQLPOINTER)pName, + nRealLen, + &nRealLen, + NULL + ),m_aStatementHandle,SQL_HANDLE_STMT,*this); + } + + return ::rtl::OUString::createFromAscii(pName); +} +// ------------------------------------------------------------------------- +sal_Int32 OResultSetMetaData::getNumColAttrib(sal_Int32 _column,sal_Int32 ident) throw(SQLException, RuntimeException) +{ + sal_Int32 column = _column; + if(_column < m_vMapping.size()) // use mapping + column = m_vMapping[_column]; + + sal_Int32 nValue=0; + sal_Int16 nLen = sizeof(nValue); + OTools::ThrowException(N3SQLColAttribute(m_aStatementHandle, + column, + ident, + NULL, + NULL, + NULL, + &nValue),m_aStatementHandle,SQL_HANDLE_STMT,*this); + return nValue; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getNumColAttrib(column,SQL_DESC_DISPLAY_SIZE); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return OTools::MapOdbcType2Jdbc(getNumColAttrib(column,SQL_DESC_TYPE)); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException) +{ + if(m_nColCount != -1) + return m_nColCount; + sal_Int16 nNumResultCols=0; + OTools::ThrowException(N3SQLNumResultCols(m_aStatementHandle,&nNumResultCols),m_aStatementHandle,SQL_HANDLE_STMT,*this); + return m_nColCount = nNumResultCols; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getNumColAttrib(column,SQL_DESC_CASE_SENSITIVE) == SQL_TRUE; +} +// ------------------------------------------------------------------------- + +::rtl::OUString SAL_CALL OResultSetMetaData::getSchemaName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getCharColAttrib(column,SQL_DESC_SCHEMA_NAME); +} +// ------------------------------------------------------------------------- + +::rtl::OUString SAL_CALL OResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getCharColAttrib(column,SQL_DESC_NAME); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getCharColAttrib(column,SQL_DESC_TABLE_NAME); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getCatalogName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getCharColAttrib(column,SQL_DESC_CATALOG_NAME); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getCharColAttrib(column,SQL_DESC_TYPE_NAME +); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getCharColAttrib(column,SQL_DESC_LABEL); +} +// ------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OResultSetMetaData::getColumnServiceName( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return ::rtl::OUString(); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getNumColAttrib(column,SQL_DESC_FIXED_PREC_SCALE) == SQL_TRUE; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getNumColAttrib(column,SQL_DESC_AUTO_UNIQUE_VALUE) == SQL_TRUE; +} +// ------------------------------------------------------------------------- + + +sal_Bool SAL_CALL OResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getNumColAttrib(column,SQL_DESC_UNSIGNED) == SQL_FALSE; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getNumColAttrib(column,SQL_DESC_PRECISION); +} +sal_Int32 SAL_CALL OResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + return getNumColAttrib(column,SQL_DESC_SCALE); +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getNumColAttrib(column,SQL_DESC_NULLABLE); +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getNumColAttrib(column,SQL_DESC_SEARCHABLE) != SQL_PRED_NONE; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getNumColAttrib(column,SQL_DESC_UPDATABLE) == SQL_ATTR_READONLY; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getNumColAttrib(column,SQL_DESC_UPDATABLE) == SQL_ATTR_WRITE; +; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL OResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException) +{ + return getNumColAttrib(column,SQL_DESC_UPDATABLE) == SQL_ATTR_WRITE; +} +// ------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/odbc/OStatement.cxx b/connectivity/source/drivers/odbc/OStatement.cxx new file mode 100644 index 000000000000..3fa896cdfece --- /dev/null +++ b/connectivity/source/drivers/odbc/OStatement.cxx @@ -0,0 +1,1004 @@ +/************************************************************************* + * + * $RCSfile: OStatement.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif +#ifndef _CONNECTIVITY_ODBC_OSTATEMENT_HXX_ +#include "odbc/OStatement.hxx" +#endif +#ifndef _CONNECTIVITY_ODBC_OCONNECTION_HXX_ +#include "odbc/OConnection.hxx" +#endif +#ifndef _CONNECTIVITY_ODBC_ORESULTSET_HXX_ +#include "odbc/OResultSet.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +#ifndef _UTL_PROPERTY_HXX_ +#include <unotools/property.hxx> +#endif +#ifndef _CONNECTIVITY_OTOOLS_HXX_ +#include "odbc/OTools.hxx" +#endif +#ifndef _UTL_UNO3_HXX_ +#include <unotools/uno3.hxx> +#endif +#ifndef _OSL_THREAD_H_ +#include <osl/thread.h> +#endif + +#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_ +#include <com/sun/star/sdbc/ResultSetConcurrency.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_ +#include <com/sun/star/sdbc/ResultSetType.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif +#ifndef _CPPUHELPER_EXTRACT_HXX_ +#include <cppuhelper/extract.hxx> +#endif + +#define THROW_SQL(x) \ + OTools::ThrowException(x,m_aStatementHandle,SQL_HANDLE_STMT,*this) + +#ifdef DEBUG +#define DEBUG_THROW \ + try \ + { \ + THROW_SQL(nRetCode); \ + } \ + catch(...) \ + { \ + } +#endif + +using namespace connectivity::odbc; +//------------------------------------------------------------------------------ +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::sdbcx; +using namespace com::sun::star::container; +using namespace com::sun::star::io; +using namespace com::sun::star::util; +//------------------------------------------------------------------------------ +OStatement_Base::OStatement_Base(OConnection* _pConnection ) : OStatement_BASE(m_aMutex), + OPropertySetHelper(OStatement_BASE::rBHelper), + rBHelper(OStatement_BASE::rBHelper), + m_pConnection(_pConnection), + m_pRowStatusArray(0) +{ + m_pConnection->acquire(); + N3SQLAllocHandle(SQL_HANDLE_STMT,m_pConnection->getConnection(),&m_aStatementHandle); +} +//------------------------------------------------------------------------------ +void OStatement_Base::disposeResultSet() +{ + // free the cursor if alive + Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY); + if (xComp.is()) + xComp->dispose(); + m_xResultSet = Reference< XResultSet>(); +} +//------------------------------------------------------------------------------ +void OStatement_BASE2::disposing() +{ + ::osl::MutexGuard aGuard(m_aMutex); + + disposeResultSet(); + + if (N3SQLFreeStmt(m_aStatementHandle,SQL_RESET_PARAMS) || + N3SQLFreeStmt(m_aStatementHandle,SQL_UNBIND) || + N3SQLFreeStmt(m_aStatementHandle,SQL_CLOSE)) + OTools::ThrowException(N3SQLFreeStmt(m_aStatementHandle,SQL_DROP),m_aStatementHandle,SQL_HANDLE_STMT,*this); + + if (m_pConnection) + m_pConnection->release(); + + dispose_ChildImpl(); + OStatement_Base::disposing(); +} +//----------------------------------------------------------------------------- +void SAL_CALL OStatement_BASE2::release() throw(RuntimeException) +{ + relase_ChildImpl(); +} +//----------------------------------------------------------------------------- +Any SAL_CALL OStatement_Base::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = OStatement_BASE::queryInterface(rType); + if(!aRet.hasValue()) + aRet = OPropertySetHelper::queryInterface(rType); + return aRet; +} +// ------------------------------------------------------------------------- +Sequence< Type > SAL_CALL OStatement_Base::getTypes( ) throw(RuntimeException) +{ + ::cppu::OTypeCollection aTypes( ::getCppuType( (const Reference< XMultiPropertySet > *)0 ), + ::getCppuType( (const Reference< XFastPropertySet > *)0 ), + ::getCppuType( (const Reference< XPropertySet > *)0 )); + + return ::utl::concatSequences(aTypes.getTypes(),OStatement_BASE::getTypes()); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OStatement_Base::cancel( ) throw(RuntimeException) +{ + OTools::ThrowException(N3SQLCancel(m_aStatementHandle),m_aStatementHandle,SQL_HANDLE_STMT,*this); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OStatement_Base::close( ) throw(SQLException, RuntimeException) +{ + { + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + } + dispose(); +} +// ------------------------------------------------------------------------- + +void SAL_CALL OStatement::clearBatch( ) throw(SQLException, RuntimeException) +{ + +} +// ------------------------------------------------------------------------- + +void OStatement_Base::reset() throw (SQLException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + clearWarnings (); + + if (m_xResultSet.get().is()) + { + clearMyResultSet(); + THROW_SQL(N3SQLFreeStmt(m_aStatementHandle, SQL_CLOSE)); + } +} +//-------------------------------------------------------------------- +// clearMyResultSet +// If a ResultSet was created for this Statement, close it +//-------------------------------------------------------------------- + +void OStatement_Base::clearMyResultSet () throw (SQLException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + Reference<XCloseable> xCloseable; + if(::utl::query_interface(m_xResultSet.get(),xCloseable)) + xCloseable->close(); + m_xResultSet = Reference< XResultSet>(); +} +//-------------------------------------------------------------------- +sal_Int32 OStatement_Base::getRowCount () throw( SQLException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + sal_Int32 numRows = 0; + + try { + THROW_SQL(N3SQLRowCount(m_aStatementHandle,&numRows)); + } + catch (...) + { + } + return numRows; +} +//-------------------------------------------------------------------- +// lockIfNecessary +// If the given SQL statement contains a 'FOR UPDATE' clause, change +// the concurrency to lock so that the row can then be updated. Returns +// true if the concurrency has been changed +//-------------------------------------------------------------------- + +sal_Bool OStatement_Base::lockIfNecessary (const ::rtl::OUString& sql) throw( SQLException) +{ + sal_Bool rc = sal_False; + + // First, convert the statement to upper case + + ::rtl::OUString sqlStatement = sql.toUpperCase (); + + // Now, look for the FOR UPDATE keywords. If there is any extra white + // space between the FOR and UPDATE, this will fail. + + sal_Int32 index = sqlStatement.indexOf(::rtl::OUString::createFromAscii(" FOR UPDATE")); + + // We found it. Change our concurrency level to ensure that the + // row can be updated. + + if (index > 0) + { + try + { + SQLINTEGER nLock = SQL_CONCUR_LOCK; + THROW_SQL(N3SQLSetStmtAttr(m_aStatementHandle, SQL_CONCURRENCY,(SQLPOINTER)nLock,SQL_IS_UINTEGER)); + } + catch (SQLWarning& warn) + { + // Catch any warnings and place on the warning stack + setWarning (warn); + } + rc = sal_True; + } + + return rc; +} +//-------------------------------------------------------------------- +// setWarning +// Sets the warning +//-------------------------------------------------------------------- + +void OStatement_Base::setWarning (const SQLWarning &ex) throw( SQLException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_aLastWarning = ex; +} + +//-------------------------------------------------------------------- +// getColumnCount +// Return the number of columns in the ResultSet +//-------------------------------------------------------------------- + +sal_Int32 OStatement_Base::getColumnCount () throw( SQLException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + sal_Int16 numCols = 0; + + try { + THROW_SQL(N3SQLNumResultCols(m_aStatementHandle,&numCols)); + } + catch (...) + { + } + return numCols; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OStatement_Base::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + ::rtl::OString aSql(::rtl::OUStringToOString(sql, + osl_getThreadTextEncoding() + )); + + sal_Bool hasResultSet = sal_False; + SQLWarning aWarning; + + // Reset the statement handle and warning + + reset(); + + // Check for a 'FOR UPDATE' statement. If present, change + // the concurrency to lock + + lockIfNecessary (sql); + + // Call SQLExecDirect + + try { + THROW_SQL(N3SQLExecDirect(m_aStatementHandle, (SDB_ODBC_CHAR*)aSql.getStr(),aSql.getLength())); + } + catch (SQLWarning& ex) { + + // Save pointer to warning and save with ResultSet + // object once it is created. + + aWarning = ex; + } + + // Now determine if there is a result set associated with + // the SQL statement that was executed. Get the column + // count, and if it is not zero, there is a result set. + + if (getColumnCount () > 0) + { + hasResultSet = sal_True; + } + + return hasResultSet; +} +//-------------------------------------------------------------------- +// getResultSet +// getResultSet returns the current result as a ResultSet. It +// returns NULL if the current result is not a ResultSet. +//-------------------------------------------------------------------- +Reference< XResultSet > OStatement_Base::getResultSet (sal_Bool checkCount) throw( SQLException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if (m_xResultSet.get().is()) // if resultset already retrieved, + { + // throw exception to avoid sequence error + throw SQLException(::rtl::OUString::createFromAscii("Invalid state for getResultSet"),*this, + ::rtl::OUString(),0,Any()); + } + + OResultSet* pRs = NULL; + sal_Int32 numCols = 1; + + // If we already know we have result columns, checkCount + // is false. This is an optimization to prevent unneeded + // calls to getColumnCount + + if (checkCount) + numCols = getColumnCount (); + + // Only return a result set if there are result columns + + if (numCols > 0) + { + pRs = new OResultSet(m_aStatementHandle,this); + + // Save a copy of our last result set + // Changed to save copy at getResultSet. + //m_xResultSet = rs; + } + else + clearMyResultSet (); + + return pRs; +} +//-------------------------------------------------------------------- +// getStmtOption +// Invoke SQLGetStmtOption with the given option. +//-------------------------------------------------------------------- + +sal_Int32 OStatement_Base::getStmtOption (short fOption) const throw( SQLException) +{ + sal_Int32 result = 0; + + // Reset last warning message + + // clearWarnings(); + + try { + N3SQLGetStmtAttr(m_aStatementHandle, fOption,&result,SQL_IS_INTEGER,NULL); + } + catch (...) + { + } + return result; +} +// ------------------------------------------------------------------------- + +Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + Reference< XResultSet > xRS = NULL; + + // Execute the statement. If execute returns true, a result + // set exists. + + if (execute (sql)) + { + xRS = getResultSet (sal_False); + } + else + { + // No ResultSet was produced. Raise an exception + throw SQLException(::rtl::OUString::createFromAscii("No ResultSet was produced"),*this, + ::rtl::OUString(),0,Any()); + } + return xRS; +} +// ------------------------------------------------------------------------- + +Reference< XConnection > SAL_CALL OStatement_Base::getConnection( ) throw(SQLException, RuntimeException) +{ + return (Reference< XConnection >)m_pConnection; +} +// ------------------------------------------------------------------------- + +Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = ::cppu::queryInterface(rType,static_cast< XBatchExecution*> (this)); + if(!aRet.hasValue()) + aRet = OStatement_Base::queryInterface(rType); + return aRet; +} +// ------------------------------------------------------------------------- + +void SAL_CALL OStatement::addBatch( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_aBatchList.push_back(sql); +} +// ------------------------------------------------------------------------- +Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + ::rtl::OString aBatchSql; + sal_Int32 nLen = 0; + for(::std::list< ::rtl::OUString>::const_iterator i=m_aBatchList.begin();i != m_aBatchList.end();++i,++nLen) + { + aBatchSql += ::rtl::OUStringToOString(*i, + osl_getThreadTextEncoding() + ); + aBatchSql += ";"; + } + + THROW_SQL(N3SQLExecDirect(m_aStatementHandle, (SDB_ODBC_CHAR*)aBatchSql.getStr(),aBatchSql.getLength())); + + Sequence< sal_Int32 > aRet(nLen); + sal_Int32* pArray = aRet.getArray(); + for(sal_Int32 j=0;j<nLen;++j) + { + SQLRETURN nError = N3SQLMoreResults(m_aStatementHandle); + if(nError == SQL_SUCCESS) + { + N3SQLRowCount(m_aStatementHandle,&pArray[j]); + } + } + return aRet; +} +// ------------------------------------------------------------------------- + + +sal_Int32 SAL_CALL OStatement_Base::executeUpdate( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + sal_Int32 numRows = -1; + + // Execute the statement. If execute returns false, a + // row count exists. + + if (!execute (sql)) { + numRows = getUpdateCount(); + } + else { + + // No update count was produced (a ResultSet was). Raise + // an exception + + throw new SQLException (::rtl::OUString::createFromAscii("No row count was produced"),*this, + ::rtl::OUString(),0,Any()); + } + return numRows; + +} +// ------------------------------------------------------------------------- + +Reference< XResultSet > SAL_CALL OStatement_Base::getResultSet( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_xResultSet = getResultSet(sal_True); + return m_xResultSet; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OStatement_Base::getUpdateCount( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + sal_Int32 rowCount = -1; + + // Only return a row count for SQL statements that did not + // return a result set. + + if (getColumnCount () == 0) + rowCount = getRowCount (); + + return rowCount; +} +// ------------------------------------------------------------------------- + +sal_Bool SAL_CALL OStatement_Base::getMoreResults( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + OResultSet* pRS = NULL; + SQLWarning warning; + sal_Bool hasResultSet = sal_False; + + // clear previous warnings + + clearWarnings (); + + // Call SQLMoreResults + + try { + hasResultSet = N3SQLMoreResults(m_aStatementHandle) == SQL_SUCCESS; + } + catch (SQLWarning &ex) { + + // Save pointer to warning and save with ResultSet + // object once it is created. + + warning = ex; + } + + // There are more results (it may not be a result set, though) + + if (hasResultSet) + { + + // Now determine if there is a result set associated + // with the SQL statement that was executed. Get the + // column count, and if it is zero, there is not a + // result set. + + if (getColumnCount () == 0) + hasResultSet = sal_False; + } + + // Set the warning for the statement, if one was generated + + setWarning (warning); + + // Return the result set indicator + + return hasResultSet; +} +// ------------------------------------------------------------------------- + +// ------------------------------------------------------------------------- +Any SAL_CALL OStatement_Base::getWarnings( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return makeAny(m_aLastWarning); +} +// ------------------------------------------------------------------------- + +// ------------------------------------------------------------------------- +void SAL_CALL OStatement_Base::clearWarnings( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + m_aLastWarning = SQLWarning(); +} +// ------------------------------------------------------------------------- +//------------------------------------------------------------------------------ +sal_Int32 OStatement_Base::getQueryTimeOut() const throw(SQLException, RuntimeException) +{ + return getStmtOption(SQL_ATTR_QUERY_TIMEOUT); +} +//------------------------------------------------------------------------------ +sal_Int32 OStatement_Base::getMaxRows() const throw(SQLException, RuntimeException) +{ + return getStmtOption(SQL_ATTR_MAX_ROWS); +} +//------------------------------------------------------------------------------ +sal_Int32 OStatement_Base::getResultSetConcurrency() const throw(SQLException, RuntimeException) +{ + sal_uInt32 nValue; + SQLRETURN nRetCode = N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_CONCURRENCY,&nValue,SQL_IS_UINTEGER,0); + return nValue; +} +//------------------------------------------------------------------------------ +sal_Int32 OStatement_Base::getResultSetType() const throw(SQLException, RuntimeException) +{ + sal_uInt32 nValue=0; + SQLRETURN nRetCode = N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_SENSITIVITY,&nValue,SQL_IS_UINTEGER,0); + nRetCode = N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_TYPE,&nValue,SQL_IS_UINTEGER,0); + return nValue; +} +//------------------------------------------------------------------------------ +sal_Int32 OStatement_Base::getFetchDirection() const throw(SQLException, RuntimeException) +{ + sal_uInt32 nValue; + SQLRETURN nRetCode = N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_TYPE,&nValue,SQL_IS_UINTEGER,0); + return nValue; +} +//------------------------------------------------------------------------------ +sal_Int32 OStatement_Base::getFetchSize() const throw(SQLException, RuntimeException) +{ + sal_uInt32 nValue; + SQLRETURN nRetCode = N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE,&nValue,SQL_IS_UINTEGER,0); + return nValue; +} +//------------------------------------------------------------------------------ +sal_Int32 OStatement_Base::getMaxFieldSize() const throw(SQLException, RuntimeException) +{ + return getStmtOption(SQL_ATTR_MAX_LENGTH); +} +//------------------------------------------------------------------------------ +::rtl::OUString OStatement_Base::getCursorName() const throw(SQLException, RuntimeException) +{ + SQLCHAR pName[258]; + SQLSMALLINT nRealLen = 0; + SQLRETURN nRetCode = N3SQLGetCursorName(m_aStatementHandle,(SQLCHAR*)pName,256,&nRealLen); + return ::rtl::OUString::createFromAscii((const char*)pName); +} +//------------------------------------------------------------------------------ +void OStatement_Base::setQueryTimeOut(sal_Int32 seconds) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + SQLRETURN nRetCode = N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_QUERY_TIMEOUT,(SQLPOINTER)seconds,SQL_IS_UINTEGER); +#ifdef DEBUG + DEBUG_THROW +#endif +} +//------------------------------------------------------------------------------ +void OStatement_Base::setMaxRows(sal_Int32 _par0) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + SQLRETURN nRetCode = N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_MAX_ROWS, (SQLPOINTER)_par0,SQL_IS_UINTEGER); +#ifdef DEBUG + DEBUG_THROW +#endif + +} +//------------------------------------------------------------------------------ +void OStatement_Base::setResultSetConcurrency(sal_Int32 _par0) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + SQLINTEGER nSet; + if(_par0 == ResultSetConcurrency::READ_ONLY) + nSet = SQL_CONCUR_READ_ONLY; + else + nSet = SQL_CONCUR_VALUES; + + THROW_SQL(N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_CONCURRENCY,(SQLPOINTER)nSet,SQL_IS_UINTEGER)); + +} +//------------------------------------------------------------------------------ +void OStatement_Base::setResultSetType(sal_Int32 _par0) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + SQLRETURN nRetCode = N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_ROW_BIND_TYPE,(SQLPOINTER)SQL_BIND_BY_COLUMN,SQL_IS_UINTEGER); + + SQLUINTEGER nSet; + switch(_par0) + { + case ResultSetType::FORWARD_ONLY: + nSet = SQL_UNSPECIFIED; + break; + case ResultSetType::SCROLL_INSENSITIVE: + nSet = SQL_INSENSITIVE; + THROW_SQL(N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_CURSOR_TYPE,(SQLPOINTER)SQL_CURSOR_KEYSET_DRIVEN,SQL_IS_UINTEGER)); + break; + case ResultSetType::SCROLL_SENSITIVE: + nSet = SQL_CURSOR_DYNAMIC; + if(N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_CURSOR_TYPE,(SQLPOINTER)nSet,SQL_IS_UINTEGER) != SQL_SUCCESS) + { + nSet = SQL_CURSOR_KEYSET_DRIVEN; + THROW_SQL(N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_CURSOR_TYPE,(SQLPOINTER)nSet,SQL_IS_UINTEGER)); + } + nSet = SQL_SENSITIVE; + break; + } + + + if(nRetCode = N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_CURSOR_SENSITIVITY,(SQLPOINTER)nSet,SQL_IS_UINTEGER) != SQL_SUCCESS) + { + } +} +//------------------------------------------------------------------------------ +void OStatement_Base::setFetchDirection(sal_Int32 _par0) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + SQLRETURN nRetCode = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_TYPE,(SQLPOINTER)_par0,SQL_IS_UINTEGER); +} +//------------------------------------------------------------------------------ +void OStatement_Base::setFetchSize(sal_Int32 _par0) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + SQLRETURN nRetCode = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)_par0,SQL_IS_UINTEGER); + +#ifdef DEBUG + DEBUG_THROW +#endif + + delete m_pRowStatusArray; + m_pRowStatusArray = new SQLUSMALLINT[_par0]; + nRetCode = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_STATUS_PTR,m_pRowStatusArray,SQL_IS_POINTER); +#ifdef DEBUG + DEBUG_THROW +#endif + +} +//------------------------------------------------------------------------------ +void OStatement_Base::setMaxFieldSize(sal_Int32 _par0) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + THROW_SQL(N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_MAX_LENGTH,(SQLPOINTER)_par0,SQL_IS_UINTEGER)); +} +//------------------------------------------------------------------------------ +void OStatement_Base::setCursorName(const ::rtl::OUString &_par0) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + ::rtl::OString aName(::rtl::OUStringToOString(_par0, + osl_getThreadTextEncoding() + )); + THROW_SQL(N3SQLSetCursorName(m_aStatementHandle,(SDB_ODBC_CHAR*)aName.getStr(),aName.getLength())); +} +// ------------------------------------------------------------------------- +sal_Bool OStatement_Base::isUsingBookmarks() const throw(SQLException, RuntimeException) +{ + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + sal_uInt32 nValue = SQL_UB_OFF; + SQLRETURN nRet = N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_USE_BOOKMARKS,&nValue,SQL_IS_UINTEGER,NULL); + // THROW_SQL(nRet); + return nValue != SQL_UB_OFF; +} +// ------------------------------------------------------------------------- +void OStatement_Base::setUsingBookmarks(sal_Bool _bUseBookmark) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if (OStatement_BASE::rBHelper.bDisposed) + throw DisposedException(); + + sal_uInt32 nValue = _bUseBookmark ? SQL_UB_VARIABLE : SQL_UB_OFF; + SQLRETURN nRet = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_USE_BOOKMARKS,(SQLPOINTER)nValue,SQL_IS_UINTEGER); + THROW_SQL(nRet); +} +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper* OStatement_Base::createArrayHelper( ) const +{ + Sequence< Property > aProps(10); + Property* pProperties = aProps.getArray(); + sal_Int32 nPos = 0; + DECL_PROP0(CURSORNAME, ::rtl::OUString); + DECL_BOOL_PROP0(ESCAPEPROCESSING); + DECL_PROP0(FETCHDIRECTION,sal_Int32); + DECL_PROP0(FETCHSIZE, sal_Int32); + DECL_PROP0(MAXFIELDSIZE,sal_Int32); + DECL_PROP0(MAXROWS, sal_Int32); + DECL_PROP0(QUERYTIMEOUT,sal_Int32); + DECL_PROP0(RESULTSETCONCURRENCY,sal_Int32); + DECL_PROP0(RESULTSETTYPE,sal_Int32); + DECL_BOOL_PROP0(USEBOOKMARKS); + + return new ::cppu::OPropertyArrayHelper(aProps); +} + +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper & OStatement_Base::getInfoHelper() +{ + return *const_cast<OStatement_Base*>(this)->getArrayHelper(); +} +// ------------------------------------------------------------------------- +sal_Bool OStatement_Base::convertFastPropertyValue( + Any & rConvertedValue, + Any & rOldValue, + sal_Int32 nHandle, + const Any& rValue ) + throw (::com::sun::star::lang::IllegalArgumentException) +{ + switch(nHandle) + { + case PROPERTY_ID_QUERYTIMEOUT: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getQueryTimeOut()); + case PROPERTY_ID_MAXFIELDSIZE: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getMaxFieldSize()); + case PROPERTY_ID_MAXROWS: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getMaxRows()); + case PROPERTY_ID_CURSORNAME: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getCursorName()); + case PROPERTY_ID_RESULTSETCONCURRENCY: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getResultSetConcurrency()); + case PROPERTY_ID_RESULTSETTYPE: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getResultSetType()); + case PROPERTY_ID_FETCHDIRECTION: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection()); + case PROPERTY_ID_FETCHSIZE: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize()); + case PROPERTY_ID_ESCAPEPROCESSING: + // return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAsLink); + break; + case PROPERTY_ID_USEBOOKMARKS: + return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, isUsingBookmarks()); + + default: + ; + } + return sal_False; +} +// ------------------------------------------------------------------------- +void OStatement_Base::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception) +{ + switch(nHandle) + { + case PROPERTY_ID_QUERYTIMEOUT: + setQueryTimeOut(connectivity::getINT32(rValue)); + break; + case PROPERTY_ID_MAXFIELDSIZE: + setMaxFieldSize(connectivity::getINT32(rValue)); + break; + case PROPERTY_ID_MAXROWS: + setMaxRows(connectivity::getINT32(rValue)); + break; + case PROPERTY_ID_CURSORNAME: + setCursorName(connectivity::getString(rValue)); + break; + case PROPERTY_ID_RESULTSETCONCURRENCY: + setResultSetConcurrency(connectivity::getINT32(rValue)); + break; + case PROPERTY_ID_RESULTSETTYPE: + setResultSetType(connectivity::getINT32(rValue)); + break; + case PROPERTY_ID_FETCHDIRECTION: + setFetchDirection(connectivity::getINT32(rValue)); + break; + case PROPERTY_ID_FETCHSIZE: + setFetchSize(connectivity::getINT32(rValue)); + break; + case PROPERTY_ID_ESCAPEPROCESSING: + // return ::utl::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAsLink); + break; + case PROPERTY_ID_USEBOOKMARKS: + setUsingBookmarks(connectivity::getBOOL(rValue)); + break; + default: + ; + } +} +// ------------------------------------------------------------------------- +void OStatement_Base::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const +{ + switch(nHandle) + { + case PROPERTY_ID_QUERYTIMEOUT: + rValue <<= getQueryTimeOut(); + break; + case PROPERTY_ID_MAXFIELDSIZE: + rValue <<= getMaxFieldSize(); + break; + case PROPERTY_ID_MAXROWS: + rValue <<= getMaxRows(); + break; + case PROPERTY_ID_CURSORNAME: + rValue <<= getCursorName(); + break; + case PROPERTY_ID_RESULTSETCONCURRENCY: + rValue <<= getResultSetConcurrency(); + break; + case PROPERTY_ID_RESULTSETTYPE: + rValue <<= getResultSetType(); + break; + case PROPERTY_ID_FETCHDIRECTION: + rValue <<= getFetchDirection(); + break; + case PROPERTY_ID_FETCHSIZE: + rValue <<= getFetchSize(); + break; + case PROPERTY_ID_ESCAPEPROCESSING: + break; + case PROPERTY_ID_USEBOOKMARKS: + rValue <<= cppu::bool2any(isUsingBookmarks()); + break; + default: + ; + } +} +// ------------------------------------------------------------------------- +IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbcx.OStatement","com.sun.star.sdbc.Statement"); + diff --git a/connectivity/source/drivers/odbc/OTools.cxx b/connectivity/source/drivers/odbc/OTools.cxx new file mode 100644 index 000000000000..23d3589ac0f3 --- /dev/null +++ b/connectivity/source/drivers/odbc/OTools.cxx @@ -0,0 +1,545 @@ +/************************************************************************* + * + * $RCSfile: OTools.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_OTOOLS_HXX_ +#include "odbc/OTools.hxx" +#endif + +#define __STL_IMPORT_VENDOR_CSTD +#include <cstring> +#ifndef _CONNECTIVITY_ODBC_OFUNCTIONS_HXX_ +#include "odbc/OFunctions.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif + +using namespace connectivity::odbc; +using namespace com::sun::star::uno; +using namespace com::sun::star::sdbc; +using namespace com::sun::star::util; +#ifndef min +#define min(x,y) (x) < ( y) ? (x) : (y) +#endif +// ------------------------------------------------------------------------- +void OTools::ThrowException(SQLRETURN _rRetCode,SQLHANDLE _pContext,SQLSMALLINT _nHandleType,const Reference< XInterface >& _xInterface,sal_Bool _bNoFound) throw(SQLException, RuntimeException) +{ + switch(_rRetCode) + { + case SQL_NEED_DATA: + case SQL_STILL_EXECUTING: + case SQL_SUCCESS: + + case SQL_SUCCESS_WITH_INFO: + return; + case SQL_NO_DATA_FOUND: + if(_bNoFound) + return; // no need to throw a exception + case SQL_ERROR: break; + + + case SQL_INVALID_HANDLE: OSL_ENSHURE(0,"SdbODBC3_SetStatus: SQL_INVALID_HANDLE"); + throw RuntimeException(); + break; + } + + + // Zusaetliche Informationen zum letzten ODBC-Funktionsaufruf vorhanden. + // SQLError liefert diese Informationen. + + SDB_ODBC_CHAR szSqlState[5]; + SDWORD pfNativeError; + SDB_ODBC_CHAR szErrorMessage[SQL_MAX_MESSAGE_LENGTH]; + SWORD pcbErrorMsg; + + // Informationen zur letzten Operation: + // wenn hstmt != SQL_NULL_HSTMT ist (Benutzung von SetStatus in SdbCursor, SdbTable, ...), + // dann wird der Status des letzten Statements erfragt, sonst der Status des letzten + // Statements zu dieser Verbindung [was in unserem Fall wahrscheinlich gleichbedeutend ist, + // aber das Reference Manual drueckt sich da nicht so klar aus ...]. + // Entsprechend bei hdbc. + SQLRETURN n = N3SQLGetDiagRec(_nHandleType,_pContext,1, + szSqlState, + &pfNativeError, + szErrorMessage,sizeof szErrorMessage - 1,&pcbErrorMsg); + OSL_ENSHURE(n != SQL_INVALID_HANDLE,"SdbODBC3_SetStatus: SQLError returned SQL_INVALID_HANDLE"); + OSL_ENSHURE(n == SQL_SUCCESS || n == SQL_SUCCESS_WITH_INFO || n == SQL_NO_DATA_FOUND || n == SQL_ERROR,"SdbODBC3_SetStatus: SQLError failed"); + + // Zum Return Code von SQLError siehe ODBC 2.0 Programmer's Reference Seite 287ff + throw SQLException( ::rtl::OUString((char *)szErrorMessage,pcbErrorMsg,RTL_TEXTENCODING_MS_1252), + _xInterface, + ::rtl::OUString((char *)szSqlState,5,RTL_TEXTENCODING_MS_1252), + pfNativeError, + Any() + ); + +} +// ------------------------------------------------------------------------- +Sequence<sal_Int8> OTools::getBytesValue(SQLHANDLE _aStatementHandle,sal_Int32 columnIndex,SWORD _fSqlType,sal_Bool &_bWasNull, + const Reference< XInterface >& _xInterface) throw(SQLException, RuntimeException) +{ + char aCharArray[2048]; + // Erstmal versuchen, die Daten mit dem kleinen Puffer + // abzuholen: + SQLINTEGER nMaxLen = sizeof aCharArray - 1; + // GETDATA(SQL_C_CHAR,aCharArray,nMaxLen); + SQLINTEGER pcbValue = 0; + OTools::ThrowException(N3SQLGetData(_aStatementHandle, + (SQLUSMALLINT)columnIndex, + SQL_C_BINARY, + &aCharArray, + (SQLINTEGER)nMaxLen, + &pcbValue), + _aStatementHandle,SQL_HANDLE_STMT,_xInterface); + + _bWasNull = pcbValue == SQL_NULL_DATA; + if(_bWasNull) + return Sequence<sal_Int8>(); + + SQLINTEGER nBytes = pcbValue != SQL_NO_TOTAL ? min(pcbValue, nMaxLen) : nMaxLen; + Sequence<sal_Int8> aData((sal_Int8*)aCharArray, nBytes); + + + // Es handelt sich um Binaerdaten, um einen String, der fuer + // StarView zu lang ist oder der Treiber kann die Laenge der + // Daten nicht im voraus bestimmen - also als MemoryStream + // speichern. + while ((pcbValue == SQL_NO_TOTAL) || pcbValue > nMaxLen) + { + // Bei Strings wird der Puffer nie ganz ausgenutzt + // (das letzte Byte ist immer ein NULL-Byte, das + // aber bei pcbValue nicht mitgezaehlt wird) + if (pcbValue != SQL_NO_TOTAL && (pcbValue - nMaxLen) < nMaxLen) + nBytes = pcbValue - nMaxLen; + else + nBytes = nMaxLen; + + // Solange eine "truncation"-Warnung vorliegt, weiter Daten abholen + // GETDATA(SQL_C_CHAR,aCharArray, nLen + 1); + OTools::ThrowException(N3SQLGetData(_aStatementHandle, + (SQLUSMALLINT)columnIndex, + SQL_C_BINARY, + &aCharArray, + (SQLINTEGER)nBytes, + &pcbValue), + _aStatementHandle,SQL_HANDLE_STMT,_xInterface); + sal_Int32 nLen = aData.getLength(); + aData.realloc(nLen + nBytes); + ::std::memcpy(aData.getArray() + nLen, aCharArray, nBytes); + } + return aData; +} +// ------------------------------------------------------------------------- +::rtl::OUString OTools::getStringValue(SQLHANDLE _aStatementHandle,sal_Int32 columnIndex,SWORD _fSqlType,sal_Bool &_bWasNull, + const Reference< XInterface >& _xInterface) throw(SQLException, RuntimeException) +{ + ::rtl::OUString aData; + switch(_fSqlType) + { + case SQL_WVARCHAR: + case SQL_WCHAR: + case SQL_WLONGVARCHAR: + { + sal_Unicode waCharArray[2048]; + // read the unicode data + sal_Int32 nMaxLen = sizeof(waCharArray) - sizeof(sal_Unicode); + // GETDATA(SQL_C_WCHAR, waCharArray, nMaxLen + sizeof(sal_Unicode)); + + SQLINTEGER pcbValue=0; + OTools::ThrowException(N3SQLGetData(_aStatementHandle, + (SQLUSMALLINT)columnIndex, + SQL_C_WCHAR, + &waCharArray, + (SQLINTEGER)nMaxLen*sizeof(sal_Unicode), + &pcbValue), + _aStatementHandle,SQL_HANDLE_STMT,_xInterface); + _bWasNull = pcbValue == SQL_NULL_DATA; + if(_bWasNull) + return ::rtl::OUString(); + // Bei Fehler bricht der GETDATA-Makro mit return ab, + // bei NULL mit break! + SQLINTEGER nLen = pcbValue != SQL_NO_TOTAL ? min(pcbValue, nMaxLen) : nMaxLen; + waCharArray[nLen] = 0; + aData = ::rtl::OUString(waCharArray); + + // Es handelt sich um Binaerdaten, um einen String, der fuer + // StarView zu lang ist oder der Treiber kann die Laenge der + // Daten nicht im voraus bestimmen - also als MemoryStream + // speichern. + while ((pcbValue == SQL_NO_TOTAL ) || pcbValue > nMaxLen) + { + // Bei Strings wird der Puffer nie ganz ausgenutzt + // (das letzte Byte ist immer ein NULL-Byte, das + // aber bei pcbValue nicht mitgezaehlt wird) + if (pcbValue != SQL_NO_TOTAL && (pcbValue - nMaxLen) < nMaxLen) + nLen = pcbValue - nMaxLen; + else + nLen = nMaxLen; + + // Solange eine "truncation"-Warnung vorliegt, weiter Daten abholen + // GETDATA(SQL_C_CHAR,waCharArray, nLen + 1); + OTools::ThrowException(N3SQLGetData(_aStatementHandle, + (SQLUSMALLINT)columnIndex, + SQL_C_WCHAR, + &waCharArray, + (SQLINTEGER)nLen+1, + &pcbValue), + _aStatementHandle,SQL_HANDLE_STMT,_xInterface); + waCharArray[nLen] = 0; + + aData += ::rtl::OUString(waCharArray); + } + } + break; + default: + { + char aCharArray[2048]; + // Erstmal versuchen, die Daten mit dem kleinen Puffer + // abzuholen: + SDWORD nMaxLen = sizeof aCharArray - 1; + // GETDATA(SQL_C_CHAR,aCharArray,nMaxLen); + SQLINTEGER pcbValue = 0; + OTools::ThrowException(N3SQLGetData(_aStatementHandle, + (SQLUSMALLINT)columnIndex, + SQL_C_CHAR, + &aCharArray, + (SQLINTEGER)nMaxLen, + &pcbValue), + _aStatementHandle,SQL_HANDLE_STMT,_xInterface); + _bWasNull = pcbValue == SQL_NULL_DATA; + if(_bWasNull) + return ::rtl::OUString(); + + SQLINTEGER nLen = pcbValue != SQL_NO_TOTAL ? min(pcbValue, nMaxLen) : nMaxLen; + aCharArray[nLen] = 0; + aData = ::rtl::OUString((const sal_Char*)aCharArray,nLen, osl_getThreadTextEncoding()); + + // Es handelt sich um Binaerdaten, um einen String, der fuer + // StarView zu lang ist oder der Treiber kann die Laenge der + // Daten nicht im voraus bestimmen - also als MemoryStream + // speichern. + while ((pcbValue == SQL_NO_TOTAL) || pcbValue > nMaxLen) + { + // Bei Strings wird der Puffer nie ganz ausgenutzt + // (das letzte Byte ist immer ein NULL-Byte, das + // aber bei pcbValue nicht mitgezaehlt wird) + if (pcbValue != SQL_NO_TOTAL && (pcbValue - nMaxLen) < nMaxLen) + nLen = pcbValue - nMaxLen; + else + nLen = nMaxLen; + + // Solange eine "truncation"-Warnung vorliegt, weiter Daten abholen + // GETDATA(SQL_C_CHAR,aCharArray, nLen + 1); + OTools::ThrowException(N3SQLGetData(_aStatementHandle, + (SQLUSMALLINT)columnIndex, + SQL_C_CHAR, + &aCharArray, + (SQLINTEGER)nLen +1, + &pcbValue), + _aStatementHandle,SQL_HANDLE_STMT,_xInterface); + aCharArray[nLen] = 0; + + aData += ::rtl::OUString((const sal_Char*)aCharArray,nLen,osl_getThreadTextEncoding()); + } + + // delete all blanks + // aData.EraseTrailingChars(); + } + } + + return aData; +} +// ------------------------------------------------------------------------- +void OTools::GetInfo(SQLHANDLE _aConnectionHandle,SQLUSMALLINT _nInfo,::rtl::OUString &_rValue,const Reference< XInterface >& _xInterface) throw(SQLException, RuntimeException) +{ + char aValue[512]; + SQLSMALLINT nValueLen; + OTools::ThrowException( + N3SQLGetInfo(_aConnectionHandle,_nInfo,aValue,sizeof aValue,&nValueLen), + _aConnectionHandle,SQL_HANDLE_DBC,_xInterface); + + _rValue = ::rtl::OUString(aValue,nValueLen,RTL_TEXTENCODING_MS_1252); +} +// ------------------------------------------------------------------------- +void OTools::GetInfo(SQLHANDLE _aConnectionHandle,SQLUSMALLINT _nInfo,sal_Int32 &_rValue,const Reference< XInterface >& _xInterface) throw(SQLException, RuntimeException) +{ + SQLSMALLINT nValueLen; + _rValue = 0; // in case the driver uses only 16 of the 32 bits (as it does, for example, for SQL_CATALOG_LOCATION) + OTools::ThrowException( + N3SQLGetInfo(_aConnectionHandle,_nInfo,&_rValue,sizeof _rValue,&nValueLen), + _aConnectionHandle,SQL_HANDLE_DBC,_xInterface); +} +// ------------------------------------------------------------------------- +void OTools::GetInfo(SQLHANDLE _aConnectionHandle,SQLUSMALLINT _nInfo,sal_Bool &_rValue,const Reference< XInterface >& _xInterface) throw(SQLException, RuntimeException) +{ + SQLSMALLINT nValueLen; + OTools::ThrowException( + N3SQLGetInfo(_aConnectionHandle,_nInfo,&_rValue,sizeof _rValue,&nValueLen), + _aConnectionHandle,SQL_HANDLE_DBC,_xInterface); +} +// ------------------------------------------------------------------------- +sal_Int32 OTools::MapOdbcType2Jdbc(sal_Int32 _nType) +{ + sal_Int32 nValue; + switch(_nType) + { + case SQL_BIT: + nValue = DataType::BIT; + break; + case SQL_TINYINT: + nValue = DataType::TINYINT; + break; + case SQL_SMALLINT: + nValue = DataType::SMALLINT; + break; + case SQL_INTEGER: + nValue = DataType::INTEGER; + break; + case SQL_BIGINT: + nValue = DataType::BIGINT; + break; + case SQL_FLOAT: + nValue = DataType::FLOAT; + break; + case SQL_REAL: + nValue = DataType::REAL; + break; + case SQL_DOUBLE: + nValue = DataType::DOUBLE; + break; + case SQL_NUMERIC: + nValue = DataType::NUMERIC; + break; + case SQL_DECIMAL: + nValue = DataType::DECIMAL; + break; + case SQL_WCHAR: + case SQL_CHAR: + nValue = DataType::CHAR; + break; + case SQL_WVARCHAR: + case SQL_VARCHAR: + nValue = DataType::VARCHAR; + break; + case SQL_WLONGVARCHAR: + case SQL_LONGVARCHAR: + nValue = DataType::LONGVARCHAR; + break; + case SQL_TYPE_DATE: + case SQL_DATE: + nValue = DataType::DATE; + break; + case SQL_TYPE_TIME: + case SQL_TIME: + nValue = DataType::TIME; + break; + case SQL_TYPE_TIMESTAMP: + case SQL_TIMESTAMP: + nValue = DataType::TIMESTAMP; + break; + case SQL_BINARY: + nValue = DataType::BINARY; + break; + case SQL_VARBINARY: + nValue = DataType::VARBINARY; + break; + case SQL_LONGVARBINARY: + nValue = DataType::LONGVARBINARY; + break; + } + return nValue; +} +//-------------------------------------------------------------------- +// jdbcTypeToOdbc +// Convert the JDBC SQL type to the correct ODBC type +//-------------------------------------------------------------------- +sal_Int32 OTools::jdbcTypeToOdbc(sal_Int32 jdbcType) +{ + // For the most part, JDBC types match ODBC types. We'll + // just convert the ones that we know are different + + sal_Int32 odbcType = jdbcType; + + switch (jdbcType) + { + case DataType::DATE: + odbcType = SQL_DATE; + break; + case DataType::TIME: + odbcType = SQL_TIME; + break; + case DataType::TIMESTAMP: + odbcType = SQL_TIMESTAMP; + break; + } + + return odbcType; +} +//----------------------------------------------------------------------------- +void OTools::getBindTypes(sal_Bool _bUseWChar,sal_Bool _bUseOldTimeDate, + sal_Int32 jdbcType,SQLSMALLINT& fCType,SQLSMALLINT& fSqlType, + SQLUINTEGER& nColumnSize,SQLSMALLINT& nDecimalDigits) +{ + switch(jdbcTypeToOdbc(jdbcType)) + { + case SQL_CHAR: if(_bUseWChar) + { + fCType = SQL_C_WCHAR; + fSqlType = SQL_WCHAR; + } + else + { + fCType = SQL_C_CHAR; + fSqlType = SQL_CHAR; + } + break; + case SQL_VARCHAR: if(_bUseWChar) + { + fCType = SQL_C_WCHAR; + fSqlType = SQL_WVARCHAR; + } + else + { + fCType = SQL_C_CHAR; + fSqlType = SQL_VARCHAR; + } + break; + case SQL_LONGVARCHAR: if(_bUseWChar) + { + fCType = SQL_C_WCHAR; + fSqlType = SQL_WLONGVARCHAR; + } + else + { + fCType = SQL_C_CHAR; + fSqlType = SQL_LONGVARCHAR; + } + break; + case SQL_DECIMAL: fCType = _bUseWChar ? SQL_C_WCHAR : SQL_C_CHAR; + fSqlType = SQL_DECIMAL; break; + case SQL_NUMERIC: fCType = _bUseWChar ? SQL_C_WCHAR : SQL_C_CHAR; + fSqlType = SQL_NUMERIC; break; + case SQL_BIT: fCType = SQL_C_TINYINT; + fSqlType = SQL_INTEGER; break; + case SQL_TINYINT: fCType = SQL_C_SHORT; + fSqlType = SQL_TINYINT; break; + case SQL_SMALLINT: fCType = SQL_C_SHORT; + fSqlType = SQL_SMALLINT; break; + case SQL_INTEGER: fCType = SQL_C_LONG; + fSqlType = SQL_INTEGER; break; + case SQL_BIGINT: fCType = _bUseWChar ? SQL_C_WCHAR : SQL_C_CHAR; + fSqlType = SQL_BIGINT; break; + case SQL_REAL: fCType = SQL_C_FLOAT; + fSqlType = SQL_REAL; break; + case SQL_DOUBLE: fCType = SQL_C_DOUBLE; + fSqlType = SQL_DOUBLE; break; + case SQL_BINARY: fCType = SQL_C_BINARY; + fSqlType = SQL_BINARY; break; + case SQL_VARBINARY: + fCType = SQL_C_BINARY; + fSqlType = SQL_VARBINARY; break; + case SQL_LONGVARBINARY: fCType = SQL_C_BINARY; + fSqlType = SQL_LONGVARBINARY; break; + case SQL_DATE: + if(_bUseOldTimeDate) + { + fCType = SQL_C_DATE; + fSqlType = SQL_DATE; + } + else + { + fCType = SQL_C_TYPE_DATE; + fSqlType = SQL_TYPE_DATE; + } + break; + case SQL_TIME: + if(_bUseOldTimeDate) + { + fCType = SQL_C_TIME; + fSqlType = SQL_TIME; + } + else + { + fCType = SQL_C_TYPE_TIME; + fSqlType = SQL_TYPE_TIME; + } + break; + case SQL_TIMESTAMP: + if(_bUseOldTimeDate) + { + fCType = SQL_C_TIMESTAMP; + fSqlType = SQL_TIMESTAMP; + } + else + { + fCType = SQL_C_TYPE_TIMESTAMP; + fSqlType = SQL_TYPE_TIMESTAMP; + } + break; + default: fCType = SQL_C_BINARY; + fSqlType = SQL_LONGVARBINARY; break; + } +} + + diff --git a/connectivity/source/drivers/odbc/makefile.mk b/connectivity/source/drivers/odbc/makefile.mk new file mode 100644 index 000000000000..dd1cef6b9938 --- /dev/null +++ b/connectivity/source/drivers/odbc/makefile.mk @@ -0,0 +1,177 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/..$/.. +PRJINC=..$/.. +PRJNAME=connectivity +TARGET=odbc + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ---------------------------------- +.IF "$(DBGUTIL_OJ)"!="" +ENVCFLAGS+=/FR$(SLO)$/ +.ENDIF + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/version.mk + +# --- Types ------------------------------------- + + +UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb +UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb + +UNOUCROUT=$(OUT)$/inc +INCPRE+=$(UNOUCROUT) + +# --- Types ------------------------------------- + +UNOTYPES+= \ + com.sun.star.util.XCancellable \ + com.sun.star.util.XNumberFormatter \ + com.sun.star.uno.TypeClass \ + com.sun.star.uno.XWeak \ + com.sun.star.uno.XAggregation \ + com.sun.star.beans.XPropertyState \ + com.sun.star.beans.XPropertySet \ + com.sun.star.beans.PropertyValue \ + com.sun.star.beans.XMultiPropertySet \ + com.sun.star.beans.XFastPropertySet \ + com.sun.star.lang.XTypeProvider \ + com.sun.star.lang.EventObject \ + com.sun.star.lang.XComponent \ + com.sun.star.lang.IllegalArgumentException \ + com.sun.star.lang.DisposedException \ + com.sun.star.lang.XMultiServiceFactory \ + com.sun.star.lang.XSingleServiceFactory \ + com.sun.star.registry.XRegistryKey \ + com.sun.star.java.XJavaThreadRegister_11 \ + com.sun.star.java.XJavaVM \ + com.sun.star.sdbc.XConnection \ + com.sun.star.sdbc.XStatement \ + com.sun.star.sdbc.XResultSet \ + com.sun.star.sdbc.XResultSetMetaDataSupplier \ + com.sun.star.sdbc.XColumnLocate \ + com.sun.star.sdbc.XResultSetUpdate \ + com.sun.star.sdbc.XWarningsSupplier \ + com.sun.star.sdbc.XRowUpdate \ + com.sun.star.sdbc.XMultipleResults \ + com.sun.star.sdbc.XBatchExecution \ + com.sun.star.sdbc.XPreparedBatchExecution \ + com.sun.star.sdbc.XParameters \ + com.sun.star.sdbc.XOutParameters \ + com.sun.star.sdbc.DriverPropertyInfo \ + com.sun.star.sdbc.XDriver \ + com.sun.star.sdbc.XRow \ + com.sun.star.sdbc.SQLWarning \ + com.sun.star.sdbc.ColumnSearch \ + com.sun.star.sdbc.DataType \ + com.sun.star.sdbc.ResultSetConcurrency \ + com.sun.star.sdbc.ResultSetType \ + com.sun.star.sdbc.ColumnValue \ + com.sun.star.sdb.XColumnUpdate \ + com.sun.star.sdb.XColumn \ + com.sun.star.lang.XServiceInfo \ + + +# --- Files ------------------------------------- + +SLOFILES=\ + $(SLO)$/OPreparedStatement.obj \ + $(SLO)$/OStatement.obj \ + $(SLO)$/OResultSetMetaData.obj \ + $(SLO)$/OResultSet.obj \ + $(SLO)$/OTools.obj \ + $(SLO)$/ODatabaseMetaData.obj \ + $(SLO)$/ODriver.obj \ + $(SLO)$/OFunctions.obj \ + $(SLO)$/oservices.obj \ + $(SLO)$/OConnection.obj + +# --- Library ----------------------------------- + +SHL1TARGET= $(ODBC_TARGET)$(ODBC_MAJOR) +SHL1OBJS=$(SLOFILES) +SHL1STDLIBS=\ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(VOSLIB) \ + $(OSLLIB) \ + $(SALLIB) + +SHL1DEPN= +SHL1IMPLIB= i$(ODBC_TARGET) +SHL1LIBS= $(SLB)$/commontools.lib \ + $(SLB)$/resource.lib + +SHL1DEF= $(MISC)$/$(SHL1TARGET).def + +DEF1NAME= $(SHL1TARGET) +DEF1EXPORTFILE= exports.dxp + + +# --- Targets ---------------------------------- + +.INCLUDE : target.mk + + diff --git a/connectivity/source/drivers/odbc/odbc.map b/connectivity/source/drivers/odbc/odbc.map new file mode 100644 index 000000000000..becb2594a6a3 --- /dev/null +++ b/connectivity/source/drivers/odbc/odbc.map @@ -0,0 +1,8 @@ +ODBC_2_0 { + global: + component_getImplementationEnvironment + component_writeInfo + component_getFactory + local: + *; +}; diff --git a/connectivity/source/drivers/odbc/odbc.xml b/connectivity/source/drivers/odbc/odbc.xml new file mode 100644 index 000000000000..253bccb84c4c --- /dev/null +++ b/connectivity/source/drivers/odbc/odbc.xml @@ -0,0 +1,70 @@ +<?xml version='1.0' encoding="UTF-8"?> +<!DOCTYPE COMPONENTDESCRIPTION PUBLIC "-//W3C//DTD HTML 3.2//EN" "componentdependencies.dtd"> +<COMPONENTDESCRIPTION> + +<Name> com.sun.star.sdbc.ODBCDriver </Name> + +<Description> + This is the implementation of the sdbc-odbc bridge. +</Description> + +<ModuleName> odbc </ModuleName> + +<LoaderName> com.sun.star.loader.SharedLibrary </LoaderName> + +<SupportedService> com.sun.star.sdbc.Driver </SupportedService> + +<ServiceDependency> ... </ServiceDependency> + +<ProjectBuildDependency> cppuhelper </ProjectBuildDependency> +<ProjectBuildDependency> cppu </ProjectBuildDependency> +<ProjectBuildDependency> sal </ProjectBuildDependency> +<ProjectBuildDependency> vos </ProjectBuildDependency> + +<RuntimeModuleDependency> cppuhelper </RuntimeModuleDependency> +<RuntimeModuleDependency> cppu1 </RuntimeModuleDependency> +<RuntimeModuleDependency> sal1 </RuntimeModuleDependency> +<RuntimeModuleDependency> vos </RuntimeModuleDependency> + +<Language> c++ </Language> + +<Status StatusValue="final"/> + +<Type> com.sun.star.util.XCancellable </Type> +<Type> com.sun.star.util.XNumberFormatter </Type> +<Type> com.sun.star.uno.TypeClass </Type> +<Type> com.sun.star.uno.XWeak </Type> +<Type> com.sun.star.uno.XAggregation </Type> +<Type> com.sun.star.beans.XPropertyState </Type> +<Type> com.sun.star.beans.XPropertySet </Type> +<Type> com.sun.star.beans.PropertyValue </Type> +<Type> com.sun.star.beans.XMultiPropertySet </Type> +<Type> com.sun.star.beans.XFastPropertySet </Type> +<Type> com.sun.star.lang.XTypeProvider </Type> +<Type> com.sun.star.lang.EventObject </Type> +<Type> com.sun.star.lang.XComponent </Type> +<Type> com.sun.star.lang.IllegalArgumentException </Type> +<Type> com.sun.star.lang.XMultiServiceFactory </Type> +<Type> com.sun.star.java.XJavaThreadRegister_11 </Type> +<Type> com.sun.star.java.XJavaVM </Type> +<Type> com.sun.star.sdbc.XConnection </Type> +<Type> com.sun.star.sdbc.XStatement </Type> +<Type> com.sun.star.sdbc.XResultSet </Type> +<Type> com.sun.star.sdbc.XResultSetMetaDataSupplier</Type> +<Type> com.sun.star.sdbc.XColumnLocate </Type> +<Type> com.sun.star.sdbc.XResultSetUpdate </Type> +<Type> com.sun.star.sdbc.XWarningsSupplier </Type> +<Type> com.sun.star.sdbc.XRowUpdate </Type> +<Type> com.sun.star.sdbc.XMultipleResults </Type> +<Type> com.sun.star.sdbc.XBatchExecution </Type> +<Type> com.sun.star.sdbc.XPreparedBatchExecution </Type> +<Type> com.sun.star.sdbc.XParameters </Type> +<Type> com.sun.star.sdbc.XOutParameters </Type> +<Type> com.sun.star.sdbc.DriverPropertyInfo </Type> +<Type> com.sun.star.sdbc.XRow </Type> +<Type> com.sun.star.sdb.XColumnUpdate </Type> +<Type> com.sun.star.sdb.XColumn </Type> + +</COMPONENTDESCRIPTION> + + diff --git a/connectivity/source/drivers/odbc/oservices.cxx b/connectivity/source/drivers/odbc/oservices.cxx new file mode 100644 index 000000000000..7e6bf4bc118a --- /dev/null +++ b/connectivity/source/drivers/odbc/oservices.cxx @@ -0,0 +1,212 @@ +/************************************************************************* + * + * $RCSfile: oservices.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ODBC_ODRIVER_HXX_ +#include "odbc/ODriver.hxx" +#endif +#ifndef _CPPUHELPER_FACTORY_HXX_ +#include <cppuhelper/factory.hxx> +#endif +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif + +using namespace connectivity::odbc; +using ::rtl::OUString; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::registry::XRegistryKey; +using ::com::sun::star::lang::XSingleServiceFactory; +using ::com::sun::star::lang::XMultiServiceFactory; + +typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) + ( + const Reference< XMultiServiceFactory > & rServiceManager, + const OUString & rComponentName, + ::cppu::ComponentInstantiation pCreateFunction, + const Sequence< OUString > & rServiceNames + ); + +//*************************************************************************************** +// +// Die vorgeschriebene C-Api muss erfuellt werden! +// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen. +// + +//--------------------------------------------------------------------------------------- +void REGISTER_PROVIDER( + const OUString& aServiceImplName, + const Sequence< OUString>& Services, + const Reference< ::com::sun::star::registry::XRegistryKey > & xKey) +{ + OUString aMainKeyName; + aMainKeyName = OUString::createFromAscii("/"); + aMainKeyName += aServiceImplName; + aMainKeyName += OUString::createFromAscii("/UNO/SERVICES"); + + Reference< ::com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) ); + OSL_ENSHURE(xNewKey.is(), "ODBC::component_writeInfo : could not create a registry key !"); + + for (sal_uInt32 i=0; i<Services.getLength(); ++i) + xNewKey->createKey(Services[i]); +} + + +//--------------------------------------------------------------------------------------- +struct ProviderRequest +{ + Reference< XSingleServiceFactory > xRet; + Reference< XMultiServiceFactory > const xServiceManager; + OUString const sImplementationName; + + ProviderRequest( + void* pServiceManager, + sal_Char const* pImplementationName + ) + : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager)) + , sImplementationName(OUString::createFromAscii(pImplementationName)) + { + } + + inline + sal_Bool CREATE_PROVIDER( + const OUString& Implname, + const Sequence< OUString > & Services, + ::cppu::ComponentInstantiation Factory, + createFactoryFunc creator + ) + { + if (!xRet.is() && (Implname == sImplementationName)) + try + { + xRet = creator( xServiceManager, sImplementationName,Factory, Services); + } + catch(...) + { + } + return xRet.is(); + } + + void* getProvider() const { return xRet.get(); } +}; + +//--------------------------------------------------------------------------------------- + +extern "C" void SAL_CALL component_getImplementationEnvironment( + const sal_Char **ppEnvTypeName, + uno_Environment **ppEnv + ) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +//--------------------------------------------------------------------------------------- +extern "C" sal_Bool SAL_CALL component_writeInfo( + void* pServiceManager, + void* pRegistryKey + ) +{ + if (pRegistryKey) + try + { + Reference< ::com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast< ::com::sun::star::registry::XRegistryKey*>(pRegistryKey)); + + REGISTER_PROVIDER( + ODBCDriver::getImplementationName_Static(), + ODBCDriver::getSupportedServiceNames_Static(), xKey); + + return sal_True; + } + catch (::com::sun::star::registry::InvalidRegistryException& ) + { + OSL_ENSHURE(sal_False, "ODBC::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); + } + + return sal_False; +} + +//--------------------------------------------------------------------------------------- +extern "C" void* SAL_CALL component_getFactory( + const sal_Char* pImplementationName, + void* pServiceManager, + void* pRegistryKey) +{ + void* pRet = 0; + if (pServiceManager) + { + ProviderRequest aReq(pServiceManager,pImplementationName); + + aReq.CREATE_PROVIDER( + ODBCDriver::getImplementationName_Static(), + ODBCDriver::getSupportedServiceNames_Static(), + ODBCDriver_CreateInstance, ::cppu::createSingleFactory) + ; + + if(aReq.xRet.is()) + aReq.xRet->acquire(); + + pRet = aReq.getProvider(); + } + + return pRet; +}; + + diff --git a/connectivity/source/inc/OColumn.hxx b/connectivity/source/inc/OColumn.hxx new file mode 100644 index 000000000000..a03c8debc371 --- /dev/null +++ b/connectivity/source/inc/OColumn.hxx @@ -0,0 +1,174 @@ +/************************************************************************* + * + * $RCSfile: OColumn.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_COLUMN_HXX_ +#define _CONNECTIVITY_COLUMN_HXX_ + +#ifndef _RTL_USTRING_ +#include <rtl/ustring> +#endif +#ifndef _SAL_TYPES_H_ +#include <sal/types.h> +#endif + +namespace connectivity +{ + class OColumn + { + ::rtl::OUString m_CatalogName; + ::rtl::OUString m_SchemaName; + ::rtl::OUString m_TableName; + ::rtl::OUString m_ColumnName; + ::rtl::OUString m_ColumnLabel; + ::rtl::OUString m_ColumnTypeName; + ::rtl::OUString m_ColumnServiceName; + + sal_Int32 m_Nullable; + sal_Int32 m_ColumnDisplaySize; + sal_Int32 m_Precision; + sal_Int32 m_Scale; + sal_Int32 m_ColumnType; + + sal_Bool m_AutoIncrement; + sal_Bool m_CaseSensitive; + sal_Bool m_Searchable; + sal_Bool m_Currency; + sal_Bool m_Signed; + sal_Bool m_ReadOnly; + sal_Bool m_Writable; + sal_Bool m_DefinitelyWritable; + + public: + OColumn() {} + OColumn(const ::rtl::OUString &_aTableName, + const ::rtl::OUString &_aColumnName, + + sal_Int32 _aNullable=0, + sal_Int32 _aColumnDisplaySize=0, + sal_Int32 _aPrecision=0, + sal_Int32 _aScale=0, + sal_Int32 _aColumnType=0, + + sal_Bool _aAutoIncrement=sal_False, + sal_Bool _aCaseSensitive=sal_False, + sal_Bool _aSearchable=sal_True, + sal_Bool _aCurrency=sal_False, + sal_Bool _aSigned=sal_False, + sal_Bool _aReadOnly=sal_True, + sal_Bool _aWritable=sal_False, + sal_Bool _aDefinitelyWritable=sal_False, + + const ::rtl::OUString &_aColumnLabel = ::rtl::OUString(), + const ::rtl::OUString &_aColumnTypeName = ::rtl::OUString(), + const ::rtl::OUString &_aColumnServiceName = ::rtl::OUString()) + : m_TableName(_aTableName), + m_ColumnName(_aColumnName), + m_ColumnLabel(_aColumnLabel), + m_ColumnTypeName(_aColumnTypeName), + m_ColumnServiceName(_aColumnServiceName), + + m_Nullable(_aNullable), + m_ColumnDisplaySize(_aColumnDisplaySize), + m_Precision(_aPrecision), + m_Scale(_aScale), + m_ColumnType(_aColumnType), + + m_AutoIncrement(_aAutoIncrement), + m_CaseSensitive(_aCaseSensitive), + m_Searchable(_aSearchable), + m_Currency(_aCurrency), + m_Signed(_aSigned), + m_ReadOnly(_aReadOnly), + m_Writable(_aWritable), + m_DefinitelyWritable(_aDefinitelyWritable) + { + if(!m_ColumnLabel.getLength()) + m_ColumnLabel = _aColumnName; + } + + sal_Bool isAutoIncrement() const { return m_AutoIncrement; } + sal_Bool isCaseSensitive() const { return m_CaseSensitive; } + sal_Bool isSearchable() const { return m_Searchable; } + sal_Bool isCurrency() const { return m_Currency; } + sal_Bool isSigned() const { return m_Signed; } + sal_Bool isReadOnly() const { return m_ReadOnly; } + sal_Bool isWritable() const { return m_Writable; } + sal_Bool isDefinitelyWritable() const { return m_DefinitelyWritable; } + + sal_Int32 isNullable() const { return m_Nullable; } + sal_Int32 getColumnDisplaySize() const { return m_ColumnDisplaySize; } + sal_Int32 getPrecision() const { return m_Precision; } + sal_Int32 getScale() const { return m_Scale; } + sal_Int32 getColumnType() const { return m_ColumnType; } + + const ::rtl::OUString& getColumnLabel() const { return m_ColumnLabel; } + const ::rtl::OUString& getColumnName() const { return m_ColumnName; } + const ::rtl::OUString& getSchemaName() const { return m_SchemaName; } + const ::rtl::OUString& getTableName() const { return m_TableName; } + const ::rtl::OUString& getCatalogName() const { return m_CatalogName; } + const ::rtl::OUString& getColumnTypeName() const { return m_ColumnTypeName; } + const ::rtl::OUString& getColumnServiceName() const { return m_ColumnServiceName; } + + }; +} + +#endif //_CONNECTIVITY_COLUMN_HXX_ + diff --git a/connectivity/source/inc/OSubComponent.hxx b/connectivity/source/inc/OSubComponent.hxx new file mode 100644 index 000000000000..da7f1f48bada --- /dev/null +++ b/connectivity/source/inc/OSubComponent.hxx @@ -0,0 +1,135 @@ +/************************************************************************* + * + * $RCSfile: OSubComponent.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_OSUBCOMPONENT_HXX_ +#define _CONNECTIVITY_OSUBCOMPONENT_HXX_ + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/Weak.hxx> +#endif + +namespace connectivity +{ + + //************************************************************ + // OSubComponent + //************************************************************ + template <class T > class OSubComponent + { + protected: + // the parent must support the tunnel implementation + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xParent; + T* m_pChildImpl; + + public: + OSubComponent(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xParent) : m_xParent(_xParent) + { + m_pChildImpl = (T*)this; + } + + + protected: + void dispose_ChildImpl() + { + ::osl::MutexGuard aGuard( m_pChildImpl->rBHelper.rMutex ); + m_xParent = NULL; + } + void relase_ChildImpl() + { + if (osl_decrementInterlockedCount( &m_pChildImpl->m_refCount ) == 0) + { + if (! m_pChildImpl->rBHelper.bDisposed) + { + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xHoldAlive( *m_pChildImpl ); + + // remember the parent + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xParent; + { + ::osl::MutexGuard aGuard( m_pChildImpl->rBHelper.rMutex ); + xParent = m_xParent; + m_xParent = NULL; + } + + // First dispose + m_pChildImpl->dispose(); + + // only the alive ref holds the object + OSL_ASSERT( m_pChildImpl->m_refCount == 1 ); + + // release the parent in the ~ + if (xParent.is()) + { + ::osl::MutexGuard aGuard( m_pChildImpl->rBHelper.rMutex ); + m_xParent = xParent; + } + + // destroy the object if xHoldAlive decrement the refcount to 0 + return; + } + } + // restore the reference count + osl_incrementInterlockedCount( &m_pChildImpl->m_refCount ); + // as we cover the job of the componenthelper we use the ... + // ((::cppu::OWeakObject*)m_pChildImpl)->release(); + } + }; +} +#endif // _CONNECTIVITY_OSUBCOMPONENT_HXX_ + diff --git a/connectivity/source/inc/OTypeInfo.hxx b/connectivity/source/inc/OTypeInfo.hxx new file mode 100644 index 000000000000..31812128ad6a --- /dev/null +++ b/connectivity/source/inc/OTypeInfo.hxx @@ -0,0 +1,119 @@ +/************************************************************************* + * + * $RCSfile: OTypeInfo.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_OTYPEINFO_HXX_ +#define _CONNECTIVITY_OTYPEINFO_HXX_ + +#ifndef _COM_SUN_STAR_SDBC_COLUMNSEARCH_HPP_ +#include <com/sun/star/sdbc/ColumnSearch.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif + +namespace connectivity +{ + namespace starsdbc2 = ::com::sun::star::sdbc; + + struct OTypeInfo + { + ::rtl::OUString aTypeName; // Name des Types in der Datenbank + ::rtl::OUString aLiteralPrefix; // Prefix zum Quoten + ::rtl::OUString aLiteralSuffix; // Suffix zum Quoten + ::rtl::OUString aCreateParams; // Parameter zum Erstellen + ::rtl::OUString aLocalTypeName; + + sal_Int32 nPrecision; // Laenge des Types + + sal_Int16 nMaximumScale; // Nachkommastellen + sal_Int16 nMinimumScale; // Min Nachkommastellen + + sal_Int16 nType; // Datenbanktyp + sal_Int16 nSearchType; // kann nach dem Typen gesucht werden + sal_Int16 nNumPrecRadix; // indicating the radix, which is usually 2 or 10 + + sal_Bool bCurrency : 1, // Waehrung + bAutoIncrement : 1, // Ist es ein automatisch incrementierendes Feld + bNullable : 1, // Kann das Feld NULL annehmen + bCaseSensitive : 1, // Ist der Type Casesensitive + bUnsigned : 1, // Ist der Type Unsigned + bEmpty_1 : 1, // for later use + bEmpty_2 : 1; + + OTypeInfo() + :bCurrency(sal_False) + ,bAutoIncrement(sal_False) + ,bNullable(sal_True) + ,bCaseSensitive(sal_False) + ,bUnsigned(sal_False) + ,nMaximumScale(0) + ,nMinimumScale(0) + ,nType(starsdbc2::DataType::OTHER) + ,nPrecision(0) + ,nSearchType(starsdbc2::ColumnSearch::FULL) + {} + sal_Bool operator == (const OTypeInfo& lh) const { return lh.nType == nType; } + sal_Bool operator != (const OTypeInfo& lh) const { return lh.nType != nType; } + }; +} +#endif // _CONNECTIVITY_OTYPEINFO_HXX_ + + diff --git a/connectivity/source/inc/adabas/BCatalog.hxx b/connectivity/source/inc/adabas/BCatalog.hxx new file mode 100644 index 000000000000..9d2fb25f1831 --- /dev/null +++ b/connectivity/source/inc/adabas/BCatalog.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * $RCSfile: BCatalog.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADABAS_CATALOG_HXX_ +#define _CONNECTIVITY_ADABAS_CATALOG_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_CATALOG_HXX_ +#include "connectivity/sdbcx/VCatalog.hxx" +#endif +#ifndef _CONNECTIVITY_OFUNCTIONDEFS_HXX_ +#include "odbc/OFunctiondefs.hxx" +#endif + +namespace connectivity +{ + namespace adabas + { + class OAdabasConnection; + class OAdabasCatalog : public connectivity::sdbcx::OCatalog + { + OAdabasConnection* m_pConnection; + SQLHANDLE m_aConnectionHdl; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; + + public: + virtual void refreshTables(); + virtual void refreshViews() ; + virtual void refreshGroups(); + virtual void refreshUsers() ; + + public: + OAdabasCatalog(SQLHANDLE _aConnectionHdl,OAdabasConnection* _pCon); + + OAdabasConnection* getConnection() { return m_pConnection; } + }; + } +} +#endif // _CONNECTIVITY_ADABAS_CATALOG_HXX_ + diff --git a/connectivity/source/inc/adabas/BColumn.hxx b/connectivity/source/inc/adabas/BColumn.hxx new file mode 100644 index 000000000000..530fb4414531 --- /dev/null +++ b/connectivity/source/inc/adabas/BColumn.hxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * $RCSfile: BColumn.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_COLUMN_HXX_ +#define _CONNECTIVITY_ADABAS_COLUMN_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ +#include "connectivity/sdbcx/VColumn.hxx" +#endif + +namespace connectivity +{ + namespace adabas + { + class OAdabasColumn : public sdbcx::OColumn + { + public: + OAdabasColumn(); + OAdabasColumn(const ::rtl::OUString& _Name, + const ::rtl::OUString& _TypeName, + const ::rtl::OUString& _DefaultValue, + sal_Int32 _IsNullable, + sal_Int32 _Precision, + sal_Int32 _Scale, + sal_Int32 _Type, + sal_Bool _IsAutoIncrement); + + }; + } +} +#endif // _CONNECTIVITY_ADABAS_COLUMN_HXX_ + diff --git a/connectivity/source/inc/adabas/BColumns.hxx b/connectivity/source/inc/adabas/BColumns.hxx new file mode 100644 index 000000000000..dc847c57d716 --- /dev/null +++ b/connectivity/source/inc/adabas/BColumns.hxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * $RCSfile: BColumns.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_COLUMNS_HXX_ +#define _CONNECTIVITY_ADABAS_COLUMNS_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#endif +#ifndef _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_ +#include "connectivity/sdbcx/IRefreshable.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_TABLE_HXX_ +#include "adabas/BTable.hxx" +#endif + +namespace connectivity +{ + namespace adabas + { + class OColumns : public sdbcx::OCollection + { + protected: + OAdabasTable* m_pTable; + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + public: + OColumns( OAdabasTable* _pTable, + ::osl::Mutex& _rMutex, + const ::std::vector< ::rtl::OUString> &_rVector + ) : sdbcx::OCollection(*_pTable,sal_True,_rMutex,_rVector) + ,m_pTable(_pTable) + {} + + // XAppend + virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + // XDrop + virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_ADABAS_COLUMNS_HXX_ + diff --git a/connectivity/source/inc/adabas/BConnection.hxx b/connectivity/source/inc/adabas/BConnection.hxx new file mode 100644 index 000000000000..621ae1151ffd --- /dev/null +++ b/connectivity/source/inc/adabas/BConnection.hxx @@ -0,0 +1,112 @@ +/************************************************************************* + * + * $RCSfile: BConnection.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADABAS_BCONNECTION_HXX_ +#define _CONNECTIVITY_ADABAS_BCONNECTION_HXX_ + +#ifndef _CPPUHELPER_COMPBASE2_HXX_ +#include <cppuhelper/compbase2.hxx> +#endif +#ifndef _CONNECTIVITY_ODBC_OCONNECTION_HXX_ +#include "odbc/OConnection.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XTablesSupplier.hpp> +#endif +#ifndef _CPPUHELPER_WEAKREF_HXX_ +#include <cppuhelper/weakref.hxx> +#endif + +namespace connectivity +{ + namespace odbc + { + class ODBCDriver; + } + namespace adabas + { + typedef connectivity::odbc::OConnection OConnection_BASE2; + + // we must use the name "OAdabasConnection" because of a compiler bug + + class OAdabasConnection : public OConnection_BASE2 + { + ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbcx::XTablesSupplier> m_xCatalog; + + sal_Bool isStarted(); + + protected: + virtual SQLRETURN OpenConnection(const ::rtl::OUString& aConnectStr,sal_Int32 nTimeOut, const ::rtl::OUString& _uid,const ::rtl::OUString& _pwd); + public: + virtual SQLRETURN Construct( const ::rtl::OUString& url,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info) throw(::com::sun::star::sdbc::SQLException); + + OAdabasConnection(const SQLHANDLE _pDriverHandle,connectivity::odbc::ODBCDriver* _pDriver); + + // OComponentHelper; + virtual void SAL_CALL disposing(); + + ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > createCatalog(); + + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_ADABAS_BCONNECTION_HXX_ + diff --git a/connectivity/source/inc/adabas/BDatabaseMetaData.hxx b/connectivity/source/inc/adabas/BDatabaseMetaData.hxx new file mode 100644 index 000000000000..7b2714b8c721 --- /dev/null +++ b/connectivity/source/inc/adabas/BDatabaseMetaData.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * $RCSfile: BDatabaseMetaData.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ODBC_ODATABASEMETADATA_HXX_ +#include "odbc/ODatabaseMetaData.hxx" +#endif + +namespace connectivity +{ + namespace odbc + { + class OConnection; + } + namespace adabas + { + typedef odbc::ODatabaseMetaData OAdabasDatabaseMetaData_BASE; + + class OAdabasDatabaseMetaData : public OAdabasDatabaseMetaData_BASE + { + public: + OAdabasDatabaseMetaData(const SQLHANDLE _pHandle,odbc::OConnection* _pCon) + : ODatabaseMetaData(_pHandle,_pCon) + { + } + + virtual ::rtl::OUString SAL_CALL getURL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} + diff --git a/connectivity/source/inc/adabas/BDriver.hxx b/connectivity/source/inc/adabas/BDriver.hxx new file mode 100644 index 000000000000..74ce2ed48bfb --- /dev/null +++ b/connectivity/source/inc/adabas/BDriver.hxx @@ -0,0 +1,129 @@ +/************************************************************************* + * + * $RCSfile: BDriver.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_BDRIVER_HXX_ +#define _CONNECTIVITY_ADABAS_BDRIVER_HXX_ + +#ifndef _COM_SUN_STAR_SDBC_XDRIVER_HPP_ +#include <com/sun/star/sdbc/XDriver.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XDATADEFINITIONSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XTablesSupplier.hpp> +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif +#ifndef _CONNECTIVITY_OFUNCTIONDEFS_HXX_ +#include "odbc/OFunctiondefs.hxx" +#endif +#ifndef _CONNECTIVITY_ODBC_ODRIVER_HXX_ +#include "odbc/ODriver.hxx" +#endif + +namespace connectivity +{ + namespace adabas + { + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ODriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ); + + typedef odbc::ODBCDriver ODriver_BASE; + + class ODriver : public ODriver_BASE, + public ::com::sun::star::sdbcx::XDataDefinitionSupplier + { + ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbcx::XTablesSupplier> m_xCatalog; + protected: + virtual SQLHANDLE EnvironmentHandle(::rtl::OUString &_rPath); + public: + + DECLARE_CTY_DEFAULTS(ODriver_BASE); + DECLARE_SERVICE_INFO(); + + ODriver(); + ~ODriver(){} + + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + + // XDriver + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMajorVersion( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMinorVersion( ) throw(::com::sun::star::uno::RuntimeException); + + // XDataDefinitionSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& connection ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } + +} +#endif //_CONNECTIVITY_ADABAS_BDRIVER_HXX_ + + diff --git a/connectivity/source/inc/adabas/BGroup.hxx b/connectivity/source/inc/adabas/BGroup.hxx new file mode 100644 index 000000000000..66e4b511363c --- /dev/null +++ b/connectivity/source/inc/adabas/BGroup.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * $RCSfile: BGroup.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_GROUP_HXX_ +#define _CONNECTIVITY_ADABAS_GROUP_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_GROUP_HXX_ +#include "connectivity/sdbcx/VGroup.hxx" +#endif + +namespace connectivity +{ + namespace adabas + { + class OAdabasConnection; + class OAdabasGroup : public sdbcx::OGroup + { + OAdabasConnection* m_pConnection; + public: + virtual void refreshUsers(); + public: + OAdabasGroup( OAdabasConnection* _pConnection); + OAdabasGroup( OAdabasConnection* _pConnection,const ::rtl::OUString& _Name); + }; + } +} +#endif // _CONNECTIVITY_ADABAS_GROUP_HXX_ + diff --git a/connectivity/source/inc/adabas/BGroups.hxx b/connectivity/source/inc/adabas/BGroups.hxx new file mode 100644 index 000000000000..917cdcff9756 --- /dev/null +++ b/connectivity/source/inc/adabas/BGroups.hxx @@ -0,0 +1,106 @@ +/************************************************************************* + * + * $RCSfile: BGroups.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_GROUPS_HXX_ +#define _CONNECTIVITY_ADABAS_GROUPS_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +namespace connectivity +{ + namespace sdbcx + { + class IRefreshableGroups; + } + namespace adabas + { + class OAdabasConnection; + class OGroups : public sdbcx::OCollection + { + protected: + OAdabasConnection* m_pConnection; + connectivity::sdbcx::IRefreshableGroups* m_pParent; + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + public: + OGroups(::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const ::std::vector< ::rtl::OUString> &_rVector, + OAdabasConnection* _pConnection, + connectivity::sdbcx::IRefreshableGroups* _pParent) : sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector) + ,m_pConnection(_pConnection) + ,m_pParent(_pParent) + {} + + // XAppend + virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + // XDrop + virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + }; + } +} + +#endif // _CONNECTIVITY_ADABAS_GROUPS_HXX_ + diff --git a/connectivity/source/inc/adabas/BIndex.hxx b/connectivity/source/inc/adabas/BIndex.hxx new file mode 100644 index 000000000000..229d32cf9931 --- /dev/null +++ b/connectivity/source/inc/adabas/BIndex.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * $RCSfile: BIndex.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_INDEX_HXX_ +#define _CONNECTIVITY_ADABAS_INDEX_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_INDEX_HXX_ +#include "connectivity/sdbcx/VIndex.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#endif + +namespace connectivity +{ + namespace adabas + { + class OAdabasTable; + class OAdabasIndex : public sdbcx::OIndex + { + OAdabasTable* m_pTable; + public: + virtual void refreshColumns(); + public: + OAdabasIndex( OAdabasTable* _pTable); + OAdabasIndex( OAdabasTable* _pTable, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _Catalog, + sal_Bool _isUnique, + sal_Bool _isPrimaryKeyIndex, + sal_Bool _isClustered + ); + OAdabasTable* getTable() const { return m_pTable; } + }; + } +} +#endif // _CONNECTIVITY_ADABAS_INDEX_HXX_ + diff --git a/connectivity/source/inc/adabas/BIndexColumn.hxx b/connectivity/source/inc/adabas/BIndexColumn.hxx new file mode 100644 index 000000000000..9385c00f0318 --- /dev/null +++ b/connectivity/source/inc/adabas/BIndexColumn.hxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * $RCSfile: BIndexColumn.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_INDEXCOLUMN_HXX_ +#define _CONNECTIVITY_ADABAS_INDEXCOLUMN_HXX_ + +#ifndef _CONNECTIVITY_ADABAS_COLUMN_HXX_ +#include "adabas/BColumn.hxx" +#endif + +namespace connectivity +{ + namespace adabas + { + class OIndexColumn : public OAdabasColumn + { + protected: + sal_Bool m_IsAscending; + public: + OIndexColumn(); + OIndexColumn( sal_Bool _IsAscending, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _TypeName, + const ::rtl::OUString& _DefaultValue, + sal_Int32 _IsNullable, + sal_Int32 _Precision, + sal_Int32 _Scale, + sal_Int32 _Type, + sal_Bool _IsAutoIncrement); + + virtual void construct(); + }; + } +} +#endif // _CONNECTIVITY_ADABAS_INDEXCOLUMN_HXX_ + diff --git a/connectivity/source/inc/adabas/BIndexColumns.hxx b/connectivity/source/inc/adabas/BIndexColumns.hxx new file mode 100644 index 000000000000..93632d29f7bc --- /dev/null +++ b/connectivity/source/inc/adabas/BIndexColumns.hxx @@ -0,0 +1,98 @@ +/************************************************************************* + * + * $RCSfile: BIndexColumns.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_INDEXCOLUMNS_HXX_ +#define _CONNECTIVITY_ADABAS_INDEXCOLUMNS_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _CONNECTIVITY_ADABAS_INDEX_HXX_ +#include "adabas/BIndex.hxx" +#endif + +namespace connectivity +{ + namespace adabas + { + class OIndexColumns : public sdbcx::OCollection + { + OAdabasIndex* m_pIndex; + protected: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException) + { + m_pIndex->refreshColumns(); + } + public: + OIndexColumns( OAdabasIndex* _pIndex, + ::osl::Mutex& _rMutex, + const ::std::vector< ::rtl::OUString> &_rVector) + : sdbcx::OCollection(*_pIndex,sal_True,_rMutex,_rVector) + ,m_pIndex(_pIndex) + { + } + }; + } +} +#endif // _CONNECTIVITY_ADABAS_INDEXCOLUMNS_HXX_ + diff --git a/connectivity/source/inc/adabas/BIndexes.hxx b/connectivity/source/inc/adabas/BIndexes.hxx new file mode 100644 index 000000000000..210260c2c0c2 --- /dev/null +++ b/connectivity/source/inc/adabas/BIndexes.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * $RCSfile: BIndexes.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADABAS_INDEXES_HXX_ +#define _CONNECTIVITY_ADABAS_INDEXES_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#endif +#ifndef _CONNECTIVITY_ADABAS_TABLE_HXX_ +#include "adabas/BTable.hxx" +#endif +namespace connectivity +{ + namespace adabas + { + class OIndexes : public sdbcx::OCollection + { + OAdabasTable* m_pTable; + protected: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + public: + OIndexes(OAdabasTable* _pTable, + ::osl::Mutex& _rMutex, + const ::std::vector< ::rtl::OUString> &_rVector + ) : sdbcx::OCollection(*_pTable,sal_True,_rMutex,_rVector) + ,m_pTable(_pTable) + {} + + // XAppend + virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + // XDrop + virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + }; + } +} + +#endif // _CONNECTIVITY_ADABAS_INDEXES_HXX_ + diff --git a/connectivity/source/inc/adabas/BKeys.hxx b/connectivity/source/inc/adabas/BKeys.hxx new file mode 100644 index 000000000000..b4112dfc3742 --- /dev/null +++ b/connectivity/source/inc/adabas/BKeys.hxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * $RCSfile: BKeys.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_KEYS_HXX_ +#define _CONNECTIVITY_ADABAS_KEYS_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#endif +#ifndef _CONNECTIVITY_ADABAS_TABLE_HXX_ +#include "adabas/BTable.hxx" +#endif +namespace connectivity +{ + namespace adabas + { + class OKeys : public sdbcx::OCollection + { + OAdabasTable* m_pTable; + protected: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + public: + OKeys(OAdabasTable* _pTable, + ::osl::Mutex& _rMutex, + const ::std::vector< ::rtl::OUString> &_rVector + ) : sdbcx::OCollection(*_pTable,sal_True,_rMutex,_rVector) + ,m_pTable(_pTable) + {} + //XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // XAppend + virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + // XDrop + virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + }; + } +} + +#endif // _CONNECTIVITY_ADABAS_KEYS_HXX_ + diff --git a/connectivity/source/inc/adabas/BTable.hxx b/connectivity/source/inc/adabas/BTable.hxx new file mode 100644 index 000000000000..5a7e6e246203 --- /dev/null +++ b/connectivity/source/inc/adabas/BTable.hxx @@ -0,0 +1,135 @@ +/************************************************************************* + * + * $RCSfile: BTable.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_TABLE_HXX_ +#define _CONNECTIVITY_ADABAS_TABLE_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_TABLE_HXX_ +#include "connectivity/sdbcx/VTable.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ +#include <com/sun/star/lang/XUnoTunnel.hpp> +#endif +#ifndef _CONNECTIVITY_ADABAS_BCONNECTION_HXX_ +#include "adabas/BConnection.hxx" +#endif + +namespace connectivity +{ + namespace adabas + { + typedef connectivity::sdbcx::OTable OTable_TYPEDEF; + + ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xColProp); + + class OAdabasTable : public OTable_TYPEDEF, + public ::com::sun::star::lang::XUnoTunnel + { + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; + OAdabasConnection* m_pConnection; + + void refreshPrimaryKeys(std::vector< ::rtl::OUString>& _rKeys); + void refreshForgeinKeys(std::vector< ::rtl::OUString>& _rKeys); + + public: + virtual void refreshColumns(); + virtual void refreshKeys(); + virtual void refreshIndexes(); + + public: + DECLARE_CTY_DEFAULTS( OTable_TYPEDEF); + OAdabasTable( OAdabasConnection* _pConnection); + OAdabasTable( OAdabasConnection* _pConnection, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _Type, + const ::rtl::OUString& _Description = ::rtl::OUString(), + const ::rtl::OUString& _SchemaName = ::rtl::OUString(), + const ::rtl::OUString& _CatalogName = ::rtl::OUString() + ); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + OAdabasConnection* getConnection() { return m_pConnection;} + + const ::rtl::OUString& getName() const { return m_Name; } + const ::rtl::OUString& getSchema() const { return m_SchemaName; } + // com::sun::star::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + + // XRename + virtual void SAL_CALL rename( const ::rtl::OUString& newName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + + // XAlterTable + virtual void SAL_CALL alterColumnByName( const ::rtl::OUString& colName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL alterColumnByIndex( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + // + sal_Bool create() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_ADABAS_TABLE_HXX_ + diff --git a/connectivity/source/inc/adabas/BTables.hxx b/connectivity/source/inc/adabas/BTables.hxx new file mode 100644 index 000000000000..b81d1016b118 --- /dev/null +++ b/connectivity/source/inc/adabas/BTables.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * $RCSfile: BTables.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADABAS_TABLES_HXX_ +#define _CONNECTIVITY_ADABAS_TABLES_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#endif +namespace connectivity +{ + namespace adabas + { + class OTables : public sdbcx::OCollection + { + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; + // OCatalog* m_pParent; + protected: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + void setComments(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + public: + OTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, + const ::std::vector< ::rtl::OUString> &_rVector) : sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector) + ,m_xMetaData(_rMetaData) + // ,m_pParent(_pParent) + {} + + // only the name is identical to ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + + // XAppend + virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + // XDrop + virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_ADABAS_TABLES_HXX_ + diff --git a/connectivity/source/inc/adabas/BUser.hxx b/connectivity/source/inc/adabas/BUser.hxx new file mode 100644 index 000000000000..2fbba63872cb --- /dev/null +++ b/connectivity/source/inc/adabas/BUser.hxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * $RCSfile: BUser.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_USER_HXX_ +#define _CONNECTIVITY_ADABAS_USER_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_USER_HXX_ +#include "connectivity/sdbcx/VUser.hxx" +#endif + +namespace connectivity +{ + namespace adabas + { + class OAdabasConnection; + typedef connectivity::sdbcx::OUser OUser_TYPEDEF; + + class OAdabasUser : public OUser_TYPEDEF + { + OAdabasConnection* m_pConnection; + public: + virtual void refreshGroups(); + public: + OAdabasUser( OAdabasConnection* _pConnection); + OAdabasUser( OAdabasConnection* _pConnection,const ::rtl::OUString& _Name); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + }; + + class OUserExtend; + typedef ::utl::OPropertyArrayUsageHelper<OUserExtend> OUserExtend_PROP; + + class OUserExtend : public OAdabasUser, + public OUserExtend_PROP + { + protected: + ::rtl::OUString m_Password; + DECLARE_CTY_PROPERTY(OAdabasUser,OUserExtend) + public: + OUserExtend(OAdabasConnection* _pConnection); + OUserExtend(OAdabasConnection* _pConnection,const ::rtl::OUString& _Name); + + virtual void construct(); + }; + } +} +#endif // _CONNECTIVITY_ADABAS_USER_HXX_ + diff --git a/connectivity/source/inc/adabas/BUsers.hxx b/connectivity/source/inc/adabas/BUsers.hxx new file mode 100644 index 000000000000..cbe7037235b7 --- /dev/null +++ b/connectivity/source/inc/adabas/BUsers.hxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * $RCSfile: BUsers.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_USERS_HXX_ +#define _CONNECTIVITY_ADABAS_USERS_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +namespace connectivity +{ + namespace sdbcx + { + class IRefreshableUsers; + } + namespace adabas + { + class OAdabasConnection; + class OUsers : public sdbcx::OCollection + { + OAdabasConnection* m_pConnection; + connectivity::sdbcx::IRefreshableUsers* m_pParent; + public: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + public: + OUsers( ::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const ::std::vector< ::rtl::OUString> &_rVector, + OAdabasConnection* _pConnection, + connectivity::sdbcx::IRefreshableUsers* _pParent) : sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector) + ,m_pConnection(_pConnection) + ,m_pParent(_pParent) + {} + + // XAppend + virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + // XDrop + virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + }; + } +} + +#endif // _CONNECTIVITY_ADABAS_USERS_HXX_ + diff --git a/connectivity/source/inc/ado/ACallableStatement.hxx b/connectivity/source/inc/ado/ACallableStatement.hxx new file mode 100644 index 000000000000..7009ba80a151 --- /dev/null +++ b/connectivity/source/inc/ado/ACallableStatement.hxx @@ -0,0 +1,129 @@ +/************************************************************************* + * + * $RCSfile: ACallableStatement.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_ACALLABLESTATEMENT_HXX_ +#define _CONNECTIVITY_ADO_ACALLABLESTATEMENT_HXX_ + +#ifndef _CONNECTIVITY_ADO_APREPAREDSTATEMENT_HXX_ +#include "ado/APreparedStatement.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XOUTPARAMETERS_HPP_ +#include <com/sun/star/sdbc/XOutParameters.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif + +namespace connectivity +{ + namespace ado + { + //************************************************************** + //************ Class: java.sql.CallableStatement + //************************************************************** + + class OCallableStatement : public OPreparedStatement, + public ::com::sun::star::sdbc::XRow, + public ::com::sun::star::sdbc::XOutParameters + { + OLEVariant m_aValue; + public: + DECLARE_CTY_DEFAULTS(OPreparedStatement); + DECLARE_SERVICE_INFO(); + virtual ~OCallableStatement() {} ; + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OCallableStatement( OConnection* _pConnection,const ::std::vector<OTypeInfo>& _TypeInfo,const ::rtl::OUString& sql ); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + + // XRow + virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XOutParameters + virtual void SAL_CALL registerOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_OCallableStatement_HXX_ + + diff --git a/connectivity/source/inc/ado/ACatalog.hxx b/connectivity/source/inc/ado/ACatalog.hxx new file mode 100644 index 000000000000..dbc99f046c0d --- /dev/null +++ b/connectivity/source/inc/ado/ACatalog.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * $RCSfile: ACatalog.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADO_CATALOG_HXX_ +#define _CONNECTIVITY_ADO_CATALOG_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_CATALOG_HXX_ +#include "connectivity/sdbcx/VCatalog.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_AWRAPADOX_HXX_ +#include "ado/Awrapadox.hxx" +#endif + +namespace connectivity +{ + namespace ado + { + class OConnection; + + class OCatalog : public connectivity::sdbcx::OCatalog + { + WpADOCatalog m_aCatalog; + OConnection* m_pConnection; + + public: + virtual void refreshTables(); + virtual void refreshViews() ; + virtual void refreshGroups(); + virtual void refreshUsers() ; + + public: + OCatalog(_ADOCatalog* _pCatalog,OConnection* _pCon); + + OConnection* getConnection() { return m_pConnection; } + }; + } +} +#endif // _CONNECTIVITY_ADO_CATALOG_HXX_ + diff --git a/connectivity/source/inc/ado/ACollection.hxx b/connectivity/source/inc/ado/ACollection.hxx new file mode 100644 index 000000000000..13d5c91de160 --- /dev/null +++ b/connectivity/source/inc/ado/ACollection.hxx @@ -0,0 +1,274 @@ +/************************************************************************* + * + * $RCSfile: ACollection.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_COLLECTION_HXX_ +#define _CONNECTIVITY_ADO_COLLECTION_HXX_ + +#ifndef _CPPUHELPER_IMPLBASE3_HXX_ +#include <cppuhelper/implbase3.hxx> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ +#include <com/sun/star/container/XNameAccess.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_ +#include <com/sun/star/container/XIndexAccess.hpp> +#endif +#ifndef _CONNECTIVITY_ADO_AWRAPADOX_HXX_ +#include "ado/Awrapadox.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_AOLEVARIANT_HXX_ +#include "ado/Aolevariant.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif + +namespace connectivity +{ + namespace ado + { + namespace starcontainer = ::com::sun::star::container; + namespace starlang = ::com::sun::star::lang; + namespace staruno = ::com::sun::star::uno; + namespace starbeans = ::com::sun::star::beans; + + typedef ::cppu::WeakImplHelper3< starcontainer::XNameAccess, + starcontainer::XIndexAccess, + starlang::XServiceInfo> OCollectionBase; + + //************************************************************ + // OCollection + //************************************************************ + template <class T,class SimT,class OCl> class OCollection : public OCollectionBase + { + protected: + vector<OCl*> m_aElements; + ::cppu::OWeakObject& m_rParent; + ::osl::Mutex& m_rMutex; // mutex of the parent + T* m_pCollection; + + + public: + OCollection(::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,T* _pCollection) + : m_rParent(_rParent) + ,m_rMutex(_rMutex) + ,m_pCollection(_pCollection) + { + m_pCollection->AddRef(); + } + + ~OCollection() + { + m_pCollection->Release(); + } + + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (staruno::RuntimeException) + { + return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.ACollection"); + } + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& _rServiceName ) throw(staruno::RuntimeException) + { + staruno::Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + const ::rtl::OUString* pSupported = aSupported.getConstArray(); + for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) + if (pSupported->equals(_rServiceName)) + return sal_True; + + return sal_False; + } + virtual staruno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(staruno::RuntimeException) + { + staruno::Sequence< ::rtl::OUString > aSupported(1); + aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.Container"); + return aSupported; + } + + // dispatch the refcounting to the parent + virtual void SAL_CALL acquire() throw(staruno::RuntimeException) + { + m_rParent.acquire(); + } + virtual void SAL_CALL release() throw(staruno::RuntimeException) + { + m_rParent.release(); + } + + // ::com::sun::star::container::XElementAccess + virtual staruno::Type SAL_CALL getElementType( ) throw(staruno::RuntimeException) + { + return::getCppuType(static_cast< staruno::Reference< starbeans::XPropertySet>*>(NULL)); + } + + virtual sal_Bool SAL_CALL hasElements( ) throw(staruno::RuntimeException) + { + ::osl::MutexGuard aGuard(m_rMutex); + return getCount() > 0; + } + + // starcontainer::XIndexAccess + virtual sal_Int32 SAL_CALL getCount( ) throw(staruno::RuntimeException) + { + ::osl::MutexGuard aGuard(m_rMutex); + sal_Int32 nCnt = 0; + m_pCollection->get_Count(&nCnt); + return nCnt; + } + + virtual staruno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(starlang::IndexOutOfBoundsException, starlang::WrappedTargetException, staruno::RuntimeException) + { + ::osl::MutexGuard aGuard(m_rMutex); + if (Index < 0 || Index >= getCount()) + throw starlang::IndexOutOfBoundsException(); + SimT* pCol = NULL; + m_pCollection->get_Item(OLEVariant(Index),&pCol); + if(!pCol) + throw starlang::IndexOutOfBoundsException(); + + OCl* pIndex = new OCl(pCol); + + m_aElements.push_back(pIndex); + + return staruno::makeAny( staruno::Reference< starbeans::XPropertySet >(pIndex)); + } + + + // starcontainer::XNameAccess + virtual staruno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(starcontainer::NoSuchElementException, starlang::WrappedTargetException, staruno::RuntimeException) + { + ::osl::MutexGuard aGuard(m_rMutex); + + SimT* pCol = NULL; + m_pCollection->get_Item(OLEVariant(aName),&pCol); + if(!pCol) + throw starlang::IndexOutOfBoundsException(); + + OCl* pIndex = new OCl(pCol); + + m_aElements.push_back(pIndex); + + return staruno::makeAny( staruno::Reference< starbeans::XPropertySet >(pIndex)); + } + virtual staruno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(staruno::RuntimeException) + { + ::osl::MutexGuard aGuard(m_rMutex); + sal_Int32 nLen = getCount(); + staruno::Sequence< ::rtl::OUString > aNameList(nLen); + + ::rtl::OUString* pStringArray = aNameList.getArray(); + OLEVariant aVar; + for (sal_Int32 i=0;i<nLen;++i) + { + aVar.setInt32(i); + SimT* pIdx = NULL; + m_pCollection->get_Item(aVar,&pIdx); + pIdx->AddRef(); + BSTR aBSTR; + pIdx->get_Name(&aBSTR); + (*pStringArray) = (sal_Unicode*)aBSTR; + SysFreeString(aBSTR); + pIdx->Release(); + ++pStringArray; + } + return aNameList; + } + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(staruno::RuntimeException) + { + ::osl::MutexGuard aGuard(m_rMutex); + SimT* pCol = NULL; + m_pCollection->get_Item(OLEVariant(aName),&pCol); + return pCol != NULL; + } + + void SAL_CALL disposing() + { + ::osl::MutexGuard aGuard(m_rMutex); + for (::std::vector<OCl*>::const_iterator i = m_aElements.begin(); i != m_aElements.end(); ++i) + { + (*i)->disposing(); + (*i)->release(); + } + m_aElements.clear(); + } + + }; + + class OIndex; + class OKey; + class OColumn; + class OTable; + class OView; + class OGroup; + class OUser; + + typedef OCollection< ADOIndexes,ADOIndex,OIndex> OIndexes; + typedef OCollection< ADOKeys,ADOKey,OKey> OKeys; + typedef OCollection< ADOColumns,ADOColumn,OColumn> OColumns; + typedef OCollection< ADOTables,ADOTable,OTable> OTables; + typedef OCollection< ADOViews,ADOView,OView> OViews; + typedef OCollection< ADOGroups,ADOGroup,OGroup> OGroups; + typedef OCollection< ADOUsers,ADOUser,OUser> OUsers; + + } +} +#endif // _CONNECTIVITY_ADO_COLLECTION_HXX_ + + + diff --git a/connectivity/source/inc/ado/AColumn.hxx b/connectivity/source/inc/ado/AColumn.hxx new file mode 100644 index 000000000000..cff2e1e6fb82 --- /dev/null +++ b/connectivity/source/inc/ado/AColumn.hxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * $RCSfile: AColumn.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_COLUMN_HXX_ +#define _CONNECTIVITY_ADO_COLUMN_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ +#include "connectivity/sdbcx/VColumn.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_AWRAPADOX_HXX_ +#include "ado/Awrapadox.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ +#include <com/sun/star/lang/XUnoTunnel.hpp> +#endif + +namespace connectivity +{ + namespace ado + { + typedef sdbcx::OColumn OColumn_ADO; + class OAdoColumn : public OColumn_ADO, + public ::com::sun::star::lang::XUnoTunnel + { + WpADOColumn m_aColumn; + protected: + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue + ) + throw (::com::sun::star::uno::Exception); + virtual void SAL_CALL getFastPropertyValue( + ::com::sun::star::uno::Any& rValue, + sal_Int32 nHandle + ) const; + public: + DECLARE_CTY_DEFAULTS( OColumn_ADO); + + OAdoColumn(sal_Bool _bCase,_ADOColumn* _pColumn = NULL); + OAdoColumn(const ::rtl::OUString& _Name, + const ::rtl::OUString& _TypeName, + const ::rtl::OUString& _DefaultValue, + sal_Int32 _IsNullable, + sal_Int32 _Precision, + sal_Int32 _Scale, + sal_Int32 _Type, + sal_Bool _IsAutoIncrement, + sal_Bool _IsCurrency, + sal_Bool _bCase); + + // virtual void construct(); + + // XInterface + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // com::sun::star::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + + WpADOColumn getColumnImpl() const { return m_aColumn;} + }; + } +} +#endif // _CONNECTIVITY_ADO_COLUMN_HXX_ + diff --git a/connectivity/source/inc/ado/AColumns.hxx b/connectivity/source/inc/ado/AColumns.hxx new file mode 100644 index 000000000000..0be84e819525 --- /dev/null +++ b/connectivity/source/inc/ado/AColumns.hxx @@ -0,0 +1,117 @@ +/************************************************************************* + * + * $RCSfile: AColumns.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_COLUMNS_HXX_ +#define _CONNECTIVITY_ADO_COLUMNS_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#endif +#ifndef _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_ +#include "connectivity/sdbcx/IRefreshable.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_AWRAPADOX_HXX_ +#include "ado/Awrapadox.hxx" +#endif + +namespace connectivity +{ + namespace ado + { + + class OColumns : public sdbcx::OCollection + { + protected: + ADOColumns* m_pCollection; + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + public: + OColumns( ::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const ::std::vector< ::rtl::OUString> &_rVector, + ADOColumns* _pCollection,sal_Bool _bCase) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector) + ,m_pCollection(_pCollection) + { + if(m_pCollection) + m_pCollection->AddRef(); + } + + ~OColumns() + { + if(m_pCollection) + m_pCollection->Release(); + } + + // XAppend + virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + // XDrop + virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_ADO_COLUMNS_HXX_ + diff --git a/connectivity/source/inc/ado/AConnection.hxx b/connectivity/source/inc/ado/AConnection.hxx new file mode 100644 index 000000000000..b3f2b7f4162b --- /dev/null +++ b/connectivity/source/inc/ado/AConnection.hxx @@ -0,0 +1,183 @@ +/************************************************************************* + * + * $RCSfile: AConnection.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADO_ACONNECTION_HXX_ +#define _CONNECTIVITY_ADO_ACONNECTION_HXX_ + +#ifndef _CPPUHELPER_COMPBASE3_HXX_ +#include <cppuhelper/compbase3.hxx> +#endif +#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ +#include <com/sun/star/sdbc/XConnection.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP_ +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_SQLWARNING_HPP_ +#include <com/sun/star/sdbc/SQLWarning.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XTablesSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ +#include <com/sun/star/beans/PropertyValue.hpp> +#endif +#ifndef _CONNECTIVITY_OSUBCOMPONENT_HXX_ +#include "OSubComponent.hxx" +#endif +#ifndef _MAP_ +#include <map> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _CONNECTIVITY_OTYPEINFO_HXX_ +#include "OTypeInfo.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif + +namespace connectivity +{ + namespace ado + { + typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbc::XConnection, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::lang::XServiceInfo> OConnection_BASE; + class WpADOConnection; + class ODriver; + + class OConnection : public OConnection_BASE, + public connectivity::OSubComponent<OConnection> + { + friend class connectivity::OSubComponent<OConnection>; + ::osl::Mutex m_aMutex; + + protected: + //==================================================================== + // Data attributes + //==================================================================== + ::std::vector<connectivity::OTypeInfo> m_aTypeInfo; // vector containing an entry + // for each row returned by + // DatabaseMetaData.getTypeInfo. + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; + + connectivity::OWeakRefArray m_aStatements; // vector containing a list + // of all the Statement objects + // for this Connection + ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbcx::XTablesSupplier> m_xCatalog; + ODriver* m_pDriver; + private: + WpADOConnection* m_pAdoConnection; + sal_Bool m_bClosed; + sal_Bool m_bAutocommit; + + protected: + void buildTypeInfo() throw( ::com::sun::star::sdbc::SQLException); + public: + + OConnection(const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info, + ODriver* _pDriver) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // OConnection(const SQLHANDLE _pConnectionHandle); + ~OConnection(); + void construct(const ::rtl::OUString& url,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info); + + DECLARE_SERVICE_INFO(); + + void closeAllStatements () throw( ::com::sun::star::sdbc::SQLException); + + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException); + + // XConnection + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL nativeSQL( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getAutoCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL commit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL rollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isClosed( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setCatalog( const ::rtl::OUString& catalog ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalog( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTypeMap( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTypeMap( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // + WpADOConnection* getConnection() { return m_pAdoConnection; } + void setCatalog(const ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbcx::XTablesSupplier>& _xCat) { m_xCatalog = _xCat; } + }; + } +} +#endif // _CONNECTIVITY_ADO_ACONNECTION_HXX_ + diff --git a/connectivity/source/inc/ado/ADatabaseMetaData.hxx b/connectivity/source/inc/ado/ADatabaseMetaData.hxx new file mode 100644 index 000000000000..8e2f03978c9e --- /dev/null +++ b/connectivity/source/inc/ado/ADatabaseMetaData.hxx @@ -0,0 +1,266 @@ +/************************************************************************* + * + * $RCSfile: ADatabaseMetaData.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_ADATABASEMETADATA_HXX_ +#define _CONNECTIVITY_ADO_ADATABASEMETADATA_HXX_ + +#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif +#ifndef _CONNECTIVITY_ADO_ACONNECTION_HXX_ +#include "ado/AConnection.hxx" +#endif + +namespace connectivity +{ + namespace ado + { + class WpADOConnection; + //************************************************************** + //************ Class: java.sql.DatabaseMetaDataDate + //************************************************************** + + class ODatabaseMetaData : public ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XDatabaseMetaData> + { + typedef struct _LiteralInfo + { + ::rtl::OUString pwszLiteralValue; + sal_uInt32 cchMaxLen; + sal_Bool fSupported; + } LiteralInfo; + + ::std::map<sal_uInt32,LiteralInfo> m_aLiteralInfo; + WpADOConnection* m_pADOConnection; + OConnection* m_pConnection; + + void fillLiterals() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // get information out of rowset + sal_Int32 getMaxSize(sal_uInt32 _nId) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Bool isCapable(sal_uInt32 _nId) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + ::rtl::OUString getLiteral(sal_uInt32 _nProperty) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + // get info out of propertyst + ::rtl::OUString getStringProperty(const ::rtl::OUString& _aProperty) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getInt32Property(const ::rtl::OUString& _aProperty) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Bool getBoolProperty(const ::rtl::OUString& _aProperty) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + public: + + ODatabaseMetaData(OConnection* _pCon); + + // XDatabaseMetaData + virtual sal_Bool SAL_CALL allProceduresAreCallable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL allTablesAreSelectable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getURL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getUserName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedLow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDatabaseProductName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDatabaseProductVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDriverName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDriverVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL usesLocalFiles( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMixedCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesMixedCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getIdentifierQuoteString( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSQLKeywords( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getNumericFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getStringFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSystemFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTimeDateFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSearchStringEscape( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getExtraNameCharacters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsAlterTableWithAddColumn( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsAlterTableWithDropColumn( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsColumnAliasing( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTypeConversion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSchemaTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getProcedureTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCatalogAtStart( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogSeparator( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInDataManipulation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInTableDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInDataManipulation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInTableDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsPositionedDelete( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsStoredProcedures( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsUnion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsUnionAll( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxConnections( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxIndexLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxRowSize( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxStatementLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxStatements( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxTablesInSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedures( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedureColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTables( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getSchemas( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCatalogs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTableTypes( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTablePrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getBestRowIdentifier( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope, sal_Bool nullable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getVersionColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getImportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getExportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCrossReference( const ::com::sun::star::uno::Any& primaryCatalog, const ::rtl::OUString& primarySchema, const ::rtl::OUString& primaryTable, const ::com::sun::star::uno::Any& foreignCatalog, const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTypeInfo( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getIndexInfo( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Bool unique, sal_Bool approximate ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsBatchUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getUDTs( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const ::com::sun::star::uno::Sequence< sal_Int32 >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_ADO_ADATABASEMETADATA_HXX_ + diff --git a/connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx b/connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx new file mode 100644 index 000000000000..9c4523490c0c --- /dev/null +++ b/connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx @@ -0,0 +1,284 @@ +/************************************************************************* + * + * $RCSfile: ADatabaseMetaDataResultSet.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_ADATABASEMETADATARESULTSET_HXX_ +#define _CONNECTIVITY_ADO_ADATABASEMETADATARESULTSET_HXX_ + +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_ +#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XCLOSEABLE_HPP_ +#include <com/sun/star/sdbc/XCloseable.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XCOLUMNLOCATE_HPP_ +#include <com/sun/star/sdbc/XColumnLocate.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_XCANCELLABLE_HPP_ +#include <com/sun/star/util/XCancellable.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP_ +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSETUPDATE_HPP_ +#include <com/sun/star/sdbc/XResultSetUpdate.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XROWUPDATE_HPP_ +#include <com/sun/star/sdbc/XRowUpdate.hpp> +#endif +#ifndef _CPPUHELPER_COMPBASE7_HXX_ +#include <cppuhelper/compbase7.hxx> +#endif +#ifndef _UNOTOOLS_PROPERTY_ARRAY_HELPER_HXX_ +#include <unotools/proparrhlp.hxx> +#endif +#ifndef _CONNECTIVITY_ADO_ASTATEMENT_HXX_ +#include "ado/AStatement.hxx" +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif + +namespace connectivity +{ + namespace ado + { + class ODatabaseMetaDataResultSetMetaData; + /* + ** java_sql_ResultSet + */ + typedef ::cppu::WeakComponentImplHelper7< ::com::sun::star::sdbc::XResultSet, + ::com::sun::star::sdbc::XRow, + ::com::sun::star::sdbc::XResultSetMetaDataSupplier, + ::com::sun::star::util::XCancellable, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::sdbc::XCloseable, + ::com::sun::star::sdbc::XColumnLocate> ODatabaseMetaDataResultSet_BASE; + + class ODatabaseMetaDataResultSet : public OBaseMutex, + public ODatabaseMetaDataResultSet_BASE, + public ::cppu::OPropertySetHelper, + public ::utl::OPropertyArrayUsageHelper<ODatabaseMetaDataResultSet> + { + ::std::vector<void*> m_aBindVector; + ::std::vector<sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 everytime + + ::std::map<sal_Int32, ::std::map<sal_Int32,sal_Int32> > m_aValueRange; + ::std::map<sal_Int32, ::std::map<sal_Int32,sal_Int32> >::iterator m_aValueRangeIter; + + ::std::map<sal_Int32, ::std::map< ::rtl::OUString,sal_Int32> > m_aStrValueRange; + ::std::map<sal_Int32, ::std::map< ::rtl::OUString,sal_Int32> >::iterator m_aStrValueRangeIter; + + ::std::map<sal_Int32, ::std::map< sal_Int32,::rtl::OUString> > m_aIntValueRange; + ::std::map<sal_Int32, ::std::map< sal_Int32,::rtl::OUString> >::iterator m_aIntValueRangeIter; + + ADORecordset* m_pRecordSet; + ::com::sun::star::uno::WeakReferenceHelper m_aStatement; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData; + OLEVariant m_aValue; + sal_Int32 m_nRowPos; + sal_Bool m_bWasNull; + sal_Bool m_bEOF; + sal_Bool m_bOnFirstAfterOpen; + + sal_Int32 getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getResultSetType() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getFetchDirection() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getFetchSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + ::rtl::OUString getCursorName() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + void setFetchDirection(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setFetchSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + + inline sal_Int32 mapColumn (sal_Int32 column); + + protected: + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + + virtual sal_Bool SAL_CALL convertFastPropertyValue( + ::com::sun::star::uno::Any & rConvertedValue, + ::com::sun::star::uno::Any & rOldValue, + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue ) + throw (::com::sun::star::lang::IllegalArgumentException); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue + ) + throw (::com::sun::star::uno::Exception); + virtual void SAL_CALL getFastPropertyValue( + ::com::sun::star::uno::Any& rValue, + sal_Int32 nHandle + ) const; + public: + DECLARE_CTY_DEFAULTS(ODatabaseMetaDataResultSet_BASE); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + ODatabaseMetaDataResultSet( ADORecordset* _pRecordSet); + ~ODatabaseMetaDataResultSet(); + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) + { + return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); + } + // XResultSet + virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRow + virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XResultSetMetaDataSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCancellable + virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + const ::std::vector<sal_Int32>& getColumnMapping() { return m_aColMapping; } + + void setCatalogsMap(); + void setSchemasMap(); + void setColumnPrivilegesMap(); + void setColumnsMap(); + void setTablesMap(); + void setProcedureColumnsMap(); + void setProceduresMap(); + void setExportedKeysMap(); + void setImportedKeysMap(); + void setPrimaryKeysMap(); + void setIndexInfoMap(); + void setTablePrivilegesMap(); + void setCrossReferenceMap(); + void setTypeInfoMap(); + }; + // ------------------------------------------------------------------------- + inline sal_Int32 ODatabaseMetaDataResultSet::mapColumn (sal_Int32 column) + { + sal_Int32 map = column; + + if (m_aColMapping.size()) + { + // Validate column number + map = m_aColMapping[column]; + } + + return map; + } + } + +} +#endif // _CONNECTIVITY_ADO_ADATABASEMETADATARESULTSET_HXX_ + diff --git a/connectivity/source/inc/ado/ADatabaseMetaDataResultSetMetaData.hxx b/connectivity/source/inc/ado/ADatabaseMetaDataResultSetMetaData.hxx new file mode 100644 index 000000000000..628ddbff1e29 --- /dev/null +++ b/connectivity/source/inc/ado/ADatabaseMetaDataResultSetMetaData.hxx @@ -0,0 +1,159 @@ +/************************************************************************* + * + * $RCSfile: ADatabaseMetaDataResultSetMetaData.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_ADATABASEMETADATARESULTSETMETADATA_HXX_ +#define _CONNECTIVITY_ADO_ADATABASEMETADATARESULTSETMETADATA_HXX_ + +#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATA_HPP_ +#include <com/sun/star/sdbc/XResultSetMetaData.hpp> +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif +#ifndef _VECTOR_ +#include <vector> +#endif + +#ifndef _CONNECTIVITY_ADO_AWRAPADO_HXX_ +#include "ado/Awrapado.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_ADATABASEMETADATARESULTSET_HXX_ +#include "ado/ADatabaseMetaDataResultSet.hxx" +#endif +#ifndef _CONNECTIVITY_COLUMN_HXX_ +#include "OColumn.hxx" +#endif + +namespace connectivity +{ + namespace ado + { + //************************************************************** + //************ Class: ResultSetMetaData + //************************************************************** + typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData> ODatabaseMetaResultSetMetaData_BASE; + + class ODatabaseMetaDataResultSetMetaData : public ODatabaseMetaResultSetMetaData_BASE + { + friend class ODatabaseMetaDataResultSet; + + const ::std::vector<sal_Int32> &m_vMapping; // when not every column is needed + ::std::map<sal_Int32,connectivity::OColumn> m_mColumns; + ::std::map<sal_Int32,connectivity::OColumn>::const_iterator m_mColumnsIter; + + ADORecordset* m_pRecordSet; + sal_Int32 m_nColCount; + + sal_Int32 MapADOType2Jdbc(DataTypeEnum eType); + protected: + void setColumnPrivilegesMap(); + void setColumnsMap(); + void setTablesMap(); + void setProcedureColumnsMap(); + void setPrimaryKeysMap(); + void setIndexInfoMap(); + void setTablePrivilegesMap(); + void setCrossReferenceMap(); + void setTypeInfoMap(); + void setProceduresMap(); + public: + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + ODatabaseMetaDataResultSetMetaData( ADORecordset* _pRecordSet ,ODatabaseMetaDataResultSet* _pRes) + : m_pRecordSet(_pRecordSet),m_vMapping(_pRes->getColumnMapping()), + m_nColCount(m_vMapping.size()-1) + { + if(m_pRecordSet) + m_pRecordSet->AddRef(); + } +// ODatabaseMetaDataResultSetMetaData( ADORecordset* _pRecordSet,::std::vector<sal_Int32> _vMapping) +// : m_pRecordSet(_pRecordSet),m_vMapping(_vMapping){m_pRecordSet->AddRef();} + ~ODatabaseMetaDataResultSetMetaData(); + + /// Avoid ambigous cast error from the compiler. + inline operator ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > () throw() + { return this; } + + virtual sal_Int32 SAL_CALL getColumnCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnLabel( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSchemaName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTableName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnTypeName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnServiceName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_ADO_ADATABASEMETARESULTSETMETADATA_HXX_ + diff --git a/connectivity/source/inc/ado/ADriver.hxx b/connectivity/source/inc/ado/ADriver.hxx new file mode 100644 index 000000000000..4b6470b6a8be --- /dev/null +++ b/connectivity/source/inc/ado/ADriver.hxx @@ -0,0 +1,132 @@ +/************************************************************************* + * + * $RCSfile: ADriver.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_ADRIVER_HXX_ +#define _CONNECTIVITY_ADO_ADRIVER_HXX_ + +#ifndef _COM_SUN_STAR_SDBC_XDRIVER_HPP_ +#include <com/sun/star/sdbc/XDriver.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XDATADEFINITIONSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif +#ifndef _CPPUHELPER_COMPBASE3_HXX_ +#include <cppuhelper/compbase3.hxx> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif + +namespace connectivity +{ + namespace ado + { + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ODriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ); + + typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbc::XDriver, + ::com::sun::star::sdbcx::XDataDefinitionSupplier, + ::com::sun::star::lang::XServiceInfo + > ODriver_BASE; + class ODriver : public ODriver_BASE + { + ::osl::Mutex m_aMutex; + + connectivity::OWeakRefArray m_xConnections; // vector containing a list + // of all the Connection objects + // for this Driver + + + public: + ODriver(); + ~ODriver(); + + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + + // XDriver + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMajorVersion( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMinorVersion( ) throw(::com::sun::star::uno::RuntimeException); + + // XDataDefinitionSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& connection ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } + +} +#endif //_CONNECTIVITY_ADO_ADRIVER_HXX_ + + diff --git a/connectivity/source/inc/ado/AGroup.hxx b/connectivity/source/inc/ado/AGroup.hxx new file mode 100644 index 000000000000..4d2355a879b3 --- /dev/null +++ b/connectivity/source/inc/ado/AGroup.hxx @@ -0,0 +1,120 @@ +/************************************************************************* + * + * $RCSfile: AGroup.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_GROUP_HXX_ +#define _CONNECTIVITY_ADABAS_GROUP_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_GROUP_HXX_ +#include "connectivity/sdbcx/VGroup.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_AWRAPADOX_HXX_ +#include "ado/Awrapadox.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ +#include <com/sun/star/lang/XUnoTunnel.hpp> +#endif + +namespace connectivity +{ + namespace ado + { + typedef sdbcx::OGroup OGroup_ADO; + + class OAdoGroup : public OGroup_ADO + , public ::com::sun::star::lang::XUnoTunnel + { + WpADOGroup m_aGroup; + + sal_Int32 MapRight(RightsEnum _eNum); + RightsEnum Map2Right(sal_Int32 _eNum); + ObjectTypeEnum MapObjectType(sal_Int32 _ObjType); + protected: + virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue,sal_Int32 nHandle) const; + virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const ::com::sun::star::uno::Any& rValue)throw (::com::sun::star::uno::Exception); + + public: + virtual void refreshUsers(); + public: + DECLARE_CTY_DEFAULTS( OGroup_ADO); + + OAdoGroup(sal_Bool _bCase, ADOGroup* _pGroup=NULL); + OAdoGroup(sal_Bool _bCase, const ::rtl::OUString& _Name); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // com::sun::star::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + + // XAuthorizable + virtual sal_Int32 SAL_CALL getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + WpADOGroup getImpl() const { return m_aGroup; } + }; + } +} +#endif // _CONNECTIVITY_ADABAS_GROUP_HXX_ + diff --git a/connectivity/source/inc/ado/AGroups.hxx b/connectivity/source/inc/ado/AGroups.hxx new file mode 100644 index 000000000000..60ce4da82caa --- /dev/null +++ b/connectivity/source/inc/ado/AGroups.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * $RCSfile: AGroups.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_GROUPS_HXX_ +#define _CONNECTIVITY_ADO_GROUPS_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_AWRAPADOX_HXX_ +#include "ado/Awrapadox.hxx" +#endif + +namespace connectivity +{ + namespace sdbcx + { + class IRefreshableGroups; + } + namespace ado + { + class OAdabasConnection; + class OGroups : public sdbcx::OCollection + { + ADOGroups* m_pCollection; + protected: + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + public: + OGroups(::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const ::std::vector< ::rtl::OUString> &_rVector, + ADOGroups* _pCollection,sal_Bool _bCase) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector) + ,m_pCollection(_pCollection) + { + if(m_pCollection) + m_pCollection->AddRef(); + } + + ~OGroups() + { + if(m_pCollection) + m_pCollection->Release(); + } + // XAppend + virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + // XDrop + virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + }; + } +} + +#endif // _CONNECTIVITY_ADO_GROUPS_HXX_ + diff --git a/connectivity/source/inc/ado/AIndex.hxx b/connectivity/source/inc/ado/AIndex.hxx new file mode 100644 index 000000000000..6096bfc50adf --- /dev/null +++ b/connectivity/source/inc/ado/AIndex.hxx @@ -0,0 +1,118 @@ +/************************************************************************* + * + * $RCSfile: AIndex.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_INDEX_HXX_ +#define _CONNECTIVITY_ADO_INDEX_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_INDEX_HXX_ +#include "connectivity/sdbcx/VIndex.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#endif +#ifndef _CONNECTIVITY_ADO_AWRAPADOX_HXX_ +#include "ado/Awrapadox.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ +#include <com/sun/star/lang/XUnoTunnel.hpp> +#endif + +namespace connectivity +{ + namespace ado + { + typedef sdbcx::OIndex OIndex_ADO; + + class OAdoIndex : public OIndex_ADO + ,public ::com::sun::star::lang::XUnoTunnel + { + WpADOIndex m_aIndex; + protected: + virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue,sal_Int32 nHandle) const; + virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const ::com::sun::star::uno::Any& rValue)throw (::com::sun::star::uno::Exception); + public: + virtual void refreshColumns(); + public: + DECLARE_CTY_DEFAULTS( OIndex_ADO); + + OAdoIndex(sal_Bool _bCase, ADOIndex* _pIndex=NULL); + OAdoIndex( const ::rtl::OUString& _Name, + const ::rtl::OUString& _Catalog, + sal_Bool _isUnique, + sal_Bool _isPrimaryKeyIndex, + sal_Bool _isClustered, + sal_Bool _bCase + ); + + // XInterface + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // com::sun::star::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + + WpADOIndex getImpl() const { return m_aIndex;} + }; + } +} +#endif // _CONNECTIVITY_ADO_INDEX_HXX_ + diff --git a/connectivity/source/inc/ado/AIndexColumn.hxx b/connectivity/source/inc/ado/AIndexColumn.hxx new file mode 100644 index 000000000000..0defab959696 --- /dev/null +++ b/connectivity/source/inc/ado/AIndexColumn.hxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * $RCSfile: AIndexColumn.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_INDEXCOLUMN_HXX_ +#define _CONNECTIVITY_ADABAS_INDEXCOLUMN_HXX_ + +#ifndef _CONNECTIVITY_ADO_COLUMN_HXX_ +#include "ado/AColumn.hxx" +#endif + +namespace connectivity +{ + namespace ado + { + class OIndexColumn : public OAdoColumn + { + protected: + sal_Bool m_IsAscending; + public: + OIndexColumn(); + OIndexColumn( sal_Bool _IsAscending, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _TypeName, + const ::rtl::OUString& _DefaultValue, + sal_Int32 _IsNullable, + sal_Int32 _Precision, + sal_Int32 _Scale, + sal_Int32 _Type, + sal_Bool _IsAutoIncrement); + + virtual void construct(); + }; + } +} +#endif // _CONNECTIVITY_ADABAS_INDEXCOLUMN_HXX_ + diff --git a/connectivity/source/inc/ado/AIndexColumns.hxx b/connectivity/source/inc/ado/AIndexColumns.hxx new file mode 100644 index 000000000000..09d2e95e99b9 --- /dev/null +++ b/connectivity/source/inc/ado/AIndexColumns.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * $RCSfile: AIndexColumns.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_INDEXCOLUMNS_HXX_ +#define _CONNECTIVITY_ADABAS_INDEXCOLUMNS_HXX_ + +#ifndef _CONNECTIVITY_ADABAS_COLUMNS_HXX_ +#include "adabas/BColumns.hxx" +#endif + +namespace connectivity +{ + namespace adabas + { + class OIndexColumns : public OColumns + { + protected: + virtual ::com::sun::star::uno::Reference< starcontainer::XNamed > createObject(const ::rtl::OUString& _rName); + virtual ::com::sun::star::uno::Reference< starbeans::XPropertySet > createEmptyObject(); + public: + OIndexColumns( ::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const ::std::vector< ::rtl::OUString> &_rVector, + OTable* _pTable, + connectivity::sdbcx::IRefreshableColumns* _pParent) + : OColumns(_rParent,_rMutex,_rVector,_pTable,_pParent) + { + } + }; + } +} +#endif // _CONNECTIVITY_ADABAS_INDEXCOLUMNS_HXX_ + diff --git a/connectivity/source/inc/ado/AIndexes.hxx b/connectivity/source/inc/ado/AIndexes.hxx new file mode 100644 index 000000000000..68dac8792a6f --- /dev/null +++ b/connectivity/source/inc/ado/AIndexes.hxx @@ -0,0 +1,112 @@ +/************************************************************************* + * + * $RCSfile: AIndexes.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADO_INDEXES_HXX_ +#define _CONNECTIVITY_ADO_INDEXES_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#endif +#ifndef _CONNECTIVITY_ADO_AWRAPADOX_HXX_ +#include "ado/Awrapadox.hxx" +#endif + +namespace connectivity +{ + namespace ado + { + class OIndexes : public sdbcx::OCollection + { + ADOIndexes* m_pCollection; + protected: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + public: + OIndexes(::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const ::std::vector< ::rtl::OUString> &_rVector, + ADOIndexes* _pCollection,sal_Bool _bCase) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector) + ,m_pCollection(_pCollection) + { + if(m_pCollection) + m_pCollection->AddRef(); + } + + ~OIndexes() + { + if(m_pCollection) + m_pCollection->Release(); + } + + // XAppend + virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + // XDrop + virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + }; + } +} + +#endif // _CONNECTIVITY_ADO_INDEXES_HXX_ + diff --git a/connectivity/source/inc/ado/AKey.hxx b/connectivity/source/inc/ado/AKey.hxx new file mode 100644 index 000000000000..44317bec3adb --- /dev/null +++ b/connectivity/source/inc/ado/AKey.hxx @@ -0,0 +1,120 @@ +/************************************************************************* + * + * $RCSfile: AKey.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_KEY_HXX_ +#define _CONNECTIVITY_ADO_KEY_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_KEY_HXX_ +#include "connectivity/sdbcx/VKey.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#endif +#ifndef _CONNECTIVITY_ADO_AWRAPADOX_HXX_ +#include "ado/Awrapadox.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ +#include <com/sun/star/lang/XUnoTunnel.hpp> +#endif + +namespace connectivity +{ + namespace ado + { + typedef sdbcx::OKey OKey_ADO; + + class OAdoKey : public OKey_ADO + ,public ::com::sun::star::lang::XUnoTunnel + { + WpADOKey m_aKey; + protected: + virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue,sal_Int32 nHandle) const; + virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const ::com::sun::star::uno::Any& rValue)throw (::com::sun::star::uno::Exception); + public: + virtual void refreshColumns(); + public: + DECLARE_CTY_DEFAULTS( OKey_ADO); + + OAdoKey(sal_Bool _bCase, ADOKey* _pKey=NULL); + OAdoKey( const ::rtl::OUString& _Name, + const ::rtl::OUString& _ReferencedTable, + sal_Int32 _Type, + sal_Int32 _UpdateRule, + sal_Int32 _DeleteRule, + sal_Bool _bCase + ); + + // XInterface + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // com::sun::star::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + + WpADOKey getImpl() const { return m_aKey;} + RuleEnum Map2Rule(const sal_Int32& _eNum) const; + sal_Int32 MapRule(const RuleEnum& _eNum) const; + }; + } +} +#endif // _CONNECTIVITY_ADO_KEY_HXX_ + diff --git a/connectivity/source/inc/ado/AKeyColumn.hxx b/connectivity/source/inc/ado/AKeyColumn.hxx new file mode 100644 index 000000000000..f883d1035116 --- /dev/null +++ b/connectivity/source/inc/ado/AKeyColumn.hxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * $RCSfile: AKeyColumn.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_KEYCOLUMN_HXX_ +#define _CONNECTIVITY_ADABAS_KEYCOLUMN_HXX_ + +#ifndef _CONNECTIVITY_ADO_COLUMN_HXX_ +#include "ado/AColumn.hxx" +#endif + +namespace connectivity +{ + namespace ado + { + class OKeyColumn : public OAdoColumn + { + protected: + ::rtl::OUString m_ReferencedColumn; + public: + OKeyColumn(); + OKeyColumn( const ::rtl::OUString& _ReferencedColumn, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _TypeName, + const ::rtl::OUString& _DefaultValue, + sal_Int32 _IsNullable, + sal_Int32 _Precision, + sal_Int32 _Scale, + sal_Int32 _Type, + sal_Bool _IsAutoIncrement); + + virtual void construct(); + }; + } +} +#endif // _CONNECTIVITY_ADABAS_KEYCOLUMN_HXX_ + diff --git a/connectivity/source/inc/ado/AKeyColumns.hxx b/connectivity/source/inc/ado/AKeyColumns.hxx new file mode 100644 index 000000000000..85b322c28c12 --- /dev/null +++ b/connectivity/source/inc/ado/AKeyColumns.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * $RCSfile: AKeyColumns.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_KEYCOLUMNS_HXX_ +#define _CONNECTIVITY_ADABAS_KEYCOLUMNS_HXX_ + +#ifndef _CONNECTIVITY_ADABAS_COLUMNS_HXX_ +#include "adabas/BColumns.hxx" +#endif + +namespace connectivity +{ + namespace adabas + { + class OKeyColumns : public OColumns + { + protected: + virtual ::com::sun::star::uno::Reference< starcontainer::XNamed > createObject(const ::rtl::OUString& _rName); + virtual ::com::sun::star::uno::Reference< starbeans::XPropertySet > createEmptyObject(); + public: + OKeyColumns( ::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const ::std::vector< ::rtl::OUString> &_rVector, + OTable* _pTable, + connectivity::sdbcx::IRefreshableColumns* _pParent) + : OColumns(_rParent,_rMutex,_rVector,_pTable,_pParent) + { + } + }; + } +} +#endif // _CONNECTIVITY_ADABAS_KEYCOLUMNS_HXX_ + diff --git a/connectivity/source/inc/ado/AKeys.hxx b/connectivity/source/inc/ado/AKeys.hxx new file mode 100644 index 000000000000..d3e945bedd06 --- /dev/null +++ b/connectivity/source/inc/ado/AKeys.hxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * $RCSfile: AKeys.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_KEYS_HXX_ +#define _CONNECTIVITY_ADO_KEYS_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_AWRAPADOX_HXX_ +#include "ado/Awrapadox.hxx" +#endif + +namespace connectivity +{ + namespace ado + { + class OKeys : public sdbcx::OCollection + { + ADOKeys* m_pCollection; + + protected: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + public: + OKeys(::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const ::std::vector< ::rtl::OUString> &_rVector, + ADOKeys* _pCollection,sal_Bool _bCase) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector) + ,m_pCollection(_pCollection) + { + if(m_pCollection) + m_pCollection->AddRef(); + } + + ~OKeys() + { + if(m_pCollection) + m_pCollection->Release(); + } + + // XAppend + virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + // XDrop + virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + }; + } +} + +#endif // _CONNECTIVITY_ADO_KEYS_HXX_ + diff --git a/connectivity/source/inc/ado/APreparedStatement.hxx b/connectivity/source/inc/ado/APreparedStatement.hxx new file mode 100644 index 000000000000..94794aefc06e --- /dev/null +++ b/connectivity/source/inc/ado/APreparedStatement.hxx @@ -0,0 +1,169 @@ +/************************************************************************* + * + * $RCSfile: APreparedStatement.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_APREPAREDSTATEMENT_HXX_ +#define _CONNECTIVITY_ADO_APREPAREDSTATEMENT_HXX_ + + +#ifndef _CONNECTIVITY_ADO_ASTATEMENT_HXX_ +#include "ado/AStatement.hxx" +#endif + +#ifndef _COM_SUN_STAR_SDBC_XPREPAREDSTATEMENT_HPP_ +#include <com/sun/star/sdbc/XPreparedStatement.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XPARAMETERS_HPP_ +#include <com/sun/star/sdbc/XParameters.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_ +#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +#endif +// #include <com/sun/star/sdbc/XClearParameters.hpp> +#ifndef _COM_SUN_STAR_SDBC_XPREPAREDBATCHEXECUTION_HPP_ +#include <com/sun/star/sdbc/XPreparedBatchExecution.hpp> +#endif +#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_ +#include <com/sun/star/io/XInputStream.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif + +namespace connectivity +{ + namespace ado + { + + class OPreparedStatement : public OStatement_Base, + public ::com::sun::star::sdbc::XPreparedStatement, + public ::com::sun::star::sdbc::XParameters, + public ::com::sun::star::sdbc::XPreparedBatchExecution, + public ::com::sun::star::sdbc::XResultSetMetaDataSupplier, + public ::com::sun::star::lang::XServiceInfo + + { + void setParameter(sal_Int32 parameterIndex, const DataTypeEnum& _eType,const sal_Int32& _nSize,const OLEVariant& _Val) + throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + protected: + //==================================================================== + // Data attributes + //==================================================================== + + int numParams; // Number of parameter markers + // for the prepared statement + + ::std::vector<OTypeInfo> m_aTypeInfo; + ADOParameters* m_pParameters; + + public: + DECLARE_CTY_DEFAULTS(OStatement_Base); + DECLARE_SERVICE_INFO(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OPreparedStatement( OConnection* _pConnection,const ::std::vector<OTypeInfo>& _TypeInfo,const ::rtl::OUString& sql); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // XPreparedStatement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL executeUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XParameters + virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XPreparedBatchExecution + virtual void SAL_CALL addBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XResultSetMetaDataSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // OComponentHelper + virtual void SAL_CALL disposing(void); + }; + } +} +#endif // _CONNECTIVITY_ADO_APREPAREDSTATEMENT_HXX_ + diff --git a/connectivity/source/inc/ado/AResultSet.hxx b/connectivity/source/inc/ado/AResultSet.hxx new file mode 100644 index 000000000000..6999759b1a06 --- /dev/null +++ b/connectivity/source/inc/ado/AResultSet.hxx @@ -0,0 +1,296 @@ +/************************************************************************* + * + * $RCSfile: AResultSet.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_ARESULTSET_HXX_ +#define _CONNECTIVITY_ADO_ARESULTSET_HXX_ + +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_ +#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XCLOSEABLE_HPP_ +#include <com/sun/star/sdbc/XCloseable.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XCOLUMNLOCATE_HPP_ +#include <com/sun/star/sdbc/XColumnLocate.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_XCANCELLABLE_HPP_ +#include <com/sun/star/util/XCancellable.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP_ +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSETUPDATE_HPP_ +#include <com/sun/star/sdbc/XResultSetUpdate.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XROWLOCATE_HPP_ +#include <com/sun/star/sdbcx/XRowLocate.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XDELETEROWS_HPP_ +#include <com/sun/star/sdbcx/XDeleteRows.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XROWUPDATE_HPP_ +#include <com/sun/star/sdbc/XRowUpdate.hpp> +#endif +#ifndef _CPPUHELPER_COMPBASE12_HXX_ +#include <cppuhelper/compbase12.hxx> +#endif +#ifndef _UNOTOOLS_PROPERTY_ARRAY_HELPER_HXX_ +#include <unotools/proparrhlp.hxx> +#endif +#ifndef _CONNECTIVITY_ADO_ASTATEMENT_HXX_ +#include "ado/AStatement.hxx" +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif + +namespace connectivity +{ + namespace ado + { + class OResultSetMetaData; + /* + ** java_sql_ResultSet + */ + typedef ::cppu::WeakComponentImplHelper12< ::com::sun::star::sdbc::XResultSet, + ::com::sun::star::sdbc::XRow, + ::com::sun::star::sdbc::XResultSetMetaDataSupplier, + ::com::sun::star::util::XCancellable, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::sdbc::XResultSetUpdate, + ::com::sun::star::sdbc::XRowUpdate, + ::com::sun::star::sdbc::XCloseable, + ::com::sun::star::sdbc::XColumnLocate, + ::com::sun::star::sdbcx::XRowLocate, + ::com::sun::star::sdbcx::XDeleteRows, + ::com::sun::star::lang::XServiceInfo> OResultSet_BASE; + + class OResultSet : public OBaseMutex, + public OResultSet_BASE, + public ::cppu::OPropertySetHelper, + public ::utl::OPropertyArrayUsageHelper<OResultSet> + { + + ADORecordset* m_pRecordSet; + OStatement_Base* m_pStmt; + ::com::sun::star::uno::WeakReferenceHelper m_aStatement; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData; + ::std::vector<OLEVariant> m_aBookmarks; + OLEVariant m_aValue; + sal_Int32 m_nRowPos; + sal_Bool m_bWasNull; + sal_Bool m_bEOF; + sal_Bool m_bOnFirstAfterOpen; + + sal_Int32 getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getResultSetType() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getFetchDirection() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getFetchSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + ::rtl::OUString getCursorName() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + void setFetchDirection(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setFetchSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + protected: + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + virtual sal_Bool SAL_CALL convertFastPropertyValue( + ::com::sun::star::uno::Any & rConvertedValue, + ::com::sun::star::uno::Any & rOldValue, + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue ) + throw (::com::sun::star::lang::IllegalArgumentException); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue + ) + throw (::com::sun::star::uno::Exception); + virtual void SAL_CALL getFastPropertyValue( + ::com::sun::star::uno::Any& rValue, + sal_Int32 nHandle + ) const; + public: + DECLARE_CTY_DEFAULTS(OResultSet_BASE); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OResultSet( ADORecordset* _pRecordSet,OStatement_Base* pStmt); + OResultSet( ADORecordset* _pRecordSet); + ~OResultSet(); + + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) + { + return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); + } + // XResultSet + virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRow + virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XResultSetMetaDataSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCancellable + virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XResultSetUpdate + virtual void SAL_CALL insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRowUpdate + virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRowLocate + virtual ::com::sun::star::uno::Any SAL_CALL getBookmark( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL compareBookmarks( const ::com::sun::star::uno::Any& first, const ::com::sun::star::uno::Any& second ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XDeleteRows + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + }; + } + +} +#endif // _CONNECTIVITY_ADO_ARESULTSET_HXX_ + + diff --git a/connectivity/source/inc/ado/AResultSetMetaData.hxx b/connectivity/source/inc/ado/AResultSetMetaData.hxx new file mode 100644 index 000000000000..cdd1d9d00be4 --- /dev/null +++ b/connectivity/source/inc/ado/AResultSetMetaData.hxx @@ -0,0 +1,140 @@ +/************************************************************************* + * + * $RCSfile: AResultSetMetaData.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_ARESULTSETMETADATA_HXX_ +#define _CONNECTIVITY_ADO_ARESULTSETMETADATA_HXX_ + +#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATA_HPP_ +#include <com/sun/star/sdbc/XResultSetMetaData.hpp> +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif +#ifndef _VECTOR_ +#include <vector> +#endif + +#ifndef _CONNECTIVITY_ADO_AWRAPADO_HXX_ +#include "ado/Awrapado.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_ARESULTSET_HXX_ +#include "ado/AResultSet.hxx" +#endif +#ifndef _CONNECTIVITY_COLUMN_HXX_ +#include "OColumn.hxx" +#endif + +namespace connectivity +{ + namespace ado + { + + //************************************************************** + //************ Class: ResultSetMetaData + //************************************************************** + typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData> OResultSetMetaData_BASE; + + class OResultSetMetaData : public OResultSetMetaData_BASE + { + friend class OResultSet; + + ADORecordset* m_pRecordSet; + sal_Int32 m_nColCount; + + sal_Int32 MapADOType2Jdbc(DataTypeEnum eType); + public: + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OResultSetMetaData( ADORecordset* _pRecordSet) + : m_pRecordSet(_pRecordSet), + m_nColCount(-1){m_pRecordSet->AddRef();} + ~OResultSetMetaData(); +#if SUPD < 570 + /// Avoid ambigous cast error from the compiler. + inline operator ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > () throw() + { return this; } +#endif + + virtual sal_Int32 SAL_CALL getColumnCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnLabel( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSchemaName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTableName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnTypeName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnServiceName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_ADO_ARESULTSETMETADATA_HXX_ + diff --git a/connectivity/source/inc/ado/AStatement.hxx b/connectivity/source/inc/ado/AStatement.hxx new file mode 100644 index 000000000000..9e1843acc491 --- /dev/null +++ b/connectivity/source/inc/ado/AStatement.hxx @@ -0,0 +1,262 @@ +/************************************************************************* + * + * $RCSfile: AStatement.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_ASTATEMENT_HXX_ +#define _CONNECTIVITY_ADO_ASTATEMENT_HXX_ + +#ifndef _COM_SUN_STAR_SDBC_XSTATEMENT_HPP_ +#include <com/sun/star/sdbc/XStatement.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP_ +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XMULTIPLERESULTS_HPP_ +#include <com/sun/star/sdbc/XMultipleResults.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XBATCHEXECUTION_HPP_ +#include <com/sun/star/sdbc/XBatchExecution.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XCLOSEABLE_HPP_ +#include <com/sun/star/sdbc/XCloseable.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_SQLWARNING_HPP_ +#include <com/sun/star/sdbc/SQLWarning.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_XCANCELLABLE_HPP_ +#include <com/sun/star/util/XCancellable.hpp> +#endif +#ifndef _CPPUHELPER_COMPBASE5_HXX_ +#include <cppuhelper/compbase5.hxx> +#endif +#ifndef _UNOTOOLS_PROPERTY_ARRAY_HELPER_HXX_ +#include <unotools/proparrhlp.hxx> +#endif +#ifndef _UTL_UNO3_HXX_ +#include <unotools/uno3.hxx> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_ACONNECTION_HXX_ +#include "ado/AConnection.hxx" +#endif +#ifndef _LIST_ +#include <list> +#endif +#ifndef _CONNECTIVITY_ADO_AWRAPADO_HXX_ +#include "ado/Awrapado.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif + +namespace connectivity +{ + namespace ado + { + typedef ::cppu::WeakComponentImplHelper5< ::com::sun::star::sdbc::XStatement, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::util::XCancellable, + ::com::sun::star::sdbc::XCloseable, + ::com::sun::star::sdbc::XMultipleResults> OStatement_BASE; + + //************************************************************** + //************ Class: java.sql.Statement + //************************************************************** + class OStatement_Base : public OBaseMutex, + public OStatement_BASE, + public ::cppu::OPropertySetHelper, + public ::utl::OPropertyArrayUsageHelper<OStatement_Base>, + public connectivity::OSubComponent< OStatement_Base> + + { + friend class connectivity::OSubComponent< OStatement_Base>; + friend class OResultSet; + + ::com::sun::star::sdbc::SQLWarning m_aLastWarning; + + protected: + ::std::list< ::rtl::OUString> m_aBatchList; + + ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet> m_xResultSet; // The last ResultSet created + // for this Statement + + OConnection* m_pConnection;// The owning Connection object + WpADOCommand m_Command; + WpADORecordset m_RecordSet; + OLEVariant m_RecordsAffected; + OLEVariant m_Parameters; + ::std::vector<connectivity::OTypeInfo> m_aTypeInfo; // Hashtable containing an entry + // for each row returned by + // DatabaseMetaData.getTypeInfo. + sal_Int32 m_nMaxRows; + sal_Int32 m_nFetchSize; + LockTypeEnum m_eLockType; + CursorTypeEnum m_eCursorType; + + using OStatement_BASE::rBHelper; + private: + + sal_Int32 getQueryTimeOut() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getMaxFieldSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getMaxRows() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getResultSetType() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getFetchDirection() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getFetchSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + ::rtl::OUString getCursorName() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + void setQueryTimeOut(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setMaxFieldSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setMaxRows(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setResultSetConcurrency(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setResultSetType(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setFetchDirection(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setFetchSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setCursorName(const ::rtl::OUString &_par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + protected: + + void reset () throw( ::com::sun::star::sdbc::SQLException); + void clearMyResultSet () throw( ::com::sun::star::sdbc::SQLException); + void setWarning (const ::com::sun::star::sdbc::SQLWarning &ex) throw( ::com::sun::star::sdbc::SQLException); + sal_Int32 getColumnCount () throw( ::com::sun::star::sdbc::SQLException); + sal_Int32 getRowCount () throw( ::com::sun::star::sdbc::SQLException); + sal_Int32 getPrecision ( sal_Int32 sqlType); + + void disposeResultSet(); + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + virtual sal_Bool SAL_CALL convertFastPropertyValue( + ::com::sun::star::uno::Any & rConvertedValue, + ::com::sun::star::uno::Any & rOldValue, + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue ) + throw (::com::sun::star::lang::IllegalArgumentException); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue + ) + throw (::com::sun::star::uno::Exception); + virtual void SAL_CALL getFastPropertyValue( + ::com::sun::star::uno::Any& rValue, + sal_Int32 nHandle + ) const; + public: + DECLARE_CTY_ACQUIRE(OStatement_BASE); + OStatement_Base(OConnection* _pConnection ); + + using OStatement_BASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >; + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) + { + return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); + } + // XStatement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Int32 SAL_CALL executeUpdate( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Bool SAL_CALL execute( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCancellable + virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XMultipleResults + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSet( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + + class OStatement : public OStatement_Base, + public ::com::sun::star::sdbc::XBatchExecution, + public ::com::sun::star::lang::XServiceInfo + { + public: + DECLARE_CTY_DEFAULTS(OStatement_Base); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OStatement( OConnection* _pConnection) : OStatement_Base( _pConnection){}; + ~OStatement(); + + DECLARE_SERVICE_INFO(); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + // XBatchExecution + virtual void SAL_CALL addBatch( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_ADO_ASTATEMENT_HXX_ + diff --git a/connectivity/source/inc/ado/ATable.hxx b/connectivity/source/inc/ado/ATable.hxx new file mode 100644 index 000000000000..97083aaeb5c8 --- /dev/null +++ b/connectivity/source/inc/ado/ATable.hxx @@ -0,0 +1,129 @@ +/************************************************************************* + * + * $RCSfile: ATable.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_TABLE_HXX_ +#define _CONNECTIVITY_ADO_TABLE_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_TABLE_HXX_ +#include "connectivity/sdbcx/VTable.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ +#include <com/sun/star/lang/XUnoTunnel.hpp> +#endif +#ifndef _CONNECTIVITY_ADO_AWRAPADOX_HXX_ +#include "ado/Awrapadox.hxx" +#endif + +namespace connectivity +{ + namespace ado + { + typedef connectivity::sdbcx::OTable OTable_TYPEDEF; + + class OAdoTable : public OTable_TYPEDEF, + public ::com::sun::star::lang::XUnoTunnel + { + WpADOTable m_aTable; + + protected: + virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue,sal_Int32 nHandle) const; + virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const ::com::sun::star::uno::Any& rValue)throw (::com::sun::star::uno::Exception); + + public: + virtual void refreshColumns(); + virtual void refreshKeys(); + virtual void refreshIndexes(); + + public: + DECLARE_CTY_DEFAULTS( OTable_TYPEDEF); + OAdoTable(sal_Bool _bCase, _ADOTable* _pTable=NULL); + OAdoTable(sal_Bool _bCase, const ::rtl::OUString& _Name, + const ::rtl::OUString& _Type, + const ::rtl::OUString& _Description = ::rtl::OUString(), + const ::rtl::OUString& _SchemaName = ::rtl::OUString(), + const ::rtl::OUString& _CatalogName = ::rtl::OUString()); + + // XINterface + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + const ::rtl::OUString& getName() const { return m_Name; } + const ::rtl::OUString& getSchema() const { return m_SchemaName; } + // com::sun::star::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + + // XRename + virtual void SAL_CALL rename( const ::rtl::OUString& newName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + + // XAlterTable + virtual void SAL_CALL alterColumnByName( const ::rtl::OUString& colName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL alterColumnByIndex( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + // + sal_Bool create() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + WpADOTable getImpl() const { return m_aTable;} + }; + } +} +#endif // _CONNECTIVITY_ADO_TABLE_HXX_ + diff --git a/connectivity/source/inc/ado/ATables.hxx b/connectivity/source/inc/ado/ATables.hxx new file mode 100644 index 000000000000..c98831cf8a6e --- /dev/null +++ b/connectivity/source/inc/ado/ATables.hxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * $RCSfile: ATables.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADO_TABLES_HXX_ +#define _CONNECTIVITY_ADO_TABLES_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_AWRAPADOX_HXX_ +#include "ado/Awrapadox.hxx" +#endif + +namespace connectivity +{ + namespace ado + { + class OTables : public sdbcx::OCollection + { + ADOTables* m_pCollection; + protected: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + void setComments(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + public: + OTables(::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, + const ::std::vector< ::rtl::OUString> &_rVector, + ADOTables* _pCollection,sal_Bool _bCase) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector) + ,m_pCollection(_pCollection) + { + if(m_pCollection) + m_pCollection->AddRef(); + } + + ~OTables() + { + if(m_pCollection) + m_pCollection->Release(); + } + + // XAppend + virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + // XDrop + virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_ADO_TABLES_HXX_ + diff --git a/connectivity/source/inc/ado/AUser.hxx b/connectivity/source/inc/ado/AUser.hxx new file mode 100644 index 000000000000..a7100a26639a --- /dev/null +++ b/connectivity/source/inc/ado/AUser.hxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * $RCSfile: AUser.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_USER_HXX_ +#define _CONNECTIVITY_ADO_USER_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_USER_HXX_ +#include "connectivity/sdbcx/VUser.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_AWRAPADOX_HXX_ +#include "ado/Awrapadox.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ +#include <com/sun/star/lang/XUnoTunnel.hpp> +#endif + +namespace connectivity +{ + namespace ado + { + typedef connectivity::sdbcx::OUser OUser_TYPEDEF; + + class OAdoUser : public OUser_TYPEDEF + , public ::com::sun::star::lang::XUnoTunnel + { + protected: + WpADOUser m_aUser; + + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue + ) + throw (::com::sun::star::uno::Exception); + virtual void SAL_CALL getFastPropertyValue( + ::com::sun::star::uno::Any& rValue, + sal_Int32 nHandle + ) const; + public: + virtual void refreshGroups(); + public: + DECLARE_CTY_DEFAULTS( OUser_TYPEDEF); + OAdoUser(sal_Bool _bCase, ADOUser* _pUser=NULL); + OAdoUser(sal_Bool _bCase, const ::rtl::OUString& _Name); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // com::sun::star::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + + WpADOUser getImpl() const { return m_aUser;} + }; + + class OUserExtend; + typedef ::utl::OPropertyArrayUsageHelper<OUserExtend> OUserExtend_PROP; + + class OUserExtend : public OAdoUser, + public OUserExtend_PROP + { + protected: + ::rtl::OUString m_Password; + DECLARE_CTY_PROPERTY(OAdoUser,OUserExtend) + + public: + OUserExtend(sal_Bool _bCase,ADOUser* _pUser=NULL); + OUserExtend(sal_Bool _bCase,const ::rtl::OUString& _Name); + + virtual void construct(); + ::rtl::OUString getPassword() const { return m_Password;} + }; + } +} +#endif // _CONNECTIVITY_ADO_USER_HXX_ + diff --git a/connectivity/source/inc/ado/AUsers.hxx b/connectivity/source/inc/ado/AUsers.hxx new file mode 100644 index 000000000000..d25a7f5c0e69 --- /dev/null +++ b/connectivity/source/inc/ado/AUsers.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * $RCSfile: AUsers.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_USERS_HXX_ +#define _CONNECTIVITY_ADO_USERS_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_AWRAPADOX_HXX_ +#include "ado/Awrapadox.hxx" +#endif + +namespace connectivity +{ + namespace sdbcx + { + class IRefreshableUsers; + } + namespace ado + { + + class OUsers : public sdbcx::OCollection + { + ADOUsers* m_pCollection; + public: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + public: + OUsers( ::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const ::std::vector< ::rtl::OUString> &_rVector, + ADOUsers* _pCollection,sal_Bool _bCase) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector) + ,m_pCollection(_pCollection) + { + if(m_pCollection) + m_pCollection->AddRef(); + } + + ~OUsers() + { + if(m_pCollection) + m_pCollection->Release(); + } + + // XAppend + virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + // XDrop + virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + }; + } +} + +#endif // _CONNECTIVITY_ADO_USERS_HXX_ + diff --git a/connectivity/source/inc/ado/AView.hxx b/connectivity/source/inc/ado/AView.hxx new file mode 100644 index 000000000000..acb55bf9fb31 --- /dev/null +++ b/connectivity/source/inc/ado/AView.hxx @@ -0,0 +1,122 @@ +/************************************************************************* + * + * $RCSfile: AView.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_VIEW_HXX_ +#define _CONNECTIVITY_ADO_VIEW_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_VIEW_HXX_ +#include "connectivity/sdbcx/VView.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ +#include <com/sun/star/lang/XUnoTunnel.hpp> +#endif +#ifndef _CONNECTIVITY_ADO_AWRAPADOX_HXX_ +#include "ado/Awrapadox.hxx" +#endif + +namespace connectivity +{ + namespace ado + { + + typedef sdbcx::OView OView_ADO; + + class OAdoView : public OView_ADO + ,public ::com::sun::star::lang::XUnoTunnel + { + WpADOView m_aView; + + protected: + // OPropertySetHelper + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue + ) + throw (::com::sun::star::uno::Exception); + virtual void SAL_CALL getFastPropertyValue( + ::com::sun::star::uno::Any& rValue, + sal_Int32 nHandle + ) const; + public: + DECLARE_CTY_DEFAULTS( OView_ADO); + + OAdoView(sal_Bool _bCase, ADOView* _pView=NULL); + OAdoView(sal_Bool _bCase, const ::rtl::OUString& _rName, + sal_Int32 _nCheckOption = 0, + const ::rtl::OUString& _rCommand = ::rtl::OUString(), + const ::rtl::OUString& _rSchemaName = ::rtl::OUString(), + const ::rtl::OUString& _rCatalogName = ::rtl::OUString()); + + // XInterface + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // com::sun::star::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + + WpADOView getImpl() const { return m_aView;} + }; + } +} + +#endif // _CONNECTIVITY_ADO_VIEW_HXX_ + diff --git a/connectivity/source/inc/ado/AViews.hxx b/connectivity/source/inc/ado/AViews.hxx new file mode 100644 index 000000000000..dfc254e0e8b4 --- /dev/null +++ b/connectivity/source/inc/ado/AViews.hxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * $RCSfile: AViews.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_VIEWS_HXX_ +#define _CONNECTIVITY_ADO_VIEWS_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_AWRAPADOX_HXX_ +#include "ado/Awrapadox.hxx" +#endif + +namespace connectivity +{ + namespace ado + { + + class OViews : public sdbcx::OCollection + { + ADOViews* m_pCollection; + protected: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + void setComments(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + public: + OViews(::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, + const ::std::vector< ::rtl::OUString> &_rVector, + ADOViews* _pCollection,sal_Bool _bCase) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector) + ,m_pCollection(_pCollection) + { + if(m_pCollection) + m_pCollection->AddRef(); + } + + ~OViews() + { + if(m_pCollection) + m_pCollection->Release(); + } + + // XAppend + virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + // XDrop + virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_ADO_VIEWS_HXX_ + diff --git a/connectivity/source/inc/ado/Aolevariant.hxx b/connectivity/source/inc/ado/Aolevariant.hxx new file mode 100644 index 000000000000..fe76c63af935 --- /dev/null +++ b/connectivity/source/inc/ado/Aolevariant.hxx @@ -0,0 +1,373 @@ +/************************************************************************* + * + * $RCSfile: Aolevariant.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADO_AOLEVARIANT_HXX_ +#define _CONNECTIVITY_ADO_AOLEVARIANT_HXX_ + +#ifndef _RTL_USTRING_HXX_ +#include <rtl/ustring.hxx> +#endif + +#ifndef _OSL_TYPES_H_ +#include <osl/types.h> +#endif +#ifndef _CONNECTIVITY_DATECONVERSION_HXX_ +#include "DateConversion.hxx" +#endif +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_ +#include <com/sun/star/uno/Sequence.h> +#endif + +namespace connectivity +{ + namespace ado + { + + class OLEVariant : public ::tagVARIANT + { + public: + OLEVariant() { VariantInit(this);} + OLEVariant(const VARIANT& varSrc) + { + ::VariantInit(this); + ::VariantCopy(this, const_cast<VARIANT*>(&varSrc)); + } + OLEVariant(const OLEVariant& varSrc) { VariantInit(this); + VariantCopy(this, const_cast<VARIANT*>(static_cast<const VARIANT*>(&varSrc)));} + OLEVariant(sal_Int32 n) { VariantInit(this); vt = VT_I4; lVal = n;} + OLEVariant(const rtl::OUString& us) { VariantInit(this); vt = VT_BSTR; bstrVal = SysAllocString(us);} + ~OLEVariant() { VariantClear(this); } // clears all the memory that was allocated before + + OLEVariant(const ::com::sun::star::util::Date& x ) + { + VariantInit(this); vt = VT_R8; + dblVal = DateConversion::toDouble(x); + } + OLEVariant(const ::com::sun::star::util::Time& x ) + { + VariantInit(this); vt = VT_R8; + dblVal = DateConversion::toDouble(x); + } + OLEVariant(const ::com::sun::star::util::DateTime& x ) + { + VariantInit(this); vt = VT_R8; + dblVal = DateConversion::toDouble(x); + } + OLEVariant(IDispatch* pDispInterface) + { VariantInit(this); vt = VT_DISPATCH; pdispVal = pDispInterface;} + + OLEVariant(const ::com::sun::star::uno::Sequence< sal_Int8 >& x) + { + VariantInit(this); vt = VT_ARRAY|VT_UI1; + parray = SafeArrayCreateVector(VT_UI1, 0, x.getLength()); + const sal_Int8* pBegin = x.getConstArray(); + const sal_Int8* pEnd = pBegin + x.getLength(); + for(sal_Int32 i=0;pBegin != pEnd;++i,++pBegin) + SafeArrayPutElement(parray,&i,&pBegin); + + } + + OLEVariant& operator=(const OLEVariant& varSrc) + { + VariantCopy(this, const_cast<VARIANT*>(static_cast<const VARIANT*>(&varSrc))); + return *this; + } + // Assign a const VARIANT& (::VariantCopy handles everything) + // + inline OLEVariant& operator=(const tagVARIANT& varSrc) + { + ::VariantCopy(this, const_cast<VARIANT*>(&varSrc)); + + return *this; + } + + // Assign a const VARIANT* (::VariantCopy handles everything) + // + inline OLEVariant& operator=(const VARIANT* pSrc) + { + ::VariantCopy(this, const_cast<VARIANT*>(pSrc)); + + return *this; + } + + void setByte(sal_uInt8 n) { VariantClear(this); vt = VT_UI1; bVal = n;} + void setInt16(sal_Int16 n) { VariantClear(this); vt = VT_I2; iVal = n;} + void setInt32(sal_Int32 n) { VariantClear(this); vt = VT_I4; lVal = n;} + void setFloat(float f) { VariantClear(this); vt = VT_R4; fltVal = f;} + void setDouble(double d) { VariantClear(this); vt = VT_R8; dblVal = d;} + void setDate(DATE d) { VariantClear(this); vt = VT_DATE; date = d;} + void setChar(unsigned char a) { VariantClear(this); vt = VT_UI1; bVal = a;} + void setCurrency(double aCur) { VariantClear(this); vt = VT_CY; set(aCur*10000);} + void setBool(sal_Bool b) { VariantClear(this); vt = VT_BOOL; boolVal = b ? -1:0;} + void setString(const rtl::OUString& us){ VariantClear(this); vt = VT_BSTR; bstrVal = SysAllocString(us);} + void setNoArg() { VariantClear(this); vt = VT_ERROR; scode = DISP_E_PARAMNOTFOUND;} + + void setIDispatch(IDispatch* pDispInterface) + { VariantClear(this); vt = VT_DISPATCH; pdispVal = pDispInterface;} + + void setNull() { VariantClear(this); vt = VT_NULL;} + void setEmpty() { VariantClear(this); vt = VT_EMPTY;} + + void setUI1SAFEARRAYPtr(SAFEARRAY* pSafeAr) + { VariantClear(this); vt = VT_ARRAY|VT_UI1; parray = pSafeAr; } + + inline void setArray(SAFEARRAY* pSafeArray, VARTYPE vtType) + { VariantClear(this); vt = VT_ARRAY|vtType; parray = pSafeArray; } + + sal_Bool isNull() const { return (vt == VT_NULL); } + sal_Bool isEmpty() const { return (vt == VT_EMPTY); } + + VARTYPE getType() const { return vt; } + + operator rtl::OUString() + { + if(vt == VT_NULL) + return rtl::OUString(); + if (vt != VT_BSTR) VariantChangeType(this, this, NULL, VT_BSTR); + return rtl::OUString((sal_Unicode*)bstrVal); + } + + rtl::OUString getString() + { + return (rtl::OUString)*this; + } + operator sal_Bool() { return getBool(); } + operator sal_Int32() { return getInt32(); } + operator sal_Int16() { return getInt16(); } + operator sal_Int8() { return getInt8(); } + operator float() { return getFloat(); } + operator double() { return getDouble(); } + operator ::com::sun::star::util::Date() + { + return connectivity::DateConversion::toDate(date,::com::sun::star::util::Date(30,12,1899)); + } + operator ::com::sun::star::util::Time() + { + return connectivity::DateConversion::toTime(date); + } + operator ::com::sun::star::util::DateTime() + { + return connectivity::DateConversion::toDateTime(date,::com::sun::star::util::Date(30,12,1899)); + } + + sal_Bool getBool() + { + if (vt != VT_BOOL) VariantChangeType(this, this, NULL, VT_BOOL); + return boolVal ? sal_True : sal_False; + }; + + IUnknown* getIUnknown() + { + if (vt != VT_UNKNOWN) VariantChangeType(this, this, NULL, VT_UNKNOWN); + return (IUnknown*) punkVal; + + } + + IDispatch* getIDispatch() + { + if (vt != VT_DISPATCH) VariantChangeType(this,this, NULL, VT_DISPATCH); + return (IDispatch*) pdispVal; + + } + + + sal_uInt8 getByte() + { + if (vt != VT_UI1) VariantChangeType(this, this, NULL, VT_UI1); + return (sal_uInt8) bVal; + } + + sal_Int16 getInt16() + { + if (vt != VT_I2) VariantChangeType(this, this, NULL, VT_I2); + return (sal_Int16) iVal; + } + + sal_Int8 getInt8() + { + if (vt != VT_UI1) VariantChangeType(this, this, NULL, VT_UI1); + return (sal_Int8) iVal; + } + + sal_Int32 getInt32() + { + if (vt != VT_I4) VariantChangeType(this, this, NULL, VT_I4); + return (sal_Int32) lVal; + } + + sal_Int32 getUInt32() + { + if (vt != VT_UI4) VariantChangeType(this, this, NULL, VT_UI4); + return (sal_uInt32) lVal; + } + + float getFloat() + { + if (vt != VT_R4) VariantChangeType(this, this, NULL, VT_R4); + return (float) fltVal; + } + + double getDouble() + { + if (vt != VT_R8) VariantChangeType(this, this, NULL, VT_R8); + return (double) dblVal; + } + + double getDate() + { + if (vt != VT_DATE) VariantChangeType(this, this, NULL, VT_DATE); + return (double) date; + } + + double getCurrency() + { + if (vt != VT_CY) VariantChangeType(this, this, NULL, VT_CY); + double toRet = ((double)cyVal.Hi*(double)4294967296.0 + (double)cyVal.Lo) / 10000; + return toRet; + } + + SAFEARRAY* getUI1SAFEARRAYPtr() + { + if (vt != (VT_ARRAY|VT_UI1)) + VariantChangeType(this,this, NULL, VT_ARRAY|VT_UI1); + return (parray); + } + + // static methods + + // ACHTUNG! Der zurueckgegebene UnicodeString muß vom + // Rufer mit delete[] freigegeben werden!!!! + inline static OLECHAR* UniCodeFromC(const char* pText) + { + + int nLength = strlen(pText)+1; + OLECHAR* aReturnString = new OLECHAR[nLength]; + + MultiByteToWideChar(CP_ACP, //ANSI Code Page + MB_PRECOMPOSED, + pText, + nLength, + (OLECHAR*) aReturnString, + nLength); + + return aReturnString; + + } + + // Der zurueckgegebene BSTR muss noch mit + // SysFreeString() wieder freigegeben werden! + // inline static BSTR BSTRFromC(const char* pText) + // { + // OLECHAR* pUniString = UniCodeFromC(pText); + // BSTR aBSTR = SysAllocString(pUniString); + // delete[] pUniString; + // return aBSTR; + // } + + inline static VARIANT_BOOL VariantBool(sal_Bool bEinBoolean) + { + return (VARIANT_BOOL) (bEinBoolean? -1:0); + } + + // static String StringFromBSTR(BSTR& aBSTR) + // { + // sal_uInt16 nLength = SysStringLen(aBSTR); + // String sRetString; + // char* pBuf = sRetString.AllocStrBuf(nLength); + // + // WideCharToMultiByte(CP_ACP, //ANSI Code Page + // WC_COMPOSITECHECK, + // aBSTR, + // nLength, + // pBuf, + // nLength, + // NULL, NULL); + // + // return sRetString; + // } + private: + void CHS() + { + cyVal.Lo ^= (sal_uInt32)-1; + cyVal.Hi ^= -1; + cyVal.Lo++; + if( !cyVal.Lo ) + cyVal.Hi++; + } + + void set(double n) + { + if( n >= 0 ) + { + cyVal.Hi = (sal_Int32)(n / (double)4294967296.0); + cyVal.Lo = (sal_uInt32)(n - ((double)cyVal.Hi * (double)4294967296.0)); + } + else { + cyVal.Hi = (sal_Int32)(-n / (double)4294967296.0); + cyVal.Lo = (sal_uInt32)(-n - ((double)cyVal.Hi * (double)4294967296.0)); + CHS(); + } + } + + }; + } +} +#endif // _CONNECTIVITY_ADO_AOLEVARIANT_HXX_ + diff --git a/connectivity/source/inc/ado/Aolewrap.hxx b/connectivity/source/inc/ado/Aolewrap.hxx new file mode 100644 index 000000000000..cd95ebf75e3c --- /dev/null +++ b/connectivity/source/inc/ado/Aolewrap.hxx @@ -0,0 +1,254 @@ +/************************************************************************* + * + * $RCSfile: Aolewrap.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADO_AOLEWRAP_HXX_ +#define _CONNECTIVITY_ADO_AOLEWRAP_HXX_ + +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif + +namespace connectivity +{ + namespace ado + { + ////////////////////////////////////////////////////////////////////////// + // + // Template-Klasse WpOLEBase<class T> + // ================================== + // + // Objekte dieser Klasse hält einen Zeiger auf ein Interface vom Typ T. + // Es gibt Konstruktoren und Zuweisungsoperator die sicherstellen, dass + // AddRef() und Release() entsprechend den COM-Konventionen gerufen werden. + // Ein Objekt kann auch keinen Zeiger halten (Nullzeiger), dann ergibt + // der Aufruf von IsValid() FALSE. + // + // Um effizientes pass-by-value machen zu koennen, ist diese (ebenso wie die + // abgeleiteten Klassen) eine ganz schmale Wrapper-Klasse unter Vermeidung + // virtueller Methoden und mit Inlining. + + //------------------------------------------------------------------------ + template<class T> class WpOLEBase + { + + protected: + T* pInterface; + + public: + + WpOLEBase(); + WpOLEBase(T* pInt); + + + //inline + WpOLEBase<T>& operator=(const WpOLEBase<T>& rhs) + { + if (rhs.pInterface != pInterface) + { + if (pInterface) pInterface->Release(); + pInterface = rhs.pInterface; + if (pInterface) pInterface->AddRef(); + } + return *this; + }; + + WpOLEBase<T>& operator=(T* rhs) + { + if (pInterface != rhs) + { + if (pInterface) pInterface->Release(); + pInterface = rhs; + if (pInterface) pInterface->AddRef(); + } + return *this; + } + + WpOLEBase(const WpOLEBase<T>& aWrapper) + { + operator=(aWrapper); + } + + virtual ~WpOLEBase() + { + if (pInterface) + { + pInterface->Release(); + pInterface = NULL; + } + } + + inline void clear() + { + if (pInterface) + { + pInterface->Release(); + pInterface = NULL; + } + } + + + inline sal_Bool IsValid() const {return pInterface != NULL;}; + operator IDispatch*() { return pInterface; } + operator T*() { return pInterface; } + }; + + + template<class T> WpOLEBase<T>::WpOLEBase<T>() + { + pInterface = NULL; + }; + + + template<class T> WpOLEBase<T>::WpOLEBase<T>(T* pInt) + { + pInterface = pInt; + }; + // kein AddRef(), da + // der nach Konvention von der erz. Methode + // schon durchgeführt wurde. + + + + + + ////////////////////////////////////////////////////////////////////////// + // + // Template-Klasse WpOLECollection<class Ts, class T, class WrapT> + // =============================================================== + // + // Diese Klasse, welche sich von WpOLEBase<Ts> ableitet, abstrahiert die + // den DAO-Collections gemeinsamen Eigenschaften: + // + // Sie werden über ein Interface Ts (etwa: DAOFields) angesprochen + // und koennen ueber get_Item (hier:GetItem) Items des Typs T (genauer: + // mit Interface T, etwa DAOField) herausgeben. + // + // Diese Wrapperklasse gibt aber nicht ein Interface T heraus, + // sondern ein Objekt der Klasse WrapT. Dieses muß eine Konstruktion + // durch T zulassen, vorzugsweise ist es von WpOLEBase<T> abgeleitet. + // + + //------------------------------------------------------------------------ + template<class Ts, class T, class WrapT> class WpOLECollection: public WpOLEBase<Ts> + { + public: + // Konstruktoren, operator= + // diese rufen nur die Oberklasse + WpOLECollection(Ts* pInt):WpOLEBase<Ts>(pInt){} + WpOLECollection(const WpOLECollection& rhs){operator=(rhs);} + inline WpOLECollection& operator=(const WpOLECollection& rhs) + {WpOLEBase<Ts>::operator=(rhs); return *this;}; + + ////////////////////////////////////////////////////////////////////// + + inline void Refresh(){pInterface->Refresh();}; + + inline sal_Int32 GetItemCount() const + { + sal_Int32 nCount = 0; + pInterface->get_Count(&nCount); + return nCount; + }; + + inline WrapT GetItem(sal_Int32 index) const + { + OSL_ENSHURE(index >= 0 && index<GetItemCount(),"Wrong index for field!"); + T* pT; + if (FAILED(pInterface->get_Item(OLEVariant(index), &pT))) return WrapT(NULL); + return WrapT(pT); + }; + + inline WrapT GetItem(const ::rtl::OUString& sStr) const + { + T* pT; + if (FAILED(pInterface->get_Item(OLEVariant(sStr), &pT))) return WrapT(NULL); + return WrapT(pT); + } + }; + + template<class Ts, class T, class WrapT> class WpOLEAppendCollection: + public WpOLECollection<Ts,T,WrapT> + { + + public: + // Konstruktoren, operator= + // diese rufen nur die Oberklasse + WpOLEAppendCollection(Ts* pInt):WpOLECollection<Ts,T,WrapT>(pInt){} + WpOLEAppendCollection(const WpOLEAppendCollection& rhs){operator=(rhs);} + inline WpOLEAppendCollection& operator=(const WpOLEAppendCollection& rhs) + {WpOLEBase<Ts>::operator=(rhs); return *this;}; + ////////////////////////////////////////////////////////////////////// + + inline sal_Bool Append(WrapT aWrapT) + { + return SUCCEEDED(pInterface->Append(aWrapT.pInterface)); + }; + + inline sal_Bool Delete(const ::rtl::OUString& sName) + { + return SUCCEEDED(pInterface->Delete(OLEVariant(sName))); + }; + + + }; + } +} +#endif // _CONNECTIVITY_ADO_AOLEWRAP_HXX_ + diff --git a/connectivity/source/inc/ado/Awrapado.hxx b/connectivity/source/inc/ado/Awrapado.hxx new file mode 100644 index 000000000000..84e60c600a33 --- /dev/null +++ b/connectivity/source/inc/ado/Awrapado.hxx @@ -0,0 +1,1021 @@ +/************************************************************************* + * + * $RCSfile: Awrapado.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADO_AWRAPADO_HXX_ +#define _CONNECTIVITY_ADO_AWRAPADO_HXX_ + +#include <tools/prewin.h> +// Includes fuer ADO +#include <oledb.h> +//#include <objbase.h> +//#include <initguid.h> +//#include <mapinls.h> +#include <ocidl.h> + +#ifndef _ADOINT_H_ +#include <adoint.h> +#endif + +#include <tools/postwin.h> + +#ifndef _CONNECTIVITY_ADO_ADOIMP_HXX_ +#include "ado/adoimp.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_AOLEWRAP_HXX_ +#include "ado/Aolewrap.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_AOLEVARIANT_HXX_ +#include "ado/Aolevariant.hxx" +#endif + +namespace connectivity +{ + namespace ado + { + class WpADOConnection; + class WpADOCommand; + class WpADORecordset; + class WpADOField; + class WpADOParameter; + class WpADOError; + class WpADOProperty; + + typedef WpOLEAppendCollection<ADOFields, ADOField, WpADOField> WpADOFields; + + //------------------------------------------------------------------------ + class WpADOConnection : public WpOLEBase<ADOConnection> + { + friend class WpADOCommand; + public: + + WpADOConnection(ADOConnection* pInt) : WpOLEBase<ADOConnection>(pInt){} + + WpADOConnection(const WpADOConnection& rhs){operator=(rhs);} + + inline WpADOConnection& operator=(const WpADOConnection& rhs) + {WpOLEBase<ADOConnection>::operator=(rhs); return *this;} + + ////////////////////////////////////////////////////////////////////// + + inline ADOProperties* get_Properties() const + { + ADOProperties* pProps=NULL; + pInterface->get_Properties(&pProps); + return pProps; + } + + inline rtl::OUString GetConnectionString() const + { + BSTR aBSTR; pInterface->get_ConnectionString(&aBSTR); + rtl::OUString sRetStr((sal_Unicode*)aBSTR); + SysFreeString(aBSTR); + return sRetStr; + } + + inline sal_Bool PutConnectionString(const ::rtl::OUString &aCon) const + { + return SUCCEEDED(pInterface->put_ConnectionString(SysAllocString(aCon.getStr()))); + } + + inline sal_Int32 GetCommandTimeout() const + { + sal_Int32 nRet; + pInterface->get_CommandTimeout(&nRet); + return nRet; + } + + inline void PutCommandTimeout(sal_Int32 nRet) + { + pInterface->put_CommandTimeout(nRet); + } + + inline sal_Int32 GetConnectionTimeout() const + { + sal_Int32 nRet; + pInterface->get_ConnectionTimeout(&nRet); + return nRet; + } + + inline void PutConnectionTimeout(sal_Int32 nRet) + { + pInterface->put_ConnectionTimeout(nRet); + } + + inline sal_Bool Close( ) + { + return (SUCCEEDED(pInterface->Close())); + } + + inline sal_Bool Execute(const ::rtl::OUString& _CommandText,OLEVariant& RecordsAffected,long Options, WpADORecordset** ppiRset) + { + return SUCCEEDED(pInterface->Execute(SysAllocString(_CommandText.getStr()),&RecordsAffected,Options,(_ADORecordset**)ppiRset)); + } + + inline sal_Bool BeginTrans() + { + sal_Int32 nIso; + return SUCCEEDED(pInterface->BeginTrans(&nIso)); + } + + inline sal_Bool CommitTrans( ) + { + return SUCCEEDED(pInterface->CommitTrans()); + } + + inline sal_Bool RollbackTrans( ) + { + return SUCCEEDED(pInterface->RollbackTrans()); + } + + inline sal_Bool Open(const ::rtl::OUString& ConnectionString, const ::rtl::OUString& UserID,const ::rtl::OUString& Password,long Options) + { + return SUCCEEDED(pInterface->Open(SysAllocString(ConnectionString.getStr()),SysAllocString(UserID.getStr()),SysAllocString(Password.getStr()),Options)); + } + + inline sal_Bool GetErrors(ADOErrors** pErrors) + { + return SUCCEEDED(pInterface->get_Errors(pErrors)); + } + + inline ::rtl::OUString GetDefaultDatabase() const + { + BSTR aBSTR; pInterface->get_DefaultDatabase(&aBSTR); + ::rtl::OUString sRetStr(aBSTR); + SysFreeString(aBSTR); return sRetStr; + } + + inline sal_Bool PutDefaultDatabase(const ::rtl::OUString& bstr) + { + return SUCCEEDED(pInterface->put_DefaultDatabase(SysAllocString(bstr.getStr()))); + } + + inline IsolationLevelEnum get_IsolationLevel() const + { + IsolationLevelEnum eNum; + pInterface->get_IsolationLevel(&eNum); + return eNum; + } + + inline sal_Bool put_IsolationLevel(const IsolationLevelEnum& eNum) + { + return SUCCEEDED(pInterface->put_IsolationLevel(eNum)); + } + + inline sal_Int32 get_Attributes() const + { + sal_Int32 nRet; + pInterface->get_Attributes(&nRet); + return nRet; + } + + inline sal_Bool put_Attributes(sal_Int32 nRet) + { + return SUCCEEDED(pInterface->put_Attributes(nRet)); + } + + inline CursorLocationEnum get_CursorLocation() const + { + CursorLocationEnum eNum; + pInterface->get_CursorLocation(&eNum); + return eNum; + } + + inline sal_Bool put_CursorLocation(const CursorLocationEnum &eNum) + { + return SUCCEEDED(pInterface->put_CursorLocation(eNum)); + } + + inline ConnectModeEnum get_Mode() const + { + ConnectModeEnum eNum; + pInterface->get_Mode(&eNum); + return eNum; + } + + inline sal_Bool put_Mode(const ConnectModeEnum &eNum) + { + + return SUCCEEDED(pInterface->put_Mode(eNum)); + } + + inline ::rtl::OUString get_Provider() const + { + BSTR aBSTR; pInterface->get_Provider(&aBSTR); + ::rtl::OUString sRetStr(aBSTR); + SysFreeString(aBSTR); return sRetStr; + } + + inline sal_Bool put_Provider(const ::rtl::OUString& bstr) + { + return SUCCEEDED(pInterface->put_Provider(SysAllocString(bstr.getStr()))); + } + + inline sal_Int32 get_State() const + { + sal_Int32 nRet; + pInterface->get_State(&nRet); + return nRet; + } + + inline sal_Bool OpenSchema(SchemaEnum eNum,OLEVariant& Restrictions,OLEVariant& SchemaID,ADORecordset**pprset) + { + return SUCCEEDED(pInterface->OpenSchema(eNum,Restrictions,SchemaID,pprset)); + } + + inline ::rtl::OUString get_Version() const + { + BSTR aBSTR; + pInterface->get_Version(&aBSTR); + ::rtl::OUString sRetStr(aBSTR); + SysFreeString(aBSTR); return sRetStr; + } + }; + + //------------------------------------------------------------------------ + class WpADOCommand : public WpOLEBase<ADOCommand> + { + public: + WpADOCommand(){} + // Konstruktoren, operator= + // diese rufen nur die Oberklasse + WpADOCommand(ADOCommand* pInt) : WpOLEBase<ADOCommand>(pInt){} + + WpADOCommand(const WpADOCommand& rhs){operator=(rhs);} + + inline WpADOCommand& operator=(const WpADOCommand& rhs) + { + WpOLEBase<ADOCommand>::operator=(rhs); return *this;} + + ////////////////////////////////////////////////////////////////////// + + sal_Bool putref_ActiveConnection( WpADOConnection *pCon) + { + return SUCCEEDED(pInterface->putref_ActiveConnection(pCon->pInterface)); + } + + void put_ActiveConnection(/* [in] */ const OLEVariant& vConn) + { + pInterface->put_ActiveConnection(vConn); + } + + inline void Create() + { + IClassFactory2* pIUnknown = NULL; + IUnknown *pOuter = NULL; + HRESULT hr; + hr = CoGetClassObject( ADOS::CLSID_ADOCOMMAND_21, + CLSCTX_INPROC_SERVER, + NULL, + IID_IClassFactory2, + (void**)&pIUnknown ); + + if( !FAILED( hr ) ) + { + pIUnknown->AddRef(); + ADOCommand* pCommand; + + hr = pIUnknown->CreateInstanceLic( pOuter, + NULL, + ADOS::IID_ADOCOMMAND_21, + ADOS::GetKeyStr(), + (void**) &pCommand); + + if( !FAILED( hr ) ) + { + pInterface = pCommand; + pInterface->AddRef(); + } + pIUnknown->Release(); + } + } + + inline sal_Int32 get_State() const + { + sal_Int32 nRet; + pInterface->get_State(&nRet); + return nRet; + } + + inline ::rtl::OUString get_CommandText() const + { + BSTR aBSTR; pInterface->get_CommandText(&aBSTR); + ::rtl::OUString sRetStr(aBSTR); + SysFreeString(aBSTR); return sRetStr; + } + + inline sal_Bool put_CommandText(const ::rtl::OUString &aCon) + { + BSTR bstr = SysAllocString(aCon.getStr()); + sal_Bool bErg = SUCCEEDED(pInterface->put_CommandText(bstr)); + SysFreeString(bstr); + return bErg; + } + + inline sal_Int32 get_CommandTimeout() const + { + sal_Int32 nRet; + pInterface->get_CommandTimeout(&nRet); + return nRet; + } + + inline void put_CommandTimeout(sal_Int32 nRet) + { + pInterface->put_CommandTimeout(nRet); + } + + inline sal_Bool get_Prepared() const + { + VARIANT_BOOL bPrepared; + pInterface->get_Prepared(&bPrepared); + return bPrepared == VARIANT_TRUE; + } + + inline sal_Bool put_Prepared(VARIANT_BOOL bPrepared) const + { + return SUCCEEDED(pInterface->put_Prepared(bPrepared)); + } + + inline sal_Bool Execute(OLEVariant& RecordsAffected,OLEVariant& Parameters,long Options, ADORecordset** ppiRset) + { + return SUCCEEDED(pInterface->Execute(&RecordsAffected,&Parameters,Options,ppiRset)); + } + + inline ADOParameter* CreateParameter(const ::rtl::OUString &bstr,DataTypeEnum Type,ParameterDirectionEnum Direction,long nSize,const OLEVariant &Value) + { + ADOParameter* pPara = NULL; + if(SUCCEEDED(pInterface->CreateParameter(bstr.getLength() ? SysAllocString(bstr.getStr()) : NULL,Type,Direction,nSize,Value,&pPara))) + return pPara; + return NULL; + } + + inline ADOParameters* get_Parameters() const + { + ADOParameters* pPara; + pInterface->get_Parameters(&pPara); + return pPara; + } + + inline sal_Bool put_CommandType( /* [in] */ CommandTypeEnum lCmdType) + { + return SUCCEEDED(pInterface->put_CommandType(lCmdType)); + } + + inline CommandTypeEnum get_CommandType( ) const + { + CommandTypeEnum eNum; + pInterface->get_CommandType(&eNum); + return eNum; + } + + // gibt den Namen des Feldes zur"ueck + inline ::rtl::OUString GetName() const + { + BSTR aBSTR; pInterface->get_Name(&aBSTR); + ::rtl::OUString sRetStr(aBSTR); + SysFreeString(aBSTR); return sRetStr; + } + + inline sal_Bool put_Name(const ::rtl::OUString& _Name) + { + return SUCCEEDED(pInterface->put_Name(SysAllocString(_Name.getStr()))); + } + inline sal_Bool Cancel() + { + return SUCCEEDED(pInterface->Cancel()); + } + }; + //------------------------------------------------------------------------ + class WpADOError:public WpOLEBase<ADOError> + { + public: + + // Konstruktoren, operator= + // diese rufen nur die Oberklasse + + WpADOError(ADOError* pInt):WpOLEBase<ADOError>(pInt){} + + WpADOError(const WpADOError& rhs){operator=(rhs);} + + inline WpADOError& operator=(const WpADOError& rhs) + {WpOLEBase<ADOError>::operator=(rhs); return *this;} + + ////////////////////////////////////////////////////////////////////// + + inline ::rtl::OUString GetDescription() const + { + BSTR aBSTR; pInterface->get_Description(&aBSTR); + ::rtl::OUString sRetStr(aBSTR); + SysFreeString(aBSTR); return sRetStr; + } + + inline ::rtl::OUString GetSource() const {BSTR aBSTR; pInterface->get_Source(&aBSTR); + ::rtl::OUString sRetStr(aBSTR); + SysFreeString(aBSTR); return sRetStr;} + + inline sal_Int32 GetNumber() const {sal_Int32 nErrNr; pInterface->get_Number(&nErrNr); + return nErrNr;} + + inline ::rtl::OUString GetSQLState() const + { + BSTR aBSTR; pInterface->get_SQLState(&aBSTR); + ::rtl::OUString sRetStr(aBSTR); + SysFreeString(aBSTR); return sRetStr; + } + + inline sal_Int32 GetNativeError() const + { + sal_Int32 nErrNr; pInterface->get_NativeError(&nErrNr); + return nErrNr; + } + }; + + + + //------------------------------------------------------------------------ + class WpADOField : public WpOLEBase<ADOField> + { + // friend class WpADOFields; + public: + + // Konstruktoren, operator= + // diese rufen nur die Oberklasse + WpADOField(ADOField* pInt=NULL):WpOLEBase<ADOField>(pInt){} + WpADOField(const WpADOField& rhs){operator=(rhs);} + + inline WpADOField& operator=(const WpADOField& rhs) + {WpOLEBase<ADOField>::operator=(rhs); return *this;} + ////////////////////////////////////////////////////////////////////// + + inline ADOProperties* get_Properties() + { + ADOProperties* pProps = NULL; + pInterface->get_Properties(&pProps); + return pProps; + } + + inline sal_Int32 GetActualSize() const + { + sal_Int32 nActualSize; pInterface->get_ActualSize(&nActualSize); + return nActualSize; + } + + inline sal_Int32 GetAttributes() const + { + sal_Int32 eADOSFieldAttributes; pInterface->get_Attributes(&eADOSFieldAttributes); + return eADOSFieldAttributes; + } + + inline sal_Int32 GetStatus() const + { + sal_Int32 eADOSFieldAttributes=0; + // pInterface->get_Status(&eADOSFieldAttributes); + return eADOSFieldAttributes; + } + + inline sal_Int32 GetDefinedSize() const + { + sal_Int32 nDefinedSize; + pInterface->get_DefinedSize(&nDefinedSize); + return nDefinedSize; + } + + // gibt den Namen des Feldes zur"ueck + inline ::rtl::OUString GetName() const + { + BSTR aBSTR; pInterface->get_Name(&aBSTR); + ::rtl::OUString sRetStr(aBSTR); + SysFreeString(aBSTR); return sRetStr; + } + + inline DataTypeEnum GetADOType() const + { + DataTypeEnum eType; pInterface->get_Type(&eType); + return eType; + } + + inline void get_Value(OLEVariant& aValVar) const + { + aValVar.setEmpty(); + pInterface->get_Value(&aValVar); + } + + inline OLEVariant get_Value() const + { + OLEVariant aValVar; + pInterface->get_Value(&aValVar); + return aValVar; + } + + inline sal_Bool PutValue(const OLEVariant& aVariant) + { + return (SUCCEEDED(pInterface->put_Value(aVariant))); + } + + inline sal_Int32 GetPrecision() const + { + sal_uInt8 eType; pInterface->get_Precision(&eType); + return eType; + } + + inline sal_Int32 GetNumericScale() const + { + sal_uInt8 eType; pInterface->get_NumericScale(&eType); + return eType; + } + + inline sal_Bool AppendChunk(const OLEVariant& _Variant) + { + return (SUCCEEDED(pInterface->AppendChunk(_Variant))); + } + + inline OLEVariant GetChunk(long Length) const + { + OLEVariant aValVar; + pInterface->GetChunk(Length,&aValVar); + return aValVar; + } + + inline void GetChunk(long Length,OLEVariant &aValVar) const + { + pInterface->GetChunk(Length,&aValVar); + } + + inline OLEVariant GetOriginalValue() const + { + OLEVariant aValVar; + pInterface->get_OriginalValue(&aValVar); + return aValVar; + } + + inline void GetOriginalValue(OLEVariant &aValVar) const + { + pInterface->get_OriginalValue(&aValVar); + } + + inline OLEVariant GetUnderlyingValue() const + { + OLEVariant aValVar; + pInterface->get_UnderlyingValue(&aValVar); + return aValVar; + } + + inline void GetUnderlyingValue(OLEVariant &aValVar) const + { + pInterface->get_UnderlyingValue(&aValVar); + } + + inline sal_Bool PutPrecision(sal_Int8 _prec) + { + return (SUCCEEDED(pInterface->put_Precision(_prec))); + } + + inline sal_Bool PutNumericScale(sal_Int8 _prec) + { + return (SUCCEEDED(pInterface->put_NumericScale(_prec))); + } + + inline void PutADOType(DataTypeEnum eType) + { + pInterface->put_Type(eType); + } + + inline sal_Bool PutDefinedSize(sal_Int32 _nDefSize) + { + return (SUCCEEDED(pInterface->put_DefinedSize(_nDefSize))); + } + + inline sal_Bool PutAttributes(sal_Int32 _nDefSize) + { + return (SUCCEEDED(pInterface->put_Attributes(_nDefSize))); + } + }; + + + + //------------------------------------------------------------------------ + class WpADOProperty: public WpOLEBase<ADOProperty> + { + friend class WpADOProperties; + + public: + // Konstruktoren, operator= + // diese rufen nur die Oberklasse + WpADOProperty(ADOProperty* pInt):WpOLEBase<ADOProperty>(pInt){} + WpADOProperty(const WpADOProperty& rhs){operator=(rhs);} + inline WpADOProperty& operator=(const WpADOProperty& rhs) + {WpOLEBase<ADOProperty>::operator=(rhs); return *this;} + ////////////////////////////////////////////////////////////////////// + + inline OLEVariant GetValue() const + { + OLEVariant aValVar; + pInterface->get_Value(&aValVar); + return aValVar; + } + + inline void GetValue(OLEVariant &aValVar) const + { + pInterface->get_Value(&aValVar); + } + + inline sal_Bool PutValue(const OLEVariant &aValVar) + { + return (SUCCEEDED(pInterface->put_Value(aValVar))); + } + + inline ::rtl::OUString GetName() const + { + BSTR aBSTR; pInterface->get_Name(&aBSTR); + ::rtl::OUString sRetStr(aBSTR); + SysFreeString(aBSTR); return sRetStr; + } + + inline DataTypeEnum GetADOType() const + { + DataTypeEnum eType; pInterface->get_Type(&eType); + return eType; + } + + inline sal_Int32 GetAttributes() const + { + sal_Int32 eADOSFieldAttributes; pInterface->get_Attributes(&eADOSFieldAttributes); + return eADOSFieldAttributes; + } + + inline sal_Bool PutAttributes(sal_Int32 _nDefSize) + { + return (SUCCEEDED(pInterface->put_Attributes(_nDefSize))); + } + }; + + + class WpADORecordset:public WpOLEBase<ADORecordset> + { + + public: + // Konstruktoren, operator= + // diese rufen nur die Oberklasse + WpADORecordset(ADORecordset* pInt=NULL):WpOLEBase<ADORecordset>(pInt){} + WpADORecordset(const WpADORecordset& rhs){operator=(rhs);} + inline WpADORecordset& operator=(const WpADORecordset& rhs) + { + WpOLEBase<ADORecordset>::operator=(rhs); + return *this; + } + ~WpADORecordset() + { + // if(pInterface && get_State() == adStateOpen) + // Close(); + } + ////////////////////////////////////////////////////////////////////// + inline void Create() + { + IClassFactory2* pIUnknown = NULL; + IUnknown *pOuter = NULL; + HRESULT hr; + hr = CoGetClassObject( ADOS::CLSID_ADORECORDSET_21, + CLSCTX_INPROC_SERVER, + NULL, + IID_IClassFactory2, + (void**)&pIUnknown ); + + if( !FAILED( hr ) ) + { + pIUnknown->AddRef(); + + ADORecordset *pRec = NULL; + hr = pIUnknown->CreateInstanceLic( pOuter, + NULL, + ADOS::IID_ADORECORDSET_21, + ADOS::GetKeyStr(), + (void**) &pRec); + + if( !FAILED( hr ) ) + { + pInterface = pRec; + pInterface->AddRef(); + } + pIUnknown->Release(); + } + } + + inline sal_Bool Open( + /* [optional][in] */ VARIANT Source, + /* [optional][in] */ VARIANT ActiveConnection, + /* [defaultvalue][in] */ CursorTypeEnum CursorType, + /* [defaultvalue][in] */ LockTypeEnum LockType, + /* [defaultvalue][in] */ sal_Int32 Options) + { + return (SUCCEEDED(pInterface->Open(Source,ActiveConnection,CursorType,LockType,Options))); + } + + + inline LockTypeEnum GetLockType() + { + LockTypeEnum eType; + pInterface->get_LockType(&eType); + return eType; + } + + inline void Close() + { + pInterface->Close(); + } + + inline sal_Bool Cancel() const + { + return (SUCCEEDED(pInterface->Cancel())); + } + + inline sal_Int32 get_State( ) + { + sal_Int32 nState = 0; + pInterface->get_State(&nState); + return nState; + } + + inline sal_Bool Supports( /* [in] */ CursorOptionEnum CursorOptions) + { + VARIANT_BOOL bSupports; + pInterface->Supports(CursorOptions,&bSupports); + return (sal_Bool) bSupports; + } + + PositionEnum get_AbsolutePosition() + { + PositionEnum aTemp; + pInterface->get_AbsolutePosition(&aTemp); + return aTemp; + } + + inline void GetDataSource(IUnknown** pIUnknown) const + { + pInterface->get_DataSource(pIUnknown); + } + + inline void PutRefDataSource(IUnknown* pIUnknown) + { + pInterface->putref_DataSource(pIUnknown); + } + + inline void GetBookmark(VARIANT& var) + { + pInterface->get_Bookmark(&var); + } + + inline OLEVariant GetBookmark() + { + OLEVariant var; + pInterface->get_Bookmark(&var); + return var; + } + + CompareEnum CompareBookmarks(const OLEVariant& left,const OLEVariant& right) + { + CompareEnum eNum; + pInterface->CompareBookmarks(left,right,&eNum); + return eNum; + } + + inline sal_Bool SetBookmark(const OLEVariant &pSafeAr) + { + return SUCCEEDED(pInterface->put_Bookmark(pSafeAr)); + } + + + inline ADOFields* GetFields() const + { + ADOFields* pFields; + pInterface->get_Fields(&pFields); + return pFields; + } + + + inline sal_Bool Move(sal_Int32 nRows, VARIANT aBmk) {return SUCCEEDED(pInterface->Move(nRows, aBmk));} + inline sal_Bool MoveNext() {return SUCCEEDED(pInterface->MoveNext());} + inline sal_Bool MovePrevious() {return SUCCEEDED(pInterface->MovePrevious());} + inline sal_Bool MoveFirst() {return SUCCEEDED(pInterface->MoveFirst());} + inline sal_Bool MoveLast() {return SUCCEEDED(pInterface->MoveLast());} + + inline sal_Bool IsAtBOF() const + { + VARIANT_BOOL bIsAtBOF; + pInterface->get_BOF(&bIsAtBOF); + return (sal_Bool) bIsAtBOF; + } + + inline sal_Bool IsAtEOF() const + { + VARIANT_BOOL bIsAtEOF; + pInterface->get_EOF(&bIsAtEOF); + return (sal_Bool) bIsAtEOF; + } + + inline sal_Bool Delete(AffectEnum eNum) + { + return SUCCEEDED(pInterface->Delete(eNum)); + } + + inline sal_Bool AddNew(const OLEVariant &FieldList,const OLEVariant &Values) + { + return SUCCEEDED(pInterface->AddNew(FieldList,Values)); + } + + inline sal_Bool Update(const OLEVariant &FieldList,const OLEVariant &Values) + { + return SUCCEEDED(pInterface->Update(FieldList,Values)); + } + + inline sal_Bool CancelUpdate() + { + return SUCCEEDED(pInterface->CancelUpdate()); + } + + inline ADOProperties* get_Properties() const + { + ADOProperties* pProps=NULL; + pInterface->get_Properties(&pProps); + return pProps; + } + + inline sal_Bool NextRecordset(OLEVariant& RecordsAffected,ADORecordset** ppiRset) + { + return SUCCEEDED(pInterface->NextRecordset(&RecordsAffected,ppiRset)); + } + + inline sal_Bool get_RecordCount(sal_Int32 &_nRet) const + { + return SUCCEEDED(pInterface->get_RecordCount(&_nRet)); + } + + inline sal_Bool get_MaxRecords(sal_Int32 &_nRet) const + { + return SUCCEEDED(pInterface->get_MaxRecords(&_nRet)); + } + + inline sal_Bool put_MaxRecords(sal_Int32 _nRet) + { + return SUCCEEDED(pInterface->put_MaxRecords(_nRet)); + } + + inline sal_Bool get_CursorType(CursorTypeEnum &_nRet) const + { + return SUCCEEDED(pInterface->get_CursorType(&_nRet)); + } + + inline sal_Bool put_CursorType(CursorTypeEnum _nRet) + { + return SUCCEEDED(pInterface->put_CursorType(_nRet)); + } + + inline sal_Bool get_LockType(LockTypeEnum &_nRet) const + { + return SUCCEEDED(pInterface->get_LockType(&_nRet)); + } + + inline sal_Bool put_LockType(LockTypeEnum _nRet) + { + return SUCCEEDED(pInterface->put_LockType(_nRet)); + } + + inline sal_Bool get_CacheSize(sal_Int32 &_nRet) const + { + return SUCCEEDED(pInterface->get_CacheSize(&_nRet)); + } + + inline sal_Bool put_CacheSize(sal_Int32 _nRet) + { + return SUCCEEDED(pInterface->put_CacheSize(_nRet)); + } + + inline sal_Bool UpdateBatch(AffectEnum AffectRecords) + { + return SUCCEEDED(pInterface->UpdateBatch(AffectRecords)); + } + }; + + //------------------------------------------------------------------------ + class WpADOParameter:public WpOLEBase<ADOParameter> + { + public: + // Konstruktoren, operator= + // diese rufen nur die Oberklasse + WpADOParameter(ADOParameter* pInt):WpOLEBase<ADOParameter>(pInt){} + WpADOParameter(const WpADOParameter& rhs):WpOLEBase<ADOParameter>(rhs){} + inline WpADOParameter& operator=(const WpADOParameter& rhs) + {WpOLEBase<ADOParameter>::operator=(rhs); return *this;} + ////////////////////////////////////////////////////////////////////// + + inline ::rtl::OUString GetName() const {BSTR aBSTR; pInterface->get_Name(&aBSTR); + ::rtl::OUString sRetStr(aBSTR); + SysFreeString(aBSTR); return sRetStr;} + + inline DataTypeEnum GetADOType() const + { + DataTypeEnum eType; pInterface->get_Type(&eType); + return eType; + } + + inline sal_Int32 GetAttributes() const + { + sal_Int32 eADOSFieldAttributes; pInterface->get_Attributes(&eADOSFieldAttributes); + return eADOSFieldAttributes; + } + + inline sal_Int32 GetPrecision() const + { + sal_uInt8 eType; pInterface->get_Precision(&eType); + return eType; + } + + inline sal_Int32 GetNumericScale() const + { + sal_uInt8 eType; pInterface->get_NumericScale(&eType); + return eType; + } + + inline ParameterDirectionEnum get_Direction() const + { + ParameterDirectionEnum alParmDirection; + pInterface->get_Direction(&alParmDirection); + return alParmDirection; + } + + inline void GetValue(OLEVariant& aValVar) const + { + pInterface->get_Value(&aValVar); + } + + inline OLEVariant GetValue() const + { + OLEVariant aValVar; + pInterface->get_Value(&aValVar); + return aValVar; + } + + inline sal_Bool PutValue(const OLEVariant& aVariant) + { + return (SUCCEEDED(pInterface->put_Value(aVariant))); + } + }; + } +} +#endif //_CONNECTIVITY_ADO_AWRAPADO_HXX_ + diff --git a/connectivity/source/inc/ado/Awrapadox.hxx b/connectivity/source/inc/ado/Awrapadox.hxx new file mode 100644 index 000000000000..2257cf7835af --- /dev/null +++ b/connectivity/source/inc/ado/Awrapadox.hxx @@ -0,0 +1,634 @@ +/************************************************************************* + * + * $RCSfile: Awrapadox.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_AWRAPADOX_HXX_ +#define _CONNECTIVITY_ADO_AWRAPADOX_HXX_ + +// Includes fuer ADO +#include <tools/prewin.h> +//#include <oledb.h> +//#include <objbase.h> +//#include <initguid.h> +//#include <mapinls.h> +//#include <ocidl.h> + +#ifndef __User_FWD_DEFINED__ +#define __User_FWD_DEFINED__ +typedef struct _ADOUser User; +#endif /* __User_FWD_DEFINED__ */ + +#ifndef __Group_FWD_DEFINED__ +#define __Group_FWD_DEFINED__ +typedef struct _ADOGroup Group; +#endif /* __Group_FWD_DEFINED__ */ + +#ifndef __Column_FWD_DEFINED__ +#define __Column_FWD_DEFINED__ +typedef struct _ADOColumn Column; +#endif /* __Column_FWD_DEFINED__ */ + +#ifndef __Index_FWD_DEFINED__ +#define __Index_FWD_DEFINED__ +typedef struct _ADOIndex Index; +#endif /* __cplusplus */ + +#ifndef __Key_FWD_DEFINED__ +#define __Key_FWD_DEFINED__ +typedef struct _ADOKey Key; +#endif /* __Key_FWD_DEFINED__ */ + +#ifndef __Table_FWD_DEFINED__ +#define __Table_FWD_DEFINED__ +typedef struct _ADOTable Table; +#endif /* __Table_FWD_DEFINED__ */ + +#ifndef _ADOINT_H_ +#include <adoint.h> +#endif + +#ifndef _ADOCTINT_H_ +#include <ado/adoctint.h> +#endif +#include <tools/postwin.h> + +#ifndef _CONNECTIVITY_ADO_AOLEWRAP_HXX_ +#include "ado/Aolewrap.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_AOLEVARIANT_HXX_ +#include "ado/Aolevariant.hxx" +#endif +#ifndef _CONNECTIVITY_ADO_ADOIMP_HXX_ +#include "ado/adoimp.hxx" +#endif +namespace connectivity +{ + namespace ado + { + class WpADOColumn : public WpOLEBase<_ADOColumn> + { + public: + WpADOColumn(_ADOColumn* pInt=NULL) : WpOLEBase<_ADOColumn>(pInt){} + + void Create(); + + inline WpADOColumn& operator=(const WpADOColumn& rhs) + {WpOLEBase<_ADOColumn>::operator=(rhs); return *this;} + + ::rtl::OUString get_Name() const + { + BSTR aBSTR; + pInterface->get_Name(&aBSTR); + rtl::OUString sRetStr((sal_Unicode*)aBSTR); + SysFreeString(aBSTR); + return sRetStr; + } + + void put_Name(const ::rtl::OUString& _rName) + { + pInterface->put_Name(SysAllocString(_rName.getStr())); + } + + DataTypeEnum get_Type() const + { + DataTypeEnum eNum; + pInterface->get_Type(&eNum); + return eNum; + } + + void put_Type(const DataTypeEnum& _eNum) + { + pInterface->put_Type(_eNum); + } + + sal_Int32 get_Precision() const + { + sal_Int32 nPrec=0; + pInterface->get_Precision(&nPrec); + return nPrec; + } + + void put_Precision(sal_Int32 _nPre) + { + pInterface->put_Precision(_nPre); + } + + sal_Int32 get_NumericScale() const + { + sal_uInt8 nPrec=0; + pInterface->get_NumericScale(&nPrec); + return nPrec; + } + + void put_NumericScale(sal_Int32 _nScale) + { + pInterface->put_NumericScale(_nScale); + } + + SortOrderEnum get_SortOrder() const + { + SortOrderEnum nPrec; + pInterface->get_SortOrder(&nPrec); + return nPrec; + } + + void put_SortOrder(SortOrderEnum _nScale) + { + pInterface->put_SortOrder(_nScale); + } + + ColumnAttributesEnum get_Attributes() const + { + ColumnAttributesEnum eNum; + pInterface->get_Attributes(&eNum); + return eNum; + } + + void put_Attributes(const ColumnAttributesEnum& _eNum) + { + pInterface->put_Attributes(_eNum); + } + + ADOProperties* get_Properties() const + { + ADOProperties* pProps = NULL; + pInterface->get_Properties(&pProps); + return pProps; + } + }; + + class WpADOKey : public WpOLEBase<ADOKey> + { + public: + WpADOKey(ADOKey* pInt=NULL) : WpOLEBase<ADOKey>(pInt){} + + inline WpADOKey& operator=(const WpADOKey& rhs) + {WpOLEBase<ADOKey>::operator=(rhs); return *this;} + + void Create(); + + ::rtl::OUString get_Name() const + { + BSTR aBSTR; + pInterface->get_Name(&aBSTR); + rtl::OUString sRetStr((sal_Unicode*)aBSTR); + SysFreeString(aBSTR); + return sRetStr; + } + + void put_Name(const ::rtl::OUString& _rName) + { + pInterface->put_Name(SysAllocString(_rName.getStr())); + } + + KeyTypeEnum get_Type() const + { + KeyTypeEnum eNum; + pInterface->get_Type(&eNum); + return eNum; + } + + void put_Type(const KeyTypeEnum& _eNum) + { + pInterface->put_Type(_eNum); + } + + ::rtl::OUString get_RelatedTable() const + { + BSTR aBSTR; + pInterface->get_RelatedTable(&aBSTR); + rtl::OUString sRetStr((sal_Unicode*)aBSTR); + SysFreeString(aBSTR); + return sRetStr; + } + + void put_RelatedTable(const ::rtl::OUString& _rName) + { + pInterface->put_RelatedTable(SysAllocString(_rName.getStr())); + } + + RuleEnum get_DeleteRule() const + { + RuleEnum eNum; + pInterface->get_DeleteRule(&eNum); + return eNum; + } + + void put_DeleteRule(const RuleEnum& _eNum) + { + pInterface->put_DeleteRule(_eNum); + } + + RuleEnum get_UpdateRule() const + { + RuleEnum eNum; + pInterface->get_UpdateRule(&eNum); + return eNum; + } + + void put_UpdateRule(const RuleEnum& _eNum) + { + pInterface->put_UpdateRule(_eNum); + } + + ADOColumns* get_Columns() const + { + ADOColumns* pCols = NULL; + pInterface->get_Columns(&pCols); + return pCols; + } + }; + + class WpADOIndex : public WpOLEBase<_ADOIndex> + { + public: + WpADOIndex(_ADOIndex* pInt=NULL) : WpOLEBase<_ADOIndex>(pInt){} + + inline WpADOIndex& operator=(const WpADOIndex& rhs) + {WpOLEBase<_ADOIndex>::operator=(rhs); return *this;} + + void Create(); + + ::rtl::OUString get_Name() const + { + BSTR aBSTR; + pInterface->get_Name(&aBSTR); + rtl::OUString sRetStr((sal_Unicode*)aBSTR); + SysFreeString(aBSTR); + return sRetStr; + } + + void put_Name(const ::rtl::OUString& _rName) + { + pInterface->put_Name(SysAllocString(_rName.getStr())); + } + + sal_Bool get_Clustered() const + { + VARIANT_BOOL eNum; + pInterface->get_Clustered(&eNum); + return eNum == VARIANT_TRUE; + } + + void put_Clustered(sal_Bool _b) + { + pInterface->put_Clustered(_b ? VARIANT_TRUE : VARIANT_FALSE); + } + + sal_Bool get_Unique() const + { + VARIANT_BOOL eNum; + pInterface->get_Unique(&eNum); + return eNum == VARIANT_TRUE; + } + + void put_Unique(sal_Bool _b) + { + pInterface->put_Unique(_b ? VARIANT_TRUE : VARIANT_FALSE); + } + + sal_Bool get_PrimaryKey() const + { + VARIANT_BOOL eNum; + pInterface->get_PrimaryKey(&eNum); + return eNum == VARIANT_TRUE; + } + + void put_PrimaryKey(sal_Bool _b) + { + pInterface->put_PrimaryKey(_b ? VARIANT_TRUE : VARIANT_FALSE); + } + + ADOColumns* get_Columns() const + { + ADOColumns* pCols = NULL; + pInterface->get_Columns(&pCols); + return pCols; + } + }; + + class WpADOCatalog : public WpOLEBase<_ADOCatalog> + { + public: + WpADOCatalog(_ADOCatalog* pInt = NULL) : WpOLEBase<_ADOCatalog>(pInt){} + + inline WpADOCatalog& operator=(const WpADOCatalog& rhs) + {WpOLEBase<_ADOCatalog>::operator=(rhs); return *this;} + + ::rtl::OUString GetObjectOwner(const ::rtl::OUString& _rName, ObjectTypeEnum _eNum); + + void putref_ActiveConnection(IDispatch* pCon) + { + pInterface->putref_ActiveConnection(pCon); + } + + ADOTables* get_Tables() + { + ADOTables* pRet = NULL; + pInterface->get_Tables(&pRet); + return pRet; + } + + ADOViews* get_Views() + { + ADOViews* pRet = NULL; + pInterface->get_Views(&pRet); + return pRet; + } + + ADOGroups* get_Groups() + { + ADOGroups* pRet = NULL; + pInterface->get_Groups(&pRet); + return pRet; + } + + ADOUsers* get_Users() + { + ADOUsers* pRet = NULL; + pInterface->get_Users(&pRet); + return pRet; + } + + ADOProcedures* get_Procedures() + { + ADOProcedures* pRet = NULL; + pInterface->get_Procedures(&pRet); + return pRet; + } + + void Create(); + }; + + class WpADOTable : public WpOLEBase<_ADOTable> + { + public: + WpADOTable(_ADOTable* pInt=NULL) : WpOLEBase<_ADOTable>(pInt){} + + inline WpADOTable& operator=(const WpADOTable& rhs) + {WpOLEBase<_ADOTable>::operator=(rhs); return *this;} + + void Create(); + + ::rtl::OUString get_Name() const + { + BSTR aBSTR; + pInterface->get_Name(&aBSTR); + rtl::OUString sRetStr((sal_Unicode*)aBSTR); + SysFreeString(aBSTR); + return sRetStr; + } + + void put_Name(const ::rtl::OUString& _rName) + { + pInterface->put_Name(SysAllocString(_rName.getStr())); + } + + ::rtl::OUString get_Type() const + { + BSTR aBSTR; + pInterface->get_Type(&aBSTR); + rtl::OUString sRetStr((sal_Unicode*)aBSTR); + SysFreeString(aBSTR); + return sRetStr; + } + + ADOColumns* get_Columns() const + { + ADOColumns* pCols = NULL; + pInterface->get_Columns(&pCols); + return pCols; + } + + ADOIndexes* get_Indexes() const + { + ADOIndexes* pCols = NULL; + pInterface->get_Indexes(&pCols); + return pCols; + } + + ADOKeys* get_Keys() const + { + ADOKeys* pCols = NULL; + pInterface->get_Keys(&pCols); + return pCols; + } + + WpADOCatalog get_ParentCatalog() const + { + ADOCatalog* pCat = NULL; + pInterface->get_ParentCatalog(&pCat); + return WpADOCatalog(pCat); + } + + ADOProperties* get_Properties() const + { + ADOProperties* pProps = NULL; + pInterface->get_Properties(&pProps); + return pProps; + } + }; + + class WpADOView : public WpOLEBase<ADOView> + { + public: + WpADOView(ADOView* pInt=NULL) : WpOLEBase<ADOView>(pInt){} + + inline WpADOView& operator=(const WpADOView& rhs) + {WpOLEBase<ADOView>::operator=(rhs); return *this;} + + void Create(); + + ::rtl::OUString get_Name() const + { + BSTR aBSTR; + pInterface->get_Name(&aBSTR); + rtl::OUString sRetStr((sal_Unicode*)aBSTR); + SysFreeString(aBSTR); + return sRetStr; + } + + void get_Command(OLEVariant& _rVar) const + { + pInterface->get_Command(&_rVar); + } + + void put_Command(OLEVariant& _rVar) + { + pInterface->put_Command(_rVar); + } + }; + + class WpADOGroup : public WpOLEBase<_ADOGroup> + { + public: + WpADOGroup(_ADOGroup* pInt=NULL) : WpOLEBase<_ADOGroup>(pInt){} + + inline WpADOGroup& operator=(const WpADOGroup& rhs) + {WpOLEBase<_ADOGroup>::operator=(rhs); return *this;} + + void Create(); + + ::rtl::OUString get_Name() const + { + BSTR aBSTR; + pInterface->get_Name(&aBSTR); + rtl::OUString sRetStr((sal_Unicode*)aBSTR); + SysFreeString(aBSTR); + return sRetStr; + } + + void put_Name(const ::rtl::OUString& _rName) + { + pInterface->put_Name(SysAllocString(_rName.getStr())); + } + + RightsEnum GetPermissions( + /* [in] */ const OLEVariant& Name, + /* [in] */ ObjectTypeEnum ObjectType) + { + RightsEnum Rights; + OLEVariant ObjectTypeId; + ObjectTypeId.setNoArg(); + pInterface->GetPermissions(Name,ObjectType,ObjectTypeId,&Rights); + return Rights; + } + + sal_Bool SetPermissions( + /* [in] */ const OLEVariant& Name, + /* [in] */ ObjectTypeEnum ObjectType, + /* [in] */ ActionEnum Action, + /* [in] */ RightsEnum Rights) + { + OLEVariant ObjectTypeId; + ObjectTypeId.setNoArg(); + return SUCCEEDED(pInterface->SetPermissions(Name,ObjectType,Action,Rights,adInheritNone,ObjectTypeId)); + } + + ADOUsers* get_Users( ) + { + ADOUsers* pRet = NULL; + pInterface->get_Users( &pRet); + return pRet; + } + }; + + class WpADOUser : public WpOLEBase<_ADOUser> + { + public: + WpADOUser(_ADOUser* pInt=NULL) : WpOLEBase<_ADOUser>(pInt){} + + inline WpADOUser& operator=(const WpADOUser& rhs) + {WpOLEBase<_ADOUser>::operator=(rhs); return *this;} + + void Create(); + + ::rtl::OUString get_Name() const + { + BSTR aBSTR; + pInterface->get_Name(&aBSTR); + rtl::OUString sRetStr((sal_Unicode*)aBSTR); + SysFreeString(aBSTR); + return sRetStr; + } + + void put_Name(const ::rtl::OUString& _rName) + { + pInterface->put_Name(SysAllocString(_rName.getStr())); + } + + sal_Bool ChangePassword(const ::rtl::OUString& _rPwd,const ::rtl::OUString& _rNewPwd) + { + return SUCCEEDED(pInterface->ChangePassword(SysAllocString(_rPwd.getStr()),SysAllocString(_rNewPwd.getStr()))); + } + + ADOGroups* get_Groups() + { + ADOGroups* pRet = NULL; + pInterface->get_Groups(&pRet); + return pRet; + } + + RightsEnum GetPermissions( + /* [in] */ const OLEVariant& Name, + /* [in] */ ObjectTypeEnum ObjectType) + { + RightsEnum Rights; + OLEVariant ObjectTypeId; + ObjectTypeId.setNoArg(); + pInterface->GetPermissions(Name,ObjectType,ObjectTypeId,&Rights); + return Rights; + } + + sal_Bool SetPermissions( + /* [in] */ const OLEVariant& Name, + /* [in] */ ObjectTypeEnum ObjectType, + /* [in] */ ActionEnum Action, + /* [in] */ RightsEnum Rights) + { + OLEVariant ObjectTypeId; + ObjectTypeId.setNoArg(); + return SUCCEEDED(pInterface->SetPermissions(Name,ObjectType,Action,Rights,adInheritNone,ObjectTypeId)); + } + }; + } +} +#endif // _CONNECTIVITY_ADO_AWRAPADOX_HXX_ + diff --git a/connectivity/source/inc/ado/adoimp.hxx b/connectivity/source/inc/ado/adoimp.hxx new file mode 100644 index 000000000000..bc05046dce9a --- /dev/null +++ b/connectivity/source/inc/ado/adoimp.hxx @@ -0,0 +1,146 @@ +/************************************************************************* + * + * $RCSfile: adoimp.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADO_ADOIMP_HXX_ +#define _CONNECTIVITY_ADO_ADOIMP_HXX_ + +#ifndef _COM_SUN_STAR_SDBC_SQLEXCEPTION_HPP_ +#include <com/sun/star/sdbc/SQLException.hpp> +#endif + +struct ADOConnection; +enum DataTypeEnum; +namespace connectivity +{ + namespace ado + { + + class ADOS + { + public: + // Auch hier: BSTR mit SysFreeString() freigeben! + inline static BSTR GetKeyStr() + { + return (BSTR)::rtl::OUString::createFromAscii("gxwaezucfyqpwjgqbcmtsncuhwsnyhiohwxz").getStr(); + } + + static const CLSID CLSID_ADOCATALOG_25; + static const IID IID_ADOCATALOG_25; + + static const CLSID CLSID_ADOCONNECTION_21; + static const IID IID_ADOCONNECTION_21; + + static const CLSID CLSID_ADOCOMMAND_21; + static const IID IID_ADOCOMMAND_21; + + static const CLSID CLSID_ADORECORDSET_21; + static const IID IID_ADORECORDSET_21; + + static const CLSID CLSID_ADOINDEX_25; + static const IID IID_ADOINDEX_25; + + static const CLSID CLSID_ADOCOLUMN_25; + static const IID IID_ADOCOLUMN_25; + + static const CLSID CLSID_ADOKEY_25; + static const IID IID_ADOKEY_25; + + static const CLSID CLSID_ADOTABLE_25; + static const IID IID_ADOTABLE_25; + + static const CLSID CLSID_ADOGROUP_25; + static const IID IID_ADOGROUP_25; + + static const CLSID CLSID_ADOUSER_25; + static const IID IID_ADOUSER_25; + + static const CLSID CLSID_ADOVIEW_25; + static const IID IID_ADOVIEW_25; + + static void ThrowException(ADOConnection* _pAdoCon,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + static sal_Int32 MapADOType2Jdbc(DataTypeEnum eType); + static DataTypeEnum MapJdbc2ADOType(sal_Int32 _nType); + }; + + + } +} + +#define ADO_PROP(ItemName) \ + WpADOProperty aProp(aProps.GetItem(ItemName)); \ + OLEVariant aVar; \ + if(aProp.IsValid()) \ + aVar = aProp.GetValue(); \ + else \ + ADOS::ThrowException(*m_pADOConnection,*this); + + +#define ADO_GETFIELD(Name) \ + ADOFields* pFields = NULL; \ + m_pRecordSet->get_Fields(&pFields); \ + WpOLEAppendCollection<ADOFields, ADOField, WpADOField> aFields(pFields); \ + WpADOField aField(aFields.GetItem(Name-1)); \ + if(!aField.IsValid()) \ + throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any()); + + +#endif //_CONNECTIVITY_ADO_ADOIMP_HXX_ + + diff --git a/connectivity/source/inc/dbase/DCatalog.hxx b/connectivity/source/inc/dbase/DCatalog.hxx new file mode 100644 index 000000000000..03fbce362706 --- /dev/null +++ b/connectivity/source/inc/dbase/DCatalog.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * $RCSfile: DCatalog.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_CATALOG_HXX_ +#define _CONNECTIVITY_DBASE_CATALOG_HXX_ + +#ifndef _CONNECTIVITY_FILE_CATALOG_HXX_ +#include "file/FCatalog.hxx" +#endif + +namespace connectivity +{ + namespace dbase + { + class ODbaseConnection; + class ODbaseCatalog : public file::OFileCatalog + { + public: + virtual void refreshTables(); + + public: + ODbaseCatalog(ODbaseConnection* _pCon); + }; + } +} +#endif // _CONNECTIVITY_DBASE_CATALOG_HXX_ + diff --git a/connectivity/source/inc/dbase/DColumns.hxx b/connectivity/source/inc/dbase/DColumns.hxx new file mode 100644 index 000000000000..0f5005a8689d --- /dev/null +++ b/connectivity/source/inc/dbase/DColumns.hxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * $RCSfile: DColumns.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_COLUMNS_HXX_ +#define _CONNECTIVITY_DBASE_COLUMNS_HXX_ + +#ifndef _CONNECTIVITY_FILE_COLUMNS_HXX_ +#include "file/FColumns.hxx" +#endif + +namespace connectivity +{ + namespace dbase + { + class ODbaseColumns : public file::OColumns + { + protected: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + public: + ODbaseColumns(file::OFileTable* _pTable, + ::osl::Mutex& _rMutex, + const ::std::vector< ::rtl::OUString> &_rVector + ) : file::OColumns(_pTable,_rMutex,_rVector) + {} + + }; + } +} +#endif // _CONNECTIVITY_DBASE_COLUMNS_HXX_ + diff --git a/connectivity/source/inc/dbase/DConnection.hxx b/connectivity/source/inc/dbase/DConnection.hxx new file mode 100644 index 000000000000..0b40007042d9 --- /dev/null +++ b/connectivity/source/inc/dbase/DConnection.hxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * $RCSfile: DConnection.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_DCONNECTION_HXX_ +#define _CONNECTIVITY_DBASE_DCONNECTION_HXX_ + +#ifndef _CONNECTIVITY_FILE_OCONNECTION_HXX_ +#include "file/FConnection.hxx" +#endif + +namespace connectivity +{ + namespace dbase + { + class ODriver; + class ODbaseConnection : public file::OConnection + { + public: + ODbaseConnection(ODriver* _pDriver); + virtual ~ODbaseConnection(); + + // XServiceInfo + DECLARE_SERVICE_INFO(); + + // XConnection + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > createCatalog(); + }; + } +} +#endif // _CONNECTIVITY_DBASE_DCONNECTION_HXX_ + diff --git a/connectivity/source/inc/dbase/DDatabaseMetaData.hxx b/connectivity/source/inc/dbase/DDatabaseMetaData.hxx new file mode 100644 index 000000000000..5efc9595537e --- /dev/null +++ b/connectivity/source/inc/dbase/DDatabaseMetaData.hxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * $RCSfile: DDatabaseMetaData.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_ODATABASEMETADATA_HXX_ +#define _CONNECTIVITY_DBASE_ODATABASEMETADATA_HXX_ + +#ifndef _CONNECTIVITY_FILE_ODATABASEMETADATA_HXX_ +#include "file/FDatabaseMetaData.hxx" +#endif + +namespace connectivity +{ + namespace dbase + { + //************************************************************** + //************ Class: java.sql.DatabaseMetaDataDate + //************************************************************** + + class ODbaseDatabaseMetaData : public file::ODatabaseMetaData + { + public: + + ODbaseDatabaseMetaData(file::OConnection* _pCon); + ~ODbaseDatabaseMetaData(); + + // virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedures( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedureColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTables( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getSchemas( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCatalogs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTableTypes( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTablePrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getBestRowIdentifier( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope, sal_Bool nullable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getVersionColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getImportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getExportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCrossReference( const ::com::sun::star::uno::Any& primaryCatalog, const ::rtl::OUString& primarySchema, const ::rtl::OUString& primaryTable, const ::com::sun::star::uno::Any& foreignCatalog, const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTypeInfo( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getIndexInfo( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Bool unique, sal_Bool approximate ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_DBASE_ODATABASEMETADATA_HXX_ + diff --git a/connectivity/source/inc/dbase/DDatabaseMetaDataResultSet.hxx b/connectivity/source/inc/dbase/DDatabaseMetaDataResultSet.hxx new file mode 100644 index 000000000000..b071370f0b69 --- /dev/null +++ b/connectivity/source/inc/dbase/DDatabaseMetaDataResultSet.hxx @@ -0,0 +1,253 @@ +/************************************************************************* + * + * $RCSfile: DDatabaseMetaDataResultSet.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_ADATABASEMETADATARESULTSET_HXX_ +#define _CONNECTIVITY_FILE_ADATABASEMETADATARESULTSET_HXX_ + +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_ +#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XCLOSEABLE_HPP_ +#include <com/sun/star/sdbc/XCloseable.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XCOLUMNLOCATE_HPP_ +#include <com/sun/star/sdbc/XColumnLocate.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_XCANCELLABLE_HPP_ +#include <com/sun/star/util/XCancellable.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP_ +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSETUPDATE_HPP_ +#include <com/sun/star/sdbc/XResultSetUpdate.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XROWUPDATE_HPP_ +#include <com/sun/star/sdbc/XRowUpdate.hpp> +#endif +#ifndef _CPPUHELPER_COMPBASE7_HXX_ +#include <cppuhelper/compbase7.hxx> +#endif +#ifndef _UNOTOOLS_PROPERTY_ARRAY_HELPER_HXX_ +#include <unotools/proparrhlp.hxx> +#endif +#ifndef _CONNECTIVITY_FILE_ASTATEMENT_HXX_ +#include "file/FStatement.hxx" +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _CONNECTIVITY_SIMPLEPROPERTYCONTAINER_HXX_ +#include "connectivity/simplepropertycontainer.hxx" +#endif + +namespace connectivity +{ + namespace file + { + namespace ::com::sun::star::sdbc = ::com::sun::star::sdbc; + namespace ::com::sun::star::beans = ::com::sun::star::beans; + namespace ::com::sun::star::util = ::com::sun::star::util; + + class ODatabaseMetaDataResultSetMetaData; + /* + ** java_sql_ResultSet + */ + typedef ::cppu::WeakComponentImplHelper7< ::com::sun::star::sdbc::XResultSet, + ::com::sun::star::sdbc::XRow, + ::com::sun::star::sdbc::XResultSetMetaDataSupplier, + ::com::sun::star::util::XCancellable, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::sdbc::XCloseable, + ::com::sun::star::sdbc::XColumnLocate> ODatabaseMetaDataResultSet_BASE; + + DECLARE_STL_VECTOR(::com::sun::star::uno::Any,ORow); + DECLARE_STL_VECTOR(ORow, ORows); + + class ODatabaseMetaDataResultSet : public OBaseMutex, + public ODatabaseMetaDataResultSet_BASE, + public connectivity::OSimplePropertyContainer, + public ::utl::OPropertyArrayUsageHelper<ODatabaseMetaDataResultSet> + { + + + ORows m_aRows; + ORowsIterator m_aRowsIter; + ::com::sun::star::uno::WeakReferenceHelper m_aStatement; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData; + sal_Int32 m_nRowPos; + sal_Int32 m_nColPos; + + sal_Int32 m_nFetchSize; + sal_Int32 m_nResultSetType; + sal_Int32 m_nFetchDirection; + sal_Int32 m_nResultSetConcurrency; + + sal_Bool m_bWasNull; + sal_Bool m_bBOF; + + void construct(); + + protected: + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + + public: + DECLARE_CTY_DEFAULTS(ODatabaseMetaDataResultSet_BASE); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + ODatabaseMetaDataResultSet( ); + ~ODatabaseMetaDataResultSet(); + + void setRows(const ORows& _rRows) { m_aRows = _rRows; } + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) + { + return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); + } + // XResultSet + virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRow + virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XResultSetMetaDataSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCancellable + virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + void setCatalogsMap(); + void setSchemasMap(); + void setColumnPrivilegesMap(); + void setColumnsMap(); + void setTablesMap(); + void setTableTypes(); + void setProcedureColumnsMap(); + void setProceduresMap(); + void setExportedKeysMap(); + void setImportedKeysMap(); + void setPrimaryKeysMap(); + void setIndexInfoMap(); + void setTablePrivilegesMap(); + void setCrossReferenceMap(); + void setTypeInfoMap(); + }; + } + +} +#endif // _CONNECTIVITY_FILE_ADATABASEMETADATARESULTSET_HXX_ + diff --git a/connectivity/source/inc/dbase/DDatabaseMetaDataResultSetMetaData.hxx b/connectivity/source/inc/dbase/DDatabaseMetaDataResultSetMetaData.hxx new file mode 100644 index 000000000000..c63c46a3bc68 --- /dev/null +++ b/connectivity/source/inc/dbase/DDatabaseMetaDataResultSetMetaData.hxx @@ -0,0 +1,150 @@ +/************************************************************************* + * + * $RCSfile: DDatabaseMetaDataResultSetMetaData.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_ADATABASEMETADATARESULTSETMETADATA_HXX_ +#define _CONNECTIVITY_FILE_ADATABASEMETADATARESULTSETMETADATA_HXX_ + +#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATA_HPP_ +#include <com/sun/star/sdbc/XResultSetMetaData.hpp> +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif +#ifndef _VECTOR_ +#include <vector> +#endif +#ifndef _CONNECTIVITY_FILE_ADATABASEMETADATARESULTSET_HXX_ +#include "file/FDatabaseMetaDataResultSet.hxx" +#endif +#ifndef _CONNECTIVITY_COLUMN_HXX_ +#include "OColumn.hxx" +#endif + +namespace connectivity +{ + namespace file + { + //************************************************************** + //************ Class: ResultSetMetaData + //************************************************************** + typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData> ODatabaseMetaResultSetMetaData_BASE; + + class ODatabaseMetaDataResultSetMetaData : public ODatabaseMetaResultSetMetaData_BASE + { + friend class ODatabaseMetaDataResultSet; + + ::std::vector<sal_Int32> m_vMapping; // when not every column is needed + ::std::map<sal_Int32,connectivity::OColumn> m_mColumns; + ::std::map<sal_Int32,connectivity::OColumn>::const_iterator m_mColumnsIter; + + sal_Int32 m_nColCount; + + protected: + void setColumnPrivilegesMap(); + void setColumnsMap(); + void setTablesMap(); + void setProcedureColumnsMap(); + void setPrimaryKeysMap(); + void setIndexInfoMap(); + void setTablePrivilegesMap(); + void setCrossReferenceMap(); + void setTypeInfoMap(); + void setProceduresMap(); + void setTableTypes(); + public: + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + ODatabaseMetaDataResultSetMetaData( ODatabaseMetaDataResultSet* _pRes) + : m_nColCount(0) + { + } + ~ODatabaseMetaDataResultSetMetaData(); + + /// Avoid ambigous cast error from the compiler. + inline operator ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > () throw() + { return this; } + + virtual sal_Int32 SAL_CALL getColumnCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnLabel( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSchemaName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTableName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnTypeName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnServiceName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_FILE_ADATABASEMETARESULTSETMETADATA_HXX_ + + diff --git a/connectivity/source/inc/dbase/DDriver.hxx b/connectivity/source/inc/dbase/DDriver.hxx new file mode 100644 index 000000000000..0f84642999e1 --- /dev/null +++ b/connectivity/source/inc/dbase/DDriver.hxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * $RCSfile: DDriver.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_DDRIVER_HXX_ +#define _CONNECTIVITY_DBASE_DDRIVER_HXX_ + +#ifndef _CPPUHELPER_COMPBASE2_HXX_ +#include <cppuhelper/compbase2.hxx> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_ODRIVER_HXX_ +#include "file/FDriver.hxx" +#endif + +namespace connectivity +{ + namespace dbase + { + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ODriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ); + + class ODriver : public file::OFileDriver + { + public: + ODriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) : file::OFileDriver(_rxFactory){} + + // XInterface + static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); + // static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); + + ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + // XDriver + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } + +} +#endif //_CONNECTIVITY_DBASE_DDRIVER_HXX_ + diff --git a/connectivity/source/inc/dbase/DIndex.hxx b/connectivity/source/inc/dbase/DIndex.hxx new file mode 100644 index 000000000000..9ef8deb91c74 --- /dev/null +++ b/connectivity/source/inc/dbase/DIndex.hxx @@ -0,0 +1,201 @@ +/************************************************************************* + * + * $RCSfile: DIndex.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_INDEX_HXX_ +#define _CONNECTIVITY_DBASE_INDEX_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_INDEX_HXX_ +#include "connectivity/sdbcx/VIndex.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ +#include <com/sun/star/lang/XUnoTunnel.hpp> +#endif +#ifndef _CONNECTIVITY_DBASE_TABLE_HXX_ +#include "dbase/DTable.hxx" +#endif +#ifndef _CONNECTIVITY_DBASE_INDEXNODE_HXX_ +#include "dbase/dindexnode.hxx" +#endif + +#define dBASE_III_GROUP "dBase III" + +namespace connectivity +{ + namespace dbase + { + class OIndexIterator; + class ONDXKey; + + typedef sdbcx::OIndex ODbaseIndex_BASE; + typedef file::OBoolOperator OBoolOperator_BASE; + typedef file::OOperand OOperand_BASE; + + class ODbaseIndex : public ODbaseIndex_BASE, + public com::sun::star::lang::XUnoTunnel + { + friend SvStream& operator << (SvStream &rStream, ODbaseIndex&); + friend SvStream& operator >> (SvStream &rStream, ODbaseIndex&); + + friend class ONDXNode; + friend class ONDXPage; + friend class ONDXPagePtr; + friend class OIndexIterator; + + public: + //================================================================== + // Kopfsatz-Struktur, verbleibt im Speicher + //================================================================== + struct NDXHeader + { + sal_uInt32 db_rootpage; /* Position der Rootpage */ + sal_uInt32 db_pagecount; /* Anzahl Pages */ + sal_uInt8 db_frei[4]; /* reserviert */ + sal_uInt16 db_keylen; /* Laenge des Schluessels */ + sal_uInt16 db_maxkeys; /* Max. # keys pro Seite */ + sal_uInt16 db_keytype; /* Art des Schluessels + (0-Text) + (1-Numerisch) */ + sal_uInt16 db_keyrec; /* Laenge eines IndexSatzes + SatzNr + keylen */ + sal_uInt8 db_frei1[3]; /* reserviert */ + sal_uInt8 db_unique; /* eindeutig */ + char db_name[488]; /* index_name (Feldname) */ + }; + + private: + SvFileStream m_aFileStream; // Stream zum Lesen/Schreiben des Index + NDXHeader m_aHeader; + ONDXPageList m_aCollector; // Pool von nicht mehr benötigten Seiten + ONDXPagePtr m_aRoot, // Wurzel des b+ Baums + m_aCurLeaf; // aktuelles Blatt + USHORT m_nCurNode; // Position des aktuellen Knoten + + sal_uInt32 m_nPageCount, + m_nRootPage; + + ODbaseTable* m_pTable; + BOOL m_bUseCollector : 1; // Verwenden des GarbageCollectors + sal_Bool m_bUnique; + + sal_Bool openIndexFile(); + INetURLObject getEntry(); + public: + DECLARE_CTY_DEFAULTS( ODbaseIndex_BASE); + + ODbaseIndex(ODbaseTable* _pTable); + ODbaseIndex(ODbaseTable* _pTable,const NDXHeader& _aHeader,const ::rtl::OUString& _Name); + + virtual void refreshColumns(); + + //XInterface + virtual com::sun::star::uno::Any SAL_CALL queryInterface( const com::sun::star::uno::Type & rType ) throw(com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(com::sun::star::uno::RuntimeException); + // com::sun::star::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(com::sun::star::uno::RuntimeException); + static com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + + const ODbaseTable* getTable() const { return m_pTable; } + const NDXHeader& getHeader() const { return m_aHeader; } + virtual OIndexIterator* createIterator(OBoolOperator_BASE* pOp, + const OOperand_BASE* pOperand = NULL); + + void SetRootPos(sal_uInt32 nPos) {m_nRootPage = nPos;} + void SetPageCount(sal_uInt32 nCount) {m_nPageCount = nCount;} + + sal_uInt32 GetRootPos() {return m_nRootPage;} + sal_uInt32 GetPageCount() {return m_nPageCount;} + + BOOL IsText() const {return m_aHeader.db_keytype == 0;} + USHORT GetMaxNodes() const {return m_aHeader.db_maxkeys;} + + virtual BOOL Insert(sal_uInt32 nRec, const OFileValue_BASE& rValue); + virtual BOOL Update(sal_uInt32 nRec, const OFileValue_BASE&, const OFileValue_BASE&); + virtual BOOL Delete(sal_uInt32 nRec, const OFileValue_BASE& rValue); + virtual BOOL Find(sal_uInt32 nRec, const OFileValue_BASE& rValue); + + void createINFEntry(); + BOOL CreateImpl(); + BOOL DropImpl(); + + DECLARE_SERVICE_INFO(); + protected: + + ONDXPage* CreatePage(sal_uInt32 nPagePos, ONDXPage* pParent = NULL, BOOL bLoad = FALSE); + void Collect(ONDXPage*); + ONDXPagePtr getRoot(); + + sal_Bool isUnique() const { return m_bUnique; } + BOOL UseCollector() const {return m_bUseCollector;} + // Tree operationen + void Insert(ONDXPagePtr aCurPage, ONDXNode& rNode); + void Release(BOOL bSave = TRUE); + BOOL ConvertToKey(ONDXKey* rKey, sal_uInt32 nRec, const OFileValue_BASE& rValue); + }; + + SvStream& operator << (SvStream &rStream, ODbaseIndex&); + SvStream& operator >> (SvStream &rStream, ODbaseIndex&); + } +} + +#endif // _CONNECTIVITY_DBASE_INDEX_HXX_ + + diff --git a/connectivity/source/inc/dbase/DIndexColumns.hxx b/connectivity/source/inc/dbase/DIndexColumns.hxx new file mode 100644 index 000000000000..faa46465c0cc --- /dev/null +++ b/connectivity/source/inc/dbase/DIndexColumns.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * $RCSfile: DIndexColumns.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_INDEXCOLUMNS_HXX_ +#define _CONNECTIVITY_DBASE_INDEXCOLUMNS_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _CONNECTIVITY_DBASE_INDEX_HXX_ +#include "dbase/DIndex.hxx" +#endif +#ifndef _CONNECTIVITY_DBASE_TABLE_HXX_ +#include "dbase/DTable.hxx" +#endif + +namespace connectivity +{ + namespace dbase + { + class ODbaseIndexColumns : public sdbcx::OCollection + { + ODbaseIndex* m_pIndex; + protected: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + public: + ODbaseIndexColumns( ODbaseIndex* _pIndex, + ::osl::Mutex& _rMutex, + const ::std::vector< ::rtl::OUString> &_rVector) + : sdbcx::OCollection(*_pIndex,_pIndex->getTable()->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers(),_rMutex,_rVector) + , m_pIndex(_pIndex) + {} + + }; + } +} +#endif // _CONNECTIVITY_DBASE_INDEXCOLUMNS_HXX_ + + diff --git a/connectivity/source/inc/dbase/DIndexIter.hxx b/connectivity/source/inc/dbase/DIndexIter.hxx new file mode 100644 index 000000000000..1403777b722e --- /dev/null +++ b/connectivity/source/inc/dbase/DIndexIter.hxx @@ -0,0 +1,125 @@ +/************************************************************************* + * + * $RCSfile: DIndexIter.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_INDEXITER_HXX_ +#define _CONNECTIVITY_DBASE_INDEXITER_HXX_ + +#ifndef _CONNECTIVITY_FILE_FCODE_HXX_ +#include "file/fcode.hxx" +#endif +#ifndef _CONNECTIVITY_DBASE_INDEX_HXX_ +#include "dbase/DIndex.hxx" +#endif +#ifndef _CONNECTIVITY_DBASE_INDEXNODE_HXX_ +#include "dbase/dindexnode.hxx" +#endif + +namespace connectivity +{ + namespace dbase + { + //================================================================== + // IndexIterator + //================================================================== + class OIndexIterator + { + protected: + file::OBoolOperator* m_pOperator; + const file::OOperand* m_pOperand; + ODbaseIndex* m_pIndex; + ONDXPagePtr m_aRoot, + m_aCurLeaf; + USHORT m_nCurNode; + + protected: + ULONG Find(BOOL bFirst); + ULONG GetCompare(BOOL bFirst); + ULONG GetLike(BOOL bFirst); + ULONG GetNull(BOOL bFirst); + ULONG GetNotNull(BOOL bFirst); + + ONDXKey* GetFirstKey(ONDXPage* pPage, + const file::OOperand& rKey); + ONDXKey* GetNextKey(); + ODbaseIndex* GetIndex() const {return m_pIndex;} + + + public: + OIndexIterator(ODbaseIndex* pInd, + file::OBoolOperator* pOp, + const file::OOperand* pOper) + :m_pOperator(pOp) + ,m_pOperand(pOper) + ,m_pIndex(pInd) + ,m_nCurNode(NODE_NOTFOUND) + { + pInd->acquire(); + } + + virtual ~OIndexIterator(); + ULONG First(); + ULONG Next(); + + }; + } +} +#endif // _CONNECTIVITY_DBASE_INDEXITER_HXX_ + diff --git a/connectivity/source/inc/dbase/DIndexPage.hxx b/connectivity/source/inc/dbase/DIndexPage.hxx new file mode 100644 index 000000000000..cd39e3c7e66f --- /dev/null +++ b/connectivity/source/inc/dbase/DIndexPage.hxx @@ -0,0 +1,127 @@ +/************************************************************************* + * + * $RCSfile: DIndexPage.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_INDEXPAGE_HXX_ +#define _CONNECTIVITY_DBASE_INDEXPAGE_HXX_ + +//#ifndef _REF_HXX +//#include <tools/ref.hxx> +//#endif +#ifndef _VOS_REF_HXX_ +#include <vos/ref.hxx> +#endif +#ifndef _STREAM_HXX +#include <tools/stream.hxx> +#endif +#ifndef _VECTOR_ +#include <vector> +#endif +//#ifndef _CONNECTIVITY_FILE_FCODE_HXX_ +//#include "file/fcode.hxx" +//#endif +//#ifndef _CONNECTIVITY_DBASE_INDEXNODE_HXX_ +//#include "dbase/dindexnode.hxx" +//#endif + +#if 0 +namespace connectivity +{ + namespace dbase + { + //================================================================== + // Index Seitenverweis + //================================================================== + // SV_DECL_REF(ONDXPage); // Basisklasse da weitere Informationen gehalten werden muessen + + class ONDXPage; + typedef vos::ORef<ONDXPage> ONDXPagePtr_BASE; + + class ONDXPagePtr : public ONDXPagePtr_BASE //ONDXPageRef + { + friend SvStream& operator << (SvStream &rStream, const ONDXPagePtr&); + friend SvStream& operator >> (SvStream &rStream, ONDXPagePtr&); + + UINT32 nPagePos; // Position in der Indexdatei + + public: + ONDXPagePtr(UINT32 nPos = 0):nPagePos(nPos){} + ONDXPagePtr(const ONDXPagePtr& rRef); + ONDXPagePtr(ONDXPage* pRefPage); + + ONDXPagePtr& operator=(const ONDXPagePtr& rRef); + ONDXPagePtr& operator=(ONDXPage* pPageRef); + + UINT32 GetPagePos() const {return nPagePos;} + BOOL HasPage() const {return nPagePos != 0;} + sal_Bool Is() const { return isValid(); } + void Clear() + { + unbind(); + } + }; + + SvStream& operator << (SvStream &rStream, const ONDXPagePtr&); + SvStream& operator >> (SvStream &rStream, ONDXPagePtr&); + } +} +#endif +#endif // _CONNECTIVITY_DBASE_INDEXPAGE_HXX_ + diff --git a/connectivity/source/inc/dbase/DIndexes.hxx b/connectivity/source/inc/dbase/DIndexes.hxx new file mode 100644 index 000000000000..708e8ab47e00 --- /dev/null +++ b/connectivity/source/inc/dbase/DIndexes.hxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * $RCSfile: DIndexes.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_INDEXES_HXX_ +#define _CONNECTIVITY_DBASE_INDEXES_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _CONNECTIVITY_DBASE_TABLE_HXX_ +#include "dbase/DTable.hxx" +#endif + +namespace connectivity +{ + namespace dbase + { + class ODbaseTable; + + typedef sdbcx::OCollection ODbaseIndexes_BASE; + + class ODbaseIndexes : public ODbaseIndexes_BASE + { + ODbaseTable* m_pTable; + protected: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + public: + ODbaseIndexes(ODbaseTable* _pTable, ::osl::Mutex& _rMutex, + const ::std::vector< ::rtl::OUString> &_rVector) : ODbaseIndexes_BASE(*_pTable,_pTable->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers(),_rMutex,_rVector) + , m_pTable(_pTable) + {} + + // XAppend + virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + // XDrop + virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + }; + } +} +#endif // _CONNECTIVITY_DBASE_INDEXES_HXX_ + diff --git a/connectivity/source/inc/dbase/DTable.hxx b/connectivity/source/inc/dbase/DTable.hxx new file mode 100644 index 000000000000..32cd7cd969ae --- /dev/null +++ b/connectivity/source/inc/dbase/DTable.hxx @@ -0,0 +1,191 @@ +/************************************************************************* + * + * $RCSfile: DTable.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_TABLE_HXX_ +#define _CONNECTIVITY_DBASE_TABLE_HXX_ + +#ifndef _CONNECTIVITY_FILE_TABLE_HXX_ +#include "file/FTable.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ +#include "connectivity/sdbcx/VColumn.hxx" +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _FSYS_HXX //autogen +#include <tools/fsys.hxx> +#endif + + +namespace connectivity +{ + namespace dbase + { + typedef file::OFileTable ODbaseTable_BASE; + class ODbaseConnection; + + typedef ::std::map< ::rtl::OUString, + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed>, utl::UStringMixLess > OContainer; + + class ODbaseTable : public ODbaseTable_BASE + { + // der Typ einer dBase datei wird mit dem ersten Byte bestimmt + public: + enum DBFType { dBaseIII = 0x03, + dBaseIV = 0x04, + dBaseV = 0x05, + dBaseFS = 0x43, + dBaseFSMemo = 0xB3, + dBaseIIIMemo = 0x83, + dBaseIVMemo = 0x8B, + dBaseIVMemoSQL = 0x8E, + FoxProMemo = 0xF5 + }; + enum DBFMemoType { MemodBaseIII = 0, + MemodBaseIV, + MemoFoxPro + }; + + private: + struct DBFHeader { /* Kopfsatz-Struktur */ + DBFType db_typ; /* Dateityp */ + BYTE db_aedat[3]; /* Datum der letzen Aenderung */ + /* JJ MM TT */ + ULONG db_anz; /* Anzahl der Saetze */ + USHORT db_kopf; /* laenge Kopfsatz-Struktur */ + USHORT db_slng; /* laenge der Daten-Saetze */ + BYTE db_frei[20]; /* reserviert */ + }; + struct DBFColumn { /* Feldbezeichner */ + BYTE db_fnm[11]; /* Feldname */ + BYTE db_typ; /* Feldtyp */ + ULONG db_adr; /* Feldadresse */ + BYTE db_flng; /* Feldlaenge */ + BYTE db_dez; /* Dezimalstellen fuer N */ + BYTE db_frei2[14]; /* reserviert */ + }; + struct DBFMemoHeader + { + DBFMemoType db_typ; /* Dateityp */ + UINT32 db_next; /* nächster freier Block */ + USHORT db_size; /* Blockgröße: dBase 3 fest */ + }; + + DBFHeader m_aHeader; + DBFMemoHeader m_aMemoHeader; + SvFileStream m_aMemoStream; + + void readHeader(); + void fillColumns(); + BOOL CreateFile(const DirEntry& aFile, BOOL& bCreateMemo); + BOOL CreateMemoFile(const DirEntry& aFile); + BOOL HasMemoFields() const { return m_aHeader.db_typ > dBaseIV;} + BOOL ReadMemoHeader(); + BOOL ReadMemo(ULONG nBlockNo, file::OFileValue& aVariable); + + BOOL WriteMemo(file::OFileValue& aVariable, ULONG& rBlockNr); + BOOL WriteBuffer(); + BOOL UpdateBuffer(file::OValueVector& rRow, file::OValueRow pOrgRow,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet> isUniqueByColumnName(const ::rtl::OUString& _rColName); + void AllocBuffer(); + + void FileClose(); + public: + virtual void refreshColumns(); + virtual void refreshIndexes(); + + public: + // DECLARE_CTY_DEFAULTS( ODbaseTable_BASE); + ODbaseTable( ODbaseConnection* _pConnection); + ODbaseTable( ODbaseConnection* _pConnection, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _Type, + const ::rtl::OUString& _Description = ::rtl::OUString(), + const ::rtl::OUString& _SchemaName = ::rtl::OUString(), + const ::rtl::OUString& _CatalogName = ::rtl::OUString() + ); + + virtual sal_Int32 getCurrentLastPos() const {return m_aHeader.db_anz;} + virtual sal_Bool seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos); + virtual sal_Bool fetchRow(file::OValueRow _rRow,const OSQLColumns& _rCols, sal_Bool bRetrieveData); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL disposing(void); + + // com::sun::star::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + + BOOL DropImpl(); + BOOL CreateImpl(); + DirEntry getEntry(); + + virtual BOOL InsertRow(file::ORefAssignValues& rRow, BOOL bFlush,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); + virtual BOOL DeleteRow(const OSQLColumns& _rCols); + virtual BOOL UpdateRow(file::OValueVector& rRow, file::OValueRow pOrgRow,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); + }; + } +} +#endif // _CONNECTIVITY_DBASE_TABLE_HXX_ + diff --git a/connectivity/source/inc/dbase/DTables.hxx b/connectivity/source/inc/dbase/DTables.hxx new file mode 100644 index 000000000000..ec191e8ba091 --- /dev/null +++ b/connectivity/source/inc/dbase/DTables.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * $RCSfile: DTables.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_TABLES_HXX_ +#define _CONNECTIVITY_DBASE_TABLES_HXX_ + +#ifndef _CONNECTIVITY_FILE_TABLES_HXX_ +#include "file/FTables.hxx" +#endif + +namespace connectivity +{ + namespace dbase + { + // namespace ::com::sun::star::sdbcx = ::com::sun::star::sdbcx; + typedef file::OTables ODbaseTables_BASE; + + class ODbaseTables : public ODbaseTables_BASE + { + protected: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + public: + ODbaseTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, + const ::std::vector< ::rtl::OUString> &_rVector) : ODbaseTables_BASE(_rMetaData,_rParent,_rMutex,_rVector) + {} + + // XAppend + virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + // XDrop + virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_DBASE_TABLES_HXX_ + diff --git a/connectivity/source/inc/dbase/dindexnode.hxx b/connectivity/source/inc/dbase/dindexnode.hxx new file mode 100644 index 000000000000..8f93ea1bce28 --- /dev/null +++ b/connectivity/source/inc/dbase/dindexnode.hxx @@ -0,0 +1,410 @@ +/************************************************************************* + * + * $RCSfile: dindexnode.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_DBASE_INDEXNODE_HXX_ +#define _CONNECTIVITY_DBASE_INDEXNODE_HXX_ + +#ifndef _CONNECTIVITY_FILE_FCODE_HXX_ +#include "file/fcode.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_TABLE_HXX_ +#include "file/FTable.hxx" +#endif +#ifndef _CONNECTIVITY_DBASE_INDEXPAGE_HXX_ +#include "dbase/DIndexPage.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_VALUE_HXX_ +#include "file/FValue.hxx" +#endif + +namespace connectivity +{ + namespace dbase + { + + class ONDXNode; + class ODbaseIndex; + typedef file::OFileValue OFileValue_BASE; + //================================================================== + // Index Key + //================================================================== + typedef file::OOperand ONDXKey_BASE; + class ONDXKey : public ONDXKey_BASE + { + friend class ONDXNode; + UINT32 nRecord; /* Satzzeiger */ + OFileValue_BASE xValue; /* Schluesselwert */ + + public: + ONDXKey():nRecord(0){} + inline ONDXKey(const OFileValue_BASE& rVal, sal_Int32 eType, UINT32 nRec) + : ONDXKey_BASE(eType) + , nRecord(nRec) + , xValue(rVal) + {} + ONDXKey(const rtl::OUString& aStr, UINT32 nRec = 0) + : ONDXKey_BASE(::com::sun::star::sdbc::DataType::VARCHAR) + ,nRecord(nRec) + { + if (aStr.len()) + xValue = aStr; + } + ONDXKey(double aVal, UINT32 nRec = 0) + : ONDXKey_BASE(::com::sun::star::sdbc::DataType::DOUBLE) + ,nRecord(nRec) + ,xValue(aVal) + { + } + ONDXKey(UINT32 nRec) + : nRecord(nRec){} + inline ONDXKey(const ONDXKey& rKey); + + inline ONDXKey& operator= (const ONDXKey& rKey); + virtual void setValue(const ::com::sun::star::uno::Any& _rVal) + { + xValue = _rVal; + } + + virtual ::com::sun::star::uno::Any getValue() const + { + return xValue; + } + + UINT32 GetRecord() const {return nRecord;} + void ResetRecord() {nRecord = 0;} + + BOOL operator == (const ONDXKey& rKey) const; + BOOL operator != (const ONDXKey& rKey) const; + BOOL operator < (const ONDXKey& rKey) const; + BOOL operator <= (const ONDXKey& rKey) const; + BOOL operator > (const ONDXKey& rKey) const; + BOOL operator >= (const ONDXKey& rKey) const; + + BOOL Load (SvFileStream& rStream, BOOL bText); + BOOL Write(SvFileStream& rStream, BOOL bText); + + static BOOL IsText(sal_Int32 eType); + + private: + StringCompare Compare(const ONDXKey& rKey) const; + }; + + #define NODE_NOTFOUND 0xFFFF + + class ONDXPagePtr; + //================================================================== + // Index Seite + //================================================================== + class ONDXPage //: public SvRefBase + { + friend class ODbaseIndex; + + friend SvStream& operator << (SvStream &rStream, const ONDXPage&); + friend SvStream& operator >> (SvStream &rStream, ONDXPage&); + + UINT32 nPagePos; // Position in der Indexdatei + BOOL bModified : 1; + USHORT nCount; + + ONDXPagePtr *aParent, // VaterSeite + *aChild; // Zeiger auf rechte ChildPage + ODbaseIndex& rIndex; + ONDXNode* ppNodes; // array von Knoten + + oslInterlockedCount m_refCount; + + public: + void acquire() + { + osl_incrementInterlockedCount( &m_refCount ); + } + void release(); + + // Knoten Operationen + USHORT Count() const {return nCount;} + + BOOL Insert(ONDXNode& rNode, ULONG nRowsLeft = 0); + BOOL Insert(USHORT nIndex, ONDXNode& rNode); + BOOL Append(ONDXNode& rNode); + BOOL Delete(USHORT); + void Remove(USHORT); + void Release(BOOL bSave = TRUE); + void ReleaseFull(BOOL bSave = TRUE); + + // Aufteilen und Zerlegen + ONDXNode Split(ONDXPage& rPage); + void Merge(USHORT nParentNodePos, ONDXPagePtr xPage); + + // Zugriffsoperationen + ONDXNode& operator[] (USHORT nPos); + const ONDXNode& operator[] (USHORT nPos) const; + + BOOL IsRoot() const; + BOOL IsLeaf() const; + BOOL IsModified() const; + BOOL HasParent(); + BOOL HasChild() const; + + BOOL IsFull() const; + + UINT32 GetPagePos() const {return nPagePos;} + ONDXPagePtr& GetChild(ODbaseIndex* pIndex = 0); + + // Parent braucht nicht nachgeladen zu werden + ONDXPagePtr GetParent(); + ODbaseIndex& GetIndex() {return rIndex;} + const ODbaseIndex& GetIndex() const {return rIndex;} + + // Setzen des Childs, ueber Referenz, um die PagePos zu erhalten + void SetChild(ONDXPagePtr aCh); + void SetParent(ONDXPagePtr aPa); + + USHORT Search(const ONDXKey& rSearch); + USHORT Search(const ONDXPage* pPage); + void SearchAndReplace(const ONDXKey& rSearch, ONDXKey& rReplace); + + protected: + ONDXPage(ODbaseIndex& rIndex, ULONG nPos, ONDXPage* = NULL); + ~ONDXPage(); + + virtual void QueryDelete(); + + void SetModified(BOOL bMod) {bModified = bMod;} + void SetPagePos(UINT32 nPage) {nPagePos = nPage;} + + BOOL Find(const ONDXKey&); // rek. Abstieg + USHORT FindPos(const ONDXKey& rKey) const; + + #ifdef DEBUG + void PrintPage(); + #endif + }; + + //================================================================== + // Index Seitenverweis + //================================================================== + // SV_DECL_REF(ONDXPage); // Basisklasse da weitere Informationen gehalten werden muessen + typedef vos::ORef<ONDXPage> ONDXPagePtr_BASE; + + class ONDXPagePtr : public ONDXPagePtr_BASE //ONDXPageRef + { + friend SvStream& operator << (SvStream &rStream, const ONDXPagePtr&); + friend SvStream& operator >> (SvStream &rStream, ONDXPagePtr&); + + UINT32 nPagePos; // Position in der Indexdatei + + public: + ONDXPagePtr(UINT32 nPos = 0):nPagePos(nPos){} + ONDXPagePtr(const ONDXPagePtr& rRef); + ONDXPagePtr(ONDXPage* pRefPage); + + ONDXPagePtr& operator=(const ONDXPagePtr& rRef); + ONDXPagePtr& operator=(ONDXPage* pPageRef); + + UINT32 GetPagePos() const {return nPagePos;} + BOOL HasPage() const {return nPagePos != 0;} + sal_Bool Is() const { return isValid(); } + void Clear() + { + unbind(); + } + }; + + SvStream& operator << (SvStream &rStream, const ONDXPagePtr&); + SvStream& operator >> (SvStream &rStream, ONDXPagePtr&); + + inline BOOL ONDXPage::IsRoot() const {return !aParent->Is();} + inline BOOL ONDXPage::IsLeaf() const {return !aChild->HasPage();} + inline BOOL ONDXPage::IsModified() const {return bModified;} + inline BOOL ONDXPage::HasParent() {return aParent->Is();} + inline BOOL ONDXPage::HasChild() const {return aChild->HasPage();} + inline ONDXPagePtr ONDXPage::GetParent() {return *aParent;} + + inline void ONDXPage::SetParent(ONDXPagePtr aPa = ONDXPagePtr()) + { *aParent = aPa;} + + inline void ONDXPage::SetChild(ONDXPagePtr aCh = ONDXPagePtr()) + { + *aChild = aCh; + if (aChild->Is()) + (*aChild)->SetParent(this); + } + SvStream& operator >> (SvStream &rStream, ONDXPage& rPage); + SvStream& operator << (SvStream &rStream, const ONDXPage& rPage); + + + typedef ::std::vector<ONDXPage*> ONDXPageList; + + //================================================================== + // Index Knoten + //================================================================== + class ONDXNode + { + friend class ONDXPage; + ONDXPagePtr aChild; /* naechster Seitenverweis */ + ONDXKey aKey; + + public: + ONDXNode(){} + ONDXNode(const ONDXKey& rKey, + ONDXPagePtr aPagePtr = ONDXPagePtr()) + :aKey(rKey), aChild(aPagePtr) {} + + // verweist der Knoten auf eine Seite + BOOL HasChild() const {return aChild.HasPage();} + // Ist ein Index angegeben, kann gegebenfalls die Seite nachgeladen werden + ONDXPagePtr& GetChild(ODbaseIndex* pIndex = NULL, ONDXPage* = NULL); + + const ONDXKey& GetKey() const {return aKey;} + ONDXKey& GetKey() {return aKey;} + + // Setzen des Childs, ueber Referenz, um die PagePos zu erhalten + void SetChild(ONDXPagePtr aCh = ONDXPagePtr(), ONDXPage* = NULL); + void SetKey(ONDXKey& rKey) {aKey = rKey;} + + void Write(SvStream &rStream, const ONDXPage& rPage) const; + void Read(SvStream &rStream, ODbaseIndex&); + }; + //================================================================== + // inline implementation + //================================================================== +// inline ONDXKey::ONDXKey(const OFileValue_BASE& rVal, sal_Int32 eType, UINT32 nRec) +// : ONDXKey_BASE(eType) +// , nRecord(nRec),xValue(rVal) +// { +// } + + +// inline ONDXKey::ONDXKey(const rtl::OUString& aStr, UINT32 nRec) +// : ONDXKey_BASE(::com::sun::star::sdbc::DataType::VARCHAR) +// ,nRecord(nRec) +// { +// if (aStr.len()) +// xValue = aStr; +// } + +// inline ONDXKey::ONDXKey(double aVal, UINT32 nRec) +// : ONDXKey_BASE(::com::sun::star::sdbc::DataType::DOUBLE) +// ,nRecord(nRec) +// ,xValue(aVal) +// { +// } + +// inline ONDXKey::ONDXKey(UINT32 nRec) +// :nRecord(nRec) +// { +// } + + inline ONDXKey::ONDXKey(const ONDXKey& rKey) + : ONDXKey_BASE(rKey.getDBType()) + ,nRecord(rKey.nRecord),xValue(rKey.xValue) + { + } + + inline ONDXKey& ONDXKey::operator=(const ONDXKey& rKey) + { + xValue = rKey.xValue; + nRecord = rKey.nRecord; + m_eDBType = rKey.getDBType(); + return *this; + } + + inline BOOL ONDXKey::operator == (const ONDXKey& rKey) const + { + return Compare(rKey) == COMPARE_EQUAL; + } + inline BOOL ONDXKey::operator != (const ONDXKey& rKey) const + { + return !operator== (rKey); + } + inline BOOL ONDXKey::operator < (const ONDXKey& rKey) const + { + return Compare(rKey) == COMPARE_LESS; + } + inline BOOL ONDXKey::operator > (const ONDXKey& rKey) const + { + return Compare(rKey) == COMPARE_GREATER; + } + inline BOOL ONDXKey::operator <= (const ONDXKey& rKey) const + { + return !operator > (rKey); + } + inline BOOL ONDXKey::operator >= (const ONDXKey& rKey) const + { + return !operator< (rKey); + } + + inline void ONDXNode::SetChild(ONDXPagePtr aCh, ONDXPage* pParent) + { + aChild = aCh; + if (aChild.Is()) + aChild->SetParent(pParent); + } + + } + +} + + + + +#endif // _CONNECTIVITY_DBASE_INDEXNODE_HXX_ + + diff --git a/connectivity/source/inc/file/FCatalog.hxx b/connectivity/source/inc/file/FCatalog.hxx new file mode 100644 index 000000000000..259ea76cf139 --- /dev/null +++ b/connectivity/source/inc/file/FCatalog.hxx @@ -0,0 +1,98 @@ +/************************************************************************* + * + * $RCSfile: FCatalog.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_CATALOG_HXX_ +#define _CONNECTIVITY_FILE_CATALOG_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_CATALOG_HXX_ +#include "connectivity/sdbcx/VCatalog.hxx" +#endif + +namespace connectivity +{ + namespace file + { + class OConnection; + class OFileCatalog : public connectivity::sdbcx::OCatalog + { + protected: + OConnection* m_pConnection; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; + + public: + virtual void refreshTables(); + virtual void refreshViews(){} + virtual void refreshGroups(){} + virtual void refreshUsers(){} + + public: + OFileCatalog(OConnection* _pCon); + + OConnection* getConnection() { return m_pConnection; } + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + }; + } +} +#endif // _CONNECTIVITY_FILE_CATALOG_HXX_ + diff --git a/connectivity/source/inc/file/FColumns.hxx b/connectivity/source/inc/file/FColumns.hxx new file mode 100644 index 000000000000..445482790c37 --- /dev/null +++ b/connectivity/source/inc/file/FColumns.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * $RCSfile: FColumns.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_COLUMNS_HXX_ +#define _CONNECTIVITY_FILE_COLUMNS_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#endif +#ifndef _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_ +#include "connectivity/sdbcx/IRefreshable.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_TABLE_HXX_ +#include "file/FTable.hxx" +#endif + +namespace connectivity +{ + namespace file + { + class OColumns : public sdbcx::OCollection + { + protected: + OFileTable* m_pTable; + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + public: + OColumns( OFileTable* _pTable, + ::osl::Mutex& _rMutex, + const ::std::vector< ::rtl::OUString> &_rVector + ) : sdbcx::OCollection(*_pTable,_pTable->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers(),_rMutex,_rVector) + ,m_pTable(_pTable) + {} + + }; + } +} +#endif // _CONNECTIVITY_FILE_COLUMNS_HXX_ + diff --git a/connectivity/source/inc/file/FConnection.hxx b/connectivity/source/inc/file/FConnection.hxx new file mode 100644 index 000000000000..dc9821ff2c33 --- /dev/null +++ b/connectivity/source/inc/file/FConnection.hxx @@ -0,0 +1,213 @@ +/************************************************************************* + * + * $RCSfile: FConnection.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_OCONNECTION_HXX_ +#define _CONNECTIVITY_FILE_OCONNECTION_HXX_ + +#ifndef _CPPUHELPER_COMPBASE3_HXX_ +#include <cppuhelper/compbase3.hxx> +#endif +#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ +#include <com/sun/star/sdbc/XConnection.hpp> +#endif +#ifndef _COM_SUN_STAR_UCB_XCONTENT_HPP_ +#include <com/sun/star/ucb/XContent.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP_ +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_SQLWARNING_HPP_ +#include <com/sun/star/sdbc/SQLWarning.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ +#include <com/sun/star/beans/PropertyValue.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif +#ifndef _CONNECTIVITY_OSUBCOMPONENT_HXX_ +#include "OSubComponent.hxx" +#endif +#ifndef _MAP_ +#include <map> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _CONNECTIVITY_OTYPEINFO_HXX_ +#include "OTypeInfo.hxx" +#endif +#ifndef _STRING_HXX +#include <tools/string.hxx> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XTablesSupplier.hpp> +#endif +#ifndef _CONNECTIVITY_SQLPARSE_HXX +#include "connectivity/sqlparse.hxx" +#endif +#ifndef _CONNECTIVITY_PARSE_SQLITERATOR_HXX_ +#include "connectivity/sqliterator.hxx" +#endif +// namespace ucb { class Content } } + +namespace connectivity +{ + namespace file + { + + class OStatement_Base; + class ODatabaseMetaData; + class OFileDriver; + + typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbc::XConnection, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::lang::XServiceInfo + > OConnection_BASE; + + class OConnection : public OConnection_BASE, + public connectivity::OSubComponent<OConnection> + { + friend class connectivity::OSubComponent<OConnection>; + + protected: + ::osl::Mutex m_aMutex; + //==================================================================== + // Data attributes + //==================================================================== + ::std::vector<connectivity::OTypeInfo> m_aTypeInfo; // vector containing an entry + // for each row returned by + // DatabaseMetaData.getTypeInfo. + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; + ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbcx::XTablesSupplier> m_xCatalog; + + connectivity::OWeakRefArray m_aStatements; // vector containing a list + // of all the Statement objects + // for this Connection + + ::com::sun::star::sdbc::SQLWarning m_aLastWarning; // Last SQLWarning generated by + // an operation + String m_aURL; // URL of connection + // String m_aDirectoryName; + String m_aFilenameExtension; + OFileDriver* m_pDriver; // Pointer to the owning + // driver object + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > m_xDir; + ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent> m_xContent; + + sal_Bool m_bClosed; + sal_Bool m_bAutoCommit; + sal_Bool m_bReadOnly; + + + public: + + OConnection(OFileDriver* _pDriver); + virtual ~OConnection(); + + void construct(const ::rtl::OUString& _rUrl,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rInfo ) throw( ::com::sun::star::sdbc::SQLException); + + void closeAllStatements () throw( ::com::sun::star::sdbc::SQLException); + + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + DECLARE_SERVICE_INFO(); + + // XConnection + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL nativeSQL( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getAutoCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL commit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL rollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isClosed( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setCatalog( const ::rtl::OUString& catalog ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalog( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTypeMap( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTypeMap( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + // no interface methods + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > getDir() const { return m_xDir; } + ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent> getContent() const { return m_xContent; } + // create a catalog or return the catalog already created + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > createCatalog(); + String getExtension() const { return m_aFilenameExtension;} + }; + } +} +#endif // _CONNECTIVITY_FILE_OCONNECTION_HXX_ + diff --git a/connectivity/source/inc/file/FDatabaseMetaData.hxx b/connectivity/source/inc/file/FDatabaseMetaData.hxx new file mode 100644 index 000000000000..3b69630f5bfc --- /dev/null +++ b/connectivity/source/inc/file/FDatabaseMetaData.hxx @@ -0,0 +1,245 @@ +/************************************************************************* + * + * $RCSfile: FDatabaseMetaData.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_ODATABASEMETADATA_HXX_ +#define _CONNECTIVITY_FILE_ODATABASEMETADATA_HXX_ + +#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif +#ifndef _CONNECTIVITY_FILE_OCONNECTION_HXX_ +#include "file/FConnection.hxx" +#endif +namespace connectivity +{ + namespace file + { + //************************************************************** + //************ Class: java.sql.DatabaseMetaDataDate + //************************************************************** + + class ODatabaseMetaData : public OBaseMutex, + public ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XDatabaseMetaData > + { + protected: + OConnection* m_pConnection; + public: + + ODatabaseMetaData(OConnection* _pCon); + ~ODatabaseMetaData(); + // XDatabaseMetaData + virtual sal_Bool SAL_CALL allProceduresAreCallable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL allTablesAreSelectable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getURL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getUserName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedLow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDatabaseProductName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDatabaseProductVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDriverName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDriverVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL usesLocalFiles( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMixedCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesMixedCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getIdentifierQuoteString( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSQLKeywords( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getNumericFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getStringFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSystemFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTimeDateFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSearchStringEscape( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getExtraNameCharacters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsAlterTableWithAddColumn( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsAlterTableWithDropColumn( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsColumnAliasing( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTypeConversion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSchemaTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getProcedureTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCatalogAtStart( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogSeparator( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInDataManipulation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInTableDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInDataManipulation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInTableDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsPositionedDelete( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsStoredProcedures( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsUnion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsUnionAll( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxConnections( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxIndexLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxRowSize( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxStatementLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxStatements( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxTablesInSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedures( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedureColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTables( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getSchemas( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCatalogs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTableTypes( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTablePrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getBestRowIdentifier( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope, sal_Bool nullable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getVersionColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getImportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getExportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCrossReference( const ::com::sun::star::uno::Any& primaryCatalog, const ::rtl::OUString& primarySchema, const ::rtl::OUString& primaryTable, const ::com::sun::star::uno::Any& foreignCatalog, const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTypeInfo( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getIndexInfo( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Bool unique, sal_Bool approximate ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsBatchUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getUDTs( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const ::com::sun::star::uno::Sequence< sal_Int32 >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_FILE_ODATABASEMETADATA_HXX_ + diff --git a/connectivity/source/inc/file/FDriver.hxx b/connectivity/source/inc/file/FDriver.hxx new file mode 100644 index 000000000000..5edbb9fe379a --- /dev/null +++ b/connectivity/source/inc/file/FDriver.hxx @@ -0,0 +1,133 @@ +/************************************************************************* + * + * $RCSfile: FDriver.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_ODRIVER_HXX_ +#define _CONNECTIVITY_FILE_ODRIVER_HXX_ + +#ifndef _COM_SUN_STAR_SDBC_XDRIVER_HPP_ +#include <com/sun/star/sdbc/XDriver.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XDATADEFINITIONSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp> +#endif +#ifndef _CPPUHELPER_COMPBASE2_HXX_ +#include <cppuhelper/compbase2.hxx> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif + +namespace connectivity +{ + namespace file + { + typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::sdbc::XDriver, ::com::sun::star::lang::XServiceInfo > ODriver_BASE; + + class OFileDriver : public ODriver_BASE, + public ::com::sun::star::sdbcx::XDataDefinitionSupplier + { + protected: + ::osl::Mutex m_aMutex; + + connectivity::OWeakRefArray m_xConnections; // vector containing a list + // of all the Connection objects + // for this Driver + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; + public: + + DECLARE_CTY_DEFAULTS(ODriver_BASE); + + OFileDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory); + + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + + // XDriver + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMajorVersion( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMinorVersion( ) throw(::com::sun::star::uno::RuntimeException); + + // XDataDefinitionSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& connection ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getFactory() { return m_xFactory; } + }; + } + +} +#endif //_CONNECTIVITY_FILE_ODRIVER_HXX_ + + diff --git a/connectivity/source/inc/file/FPreparedStatement.hxx b/connectivity/source/inc/file/FPreparedStatement.hxx new file mode 100644 index 000000000000..3c89cd193fbf --- /dev/null +++ b/connectivity/source/inc/file/FPreparedStatement.hxx @@ -0,0 +1,163 @@ +/************************************************************************* + * + * $RCSfile: FPreparedStatement.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_OPREPAREDSTATEMENT_HXX_ +#define _CONNECTIVITY_FILE_OPREPAREDSTATEMENT_HXX_ + + +#ifndef _CONNECTIVITY_FILE_OSTATEMENT_HXX_ +#include "file/FStatement.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XPREPAREDSTATEMENT_HPP_ +#include <com/sun/star/sdbc/XPreparedStatement.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XPARAMETERS_HPP_ +#include <com/sun/star/sdbc/XParameters.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_ +#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +#endif +// #include <com/sun/star/sdbc/XClearParameters.hpp> +#ifndef _COM_SUN_STAR_SDBC_XPREPAREDBATCHEXECUTION_HPP_ +#include <com/sun/star/sdbc/XPreparedBatchExecution.hpp> +#endif +#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_ +#include <com/sun/star/io/XInputStream.hpp> +#endif +#ifndef _CONNECTIVITY_FILE_FRESULTSET_HXX_ +#include "file/FResultSet.hxx" +#endif + +namespace connectivity +{ + namespace file + { + + class OPreparedStatement : public OStatement_BASE2, + public ::com::sun::star::sdbc::XPreparedStatement, + public ::com::sun::star::sdbc::XParameters, + public ::com::sun::star::sdbc::XResultSetMetaDataSupplier, + public ::com::sun::star::lang::XServiceInfo + + { + protected: + //==================================================================== + // Data attributes + //==================================================================== + + ::rtl::OUString m_aSql; + OValueRow m_aRow; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > m_xRS; // only to enshure that the result isn't deleted + OResultSet* m_pResultSet; + + public: + DECLARE_CTY_DEFAULTS(OStatement_BASE2); + DECLARE_SERVICE_INFO(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OPreparedStatement( OConnection* _pConnection,const ::std::vector<connectivity::OTypeInfo>& _TypeInfo); + + void construct(const ::rtl::OUString& sql) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + //XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // XPreparedStatement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL executeUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XParameters + virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XResultSetMetaDataSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_FILE_OPREPAREDSTATEMENT_HXX_ + + diff --git a/connectivity/source/inc/file/FResultSet.hxx b/connectivity/source/inc/file/FResultSet.hxx new file mode 100644 index 000000000000..32f1e0e32351 --- /dev/null +++ b/connectivity/source/inc/file/FResultSet.hxx @@ -0,0 +1,458 @@ +/************************************************************************* + * + * $RCSfile: FResultSet.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_FRESULTSET_HXX_ +#define _CONNECTIVITY_FILE_FRESULTSET_HXX_ + +#ifndef _COM_SUN_STAR_SQLC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SQLC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SQLC_XRESULTSETMETADATASUPPLIER_HPP_ +#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SQLC_XCLOSEABLE_HPP_ +#include <com/sun/star/sdbc/XCloseable.hpp> +#endif +#ifndef _COM_SUN_STAR_SQLC_XCOLUMNLOCATE_HPP_ +#include <com/sun/star/sdbc/XColumnLocate.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_XCANCELLABLE_HPP_ +#include <com/sun/star/util/XCancellable.hpp> +#endif +#ifndef _COM_SUN_STAR_SQLC_XWARNINGSSUPPLIER_HPP_ +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SQLC_XRESULTSETUPDATE_HPP_ +#include <com/sun/star/sdbc/XResultSetUpdate.hpp> +#endif +#ifndef _COM_SUN_STAR_SQLC_XROWUPDATE_HPP_ +#include <com/sun/star/sdbc/XRowUpdate.hpp> +#endif +#ifndef _CPPUHELPER_COMPBASE11_HXX_ +#include <cppuhelper/compbase11.hxx> +#endif +#ifndef _UNOTOOLS_PROPERTY_ARRAY_HELPER_HXX_ +#include <unotools/proparrhlp.hxx> +#endif +#ifndef _CONNECTIVITY_FILE_OSTATEMENT_HXX_ +#include "file/FStatement.hxx" +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _CONNECTIVITY_SIMPLEPROPERTYCONTAINER_HXX_ +#include "connectivity/simplepropertycontainer.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_FANALYZER_HXX_ +#include "file/fanalyzer.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_TABLE_HXX_ +#include "file/FTable.hxx" +#endif + +namespace connectivity +{ + namespace file + { + class OKeySet : public ::std::vector<sal_Int32> + { + sal_Bool m_bFrozen; + public: + OKeySet(): ::std::vector<sal_Int32>(),m_bFrozen(sal_False){} + OKeySet(size_type _nSize) : ::std::vector<sal_Int32>(_nSize),m_bFrozen(sal_False){} + + sal_Bool isFrozen() const { return m_bFrozen; } + void setFrozen(sal_Bool _bFrozen=sal_True) { m_bFrozen = _bFrozen; } + }; + + typedef union + { + double aDouble; + rtl::OUString* pString; + } OFILEKey; + +#define SQL_ORDERBYKEYS 10 +#define SQL_COLUMN_NOTFOUND STRING_NOTFOUND + + class OFILEKeyValue + { + private: + INT32 nValue; + OFILEKey pKey[SQL_ORDERBYKEYS]; + + public: + OFILEKeyValue() { } + OFILEKeyValue(INT32 nVal) : nValue(nVal) {} + ~OFILEKeyValue(){} + + void SetKey(UINT16 i, double d) { pKey[i].aDouble = d; } + void SetKey(UINT16 i, const rtl::OUString& rString) { pKey[i].pString = new rtl::OUString(rString); } + void SetValue(INT32 nVal) { nValue = nVal; } + + rtl::OUString* GetKeyString(UINT16 i) const { return pKey[i].pString; } + double GetKeyDouble(UINT16 i) const { return pKey[i].aDouble; } + + inline INT32 GetValue() const {return nValue;} + }; + + typedef OFILEKeyValue * OFILEKeyValuePtr; + + typedef enum + { + SQL_ORDERBYKEY_NONE, // Nicht sortieren + SQL_ORDERBYKEY_DOUBLE, // Numerischer Key + SQL_ORDERBYKEY_STRING // String Key + } OKeyType; + + class OFILESortIndex + { + private: + INT32 nMaxCount; // Maximal moegliche Anzahl Key/Value-Paare im Index (und damit Array-Groesse) + INT32 nCount; // Anzahl Key/Value-Paare im Index (und damit naechste freie Position) + + OFILEKeyValuePtr * ppKeyValueArray; + // Zeiger auf Array der Groesse [nMaxCount] + + BOOL bFrozen; + CharSet eCharSet; + + public: // nur fuer OFILECompare: + static OFILESortIndex *pCurrentIndex; // Waehrend der Ausfuehrung von qsort ist hier der Zeiger + static CharSet eCurrentCharSet; + // auf den gerade zur Sortierung verwendeten Index hinterlegt + // (wird von der Vergleichsfunktion OFILEKeyCompare verwendet). + OKeyType eKeyType[SQL_ORDERBYKEYS]; + BOOL bAscending[SQL_ORDERBYKEYS]; + + + public: + + OFILESortIndex(const OKeyType eKeyType[], // Art des Schluessels: numerisch/String/nicht sortieren (Genau 3 Eintraege!) + const BOOL bAscending[], // TRUE = Aufsteigend sortieren (Genau 3 Eintraege!) + INT32 nMaxNumberOfRows, + CharSet eSet); + + ~OFILESortIndex(); + + + BOOL AddKeyValue(OFILEKeyValue * pKeyValue); + // TRUE, wenn erfolgreich hinzugefuegt, FALSE bei Ueberschreitung + // der Index-Kapazitaet. + // pKeyValue wird beim Zerstoeren des Index automatisch freigegeben. + + void Freeze(); // "Einfrieren" des Index: + // Vor "Freeze" duerfen Count() und Get() nicht gerufen werden, + // nach "Freeze" darf dafuer Add() nicht mehr gerufen werden. + + OKeySet* CreateKeySet(); + + + + BOOL IsFrozen() { return bFrozen; } // TRUE nach Aufruf von Freeze() + + INT32 Count() const { return nCount; } // Anzahl Key/Value-Paare im Index + INT32 GetValue(INT32 nPos) const; // Value an Position nPos (1..n) [sortierter Zugriff]. + }; + + static int +#if defined(WIN) || defined(WNT) +__cdecl +#endif +#if defined(ICC) && defined(OS2) +_Optlink +#endif +OFILEKeyCompare(const void * elem1, const void * elem2); + + /* + ** java_sql_ResultSet + */ + typedef ::cppu::WeakComponentImplHelper11< ::com::sun::star::sdbc::XResultSet, + ::com::sun::star::sdbc::XRow, + ::com::sun::star::sdbc::XResultSetMetaDataSupplier, + ::com::sun::star::util::XCancellable, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::sdbc::XResultSetUpdate, + ::com::sun::star::sdbc::XRowUpdate, + ::com::sun::star::sdbc::XCloseable, + ::com::sun::star::sdbc::XColumnLocate, + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::lang::XUnoTunnel> OResultSet_BASE; + + class OResultSet : public OBaseMutex, + public OResultSet_BASE, + public connectivity::OSimplePropertyContainer, + public ::utl::OPropertyArrayUsageHelper<OResultSet> + { + + ::std::vector<void*> m_aBindVector; + ::std::vector<sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 everytime + + OValueRow m_aRow; + OValueRow m_aEvaluateRow; // contains all values of a row + OValueRow m_aParameterRow; + ORefAssignValues m_aAssignValues; // needed for insert,update and parameters + // to compare with the restrictions + ::std::vector<sal_Int32>* m_pEvaluationKeySet; + ::std::vector<sal_Int32>::iterator m_aEvaluateIter; + + OKeySet* m_pFileSet; + OKeySet::iterator m_aFileSetIter; + + UINT16 nOrderbyColumnNumber[SQL_ORDERBYKEYS]; + BOOL bOrderbyAscending[SQL_ORDERBYKEYS]; + + OFILESortIndex* m_pSortIndex; + ::vos::ORef<connectivity::OSQLColumns> m_xColumns; // this are the select columns + ::vos::ORef<connectivity::OSQLColumns> m_xParamColumns; + OFileTable* m_pTable; + connectivity::OSQLParseNode* m_pParseTree; + + OFILEAnalyzer m_aSQLAnalyzer; + connectivity::OSQLParseTreeIterator& m_aSQLIterator; + + sal_Int32 m_nFetchSize; + sal_Int32 m_nResultSetType; + sal_Int32 m_nFetchDirection; + sal_Int32 m_nResultSetConcurrency; + + ::com::sun::star::uno::WeakReferenceHelper m_aStatement; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> m_xDBMetaData; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xColNames; // table columns + + ::rtl::OUString m_aTableRange; + sal_Int32 m_nRowPos; + sal_Int32 m_nFilePos; + sal_Int32 m_nLastVisitedPos; + sal_Int32 m_nRowCountResult; + sal_Bool m_bWasNull; + sal_Bool m_bBOF; // before first record + sal_Bool m_bEOF; // after last record + sal_Bool m_bLastRecord; + sal_Bool m_bFileSetFrozen; + + void construct(); + sal_Bool evaluate(); + BOOL Move(OFileTable::FilePosition eCursorPosition, INT32 nOffset, BOOL bRetrieveData); + BOOL ExecuteRow(OFileTable::FilePosition eFirstCursorPosition, + INT32 nOffset = 1, + BOOL bRebind = TRUE, + BOOL bEvaluate = TRUE, + BOOL bRetrieveData = TRUE); + + OFILEKeyValue* GetOrderbyKeyValue(OValueRow _rRow); + BOOL IsSorted() const {return nOrderbyColumnNumber[0] != SQL_COLUMN_NOTFOUND;} + void anylizeSQL(); + void setOrderbyColumn(UINT16 nOrderbyColumnNo, + connectivity::OSQLParseNode* pColumnRef, + connectivity::OSQLParseNode* pAscendingDescending); + void SetAssignValue(const String& aColumnName, + const String& aValue, + BOOL bSetNull = FALSE, + UINT32 nParameter=SQL_NO_PARAMETER); + void ParseAssignValues( const ::std::vector< String>& aColumnNameList, + connectivity::OSQLParseNode* pRow_Value_Constructor_Elem,xub_StrLen nIndex); + UINT32 AddParameter(connectivity::OSQLParseNode * pParameter, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet>& _xCol); + void GetAssignValues(); + + void scanParameter(OSQLParseNode* pParseNode,::std::vector< OSQLParseNode*>& _rParaNodes); + protected: + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + + public: + DECLARE_CTY_DEFAULTS(OResultSet_BASE); + DECLARE_SERVICE_INFO(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator); + ~OResultSet(); + + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > operator *() + { + return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(*(OResultSet_BASE*)this); + } + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) + { + return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); + } + // XResultSet + virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRow + virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XResultSetMetaDataSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCancellable + virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XResultSetUpdate + virtual void SAL_CALL insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRowUpdate + virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // com::sun::star::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + + // special methods + inline sal_Int32 mapColumn(sal_Int32 column); + BOOL OpenImpl(); + + sal_Int32 getRowCountResult() const { return m_nRowCountResult; } + void setParameterRow(const OValueRow& _rParaRow) { m_aParameterRow = _rParaRow; } + void describeParameter(); + }; + // ------------------------------------------------------------------------- + inline sal_Int32 OResultSet::mapColumn (sal_Int32 column) + { + return column; +// sal_Int32 map = column; +// +// if (m_aColMapping.size()) +// { +// // Validate column number +// OSL_ENSHURE(column>0,"OResultSet::mapColumn column <= 0"); +// map = m_aColMapping[column]; +// } +// +// return map; + } + } +} +#endif // _CONNECTIVITY_FILE_ORESULTSET_HXX_ + + diff --git a/connectivity/source/inc/file/FResultSetMetaData.hxx b/connectivity/source/inc/file/FResultSetMetaData.hxx new file mode 100644 index 000000000000..6aaf565012ff --- /dev/null +++ b/connectivity/source/inc/file/FResultSetMetaData.hxx @@ -0,0 +1,127 @@ +/************************************************************************* + * + * $RCSfile: FResultSetMetaData.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_ORESULTSETMETADATA_HXX_ +#define _CONNECTIVITY_FILE_ORESULTSETMETADATA_HXX_ + +#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATA_HPP_ +#include <com/sun/star/sdbc/XResultSetMetaData.hpp> +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif + +namespace connectivity +{ + namespace file + { + + //************************************************************** + //************ Class: ResultSetMetaData + //************************************************************** + typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData> OResultSetMetaData_BASE; + + class OResultSetMetaData : public OResultSetMetaData_BASE + { + ::rtl::OUString m_aTableName; + const connectivity::OSQLColumns& m_rColumns; + + public: + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OResultSetMetaData(const OSQLColumns& _rColumns,const ::rtl::OUString& _aTableName) + : m_rColumns(_rColumns) + , m_aTableName(_aTableName) + {} + ~OResultSetMetaData(); + + /// Avoid ambigous cast error from the compiler. + inline operator ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > () throw() + { return this; } + + virtual sal_Int32 SAL_CALL getColumnCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnLabel( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSchemaName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTableName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnTypeName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnServiceName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_FILE_ORESULTSETMETADATA_HXX_ + diff --git a/connectivity/source/inc/file/FStatement.hxx b/connectivity/source/inc/file/FStatement.hxx new file mode 100644 index 000000000000..b4bbfb1ed193 --- /dev/null +++ b/connectivity/source/inc/file/FStatement.hxx @@ -0,0 +1,233 @@ +/************************************************************************* + * + * $RCSfile: FStatement.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_OSTATEMENT_HXX_ +#define _CONNECTIVITY_FILE_OSTATEMENT_HXX_ + +#ifndef _COM_SUN_STAR_SDBC_XSTATEMENT_HPP_ +#include <com/sun/star/sdbc/XStatement.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP_ +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XMULTIPLERESULTS_HPP_ +#include <com/sun/star/sdbc/XMultipleResults.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XBATCHEXECUTION_HPP_ +#include <com/sun/star/sdbc/XBatchExecution.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XCLOSEABLE_HPP_ +#include <com/sun/star/sdbc/XCloseable.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_SQLWARNING_HPP_ +#include <com/sun/star/sdbc/SQLWarning.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_XCANCELLABLE_HPP_ +#include <com/sun/star/util/XCancellable.hpp> +#endif +#ifndef _UNOTOOLS_PROPERTY_ARRAY_HELPER_HXX_ +#include <unotools/proparrhlp.hxx> +#endif +#ifndef _CPPUHELPER_COMPBASE4_HXX_ +#include <cppuhelper/compbase4.hxx> +#endif +#ifndef _UTL_UNO3_HXX_ +#include <unotools/uno3.hxx> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_OCONNECTION_HXX_ +#include "file/FConnection.hxx" +#endif +#ifndef _LIST_ +#include <list> +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif +#ifndef _CONNECTIVITY_SIMPLEPROPERTYCONTAINER_HXX_ +#include "connectivity/simplepropertycontainer.hxx" +#endif +#ifndef _CONNECTIVITY_FILE_FANALYZER_HXX_ +#include "file/fanalyzer.hxx" +#endif + +namespace connectivity +{ + namespace file + { + typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::sdbc::XStatement, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::util::XCancellable, + ::com::sun::star::sdbc::XCloseable> OStatement_BASE; + + //************************************************************** + //************ Class: java.sql.Statement + //************************************************************** + class OStatement_Base : public OBaseMutex, + public OStatement_BASE, + public connectivity::OSimplePropertyContainer, + public ::utl::OPropertyArrayUsageHelper<OStatement_Base> + + { + ::com::sun::star::sdbc::SQLWarning m_aLastWarning; + ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet> m_xResultSet; // The last ResultSet created + // for this Statement + protected: + + connectivity::OSQLParser m_aParser; + connectivity::OSQLParseTreeIterator m_aSQLIterator; + + + OConnection* m_pConnection;// The owning Connection object + connectivity::OSQLParseNode* m_pParseTree; + + ::rtl::OUString m_aCursorName; + sal_Int32 m_nMaxFieldSize; + sal_Int32 m_nMaxRows; + sal_Int32 m_nQueryTimeOut; + sal_Int32 m_nFetchSize; + sal_Int32 m_nResultSetType; + sal_Int32 m_nFetchDirection; + sal_Int32 m_nResultSetConcurrency; + sal_Bool m_bEscapeProcessing; + protected: + + void reset () throw( ::com::sun::star::sdbc::SQLException); + void clearMyResultSet () throw( ::com::sun::star::sdbc::SQLException); + void setWarning (const ::com::sun::star::sdbc::SQLWarning &ex) throw( ::com::sun::star::sdbc::SQLException); + sal_Int32 getPrecision ( sal_Int32 sqlType); + + void disposeResultSet(); + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + public: + connectivity::OSQLParseNode* getParseTree() const { return m_pParseTree;} + + ::cppu::OBroadcastHelper& rBHelper; + DECLARE_CTY_ACQUIRE(OStatement_BASE); + OStatement_Base(OConnection* _pConnection ); + + using OStatement_BASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >; + // OComponentHelper + virtual void SAL_CALL disposing(void){OStatement_BASE::disposing();} + // XInterface + // virtual void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) = 0; + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) + { + return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); + } + // XStatement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Int32 SAL_CALL executeUpdate( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Bool SAL_CALL execute( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCancellable + virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + + class OStatement_BASE2 : public OStatement_Base, + public connectivity::OSubComponent< OStatement_BASE2> + + { + friend class connectivity::OSubComponent< OStatement_BASE2>; + public: + OStatement_BASE2(OConnection* _pConnection ) : OStatement_Base(_pConnection ), + connectivity::OSubComponent< OStatement_BASE2>((::cppu::OWeakObject*)_pConnection){} + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException); + }; + + class OStatement : public OStatement_BASE2, + public ::com::sun::star::lang::XServiceInfo + { + public: + DECLARE_CTY_DEFAULTS(OStatement_BASE2); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OStatement( OConnection* _pConnection) : OStatement_BASE2( _pConnection){} + DECLARE_SERVICE_INFO(); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) + { + return OStatement_BASE2::queryInterface( rType); + } + }; + } +} +#endif // _CONNECTIVITY_FILE_OSTATEMENT_HXX_ + diff --git a/connectivity/source/inc/file/FTable.hxx b/connectivity/source/inc/file/FTable.hxx new file mode 100644 index 000000000000..aed252f10909 --- /dev/null +++ b/connectivity/source/inc/file/FTable.hxx @@ -0,0 +1,163 @@ +/************************************************************************* + * + * $RCSfile: FTable.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_TABLE_HXX_ +#define _CONNECTIVITY_FILE_TABLE_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_TABLE_HXX_ +#include "connectivity/sdbcx/VTable.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ +#include <com/sun/star/lang/XUnoTunnel.hpp> +#endif +#ifndef _CONNECTIVITY_FILE_BCONNECTION_HXX_ +#include "file/FConnection.hxx" +#endif +#ifndef _STREAM_HXX +#include <tools/stream.hxx> +#endif +#ifndef _CONNECTIVITY_FILE_VALUE_HXX_ +#include "file/FValue.hxx" +#endif + +namespace connectivity +{ + namespace file + { + typedef connectivity::sdbcx::OTable OTable_TYPEDEF; + + class OFileTable : public OTable_TYPEDEF, + public ::com::sun::star::lang::XUnoTunnel + { + protected: + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; + OConnection* m_pConnection; + SvFileStream m_aFileStream; + ::vos::ORef<OSQLColumns> m_aColumns; + sal_uInt8* m_pBuffer; + sal_uInt16 m_nBufferSize; // Groesse des ReadBuffer, wenn pBuffer != NULL + sal_Int32 m_nFilePos; // aktuelle FilePosition + + public: + virtual void refreshColumns(); + virtual void refreshKeys(); + virtual void refreshIndexes(); + + enum FilePosition + { + FILE_NEXT = 0, + FILE_PRIOR, + FILE_FIRST, + FILE_LAST, + FILE_RELATIVE, + FILE_ABSOLUTE, + FILE_BOOKMARK + }; + + public: + DECLARE_CTY_DEFAULTS( OTable_TYPEDEF); + OFileTable( OConnection* _pConnection); + OFileTable( OConnection* _pConnection, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _Type, + const ::rtl::OUString& _Description = ::rtl::OUString(), + const ::rtl::OUString& _SchemaName = ::rtl::OUString(), + const ::rtl::OUString& _CatalogName = ::rtl::OUString() + ); + + //XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + + OConnection* getConnection() const { return m_pConnection;} + virtual sal_Int32 getCurrentLastPos() const {return 0;} + + virtual sal_Bool seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) = 0; + virtual sal_Bool fetchRow(OValueRow _rRow,const OSQLColumns& _rCols, sal_Bool bRetrieveData) = 0; + + ::vos::ORef<OSQLColumns> getTableColumns() const {return m_aColumns;} + virtual BOOL InsertRow(ORefAssignValues& rRow, BOOL bFlush,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols) + { + return sal_False; + } + virtual BOOL DeleteRow(const OSQLColumns& _rCols) + { + return sal_False; + } + virtual BOOL UpdateRow(OValueVector& rRow, file::OValueRow pOrgRow,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols) + { + return sal_False; + } + + const ::rtl::OUString& getName() const { return m_Name; } + const ::rtl::OUString& getSchema() const { return m_SchemaName; } + // com::sun::star::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + }; + } +} +#endif // _CONNECTIVITY_FILE_TABLE_HXX_ + diff --git a/connectivity/source/inc/file/FTables.hxx b/connectivity/source/inc/file/FTables.hxx new file mode 100644 index 000000000000..cde2c2710c88 --- /dev/null +++ b/connectivity/source/inc/file/FTables.hxx @@ -0,0 +1,98 @@ +/************************************************************************* + * + * $RCSfile: FTables.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_TABLES_HXX_ +#define _CONNECTIVITY_FILE_TABLES_HXX_ + +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#endif +namespace connectivity +{ + namespace file + { + class OTables : public sdbcx::OCollection + { + protected: + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject(); + public: + OTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, + const ::std::vector< ::rtl::OUString> &_rVector) : sdbcx::OCollection(_rParent,_rMetaData->storesMixedCaseQuotedIdentifiers(),_rMutex,_rVector) + ,m_xMetaData(_rMetaData) + // ,m_pParent(_pParent) + {} + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + + // only the name is identical to ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + }; + } +} +#endif // _CONNECTIVITY_FILE_TABLES_HXX_ + diff --git a/connectivity/source/inc/file/fanalyzer.hxx b/connectivity/source/inc/file/fanalyzer.hxx new file mode 100644 index 000000000000..43229b4e8793 --- /dev/null +++ b/connectivity/source/inc/file/fanalyzer.hxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * $RCSfile: fanalyzer.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_FANALYZER_HXX_ +#define _CONNECTIVITY_FILE_FANALYZER_HXX_ + +#ifndef _CONNECTIVITY_FILE_FCOMP_HXX_ +#include "file/fcomp.hxx" +#endif + +namespace connectivity +{ + namespace file + { + class OSQLAnalyzer + { + OPredicateCompiler m_aCompiler; + OPredicateInterpreter m_aInterpreter; + + // OCursor& m_rCursor; + + public: + OSQLAnalyzer(); + + void describeParam(::vos::ORef<OSQLColumns> rParameterColumns); // genauere Beschreibung der Parameter + ::std::vector<sal_Int32>* bindResultRow(OValueRow _pRow); // Anbinden einer Ergebniszeile an die Restrictions + void bindParameterRow(OValueRow _pRow); // Anbinden einer Parameterzeile an die Restrictions + + void start(OSQLParseNode* pSQLParseNode); + void clean(); + BOOL hasRestriction() const {return m_aCompiler.hasCode();} + BOOL evaluateRestriction() {return m_aInterpreter.start();} + void setOrigColumns(const OFileColumns& rCols) { m_aCompiler.setOrigColumns(rCols); } + void setParameterColumns(::vos::ORef< connectivity::OSQLColumns > _rParaCols) { m_aCompiler.setParameterColumns(_rParaCols); } + virtual OOperandAttr* createOperandAttr(sal_Int32 _nPos,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet>& _xCol) { return new OOperandAttr(_nPos,_xCol); } + }; + + class OFILEAnalyzer : public OSQLAnalyzer + { + public: + OFILEAnalyzer() : OSQLAnalyzer(){} + virtual OOperandAttr* createOperandAttr(sal_Int32 _nPos,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet>& _xCol) { return new OFILEOperandAttr(_nPos,_xCol); } + }; + } +} +#endif // _CONNECTIVITY_FILE_FANALYZER_HXX_ + diff --git a/connectivity/source/inc/file/fcode.hxx b/connectivity/source/inc/file/fcode.hxx new file mode 100644 index 000000000000..ff391fbb99d3 --- /dev/null +++ b/connectivity/source/inc/file/fcode.hxx @@ -0,0 +1,394 @@ +/************************************************************************* + * + * $RCSfile: fcode.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_FCODE_HXX_ +#define _CONNECTIVITY_FILE_FCODE_HXX_ + +#ifndef _CONNECTIVITY_PARSE_SQLITERATOR_HXX_ +#include "connectivity/sqliterator.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +#ifndef _RTTI_HXX //autogen +#include <tools/rtti.hxx> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ +#include <com/sun/star/container/XNameAccess.hpp> +#endif +#ifndef _CONNECTIVITY_FILE_VALUE_HXX_ +#include "file/FValue.hxx" +#endif + + +namespace connectivity +{ + class OSQLParseNode; + namespace file + { + + class OOperand; + typedef ::std::stack<OOperand*> OCodeStack; + class OBoolOperator; + typedef ::std::map<sal_Int32,sal_Int32> OEvaluateSet; + + typedef ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> OFileColumns; + + + class OCode + { + public: + virtual ~OCode(); + + TYPEINFO(); + }; + + + // operands that the parsetree generate + class OOperand : public OCode + { + protected: + sal_Int32 m_eDBType; + + OOperand(const sal_Int32& _rType) : m_eDBType(_rType){} + OOperand() : m_eDBType(::com::sun::star::sdbc::DataType::OTHER){} + + public: + virtual ::com::sun::star::uno::Any getValue() const = 0; + virtual void setValue(const ::com::sun::star::uno::Any& _rVal) = 0; + + virtual sal_Int32 getDBType() const {return m_eDBType;} + virtual OEvaluateSet* preProcess(OBoolOperator* pOp, OOperand* pRight = 0); + inline sal_Bool isValid() const; + + TYPEINFO(); + }; + + class OOperandRow : public OOperand + { + sal_uInt16 m_nRowPos; + protected: + OValueRow m_pRow; + + OOperandRow(sal_uInt16 _nPos, sal_Int32 _rType) : OOperand(_rType) + , m_nRowPos(_nPos){} + public: + sal_uInt16 getRowPos() const {return m_nRowPos;} + virtual ::com::sun::star::uno::Any getValue() const; + virtual void setValue(const ::com::sun::star::uno::Any& _rVal) + { + (*m_pRow)[m_nRowPos] = _rVal; + } + void bindValue(OValueRow _pRow); // Bindung an den Wert, den der Operand repräsentiert + + TYPEINFO(); + }; + + // Attribute aus einer Ergebniszeile + class OOperandAttr : public OOperandRow + { + protected: + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet> m_xColumn; + + public: + OOperandAttr(sal_uInt16 _nPos,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet>& _xColumn); + + virtual sal_Bool isIndexed() const {return sal_False;} + virtual OEvaluateSet* preProcess(OBoolOperator* pOp, OOperand* pRight = 0) { return NULL;} + TYPEINFO(); + }; + + // Attribute aus einer Ergebniszeile + class OFILEOperandAttr : public OOperandAttr + { + public: + OFILEOperandAttr(sal_uInt16 _nPos,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet>& _xColumn); + + virtual sal_Bool isIndexed() const + { + return ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>(m_xColumn,::com::sun::star::uno::UNO_QUERY)->getPropertySetInfo()->hasPropertyByName(connectivity::PROPERTY_ISASCENDING); + } + virtual OEvaluateSet* preProcess(OBoolOperator* pOp, OOperand* pRight = 0); + TYPEINFO(); + }; + + + // Parameter für ein Prädikat + class OOperandParam : public OOperandRow + { + public: + OOperandParam(connectivity::OSQLParseNode* pNode, ::vos::ORef<connectivity::OSQLColumns> _xParamColumns); + void describe(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet>& _xColumn, ::vos::ORef<connectivity::OSQLColumns> _xParamColumns); + + TYPEINFO(); + }; + + + // WerteOperanden + class OOperandValue : public OOperand + { + protected: + ::com::sun::star::uno::Any m_aValue; + + protected: + OOperandValue(){} + OOperandValue(const ::com::sun::star::uno::Any& _rVar, sal_Int32 eDbType) + : OOperand(eDbType) + , m_aValue(_rVar) + {} + + OOperandValue(sal_Int32 eDbType) :OOperand(eDbType){} + public: + virtual ::com::sun::star::uno::Any getValue() const; + virtual void setValue(const ::com::sun::star::uno::Any& _rVal) { m_aValue = _rVal; } + + TYPEINFO(); + }; + + + // Konstanten + class OOperandConst : public OOperandValue + { + public: + OOperandConst(const connectivity::OSQLParseNode& rColumnRef, const rtl::OUString& aStrValue); + + TYPEINFO(); + }; + + + // Ergebnis Operanden + class OOperandResult : public OOperandValue + { + protected: + OOperandResult(const ::com::sun::star::uno::Any& _rVar, sal_Int32 eDbType) + :OOperandValue(_rVar, eDbType) {} + OOperandResult(sal_Int32 eDbType) + :OOperandValue(eDbType) {} + public: + TYPEINFO(); + }; + + + class OOperandResultBOOL : public OOperandResult + { + public: + OOperandResultBOOL(sal_Bool bResult):OOperandResult(::com::sun::star::sdbc::DataType::BIT) + { + m_aValue <<= bResult ? 1.0 : 0.0; + } + }; + + class OOperandResultNUM : public OOperandResult + { + public: + OOperandResultNUM(double fNum):OOperandResult(::com::sun::star::sdbc::DataType::DOUBLE) + { + m_aValue <<= fNum; + } + }; + + + // Operatoren + + class OOperator : public OCode + { + public: + virtual void Exec(OCodeStack&) = 0; + virtual sal_uInt16 getRequestedOperands() const; // Anzahl benötigter Operanden + // Standard ist 2 + TYPEINFO(); + }; + + + // boolsche Operatoren + + class OBoolOperator : public OOperator + { + public: + TYPEINFO(); + virtual void Exec(OCodeStack&); + virtual sal_Bool operate(const OOperand*, const OOperand*) const; + }; + + + class OOp_AND : public OBoolOperator + { + public: + TYPEINFO(); + + protected: + virtual sal_Bool operate(const OOperand*, const OOperand*) const; + }; + + class OOp_OR : public OBoolOperator + { + public: + TYPEINFO(); + protected: + virtual sal_Bool operate(const OOperand*, const OOperand*) const; + }; + + class OOp_ISNULL : public OBoolOperator + { + public: + TYPEINFO(); + public: + virtual void Exec(OCodeStack&); + virtual sal_uInt16 getRequestedOperands() const; + virtual sal_Bool operate(const OOperand*, const OOperand* = NULL) const; + }; + + class OOp_ISNOTNULL : public OOp_ISNULL + { + public: + TYPEINFO(); + virtual sal_Bool operate(const OOperand*, const OOperand* = NULL) const; + }; + + class OOp_LIKE : public OBoolOperator + { + public: + TYPEINFO(); + protected: + const sal_Unicode cEscape; + + public: + OOp_LIKE(const sal_Unicode cEsc = L'\0'):cEscape(cEsc){}; + + virtual sal_Bool operate(const OOperand*, const OOperand*) const; + }; + + class OOp_NOTLIKE : public OOp_LIKE + { + public: + TYPEINFO(); + public: + OOp_NOTLIKE(const char cEsc = '\0'):OOp_LIKE(cEsc){}; + + virtual sal_Bool operate(const OOperand*, const OOperand*) const; + }; + + class OOp_COMPARE : public OBoolOperator + { + connectivity::OSQLPredicateType aPredicateType; + + public: + TYPEINFO(); + OOp_COMPARE(connectivity::OSQLPredicateType aPType) + :aPredicateType(aPType) {} + + connectivity::OSQLPredicateType getPredicateType() const {return aPredicateType;} + virtual sal_Bool operate(const OOperand*, const OOperand*) const; + }; + + // numerische Operatoren + + class ONumOperator : public OOperator + { + public: + virtual void Exec(OCodeStack&); + + TYPEINFO(); + + protected: + virtual double operate(double fLeft, double fRight) const = 0; + }; + + class OOp_ADD : public ONumOperator + { + protected: + virtual double operate(double fLeft, double fRight) const; + }; + + class OOp_SUB : public ONumOperator + { + protected: + virtual double operate(double fLeft, double fRight) const; + }; + + class OOp_MUL : public ONumOperator + { + protected: + virtual double operate(double fLeft, double fRight) const; + }; + + class OOp_DIV : public ONumOperator + { + protected: + virtual double operate(double fLeft, double fRight) const; + }; + + inline sal_Bool OOperand::isValid() const + { + ::com::sun::star::uno::Any aVal = getValue(); + return aVal.hasValue() && aVal.getValueTypeClass() == ::com::sun::star::uno::TypeClass_DOUBLE && connectivity::getDouble(aVal) != 0; + } + } +} + +#endif // _CONNECTIVITY_FILE_FCODE_HXX_ + diff --git a/connectivity/source/inc/file/fcomp.hxx b/connectivity/source/inc/file/fcomp.hxx new file mode 100644 index 000000000000..01bb73c8c210 --- /dev/null +++ b/connectivity/source/inc/file/fcomp.hxx @@ -0,0 +1,140 @@ +/************************************************************************* + * + * $RCSfile: fcomp.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_FILE_FCOMP_HXX_ +#define _CONNECTIVITY_FILE_FCOMP_HXX_ + +#ifndef _CONNECTIVITY_FILE_FCODE_HXX_ +#include "file/fcode.hxx" +#endif +#ifndef _LIST_ +#include <list> +#endif + +namespace connectivity +{ + class OSQLParseNode; + namespace file + { + class OCode; + class OOperand; + typedef::std::vector<OCode*> OCodeList; + + class OPredicateCompiler + { + friend class OPredicateInterpreter; + friend class OSQLAnalyzer; + + OCodeList m_aCodeList; + OFileColumns m_orgColumns; // in filecurs this are the filecolumns + ::vos::ORef< connectivity::OSQLColumns> m_aParameterColumns; + OSQLAnalyzer* m_pAnalyzer; + sal_Bool m_bORCondition; + + public: + OPredicateCompiler(OSQLAnalyzer* pAnalyzer); + + virtual ~OPredicateCompiler(); + + void start(connectivity::OSQLParseNode* pSQLParseNode); + OOperand* execute(connectivity::OSQLParseNode* pPredicateNode); + + void Clean(); + sal_Bool isClean() const {return m_aCodeList.empty();} + sal_Bool hasCode() const {return !isClean();} + sal_Bool hasORCondition() const {return m_bORCondition;} + void setOrigColumns(const OFileColumns& rCols) { m_orgColumns = rCols; } + const OFileColumns getOrigColumns() const { return m_orgColumns; } + + void setParameterColumns(::vos::ORef< connectivity::OSQLColumns > _rParaCols) + { + m_aParameterColumns = _rParaCols; + } + + protected: + OOperand* execute_COMPARE(connectivity::OSQLParseNode* pPredicateNode); + OOperand* execute_LIKE(connectivity::OSQLParseNode* pPredicateNode); + OOperand* execute_ISNULL(connectivity::OSQLParseNode* pPredicateNode); + OOperand* execute_Operand(connectivity::OSQLParseNode* pPredicateNode); + + private: + // OCursor& Cursor() const; + }; + + + class OPredicateInterpreter + { + OCodeStack m_aStack; + OPredicateCompiler& m_rCompiler; + + public: + OPredicateInterpreter(OPredicateCompiler& rComp) : m_rCompiler(rComp){} + virtual ~OPredicateInterpreter(); + + sal_Bool start() + { + return evaluate(m_rCompiler.m_aCodeList); + } + sal_Bool evaluate(OCodeList& rCodeList); + }; + } +} +#endif // _CONNECTIVITY_FILE_FCOMP_HXX_ + diff --git a/connectivity/source/inc/internalnode.hxx b/connectivity/source/inc/internalnode.hxx new file mode 100644 index 000000000000..819b3dbef122 --- /dev/null +++ b/connectivity/source/inc/internalnode.hxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * $RCSfile: internalnode.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_SQLINTERNALNODE_HXX +#define _CONNECTIVITY_SQLINTERNALNODE_HXX + +#ifndef _CONNECTIVITY_SQLNODE_HXX +#include <connectivity/sqlnode.hxx> +#endif + +namespace connectivity +{ + //========================================================================== + //= OSQLInternalNode + //========================================================================== + /** special node for avoiding memory leaks + */ + class OSQLInternalNode : public OSQLParseNode + { + public: + OSQLInternalNode(const sal_Char* pNewValue, + SQLNodeType eNodeType, + sal_uInt32 nNodeID = 0); + OSQLInternalNode(const ByteString& _rNewValue, + SQLNodeType eNodeType, + sal_uInt32 nNodeID = 0); + OSQLInternalNode(const sal_Unicode* pNewValue, + SQLNodeType eNodeType, + sal_uInt32 nNodeID = 0); + OSQLInternalNode(const String& _rNewValue, + SQLNodeType eNodeType, + sal_uInt32 nNodeID = 0); + + virtual ~OSQLInternalNode(); + }; +} + +#endif //_CONNECTIVITY_SQLINTERNALNODE_HXX diff --git a/connectivity/source/inc/java/io/InputStream.hxx b/connectivity/source/inc/java/io/InputStream.hxx new file mode 100644 index 000000000000..7b8c5b996731 --- /dev/null +++ b/connectivity/source/inc/java/io/InputStream.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * $RCSfile: InputStream.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_IO_INPUTSTREAM_HXX_ +#define _CONNECTIVITY_JAVA_IO_INPUTSTREAM_HXX_ + +#ifndef _CONNECTIVITY_JAVA_LANG_OBJECT_HXX_ +#include "java/lang/Object.hxx" +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif +#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_ +#include <com/sun/star/io/XInputStream.hpp> +#endif + +namespace connectivity +{ + + //************************************************************** + //************ Class: java.io.InputStream + //************************************************************** + class java_io_InputStream : public java_lang_Object, + public ::cppu::WeakImplHelper1< ::com::sun::star::io::XInputStream> + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + public: + static jclass getMyClass(); + virtual ~java_io_InputStream(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_io_InputStream( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} + // XInputStream + virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL available( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL closeInput( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + }; +} +#endif // _CONNECTIVITY_JAVA_IO_INPUTSTREAM_HXX_ + diff --git a/connectivity/source/inc/java/io/Reader.hxx b/connectivity/source/inc/java/io/Reader.hxx new file mode 100644 index 000000000000..446f6b524c23 --- /dev/null +++ b/connectivity/source/inc/java/io/Reader.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * $RCSfile: Reader.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_IO_READER_HXX_ +#define _CONNECTIVITY_JAVA_IO_READER_HXX_ + +#ifndef _CONNECTIVITY_JAVA_LANG_OBJECT_HXX_ +#include "java/lang/Object.hxx" +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif +#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_ +#include <com/sun/star/io/XInputStream.hpp> +#endif + +namespace connectivity +{ + //************************************************************** + //************ Class: java.io.InputStream + //************************************************************** + class java_io_Reader : public java_lang_Object, + public ::cppu::WeakImplHelper1< ::com::sun::star::io::XInputStream> + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + public: + static jclass getMyClass(); + virtual ~java_io_Reader(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_io_Reader( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} + // XInputStream + virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL available( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL closeInput( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + }; +} +#endif // _CONNECTIVITY_JAVA_IO_READER_HXX_ + diff --git a/connectivity/source/inc/java/lang/Boolean.hxx b/connectivity/source/inc/java/lang/Boolean.hxx new file mode 100644 index 000000000000..ac92587af1f6 --- /dev/null +++ b/connectivity/source/inc/java/lang/Boolean.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * $RCSfile: Boolean.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:27 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_LANG_BOOLEAN_HXX_ +#define _CONNECTIVITY_JAVA_LANG_BOOLEAN_HXX_ + +#ifndef _CONNECTIVITY_JAVA_LANG_OBJECT_HXX_ +#include "java/lang/Object.hxx" +#endif +//************************************************************** +//************ Class: java.lang.Boolean +//************************************************************** +namespace connectivity +{ + class java_lang_Boolean : public java_lang_Object + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + public: + static jclass getMyClass(); + virtual ~java_lang_Boolean(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_lang_Boolean( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} + + java_lang_Boolean( sal_Bool _par0 ); + }; +} + +#endif // _CONNECTIVITY_JAVA_LANG_BOOLEAN_HXX_ + + diff --git a/connectivity/source/inc/java/lang/Class.hxx b/connectivity/source/inc/java/lang/Class.hxx new file mode 100644 index 000000000000..3ee5265e7622 --- /dev/null +++ b/connectivity/source/inc/java/lang/Class.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * $RCSfile: Class.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:27 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_LANG_CLASS_HXX_ +#define _CONNECTIVITY_JAVA_LANG_CLASS_HXX_ +//************************************************************** +//************ Class: java.lang.Class +//************************************************************** +#ifndef _CONNECTIVITY_JAVA_LANG_OBJECT_HXX_ +#include "java/lang/Object.hxx" +#endif + +namespace connectivity +{ + class java_lang_Class : public java_lang_Object + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + public: + static jclass getMyClass(); + virtual ~java_lang_Class(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_lang_Class( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} + + static java_lang_Class * forName( const ::rtl::OUString &_par0 ); + sal_Bool isAssignableFrom( java_lang_Class * _par0 ); + java_lang_Object * newInstance(); + ::rtl::OUString getName(); + }; +} + +#endif // _CONNECTIVITY_JAVA_LANG_CLASS_HXX_ + diff --git a/connectivity/source/inc/java/lang/Exception.hxx b/connectivity/source/inc/java/lang/Exception.hxx new file mode 100644 index 000000000000..48bcb9391b77 --- /dev/null +++ b/connectivity/source/inc/java/lang/Exception.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * $RCSfile: Exception.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:27 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_LANG_EXCEPTION_HXX_ +#define _CONNECTIVITY_JAVA_LANG_EXCEPTION_HXX_ + +#ifndef _CONNECTIVITY_JAVA_LANG_THROWABLE_HXX_ +#include "java/lang/Throwable.hxx" +#endif + +namespace connectivity +{ + + //************************************************************** + //************ Class: java.lang.Exception + //************************************************************** + class java_lang_Exception : public java_lang_Throwable{ + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + public: + static jclass getMyClass(); + virtual ~java_lang_Exception(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_lang_Exception( JNIEnv * pEnv, jobject myObj ) : java_lang_Throwable( pEnv, myObj ){} + + }; +} +#endif // _CONNECTIVITY_JAVA_LANG_EXCEPTION_HXX_ + diff --git a/connectivity/source/inc/java/lang/Object.hxx b/connectivity/source/inc/java/lang/Object.hxx new file mode 100644 index 000000000000..d5e84074dc32 --- /dev/null +++ b/connectivity/source/inc/java/lang/Object.hxx @@ -0,0 +1,166 @@ +/************************************************************************* + * + * $RCSfile: Object.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:27 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_LANG_OBJECT_HXX_ +#define _CONNECTIVITY_JAVA_LANG_OBJECT_HXX_ + +#if STLPORT_VERSION>=321 +// jni.h needs cstdarg for std::va_list +#include <cstdarg> +#endif +#include <jni.h> + +#ifdef OS2 +#include <typedefs.h> +#endif + +#ifndef _COM_SUN_STAR_SDBC_SQLEXCEPTION_HPP_ +#include <com/sun/star/sdbc/SQLException.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif +//===================================================================== + +#ifdef HAVE_64BIT_POINTERS +#error "no 64 bit pointer" +#else +#ifdef OS2 +#define INT64_TO_PVOID(x) (void *)x.lo +inline jlong Make_Os2_Int64( sal_Int32 hi, sal_Int32 lo ) {jlong x = CONST64( hi, lo ); return x; } +#define PVOID_TO_INT64(x) Make_Os2_Int64( 0, (sal_Int32)x ) +#else //OS2 +#define PVOID_TO_INT64(x) (jlong)(sal_Int32)x +#define INT64_TO_PVOID(x) (void *)x +#endif //Os2 +#endif //HAVE_64BIT_POINTERS + +namespace connectivity +{ + + class SDBThreadAttach + { + sal_Bool bDetach; + protected: + void attachThread(JNIEnv * &pEnv,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory=NULL); + void detachThread(); + void xInit(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory=NULL); + int StartJava(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory=NULL); + + void setError(); + public: + JNIEnv * pEnv; + + SDBThreadAttach(); + SDBThreadAttach(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory); + ~SDBThreadAttach(); + + static sal_Bool IsJavaErrorOccured(); + }; + //===================================================================== + class java_lang_Class; + class java_lang_Object + { + // Zuweisungsoperator und Copy Konstruktor sind verboten + java_lang_Object& operator = (java_lang_Object&) { return *this;}; + java_lang_Object(java_lang_Object&) {}; + + static jclass getMyClass(); + // nur zum Zerstoeren des C++ Pointers in vom JSbxObject + // abgeleiteten Java Objekten + //static jclass getJSbxObjectClass(); + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; + + protected: + // der JAVA Handle zu dieser Klasse + jobject object; + // Klassendefinition + + // neu in SJ2: + static jclass theClass; // die Klasse braucht nur einmal angefordert werden ! + static jclass theJSbxObjectClass; // die Klasse braucht nur einmal angefordert werden ! + static sal_uInt32 nObjCount; // Zaehler fuer die Anzahl der Instanzen + + static void ThrowSQLException(JNIEnv * pEnv,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> & _rContext) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + public: + // der Konstruktor, der fuer die abgeleiteten Klassen verwendet + // werden soll. + java_lang_Object( JNIEnv * pEnv, jobject myObj ); + // der eigentliche Konstruktor + java_lang_Object(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory=NULL); + + virtual ~java_lang_Object(); + + void saveRef( JNIEnv * pEnv, jobject myObj ); + jobject getJavaObject() const { return object; } + java_lang_Object * GetWrapper() { return this; } + + java_lang_Class * getClass(); + + ::rtl::OUString toString(); + }; +} +#endif //_CONNECTIVITY_JAVA_LANG_OBJJECT_HXX_ + + diff --git a/connectivity/source/inc/java/lang/String.hxx b/connectivity/source/inc/java/lang/String.hxx new file mode 100644 index 000000000000..09f8c161547c --- /dev/null +++ b/connectivity/source/inc/java/lang/String.hxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * $RCSfile: String.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:27 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_LANG_STRING_HXX_ +#define _CONNECTIVITY_JAVA_LANG_STRING_HXX_ + +#ifndef _CONNECTIVITY_JAVA_LANG_OBJECT_HXX_ +#include "java/lang/Object.hxx" +#endif + +namespace connectivity +{ + class java_lang_String : public java_lang_Object + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + public: + static jclass getMyClass(); + virtual ~java_lang_String(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_lang_String( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} + + java_lang_String( const ::rtl::OUString& _par0 ); + operator ::rtl::OUString(); + }; + +} + +#endif // _CONNECTIVITY_JAVA_LANG_STRING_HXX_ + diff --git a/connectivity/source/inc/java/lang/Throwable.hxx b/connectivity/source/inc/java/lang/Throwable.hxx new file mode 100644 index 000000000000..e2eb14d01b94 --- /dev/null +++ b/connectivity/source/inc/java/lang/Throwable.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * $RCSfile: Throwable.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:27 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_LANG_THROWABLE_HXX_ +#define _CONNECTIVITY_JAVA_LANG_THROWABLE_HXX_ + +#ifndef _CONNECTIVITY_JAVA_LANG_OBJECT_HXX_ +#include "java/lang/Object.hxx" +#endif + +namespace connectivity +{ + //************************************************************** + //************ Class: java.lang.Throwable + //************************************************************** + class java_lang_Throwable : public java_lang_Object + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + public: + static jclass getMyClass(); + virtual ~java_lang_Throwable(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_lang_Throwable( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} + ::rtl::OUString getMessage() const; + ::rtl::OUString getLocalizedMessage() const; + ::rtl::OUString toString() const; + }; +} +#endif // _CONNECTIVITY_JAVA_LANG_THROWABLE_HXX_ + diff --git a/connectivity/source/inc/java/sql/Array.hxx b/connectivity/source/inc/java/sql/Array.hxx new file mode 100644 index 000000000000..675c2b6f94b7 --- /dev/null +++ b/connectivity/source/inc/java/sql/Array.hxx @@ -0,0 +1,106 @@ +/************************************************************************* + * + * $RCSfile: Array.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_ARRAY_HXX_ +#define _CONNECTIVITY_JAVA_SQL_ARRAY_HXX_ + +#ifndef _CONNECTIVITY_JAVA_LANG_OBJECT_HXX_ +#include "java/lang/Object.hxx" +#endif + +#ifndef _COM_SUN_STAR_SDBC_XARRAY_HPP_ +#include <com/sun/star/sdbc/XArray.hpp> +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif + +namespace connectivity +{ + + //************************************************************** + //************ Class: java.sql.SQLWarning + //************************************************************** + class java_sql_Array : public java_lang_Object, + public ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XArray> + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + public: + static jclass getMyClass(); + virtual ~java_sql_Array(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_Array( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} + + // XArray + virtual ::rtl::OUString SAL_CALL getBaseTypeName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getBaseType( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getArray( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getArrayAtIndex( sal_Int32 index, sal_Int32 count, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSet( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSetAtIndex( sal_Int32 index, sal_Int32 count, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_ARRAY_HXX_ + diff --git a/connectivity/source/inc/java/sql/Blob.hxx b/connectivity/source/inc/java/sql/Blob.hxx new file mode 100644 index 000000000000..ae5b8e9315a5 --- /dev/null +++ b/connectivity/source/inc/java/sql/Blob.hxx @@ -0,0 +1,106 @@ +/************************************************************************* + * + * $RCSfile: Blob.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_BLOB_HXX_ +#define _CONNECTIVITY_JAVA_SQL_BLOB_HXX_ + +#ifndef _CONNECTIVITY_JAVA_LANG_OBJECT_HXX_ +#include "java/lang/Object.hxx" +#endif + +#ifndef _COM_SUN_STAR_SDBC_XBLOB_HPP_ +#include <com/sun/star/sdbc/XBlob.hpp> +#endif + +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif + +namespace connectivity +{ + + //************************************************************** + //************ Class: java.sql.SQLWarning + //************************************************************** + class java_sql_Blob : public java_lang_Object, + public ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XBlob> + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + public: + static jclass getMyClass(); + virtual ~java_sql_Blob(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_Blob( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} + + // XBlob + virtual sal_Int64 SAL_CALL length( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int64 pos, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL position( const ::com::sun::star::uno::Sequence< sal_Int8 >& pattern, sal_Int64 start ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL positionOfBlob( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& pattern, sal_Int64 start ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_BLOB_HXX_ + diff --git a/connectivity/source/inc/java/sql/CallableStatement.hxx b/connectivity/source/inc/java/sql/CallableStatement.hxx new file mode 100644 index 000000000000..ccb0b1eeb603 --- /dev/null +++ b/connectivity/source/inc/java/sql/CallableStatement.hxx @@ -0,0 +1,129 @@ +/************************************************************************* + * + * $RCSfile: CallableStatement.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_CALLABLESTATEMENT_HXX_ +#define _CONNECTIVITY_JAVA_SQL_CALLABLESTATEMENT_HXX_ + +#ifndef _CONNECTIVITY_JAVA_SQL_PREPAREDSTATEMENT_HXX_ +#include "java/sql/PreparedStatement.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XOUTPARAMETERS_HPP_ +#include <com/sun/star/sdbc/XOutParameters.hpp> +#endif + +namespace connectivity +{ + + //************************************************************** + //************ Class: java.sql.CallableStatement + //************************************************************** + + class java_sql_CallableStatement : public java_sql_PreparedStatement, + public ::com::sun::star::sdbc::XRow, + public ::com::sun::star::sdbc::XOutParameters + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + public: + DECLARE_CTY_DEFAULTS(java_sql_PreparedStatement); + DECLARE_SERVICE_INFO(); + static jclass getMyClass(); + virtual ~java_sql_CallableStatement() {} ; + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_CallableStatement( JNIEnv * pEnv, jobject myObj,java_sql_Connection* _pCon ) : java_sql_PreparedStatement( pEnv, myObj, _pCon ){} + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // XRow + virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XOutParameters + virtual void SAL_CALL registerOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_CALLABLESTATEMENT_HXX_ + diff --git a/connectivity/source/inc/java/sql/Clob.hxx b/connectivity/source/inc/java/sql/Clob.hxx new file mode 100644 index 000000000000..51973701788a --- /dev/null +++ b/connectivity/source/inc/java/sql/Clob.hxx @@ -0,0 +1,104 @@ +/************************************************************************* + * + * $RCSfile: Clob.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_CLOB_HXX_ +#define _CONNECTIVITY_JAVA_SQL_CLOB_HXX_ + +#ifndef _CONNECTIVITY_JAVA_LANG_OBJECT_HXX_ +#include "java/lang/Object.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XCLOB_HPP_ +#include <com/sun/star/sdbc/XClob.hpp> +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif + +namespace connectivity +{ + + //************************************************************** + //************ Class: java.sql.SQLWarning + //************************************************************** + class java_sql_Clob : public java_lang_Object, + public ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XClob> + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + public: + static jclass getMyClass(); + virtual ~java_sql_Clob(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_Clob( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} + + // XClob + virtual sal_Int64 SAL_CALL length( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSubString( sal_Int64 pos, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL position( const ::rtl::OUString& searchstr, sal_Int32 start ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL positionOfClob( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& pattern, sal_Int64 start ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_CLOB_HXX_ + diff --git a/connectivity/source/inc/java/sql/Connection.hxx b/connectivity/source/inc/java/sql/Connection.hxx new file mode 100644 index 000000000000..41c75be37704 --- /dev/null +++ b/connectivity/source/inc/java/sql/Connection.hxx @@ -0,0 +1,161 @@ +/************************************************************************* + * + * $RCSfile: Connection.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_CONNECTION_HXX_ +#define _CONNECTIVITY_JAVA_SQL_CONNECTION_HXX_ + +#ifndef _CONNECTIVITY_JAVA_LANG_OBJECT_HXX_ +#include "java/lang/Object.hxx" +#endif +#ifndef _CPPUHELPER_COMPBASE3_HXX_ +#include <cppuhelper/compbase3.hxx> +#endif +#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ +#include <com/sun/star/sdbc/XConnection.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP_ +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _CONNECTIVITY_OSUBCOMPONENT_HXX_ +#include "OSubComponent.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif + + +namespace connectivity +{ + class java_sql_Driver; + + typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbc::XConnection, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::lang::XServiceInfo> java_sql_Connection_BASE; + + class java_sql_Connection : public java_sql_Connection_BASE, + public java_lang_Object, + public OSubComponent<java_sql_Connection> + { + friend class OSubComponent<java_sql_Connection>; + + ::osl::Mutex m_aMutex; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; + OWeakRefArray m_aStatements; // vector containing a list + // of all the Statement objects + // for this Connection + java_sql_Driver* m_pDriver; + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + public: + static int TRANSACTION_NONE; + static int TRANSACTION_READ_COMMITTED; + static int TRANSACTION_READ_UNCOMMITTED; + static int TRANSACTION_REPEATABLE_READ; + static int TRANSACTION_SERIALIZABLE; + + static jclass getMyClass(); + virtual ~java_sql_Connection(); + DECLARE_SERVICE_INFO(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_Connection( JNIEnv * pEnv, jobject myObj,java_sql_Driver* _pDriver ) :java_sql_Connection_BASE(m_aMutex), + java_lang_Object( pEnv, myObj ), + OSubComponent<java_sql_Connection>((::cppu::OWeakObject*)_pDriver), + m_xMetaData(NULL), + m_pDriver(_pDriver){} + + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException); + + // XConnection + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL nativeSQL( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getAutoCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL commit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL rollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isClosed( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setCatalog( const ::rtl::OUString& catalog ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalog( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTypeMap( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTypeMap( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_CONNECTION_HXX_ + diff --git a/connectivity/source/inc/java/sql/DatabaseMetaData.hxx b/connectivity/source/inc/java/sql/DatabaseMetaData.hxx new file mode 100644 index 000000000000..3a9396bd49ba --- /dev/null +++ b/connectivity/source/inc/java/sql/DatabaseMetaData.hxx @@ -0,0 +1,248 @@ +/************************************************************************* + * + * $RCSfile: DatabaseMetaData.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_DATABASEMETADATA_HXX_ +#define _CONNECTIVITY_JAVA_SQL_DATABASEMETADATA_HXX_ + +#ifndef _CONNECTIVITY_JAVA_LANG_OBJECT_HXX_ +#include "java/lang/Object.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif +namespace connectivity +{ + class java_sql_Connection; + //************************************************************** + //************ Class: java.sql.DatabaseMetaDataDate + //************************************************************** + + class java_sql_DatabaseMetaData : public ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XDatabaseMetaData >, + public java_lang_Object + { + java_sql_Connection* m_pConnection; + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + public: + static jclass getMyClass(); + virtual ~java_sql_DatabaseMetaData(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_DatabaseMetaData( JNIEnv * pEnv, jobject myObj,java_sql_Connection* _pConnection ) + : java_lang_Object( pEnv, myObj ),m_pConnection(_pConnection){} + + virtual sal_Bool SAL_CALL allProceduresAreCallable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL allTablesAreSelectable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getURL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getUserName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedLow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDatabaseProductName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDatabaseProductVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDriverName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDriverVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL usesLocalFiles( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMixedCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesMixedCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getIdentifierQuoteString( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSQLKeywords( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getNumericFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getStringFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSystemFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTimeDateFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSearchStringEscape( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getExtraNameCharacters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsAlterTableWithAddColumn( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsAlterTableWithDropColumn( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsColumnAliasing( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTypeConversion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSchemaTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getProcedureTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCatalogAtStart( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogSeparator( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInDataManipulation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInTableDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInDataManipulation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInTableDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsPositionedDelete( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsStoredProcedures( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsUnion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsUnionAll( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxConnections( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxIndexLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxRowSize( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxStatementLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxStatements( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxTablesInSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedures( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedureColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTables( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getSchemas( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCatalogs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTableTypes( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTablePrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getBestRowIdentifier( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope, sal_Bool nullable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getVersionColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getImportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getExportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCrossReference( const ::com::sun::star::uno::Any& primaryCatalog, const ::rtl::OUString& primarySchema, const ::rtl::OUString& primaryTable, const ::com::sun::star::uno::Any& foreignCatalog, const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTypeInfo( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getIndexInfo( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Bool unique, sal_Bool approximate ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsBatchUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getUDTs( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const ::com::sun::star::uno::Sequence< sal_Int32 >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_DATABASEMETADATA_HXX_ + diff --git a/connectivity/source/inc/java/sql/Driver.hxx b/connectivity/source/inc/java/sql/Driver.hxx new file mode 100644 index 000000000000..612c60de9e8e --- /dev/null +++ b/connectivity/source/inc/java/sql/Driver.hxx @@ -0,0 +1,118 @@ +/************************************************************************* + * + * $RCSfile: Driver.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_DRIVER_HXX_ +#define _CONNECTIVITY_JAVA_SQL_DRIVER_HXX_ + +#ifndef _COM_SUN_STAR_SDBC_XDRIVER_HPP_ +#include <com/sun/star/sdbc/XDriver.hpp> +#endif +#ifndef _CONNECTIVITY_JAVA_LANG_OBJECT_HXX_ +#include "java/lang/Object.hxx" +#endif +#ifndef _CPPUHELPER_IMPLBASE2_HXX_ +#include <cppuhelper/implbase2.hxx> +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif + +namespace connectivity +{ + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL java_sql_Driver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ); + + class java_sql_Driver : public ::cppu::WeakImplHelper2< ::com::sun::star::sdbc::XDriver,::com::sun::star::lang::XServiceInfo>, + public java_lang_Object + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + public: + static jclass getMyClass(); + virtual ~java_sql_Driver(); + + java_sql_Driver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory); + java_sql_Driver( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} + + static rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + + // XDriver + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Int32 SAL_CALL getMajorVersion( ) throw(::com::sun::star::uno::RuntimeException) ; + virtual sal_Int32 SAL_CALL getMinorVersion( ) throw(::com::sun::star::uno::RuntimeException) ; + }; + +} +#endif //_CONNECTIVITY_JAVA_SQL_DRIVER_HXX_ + diff --git a/connectivity/source/inc/java/sql/DriverManager.hxx b/connectivity/source/inc/java/sql/DriverManager.hxx new file mode 100644 index 000000000000..9e8e54de2ffb --- /dev/null +++ b/connectivity/source/inc/java/sql/DriverManager.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * $RCSfile: DriverManager.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_DRIVERMANAGER_HXX_ +#define _CONNECTIVITY_JAVA_SQL_DRIVERMANAGER_HXX_ + +#ifndef _CONNECTIVITY_JAVA_LANG_OBJECT_HXX_ +#include "java/lang/Object.hxx" +#endif + +namespace connectivity +{ + class java_sql_Driver; + class java_sql_Connection; + // class java_util_Properties; + //************************************************************** + //************ Class: java.sql.DriverManager + //************************************************************** + class java_sql_DriverManager : public java_lang_Object + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + public: + static jclass getMyClass(); + virtual ~java_sql_DriverManager(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_DriverManager( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} + + static jobject getDriver(const ::rtl::OUString &url); + + // static java_sql_Connection * getConnection( const ::rtl::OUString* _par0 ); + // static java_sql_Connection * getConnection( const String* _par0, java_util_Properties * _par1 ); + // static java_sql_Connection * getConnection( const String* _par0, const String* _par1, const String* _par2 ); + // static java_util_Enumeration * getDrivers(); + static void setLoginTimeout(sal_Int32 _par0); + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_DRIVERMANAGER_HXX_ + diff --git a/connectivity/source/inc/java/sql/DriverPropertyInfo.hxx b/connectivity/source/inc/java/sql/DriverPropertyInfo.hxx new file mode 100644 index 000000000000..5a30b13054da --- /dev/null +++ b/connectivity/source/inc/java/sql/DriverPropertyInfo.hxx @@ -0,0 +1,101 @@ +/************************************************************************* + * + * $RCSfile: DriverPropertyInfo.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_DRIVERPOPERTYINFO_HXX_ +#define _CONNECTIVITY_JAVA_SQL_DRIVERPOPERTYINFO_HXX_ + +#ifndef _CONNECTIVITY_JAVA_LANG_OBJECT_HXX_ +#include "java/lang/Object.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_DRIVERPROPERTYINFO_HPP_ +#include <com/sun/star/sdbc/DriverPropertyInfo.hpp> +#endif + +namespace connectivity +{ + +//************************************************************** +//************ Class: java.sql.DriverManager +//************************************************************** + class java_sql_DriverPropertyInfo : public java_lang_Object + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + public: + static jclass getMyClass(); + virtual ~java_sql_DriverPropertyInfo(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_DriverPropertyInfo( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} + operator ::com::sun::star::sdbc::DriverPropertyInfo(); + + ::rtl::OUString name() const; + ::rtl::OUString description() const; + ::rtl::OUString value() const; + sal_Bool required() const; + ::com::sun::star::uno::Sequence< ::rtl::OUString> choices() const; + }; +} + +#endif // _CONNECTIVITY_JAVA_SQL_DRIVERPOPERTYINFO_HXX_ + diff --git a/connectivity/source/inc/java/sql/PreparedStatement.hxx b/connectivity/source/inc/java/sql/PreparedStatement.hxx new file mode 100644 index 000000000000..1fd2131714e3 --- /dev/null +++ b/connectivity/source/inc/java/sql/PreparedStatement.hxx @@ -0,0 +1,146 @@ +/************************************************************************* + * + * $RCSfile: PreparedStatement.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_PREPAREDSTATEMENT_HXX_ +#define _CONNECTIVITY_JAVA_SQL_PREPAREDSTATEMENT_HXX_ + +#ifndef _CONNECTIVITY_JAVA_SQL_STATEMENT_HXX_ +#include "java/sql/Statement.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XPREPAREDSTATEMENT_HPP_ +#include <com/sun/star/sdbc/XPreparedStatement.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XPARAMETERS_HPP_ +#include <com/sun/star/sdbc/XParameters.hpp> +#endif +// #include <com/sun/star/sdbc/XClearParameters.hpp> +#ifndef _COM_SUN_STAR_SDBC_XPREPAREDBATCHEXECUTION_HPP_ +#include <com/sun/star/sdbc/XPreparedBatchExecution.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif + +namespace connectivity +{ + //************************************************************** + //************ Class: java.sql.PreparedStatement + //************************************************************** + + class java_sql_PreparedStatement : public OStatement_BASE2, + public ::com::sun::star::sdbc::XPreparedStatement, + public ::com::sun::star::sdbc::XParameters, + public ::com::sun::star::sdbc::XPreparedBatchExecution, + public ::com::sun::star::lang::XServiceInfo + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + public: + DECLARE_CTY_DEFAULTS(OStatement_BASE2); + DECLARE_SERVICE_INFO(); + static jclass getMyClass(); + virtual ~java_sql_PreparedStatement(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_PreparedStatement( JNIEnv * pEnv, jobject myObj,java_sql_Connection* _pCon ) : OStatement_BASE2( pEnv, myObj, _pCon ){} + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // XPreparedStatement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL executeUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XParameters + virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XPreparedBatchExecution + virtual void SAL_CALL addBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_PREPAREDSTATEMENT_HXX_ + diff --git a/connectivity/source/inc/java/sql/Ref.hxx b/connectivity/source/inc/java/sql/Ref.hxx new file mode 100644 index 000000000000..7fd64e5ddc7b --- /dev/null +++ b/connectivity/source/inc/java/sql/Ref.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * $RCSfile: Ref.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_REF_HXX_ +#define _CONNECTIVITY_JAVA_SQL_REF_HXX_ + +#ifndef _CONNECTIVITY_JAVA_LANG_OBJECT_HXX_ +#include "java/lang/Object.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XREF_HPP_ +#include <com/sun/star/sdbc/XRef.hpp> +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif + +namespace connectivity +{ + //************************************************************** + //************ Class: java.sql.Ref + //************************************************************** + class java_sql_Ref : public java_lang_Object, + public ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XRef> + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + public: + static jclass getMyClass(); + virtual ~java_sql_Ref(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_Ref( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} + + // XRef + virtual ::rtl::OUString SAL_CALL getBaseTypeName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_REF_HXX_ + diff --git a/connectivity/source/inc/java/sql/ResultSet.hxx b/connectivity/source/inc/java/sql/ResultSet.hxx new file mode 100644 index 000000000000..996afc54e07f --- /dev/null +++ b/connectivity/source/inc/java/sql/ResultSet.hxx @@ -0,0 +1,272 @@ +/************************************************************************* + * + * $RCSfile: ResultSet.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_RESULTSET_HXX_ +#define _CONNECTIVITY_JAVA_SQL_RESULTSET_HXX_ + +#ifndef _CONNECTIVITY_JAVA_LANG_OBJECT_HXX_ +#include "java/lang/Object.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_ +#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XCLOSEABLE_HPP_ +#include <com/sun/star/sdbc/XCloseable.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XCOLUMNLOCATE_HPP_ +#include <com/sun/star/sdbc/XColumnLocate.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_XCANCELLABLE_HPP_ +#include <com/sun/star/util/XCancellable.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP_ +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSETUPDATE_HPP_ +#include <com/sun/star/sdbc/XResultSetUpdate.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XROWUPDATE_HPP_ +#include <com/sun/star/sdbc/XRowUpdate.hpp> +#endif +#ifndef _CPPUHELPER_COMPBASE10_HXX_ +#include <cppuhelper/compbase10.hxx> +#endif +#ifndef _UNOTOOLS_PROPERTY_ARRAY_HELPER_HXX_ +#include <unotools/proparrhlp.hxx> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_STATEMENT_HXX_ +#include "java/sql/Statement.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif + +namespace connectivity +{ + + /* + ** java_sql_ResultSet + */ + typedef ::cppu::WeakComponentImplHelper10< ::com::sun::star::sdbc::XResultSet, + ::com::sun::star::sdbc::XRow, + ::com::sun::star::sdbc::XResultSetMetaDataSupplier, + ::com::sun::star::util::XCancellable, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::sdbc::XResultSetUpdate, + ::com::sun::star::sdbc::XRowUpdate, + ::com::sun::star::sdbc::XCloseable, + ::com::sun::star::sdbc::XColumnLocate, + ::com::sun::star::lang::XServiceInfo> java_sql_ResultSet_BASE; + + class java_sql_ResultSet : public OBaseMutex, + public java_sql_ResultSet_BASE, + public java_lang_Object, + public ::cppu::OPropertySetHelper, + public ::utl::OPropertyArrayUsageHelper<java_sql_ResultSet> + { + ::com::sun::star::uno::WeakReferenceHelper m_aStatement; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData; + + sal_Int32 getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getResultSetType() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getFetchDirection() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getFetchSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + ::rtl::OUString getCursorName() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + void setFetchDirection(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setFetchSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + + virtual sal_Bool SAL_CALL convertFastPropertyValue( + ::com::sun::star::uno::Any & rConvertedValue, + ::com::sun::star::uno::Any & rOldValue, + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue ) + throw (::com::sun::star::lang::IllegalArgumentException); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue + ) + throw (::com::sun::star::uno::Exception); + virtual void SAL_CALL getFastPropertyValue( + ::com::sun::star::uno::Any& rValue, + sal_Int32 nHandle + ) const; + public: + DECLARE_CTY_DEFAULTS(java_sql_ResultSet_BASE); + DECLARE_SERVICE_INFO(); + static jclass getMyClass(); + virtual ~java_sql_ResultSet(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_ResultSet( JNIEnv * pEnv, jobject myObj,java_sql_Statement_Base* pStmt=NULL ) : java_sql_ResultSet_BASE(m_aMutex), + OPropertySetHelper(java_sql_ResultSet_BASE::rBHelper), + m_aStatement((::cppu::OWeakObject*)pStmt), + java_lang_Object( pEnv, myObj ) + {} + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) + { + return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); + } + // XResultSet + virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRow + virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XResultSetMetaDataSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCancellable + virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XResultSetUpdate + virtual void SAL_CALL insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRowUpdate + virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_RESULTSET_HXX_ + diff --git a/connectivity/source/inc/java/sql/ResultSetMetaData.hxx b/connectivity/source/inc/java/sql/ResultSetMetaData.hxx new file mode 100644 index 000000000000..43ced3ff4463 --- /dev/null +++ b/connectivity/source/inc/java/sql/ResultSetMetaData.hxx @@ -0,0 +1,118 @@ +/************************************************************************* + * + * $RCSfile: ResultSetMetaData.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_RESULTSETMETADATA_HXX_ +#define _CONNECTIVITY_JAVA_SQL_RESULTSETMETADATA_HXX_ + +#ifndef _CONNECTIVITY_JAVA_LANG_OBJECT_HXX_ +#include "java/lang/Object.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATA_HPP_ +#include <com/sun/star/sdbc/XResultSetMetaData.hpp> +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif + +namespace connectivity +{ + //************************************************************** + //************ Class: java.sql.ResultSetMetaData + //************************************************************** + + class java_sql_ResultSetMetaData : public ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData>, + public java_lang_Object + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + public: + static jclass getMyClass(); + virtual ~java_sql_ResultSetMetaData(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_ResultSetMetaData( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} + + virtual sal_Int32 SAL_CALL getColumnCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnLabel( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSchemaName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTableName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnTypeName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnServiceName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_RESULTSETMETADATA_HXX_ + diff --git a/connectivity/source/inc/java/sql/SQLException.hxx b/connectivity/source/inc/java/sql/SQLException.hxx new file mode 100644 index 000000000000..5dc1f898acfe --- /dev/null +++ b/connectivity/source/inc/java/sql/SQLException.hxx @@ -0,0 +1,106 @@ +/************************************************************************* + * + * $RCSfile: SQLException.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_SQLEXCEPTION_HXX_ +#define _CONNECTIVITY_JAVA_SQL_SQLEXCEPTION_HXX_ + +#ifndef _CONNECTIVITY_JAVA_LANG_EXCEPTION_HXX_ +#include "java/lang/Exception.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_SQLEXCEPTION_HPP_ +#include <com/sun/star/sdbc/SQLException.hpp> +#endif + +namespace connectivity +{ + namespace starsdbc = ::com::sun::star::sdbc; + //************************************************************** + //************ Class: java.sql.SQLException + //************************************************************** + class java_sql_SQLException_BASE; + class java_sql_SQLException : public starsdbc::SQLException + { + public: + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_SQLException(){} + java_sql_SQLException( const java_sql_SQLException_BASE& _rException,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> & _rContext); + }; + + class java_sql_SQLException_BASE : public java_lang_Exception + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + public: + static jclass getMyClass(); + virtual ~java_sql_SQLException_BASE(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_SQLException_BASE( JNIEnv * pEnv, jobject myObj ); + + ::rtl::OUString getSQLState() const; + sal_Int32 getErrorCode() const; + starsdbc::SQLException getNextException() const; + }; + +} +#endif // _CONNECTIVITY_JAVA_SQL_SQLEXCEPTION_HXX_ + diff --git a/connectivity/source/inc/java/sql/SQLWarning.hxx b/connectivity/source/inc/java/sql/SQLWarning.hxx new file mode 100644 index 000000000000..fa1e7e3d6f27 --- /dev/null +++ b/connectivity/source/inc/java/sql/SQLWarning.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * $RCSfile: SQLWarning.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_SQLWARNING_HXX_ +#define _CONNECTIVITY_JAVA_SQL_SQLWARNING_HXX_ + +#ifndef _CONNECTIVITY_JAVA_SQL_SQLEXCEPTION_HXX_ +#include "java/sql/SQLException.hxx" +#endif +//#ifndef _COM_SUN_STAR_SDBC_SQLWARNING_HPP_ +//#include <com/sun/star/sdbc/SQLWarning.hpp> +//#endif + +namespace connectivity +{ + // namespace starsdbc = ::com::sun::star::sdbc; + // namespace ::com::sun::star::uno = ::com::sun::star::uno; + //************************************************************** + //************ Class: java.sql.SQLWarning + //************************************************************** + class java_sql_SQLWarning_BASE : public java_sql_SQLException_BASE + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + public: + static jclass getMyClass(); + virtual ~java_sql_SQLWarning_BASE(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_SQLWarning_BASE( JNIEnv * pEnv, jobject myObj ) : java_sql_SQLException_BASE( pEnv, myObj ){} + + }; + + class java_sql_SQLWarning : public java_sql_SQLException + { + public: + java_sql_SQLWarning(const java_sql_SQLWarning_BASE& _rW,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> & _rContext) + : java_sql_SQLException(_rW,_rContext) {} + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_SQLWARNING_HXX_ + diff --git a/connectivity/source/inc/java/sql/Timestamp.hxx b/connectivity/source/inc/java/sql/Timestamp.hxx new file mode 100644 index 000000000000..7729d38f71ed --- /dev/null +++ b/connectivity/source/inc/java/sql/Timestamp.hxx @@ -0,0 +1,151 @@ +/************************************************************************* + * + * $RCSfile: Timestamp.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_TIMESTAMP_HXX_ +#define _CONNECTIVITY_JAVA_SQL_TIMESTAMP_HXX_ + +#ifndef _CONNECTIVITY_JAVA_UTIL_DATE_HXX_ +#include "java/util/Date.hxx" +#endif +#ifndef _COM_SUN_STAR_UTIL_TIME_HPP_ +#include <com/sun/star/util/Time.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_DATETIME_HPP_ +#include <com/sun/star/util/DateTime.hpp> +#endif + + +namespace connectivity +{ + //************************************************************** + //************ Class: java.sql.Date + //************************************************************** + + class java_sql_Date : public java_util_Date + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + public: + static jclass getMyClass(); + virtual ~java_sql_Date(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_Date( JNIEnv * pEnv, jobject myObj ) : java_util_Date( pEnv, myObj ){} + java_sql_Date( const ::com::sun::star::util::Date& _rOut ) : java_util_Date(_rOut) {} + operator ::com::sun::star::util::Date() + { + return ::com::sun::star::util::Date(getYear(),getMonth(),getDate()); + } + }; + + + //************************************************************** + //************ Class: java.sql.Time + //************************************************************** + + class java_sql_Time : public java_util_Date + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + public: + static jclass getMyClass(); + virtual ~java_sql_Time(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_Time( JNIEnv * pEnv, jobject myObj ) : java_util_Date( pEnv, myObj ){} + java_sql_Time( const ::com::sun::star::util::Time& _rOut ); + operator ::com::sun::star::util::Time() + { + return ::com::sun::star::util::Time(0,getSeconds(),getMinutes(),getHours()); + } + }; + + //************************************************************** + //************ Class: java.sql.Timestamp + //************************************************************** + class java_sql_Timestamp : public java_util_Date + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + public: + static jclass getMyClass(); + virtual ~java_sql_Timestamp(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_Timestamp( JNIEnv * pEnv, jobject myObj ) : java_util_Date( pEnv, myObj ){} + java_sql_Timestamp( const ::com::sun::star::util::DateTime& _rOut); + operator ::com::sun::star::util::DateTime() + { + return ::com::sun::star::util::DateTime(getYear(),getMonth(),getDate(), + getHours(),getMinutes(),getSeconds(),getNanos()); + } + + sal_Int32 getNanos(); + void setNanos(sal_Int32 n); + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_TIMESTAMP_HXX_ + diff --git a/connectivity/source/inc/java/tools.hxx b/connectivity/source/inc/java/tools.hxx new file mode 100644 index 000000000000..c65ee9f6745f --- /dev/null +++ b/connectivity/source/inc/java/tools.hxx @@ -0,0 +1,127 @@ +/************************************************************************* + * + * $RCSfile: tools.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#define _CONNECTIVITY_JAVA_TOOLS_HXX_ + +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ +#include <com/sun/star/beans/PropertyValue.hpp> +#endif +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_ +#include <com/sun/star/uno/Sequence.h> +#endif + +#ifndef JNI_H +#include <jni.h> +#endif +#ifndef _CONNECTIVITY_JAVA_SQL_SQLEXCEPTION_HXX_ +#include "java/sql/SQLException.hxx" +#endif + +#ifndef _UTL_UNO3_HXX_ +#include <unotools/uno3.hxx> +#endif + +//FORWARD_DECLARE_INTERFACE(container,XNameAccess) +//FORWARD_DECLARE_INTERFACE(uno,Reference) +#include <com/sun/star/container/XNameAccess.hpp> +#ifndef _COM_SUN_STAR_UTIL_TIME_HPP_ +#include <com/sun/star/util/Time.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_DATE_HPP_ +#include <com/sun/star/util/Date.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_DATETIME_HPP_ +#include <com/sun/star/util/DateTime.hpp> +#endif + + +namespace connectivity +{ + + jstring convertwchar_tToJavaString(JNIEnv *pEnv,const ::rtl::OUString& _Temp); + ::rtl::OUString JavaString2String(JNIEnv *pEnv,jstring _Str); + + jobjectArray createStringPropertyArray(JNIEnv *pEnv,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + template<class T,class JT> ::com::sun::star::uno::Sequence< T > copyArrayAndDelete(JNIEnv *pEnv,jobjectArray _Array,const T& _rD1,const JT& _rD2) + { + ::com::sun::star::uno::Sequence< T > xOut; + if(_Array) + { + jsize nLen = pEnv->GetArrayLength(_Array); + xOut.realloc(nLen); + for(jsize i=0;i<nLen;++i) + { + JT xInfo(pEnv,pEnv->GetObjectArrayElement(_Array,i)); + xOut.getArray()[i] = xInfo; + } + pEnv->DeleteLocalRef(_Array); + } + return xOut; + } + + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > Map2XNameAccess(JNIEnv *pEnv,jobject _pMap); + jobject XNameAccess2Map(JNIEnv *pEnv,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & _rMap); +} + +#endif // _CONNECTIVITY_JAVA_TOOLS_HXX_ + diff --git a/connectivity/source/inc/java/util/Date.hxx b/connectivity/source/inc/java/util/Date.hxx new file mode 100644 index 000000000000..121cce620d7c --- /dev/null +++ b/connectivity/source/inc/java/util/Date.hxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * $RCSfile: Date.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:27 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_UTIL_DATE_HXX_ +#define _CONNECTIVITY_JAVA_UTIL_DATE_HXX_ + +#ifndef _CONNECTIVITY_JAVA_LANG_OBJECT_HXX_ +#include "java/lang/Object.hxx" +#endif +#ifndef _COM_SUN_STAR_UTIL_DATE_HPP_ +#include <com/sun/star/util/Date.hpp> +#endif + +namespace connectivity +{ + + //************************************************************** + //************ Class: java.util.Date + //************************************************************** + + class java_util_Date : public java_lang_Object + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); + public: + static jclass getMyClass(); + virtual ~java_util_Date(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_util_Date( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} + java_util_Date( const ::com::sun::star::util::Date& _rOut ); + + sal_Int32 getMonth(); + sal_Int32 getYear(); + sal_Int32 getDate(); + + sal_Int32 getMinutes(); + sal_Int32 getSeconds(); + sal_Int32 getHours(); + }; +} +#endif // _CONNECTIVITY_JAVA_UTIL_DATE_HXX_ + diff --git a/connectivity/source/inc/java/util/Property.hxx b/connectivity/source/inc/java/util/Property.hxx new file mode 100644 index 000000000000..ca24b386f895 --- /dev/null +++ b/connectivity/source/inc/java/util/Property.hxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * $RCSfile: Property.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:27 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +class java_util_Property : public java_lang_Object +{ +protected: +// statische Daten fuer die Klasse + static jclass theClass; + // der Destruktor um den Object-Counter zu aktualisieren + static void saveClassRef( jclass pClass ); +public: + static jclass getMyClass(); + virtual ~java_util_Property(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: +}; java_util_Property( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} diff --git a/connectivity/source/inc/odbc/OBoundParam.hxx b/connectivity/source/inc/odbc/OBoundParam.hxx new file mode 100644 index 000000000000..d7badbf6f207 --- /dev/null +++ b/connectivity/source/inc/odbc/OBoundParam.hxx @@ -0,0 +1,271 @@ +/************************************************************************* + * + * $RCSfile: OBoundParam.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:27 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_OBOUNPARAM_HXX_ +#define _CONNECTIVITY_OBOUNPARAM_HXX_ + +#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_ +#include <com/sun/star/io/XInputStream.hpp> +#endif + +namespace connectivity +{ + namespace odbc + { + class OBoundParam + { + + public: + OBoundParam() + { + pA1=0; + pA2=0; + pB1=0; + pB2=0; + pC1=0; + pC2=0; + pS1=0; + pS2=0; + } + //-------------------------------------------------------------------- + // initialize + // Perform an necessary initialization + //-------------------------------------------------------------------- + void initialize () + { + // Allocate storage for the length. Note - the length is + // stored in native format, and will have to be converted + // to a Java sal_Int32. The jdbcodbc 'C' bridge provides an + // interface to do this. + + paramLength = new sal_Int8[4]; + } + + //-------------------------------------------------------------------- + // allocBindDataBuffer + // Allocates and returns a new bind data buffer of the specified + // length + //-------------------------------------------------------------------- + sal_Int8* allocBindDataBuffer (sal_Int32 bufLen) + { + binaryData = new sal_Int8[bufLen]; + + // Reset the input stream, we are doing a new bind + setInputStream (NULL, 0); + + return binaryData; + } + + //-------------------------------------------------------------------- + // getBindDataBuffer + // Returns the data buffer to be used when binding to a parameter + //-------------------------------------------------------------------- + sal_Int8* getBindDataBuffer () + { + return binaryData; + } + + //-------------------------------------------------------------------- + // getBindLengthBuffer + // Returns the length buffer to be used when binding to a parameter + //-------------------------------------------------------------------- + sal_Int8* getBindLengthBuffer () + { + return paramLength; + } + + //-------------------------------------------------------------------- + // setInputStream + // Sets the input stream for the bound parameter + //-------------------------------------------------------------------- + void setInputStream(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& inputStream, + sal_Int32 len) + { + paramInputStream = inputStream; + paramInputStreamLen = len; + } + + //-------------------------------------------------------------------- + // getInputStream + // Gets the input stream for the bound parameter + //-------------------------------------------------------------------- + ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream> getInputStream () + { + return paramInputStream; + } + + //-------------------------------------------------------------------- + // getInputStreamLen + // Gets the input stream length for the bound parameter + //-------------------------------------------------------------------- + sal_Int32 getInputStreamLen () + { + return paramInputStreamLen; + } + + //-------------------------------------------------------------------- + // setSqlType + // Sets the Java sql type used to register an OUT parameter + //-------------------------------------------------------------------- + + void setSqlType(sal_Int32 type) + { + sqlType = type; + } + + //-------------------------------------------------------------------- + // getSqlType + // Gets the Java sql type used to register an OUT parameter + //-------------------------------------------------------------------- + + sal_Int32 getSqlType () + { + return sqlType; + } + + //-------------------------------------------------------------------- + // setStreamType + // Sets the input stream type used to register an OUT parameter + //-------------------------------------------------------------------- + + void setStreamType (sal_Int32 type) + { + streamType = type; + } + + //-------------------------------------------------------------------- + // getStreamType + // Gets the input stream type used to register an OUT parameter + //-------------------------------------------------------------------- + + sal_Int32 getStreamType () + { + return streamType; + } + + //-------------------------------------------------------------------- + // setOutputParameter + // Sets the flag indicating if this is an OUTPUT parameter + //-------------------------------------------------------------------- + + void setOutputParameter (sal_Bool output) + { + outputParameter = output; + } + + //-------------------------------------------------------------------- + // isOutputParameter + // Gets the OUTPUT parameter flag + //-------------------------------------------------------------------- + + sal_Bool isOutputParameter () + { + return outputParameter; + } + + protected: + //==================================================================== + // Data attributes + //==================================================================== + + sal_Int8* binaryData; // Storage area to be used + // when binding the parameter + + sal_Int8* paramLength; // Storage area to be used + // for the bound length of the + // parameter. Note that this + // data is in native format. + + ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream> paramInputStream; + // When an input stream is + // bound to a parameter, the + // input stream is saved + // until needed. + + sal_Int32 paramInputStreamLen; // Length of input stream + + sal_Int32 sqlType; // Java SQL type used to + // register an OUT parameter + + sal_Int32 streamType; // Input stream type + // (ASCII, BINARY, UNICODE) + + + sal_Bool outputParameter; // true for OUTPUT parameters + + + sal_Int32 pA1; //pointers + sal_Int32 pA2; + sal_Int32 pB1; + sal_Int32 pB2; + sal_Int32 pC1; + sal_Int32 pC2; + sal_Int32 pS1; + sal_Int32 pS2;// reserved for strings(UTFChars) + + public: + static int ASCII; + static int UNICODE; + static int BINARY; + }; + } +} +#endif // _CONNECTIVITY_OBOUNPARAM_HXX_ + diff --git a/connectivity/source/inc/odbc/OConnection.hxx b/connectivity/source/inc/odbc/OConnection.hxx new file mode 100644 index 000000000000..f4676efc88f2 --- /dev/null +++ b/connectivity/source/inc/odbc/OConnection.hxx @@ -0,0 +1,192 @@ +/************************************************************************* + * + * $RCSfile: OConnection.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:27 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ODBC_OCONNECTION_HXX_ +#define _CONNECTIVITY_ODBC_OCONNECTION_HXX_ + +#ifndef _CPPUHELPER_COMPBASE3_HXX_ +#include <cppuhelper/compbase3.hxx> +#endif +#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ +#include <com/sun/star/sdbc/XConnection.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP_ +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_SQLWARNING_HPP_ +#include <com/sun/star/sdbc/SQLWarning.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ +#include <com/sun/star/beans/PropertyValue.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif +#ifndef _CONNECTIVITY_OFUNCTIONDEFS_HXX_ +#include "odbc/OFunctiondefs.hxx" +#endif +#ifndef _CONNECTIVITY_OSUBCOMPONENT_HXX_ +#include "OSubComponent.hxx" +#endif +#ifndef _MAP_ +#include <map> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _CONNECTIVITY_OTYPEINFO_HXX_ +#include "OTypeInfo.hxx" +#endif + +namespace connectivity +{ + namespace odbc + { + + class OStatement_Base; + class ODBCDriver; + class ODatabaseMetaData; + + typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbc::XConnection, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::lang::XServiceInfo + > OConnection_BASE; + + class OConnection : public OConnection_BASE, + public connectivity::OSubComponent<OConnection> + { + friend class connectivity::OSubComponent<OConnection>; + + protected: + ::osl::Mutex m_aMutex; + //==================================================================== + // Data attributes + //==================================================================== + ::std::vector<connectivity::OTypeInfo> m_aTypeInfo; // vector containing an entry + // for each row returned by + // DatabaseMetaData.getTypeInfo. + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; + + connectivity::OWeakRefArray m_aStatements; // vector containing a list + // of all the Statement objects + // for this Connection + + ::com::sun::star::sdbc::SQLWarning m_aLastWarning; // Last SQLWarning generated by + // an operation + ::rtl::OUString m_aURL; // URL of connection + ODBCDriver* m_pDriver; // Pointer to the owning + // driver object + + SQLHANDLE m_aConnectionHandle; + SQLHANDLE m_pDriverHandleCopy; // performance reason + sal_Bool m_bClosed; + + + SQLRETURN OpenConnection(const ::rtl::OUString& aConnectStr,sal_Int32 nTimeOut, sal_Bool bSilent); + + void buildTypeInfo() throw( ::com::sun::star::sdbc::SQLException); + public: + virtual SQLRETURN Construct( const ::rtl::OUString& url,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info) throw(::com::sun::star::sdbc::SQLException); + + OConnection(const SQLHANDLE _pDriverHandle,ODBCDriver* _pDriver); + // OConnection(const SQLHANDLE _pConnectionHandle); + virtual ~OConnection(); + + void closeAllStatements () throw( ::com::sun::star::sdbc::SQLException); + + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + DECLARE_SERVICE_INFO(); + + // XConnection + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL nativeSQL( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getAutoCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL commit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL rollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isClosed( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setCatalog( const ::rtl::OUString& catalog ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalog( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTypeMap( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTypeMap( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // + SQLHANDLE getConnection() { return m_aConnectionHandle; } + }; + } +} +#endif // _CONNECTIVITY_ODBC_OCONNECTION_HXX_ + diff --git a/connectivity/source/inc/odbc/ODatabaseMetaData.hxx b/connectivity/source/inc/odbc/ODatabaseMetaData.hxx new file mode 100644 index 000000000000..4eb2cbfa048c --- /dev/null +++ b/connectivity/source/inc/odbc/ODatabaseMetaData.hxx @@ -0,0 +1,244 @@ +/************************************************************************* + * + * $RCSfile: ODatabaseMetaData.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:27 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ODBC_ODATABASEMETADATA_HXX_ +#define _CONNECTIVITY_ODBC_ODATABASEMETADATA_HXX_ + +#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif +#ifndef _CONNECTIVITY_ODBC_OCONNECTION_HXX_ +#include "odbc/OConnection.hxx" +#endif +namespace connectivity +{ + namespace odbc + { + //************************************************************** + //************ Class: java.sql.DatabaseMetaDataDate + //************************************************************** + + class ODatabaseMetaData : public ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XDatabaseMetaData > + { + SQLHANDLE m_aConnectionHandle; + OConnection* m_pConnection; + public: + + ODatabaseMetaData(const SQLHANDLE _pHandle,OConnection* _pCon); + ~ODatabaseMetaData(); + // XDatabaseMetaData + virtual sal_Bool SAL_CALL allProceduresAreCallable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL allTablesAreSelectable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getURL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getUserName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedLow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDatabaseProductName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDatabaseProductVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDriverName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDriverVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL usesLocalFiles( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMixedCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesMixedCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getIdentifierQuoteString( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSQLKeywords( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getNumericFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getStringFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSystemFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTimeDateFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSearchStringEscape( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getExtraNameCharacters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsAlterTableWithAddColumn( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsAlterTableWithDropColumn( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsColumnAliasing( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTypeConversion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSchemaTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getProcedureTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCatalogAtStart( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogSeparator( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInDataManipulation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInTableDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInDataManipulation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInTableDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsPositionedDelete( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsStoredProcedures( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsUnion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsUnionAll( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxConnections( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxIndexLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxRowSize( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxStatementLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxStatements( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxTablesInSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedures( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedureColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTables( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getSchemas( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCatalogs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTableTypes( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTablePrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getBestRowIdentifier( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope, sal_Bool nullable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getVersionColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getImportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getExportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCrossReference( const ::com::sun::star::uno::Any& primaryCatalog, const ::rtl::OUString& primarySchema, const ::rtl::OUString& primaryTable, const ::com::sun::star::uno::Any& foreignCatalog, const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTypeInfo( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getIndexInfo( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Bool unique, sal_Bool approximate ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsBatchUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getUDTs( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const ::com::sun::star::uno::Sequence< sal_Int32 >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_ODBC_ODATABASEMETADATA_HXX_ + diff --git a/connectivity/source/inc/odbc/ODefs3.hxx b/connectivity/source/inc/odbc/ODefs3.hxx new file mode 100644 index 000000000000..de1fd44057c5 --- /dev/null +++ b/connectivity/source/inc/odbc/ODefs3.hxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * $RCSfile: ODefs3.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:27 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ODBC_ODEFS_HXX_ +#define _CONNECTIVITY_ODBC_ODEFS_HXX_ + +#define N3SQLAllocHandle SQLAllocHandle +#define N3SQLConnect SQLConnect +#define N3SQLDriverConnect SQLDriverConnect +#define N3SQLBrowseConnect SQLBrowseConnect +#define N3SQLDataSources SQLDataSources +#define N3SQLDrivers SQLDrivers +#define N3SQLGetInfo SQLGetInfo +#define N3SQLGetFunctions SQLGetFunctions +#define N3SQLGetTypeInfo SQLGetTypeInfo +#define N3SQLSetConnectAttr SQLSetConnectAttr +#define N3SQLGetConnectAttr SQLGetConnectAttr +#define N3SQLSetEnvAttr SQLSetEnvAttr +#define N3SQLGetEnvAttr SQLGetEnvAttr +#define N3SQLSetStmtAttr SQLSetStmtAttr +#define N3SQLGetStmtAttr SQLgetStmtAttr +#define N3SQLSetDescField SQLSetDescField +#define N3SQLGetDescField SQLGetDescField +#define N3SQLGetDescRec SQLGetDescRec +#define N3SQLSetDescRec SQLSetDescRec +#define N3SQLPrepare SQLPrepare +#define N3SQLBindParameter SQLBindParameter +#define N3SQLGetCursorName SQLGetCursorName +#define N3SQLSetCursorName SQLSetCursorName +#define N3SQLExecute SQLExecute +#define N3SQLExecDirect SQLExecDirect +#define N3SQLNativeSql SQLNativeSql +#define N3SQLDescribeParam SQLDescribeParam +#define N3SQLNumParams SQLNumParams +#define N3SQLParamData SQLParamData +#define N3SQLPutData SQLPutData +#define N3SQLRowCount SQLRowCount +#define N3SQLNumResultCols SQLNumResultCols +#define N3SQLDescribeCol SQLDescribeCol +#define N3SQLColAttribute SQLColAttribute +#define N3SQLBindCol SQLBindCol +#define N3SQLFetch SQLFetch +#define N3SQLFetchScroll SQLFetchScroll +#define N3SQLGetData SQLGetData +#define N3SQLSetPos SQLSetPos +#define N3SQLBulkOperations SQLBulkOperations +#define N3SQLMoreResults SQLMoreResults +#define N3SQLGetDiagField SQLGetDiagField +#define N3SQLGetDiagRec SQLGetDiagRec +#define N3SQLColumnPrivileges SQLColumnPrivileges +#define N3SQLColumns SQLColumns +#define N3SQLForeignKeys SQLForeignKeys +#define N3SQLPrimaryKeys SQLPrimaryKeys +#define N3SQLProcedureColumns SQLProcedureColumns +#define N3SQLProcedures SQLProcedures +#define N3SQLSpecialColumns SQLSpecialColumns +#define N3SQLStatistics SQLStatistics +#define N3SQLTablePrivileges SQLTablePrivileges +#define N3SQLTables SQLTables +#define N3SQLFreeStmt SQLFreeStmt +#define N3SQLCloseCursor SQLCloseCursor +#define N3SQLCancel SQLCancel +#define N3SQLEndTran SQLEndTran +#define N3SQLDisconnect SQLDisconnect +#define N3SQLFreeHandle SQLFreeHandle +#define N3SQLGetCursorName SQLGetCursorName + +#endif // _CONNECTIVITY_ODBC_ODEFS_HXX_ + diff --git a/connectivity/source/inc/odbc/ODriver.hxx b/connectivity/source/inc/odbc/ODriver.hxx new file mode 100644 index 000000000000..d11769c582b5 --- /dev/null +++ b/connectivity/source/inc/odbc/ODriver.hxx @@ -0,0 +1,128 @@ +/************************************************************************* + * + * $RCSfile: ODriver.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:27 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ODBC_ODRIVER_HXX_ +#define _CONNECTIVITY_ODBC_ODRIVER_HXX_ + +#ifndef _COM_SUN_STAR_SDBC_XDRIVER_HPP_ +#include <com/sun/star/sdbc/XDriver.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif +#ifndef _CPPUHELPER_COMPBASE2_HXX_ +#include <cppuhelper/compbase2.hxx> +#endif +#ifndef _CONNECTIVITY_OFUNCTIONDEFS_HXX_ +#include "odbc/OFunctiondefs.hxx" +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif + +namespace connectivity +{ + namespace odbc + { + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ODBCDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ); + + typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::sdbc::XDriver, ::com::sun::star::lang::XServiceInfo > ODriver_BASE; + + class ODBCDriver : public ODriver_BASE + { + protected: + ::osl::Mutex m_aMutex; + + connectivity::OWeakRefArray m_xConnections; // vector containing a list + // of all the Connection objects + // for this Driver + + SQLHANDLE m_pDriverHandle; + + virtual SQLHANDLE EnvironmentHandle(::rtl::OUString &_rPath); + public: + + ODBCDriver(); + + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + + // XDriver + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMajorVersion( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMinorVersion( ) throw(::com::sun::star::uno::RuntimeException); + }; + } + +} +#endif //_CONNECTIVITY_ODBC_ODRIVER_HXX_ + + diff --git a/connectivity/source/inc/odbc/OFunctiondefs.hxx b/connectivity/source/inc/odbc/OFunctiondefs.hxx new file mode 100644 index 000000000000..49fee156367c --- /dev/null +++ b/connectivity/source/inc/odbc/OFunctiondefs.hxx @@ -0,0 +1,232 @@ +/************************************************************************* + * + * $RCSfile: OFunctiondefs.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:27 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +//-------------------------------------------------------------------------- +#ifndef _CONNECTIVITY_OFUNCTIONDEFS_HXX_ +#define _CONNECTIVITY_OFUNCTIONDEFS_HXX_ + +#if defined(WIN) || defined(WNT) + +// #include "odbc3imp.hxx" +#include <tools/prewin.h> +#include <odbc/sqlext.h> +#include <tools/postwin.h> + + + + +#ifndef SQL_C_BOOKMARK +#define SQL_C_BOOKMARK SQL_C_ULONG /* BOOKMARK */ +#endif + +#ifndef SQL_OPT_TRACE_OFF +#define SQL_OPT_TRACE_OFF 0UL +#endif + +#define SDB_ODBC_CHAR UCHAR + +#endif + +//-------------------------------------------------------------------------- + +#ifdef MAC + +#include <mac_start.h> + +#define sal_Bool SQLBOOL +#define PFUNC SQLPFUNC + +#ifdef __powerc + +#ifndef _ODBCCFM_H +#include <ODBCCfm.h> +#endif + +#else + +#ifndef __ODBCSHAREDLIBRARY__ + #include <odbc/ODBCSharedLibrary.h> +#endif + +#endif + +#ifndef __SQLEXT + #include <odbc/sqlext.h> +#endif + +#include <mac_end.h> + +// Schnell wieder weg mit dem ganzen Zeug + +#undef sal_Bool +#undef PFUNC + +#ifdef __powerc + // Herkoemmliche Version (DLL-Bindung automatisch beim Start des Programms). + // odbcdefs.hxx biegt die in den Quellen benutzten NSQL-Methoden auf die + // herkoemmlichen SQL...-Aufrufe um. + // #include "odbc3defs.hxx" +#else + // Stub-Version: dynamische Bindung an die DLL zur Laufzeit. + // odbcstub definiert die in den Quellen benutzten NSQL...-Methoden + // als indirekte Funktionsaufrufe. + // odbcimp zieht sich selbst preos2, odbc und postos2 an. + // #include "odbc3imp.hxx" +#endif + +#define SDB_ODBC_CHAR UCHAR + +#endif + +//-------------------------------------------------------------------------- + +#ifdef OS2 + +#ifdef ODBCIMP + +// Stub-Version: dynamische Bindung an die DLL zur Laufzeit. +// odbcstub definiert die in den Quellen benutzten NSQL...-Methoden +// als indirekte Funktionsaufrufe. +// odbcimp zieht sich selbst preos2, odbc und postos2 an. +// #include "odbc3imp.hxx" + +#else + +// Zur Zeit verwenden wir die ODBC-DLL von Watcom-SQL direkt (ueber die +// mitgelieferte Lib). + +#ifndef ODBC_OS2 +#define ODBC_OS2 +#endif + +#include <svpm.h> +#include <odbc.h> +#define SQL_API __syscall +#ifndef SQL_MAX_MESSAGE_LENGTH +#define SQL_MAX_MESSAGE_LENGTH MAX_MESSAGE_LENGTH +#endif +#ifndef SQL_MAX_DSN_LENGTH +#define SQL_MAX_DSN_LENGTH MAX_DSN_LENGTH +#endif +#ifndef SQL_AUTOCOMMIT_ON +#define SQL_AUTOCOMMIT_ON 1UL +#endif +#ifndef SQL_AUTOCOMMIT_OFF +#define SQL_AUTOCOMMIT_OFF 0UL +#endif + +#define SQL_FETCH_PRIOR SQL_FETCH_PREV +#define SQL_NO_TOTAL (-4) + +// #include "odbc3defs.hxx" + +#endif + +// In der ODBC.H von Watcom werden Strings als char * erwartet +// (nicht, wie sonst bei ODBC ueblich, als UCHAR *). +#if defined( ICC ) || defined( WTC ) +#define SDB_ODBC_CHAR unsigned char +#else +#define SDB_ODBC_CHAR char +#endif + +#endif + +//-------------------------------------------------------------------------- + +#ifdef UNX + +#ifdef ODBCIMP +// Stub-Version: dynamische Bindung an die shared library zur Laufzeit. +// odbcstub definiert die in den Quellen benutzten NSQL...-Methoden +// als indirekte Funktionsaufrufe. +// odbcimp zieht sich selbst preos2, odbc und postos2 an. +// #include "odbc3imp.hxx" + +#else + +// Zur Zeit verwenden wir die ODBC-shared library von Q+E direkt (ueber die +// mitgelieferte Lib). + +#ifndef ODBC_UNX +#define ODBC_UNX +#endif +#include <odbc/qeodbc.h> +#define CALLBACK +#define EXPORT +#include <odbc/sqlext.h> +#undef sal_Bool // Ist in qeodbc.h definiert, wird aber von solar.h noch einmal + // definiert. + +// #include "odbc3defs.hxx" + +#endif // ODBCIMP + +#define SDB_ODBC_CHAR UCHAR +#define SQL_WCHAR (-8) +#define SQL_WVARCHAR (-9) +#define SQL_WLONGVARCHAR (-10) +#define SQL_C_WCHAR SQL_WCHAR + + +#endif // UNX +#endif // _CONNECTIVITY_OFUNCTIONDEFS_HXX_ + diff --git a/connectivity/source/inc/odbc/OFunctions.hxx b/connectivity/source/inc/odbc/OFunctions.hxx new file mode 100644 index 000000000000..bbfeefb91351 --- /dev/null +++ b/connectivity/source/inc/odbc/OFunctions.hxx @@ -0,0 +1,596 @@ +/************************************************************************* + * + * $RCSfile: OFunctions.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:27 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ODBC_OFUNCTIONS_HXX_ +#define _CONNECTIVITY_ODBC_OFUNCTIONS_HXX_ + +#ifndef _CONNECTIVITY_OFUNCTIONDEFS_HXX_ +#include "odbc/OFunctiondefs.hxx" +#endif +#ifndef _RTL_USTRING_HXX_ +#include <rtl/ustring.hxx> +#endif +#ifndef _OSL_MODULE_H_ +#include <osl/module.h> +#endif + +namespace connectivity +{ + + sal_Bool LoadFunctions(oslModule pODBCso, sal_Bool _bDS=sal_True); + sal_Bool LoadLibrary_ODBC3(::rtl::OUString &_rPath); + sal_Bool LoadLibrary_ADABAS(::rtl::OUString &_rPath); + + // Connecting to a data source + typedef SQLRETURN (SQL_API *T3SQLAllocHandle) (SQLSMALLINT HandleType,SQLHANDLE InputHandle,SQLHANDLE * OutputHandlePtr); + extern T3SQLAllocHandle pODBC3SQLAllocHandle; + #define N3SQLAllocHandle(a,b,c) (*pODBC3SQLAllocHandle)(a,b,c) + + typedef SQLRETURN (SQL_API *T3SQLConnect) (SQLHDBC ConnectionHandle,SQLCHAR *ServerName,SQLSMALLINT NameLength1,SQLCHAR *UserName,SQLSMALLINT NameLength2,SQLCHAR *Authentication,SQLSMALLINT NameLength3); + extern T3SQLConnect pODBC3SQLConnect; + #define N3SQLConnect(a,b,c,d,e,f,g) (*pODBC3SQLConnect)(a,b,c,d,e,f,g) + + typedef SQLRETURN (SQL_API *T3SQLDriverConnect) ( SQLHDBC ConnectionHandle, + HWND WindowHandle, + SQLCHAR * InConnectionString, + SQLSMALLINT StringLength1, + SQLCHAR * OutConnectionString, + SQLSMALLINT BufferLength, + SQLSMALLINT * StringLength2Ptr, + SQLUSMALLINT DriverCompletion); + extern T3SQLDriverConnect pODBC3SQLDriverConnect; + #define N3SQLDriverConnect(a,b,c,d,e,f,g,h) (*pODBC3SQLDriverConnect)(a,b,c,d,e,f,g,h) + + typedef SQLRETURN (SQL_API *T3SQLBrowseConnect) ( SQLHDBC ConnectionHandle, + SQLCHAR * InConnectionString, + SQLSMALLINT StringLength1, + SQLCHAR * OutConnectionString, + SQLSMALLINT BufferLength, + SQLSMALLINT * StringLength2Ptr); + extern T3SQLBrowseConnect pODBC3SQLBrowseConnect; + #define N3SQLBrowseConnect(a,b,c,d,e,f) (*pODBC3SQLBrowseConnect)(a,b,c,d,e,f) + + // Obtaining information about a driver and data source + typedef SQLRETURN (SQL_API *T3SQLDataSources) ( SQLHENV EnvironmentHandle, + SQLUSMALLINT Direction, + SQLCHAR * ServerName, + SQLSMALLINT BufferLength1, + SQLSMALLINT * NameLength1Ptr, + SQLCHAR * Description, + SQLSMALLINT BufferLength2, + SQLSMALLINT * NameLength2Ptr); + extern T3SQLDataSources pODBC3SQLDataSources; + #define N3SQLDataSources(a,b,c,d,e,f,g,h) (*pODBC3SQLDataSources)(a,b,c,d,e,f,g,h) + + typedef SQLRETURN (SQL_API *T3SQLDrivers) ( SQLHENV EnvironmentHandle, + SQLUSMALLINT Direction, + SQLCHAR * DriverDescription, + SQLSMALLINT BufferLength1, + SQLSMALLINT * DescriptionLengthPtr, + SQLCHAR * DriverAttributes, + SQLSMALLINT BufferLength2, + SQLSMALLINT * AttributesLengthPtr); + extern T3SQLDrivers pODBC3SQLDrivers; + #define N3SQLDrivers(a,b,c,d,e,f,g,h) (*pODBC3SQLDrivers)(a,b,c,d,e,f,g,h) + + typedef SQLRETURN (SQL_API *T3SQLGetInfo) ( SQLHDBC ConnectionHandle, + SQLUSMALLINT InfoType, + SQLPOINTER InfoValuePtr, + SQLSMALLINT BufferLength, + SQLSMALLINT * StringLengthPtr); + extern T3SQLGetInfo pODBC3SQLGetInfo; + #define N3SQLGetInfo(a,b,c,d,e) (*pODBC3SQLGetInfo)(a,b,c,d,e) + + typedef SQLRETURN (SQL_API *T3SQLGetFunctions) (SQLHDBC ConnectionHandle, + SQLUSMALLINT FunctionId, + SQLUSMALLINT * SupportedPtr); + extern T3SQLGetFunctions pODBC3SQLGetFunctions; + #define N3SQLGetFunctions(a,b,c) (*pODBC3SQLGetFunctions)(a,b,c) + + typedef SQLRETURN (SQL_API *T3SQLGetTypeInfo) ( SQLHSTMT StatementHandle, + SQLSMALLINT DataType); + extern T3SQLGetTypeInfo pODBC3SQLGetTypeInfo; + #define N3SQLGetTypeInfo(a,b) (*pODBC3SQLGetTypeInfo)(a,b) + + // Setting and retrieving driver attributes + typedef SQLRETURN (SQL_API *T3SQLSetConnectAttr)(SQLHDBC ConnectionHandle, + SQLINTEGER Attribute, + SQLPOINTER ValuePtr, + SQLINTEGER StringLength); + extern T3SQLSetConnectAttr pODBC3SQLSetConnectAttr; + #define N3SQLSetConnectAttr(a,b,c,d) (*pODBC3SQLSetConnectAttr)(a,b,c,d) + + typedef SQLRETURN (SQL_API *T3SQLGetConnectAttr) (SQLHDBC ConnectionHandle, + SQLINTEGER Attribute, + SQLPOINTER ValuePtr, + SQLINTEGER BufferLength, + SQLINTEGER* StringLength); + extern T3SQLGetConnectAttr pODBC3SQLGetConnectAttr; + #define N3SQLGetConnectAttr(a,b,c,d,e) (*pODBC3SQLGetConnectAttr)(a,b,c,d,e) + + + typedef SQLRETURN (SQL_API *T3SQLSetEnvAttr) ( SQLHENV EnvironmentHandle, + SQLINTEGER Attribute, + SQLPOINTER ValuePtr, + SQLINTEGER StringLength); + extern T3SQLSetEnvAttr pODBC3SQLSetEnvAttr; + #define N3SQLSetEnvAttr(a,b,c,d) (*pODBC3SQLSetEnvAttr)(a,b,c,d) + + typedef SQLRETURN (SQL_API *T3SQLGetEnvAttr) ( SQLHENV EnvironmentHandle, + SQLINTEGER Attribute, + SQLPOINTER ValuePtr, + SQLINTEGER BufferLength, + SQLINTEGER* StringLength); + extern T3SQLGetEnvAttr pODBC3SQLGetEnvAttr; + #define N3SQLGetEnvAttr(a,b,c,d,e) (*pODBC3SQLGetEnvAttr)(a,b,c,d,e) + + + typedef SQLRETURN (SQL_API *T3SQLSetStmtAttr) ( SQLHSTMT StatementHandle, + SQLINTEGER Attribute, + SQLPOINTER ValuePtr, + SQLINTEGER StringLength); + extern T3SQLSetStmtAttr pODBC3SQLSetStmtAttr; + #define N3SQLSetStmtAttr(a,b,c,d) (*pODBC3SQLSetStmtAttr)(a,b,c,d) + + typedef SQLRETURN (SQL_API *T3SQLGetStmtAttr) ( SQLHSTMT StatementHandle, + SQLINTEGER Attribute, + SQLPOINTER ValuePtr, + SQLINTEGER BufferLength, + SQLINTEGER* StringLength); + extern T3SQLGetStmtAttr pODBC3SQLGetStmtAttr; + #define N3SQLGetStmtAttr(a,b,c,d,e) (*pODBC3SQLGetStmtAttr)(a,b,c,d,e) + + // Setting and retrieving descriptor fields + /*typedef SQLRETURN (SQL_API *T3SQLSetDescField) (SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, + SQLSMALLINT FieldIdentifier, + SQLPOINTER ValuePtr, + SQLINTEGER BufferLength); + extern T3SQLSetDescField pODBC3SQLSetDescField; + #define N3SQLSetDescField(a,b,c,d,e) (*pODBC3SQLSetDescField)(a,b,c,d,e) + + typedef SQLRETURN (SQL_API *T3SQLGetDescField) ( SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, + SQLSMALLINT FieldIdentifier, + SQLPOINTER ValuePtr, + SQLINTEGER BufferLength, + SQLINTEGER * StringLengthPtr); + extern T3SQLGetDescField pODBC3SQLGetDescField; + #define N3SQLGetDescField(a,b,c,d,e,f) (*pODBC3SQLGetDescField)(a,b,c,d,e,f) + + + typedef SQLRETURN (SQL_API *T3SQLGetDescRec) ( SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, + SQLCHAR * Name, + SQLSMALLINT BufferLength, + SQLSMALLINT * StringLengthPtr, + SQLSMALLINT * TypePtr, + SQLSMALLINT * SubTypePtr, + SQLINTEGER * LengthPtr, + SQLSMALLINT * PrecisionPtr, + SQLSMALLINT * ScalePtr, + SQLSMALLINT * NullablePtr); + extern T3SQLGetDescRec pODBC3SQLGetDescRec; + #define N3SQLGetDescRec(a,b,c,d,e,f,g,h,i,j,k) (*pODBC3SQLGetDescRec)(a,b,c,d,e,f,g,h,i,j,k) + + + typedef SQLRETURN (SQL_API *T3SQLSetDescRec) ( SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, + SQLSMALLINT Type, + SQLSMALLINT SubType, + SQLINTEGER Length, + SQLSMALLINT Precision, + SQLSMALLINT Scale, + SQLPOINTER DataPtr, + SQLINTEGER * StringLengthPtr, + SQLINTEGER * IndicatorPtr); + extern T3SQLSetDescRec pODBC3SQLSetDescRec; + #define N3SQLSetDescRec(a,b,c,d,e,f,g,h,i,j) (*pODBC3SQLSetDescRec)(a,b,c,d,e,f,g,h,i,j) + */ + + // Preparing SQL requests + typedef SQLRETURN (SQL_API *T3SQLPrepare) ( SQLHSTMT StatementHandle, + SQLCHAR * StatementText, + SQLINTEGER TextLength); + extern T3SQLPrepare pODBC3SQLPrepare; + #define N3SQLPrepare(a,b,c) (*pODBC3SQLPrepare)(a,b,c) + + typedef SQLRETURN (SQL_API *T3SQLBindParameter) (SQLHSTMT StatementHandle, + SQLUSMALLINT ParameterNumber, + SQLSMALLINT InputOutputType, + SQLSMALLINT ValueType, + SQLSMALLINT ParameterType, + SQLUINTEGER ColumnSize, + SQLSMALLINT DecimalDigits, + SQLPOINTER ParameterValuePtr, + SQLINTEGER BufferLength, + SQLINTEGER * StrLen_or_IndPtr); + extern T3SQLBindParameter pODBC3SQLBindParameter; + #define N3SQLBindParameter(a,b,c,d,e,f,g,h,i,j) (*pODBC3SQLBindParameter)(a,b,c,d,e,f,g,h,i,j) + + /*typedef SQLRETURN (SQL_API *T3SQLGetCursorName) (SQLHSTMT StatementHandle, + SQLCHAR * CursorName, + SQLSMALLINT BufferLength, + SQLSMALLINT * NameLengthPtr); + extern T3SQLGetCursorName pODBC3SQLGetCursorName; + #define N3SQLGetCursorName(a,b,c,d) (*pODBC3SQLGetCursorName)(a,b,c,d) + */ + + typedef SQLRETURN (SQL_API *T3SQLSetCursorName) (SQLHSTMT StatementHandle, + SQLCHAR * CursorName, + SQLSMALLINT NameLength); + extern T3SQLSetCursorName pODBC3SQLSetCursorName; + #define N3SQLSetCursorName(a,b,c) (*pODBC3SQLSetCursorName)(a,b,c) + + // Submitting requests + typedef SQLRETURN (SQL_API *T3SQLExecute) ( SQLHSTMT StatementHandle); + extern T3SQLExecute pODBC3SQLExecute; + #define N3SQLExecute(a) (*pODBC3SQLExecute)(a) + + typedef SQLRETURN (SQL_API *T3SQLExecDirect) ( SQLHSTMT StatementHandle, + SQLCHAR * StatementText, + SQLINTEGER TextLength); + extern T3SQLExecDirect pODBC3SQLExecDirect; + #define N3SQLExecDirect(a,b,c) (*pODBC3SQLExecDirect)(a,b,c) + + /*typedef SQLRETURN (SQL_API *T3SQLNativeSql) ( SQLHDBC ConnectionHandle, + SQLCHAR * InStatementText, + SQLINTEGER TextLength1, + SQLCHAR * utStatementText, + SQLINTEGER BufferLength, + SQLINTEGER * TextLength2Ptr); + extern T3SQLNativeSql pODBC3SQLNativeSql; + #define N3SQLNativeSql(a,b,c,d,e,f) (*pODBC3SQLNativeSql)(a,b,c,d,e,f)*/ + + typedef SQLRETURN (SQL_API *T3SQLDescribeParam) (SQLHSTMT StatementHandle, + SQLUSMALLINT ParameterNumber, + SQLSMALLINT * DataTypePtr, + SQLUINTEGER * ParameterSizePtr, + SQLSMALLINT * DecimalDigitsPtr, + SQLSMALLINT * NullablePtr); + extern T3SQLDescribeParam pODBC3SQLDescribeParam; + #define N3SQLDescribeParam(a,b,c,d,e,f) (*pODBC3SQLDescribeParam)(a,b,c,d,e,f) + + typedef SQLRETURN (SQL_API *T3SQLNumParams) ( SQLHSTMT StatementHandle, + SQLSMALLINT * ParameterCountPtr); + extern T3SQLNumParams pODBC3SQLNumParams; + #define N3SQLNumParams(a,b) (*pODBC3SQLNumParams)(a,b) + + typedef SQLRETURN (SQL_API *T3SQLParamData) ( SQLHSTMT StatementHandle, + SQLPOINTER * ValuePtrPtr); + extern T3SQLParamData pODBC3SQLParamData; + #define N3SQLParamData(a,b) (*pODBC3SQLParamData)(a,b) + + typedef SQLRETURN (SQL_API *T3SQLPutData) ( SQLHSTMT StatementHandle, + SQLPOINTER DataPtr, + SQLINTEGER StrLen_or_Ind); + extern T3SQLPutData pODBC3SQLPutData; + #define N3SQLPutData(a,b,c) (*pODBC3SQLPutData)(a,b,c) + + // Retrieving results and information about results + typedef SQLRETURN (SQL_API *T3SQLRowCount) ( SQLHSTMT StatementHandle, + SQLINTEGER * RowCountPtr); + extern T3SQLRowCount pODBC3SQLRowCount; + #define N3SQLRowCount(a,b) (*pODBC3SQLRowCount)(a,b) + + typedef SQLRETURN (SQL_API *T3SQLNumResultCols) (SQLHSTMT StatementHandle, + SQLSMALLINT * ColumnCountPtr); + extern T3SQLNumResultCols pODBC3SQLNumResultCols; + #define N3SQLNumResultCols(a,b) (*pODBC3SQLNumResultCols)(a,b) + + typedef SQLRETURN (SQL_API *T3SQLDescribeCol) ( SQLHSTMT StatementHandle, + SQLSMALLINT ColumnNumber, + SQLCHAR * ColumnName, + SQLSMALLINT BufferLength, + SQLSMALLINT * NameLengthPtr, + SQLSMALLINT * DataTypePtr, + SQLUINTEGER * ColumnSizePtr, + SQLSMALLINT * DecimalDigitsPtr, + SQLSMALLINT * NullablePtr); + extern T3SQLDescribeCol pODBC3SQLDescribeCol; + #define N3SQLDescribeCol(a,b,c,d,e,f,g,h,i) (*pODBC3SQLDescribeCol)(a,b,c,d,e,f,g,h,i) + + typedef SQLRETURN (SQL_API *T3SQLColAttribute) (SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, + SQLUSMALLINT FieldIdentifier, + SQLPOINTER CharacterAttributePtr, + SQLSMALLINT BufferLength, + SQLSMALLINT * StringLengthPtr, + SQLPOINTER NumericAttributePtr); + extern T3SQLColAttribute pODBC3SQLColAttribute; + #define N3SQLColAttribute(a,b,c,d,e,f,g) (*pODBC3SQLColAttribute)(a,b,c,d,e,f,g) + + typedef SQLRETURN (SQL_API *T3SQLBindCol) ( SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, + SQLSMALLINT TargetType, + SQLPOINTER TargetValuePtr, + SQLINTEGER BufferLength, + SQLINTEGER * StrLen_or_IndPtr); + extern T3SQLBindCol pODBC3SQLBindCol; + #define N3SQLBindCol(a,b,c,d,e,f) (*pODBC3SQLBindCol)(a,b,c,d,e,f) + + typedef SQLRETURN (SQL_API *T3SQLFetch) ( SQLHSTMT StatementHandle); + extern T3SQLFetch pODBC3SQLFetch; + #define N3SQLFetch(a) (*pODBC3SQLFetch)(a) + + typedef SQLRETURN (SQL_API *T3SQLFetchScroll) ( SQLHSTMT StatementHandle, + SQLSMALLINT FetchOrientation, + SQLINTEGER FetchOffset); + extern T3SQLFetchScroll pODBC3SQLFetchScroll; + #define N3SQLFetchScroll(a,b,c) (*pODBC3SQLFetchScroll)(a,b,c) + + typedef SQLRETURN (SQL_API *T3SQLGetData) ( SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, + SQLSMALLINT TargetType, + SQLPOINTER TargetValuePtr, + SQLINTEGER BufferLength, + SQLINTEGER * StrLen_or_IndPtr); + extern T3SQLGetData pODBC3SQLGetData; + #define N3SQLGetData(a,b,c,d,e,f) (*pODBC3SQLGetData)(a,b,c,d,e,f) + + typedef SQLRETURN (SQL_API *T3SQLSetPos) ( SQLHSTMT StatementHandle, + SQLUSMALLINT RowNumber, + SQLUSMALLINT Operation, + SQLUSMALLINT LockType); + extern T3SQLSetPos pODBC3SQLSetPos; + #define N3SQLSetPos(a,b,c,d) (*pODBC3SQLSetPos)(a,b,c,d) + + typedef SQLRETURN (SQL_API *T3SQLBulkOperations) ( SQLHSTMT StatementHandle, + SQLUSMALLINT Operation); + extern T3SQLBulkOperations pODBC3SQLBulkOperations; + #define N3SQLBulkOperations(a,b) (*pODBC3SQLBulkOperations)(a,b) + + typedef SQLRETURN (SQL_API *T3SQLMoreResults) ( SQLHSTMT StatementHandle); + extern T3SQLMoreResults pODBC3SQLMoreResults; + #define N3SQLMoreResults(a) (*pODBC3SQLMoreResults)(a) + + /*typedef SQLRETURN (SQL_API *T3SQLGetDiagField) (SQLSMALLINT HandleType, + SQLHANDLE Handle, + SQLSMALLINT RecNumber, + SQLSMALLINT DiagIdentifier, + SQLPOINTER DiagInfoPtr, + SQLSMALLINT BufferLength, + SQLSMALLINT * StringLengthPtr); + extern T3SQLGetDiagField pODBC3SQLGetDiagField; + #define N3SQLGetDiagField(a,b,c,d,e,f,g) (*pODBC3SQLGetDiagField)(a,b,c,d,e,f,g)*/ + + typedef SQLRETURN (SQL_API *T3SQLGetDiagRec) ( SQLSMALLINT HandleType, + SQLHANDLE Handle, + SQLSMALLINT RecNumber, + SQLCHAR * Sqlstate, + SQLINTEGER * NativeErrorPtr, + SQLCHAR * MessageText, + SQLSMALLINT BufferLength, + SQLSMALLINT * TextLengthPtr); + + extern T3SQLGetDiagRec pODBC3SQLGetDiagRec; + #define N3SQLGetDiagRec(a,b,c,d,e,f,g,h) (*pODBC3SQLGetDiagRec)(a,b,c,d,e,f,g,h) + + // Obtaining information about the data source’s system tables (catalog functions) + typedef SQLRETURN (SQL_API *T3SQLColumnPrivileges) (SQLHSTMT StatementHandle, + SQLCHAR * CatalogName, + SQLSMALLINT NameLength1, + SQLCHAR * SchemaName, + SQLSMALLINT NameLength2, + SQLCHAR * TableName, + SQLSMALLINT NameLength3, + SQLCHAR * ColumnName, + SQLSMALLINT NameLength4); + extern T3SQLColumnPrivileges pODBC3SQLColumnPrivileges; + #define N3SQLColumnPrivileges(a,b,c,d,e,f,g,h,i) (*pODBC3SQLColumnPrivileges)(a,b,c,d,e,f,g,h,i) + + typedef SQLRETURN (SQL_API *T3SQLColumns) ( SQLHSTMT StatementHandle, + SQLCHAR * CatalogName, + SQLSMALLINT NameLength1, + SQLCHAR * SchemaName, + SQLSMALLINT NameLength2, + SQLCHAR * TableName, + SQLSMALLINT NameLength3, + SQLCHAR * ColumnName, + SQLSMALLINT NameLength4); + extern T3SQLColumns pODBC3SQLColumns; + #define N3SQLColumns(a,b,c,d,e,f,g,h,i) (*pODBC3SQLColumns)(a,b,c,d,e,f,g,h,i) + + typedef SQLRETURN (SQL_API *T3SQLForeignKeys) ( SQLHSTMT StatementHandle, + SQLCHAR * PKCatalogName, + SQLSMALLINT NameLength1, + SQLCHAR * PKSchemaName, + SQLSMALLINT NameLength2, + SQLCHAR * PKTableName, + SQLSMALLINT NameLength3, + SQLCHAR * FKCatalogName, + SQLSMALLINT NameLength4, + SQLCHAR * FKSchemaName, + SQLSMALLINT NameLength5, + SQLCHAR * FKTableName, + SQLSMALLINT NameLength6); + extern T3SQLForeignKeys pODBC3SQLForeignKeys; + #define N3SQLForeignKeys(a,b,c,d,e,f,g,h,i,j,k,l,m) (*pODBC3SQLForeignKeys)(a,b,c,d,e,f,g,h,i,j,k,l,m) + + typedef SQLRETURN (SQL_API *T3SQLPrimaryKeys) ( SQLHSTMT StatementHandle, + SQLCHAR * CatalogName, + SQLSMALLINT NameLength1, + SQLCHAR * SchemaName, + SQLSMALLINT NameLength2, + SQLCHAR * TableName, + SQLSMALLINT NameLength3); + extern T3SQLPrimaryKeys pODBC3SQLPrimaryKeys; + #define N3SQLPrimaryKeys(a,b,c,d,e,f,g) (*pODBC3SQLPrimaryKeys)(a,b,c,d,e,f,g) + + typedef SQLRETURN (SQL_API *T3SQLProcedureColumns) (SQLHSTMT StatementHandle, + SQLCHAR * CatalogName, + SQLSMALLINT NameLength1, + SQLCHAR * SchemaName, + SQLSMALLINT NameLength2, + SQLCHAR * ProcName, + SQLSMALLINT NameLength3, + SQLCHAR * ColumnName, + SQLSMALLINT NameLength4); + extern T3SQLProcedureColumns pODBC3SQLProcedureColumns; + #define N3SQLProcedureColumns(a,b,c,d,e,f,g,h,i) (*pODBC3SQLProcedureColumns)(a,b,c,d,e,f,g,h,i) + + typedef SQLRETURN (SQL_API *T3SQLProcedures) ( SQLHSTMT StatementHandle, + SQLCHAR * CatalogName, + SQLSMALLINT NameLength1, + SQLCHAR * SchemaName, + SQLSMALLINT NameLength2, + SQLCHAR * ProcName, + SQLSMALLINT NameLength3); + extern T3SQLProcedures pODBC3SQLProcedures; + #define N3SQLProcedures(a,b,c,d,e,f,g) (*pODBC3SQLProcedures)(a,b,c,d,e,f,g) + + typedef SQLRETURN (SQL_API *T3SQLSpecialColumns) (SQLHSTMT StatementHandle, + SQLSMALLINT IdentifierType, + SQLCHAR * CatalogName, + SQLSMALLINT NameLength1, + SQLCHAR * SchemaName, + SQLSMALLINT NameLength2, + SQLCHAR * TableName, + SQLSMALLINT NameLength3, + SQLSMALLINT Scope, + SQLSMALLINT Nullable); + extern T3SQLSpecialColumns pODBC3SQLSpecialColumns; + #define N3SQLSpecialColumns(a,b,c,d,e,f,g,h,i,j) (*pODBC3SQLSpecialColumns)(a,b,c,d,e,f,g,h,i,j) + + typedef SQLRETURN (SQL_API *T3SQLStatistics) ( SQLHSTMT StatementHandle, + SQLCHAR * CatalogName, + SQLSMALLINT NameLength1, + SQLCHAR * SchemaName, + SQLSMALLINT NameLength2, + SQLCHAR * TableName, + SQLSMALLINT NameLength3, + SQLUSMALLINT Unique, + SQLUSMALLINT Reserved); + extern T3SQLStatistics pODBC3SQLStatistics; + #define N3SQLStatistics(a,b,c,d,e,f,g,h,i) (*pODBC3SQLStatistics)(a,b,c,d,e,f,g,h,i) + + typedef SQLRETURN (SQL_API *T3SQLTablePrivileges) (SQLHSTMT StatementHandle, + SQLCHAR * CatalogName, + SQLSMALLINT NameLength1, + SQLCHAR * SchemaName, + SQLSMALLINT NameLength2, + SQLCHAR * TableName, + SQLSMALLINT NameLength3); + extern T3SQLTablePrivileges pODBC3SQLTablePrivileges; + #define N3SQLTablePrivileges(a,b,c,d,e,f,g) (*pODBC3SQLTablePrivileges)(a,b,c,d,e,f,g) + + typedef SQLRETURN (SQL_API *T3SQLTables) ( SQLHSTMT StatementHandle, + SQLCHAR * CatalogName, + SQLSMALLINT NameLength1, + SQLCHAR * SchemaName, + SQLSMALLINT NameLength2, + SQLCHAR * TableName, + SQLSMALLINT NameLength3, + SQLCHAR * TableType, + SQLSMALLINT NameLength4); + extern T3SQLTables pODBC3SQLTables; + #define N3SQLTables(a,b,c,d,e,f,g,h,i) (*pODBC3SQLTables)(a,b,c,d,e,f,g,h,i) + + // Terminating a statement + typedef SQLRETURN (SQL_API *T3SQLFreeStmt) ( SQLHSTMT StatementHandle, + SQLUSMALLINT Option); + extern T3SQLFreeStmt pODBC3SQLFreeStmt; + #define N3SQLFreeStmt(a,b) (*pODBC3SQLFreeStmt)(a,b) + + typedef SQLRETURN (SQL_API *T3SQLCloseCursor) (SQLHSTMT StatementHandle); + extern T3SQLCloseCursor pODBC3SQLCloseCursor; + #define N3SQLCloseCursor(a) (*pODBC3SQLCloseCursor)(a) + + typedef SQLRETURN (SQL_API *T3SQLCancel) ( SQLHSTMT StatementHandle); + extern T3SQLCancel pODBC3SQLCancel; + #define N3SQLCancel(a) (*pODBC3SQLCancel)(a) + + typedef SQLRETURN (SQL_API *T3SQLEndTran) ( SQLSMALLINT HandleType, + SQLHANDLE Handle, + SQLSMALLINT CompletionType); + extern T3SQLEndTran pODBC3SQLEndTran; + #define N3SQLEndTran(a,b,c) (*pODBC3SQLEndTran)(a,b,c) + + // Terminating a connection + typedef SQLRETURN (SQL_API *T3SQLDisconnect) (SQLHDBC ConnectionHandle); + extern T3SQLDisconnect pODBC3SQLDisconnect; + #define N3SQLDisconnect(a) (*pODBC3SQLDisconnect)(a) + + typedef SQLRETURN (SQL_API *T3SQLFreeHandle) (SQLSMALLINT HandleType, + SQLHANDLE Handle); + extern T3SQLFreeHandle pODBC3SQLFreeHandle; + #define N3SQLFreeHandle(a,b) (*pODBC3SQLFreeHandle)(a,b) + + typedef SQLRETURN (SQL_API *T3SQLGetCursorName) ( SQLHSTMT StatementHandle, + SQLCHAR * CursorName, + SQLSMALLINT BufferLength, + SQLSMALLINT* NameLength2); + extern T3SQLGetCursorName pODBC3SQLGetCursorName; + #define N3SQLGetCursorName(a,b,c,d) (*pODBC3SQLGetCursorName)(a,b,c,d) + + typedef SQLRETURN (SQL_API *T3SQLNativeSql) ( SQLHSTMT ConnectionHandle, + SQLCHAR * InStatementText, + SQLINTEGER TextLength1, + SQLCHAR * OutStatementText, + SQLINTEGER BufferLength, + SQLINTEGER * TextLength2Ptr); + extern T3SQLNativeSql pODBC3SQLNativeSql; + #define N3SQLNativeSql(a,b,c,d,e,f) (*pODBC3SQLNativeSql)(a,b,c,d,e,f) +} + +#endif // _CONNECTIVITY_ODBC_OFUNCTIONS_HXX_ + + diff --git a/connectivity/source/inc/odbc/OPreparedStatement.hxx b/connectivity/source/inc/odbc/OPreparedStatement.hxx new file mode 100644 index 000000000000..f8bb8a24056a --- /dev/null +++ b/connectivity/source/inc/odbc/OPreparedStatement.hxx @@ -0,0 +1,188 @@ +/************************************************************************* + * + * $RCSfile: OPreparedStatement.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:27 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ODBC_OPREPAREDSTATEMENT_HXX_ +#define _CONNECTIVITY_ODBC_OPREPAREDSTATEMENT_HXX_ + + +#ifndef _CONNECTIVITY_ODBC_OSTATEMENT_HXX_ +#include "odbc/OStatement.hxx" +#endif + +#ifndef _COM_SUN_STAR_SDBC_XPREPAREDSTATEMENT_HPP_ +#include <com/sun/star/sdbc/XPreparedStatement.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XPARAMETERS_HPP_ +#include <com/sun/star/sdbc/XParameters.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_ +#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +#endif +// #include <com/sun/star/sdbc/XClearParameters.hpp> +#ifndef _COM_SUN_STAR_SDBC_XPREPAREDBATCHEXECUTION_HPP_ +#include <com/sun/star/sdbc/XPreparedBatchExecution.hpp> +#endif +#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_ +#include <com/sun/star/io/XInputStream.hpp> +#endif + +namespace connectivity +{ + namespace odbc + { + + class OBoundParam; + + class OPreparedStatement : public OStatement_BASE2, + public ::com::sun::star::sdbc::XPreparedStatement, + public ::com::sun::star::sdbc::XParameters, + public ::com::sun::star::sdbc::XPreparedBatchExecution, + public ::com::sun::star::sdbc::XResultSetMetaDataSupplier, + public ::com::sun::star::lang::XServiceInfo + + { + protected: + //==================================================================== + // Data attributes + //==================================================================== + ::std::vector<OTypeInfo> m_aTypeInfo; // Hashtable containing an entry + // for each row returned by + // DatabaseMetaData.getTypeInfo. + + int numParams; // Number of parameter markers + // for the prepared statement + + OBoundParam* boundParams; + // Array of bound parameter + // objects. Each parameter + // marker will have a + // corresponding object to + // hold bind information, and + // resulting data. + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xMetaData; + + void FreeParams(); + void putParamData (sal_Int32 index) throw(::com::sun::star::sdbc::SQLException); + void setChar(sal_Int32 parameterIndex,sal_Int32 SQLtype,sal_Int32 scale,const ::rtl::OUString& x) throw(::com::sun::star::sdbc::SQLException); + void setBinary(sal_Int32 parameterIndex,sal_Int32 SQLtype,const ::com::sun::star::uno::Sequence< sal_Int8 >& x) throw(::com::sun::star::sdbc::SQLException); + void setStream (sal_Int32 ParameterIndex,const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& x, + sal_Int32 length,sal_Int32 SQLtype,sal_Int32 streamType) throw(::com::sun::star::sdbc::SQLException); + sal_Int32 getParamLength ( sal_Int32 index); + sal_Int8* getLengthBuf (sal_Int32 index); + sal_Int8* getDataBuf (sal_Int32 index); + sal_Int8* allocBindBuf ( sal_Int32 index, sal_Int32 bufLen); + void initBoundParam () throw(::com::sun::star::sdbc::SQLException); + + sal_Int32 getPrecision ( sal_Int32 sqlType); + + public: + DECLARE_CTY_DEFAULTS(OStatement_BASE2); + DECLARE_SERVICE_INFO(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OPreparedStatement( OConnection* _pConnection,const ::std::vector<OTypeInfo>& _TypeInfo,const ::rtl::OUString& sql); + + //XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // XPreparedStatement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL executeUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XParameters + virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XPreparedBatchExecution + virtual void SAL_CALL addBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XResultSetMetaDataSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_ODBC_OPREPAREDSTATEMENT_HXX_ + diff --git a/connectivity/source/inc/odbc/OResultSet.hxx b/connectivity/source/inc/odbc/OResultSet.hxx new file mode 100644 index 000000000000..c38e5002960b --- /dev/null +++ b/connectivity/source/inc/odbc/OResultSet.hxx @@ -0,0 +1,363 @@ +/************************************************************************* + * + * $RCSfile: OResultSet.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:27 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ODBC_ORESULTSET_HXX_ +#define _CONNECTIVITY_ODBC_ORESULTSET_HXX_ + +#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_ +#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XCLOSEABLE_HPP_ +#include <com/sun/star/sdbc/XCloseable.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XCOLUMNLOCATE_HPP_ +#include <com/sun/star/sdbc/XColumnLocate.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_XCANCELLABLE_HPP_ +#include <com/sun/star/util/XCancellable.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP_ +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XRESULTSETUPDATE_HPP_ +#include <com/sun/star/sdbc/XResultSetUpdate.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XROWUPDATE_HPP_ +#include <com/sun/star/sdbc/XRowUpdate.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XROWLOCATE_HPP_ +#include <com/sun/star/sdbcx/XRowLocate.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XDELETEROWS_HPP_ +#include <com/sun/star/sdbcx/XDeleteRows.hpp> +#endif +#ifndef _CPPUHELPER_COMPBASE12_HXX_ +#include <cppuhelper/compbase12.hxx> +#endif +#ifndef _UNOTOOLS_PROPERTY_ARRAY_HELPER_HXX_ +#include <unotools/proparrhlp.hxx> +#endif +#ifndef _CONNECTIVITY_ODBC_OFUNCTIONS_HXX_ +#include "odbc/OFunctions.hxx" +#endif +#ifndef _CONNECTIVITY_ODBC_OSTATEMENT_HXX_ +#include "odbc/OStatement.hxx" +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif + +namespace connectivity +{ + namespace odbc + { + + /* + ** java_sql_ResultSet + */ + typedef ::cppu::WeakComponentImplHelper12< ::com::sun::star::sdbc::XResultSet, + ::com::sun::star::sdbc::XRow, + ::com::sun::star::sdbc::XResultSetMetaDataSupplier, + ::com::sun::star::util::XCancellable, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::sdbc::XResultSetUpdate, + ::com::sun::star::sdbc::XRowUpdate, + ::com::sun::star::sdbcx::XRowLocate, + ::com::sun::star::sdbcx::XDeleteRows, + ::com::sun::star::sdbc::XCloseable, + ::com::sun::star::sdbc::XColumnLocate, + ::com::sun::star::lang::XServiceInfo> OResultSet_BASE; + + + + class OResultSet : public OBaseMutex, + public OResultSet_BASE, + public ::cppu::OPropertySetHelper, + public ::utl::OPropertyArrayUsageHelper<OResultSet> + { + + ::std::vector<void*> m_aBindVector; + ::std::vector<sal_Int32> m_aLengthVector; + ::std::vector<sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 everytime + ::std::vector< ::com::sun::star::uno::Any> m_aRow; // only used when SQLGetData can't be called in any order + SQLHANDLE m_aStatementHandle; + SQLHANDLE m_aConnectionHandle; + ::com::sun::star::uno::WeakReferenceHelper m_aStatement; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData; + SQLUSMALLINT* m_pRowStatusArray; + sal_Int32 m_nRowPos; + sal_Int32 m_nLastColumnPos; // used for m_aRow just to know where we are + SQLRETURN m_nCurrentFetchState; + sal_Bool m_bWasNull; + sal_Bool m_bBOF; // before first record + sal_Bool m_bEOF; // after last record + sal_Bool m_bLastRecord; + sal_Bool m_bFreeHandle; + sal_Bool m_bInserting; + sal_Bool m_bFetchData; // true when SQLGetaData can be called in any order or when fetching data for m_aRow + + sal_Bool isBookmarkable() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getResultSetType() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getFetchDirection() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getFetchSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + ::rtl::OUString getCursorName() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + void setFetchDirection(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setFetchSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + + void fillRow(sal_Int32 _nToColumn); + void allocBuffer(sal_Bool _bAllocRow); + void releaseBuffer(); + + protected: + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + + virtual sal_Bool SAL_CALL convertFastPropertyValue( + ::com::sun::star::uno::Any & rConvertedValue, + ::com::sun::star::uno::Any & rOldValue, + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue ) + throw (::com::sun::star::lang::IllegalArgumentException); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue + ) + throw (::com::sun::star::uno::Exception); + virtual void SAL_CALL getFastPropertyValue( + ::com::sun::star::uno::Any& rValue, + sal_Int32 nHandle + ) const; + public: + DECLARE_CTY_DEFAULTS(OResultSet_BASE); + DECLARE_SERVICE_INFO(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OResultSet( SQLHANDLE _pStatementHandle,OStatement_Base* pStmt); + OResultSet( SQLHANDLE _pStatementHandle); + ~OResultSet(); + + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > operator *() + { + return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(*(OResultSet_BASE*)this); + } + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) + { + return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); + } + // XResultSet + virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRow + virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XResultSetMetaDataSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCancellable + virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XResultSetUpdate + virtual void SAL_CALL insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRowUpdate + virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRowLocate + virtual ::com::sun::star::uno::Any SAL_CALL getBookmark( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL compareBookmarks( const ::com::sun::star::uno::Any& first, const ::com::sun::star::uno::Any& second ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XDeleteRows + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + // special methods + inline sal_Int32 mapColumn(sal_Int32 column); + void openTablesTypes( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openTypeInfo() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openCatalogs() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openSchemas() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openTables(const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& tableNamePattern, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types ) + throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openColumnPrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, + const ::rtl::OUString& table, const ::rtl::OUString& columnNamePattern )throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern )throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openProcedureColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& procedureNamePattern,const ::rtl::OUString& columnNamePattern )throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openProcedures( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& procedureNamePattern)throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openVersionColumns(const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, + const ::rtl::OUString& table)throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openBestRowIdentifier( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, + const ::rtl::OUString& table,sal_Int32 scope,sal_Bool nullable )throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openForeignKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString* schema,const ::rtl::OUString* table, + const ::com::sun::star::uno::Any& catalog2, const ::rtl::OUString* schema2,const ::rtl::OUString* table2)throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openExportedKeys(const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema,const ::rtl::OUString& table)throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openImportedKeys(const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema,const ::rtl::OUString& table)throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openPrimaryKeys(const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema,const ::rtl::OUString& table)throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openTablePrivileges(const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& tableNamePattern)throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openSpecialColumns(sal_Bool _bRowVer,const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, + const ::rtl::OUString& table,sal_Int32 scope, sal_Bool nullable )throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openIndexInfo( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, + const ::rtl::OUString& table,sal_Bool unique,sal_Bool approximate )throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + }; + // ------------------------------------------------------------------------- + inline sal_Int32 OResultSet::mapColumn (sal_Int32 column) + { + sal_Int32 map = column; + + if (m_aColMapping.size()) + { + // Validate column number + OSL_ENSHURE(column>0,"OResultSet::mapColumn column <= 0"); + map = m_aColMapping[column]; + } + + return map; + } + } +} +#endif // _CONNECTIVITY_ODBC_ORESULTSET_HXX_ + + diff --git a/connectivity/source/inc/odbc/OResultSetMetaData.hxx b/connectivity/source/inc/odbc/OResultSetMetaData.hxx new file mode 100644 index 000000000000..b4f147c73adc --- /dev/null +++ b/connectivity/source/inc/odbc/OResultSetMetaData.hxx @@ -0,0 +1,132 @@ +/************************************************************************* + * + * $RCSfile: OResultSetMetaData.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:27 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ODBC_ORESULTSETMETADATA_HXX_ +#define _CONNECTIVITY_ODBC_ORESULTSETMETADATA_HXX_ + +#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATA_HPP_ +#include <com/sun/star/sdbc/XResultSetMetaData.hpp> +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif +#ifndef _CONNECTIVITY_ODBC_OFUNCTIONS_HXX_ +#include "odbc/OFunctions.hxx" +#endif +#ifndef _VECTOR_ +#include <vector> +#endif + +namespace connectivity +{ + namespace odbc + { + //************************************************************** + //************ Class: ResultSetMetaData + //************************************************************** + typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData> OResultSetMetaData_BASE; + + class OResultSetMetaData : public OResultSetMetaData_BASE + { + ::std::vector<sal_Int32> m_vMapping; // when not every column is needed + + SQLHANDLE m_aStatementHandle; + sal_Int32 m_nColCount; + + ::rtl::OUString getCharColAttrib(sal_Int32 column,sal_Int32 ident) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getNumColAttrib(sal_Int32 column,sal_Int32 ident) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + public: + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OResultSetMetaData( SQLHANDLE _pStmt ) : m_aStatementHandle( _pStmt ),m_nColCount(-1){} + OResultSetMetaData( SQLHANDLE _pStmt ,const ::std::vector<sal_Int32> & _vMapping) + : m_aStatementHandle( _pStmt ),m_vMapping(_vMapping),m_nColCount(_vMapping.size()-1){} + ~OResultSetMetaData(); + + /// Avoid ambigous cast error from the compiler. + inline operator ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > () throw() + { return this; } + + virtual sal_Int32 SAL_CALL getColumnCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnLabel( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSchemaName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTableName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnTypeName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnServiceName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_ODBC_ORESULTSETMETADATA_HXX_ + diff --git a/connectivity/source/inc/odbc/OStatement.hxx b/connectivity/source/inc/odbc/OStatement.hxx new file mode 100644 index 000000000000..86839c2daf5c --- /dev/null +++ b/connectivity/source/inc/odbc/OStatement.hxx @@ -0,0 +1,272 @@ +/************************************************************************* + * + * $RCSfile: OStatement.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:27 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ODBC_OSTATEMENT_HXX_ +#define _CONNECTIVITY_ODBC_OSTATEMENT_HXX_ + +#ifndef _COM_SUN_STAR_SDBC_XSTATEMENT_HPP_ +#include <com/sun/star/sdbc/XStatement.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP_ +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XMULTIPLERESULTS_HPP_ +#include <com/sun/star/sdbc/XMultipleResults.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XBATCHEXECUTION_HPP_ +#include <com/sun/star/sdbc/XBatchExecution.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XCLOSEABLE_HPP_ +#include <com/sun/star/sdbc/XCloseable.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_SQLWARNING_HPP_ +#include <com/sun/star/sdbc/SQLWarning.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_XCANCELLABLE_HPP_ +#include <com/sun/star/util/XCancellable.hpp> +#endif +#ifndef _UNOTOOLS_PROPERTY_ARRAY_HELPER_HXX_ +#include <unotools/proparrhlp.hxx> +#endif +#ifndef _CPPUHELPER_COMPBASE5_HXX_ +#include <cppuhelper/compbase5.hxx> +#endif +#ifndef _UTL_UNO3_HXX_ +#include <unotools/uno3.hxx> +#endif +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/CommonTools.hxx" +#endif +#ifndef _CONNECTIVITY_ODBC_OFUNCTIONS_HXX_ +#include "odbc/OFunctions.hxx" +#endif +#ifndef _CONNECTIVITY_ODBC_OCONNECTION_HXX_ +#include "odbc/OConnection.hxx" +#endif +#ifndef _LIST_ +#include <list> +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif + +namespace connectivity +{ + namespace odbc + { + + typedef ::cppu::WeakComponentImplHelper5< ::com::sun::star::sdbc::XStatement, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::util::XCancellable, + ::com::sun::star::sdbc::XCloseable, + ::com::sun::star::sdbc::XMultipleResults> OStatement_BASE; + + //************************************************************** + //************ Class: java.sql.Statement + //************************************************************** + class OStatement_Base : public OBaseMutex, + public OStatement_BASE, + public ::cppu::OPropertySetHelper, + public ::utl::OPropertyArrayUsageHelper<OStatement_Base> + + { + ::com::sun::star::sdbc::SQLWarning m_aLastWarning; + ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet> m_xResultSet; // The last ResultSet created + // for this Statement + protected: + ::std::list< ::rtl::OUString> m_aBatchList; + + OConnection* m_pConnection;// The owning Connection object + SQLHANDLE m_aStatementHandle; + SQLUSMALLINT* m_pRowStatusArray; + + //using OStatement_BASE::rBHelper; + private: + + sal_Int32 getQueryTimeOut() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getMaxFieldSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getMaxRows() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getResultSetType() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getFetchDirection() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getFetchSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + ::rtl::OUString getCursorName() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Bool isUsingBookmarks() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + void setQueryTimeOut(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setMaxFieldSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setMaxRows(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setResultSetType(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setFetchDirection(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setFetchSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setResultSetConcurrency(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setCursorName(const ::rtl::OUString &_par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setUsingBookmarks(sal_Bool _bUseBookmark) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + protected: + + void reset () throw( ::com::sun::star::sdbc::SQLException); + void clearMyResultSet () throw( ::com::sun::star::sdbc::SQLException); + void setWarning (const ::com::sun::star::sdbc::SQLWarning &ex) throw( ::com::sun::star::sdbc::SQLException); + sal_Bool lockIfNecessary (const ::rtl::OUString& sql) throw( ::com::sun::star::sdbc::SQLException); + sal_Int32 getColumnCount () throw( ::com::sun::star::sdbc::SQLException); + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > getResultSet (sal_Bool checkCount) throw( ::com::sun::star::sdbc::SQLException); + sal_Int32 getRowCount () throw( ::com::sun::star::sdbc::SQLException); + sal_Int32 getStmtOption (short fOption) const throw( ::com::sun::star::sdbc::SQLException); + + void disposeResultSet(); + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + virtual sal_Bool SAL_CALL convertFastPropertyValue( + ::com::sun::star::uno::Any & rConvertedValue, + ::com::sun::star::uno::Any & rOldValue, + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue ) + throw (::com::sun::star::lang::IllegalArgumentException); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue + ) + throw (::com::sun::star::uno::Exception); + virtual void SAL_CALL getFastPropertyValue( + ::com::sun::star::uno::Any& rValue, + sal_Int32 nHandle + ) const; + public: + ::cppu::OBroadcastHelper& rBHelper; + DECLARE_CTY_ACQUIRE(OStatement_BASE); + OStatement_Base(OConnection* _pConnection ); + // #if SUPD > 569 + using OStatement_BASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >; + //#else + // using OStatement_BASE::operator ::com::sun::star::uno::XInterface*; + //#endif + // OComponentHelper + virtual void SAL_CALL disposing(void){OStatement_BASE::disposing();} + // XInterface + virtual void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException){} + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) + { + return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); + } + // XStatement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Int32 SAL_CALL executeUpdate( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Bool SAL_CALL execute( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCancellable + virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XMultipleResults + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSet( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + // other methods + SQLHANDLE getConnectionHandle() { return m_pConnection->getConnection(); } + }; + + class OStatement_BASE2 : public OStatement_Base, + public OSubComponent< OStatement_BASE2> + + { + friend class OSubComponent< OStatement_BASE2>; + public: + OStatement_BASE2(OConnection* _pConnection ) : OStatement_Base(_pConnection ), + OSubComponent< OStatement_BASE2>((::cppu::OWeakObject*)_pConnection){} + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException); + }; + + class OStatement : public OStatement_BASE2, + public ::com::sun::star::sdbc::XBatchExecution, + public ::com::sun::star::lang::XServiceInfo + { + public: + DECLARE_CTY_DEFAULTS(OStatement_BASE2); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OStatement( OConnection* _pConnection) : OStatement_BASE2( _pConnection){} + DECLARE_SERVICE_INFO(); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + // XBatchExecution + virtual void SAL_CALL addBatch( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_ODBC_OSTATEMENT_HXX_ + diff --git a/connectivity/source/inc/odbc/OTools.hxx b/connectivity/source/inc/odbc/OTools.hxx new file mode 100644 index 000000000000..f88be11e3d9f --- /dev/null +++ b/connectivity/source/inc/odbc/OTools.hxx @@ -0,0 +1,559 @@ +/************************************************************************* + * + * $RCSfile: OTools.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:27 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_OTOOLS_HXX_ +#define _CONNECTIVITY_OTOOLS_HXX_ + +#ifndef _CONNECTIVITY_OFUNCTIONDEFS_HXX_ +#include "odbc/OFunctiondefs.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_SQLEXCEPTION_HPP_ +#include <com/sun/star/sdbc/SQLException.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_DATE_HPP_ +#include <com/sun/star/util/Date.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_TIME_HPP_ +#include <com/sun/star/util/Time.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_DATETIME_HPP_ +#include <com/sun/star/util/DateTime.hpp> +#endif +#ifndef _OSL_THREAD_H_ +#include <osl/thread.h> +#endif +#ifndef _RTL_USTRING_HXX_ +#include <rtl/ustring.hxx> +#endif +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_ +#include <com/sun/star/uno/Sequence.hxx> +#endif + +namespace connectivity +{ + namespace odbc + { + + const sal_uInt32 ODBC_FRACTION_UNITS_PER_HSECOND = 10000000L; + const sal_Int32 MAX_PUT_DATA_LENGTH = 2000; + + class OTools + { + public: + static void ThrowException( SQLRETURN _rRetCode,SQLHANDLE _pContext,SQLSMALLINT _nHandleType, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface,sal_Bool _bNoFound=sal_True) + throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + static void GetInfo(SQLHANDLE _aConnectionHandle,SQLUSMALLINT _nInfo,::rtl::OUString &_rValue, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface) + throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + static void GetInfo(SQLHANDLE _aConnectionHandle,SQLUSMALLINT _nInfo,sal_Int32 &_rValue,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + static void GetInfo(SQLHANDLE _aConnectionHandle,SQLUSMALLINT _nInfo,sal_Bool &_rValue,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + static sal_Int32 MapOdbcType2Jdbc(sal_Int32 _nType); + static sal_Int32 jdbcTypeToOdbc(sal_Int32 jdbcType); + + static DATE_STRUCT DateToOdbcDate(const ::com::sun::star::util::Date& x) + { + DATE_STRUCT aVal; + aVal.year = x.Year; + aVal.month = x.Month; + aVal.day = x.Day; + return aVal; + } + static TIME_STRUCT TimeToOdbcTime(const ::com::sun::star::util::Time& x) + { + TIME_STRUCT aVal; + aVal.hour = x.Hours; + aVal.minute = x.Minutes; + aVal.second = x.Seconds; + return aVal; + } + static TIMESTAMP_STRUCT DateTimeToTimestamp(const ::com::sun::star::util::DateTime& x) + { + TIMESTAMP_STRUCT aVal; + aVal.year = x.Year; + aVal.month = x.Month; + aVal.day = x.Day; + aVal.hour = x.Hours; + aVal.minute = x.Minutes; + aVal.second = x.Seconds; + aVal.fraction = x.HundredthSeconds * ODBC_FRACTION_UNITS_PER_HSECOND; + return aVal; + } + static void getBindTypes(sal_Bool _bUseWChar,sal_Bool _bUseOldTimeDate, + sal_Int32 jdbcType,SQLSMALLINT& fCType,SQLSMALLINT& fSqlType, + SQLUINTEGER& nColumnSize,SQLSMALLINT& nDecimalDigits); + static ::rtl::OUString getStringValue(SQLHANDLE _aStatementHandle,sal_Int32 columnIndex,SWORD _fSqlType,sal_Bool &_bWasNull, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + static ::com::sun::star::uno::Sequence<sal_Int8> OTools::getBytesValue(SQLHANDLE _aStatementHandle,sal_Int32 columnIndex,SWORD _fSqlType,sal_Bool &_bWasNull, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + + template <class T> T getValue( SQLHANDLE _aStatementHandle,sal_Int32 columnIndex, + SQLSMALLINT _nType,sal_Bool &_bWasNull, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface,const T& _rValue) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) + { + SQLINTEGER pcbValue; + T nValue = _rValue; + OTools::ThrowException(N3SQLGetData(_aStatementHandle, + columnIndex, + _nType, + &nValue, + (SQLINTEGER)sizeof nValue, + &pcbValue), + _aStatementHandle,SQL_HANDLE_STMT,_xInterface,sal_False); + _bWasNull = pcbValue == SQL_NULL_DATA; + return nValue; + } + + //----------------------------------------------------------------------------- + template < class T > void bindData(SWORD fSqlType,sal_Bool _bUseWChar,void *&_pData,SDWORD*& pLen,const T* _pValue) + { + SDWORD nMaxLen = 0; + + switch (fSqlType) + { + case SQL_CHAR: + case SQL_VARCHAR: + if(_bUseWChar) + { + *pLen = SQL_NTS; + *((rtl::OUString*)_pData) = *(::rtl::OUString*)_pValue; + + // Zeiger auf Char* + _pData = (void*)((rtl::OUString*)_pData)->getStr(); + } + else + { + ::rtl::OString aString(::rtl::OUStringToOString(*(::rtl::OUString*)_pValue,osl_getThreadTextEncoding())); + *pLen = SQL_NTS; + memcpy(_pData,aString.getStr(),aString.getLength()); + ((sal_Int8*)_pData)[aString.getLength()] = '\0'; + } break; + + case SQL_BIGINT: + case SQL_DECIMAL: + case SQL_NUMERIC: + if(_bUseWChar) + { + ::rtl::OUString aString = rtl::OUString::valueOf(*(double*)_pValue); + nMaxLen = aString.getLength(); + *pLen = nMaxLen; + *((rtl::OUString*)_pData) = aString; + // Zeiger auf Char* + _pData = (void*)((rtl::OUString*)_pData)->getStr(); + } + else + { + ::rtl::OString aString = ::rtl::OString::valueOf(*(double*)_pValue); + nMaxLen = aString.getLength(); + *pLen = nMaxLen; + memcpy(_pData,aString.getStr(),aString.getLength()); + ((sal_Int8*)_pData)[aString.getLength()] = '\0'; + } break; + case SQL_BIT: + *((sal_Int8*)_pData) = *(sal_Int8*)_pValue; + *pLen = sizeof(sal_Int8); + break; + case SQL_TINYINT: + case SQL_SMALLINT: + *((sal_Int16*)_pData) = *(sal_Int16*)_pValue; + *pLen = sizeof(sal_Int16); + break; + case SQL_INTEGER: + *((sal_Int32*)_pData) = *(sal_Int32*)_pValue; + *pLen = sizeof(sal_Int32); + break; + case SQL_REAL: + *((float*)_pData) = *(float*)_pValue; + *pLen = sizeof(float); + break; + case SQL_DOUBLE: + *((double*)_pData) = *(double*)_pValue; + *pLen = sizeof(double); + break; + case SQL_BINARY: + case SQL_VARBINARY: + _pData = (void*)((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getConstArray(); + *pLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength(); + break; + case SQL_LONGVARBINARY: + { + sal_Int32 nLen = 0; + nLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength(); + *pLen = (SDWORD)SQL_LEN_DATA_AT_EXEC(nLen); + } + break; + case SQL_LONGVARCHAR: + { + _pData = 0;//(void*)&rCol; + sal_Int32 nLen = 0; + if(_bUseWChar) + nLen = sizeof(sal_Unicode) * ((::rtl::OUString*)_pValue)->getLength(); + else + { + ::rtl::OString aString(::rtl::OUStringToOString(*(::rtl::OUString*)_pValue, + osl_getThreadTextEncoding() + )); + nLen = aString.getLength(); + } + *pLen = (SDWORD)SQL_LEN_DATA_AT_EXEC(nLen); + } break; + case SQL_DATE: + *(DATE_STRUCT*)_pData = *(DATE_STRUCT*)_pValue; + *pLen = (SDWORD)sizeof(DATE_STRUCT); + break; + case SQL_TIME: + *(TIME_STRUCT*)_pData = *(TIME_STRUCT*)_pValue; + *pLen = (SDWORD)sizeof(TIME_STRUCT); + break; + case SQL_TIMESTAMP: + *(TIMESTAMP_STRUCT*)_pData = *(TIMESTAMP_STRUCT*)_pValue; + *pLen = (SDWORD)sizeof(TIMESTAMP_STRUCT); + break; + } + } + + //----------------------------------------------------------------------------- + template < class T > sal_Bool bindParameter( SQLHANDLE _hStmt,sal_Int32 nPos, sal_Int8* pDataBuffer, + sal_Int8* pLenBuffer,SQLSMALLINT _nJDBCtype, + sal_Bool _bUseWChar,sal_Bool _bUseOldTimeDate,const T* _pValue, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface) + throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) + { + SQLRETURN nRetcode; + SWORD fSqlType; + SWORD fCType; + SDWORD nMaxLen = 0; + void* pData = pDataBuffer; + SDWORD* pLen = (SDWORD*)pLenBuffer; + SQLUINTEGER nColumnSize=0; + SQLSMALLINT nDecimalDigits=0; + SQLSMALLINT nNullable=0; + + OTools::getBindTypes(_bUseWChar,_bUseOldTimeDate,_nJDBCtype,fSqlType,fCType,nColumnSize,nDecimalDigits); + + bindData< T >(fSqlType,_bUseWChar,pData,pLen,_pValue); + if(fSqlType == SQL_LONGVARCHAR || fSqlType == SQL_LONGVARBINARY) + memcpy(pData,&nPos,sizeof(nPos)); + + nRetcode = N3SQLDescribeParam(_hStmt,nPos,&fSqlType,&nColumnSize,&nDecimalDigits,&nNullable); + + nRetcode = N3SQLBindParameter(_hStmt, + nPos, + SQL_PARAM_INPUT, + fCType, + fSqlType, + nColumnSize, + nDecimalDigits, + pData, + nMaxLen, + pLen); + + OTools::ThrowException(nRetcode,_hStmt,SQL_HANDLE_STMT,_xInterface); + return sal_True; + } + + + template <class T> void bindValue(SQLHANDLE _aStatementHandle,sal_Int32 columnIndex, + SQLSMALLINT _nType,SQLSMALLINT _nMaxLen,SQLSMALLINT _nScale, + const T* _pValue,void* _pData,SQLINTEGER *pLen, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) + { + SQLRETURN nRetcode; + SWORD fSqlType; + SWORD fCType; + + switch(_nType) + { + case SQL_CHAR: //if(GetODBCConnection()->m_bUserWChar) + // { + // fCType = SQL_C_WCHAR; + // fSqlType = SQL_WCHAR; + // } + // else + { + fCType = SQL_C_CHAR; + fSqlType = SQL_CHAR; + } + break; + case SQL_VARCHAR: //if(GetODBCConnection()->m_bUserWChar) + // { + // fCType = SQL_C_WCHAR; + // fSqlType = SQL_WVARCHAR; + // } + // else + { + fCType = SQL_C_CHAR; + fSqlType = SQL_VARCHAR; + } + break; + case SQL_LONGVARCHAR: //if(GetODBCConnection()->m_bUserWChar) + // { + // fCType = SQL_C_WCHAR; + // fSqlType = SQL_WLONGVARCHAR; + // } + // else + { + fCType = SQL_C_CHAR; + fSqlType = SQL_LONGVARCHAR; + } + break; + case SQL_DECIMAL: fCType = SQL_C_CHAR;//GetODBCConnection()->m_bUserWChar ? SQL_C_WCHAR : SQL_C_CHAR; + fSqlType = SQL_DECIMAL; break; + case SQL_NUMERIC: fCType = SQL_C_CHAR;//GetODBCConnection()->m_bUserWChar ? SQL_C_WCHAR : SQL_C_CHAR; + fSqlType = SQL_NUMERIC; break; + case SQL_BIT: fCType = SQL_C_TINYINT; + fSqlType = SQL_INTEGER; break; + case SQL_TINYINT: fCType = SQL_C_SHORT; + fSqlType = SQL_TINYINT; break; + case SQL_SMALLINT: fCType = SQL_C_SHORT; + fSqlType = SQL_SMALLINT; break; + case SQL_INTEGER: fCType = SQL_C_LONG; + fSqlType = SQL_INTEGER; break; + case SQL_BIGINT: fCType = SQL_C_CHAR;//GetODBCConnection()->m_bUserWChar ? SQL_C_WCHAR : SQL_C_CHAR; + fSqlType = SQL_BIGINT; break; + case SQL_REAL: fCType = SQL_C_FLOAT; + fSqlType = SQL_REAL; break; + case SQL_DOUBLE: fCType = SQL_C_DOUBLE; + fSqlType = SQL_DOUBLE; break; + case SQL_BINARY: fCType = SQL_C_BINARY; + fSqlType = SQL_BINARY; break; + case SQL_VARBINARY: + fCType = SQL_C_BINARY; + fSqlType = SQL_VARBINARY; break; + case SQL_LONGVARBINARY: fCType = SQL_C_BINARY; + fSqlType = SQL_LONGVARBINARY; break; + case SQL_DATE: + // if(((SdbODBC3Connection*)GetODBCConnection())->m_bUseOldTimeDate) + { + fCType = SQL_C_DATE; + fSqlType = SQL_DATE; + } + // else + // { + // fCType = SQL_C_TYPE_DATE; + // fSqlType = SQL_TYPE_DATE; + // } + break; + case SQL_TIME: + // if(((SdbODBC3Connection*)GetODBCConnection())->m_bUseOldTimeDate) + { + fCType = SQL_C_TIME; + fSqlType = SQL_TIME; + } + // else + // { + // fCType = SQL_C_TYPE_TIME; + // fSqlType = SQL_TYPE_TIME; + // } + break; + case SQL_TIMESTAMP: + // if(((SdbODBC3Connection*)GetODBCConnection())->m_bUseOldTimeDate) + { + fCType = SQL_C_TIMESTAMP; + fSqlType = SQL_TIMESTAMP; + } + // else + // { + // fCType = SQL_C_TYPE_TIMESTAMP; + // fSqlType = SQL_TYPE_TIMESTAMP; + // } + break; + default: fCType = SQL_C_BINARY; + fSqlType = SQL_LONGVARBINARY; break; + } + + if (columnIndex != 0 && !_pValue) + { + *pLen = SQL_NULL_DATA; + nRetcode = N3SQLBindCol(_aStatementHandle, + columnIndex, + fCType, + _pData, + _nMaxLen, + pLen + ); + } + else + { + try + { + switch (_nType) + { + case SQL_CHAR: + case SQL_VARCHAR: + //if(GetODBCConnection()->m_bUserWChar) + // { + // _nMaxLen = rCol.GetPrecision(); + // *pLen = SQL_NTS; + // *((rtl::OUString*)pData) = (rtl::OUString)_aValue; + // + // // Zeiger auf Char* + // pData = (void*)((rtl::OUString*)pData)->getStr(); + // } + // else + { + ::rtl::OString aString(::rtl::OUStringToOString(*(::rtl::OUString*)_pValue,osl_getThreadTextEncoding())); + *pLen = SQL_NTS; + *((::rtl::OString*)_pData) = aString; + _nMaxLen = aString.getLength(); + + // Zeiger auf Char* + _pData = (void*)aString.getStr(); + } break; + case SQL_BIGINT: + case SQL_DECIMAL: + case SQL_NUMERIC: + //if(GetODBCConnection()->m_bUserWChar) + // { + // rtl::OUString aString(rtl::OUString(SdbTools::ToString(ODbTypeConversion::toDouble(*pVariable),rCol.GetScale()))); + // *pLen = _nMaxLen; + // *((rtl::OUString*)_pData) = aString; + // // Zeiger auf Char* + // _pData = (void*)((rtl::OUString*)_pData)->getStr(); + // } + // else + { + ::rtl::OString aString = ::rtl::OString::valueOf(*(double*)_pValue); + _nMaxLen = aString.getLength(); + *pLen = _nMaxLen; + *((::rtl::OString*)_pData) = aString; + // Zeiger auf Char* + _pData = (void*)((::rtl::OString*)_pData)->getStr(); + } break; + case SQL_BIT: + *((sal_Int8*)_pData) = *(sal_Int8*)_pValue; + *pLen = sizeof(sal_Int8); + break; + case SQL_TINYINT: + case SQL_SMALLINT: + *((sal_Int16*)_pData) = *(sal_Int16*)_pValue; + *pLen = sizeof(sal_Int16); + break; + case SQL_INTEGER: + *((sal_Int32*)_pData) = *(sal_Int32*)_pValue; + *pLen = sizeof(sal_Int32); + break; + case SQL_REAL: + *((float*)_pData) = *(float*)_pValue; + *pLen = sizeof(float); + break; + case SQL_DOUBLE: + *((double*)_pData) = *(double*)_pValue; + *pLen = sizeof(double); + break; + case SQL_BINARY: + case SQL_VARBINARY: + // if (_pValue == ::getCppuType((const ::com::sun::star::uno::Sequence< sal_Int8 > *)0)) + { + _pData = (void*)((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getConstArray(); + *pLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength(); + } break; + case SQL_LONGVARBINARY: + { + sal_Int32 nLen = 0; + nLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength(); + *pLen = (SDWORD)SQL_LEN_DATA_AT_EXEC(nLen); + } + break; + case SQL_LONGVARCHAR: + { + sal_Int32 nLen = 0; + nLen = ((::rtl::OUString*)_pValue)->getLength(); + *pLen = (SDWORD)SQL_LEN_DATA_AT_EXEC(nLen); + } break; + case SQL_DATE: + *pLen = sizeof(DATE_STRUCT); + *((DATE_STRUCT*)_pData) = *(DATE_STRUCT*)_pValue; + break; + case SQL_TIME: + *pLen = sizeof(TIME_STRUCT); + *((TIME_STRUCT*)_pData) = *(TIME_STRUCT*)_pValue; + break; + case SQL_TIMESTAMP: + *pLen = sizeof(TIMESTAMP_STRUCT); + *((TIMESTAMP_STRUCT*)_pData) = *(TIMESTAMP_STRUCT*)_pValue; + } + } + catch ( ... ) + { + } +// SQLINTEGER *pLen = &aLen; +// bindData< T >(fSqlType,sal_False,_pData,pLen,_pValue); + + + nRetcode = N3SQLBindCol(_aStatementHandle, + columnIndex, + fCType, + _pData, + _nMaxLen, + pLen + ); + } + + OTools::ThrowException(nRetcode,_aStatementHandle,SQL_HANDLE_STMT,_xInterface); + } + } +} +#endif // _CONNECTIVITY_OTOOLS_HXX_ + diff --git a/connectivity/source/inc/propertyids.hxx b/connectivity/source/inc/propertyids.hxx new file mode 100644 index 000000000000..9df0f2e94d73 --- /dev/null +++ b/connectivity/source/inc/propertyids.hxx @@ -0,0 +1,196 @@ +/************************************************************************* + * + * $RCSfile: propertyids.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#define _CONNECTIVITY_PROPERTYIDS_HXX_ + + +namespace connectivity +{ + struct UStringDescription + { + const sal_Char* pZeroTerminatedName; + + UStringDescription(sal_Char* _pName) { pZeroTerminatedName = _pName; } + operator ::rtl::OUString() const { return ::rtl::OUString::createFromAscii(pZeroTerminatedName); } + private: + UStringDescription(); + }; + +#define DECLARE_CONSTASCII_USTRING(name) \ + extern connectivity::UStringDescription name; + +#define IMPLEMENT_CONSTASCII_USTRING(name, asciivalue) \ + connectivity::UStringDescription name(asciivalue) + + + DECLARE_CONSTASCII_USTRING(PROPERTY_CURSORNAME) + DECLARE_CONSTASCII_USTRING(PROPERTY_RESULTSETCONCURRENCY) + DECLARE_CONSTASCII_USTRING(PROPERTY_RESULTSETTYPE) + DECLARE_CONSTASCII_USTRING(PROPERTY_FETCHDIRECTION) + DECLARE_CONSTASCII_USTRING(PROPERTY_FETCHSIZE) + DECLARE_CONSTASCII_USTRING(PROPERTY_QUERYTIMEOUT) + DECLARE_CONSTASCII_USTRING(PROPERTY_MAXFIELDSIZE) + DECLARE_CONSTASCII_USTRING(PROPERTY_MAXROWS) + DECLARE_CONSTASCII_USTRING(PROPERTY_ESCAPEPROCESSING) + DECLARE_CONSTASCII_USTRING(PROPERTY_USEBOOKMARKS) + + DECLARE_CONSTASCII_USTRING(PROPERTY_NAME) + DECLARE_CONSTASCII_USTRING(PROPERTY_TYPE) + DECLARE_CONSTASCII_USTRING(PROPERTY_TYPENAME) + DECLARE_CONSTASCII_USTRING(PROPERTY_PRECISION) + DECLARE_CONSTASCII_USTRING(PROPERTY_SCALE) + DECLARE_CONSTASCII_USTRING(PROPERTY_ISNULLABLE) + DECLARE_CONSTASCII_USTRING(PROPERTY_ISAUTOINCREMENT) + DECLARE_CONSTASCII_USTRING(PROPERTY_ISROWVERSION) + DECLARE_CONSTASCII_USTRING(PROPERTY_DESCRIPTION) + DECLARE_CONSTASCII_USTRING(PROPERTY_DEFAULTVALUE) + + DECLARE_CONSTASCII_USTRING(PROPERTY_REFERENCEDTABLE) + DECLARE_CONSTASCII_USTRING(PROPERTY_UPDATERULE) + DECLARE_CONSTASCII_USTRING(PROPERTY_DELETERULE) + + DECLARE_CONSTASCII_USTRING(PROPERTY_CATALOG) + DECLARE_CONSTASCII_USTRING(PROPERTY_ISUNIQUE) + DECLARE_CONSTASCII_USTRING(PROPERTY_ISPRIMARYKEYINDEX) + DECLARE_CONSTASCII_USTRING(PROPERTY_ISCLUSTERED) + DECLARE_CONSTASCII_USTRING(PROPERTY_ISASCENDING) + + DECLARE_CONSTASCII_USTRING(PROPERTY_SCHEMANAME) + DECLARE_CONSTASCII_USTRING(PROPERTY_CATALOGNAME) + DECLARE_CONSTASCII_USTRING(PROPERTY_COMMAND) + DECLARE_CONSTASCII_USTRING(PROPERTY_CHECKOPTION) + DECLARE_CONSTASCII_USTRING(PROPERTY_PASSWORD) + DECLARE_CONSTASCII_USTRING(PROPERTY_REFERENCEDCOLUMN) + + DECLARE_CONSTASCII_USTRING(PROPERTY_FUNCTION) + DECLARE_CONSTASCII_USTRING(PROPERTY_TABLENAME) + DECLARE_CONSTASCII_USTRING(PROPERTY_REALNAME) + DECLARE_CONSTASCII_USTRING(PROPERTY_DBASEPRECISIONCHANGED) + DECLARE_CONSTASCII_USTRING(PROPERTY_ISCURRENCY) + DECLARE_CONSTASCII_USTRING(PROPERTY_ISBOOKMARKABLE) + + // error msg + DECLARE_CONSTASCII_USTRING(STAT_INVALID_INDEX) +} + + +//------------------------------------------------------------------------------ +#define DECL_PROP1IMPL(varname, type) \ + pProperties[nPos++] = ::com::sun::star::beans::Property(connectivity::PROPERTY_##varname, PROPERTY_ID_##varname, ::getCppuType(reinterpret_cast< type*>(NULL)), +//------------------------------------------------------------------------------ +#define DECL_PROP0(varname, type) \ + DECL_PROP1IMPL(varname, type) 0) +//------------------------------------------------------------------------------ +#define DECL_BOOL_PROP1IMPL(varname) \ + pProperties[nPos++] = ::com::sun::star::beans::Property(connectivity::PROPERTY_##varname, PROPERTY_ID_##varname, ::getBooleanCppuType(), +//------------------------------------------------------------------------------ +#define DECL_BOOL_PROP0(varname) \ + DECL_BOOL_PROP1IMPL(varname) 0) + + +#define PROPERTY_ID_QUERYTIMEOUT 1 +#define PROPERTY_ID_MAXFIELDSIZE 2 +#define PROPERTY_ID_MAXROWS 3 +#define PROPERTY_ID_CURSORNAME 4 +#define PROPERTY_ID_RESULTSETCONCURRENCY 5 +#define PROPERTY_ID_RESULTSETTYPE 6 +#define PROPERTY_ID_FETCHDIRECTION 7 +#define PROPERTY_ID_FETCHSIZE 8 +#define PROPERTY_ID_ESCAPEPROCESSING 9 +#define PROPERTY_ID_USEBOOKMARKS 10 +// Column +#define PROPERTY_ID_NAME 11 +#define PROPERTY_ID_TYPE 12 +#define PROPERTY_ID_TYPENAME 13 +#define PROPERTY_ID_PRECISION 14 +#define PROPERTY_ID_SCALE 15 +#define PROPERTY_ID_ISNULLABLE 16 +#define PROPERTY_ID_ISAUTOINCREMENT 17 +#define PROPERTY_ID_ISROWVERSION 18 +#define PROPERTY_ID_DESCRIPTION 19 +#define PROPERTY_ID_DEFAULTVALUE 20 + +#define PROPERTY_ID_REFERENCEDTABLE 21 +#define PROPERTY_ID_UPDATERULE 22 +#define PROPERTY_ID_DELETERULE 23 +#define PROPERTY_ID_CATALOG 24 +#define PROPERTY_ID_ISUNIQUE 25 +#define PROPERTY_ID_ISPRIMARYKEYINDEX 26 +#define PROPERTY_ID_ISCLUSTERED 27 +#define PROPERTY_ID_ISASCENDING 28 +#define PROPERTY_ID_SCHEMANAME 29 +#define PROPERTY_ID_CATALOGNAME 30 + +#define PROPERTY_ID_COMMAND 31 +#define PROPERTY_ID_CHECKOPTION 32 +#define PROPERTY_ID_PASSWORD 33 +#define PROPERTY_ID_REFERENCEDCOLUMN 34 + +#define PROPERTY_ID_FUNCTION 35 +#define PROPERTY_ID_TABLENAME 36 +#define PROPERTY_ID_REALNAME 37 +#define PROPERTY_ID_DBASEPRECISIONCHANGED 38 +#define PROPERTY_ID_ISCURRENCY 39 +#define PROPERTY_ID_ISBOOKMARKABLE 40 + +#endif // _CONNECTIVITY_PROPERTYIDS_HXX_ + + diff --git a/connectivity/source/inc/sqlscan.hxx b/connectivity/source/inc/sqlscan.hxx new file mode 100644 index 000000000000..70d23ca6ef67 --- /dev/null +++ b/connectivity/source/inc/sqlscan.hxx @@ -0,0 +1,119 @@ +/************************************************************************* + * + * $RCSfile: sqlscan.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_SQLSCAN_HXX +#define _CONNECTIVITY_SQLSCAN_HXX + +#include <stdarg.h> + +#ifndef _DEBUG_HXX //autogen +#include <tools/debug.hxx> +#endif +#ifndef _STRING_HXX //autogen wg. String +#include <tools/string.hxx> +#endif + +namespace connectivity +{ + class OParseContext; + //========================================================================== + //= OSQLScanner + //========================================================================== + /** Scanner for SQL92 + */ + class OSQLScanner + { + OParseContext* m_pContext; // context for parse, knows all international stuff + ByteString m_sStatement; // statement to parse + String m_sErrorMessage; + + xub_StrLen m_nCurrentPos; // next position to read from the statement + sal_Bool m_bInternational; // do we have a statement which may uses + sal_Int32 m_nRule; // rule to be set + + public: + OSQLScanner(); + ~OSQLScanner(); + + virtual int SQLyygetc(void); + virtual void SQLyyerror(char *fmt); + virtual void output(int) { DBG_ERROR("Internal error in sdblex.l: output not possible"); } + virtual void ECHO(void) { DBG_ERROR("Internal error in sdblex.l: ECHO not possible"); } + virtual int getInternationalTokenID(const char* sToken) const; + + // setting the new information before scanning + void prepareScan(const String & rNewStatement, OParseContext* pContext, sal_Bool bInternational); + const String& getErrorMessage() const {return m_sErrorMessage;} + + int SQLlex(); + // set this as scanner for flex + void setScanner(sal_Bool _bNull=sal_False); + // rules settings + void SetRule(int nRule) {m_nRule = nRule;} + int GetCurrentRule() const; + int GetGERRule() const; + int GetENGRule() const; + int GetSQLRule() const; + int GetDATERule() const; + int GetSTRINGRule() const; + }; +} + +#endif diff --git a/connectivity/source/manager/exports.dxp b/connectivity/source/manager/exports.dxp new file mode 100644 index 000000000000..9630d7e06768 --- /dev/null +++ b/connectivity/source/manager/exports.dxp @@ -0,0 +1,3 @@ +component_getImplementationEnvironment +component_writeInfo +component_getFactory diff --git a/connectivity/source/manager/makefile.mk b/connectivity/source/manager/makefile.mk new file mode 100644 index 000000000000..aaff11348e0a --- /dev/null +++ b/connectivity/source/manager/makefile.mk @@ -0,0 +1,137 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:14:28 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. +PRJINC=.. +PRJNAME=connectivity +TARGET=sdbc + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ---------------------------------- +.IF "$(DBGUTIL_OJ)"!="" +ENVCFLAGS+=/FR$(SLO)$/ +.ENDIF + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/version.mk + +# --- Types ------------------------------------- + + +UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb +UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb + +UNOUCROUT=$(PRJ)$/common$/inc +INCPRE+=$(UNOUCROUT) + +# --- Types ------------------------------------- + +UNOTYPES+= \ + com.sun.star.sdbc.XDriverManager \ + com.sun.star.lang.XMultiServiceFactory \ + com.sun.star.uno.TypeClass \ + com.sun.star.container.XEnumerationAccess \ + com.sun.star.container.XContentEnumerationAccess\ + com.sun.star.uno.XWeak \ + com.sun.star.uno.XAggregation \ + com.sun.star.lang.XTypeProvider \ + com.sun.star.lang.XSingleServiceFactory \ + com.sun.star.registry.XRegistryKey \ + com.sun.star.lang.XServiceInfo \ + com.sun.star.uno.XNamingService \ + com.sun.star.sdbc.XDriver \ + com.sun.star.sdbc.XDriverAccess \ + com.sun.star.lang.IllegalArgumentException + +# --- Files ------------------------------------- + +SLOFILES=\ + $(SLO)$/mdrivermanager.obj \ + $(SLO)$/registration.obj + +# --- Library ----------------------------------- + +SHL1TARGET= $(SDBC_TARGET)$(SDBC_MAJOR) +SHL1VERSIONMAP= $(TARGET).map +SHL1OBJS=$(SLOFILES) +SHL1STDLIBS=\ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(VOSLIB) \ + $(OSLLIB) \ + $(SALLIB) + +SHL1DEPN= +SHL1IMPLIB= i$(SHL1TARGET) + +SHL1DEF= $(MISC)$/$(SHL1TARGET).def + +DEF1NAME= $(SHL1TARGET) +DEF1EXPORTFILE= exports.dxp + + +# --- Targets ---------------------------------- + +.INCLUDE : target.mk + + diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx new file mode 100644 index 000000000000..2cad40cbe691 --- /dev/null +++ b/connectivity/source/manager/mdrivermanager.cxx @@ -0,0 +1,400 @@ +/************************************************************************* + * + * $RCSfile: mdrivermanager.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DRIVERMANAGER_HXX_ +#include "drivermanager.hxx" +#endif + +#ifndef _COM_SUN_STAR_SDBC_XDRIVER_HPP_ +#include <com/sun/star/sdbc/XDriver.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XCONTENTENUMERATIONACCESS_HPP_ +#include <com/sun/star/container/XContentEnumerationAccess.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_ELEMENTEXISTEXCEPTION_HPP_ +#include <com/sun/star/container/ElementExistException.hpp> +#endif + +#ifndef _CPPUHELPER_EXTRACT_HXX_ +#include <cppuhelper/extract.hxx> +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::container; +using namespace ::osl; + +#define SERVICE_SDBC_DRIVER ::rtl::OUString::createFromAscii("com.sun.star.sdbc.Driver") + +//========================================================================== +//= ODriverEnumeration +//========================================================================== +class ODriverEnumeration : public ::cppu::ImplHelper1< XEnumeration > +{ + friend class OSDBCDriverManager; + + oslInterlockedCount m_refCount; + + DECLARE_STL_VECTOR(OSDBCDriverManager::SdbcDriver, Drivers); + Drivers m_aDrivers; + sal_Int32 m_nPos; + + ~ODriverEnumeration(); +public: + ODriverEnumeration(const Drivers& _rDriverSequence); + +// XInterface + virtual void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException); + +// XEnumeration + virtual sal_Bool SAL_CALL hasMoreElements( ) throw(RuntimeException); + virtual Any SAL_CALL nextElement( ) throw(NoSuchElementException, WrappedTargetException, RuntimeException); +}; + +//-------------------------------------------------------------------------- +ODriverEnumeration::ODriverEnumeration(const Drivers& _rDriverSequence) + :m_aDrivers(_rDriverSequence) + ,m_nPos(0) +{ +} + +//-------------------------------------------------------------------------- +ODriverEnumeration::~ODriverEnumeration() +{ +} + +//-------------------------------------------------------------------------- +void SAL_CALL ODriverEnumeration::acquire() throw(::com::sun::star::uno::RuntimeException) +{ + osl_incrementInterlockedCount(&m_refCount); +} + +//-------------------------------------------------------------------------- +void SAL_CALL ODriverEnumeration::release() throw(::com::sun::star::uno::RuntimeException) +{ + osl_decrementInterlockedCount(&m_refCount); +} + +//-------------------------------------------------------------------------- +sal_Bool SAL_CALL ODriverEnumeration::hasMoreElements( ) throw(RuntimeException) +{ + return m_nPos < m_aDrivers.size(); +} + +//-------------------------------------------------------------------------- +Any SAL_CALL ODriverEnumeration::nextElement( ) throw(NoSuchElementException, WrappedTargetException, RuntimeException) +{ + if (!hasMoreElements()) + throw NoSuchElementException(); + return makeAny(m_aDrivers[m_nPos++]); +} + +//========================================================================== +//= OSDBCDriverManager +//========================================================================== +//-------------------------------------------------------------------------- +OSDBCDriverManager::OSDBCDriverManager(const Reference< XMultiServiceFactory >& _rxFactory) + :m_xServiceFactory(_rxFactory) + ,m_nLoginTimeout(NULL) +{ + // bootstrap all objects supporting the .sdb.Driver service + + Reference< XContentEnumerationAccess > xEnumAccess(_rxFactory, UNO_QUERY); + Reference< XEnumeration > xEnumDrivers; + if (xEnumAccess.is()) + xEnumDrivers = xEnumAccess->createContentEnumeration(SERVICE_SDBC_DRIVER); + + if (xEnumDrivers.is()) + { + while (xEnumDrivers->hasMoreElements()) + { + Any aCurrent = xEnumDrivers->nextElement(); + Reference< XSingleServiceFactory > xFactory; + + if (!::cppu::extractInterface(xFactory, aCurrent)) + continue; + + Reference< XDriver > xDriver(xFactory->createInstance(), UNO_QUERY); + if (xDriver.is()) + m_aDriversBS.push_back(xDriver); + } + } +} + +//-------------------------------------------------------------------------- +void SAL_CALL OSDBCDriverManager::acquire() throw(::com::sun::star::uno::RuntimeException) +{ + osl_incrementInterlockedCount(&m_refCount); +} + +//-------------------------------------------------------------------------- +void SAL_CALL OSDBCDriverManager::release() throw(::com::sun::star::uno::RuntimeException) +{ + osl_decrementInterlockedCount(&m_refCount); +} + +//-------------------------------------------------------------------------- +Reference< XConnection > SAL_CALL OSDBCDriverManager::getConnection( const ::rtl::OUString& _rURL ) throw(SQLException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + + Reference< XConnection > xConnection; + Reference< XDriver > xDriver = implGetDriverForURL(_rURL); + if (xDriver.is()) + // TODO : handle the login timeout + xConnection = xDriver->connect(_rURL, Sequence< PropertyValue >()); + // may throw an exception + + return xConnection; +} + +//-------------------------------------------------------------------------- +Reference< XConnection > SAL_CALL OSDBCDriverManager::getConnectionWithInfo( const ::rtl::OUString& _rURL, const Sequence< PropertyValue >& _rInfo ) throw(SQLException, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + + Reference< XConnection > xConnection; + Reference< XDriver > xDriver = implGetDriverForURL(_rURL); + if (xDriver.is()) + // TODO : handle the login timeout + xConnection = xDriver->connect(_rURL, _rInfo); + // may throw an exception + + return xConnection; +} + +//-------------------------------------------------------------------------- +void SAL_CALL OSDBCDriverManager::setLoginTimeout( sal_Int32 seconds ) throw(RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + m_nLoginTimeout = seconds; +} + +//-------------------------------------------------------------------------- +sal_Int32 SAL_CALL OSDBCDriverManager::getLoginTimeout( ) throw(RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + return m_nLoginTimeout; +} + +//-------------------------------------------------------------------------- +Reference< XEnumeration > SAL_CALL OSDBCDriverManager::createEnumeration( ) throw(RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + + ODriverEnumeration::Drivers aDrivers(m_aDriversBS); + for (ConstRuntimeDriversIterator aLoop = m_aDriversRT.begin(); aLoop != m_aDriversRT.end(); ++aLoop) + aDrivers.push_back(aLoop->second); + + return new ODriverEnumeration(aDrivers); +} + +//-------------------------------------------------------------------------- +::com::sun::star::uno::Type SAL_CALL OSDBCDriverManager::getElementType( ) throw(::com::sun::star::uno::RuntimeException) +{ + return ::getCppuType(static_cast< Reference< XDriver >* >(NULL)); +} + +//-------------------------------------------------------------------------- +sal_Bool SAL_CALL OSDBCDriverManager::hasElements( ) throw(::com::sun::star::uno::RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + return (m_aDriversBS.size() + m_aDriversRT.size()) != 0; +} + +//-------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OSDBCDriverManager::getImplementationName( ) throw(RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + return getImplementationName_Static(); +} + +//-------------------------------------------------------------------------- +sal_Bool SAL_CALL OSDBCDriverManager::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + const ::rtl::OUString* pSupported = aSupported.getConstArray(); + for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) + if (pSupported->equals(_rServiceName)) + return sal_True; + + return sal_False; +} + +//-------------------------------------------------------------------------- +Sequence< ::rtl::OUString > SAL_CALL OSDBCDriverManager::getSupportedServiceNames( ) throw(RuntimeException) +{ + return getSupportedServiceNames_Static(); +} + +//-------------------------------------------------------------------------- +Reference< XInterface > SAL_CALL OSDBCDriverManager::CreateInstance(const Reference< XMultiServiceFactory >& _rxFactory) +{ + return static_cast<XDriverManager*>(new OSDBCDriverManager(_rxFactory)); +} + +//-------------------------------------------------------------------------- +::rtl::OUString SAL_CALL OSDBCDriverManager::getImplementationName_Static( ) throw(RuntimeException) +{ + return ::rtl::OUString::createFromAscii("com.sun.star.sdbc.OSDBCDriverManager"); +} + +//-------------------------------------------------------------------------- +Sequence< ::rtl::OUString > SAL_CALL OSDBCDriverManager::getSupportedServiceNames_Static( ) throw(RuntimeException) +{ + Sequence< ::rtl::OUString > aSupported(1); + aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.DriverManager"); + return aSupported; +} + +//-------------------------------------------------------------------------- +Reference< XInterface > SAL_CALL OSDBCDriverManager::getRegisteredObject( const ::rtl::OUString& _rName ) throw(Exception, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + ConstRuntimeDriversIterator aSearch = m_aDriversRT.find(_rName); + if (aSearch == m_aDriversRT.end()) + throw NoSuchElementException(); + + return aSearch->second; +} + +//-------------------------------------------------------------------------- +void SAL_CALL OSDBCDriverManager::registerObject( const ::rtl::OUString& _rName, const Reference< XInterface >& _rxObject ) throw(Exception, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + ConstRuntimeDriversIterator aSearch = m_aDriversRT.find(_rName); + if (aSearch != m_aDriversRT.end()) + throw ElementExistException(); + + Reference< XDriver > xNewDriver(_rxObject, UNO_QUERY); + if (!xNewDriver.is()) + throw IllegalArgumentException(); + + m_aDriversRT[_rName] = xNewDriver; +} + +//-------------------------------------------------------------------------- +void SAL_CALL OSDBCDriverManager::revokeObject( const ::rtl::OUString& _rName ) throw(Exception, RuntimeException) +{ + MutexGuard aGuard(m_aMutex); + ConstRuntimeDriversIterator aSearch = m_aDriversRT.find(_rName); + if (aSearch == m_aDriversRT.end()) + throw NoSuchElementException(); + + m_aDriversRT.erase(_rName); +} + +//-------------------------------------------------------------------------- +Reference< XDriver > SAL_CALL OSDBCDriverManager::getDriverByURL( const ::rtl::OUString& _rURL ) throw(RuntimeException) +{ + return implGetDriverForURL(_rURL); +} + +//-------------------------------------------------------------------------- +Reference< XDriver > OSDBCDriverManager::implGetDriverForURL(const ::rtl::OUString& _rURL) +{ + // search all bootstrapped drivers + for ( ConstBootstrappedDriversIterator aSearchBS = m_aDriversBS.begin(); + aSearchBS != m_aDriversBS.end(); + ++aSearchBS + ) + { + try + { + if ((*aSearchBS)->acceptsURL(_rURL)) + return *aSearchBS; + } + catch(SQLException&) + { + } + } + + // search all drivers registered at runtime + for ( ConstRuntimeDriversIterator aSearchRT = m_aDriversRT.begin(); + aSearchRT != m_aDriversRT.end(); + ++aSearchRT + ) + { + try + { + if (aSearchRT->second->acceptsURL(_rURL)) + return aSearchRT->second; + } + catch(SQLException&) + { + } + } + + + return Reference< XDriver >(); +} + + diff --git a/connectivity/source/manager/sdbc.map b/connectivity/source/manager/sdbc.map new file mode 100644 index 000000000000..2d8534b22e21 --- /dev/null +++ b/connectivity/source/manager/sdbc.map @@ -0,0 +1,8 @@ +SDBC_1_0 { + global: + component_getImplementationEnvironment; + component_writeInfo; + component_getFactory; + local: + *; +}; diff --git a/connectivity/source/parse/PColumn.cxx b/connectivity/source/parse/PColumn.cxx new file mode 100644 index 000000000000..2644abc2c6f6 --- /dev/null +++ b/connectivity/source/parse/PColumn.cxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * $RCSfile: PColumn.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ +#include "connectivity/PColumn.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif + +using namespace connectivity; +using namespace connectivity::parse; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +// ------------------------------------------------------------------------- +OParseColumn::OParseColumn(const Reference<XFastPropertySet>& _xColumn,sal_Bool _bCase) + : connectivity::sdbcx::OColumn( getString(_xColumn->getFastPropertyValue(PROPERTY_ID_NAME)) + , getString(_xColumn->getFastPropertyValue(PROPERTY_ID_TYPENAME)) + , getString(_xColumn->getFastPropertyValue(PROPERTY_ID_DEFAULTVALUE)) + , getINT32(_xColumn->getFastPropertyValue(PROPERTY_ID_ISNULLABLE)) + , getINT32(_xColumn->getFastPropertyValue(PROPERTY_ID_PRECISION)) + , getINT32(_xColumn->getFastPropertyValue(PROPERTY_ID_SCALE)) + , getINT32(_xColumn->getFastPropertyValue(PROPERTY_ID_TYPE)) + , getBOOL(_xColumn->getFastPropertyValue(PROPERTY_ID_ISAUTOINCREMENT)) + , sal_False + , getBOOL(_xColumn->getFastPropertyValue(PROPERTY_ID_ISCURRENCY)) + , _bCase + ) + , m_bFunction(sal_False) + , m_bDbasePrecisionChanged(sal_False) +{ + construct(); +} +// ------------------------------------------------------------------------- +OParseColumn::OParseColumn( const ::rtl::OUString& _Name, + const ::rtl::OUString& _TypeName, + const ::rtl::OUString& _DefaultValue, + sal_Int32 _IsNullable, + sal_Int32 _Precision, + sal_Int32 _Scale, + sal_Int32 _Type, + sal_Bool _IsAutoIncrement, + sal_Bool _IsCurrency, + sal_Bool _bCase + ) : connectivity::sdbcx::OColumn(_Name, + _TypeName, + _DefaultValue, + _IsNullable, + _Precision, + _Scale, + _Type, + _IsAutoIncrement, + sal_False, + _IsCurrency, + _bCase) + , m_bFunction(sal_False) + , m_bDbasePrecisionChanged(sal_False) +{ + construct(); +} +// ------------------------------------------------------------------------- +OParseColumn::~OParseColumn() +{ +} +// ------------------------------------------------------------------------- +void OParseColumn::construct() +{ + sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY; + + registerProperty(connectivity::PROPERTY_FUNCTION, PROPERTY_ID_FUNCTION, nAttrib,&m_bFunction, ::getCppuType(reinterpret_cast< sal_Bool*>(NULL))); + registerProperty(connectivity::PROPERTY_TABLENAME, PROPERTY_ID_TABLENAME, nAttrib,&m_aTableName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(connectivity::PROPERTY_REALNAME, PROPERTY_ID_REALNAME, nAttrib,&m_aRealName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(connectivity::PROPERTY_DBASEPRECISIONCHANGED, PROPERTY_ID_DBASEPRECISIONCHANGED, nAttrib,&m_bDbasePrecisionChanged, ::getCppuType(reinterpret_cast<sal_Bool*>(NULL))); + +} + diff --git a/connectivity/source/parse/internalnode.cxx b/connectivity/source/parse/internalnode.cxx new file mode 100644 index 000000000000..57d5dbd6d7e6 --- /dev/null +++ b/connectivity/source/parse/internalnode.cxx @@ -0,0 +1,127 @@ +/************************************************************************* + * + * $RCSfile: internalnode.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_SQLINTERNALNODE_HXX +#include "internalnode.hxx" +#endif + +#include <stl_algo.h> +#ifndef _CONNECTIVITY_SQLPARSE_HXX +#include <connectivity/sqlparse.hxx> +#endif +#ifndef _DEBUG_HXX //autogen +#include <tools/debug.hxx> +#endif + +using namespace connectivity; + +//----------------------------------------------------------------------------- +OSQLInternalNode::OSQLInternalNode(const sal_Char* pNewValue, + SQLNodeType eNodeType, + sal_uInt32 nNodeID) + :OSQLParseNode(pNewValue,eNodeType,nNodeID) +{ + DBG_ASSERT(OSQLParser::s_pGarbageCollector, "Collector not initialized") + OSQLParser::s_pGarbageCollector->push_back(this); +} + +//----------------------------------------------------------------------------- +OSQLInternalNode::OSQLInternalNode(const ByteString &_NewValue, + SQLNodeType eNodeType, + sal_uInt32 nNodeID) + :OSQLParseNode(_NewValue,eNodeType,nNodeID) +{ + DBG_ASSERT(OSQLParser::s_pGarbageCollector, "Collector not initialized") + OSQLParser::s_pGarbageCollector->push_back(this); +} + +//----------------------------------------------------------------------------- +OSQLInternalNode::OSQLInternalNode(const sal_Unicode* pNewValue, + SQLNodeType eNodeType, + sal_uInt32 nNodeID) + :OSQLParseNode(pNewValue,eNodeType,nNodeID) +{ + DBG_ASSERT(OSQLParser::s_pGarbageCollector, "Collector not initialized") + OSQLParser::s_pGarbageCollector->push_back(this); +} + +//----------------------------------------------------------------------------- +OSQLInternalNode::OSQLInternalNode(const String &_NewValue, + SQLNodeType eNodeType, + sal_uInt32 nNodeID) + :OSQLParseNode(_NewValue,eNodeType,nNodeID) +{ + DBG_ASSERT(OSQLParser::s_pGarbageCollector, "Collector not initialized") + OSQLParser::s_pGarbageCollector->push_back(this); +} + + +//----------------------------------------------------------------------------- +OSQLInternalNode::~OSQLInternalNode() +{ + // remove the node from the garbage list + DBG_ASSERT(OSQLParser::s_pGarbageCollector, "Collector not initialized") + if (!OSQLParser::s_pGarbageCollector->empty()) + { + OSQLParser::s_pGarbageCollector->erase( + ::std::find(OSQLParser::s_pGarbageCollector->begin(), OSQLParser::s_pGarbageCollector->end(), + this)); + } +} diff --git a/connectivity/source/parse/makefile.mk b/connectivity/source/parse/makefile.mk new file mode 100644 index 000000000000..4d33aac1f973 --- /dev/null +++ b/connectivity/source/parse/makefile.mk @@ -0,0 +1,114 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:14:28 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=connectivity +TARGET=sql + +# --- Settings ----------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/sqlbison.obj \ + $(SLO)$/sqlflex.obj \ + $(SLO)$/PColumn.obj \ + $(SLO)$/sqliterator.obj \ + $(SLO)$/sqlnode.obj \ + $(SLO)$/fcode.obj \ + $(SLO)$/fcomp.obj \ + $(SLO)$/fanalyzer.obj \ + $(SLO)$/internalnode.obj + + +EXCEPTIONSFILES= \ + $(SLO)$/sqlbison.obj \ + $(SLO)$/PColumn.obj \ + $(SLO)$/sqliterator.obj \ + $(SLO)$/internalnode.obj \ + $(SLO)$/fcode.obj \ + $(SLO)$/fcomp.obj \ + $(SLO)$/fanalyzer.obj \ + $(SLO)$/sqlnode.obj + +all: \ + $(MISC)$/sqlflex.cxx \ + $(MISC)$/sqlbison.cxx \ + ALLTAR +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + + +$(MISC)$/sqlflex.cxx: sqlflex.l + +flex -i -8 -PSQLyy -L -o$(MISC)$/sqlflex.cxx sqlflex.l + +$(MISC)$/sqlbison.cxx: sqlbison.y + +bison -v -d -pSQLyy -l -bsql -o$(MISC)$/sqlbison.cxx sqlbison.y + -$(MKDIR) $(OUT)$/inc$/connectivity + +$(COPY) $(MISC)$/sqlbison.cxx.h $(OUT)$/inc$/connectivity$/sqlbison.hxx + diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y new file mode 100644 index 000000000000..f8aa3daf6254 --- /dev/null +++ b/connectivity/source/parse/sqlbison.y @@ -0,0 +1,4232 @@ +%{ +//-------------------------------------------------------------------------- +// +// $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/connectivity/source/parse/sqlbison.y,v 1.1.1.1 2000-09-18 16:14:28 hr Exp $ +// +// Copyright 2000 Sun Microsystems, Inc. All Rights Reserved. +// +// First creation: +// OJ +// +// Last change: +// $Author: hr $ $Date: 2000-09-18 16:14:28 $ $Revision: 1.1.1.1 $ +// +// Description: +// +// +//-------------------------------------------------------------------------- + +#ifndef _VECTOR_ +#include <vector> +#endif + +#ifndef _SOLAR_H +#include <tools/solar.h> +#endif + +#ifndef _CONNECTIVITY_SQLNODE_HXX +#include <connectivity/sqlnode.hxx> +#endif +#ifndef _CONNECTIVITY_SQLPARSE_HXX +#include <connectivity/sqlparse.hxx> +#endif +#ifndef _CONNECTIVITY_SQLINTERNALNODE_HXX +#include <internalnode.hxx> +#endif +#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_ +#include <com/sun/star/lang/Locale.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_DATE_HPP_ +#include <com/sun/star/util/Date.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATTER_HPP_ +#include <com/sun/star/util/XNumberFormatter.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATSSUPPLIER_HPP_ +#include <com/sun/star/util/XNumberFormatsSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATS_HPP_ +#include <com/sun/star/util/XNumberFormats.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_NUMBERFORMAT_HPP_ +#include <com/sun/star/util/NumberFormat.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATTYPES_HPP_ +#include <com/sun/star/util/XNumberFormatTypes.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include <com/sun/star/beans/XPropertySet.hpp> +#endif +#ifndef _TOOLS_SOLMATH_HXX //autogen wg. SolarMath +#include <tools/solmath.hxx> +#endif +#ifndef _ISOLANG_HXX +#include <tools/isolang.hxx> +#endif +#ifndef _DATETIME_HXX +#include <tools/datetime.hxx> +#endif +#ifndef _TOOLS_INTN_HXX //autogen wg. International +#include <tools/intn.hxx> +#endif +#ifndef _CONNECTIVITY_SQLSCAN_HXX +#include "sqlscan.hxx" +#endif +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif + +static String aEmptyString; + +static connectivity::OSQLInternalNode* newNode(const sal_Char* pNewValue, + const connectivity::SQLNodeType eNodeType, + const UINT16 nNodeID = 0) +{ + + return new connectivity::OSQLInternalNode(pNewValue, eNodeType, nNodeID); +} + +static connectivity::OSQLInternalNode* newNode(const ByteString& _NewValue, + const connectivity::SQLNodeType eNodeType, + const UINT16 nNodeID = 0) +{ + + return new connectivity::OSQLInternalNode(_NewValue, eNodeType, nNodeID); +} + +static connectivity::OSQLInternalNode* newNode(const String& _NewValue, + const connectivity::SQLNodeType eNodeType, + const UINT16 nNodeID = 0) +{ + + return new connectivity::OSQLInternalNode(_NewValue, eNodeType, nNodeID); +} + + +// yyi ist die interne Nr. der Regel, die gerade reduziert wird. +// Ueber die Mapping-Tabelle yyrmap wird daraus eine externe Regel-Nr. +#define SQL_NEW_RULE newNode(aEmptyString, SQL_NODE_RULE, yyr1[yyn]) +#define SQL_NEW_LISTRULE newNode(aEmptyString, SQL_NODE_LISTRULE, yyr1[yyn]) +#define SQL_NEW_COMMALISTRULE newNode(aEmptyString, SQL_NODE_COMMALISTRULE, yyr1[yyn]) + + +connectivity::OSQLParser* xxx_pGLOBAL_SQLPARSER; + +#define YYERROR_VERBOSE + +#define SQLyyerror(s) \ +{ \ + xxx_pGLOBAL_SQLPARSER->error(s); \ +} + +using namespace connectivity; +#define SQLyylex xxx_pGLOBAL_SQLPARSER->SQLlex +%} + /* symbolic tokens */ + +%union { + connectivity::OSQLParseNode * pParseNode; +} +%type <pParseNode> '(' ')' ',' ':' ';' '?' '[' ']' '{' '}' '.' + +%token <pParseNode> SQL_TOKEN_STRING SQL_TOKEN_ACCESS_DATE SQL_TOKEN_INT SQL_TOKEN_REAL_NUM +%token <pParseNode> SQL_TOKEN_INTNUM SQL_TOKEN_APPROXNUM SQL_TOKEN_NOT SQL_TOKEN_NAME + + /* operators */ +%left <pParseNode> SQL_TOKEN_NAME +%left <pParseNode> SQL_TOKEN_OR +%left <pParseNode> SQL_TOKEN_AND + +%left <pParseNode> LESSEQ GREATEQ NOTEQUAL LESS GREAT EQUAL /* '<' '>' = <> < > <= >= != */ +%left <pParseNode> '+' '-' +%left <pParseNode> '*' '/' +%left <pParseNode> SQL_TOKEN_NATURAL SQL_TOKEN_CROSS SQL_TOKEN_FULL SQL_TOKEN_LEFT SQL_TOKEN_RIGHT +%left <pParseNode> ')' +%right <pParseNode> '=' +%right <pParseNode> '.' +%right <pParseNode> '(' + + +%nonassoc <pParseNode> SQL_TOKEN_UMINUS + + + + /* literal keyword tokens */ + +%token <pParseNode> SQL_TOKEN_ALL SQL_TOKEN_ALTER SQL_TOKEN_AMMSC SQL_TOKEN_ANY SQL_TOKEN_AS SQL_TOKEN_ASC SQL_TOKEN_AT SQL_TOKEN_AUTHORIZATION SQL_TOKEN_AVG + +%token <pParseNode> SQL_TOKEN_BETWEEN SQL_TOKEN_BIT SQL_TOKEN_BIT_LENGTH SQL_TOKEN_BOTH SQL_TOKEN_BY + +%token <pParseNode> SQL_TOKEN_CAST SQL_TOKEN_CHARACTER SQL_TOKEN_CHAR_LENGTH SQL_TOKEN_CHECK SQL_TOKEN_COLLATE SQL_TOKEN_COMMIT SQL_TOKEN_CONTINUE SQL_TOKEN_CONVERT SQL_TOKEN_COUNT SQL_TOKEN_CREATE SQL_TOKEN_CROSS +%token <pParseNode> SQL_TOKEN_CURRENT SQL_TOKEN_CURRENT_DATE SQL_TOKEN_CURRENT_TIME SQL_TOKEN_CURRENT_TIMESTAMP SQL_TOKEN_CURSOR + +%token <pParseNode> SQL_TOKEN_DATE SQL_TOKEN_DAY SQL_TOKEN_DEC SQL_TOKEN_DECIMAL SQL_TOKEN_DECLARE SQL_TOKEN_DEFAULT SQL_TOKEN_DELETE SQL_TOKEN_DESC +%token <pParseNode> SQL_TOKEN_DISTINCT SQL_TOKEN_DOUBLE SQL_TOKEN_DROP + +%token <pParseNode> SQL_TOKEN_ESCAPE SQL_TOKEN_EXCEPT SQL_TOKEN_EXISTS SQL_TOKEN_EXTRACT SQL_TOKEN_FALSE SQL_TOKEN_FETCH SQL_TOKEN_FLOAT SQL_TOKEN_FOR SQL_TOKEN_FOREIGN SQL_TOKEN_FOUND SQL_TOKEN_FROM SQL_TOKEN_FULL + +%token <pParseNode> SQL_TOKEN_GRANT SQL_TOKEN_GROUP SQL_TOKEN_HAVING SQL_TOKEN_HOUR SQL_TOKEN_IN SQL_TOKEN_INDICATOR SQL_TOKEN_INNER SQL_TOKEN_INSERT SQL_TOKEN_INTEGER SQL_TOKEN_INTO SQL_TOKEN_IS SQL_TOKEN_INTERSECT + +%token <pParseNode> SQL_TOKEN_JOIN SQL_TOKEN_KEY SQL_TOKEN_LEADING SQL_TOKEN_LEFT SQL_TOKEN_LIKE SQL_TOKEN_LOCAL SQL_TOKEN_LOWER SQL_TOKEN_MINUTE SQL_TOKEN_MONTH +%token <pParseNode> SQL_TOKEN_MAX SQL_TOKEN_MIN SQL_TOKEN_NATURAL SQL_TOKEN_NCHAR SQL_TOKEN_NULL SQL_TOKEN_NUMERIC + +%token <pParseNode> SQL_TOKEN_OCTECT_LENGTH SQL_TOKEN_OF SQL_TOKEN_ON SQL_TOKEN_OPTION SQL_TOKEN_ORDER SQL_TOKEN_OUTER + +%token <pParseNode> SQL_TOKEN_POSITION SQL_TOKEN_PRECISION SQL_TOKEN_PRIMARY SQL_TOKEN_PRIVILEGES SQL_TOKEN_PROCEDURE SQL_TOKEN_PUBLIC +%token <pParseNode> SQL_TOKEN_REAL SQL_TOKEN_REFERENCES SQL_TOKEN_ROLLBACK SQL_TOKEN_RIGHT + +%token <pParseNode> SQL_TOKEN_SCHEMA SQL_TOKEN_SECOND SQL_TOKEN_SELECT SQL_TOKEN_SET SQL_TOKEN_SIZE SQL_TOKEN_SMALLINT SQL_TOKEN_SOME SQL_TOKEN_SQLCODE SQL_TOKEN_SQLERROR SQL_TOKEN_SUBSTRING SQL_TOKEN_SUM + +%token <pParseNode> SQL_TOKEN_TABLE SQL_TOKEN_TIME SQL_TOKEN_TIMESTAMP SQL_TOKEN_TIMEZONE_HOUR SQL_TOKEN_TIMEZONE_MINUTE SQL_TOKEN_TO SQL_TOKEN_TRAILING SQL_TOKEN_TRANSLATE SQL_TOKEN_TRIM SQL_TOKEN_TRUE SQL_TOKEN_UNION +%token <pParseNode> SQL_TOKEN_UNIQUE SQL_TOKEN_UNKNOWN SQL_TOKEN_UPDATE SQL_TOKEN_UPPER SQL_TOKEN_USAGE SQL_TOKEN_USER SQL_TOKEN_USING SQL_TOKEN_VALUES SQL_TOKEN_VIEW +%token <pParseNode> SQL_TOKEN_WHERE SQL_TOKEN_WITH SQL_TOKEN_WORK SQL_TOKEN_YEAR SQL_TOKEN_ZONE + +/* ODBC KEYWORDS */ +%token <pParseNode> SQL_TOKEN_CALL SQL_TOKEN_D SQL_TOKEN_FN SQL_TOKEN_T SQL_TOKEN_TS SQL_TOKEN_OJ + + +%token <pParseNode> SQL_TOKEN_INVALIDSYMBOL + +/*%type <pParseNode> sql_single_statement */ + +%type <pParseNode> sql /*schema */ +%type <pParseNode> column_def_opt_list column_def_opt table_constraint_def column_commalist +%type <pParseNode> view_def opt_with_check_option opt_column_commalist privilege_def +%type <pParseNode> opt_with_grant_option privileges operation_commalist operation +%type <pParseNode> grantee_commalist grantee opt_order_by_clause ordering_spec_commalist +%type <pParseNode> ordering_spec opt_asc_desc manipulative_statement commit_statement +%type <pParseNode> /*delete_statement_positioned*/ delete_statement_searched fetch_statement +%type <pParseNode> insert_statement values_or_query_spec +%type <pParseNode> rollback_statement select_statement_into opt_all_distinct +%type <pParseNode> /*update_statement_positioned*/ assignment_commalist assignment +%type <pParseNode> update_statement_searched target_commalist target opt_where_clause +%type <pParseNode> select_statement selection table_exp from_clause table_ref_commalist table_ref +%type <pParseNode> where_clause opt_group_by_clause column_ref_commalist opt_having_clause +%type <pParseNode> search_condition predicate comparison_predicate between_predicate +%type <pParseNode> like_predicate opt_escape test_for_null in_predicate +%type <pParseNode> all_or_any_predicate any_all_some existence_test subquery +%type <pParseNode> scalar_exp_commalist parameter_ref literal +%type <pParseNode> column_ref data_type column cursor parameter range_variable user /*like_check*/ +/* neue Regeln bei OJ */ +%type <pParseNode> derived_column as_clause table_name num_primary term num_value_exp +%type <pParseNode> value_exp_primary num_value_fct unsigned_value_spec cast_spec set_fct_spec scalar_subquery +%type <pParseNode> position_exp extract_exp length_exp general_value_spec +%type <pParseNode> general_set_fct set_fct_type query_exp non_join_query_exp joined_table +%type <pParseNode> non_join_query_term non_join_query_primary simple_table +%type <pParseNode> table_value_const_list row_value_constructor row_value_const_list row_value_constructor_elem +%type <pParseNode> qualified_join value_exp query_term join_type outer_join_type join_condition boolean_term +%type <pParseNode> boolean_factor truth_value boolean_test boolean_primary named_columns_join join_spec +%type <pParseNode> cast_operand cast_target factor datetime_value_exp /*interval_value_exp*/ datetime_term datetime_factor +%type <pParseNode> datetime_primary datetime_value_fct time_zone time_zone_specifier /*interval_term*/ /*interval_qualifier*/ +%type <pParseNode> /*start_field*/ non_second_datetime_field /*end_field*/ /*single_datetime_field*/ extract_field datetime_field time_zone_field +%type <pParseNode> extract_source char_length_exp octet_length_exp bit_length_exp select_sublist string_value_exp +%type <pParseNode> char_value_exp concatenation char_factor char_primary string_value_fct char_substring_fct fold +%type <pParseNode> form_conversion char_translation trim_fct trim_operands trim_spec bit_value_fct bit_substring_fct op_column_commalist +%type <pParseNode> /*bit_concatenation*/ bit_value_exp bit_factor bit_primary collate_clause char_value_fct unique_spec value_exp_commalist in_predicate_value unique_test update_source +%type <pParseNode> all query_primary as not for_length upper_lower comparison column_val cross_union /*opt_schema_element_list*/ +%type <pParseNode> /*op_authorization op_schema*/ nil_fkt schema_element base_table_def base_table_element base_table_element_commalist +%type <pParseNode> column_def odbc_fct_spec odbc_call_spec odbc_fct_type op_parameter union_statement +%type <pParseNode> op_odbc_call_parameter odbc_parameter_commalist odbc_parameter +%% + +/* Parse Tree an OSQLParser zurueckliefern + * (der Zugriff ueber yyval nach Aufruf des Parsers scheitert, + * + */ +sql_single_statement: + sql + { xxx_pGLOBAL_SQLPARSER->setParseTree( $1 ); } + | sql ';' + { xxx_pGLOBAL_SQLPARSER->setParseTree( $1 ); } + ; +/* +sql_list: + sql_ ';' + {$$ = SQL_NEW_LISTRULE; + $$->append($1); + pSqlParseTreeRoot = $1; -- obsolete - Ergebnis in yyval! rdm } + | sql_list sql ';' + {$1->append($2); + $$ = $1;} + ; +*/ + + + /* schema definition language */ + /* Note: other ``sql:'' rules appear later in the grammar */ +/*** +sql: + schema + ; + +op_authorization: + {$$ = SQL_NEW_RULE;} + | SQL_TOKEN_AUTHORIZATION user + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +op_schema: + {$$ = SQL_NEW_RULE;} + | SQL_TOKEN_NAME + | SQL_TOKEN_NAME '.' SQL_TOKEN_NAME + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode(".", SQL_NODE_PUNCTUATION)); + $$->append($3); + } + ; + +schema: + SQL_TOKEN_CREATE SQL_TOKEN_SCHEMA op_schema op_authorization opt_schema_element_list + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + $$->append($5); + } + ; + +opt_schema_element_list: + /* empty * / {$$ = SQL_NEW_RULE;} + | schema_glement_list + ; + +schema_element_list: + schema_element + {$$ = SQL_NEW_LISTRULE; + $$->append($1);} + | schema_element_list schema_element + {$1->append($2); + $$ = $1;} + ; +*/ +sql: + schema_element + {$$ = SQL_NEW_RULE; + $$->append($1); + } + ; + +schema_element: + base_table_def + | view_def + | privilege_def + ; + +base_table_def: + SQL_TOKEN_CREATE SQL_TOKEN_TABLE table_name '(' base_table_element_commalist ')' + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($5); + $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION));} + ; + +base_table_element_commalist: + base_table_element + {$$ = SQL_NEW_COMMALISTRULE; + $$->append($1);} + | base_table_element_commalist ',' base_table_element + {$1->append($3); + $$ = $1;} + ; + +base_table_element: + column_def + | table_constraint_def + ; + +column_def: + column data_type column_def_opt_list + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; + +column_def_opt_list: + /* empty */ {$$ = SQL_NEW_LISTRULE;} + | column_def_opt_list column_def_opt + {$1->append($2); + $$ = $1;} + ; + +nil_fkt: + datetime_value_fct + ; +unique_spec: + SQL_TOKEN_UNIQUE + | SQL_TOKEN_PRIMARY SQL_TOKEN_KEY + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +column_def_opt: + SQL_TOKEN_NOT SQL_TOKEN_NULL + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2);} + | unique_spec + | SQL_TOKEN_DEFAULT literal + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2);} + | SQL_TOKEN_DEFAULT SQL_TOKEN_NULL + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2);} + | SQL_TOKEN_DEFAULT SQL_TOKEN_USER + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2);} + | SQL_TOKEN_DEFAULT nil_fkt + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | SQL_TOKEN_CHECK + | SQL_TOKEN_CHECK '(' search_condition ')' + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION));} + | SQL_TOKEN_REFERENCES table_name + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2);} + | SQL_TOKEN_REFERENCES table_name '(' column_commalist ')' + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($4); + $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION));} + ; + +table_constraint_def: + unique_spec '(' column_commalist ')' + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION));} + | SQL_TOKEN_FOREIGN SQL_TOKEN_KEY '(' column_commalist ')' SQL_TOKEN_REFERENCES table_name + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($4); + $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION)); + $$->append($6); + $$->append($7);} + | SQL_TOKEN_FOREIGN SQL_TOKEN_KEY '(' column_commalist ')' SQL_TOKEN_REFERENCES table_name '(' column_commalist ')' + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($4); + $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION)); + $$->append($6); + $$->append($7); + $$->append($8 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($9); + $$->append($10 = newNode(")", SQL_NODE_PUNCTUATION));} + | SQL_TOKEN_CHECK '(' search_condition ')' + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION));} + ; +op_column_commalist: + /* empty */ {$$ = SQL_NEW_RULE;} + | '(' column_commalist ')' + {$$ = SQL_NEW_RULE; + $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +column_commalist: + column_commalist ',' column + {$1->append($3); + $$ = $1;} + | column + {$$ = SQL_NEW_COMMALISTRULE; + $$->append($1);} + ; + +view_def: + SQL_TOKEN_CREATE SQL_TOKEN_VIEW table_name opt_column_commalist SQL_TOKEN_AS select_statement opt_with_check_option + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + $$->append($5); + $$->append($6); + $$->append($7);} + ; + +opt_with_check_option: + /* empty */ {$$ = SQL_NEW_RULE;} + | SQL_TOKEN_WITH SQL_TOKEN_CHECK SQL_TOKEN_OPTION + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3);} + ; + +opt_column_commalist: + /* empty */ {$$ = SQL_NEW_RULE;} + | '(' column_commalist ')' + {$$ = SQL_NEW_RULE; + $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION));} + ; + +privilege_def: + SQL_TOKEN_GRANT privileges SQL_TOKEN_ON table_name SQL_TOKEN_TO grantee_commalist + opt_with_grant_option + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + $$->append($5); + $$->append($6); + $$->append($7);} + ; + +opt_with_grant_option: + /* empty */ {$$ = SQL_NEW_RULE;} + | SQL_TOKEN_WITH SQL_TOKEN_GRANT SQL_TOKEN_OPTION + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3);} + ; + +privileges: + SQL_TOKEN_ALL SQL_TOKEN_PRIVILEGES + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2);} + | operation_commalist + ; + +operation_commalist: + operation + {$$ = SQL_NEW_COMMALISTRULE; + $$->append($1);} + | operation_commalist ',' operation + {$1->append($3); + $$ = $1;} + ; + +operation: + SQL_TOKEN_SELECT + | SQL_TOKEN_INSERT opt_column_commalist + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2);} + | SQL_TOKEN_DELETE + | SQL_TOKEN_UPDATE opt_column_commalist + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2);} + | SQL_TOKEN_REFERENCES opt_column_commalist + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2);} + | SQL_TOKEN_USAGE + ; + + +grantee_commalist: + grantee + {$$ = SQL_NEW_COMMALISTRULE; + $$->append($1);} + | grantee_commalist ',' grantee + {$1->append($3); + $$ = $1;} + ; + +grantee: + SQL_TOKEN_PUBLIC + | user + ; + + /* module language */ + +opt_order_by_clause: + /* empty */ {$$ = SQL_NEW_RULE;} + | SQL_TOKEN_ORDER SQL_TOKEN_BY ordering_spec_commalist + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3);} + ; + +ordering_spec_commalist: + ordering_spec + {$$ = SQL_NEW_COMMALISTRULE; + $$->append($1);} + | ordering_spec_commalist ',' ordering_spec + {$1->append($3); + $$ = $1;} + ; + +ordering_spec: +/* SQL_TOKEN_INTNUM opt_asc_desc + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2);} +*/ + predicate opt_asc_desc + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2);} + + | row_value_constructor_elem opt_asc_desc + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2);} + ; + +opt_asc_desc: + {$$ = SQL_NEW_RULE;} + | SQL_TOKEN_ASC + | SQL_TOKEN_DESC + ; + + +/*** +manipulative_statement_list: + manipulative_statement + {$$ = SQL_NEW_LISTRULE; + $$->append($1);} + | manipulative_statement_list manipulative_statement + {$1->append($2); + $$ = $1;} + ; +***/ + +sql: + {$$ = SQL_NEW_LISTRULE;} + ; +not: + {$$ = SQL_NEW_RULE;} + | SQL_TOKEN_NOT + ; + /* manipulative statements */ + +sql: manipulative_statement + ; + +manipulative_statement: + commit_statement +/* | delete_statement_positioned*/ + | delete_statement_searched + | fetch_statement + | insert_statement + | rollback_statement + | select_statement_into +/* | update_statement_positioned*/ + | update_statement_searched + | union_statement + | '{' odbc_call_spec '}' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("{", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode("}", SQL_NODE_PUNCTUATION)); + } + ; + +union_statement: + select_statement + | union_statement SQL_TOKEN_UNION all select_statement + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + ; +commit_statement: + SQL_TOKEN_COMMIT SQL_TOKEN_WORK + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2);} + ; +/* +delete_statement_positioned: + SQL_TOKEN_DELETE SQL_TOKEN_FROM table_name SQL_TOKEN_WHERE SQL_TOKEN_CURRENT SQL_TOKEN_OF cursor + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + $$->append($5); + $$->append($6); + $$->append($7);} + ; +*/ +delete_statement_searched: + SQL_TOKEN_DELETE SQL_TOKEN_FROM table_name opt_where_clause + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4);} + ; + +fetch_statement: + SQL_TOKEN_FETCH cursor SQL_TOKEN_INTO target_commalist + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4);} + ; + +insert_statement: + SQL_TOKEN_INSERT SQL_TOKEN_INTO table_name opt_column_commalist values_or_query_spec + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + $$->append($5);} + ; +values_or_query_spec: + SQL_TOKEN_VALUES table_value_const_list + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; + +table_value_const_list: + row_value_constructor + {$$ = SQL_NEW_COMMALISTRULE; + $$->append($1);} + | table_value_const_list ',' row_value_constructor + {$1->append($3); + $$ = $1;} + ; +row_value_const_list: + row_value_constructor_elem + {$$ = SQL_NEW_COMMALISTRULE; + $$->append($1);} + | row_value_const_list ',' row_value_constructor_elem + {$1->append($3); + $$ = $1;} + ; +row_value_constructor: + row_value_constructor_elem + | '(' row_value_const_list ')' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); + } +/* | subquery + { + $$ = SQL_NEW_RULE; + $$->append($1); + }*/ + ; +row_value_constructor_elem: + value_exp /*[^')']*/ + | SQL_TOKEN_NULL + | SQL_TOKEN_DEFAULT + ; + + +rollback_statement: + SQL_TOKEN_ROLLBACK SQL_TOKEN_WORK + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2);} + ; + + + /* INTO target_commalist herausgenommen */ +select_statement_into: + SQL_TOKEN_SELECT opt_all_distinct selection SQL_TOKEN_INTO target_commalist table_exp + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + $$->append($5); + $$->append($6); } + ; + +opt_all_distinct: + {$$ = SQL_NEW_RULE;} + | SQL_TOKEN_ALL + | SQL_TOKEN_DISTINCT + + ; +/* +update_statement_positioned: + SQL_TOKEN_UPDATE table_name SQL_TOKEN_SET assignment_commalist + SQL_TOKEN_WHERE SQL_TOKEN_CURRENT SQL_TOKEN_OF cursor + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + $$->append($5); + $$->append($6); + $$->append($7); + $$->append($8);} + ; +*/ +assignment_commalist: + assignment + {$$ = SQL_NEW_COMMALISTRULE; + $$->append($1);} + | assignment_commalist ',' assignment + {$1->append($3); + $$ = $1;} + ; + +assignment: + column EQUAL update_source + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3);} + ; +update_source: + value_exp + | SQL_TOKEN_NULL + | SQL_TOKEN_DEFAULT + ; +update_statement_searched: + SQL_TOKEN_UPDATE table_name SQL_TOKEN_SET assignment_commalist opt_where_clause + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + $$->append($5);} + ; + +target_commalist: + target + {$$ = SQL_NEW_COMMALISTRULE; + $$->append($1);} + | target_commalist ',' target + {$1->append($3); + $$ = $1;} + ; + +target: + parameter_ref + ; + +opt_where_clause: + /* empty */ {$$ = SQL_NEW_RULE;} + | where_clause + ; + + /* query expressions */ + +query_term: + non_join_query_term + { + $$ = SQL_NEW_RULE; + $$->append($1); + } +/* | joined_table + { + $$ = SQL_NEW_RULE; + $$->append($1); + } +*/ ; +/* SELECT STATEMENT */ +select_statement: + SQL_TOKEN_SELECT opt_all_distinct selection table_exp + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + ; + +selection: + '*' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("*", SQL_NODE_PUNCTUATION)); + } + | scalar_exp_commalist + ; + +table_exp: + from_clause + opt_where_clause + opt_group_by_clause + opt_having_clause + opt_order_by_clause + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + $$->append($5);} + ; + +from_clause: + SQL_TOKEN_FROM table_ref_commalist + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2);} + ; + +table_ref_commalist: + table_ref + {$$ = SQL_NEW_COMMALISTRULE; + $$->append($1);} + | table_ref_commalist ',' table_ref /*[^SQL_TOKEN_CROSS SQL_TOKEN_FULL SQL_TOKEN_UNION SQL_TOKEN_LEFT SQL_TOKEN_RIGHT SQL_TOKEN_INNER SQL_TOKEN_NATURAL]*/ + {$1->append($3); + $$ = $1;} + ; +as: + {$$ = SQL_NEW_RULE;} + | SQL_TOKEN_AS + { + $$ = SQL_NEW_RULE; + } + ; +table_ref: + table_name + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | table_name as range_variable op_column_commalist + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | '(' joined_table ')' as range_variable op_column_commalist + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); + $$->append($4); + $$->append($5); + $$->append($6); + } + | joined_table + | '{' SQL_TOKEN_OJ joined_table '}' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("{", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3); + $$->append($4 = newNode("}", SQL_NODE_PUNCTUATION)); + } + ; +where_clause: + SQL_TOKEN_WHERE search_condition + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2);} + ; + +opt_group_by_clause: + /* empty */ {$$ = SQL_NEW_RULE;} + | SQL_TOKEN_GROUP SQL_TOKEN_BY column_ref_commalist + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3);} + ; + +column_ref_commalist: + column_ref + {$$ = SQL_NEW_COMMALISTRULE; + $$->append($1);} + | column_ref_commalist ',' column_ref + {$1->append($3); + $$ = $1;} + ; + +opt_having_clause: + /* empty */ {$$ = SQL_NEW_RULE;} + | SQL_TOKEN_HAVING search_condition + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2);} + ; + + /* search conditions */ +truth_value: + SQL_TOKEN_TRUE + | SQL_TOKEN_FALSE + | SQL_TOKEN_UNKNOWN + ; +boolean_primary: + predicate + | '(' search_condition ')' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +subroutine: + { + if(!xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) + YYERROR; + } + ; +boolean_test: + boolean_primary + | boolean_primary SQL_TOKEN_IS truth_value + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + | boolean_primary SQL_TOKEN_IS SQL_TOKEN_NOT truth_value %prec SQL_TOKEN_IS + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | subroutine SQL_TOKEN_NOT SQL_TOKEN_LIKE string_value_exp opt_escape + { + if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) + { + OSQLParseNode* pColumnRef = newNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::column_ref)); + pColumnRef->append(newNode(xxx_pGLOBAL_SQLPARSER->getFieldName(),SQL_NODE_NAME)); + + $$ = SQL_NEW_RULE; + $$->append(pColumnRef); + $$->append($2); + $$->append($3); + if (xxx_pGLOBAL_SQLPARSER->buildLikeRule($$,$4,$5)) + $$->append($5); + else + { + delete $$; + YYABORT; + } + } + else + YYERROR; + } + ; +boolean_factor: + boolean_test + | SQL_TOKEN_NOT boolean_test + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +boolean_term: + boolean_factor + | boolean_term SQL_TOKEN_AND boolean_factor + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + | row_value_constructor_elem '\n' /*[^')' ',']*/ + { + $$ = SQL_NEW_RULE; + INT16 nErg = xxx_pGLOBAL_SQLPARSER->buildComparsionRule($$,$1); + if(nErg == 1) + { + OSQLParseNode* pTemp = $$; + $$ = pTemp->removeAt((ULONG)0); + delete pTemp; + } + else + { + delete $$; + if(nErg) + YYERROR; + else + YYABORT; + } + } + | boolean_term SQL_TOKEN_AND literal + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + INT16 nErg = xxx_pGLOBAL_SQLPARSER->buildComparsionRule($$,$3); + if(nErg < 1) + { + delete $$; + if(nErg) + YYERROR; + else + YYABORT; + } + + } + | boolean_term SQL_TOKEN_AND SQL_TOKEN_STRING + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + INT16 nErg = xxx_pGLOBAL_SQLPARSER->buildComparsionRule($$,$3); + if(nErg < 1) + { + delete $$; + if(nErg) + YYERROR; + else + YYABORT; + } + + } + ; +search_condition: + boolean_term + | search_condition SQL_TOKEN_OR boolean_term + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; +predicate: + comparison_predicate + | between_predicate + | all_or_any_predicate + | existence_test + | unique_test + | test_for_null + | in_predicate + | like_predicate + ; + +comparison_predicate: + row_value_constructor comparison row_value_constructor + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + | comparison row_value_constructor + { + $$ = SQL_NEW_RULE; + INT16 nErg = xxx_pGLOBAL_SQLPARSER->buildComparsionRule($$,$2,$1); + if(nErg == 1) + { + OSQLParseNode* pTemp = $$; + $$ = pTemp->removeAt((ULONG)0); + delete pTemp; + } + else + { + delete $$; + YYABORT; + } + } + ; +comparison: + LESS + | NOTEQUAL + | EQUAL + | GREAT + | LESSEQ + | GREATEQ + ; +between_predicate: + row_value_constructor SQL_TOKEN_BETWEEN row_value_constructor SQL_TOKEN_AND row_value_constructor + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + $$->append($5); + } + | row_value_constructor SQL_TOKEN_NOT SQL_TOKEN_BETWEEN row_value_constructor SQL_TOKEN_AND row_value_constructor + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + $$->append($5); + $$->append($6); + } + | subroutine SQL_TOKEN_NOT SQL_TOKEN_BETWEEN row_value_constructor SQL_TOKEN_AND row_value_constructor + { + if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) + { + OSQLParseNode* pColumnRef = newNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::column_ref)); + pColumnRef->append(newNode(xxx_pGLOBAL_SQLPARSER->getFieldName(),SQL_NODE_NAME)); + + $$ = SQL_NEW_RULE; + $$->append(pColumnRef); + $$->append($2); + $$->append($3); + $$->append($4); + $$->append($5); + $$->append($6); + } + else + YYERROR; + } + | subroutine SQL_TOKEN_BETWEEN row_value_constructor SQL_TOKEN_AND row_value_constructor + { + if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) + { + OSQLParseNode* pColumnRef = newNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::column_ref)); + pColumnRef->append(newNode(xxx_pGLOBAL_SQLPARSER->getFieldName(),SQL_NODE_NAME)); + + $$ = SQL_NEW_RULE; + $$->append(pColumnRef); + $$->append($2); + $$->append($3); + $$->append($4); + $$->append($5); + } + else + YYERROR; + } + ; + +like_predicate: + row_value_constructor SQL_TOKEN_NOT SQL_TOKEN_LIKE string_value_exp opt_escape + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + $$->append($5); + } + | row_value_constructor SQL_TOKEN_LIKE string_value_exp opt_escape + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | row_value_constructor SQL_TOKEN_NOT SQL_TOKEN_LIKE value_exp_primary opt_escape + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + $$->append($5); + } + | row_value_constructor SQL_TOKEN_LIKE value_exp_primary opt_escape + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + /*| SQL_TOKEN_NOT + { + if(!xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) + YYERROR; + } SQL_TOKEN_LIKE string_value_exp opt_escape + { + if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) + { + OSQLParseNode* pColumnRef = newNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::column_ref)); + pColumnRef->append(newNode(xxx_pGLOBAL_SQLPARSER->getFieldName(),SQL_NODE_NAME)); + + $$ = SQL_NEW_RULE; + $$->append(pColumnRef); + $$->append($1); + $$->append($3); + if (xxx_pGLOBAL_SQLPARSER->buildLikeRule($$,$4,$5)) + $$->append($5); + else + { + delete $$; + YYABORT; + } + } + else + YYERROR; + } + */| SQL_TOKEN_LIKE string_value_exp opt_escape + { + if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) + { + OSQLParseNode* pColumnRef = newNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::column_ref)); + pColumnRef->append(newNode(xxx_pGLOBAL_SQLPARSER->getFieldName(),SQL_NODE_NAME)); + + $$ = SQL_NEW_RULE; + $$->append(pColumnRef); + $$->append($1); + if (xxx_pGLOBAL_SQLPARSER->buildLikeRule($$,$2,$3)) + $$->append($3); + else + { + delete $$; + YYABORT; + } + } + else + YYERROR; + } + | SQL_TOKEN_LIKE value_exp_primary opt_escape + { + if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) + { + OSQLParseNode* pColumnRef = newNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::column_ref)); + pColumnRef->append(newNode(xxx_pGLOBAL_SQLPARSER->getFieldName(),SQL_NODE_NAME)); + + $$ = SQL_NEW_RULE; + $$->append(pColumnRef); + $$->append($1); + if (xxx_pGLOBAL_SQLPARSER->buildLikeRule($$,$2,$3)) + $$->append($3); + else + { + delete $$; + YYABORT; + } + } + else + YYERROR; + } + | subroutine SQL_TOKEN_NOT SQL_TOKEN_LIKE value_exp_primary opt_escape + { + if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) + { + OSQLParseNode* pColumnRef = newNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::column_ref)); + pColumnRef->append(newNode(xxx_pGLOBAL_SQLPARSER->getFieldName(),SQL_NODE_NAME)); + + $$ = SQL_NEW_RULE; + $$->append(pColumnRef); + $$->append($2); + $$->append($3); + if (xxx_pGLOBAL_SQLPARSER->buildLikeRule($$,$4,$5)) + $$->append($5); + else + { + delete $$; + YYABORT; + } + } + else + YYERROR; + } + ; + +opt_escape: + /* empty */ {$$ = SQL_NEW_RULE;} + | SQL_TOKEN_ESCAPE string_value_exp + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2);} + | '{' SQL_TOKEN_ESCAPE SQL_TOKEN_STRING '}' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("{", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3); + $$->append($4 = newNode("}", SQL_NODE_PUNCTUATION)); + } + ; + +test_for_null: + row_value_constructor SQL_TOKEN_IS not SQL_TOKEN_NULL + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | SQL_TOKEN_IS not SQL_TOKEN_NULL + { + if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) + { + OSQLParseNode* pColumnRef = newNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::column_ref)); + pColumnRef->append(newNode(xxx_pGLOBAL_SQLPARSER->getFieldName(),SQL_NODE_NAME)); + + $$ = SQL_NEW_RULE; + $$->append(pColumnRef); + $$->append($1); + $$->append($2); + $$->append($3); + } + else + YYERROR; + } + ; +in_predicate_value: + subquery + {$$ = SQL_NEW_RULE; + $$->append($1); + } + | '(' value_exp_commalist ')' + {$$ = SQL_NEW_RULE; + $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +in_predicate: + row_value_constructor not SQL_TOKEN_IN in_predicate_value + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | subroutine SQL_TOKEN_IN in_predicate_value + { + if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) + { + OSQLParseNode* pColumnRef = newNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::column_ref)); + pColumnRef->append(newNode(xxx_pGLOBAL_SQLPARSER->getFieldName(),SQL_NODE_NAME)); + + $$ = SQL_NEW_RULE; + $$->append(pColumnRef); + $$->append($2); + $$->append($3); + /*$$->append($3);*/ + } + else + YYERROR; + } + ; +all_or_any_predicate: + row_value_constructor comparison any_all_some subquery + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | comparison any_all_some subquery + { + if(xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) + { + OSQLParseNode* pColumnRef = newNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::column_ref)); + pColumnRef->append(newNode(xxx_pGLOBAL_SQLPARSER->getFieldName(),SQL_NODE_NAME)); + + $$ = SQL_NEW_RULE; + $$->append(pColumnRef); + $$->append($1); + $$->append($2); + $$->append($3); + } + else + YYERROR; + } + ; + +any_all_some: + SQL_TOKEN_ANY + | SQL_TOKEN_ALL + | SQL_TOKEN_SOME + ; + +existence_test: + SQL_TOKEN_EXISTS subquery + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2);} + ; +unique_test: + SQL_TOKEN_UNIQUE subquery + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2);} + ; +subquery: + '(' query_exp ')' + {$$ = SQL_NEW_RULE; + $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION));} + ; + + /* scalar expressions */ +scalar_exp_commalist: + select_sublist + { + $$ = SQL_NEW_COMMALISTRULE; + $$->append($1); + } + | scalar_exp_commalist ',' select_sublist + { + $1->append($3); + $$ = $1; + } + ; +select_sublist: + table_name '.' '*' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode(".", SQL_NODE_PUNCTUATION)); + $$->append($3 = newNode("*", SQL_NODE_PUNCTUATION)); + } + | derived_column + + ; + +parameter_ref: + parameter + ; + +/* +op_like: + '*' + { + $$ = newNode("*", SQL_NODE_PUNCTUATION); + } + | '?' + { + $$ = newNode("?", SQL_NODE_PUNCTUATION); + } + | op_like '*' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("*", SQL_NODE_PUNCTUATION)); + xxx_pGLOBAL_SQLPARSER->reduceLiteral($$, FALSE); + } + | op_like '?' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("?", SQL_NODE_PUNCTUATION)); + xxx_pGLOBAL_SQLPARSER->reduceLiteral($$, FALSE); + } + ; +*/ + +literal: +/* SQL_TOKEN_STRING + | */SQL_TOKEN_INT + | SQL_TOKEN_REAL_NUM + | SQL_TOKEN_INTNUM + | SQL_TOKEN_APPROXNUM + | SQL_TOKEN_ACCESS_DATE +/* rules for predicate check */ + | literal SQL_TOKEN_STRING + { + if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + xxx_pGLOBAL_SQLPARSER->reduceLiteral($$, TRUE); + } + else + YYERROR; + } + | literal SQL_TOKEN_INT + { + if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + xxx_pGLOBAL_SQLPARSER->reduceLiteral($$, TRUE); + } + else + YYERROR; + } + | literal SQL_TOKEN_REAL_NUM + { + if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + xxx_pGLOBAL_SQLPARSER->reduceLiteral($$, TRUE); + } + else + YYERROR; + } + | literal SQL_TOKEN_APPROXNUM + { + if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + xxx_pGLOBAL_SQLPARSER->reduceLiteral($$, TRUE); + } + else + YYERROR; + } + ; + + /* miscellaneous */ +as_clause: + /* empty */ {$$ = SQL_NEW_RULE;} + | SQL_TOKEN_AS column + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + | column + ; +position_exp: + SQL_TOKEN_POSITION '(' string_value_exp SQL_TOKEN_IN string_value_exp ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4); + $$->append($5); + $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +num_value_fct: + position_exp + | extract_exp + | length_exp + ; +char_length_exp: + SQL_TOKEN_CHAR_LENGTH '(' string_value_exp ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +octet_length_exp: + SQL_TOKEN_OCTECT_LENGTH '(' string_value_exp ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +bit_length_exp: + SQL_TOKEN_BIT_LENGTH '(' string_value_exp ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +length_exp: + char_length_exp + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | octet_length_exp + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | bit_length_exp + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + ; +datetime_field: + non_second_datetime_field + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | SQL_TOKEN_SECOND + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + ; +extract_field: + datetime_field + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | time_zone_field + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + ; +time_zone_field: + SQL_TOKEN_TIMEZONE_HOUR + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | SQL_TOKEN_TIMEZONE_MINUTE + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + ; +extract_source: + datetime_value_exp + { + $$ = SQL_NEW_RULE; + $$->append($1); + } +/* | interval_value_exp + { + $$ = SQL_NEW_RULE; + $$->append($1); + } */ + ; +extract_exp: + SQL_TOKEN_EXTRACT '(' extract_field SQL_TOKEN_FROM extract_source ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4); + $$->append($5); + $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +unsigned_value_spec: + literal + | general_value_spec + ; +general_value_spec: + parameter + | SQL_TOKEN_USER + ; +set_fct_spec: + general_set_fct + | '{' odbc_fct_spec '}' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("{", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode("}", SQL_NODE_PUNCTUATION)); + } + | SQL_TOKEN_NAME '(' value_exp_commalist ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +op_parameter: + {$$ = SQL_NEW_RULE;} + | '?' EQUAL + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("?", SQL_NODE_PUNCTUATION)); + $$->append($2); + } + ; +odbc_call_spec: + op_parameter SQL_TOKEN_CALL table_name op_odbc_call_parameter + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + ; + +op_odbc_call_parameter: + {$$ = SQL_NEW_RULE;} + | '(' odbc_parameter_commalist ')' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; + +odbc_parameter_commalist: + odbc_parameter + {$$ = SQL_NEW_COMMALISTRULE; + $$->append($1);} + | odbc_parameter_commalist ',' odbc_parameter + { + $1->append($3); + $$ = $1; + } + ; +odbc_parameter: + /* empty */ {$$ = SQL_NEW_RULE;} + | literal + | parameter + ; + +odbc_fct_spec: + odbc_fct_type SQL_TOKEN_STRING + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; + +odbc_fct_type: + SQL_TOKEN_FN + | SQL_TOKEN_D + | SQL_TOKEN_T + | SQL_TOKEN_TS + ; + +general_set_fct: + set_fct_type '(' opt_all_distinct value_exp ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4); + $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION)); + } + | SQL_TOKEN_COUNT '(' '*' ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3 = newNode("*", SQL_NODE_PUNCTUATION)); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + } + | SQL_TOKEN_COUNT '(' opt_all_distinct value_exp ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4); + $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +set_fct_type: + SQL_TOKEN_AVG + | SQL_TOKEN_MAX + | SQL_TOKEN_MIN + | SQL_TOKEN_SUM + ; + +outer_join_type: + SQL_TOKEN_LEFT %prec SQL_TOKEN_LEFT + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | SQL_TOKEN_RIGHT %prec SQL_TOKEN_RIGHT + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | SQL_TOKEN_FULL %prec SQL_TOKEN_FULL + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + ; +join_condition: + SQL_TOKEN_ON search_condition + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +join_spec: + join_condition + | named_columns_join + ; +join_type: + SQL_TOKEN_INNER + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | outer_join_type + | outer_join_type SQL_TOKEN_OUTER + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +cross_union: + table_ref /*[SQL_TOKEN_CROSS]*/ SQL_TOKEN_CROSS SQL_TOKEN_JOIN table_ref %prec SQL_TOKEN_CROSS + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + ; + +qualified_join: + /* wenn SQL_TOKEN_NATURAL, dann keine join_spec */ + table_ref /*[SQL_TOKEN_NATURAL]*/ SQL_TOKEN_NATURAL join_type SQL_TOKEN_JOIN table_ref %prec SQL_TOKEN_NATURAL + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + $$->append($5); + } + | table_ref join_type SQL_TOKEN_JOIN table_ref join_spec + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + $$->append($5); + } + | cross_union + ; +joined_table: + qualified_join +/* | query_exp*/ + | '(' joined_table ')' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); + } + + ; +named_columns_join: + SQL_TOKEN_USING '(' column_commalist ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +simple_table: + select_statement + | values_or_query_spec + ; + +non_join_query_primary: + simple_table + | '(' non_join_query_exp ')' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +non_join_query_term: + non_join_query_primary + | query_term SQL_TOKEN_INTERSECT all query_primary + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + ; +query_primary: + non_join_query_primary + /*| joined_table*/ + ; +non_join_query_exp: + non_join_query_term + | query_exp SQL_TOKEN_UNION all query_term + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | query_exp SQL_TOKEN_EXCEPT all query_term + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + ; +all: + /* empty*/ {$$ = SQL_NEW_RULE;} + | SQL_TOKEN_ALL + ; +query_exp: + non_join_query_exp /*[^')']*/ + ; +scalar_subquery: + subquery + ; +cast_operand: + value_exp + | SQL_TOKEN_NULL + ; +cast_target: + table_name + | data_type + ; +cast_spec: + SQL_TOKEN_CAST '(' cast_operand SQL_TOKEN_AS cast_target ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4); + $$->append($5); + $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +value_exp_primary: + unsigned_value_spec + | column_ref + | set_fct_spec + | scalar_subquery + | '(' value_exp ')' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode(")", SQL_NODE_PUNCTUATION)); + } + | cast_spec + ; + +num_primary: + value_exp_primary + | num_value_fct + ; +factor: + num_primary + | '-' num_primary %prec SQL_TOKEN_UMINUS + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("-", SQL_NODE_PUNCTUATION)); + $$->append($2); + } + | '+' num_primary %prec SQL_TOKEN_UMINUS + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("+", SQL_NODE_PUNCTUATION)); + $$->append($2); + } + ; + +term: + factor + | term '*' factor + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("*", SQL_NODE_PUNCTUATION)); + $$->append($3); + } + | term '/' factor + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("/", SQL_NODE_PUNCTUATION)); + $$->append($3); + } + ; + +num_value_exp: + term + | num_value_exp '+' term + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("+", SQL_NODE_PUNCTUATION)); + $$->append($3); + } + | num_value_exp '-' term + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("-", SQL_NODE_PUNCTUATION)); + $$->append($3); + } + ; +datetime_primary: +/* value_exp_primary + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + |*/ datetime_value_fct + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + ; +datetime_value_fct: + SQL_TOKEN_CURRENT_DATE + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | SQL_TOKEN_CURRENT_TIME + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | SQL_TOKEN_CURRENT_TIMESTAMP + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + ; +time_zone: + SQL_TOKEN_AT time_zone_specifier + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +time_zone_specifier: + SQL_TOKEN_LOCAL + { + $$ = SQL_NEW_RULE; + $$->append($1); + } +/* | SQL_TOKEN_TIME SQL_TOKEN_ZONE interval_value_exp + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + }*/ + ; +datetime_factor: + datetime_primary + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | datetime_primary time_zone + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +datetime_term: + datetime_factor + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + ; +/* +interval_term: + literal + | interval_term '*' factor + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("*", SQL_NODE_PUNCTUATION)); + $$->append($3); + } + | interval_term '/' factor + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("/", SQL_NODE_PUNCTUATION)); + $$->append($3); + } + ; +*/ +datetime_value_exp: + datetime_term + { + $$ = SQL_NEW_RULE; + $$->append($1); + } +/* | interval_value_exp '+' datetime_term + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("+", SQL_NODE_PUNCTUATION)); + $$->append($3); + } + | datetime_value_exp '+' interval_term + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("+", SQL_NODE_PUNCTUATION)); + $$->append($3); + } + | datetime_value_exp '-' interval_term + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("-", SQL_NODE_PUNCTUATION)); + $$->append($3); + } +*/ ; +/* +interval_value_exp: + interval_term + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | interval_value_exp '+' interval_term + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("+", SQL_NODE_PUNCTUATION)); + $$->append($3); + } + | interval_value_exp '-' interval_term + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("-", SQL_NODE_PUNCTUATION)); + $$->append($3); + } + | '(' datetime_value_exp '-' datetime_term ')' interval_qualifier + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode("-", SQL_NODE_PUNCTUATION)); + $$->append($4); + $$->append($5 = newNode(")", SQL_NODE_PUNCTUATION)); + $$->append($6); + } + ; +*/ +non_second_datetime_field: + SQL_TOKEN_YEAR + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | SQL_TOKEN_MONTH + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | SQL_TOKEN_DAY + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | SQL_TOKEN_HOUR + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | SQL_TOKEN_MINUTE + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + ; +/*start_field: + non_second_datetime_field + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | non_second_datetime_field '(' SQL_TOKEN_INTNUM ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +end_field: + non_second_datetime_field + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | SQL_TOKEN_SECOND + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | SQL_TOKEN_SECOND '(' SQL_TOKEN_INTNUM ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +*/ +/* +single_datetime_field: + non_second_datetime_field + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | non_second_datetime_field '(' SQL_TOKEN_INTNUM ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + } + | SQL_TOKEN_SECOND + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | SQL_TOKEN_SECOND '(' SQL_TOKEN_INTNUM ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + } + | SQL_TOKEN_SECOND '(' SQL_TOKEN_INTNUM ',' SQL_TOKEN_INTNUM ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(",", SQL_NODE_PUNCTUATION)); + $$->append($5); + $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +*/ +/* +interval_qualifier: + start_field SQL_TOKEN_TO end_field + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + | single_datetime_field + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + ; +*/ +value_exp_commalist: + value_exp + {$$ = SQL_NEW_COMMALISTRULE; + $$->append($1);} + | value_exp_commalist ',' value_exp + {$1->append($3); + $$ = $1;} + /* this rule is only valid if we check predicates */ + | value_exp_commalist ';' value_exp + { + if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) + { + $1->append($3); + $$ = $1; + } + else + YYERROR; + } + ; +value_exp: + num_value_exp /*[^')']*/ + | string_value_exp + | datetime_value_exp + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + ; +string_value_exp: + char_value_exp +/* | bit_value_exp + { + $$ = SQL_NEW_RULE; + $$->append($1); + } +*/ ; +char_value_exp: + char_factor + | concatenation + ; +concatenation: + char_value_exp '+' char_factor + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("+", SQL_NODE_PUNCTUATION)); + $$->append($3); + } + ; + +char_primary: + SQL_TOKEN_STRING + | string_value_fct + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + ; +collate_clause: + SQL_TOKEN_COLLATE table_name + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +char_factor: + char_primary + | char_primary collate_clause + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +string_value_fct: + char_value_fct + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | bit_value_fct + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + ; +bit_value_fct: + bit_substring_fct + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + ; +bit_substring_fct: + SQL_TOKEN_SUBSTRING '(' bit_value_exp SQL_TOKEN_FROM string_value_exp for_length ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4); + $$->append($5); + $$->append($6); + $$->append($7 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +bit_value_exp: + bit_factor + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + ; +/* + bit_concatenation + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | +bit_concatenation: + bit_value_exp '+' bit_factor + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("+", SQL_NODE_PUNCTUATION)); + $$->append($3); + } + ; +*/ +bit_factor: + bit_primary + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + ; +bit_primary: + {$$ = SQL_NEW_RULE;} +/* value_exp_primary + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | string_value_fct + { + $$ = SQL_NEW_RULE; + $$->append($1); + }*/ + ; +char_value_fct: + char_substring_fct + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | fold + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | form_conversion + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | char_translation + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + | trim_fct + { + $$ = SQL_NEW_RULE; + $$->append($1); + } + ; +for_length: + {$$ = SQL_NEW_RULE;} + | SQL_TOKEN_FOR string_value_exp + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +char_substring_fct: + SQL_TOKEN_SUBSTRING '(' string_value_exp SQL_TOKEN_FROM string_value_exp for_length ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4); + $$->append($5); + $$->append($6); + $$->append($7 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +upper_lower: + SQL_TOKEN_UPPER + | SQL_TOKEN_LOWER + ; +fold: + upper_lower '(' string_value_exp ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +form_conversion: + SQL_TOKEN_CONVERT '(' string_value_exp SQL_TOKEN_USING table_name ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4); + $$->append($5); + $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +char_translation: + SQL_TOKEN_TRANSLATE '(' string_value_exp SQL_TOKEN_USING table_name ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4); + $$->append($5); + $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +trim_fct: + SQL_TOKEN_TRIM '(' trim_operands ')' + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION)); + } + ; +trim_operands: + string_value_exp + | trim_spec string_value_exp SQL_TOKEN_FROM string_value_exp + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + $$->append($4); + } + | trim_spec SQL_TOKEN_FROM string_value_exp + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + $$->append($3); + } + ; +trim_spec: + SQL_TOKEN_BOTH + | SQL_TOKEN_LEADING + | SQL_TOKEN_TRAILING + ; + +derived_column: + value_exp as_clause + { + $$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2); + } + ; +/* Tabellenname */ +table_name: + SQL_TOKEN_NAME + {$$ = SQL_NEW_RULE; + $$->append($1);} + | SQL_TOKEN_NAME '.' SQL_TOKEN_NAME %prec SQL_TOKEN_NAME + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode(".", SQL_NODE_PUNCTUATION)); + $$->append($3);} + | SQL_TOKEN_NAME '.' SQL_TOKEN_NAME '.' SQL_TOKEN_NAME %prec SQL_TOKEN_NAME + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2= newNode(".", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(".", SQL_NODE_PUNCTUATION)); + $$->append($5);} + | SQL_TOKEN_NAME ':' SQL_TOKEN_NAME '.' SQL_TOKEN_NAME + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2= newNode(":", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(".", SQL_NODE_PUNCTUATION)); + $$->append($5);} +/* | SQL_TOKEN_NAME ';' SQL_TOKEN_NAME '.' SQL_TOKEN_NAME + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2= newNode(";", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(".", SQL_NODE_PUNCTUATION)); + $$->append($5);} +*/ ; +column_ref: + column + {$$ = SQL_NEW_RULE; + $$->append($1);} + | SQL_TOKEN_NAME '.' column_val %prec '.' + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode(".", SQL_NODE_PUNCTUATION)); + $$->append($3);} + | SQL_TOKEN_NAME '.' SQL_TOKEN_NAME '.' column_val %prec '.' + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode(".", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(".", SQL_NODE_PUNCTUATION)); + $$->append($5);} + | SQL_TOKEN_NAME '.' SQL_TOKEN_NAME '.' SQL_TOKEN_NAME '.' column_val %prec '.' + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2= newNode(".", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(".", SQL_NODE_PUNCTUATION)); + $$->append($5); + $$->append($6 = newNode(".", SQL_NODE_PUNCTUATION)); + $$->append($7); + } + | SQL_TOKEN_NAME ':' SQL_TOKEN_NAME '.' SQL_TOKEN_NAME '.' column_val %prec '.' + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2= newNode(":", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(".", SQL_NODE_PUNCTUATION)); + $$->append($5); + $$->append($6 = newNode(".", SQL_NODE_PUNCTUATION)); + $$->append($7); + } +/* | SQL_TOKEN_NAME ';' SQL_TOKEN_NAME '.' SQL_TOKEN_NAME '.' column_val + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2= newNode(";", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(".", SQL_NODE_PUNCTUATION)); + $$->append($5); + $$->append($6 = newNode(".", SQL_NODE_PUNCTUATION)); + $$->append($7); + } +*/ ; + + /* data types */ +column_val: + column + {$$ = SQL_NEW_RULE; + $$->append($1);} + | '*' + { + $$ = SQL_NEW_RULE; + $$->append($1 = newNode("*", SQL_NODE_PUNCTUATION)); + } + ; +data_type: + SQL_TOKEN_CHARACTER + | SQL_TOKEN_CHARACTER '(' SQL_TOKEN_INTNUM ')' + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION));} + | SQL_TOKEN_NUMERIC + | SQL_TOKEN_NUMERIC '(' SQL_TOKEN_INTNUM ')' + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION));} + | SQL_TOKEN_NUMERIC '(' SQL_TOKEN_INTNUM ',' SQL_TOKEN_INTNUM ')' + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(",", SQL_NODE_PUNCTUATION)); + $$->append($5); + $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION));} + | SQL_TOKEN_DECIMAL + | SQL_TOKEN_DECIMAL '(' SQL_TOKEN_INTNUM ')' + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION));} + | SQL_TOKEN_DECIMAL '(' SQL_TOKEN_INTNUM ',' SQL_TOKEN_INTNUM ')' + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(",", SQL_NODE_PUNCTUATION)); + $$->append($5); + $$->append($6 = newNode(")", SQL_NODE_PUNCTUATION));} + | SQL_TOKEN_INTEGER + | SQL_TOKEN_SMALLINT + | SQL_TOKEN_FLOAT + | SQL_TOKEN_FLOAT '(' SQL_TOKEN_INTNUM ')' + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2 = newNode("(", SQL_NODE_PUNCTUATION)); + $$->append($3); + $$->append($4 = newNode(")", SQL_NODE_PUNCTUATION));} + | SQL_TOKEN_REAL + | SQL_TOKEN_DOUBLE SQL_TOKEN_PRECISION + {$$ = SQL_NEW_RULE; + $$->append($1); + $$->append($2);} + ; + + /* the various things you can name */ + +column: + SQL_TOKEN_NAME + | SQL_TOKEN_POSITION + { + UINT16 nNod = $$->getRuleID(); + delete $$; + $$ = newNode(xxx_pGLOBAL_SQLPARSER->TokenIDToStr(nNod), SQL_NODE_NAME); + } + | SQL_TOKEN_CHAR_LENGTH + { + UINT16 nNod = $$->getRuleID(); + delete $$; + $$ = newNode(xxx_pGLOBAL_SQLPARSER->TokenIDToStr(nNod), SQL_NODE_NAME); + } + | SQL_TOKEN_EXTRACT + { + UINT16 nNod = $$->getRuleID(); + delete $$; + $$ = newNode(xxx_pGLOBAL_SQLPARSER->TokenIDToStr(nNod), SQL_NODE_NAME); + } + ; + +cursor: SQL_TOKEN_NAME + {$$ = SQL_NEW_RULE; + $$->append($1);} + ; + +/*** +module: SQL_TOKEN_NAME + {$$ = SQL_NEW_RULE; + $$->append($1);} + ; +***/ + +parameter: + ':' SQL_TOKEN_NAME + {$$ = SQL_NEW_RULE; + $$->append($1 = newNode(":", SQL_NODE_PUNCTUATION)); + $$->append($2);} + | '?' + {$$ = SQL_NEW_RULE; + $$->append($1 = newNode("?", SQL_NODE_PUNCTUATION));} + | '[' SQL_TOKEN_NAME ']' + {$$ = SQL_NEW_RULE; + $$->append($1 = newNode("[", SQL_NODE_PUNCTUATION)); + $$->append($2); + $$->append($3 = newNode("]", SQL_NODE_PUNCTUATION));} + ; + +/*** +procedure: SQL_TOKEN_NAME + {$$ = SQL_NEW_RULE; + $$->append($1);} + ; +***/ + +range_variable: SQL_TOKEN_NAME + ; + +user: SQL_TOKEN_NAME + ; + +/* PREDICATECHECK RULES */ +sql: + search_condition /* checking predicats */ + { + if (xxx_pGLOBAL_SQLPARSER->inPredicateCheck()) + { + $$ = $1; + } + else + YYERROR; + } +%% + + +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::osl; +// using namespace connectivity; + +//============================================================ +//= a helper for static ascii pseudo-unicode strings +//============================================================ +// string constants +struct _ConstAsciiString_ +{ + sal_Int32 length; + sal_Char const* str; + + operator rtl::OUString () const { return rtl::OUString(str, length, RTL_TEXTENCODING_ASCII_US); } +// operator String () const { return String(str, length, RTL_TEXTENCODING_ASCII_US); } + operator const sal_Char * () const { return str; } +}; + +#define IMPLEMENT_CONSTASCII_STRING( name, string ) \ + _ConstAsciiString_ const name = { sizeof(string)-1, string } + +IMPLEMENT_CONSTASCII_STRING(ERROR_STR_GENERAL, "Syntax error in SQL expression"); +IMPLEMENT_CONSTASCII_STRING(ERROR_STR_GENERAL_HINT, "before \"#\" expression." ); +IMPLEMENT_CONSTASCII_STRING(ERROR_STR_VALUE_NO_LIKE, "The value # can not be used with LIKE!"); +IMPLEMENT_CONSTASCII_STRING(ERROR_STR_FIELD_NO_LIKE, "LIKE can not be used with this field!"); +IMPLEMENT_CONSTASCII_STRING(ERROR_STR_INVALID_COMPARE, "The entered criterion can not be compared with this field!"); +IMPLEMENT_CONSTASCII_STRING(ERROR_STR_INVALID_STRING_COMPARE, "The field can not be compared with a string!"); +IMPLEMENT_CONSTASCII_STRING(ERROR_STR_INVALID_DATE_COMPARE, "The field can not be compared with a date!"); +IMPLEMENT_CONSTASCII_STRING(ERROR_STR_INVALID_REAL_COMPARE, "The field can not be compared with a floating point number!"); +IMPLEMENT_CONSTASCII_STRING(ERROR_STR_INVALID_INT_COMPARE, "The field can not be compared with a number!"); + +IMPLEMENT_CONSTASCII_STRING(KEY_STR_LIKE, "LIKE"); +IMPLEMENT_CONSTASCII_STRING(KEY_STR_NOT, "NOT"); +IMPLEMENT_CONSTASCII_STRING(KEY_STR_NULL, "NULL"); +IMPLEMENT_CONSTASCII_STRING(KEY_STR_TRUE, "TRUE"); +IMPLEMENT_CONSTASCII_STRING(KEY_STR_FALSE, "FALSE"); +IMPLEMENT_CONSTASCII_STRING(KEY_STR_IS, "IS"); +IMPLEMENT_CONSTASCII_STRING(KEY_STR_BETWEEN, "BETWEEN"); +IMPLEMENT_CONSTASCII_STRING(KEY_STR_OR, "OR"); +IMPLEMENT_CONSTASCII_STRING(KEY_STR_AND, "AND"); +IMPLEMENT_CONSTASCII_STRING(KEY_STR_AVG, "AVG"); +IMPLEMENT_CONSTASCII_STRING(KEY_STR_COUNT, "COUNT"); +IMPLEMENT_CONSTASCII_STRING(KEY_STR_MAX, "MAX"); +IMPLEMENT_CONSTASCII_STRING(KEY_STR_MIN, "MIN"); +IMPLEMENT_CONSTASCII_STRING(KEY_STR_SUM, "SUM"); + +IMPLEMENT_CONSTASCII_STRING(FIELD_STR_LOCALE, "Locale"); +IMPLEMENT_CONSTASCII_STRING(FIELD_STR_REALNAME, "RealName"); +IMPLEMENT_CONSTASCII_STRING(FIELD_STR_FORMATKEY, "FormatKey"); +IMPLEMENT_CONSTASCII_STRING(FIELD_STR_NAME, "Name"); +IMPLEMENT_CONSTASCII_STRING(FIELD_STR_TYPE, "Type"); +IMPLEMENT_CONSTASCII_STRING(FIELD_STR_NULLDATE, "NullDate"); + +IMPLEMENT_CONSTASCII_STRING(STR_SQL_TOKEN, "SQL_TOKEN_"); + +//========================================================================== +//= OParseContext +//========================================================================== +DBG_NAME(OParseContext); +//----------------------------------------------------------------------------- +OParseContext::OParseContext() +{ + DBG_CTOR(OParseContext,NULL); +} + +//----------------------------------------------------------------------------- +OParseContext::~OParseContext() +{ + DBG_DTOR(OParseContext,NULL); +} + +//----------------------------------------------------------------------------- +String OParseContext::getErrorMessage(ErrorCode _eCode) const +{ + String aMsg; + switch (_eCode) + { + case ERROR_GENERAL: aMsg = ERROR_STR_GENERAL; break; + case ERROR_GENERAL_HINT: aMsg = ERROR_STR_GENERAL_HINT; break; + case ERROR_VALUE_NO_LIKE: aMsg = ERROR_STR_VALUE_NO_LIKE; break; + case ERROR_FIELD_NO_LIKE: aMsg = ERROR_STR_FIELD_NO_LIKE; break; + case ERROR_INVALID_COMPARE: aMsg = ERROR_STR_INVALID_COMPARE; break; + case ERROR_INVALID_INT_COMPARE: aMsg = ERROR_STR_INVALID_INT_COMPARE; break; + case ERROR_INVALID_STRING_COMPARE: aMsg = ERROR_STR_INVALID_STRING_COMPARE; break; + case ERROR_INVALID_DATE_COMPARE: aMsg = ERROR_STR_INVALID_DATE_COMPARE; break; + case ERROR_INVALID_REAL_COMPARE: aMsg = ERROR_STR_INVALID_REAL_COMPARE; break; + } + return aMsg; +} + +//----------------------------------------------------------------------------- +ByteString OParseContext::getIntlKeywordAscii(InternationalKeyCode _eKey) const +{ + ByteString aKeyword; + switch (_eKey) + { + case KEY_LIKE: aKeyword = KEY_STR_LIKE; break; + case KEY_NOT: aKeyword = KEY_STR_NOT; break; + case KEY_NULL: aKeyword = KEY_STR_NULL; break; + case KEY_TRUE: aKeyword = KEY_STR_TRUE; break; + case KEY_FALSE: aKeyword = KEY_STR_FALSE; break; + case KEY_IS: aKeyword = KEY_STR_IS; break; + case KEY_BETWEEN: aKeyword = KEY_STR_BETWEEN; break; + case KEY_OR: aKeyword = KEY_STR_OR; break; + case KEY_AND: aKeyword = KEY_STR_AND; break; + case KEY_AVG: aKeyword = KEY_STR_AVG; break; + case KEY_COUNT: aKeyword = KEY_STR_COUNT; break; + case KEY_MAX: aKeyword = KEY_STR_MAX; break; + case KEY_MIN: aKeyword = KEY_STR_MIN; break; + case KEY_SUM: aKeyword = KEY_STR_SUM; break; + } + return aKeyword; +} + +//----------------------------------------------------------------------------- +OParseContext::InternationalKeyCode OParseContext::getIntlKeyCode(const ByteString& rToken) const +{ + static OParseContext::InternationalKeyCode Intl_TokenID[] = + { + KEY_LIKE, KEY_NOT, KEY_NULL, KEY_TRUE, + KEY_FALSE, KEY_IS, KEY_BETWEEN, KEY_OR, + KEY_AND, KEY_AVG, KEY_COUNT, KEY_MAX, + KEY_MIN, KEY_SUM + }; + + sal_uInt32 nCount = sizeof Intl_TokenID / sizeof Intl_TokenID[0]; + for (sal_uInt32 i = 0; i < nCount; i++) + { + ByteString aKey = getIntlKeywordAscii(Intl_TokenID[i]); + if (rToken.EqualsIgnoreCaseAscii(aKey)) + return Intl_TokenID[i]; + } + + return KEY_NONE; +} + +//------------------------------------------------------------------------------ +const International& OParseContext::getDefaultInternational() +{ + static International aIntl(LANGUAGE_ENGLISH_US); + static BOOL bInitialized = FALSE; + if (!bInitialized) + { // ensure that the two members we're interested in are really set + // (if the system doesn't know the locale en_US aIntl would be initialized with the + // system language which may be anything - which we don't want ...) + // 74342 - 21.03.00 - FS + aIntl.SetNumThousandSep(','); + aIntl.SetNumDecimalSep('.'); + bInitialized = TRUE; + } + return aIntl; +} + +//========================================================================== +//= misc +//========================================================================== +// Der (leider globale) yylval fuer die Uebergabe von +// Werten vom Scanner an den Parser. Die globale Variable +// wird nur kurzzeitig verwendet, der Parser liest die Variable +// sofort nach dem Scanner-Aufruf in eine gleichnamige eigene +// Member-Variable. + +const double fMilliSecondsPerDay = 86400000.0; + +//------------------------------------------------------------------------------ +Date getNULLDate(const Reference< ::com::sun::star::util::XNumberFormatsSupplier > &xSupplier) +{ + DBG_ASSERT(xSupplier.is(), "getNULLDate : the formatter doesn't implement a supplier !"); + if (xSupplier.is()) + { + try + { + // get the null date + ::com::sun::star::util::Date aDate; + xSupplier->getNumberFormatSettings()->getPropertyValue(FIELD_STR_NULLDATE) >>= aDate; + return Date(aDate.Day, aDate.Month, aDate.Year); + } + catch ( ... ) + { + } + } + + return Date(1,1,1900); +} + +//------------------------------------------------------------------------------ +Any getNumberFormatProperty(const Reference< ::com::sun::star::util::XNumberFormatsSupplier > &xSupplier, + sal_Int32 nKey, + const rtl::OUString& aPropertyName) +{ + DBG_ASSERT(xSupplier.is(), "getNumberFormatProperty : the formatter doesn't implement a supplier !"); + Reference< ::com::sun::star::util::XNumberFormats > xFormats = xSupplier->getNumberFormats(); + + if (xFormats.is()) + { + try + { + Reference< XPropertySet > xProperties(xFormats->getByKey(nKey)); + return xProperties->getPropertyValue(aPropertyName); + } + catch( ... ) + { + } + } + return Any(); +} + +// date time conversion +//------------------------------------------------------------------ +DateTime ToDateTime(const Reference< ::com::sun::star::util::XNumberFormatsSupplier > & xSupplier, + const double& fSbxDate) +{ + + long nDays = (long)fSbxDate; + long nMSeconds = long((fSbxDate - (double)nDays) * fMilliSecondsPerDay + 0.5); + + // Datum: + DateTime x(getNULLDate(xSupplier)); + + if (nDays >= 0) + x += (sal_uInt32)nDays; + else + x -= (sal_uInt32)(-nDays); + + // Zeit: + x.MakeTimeFromMS(nMSeconds); + if (x.GetTime() < 0) + x += Time(23,59,59,99); + return x; +} + +//------------------------------------------------------------------ +double ToDouble(const Reference< ::com::sun::star::util::XNumberFormatsSupplier > & xSupplier, const Date& rDate) +{ + long nDays = 0; + Date aNullDate(getNULLDate(xSupplier)); + if (aNullDate >= rDate) + { + nDays = (long)(aNullDate - rDate); + nDays *= -1; + } + else + nDays = (long)(rDate - aNullDate); + + return (double)nDays; +} + +//------------------------------------------------------------------ +double ToDouble(const Time& rTime) +{ + return (double)rTime.GetMSFromTime() / fMilliSecondsPerDay; +} + +//------------------------------------------------------------------ +Date ToDate(const Reference< ::com::sun::star::util::XNumberFormatsSupplier > & xSupplier, const double& fSbxDate) +{ + // count the days + long nDays = (long)fSbxDate; + Date aNullDate(getNULLDate(xSupplier)); + + if (nDays >= 0) + aNullDate += (sal_uInt32)nDays; + else + aNullDate -= (sal_uInt32)(-nDays); + + return aNullDate; +} + +//------------------------------------------------------------------ +Time ToTime(const double& fSbxDate) +{ + long nDays = (long)fSbxDate; + long nMSeconds = long((fSbxDate - (double)nDays) * fMilliSecondsPerDay + 0.5); + + Time x; + x.MakeTimeFromMS(nMSeconds); + if (x.GetTime() < 0) + x += Time(23,59,59,99); + return x; +} + +//------------------------------------------------------------------ +String ToDateString(const Date& rDate) +{ + sal_Char s[11]; + sprintf(s,"%04d-%02d-%02d", + (int)rDate.GetYear(), + (int)rDate.GetMonth(), + (int)rDate.GetDay()); + s[10] = 0; + return String::CreateFromAscii(s); +} + +//------------------------------------------------------------------ +String ToTimeString(const Time& rTime) +{ + sal_Char s[9]; + sprintf(s,"%02d:%02d:%02d", + (int)rTime.GetHour(), + (int)rTime.GetMin(), + (int)rTime.GetSec()); + s[8] = 0; + return String::CreateFromAscii(s); +} + +//------------------------------------------------------------------ +String ToDateTimeString(const DateTime& rDateTime) +{ + String aTemp(ToDateString(rDateTime)); + aTemp += String::CreateFromAscii(" "); + aTemp += ToTimeString(rDateTime); + return aTemp; +} + + +//------------------------------------------------------------------ +String ConvertLikeToken(const OSQLParseNode* pTokenNode, const OSQLParseNode* pEscapeNode, sal_Bool bInternational) +{ + String aMatchStr; + if (pTokenNode->isToken()) + { + char cEscape = 0; + if (pEscapeNode->count()) + cEscape = pEscapeNode->getChild(1)->getTokenValue().GetChar(0); + + // Platzhalter austauschen + aMatchStr = pTokenNode->getTokenValue(); + sal_uInt16 nLen = aMatchStr.Len(); + const char* sSearch = bInternational ? "%_" : "*?"; + const char* sReplace = bInternational ? "*?" : "%_"; + for (sal_uInt16 i = 0; i < nLen; i++) + { + char c = aMatchStr.GetChar(i); + if (c == sSearch[0] || c == sSearch[1]) + { + if (i > 0 && aMatchStr.GetChar(i-1) == cEscape) + continue; + else if (c == sSearch[0]) + aMatchStr.SetChar(i,sReplace[0]); + else + aMatchStr.SetChar(i,sReplace[1]); + } + } + } + return aMatchStr; +} + +//========================================================================== +//= OSQLParser +//========================================================================== +DBG_NAME(OSQLParser); + +sal_uInt32 OSQLParser::s_nRuleIDs[OSQLParseNode::rule_count + 1]; +OParseContext OSQLParser::s_aDefaultContext; + +sal_Int32 OSQLParser::s_nRefCount = 0; +::osl::Mutex OSQLParser::s_aMutex; +OSQLScanner* OSQLParser::s_pScanner = 0; +OSQLParseNodes* OSQLParser::s_pGarbageCollector = 0; + +//----------------------------------------------------------------------------- +OSQLParser::OSQLParser(OParseContext* _pContext) + :m_pContext(_pContext) + ,m_pParseTree(NULL) + ,m_pIntl(NULL) + ,m_nFormatKey(0) +{ + DBG_CTOR(OSQLParser,NULL); + + xxx_pGLOBAL_SQLPARSER = this; + +#ifdef SQLYYDEBUG +#ifdef SQLYYDEBUG_ON + SQLyydebug = 1; +#endif +#endif + + ::osl::MutexGuard aGuard(s_aMutex); + // do we have to initialize the data + if (s_nRefCount == 0) + { + s_pScanner = new OSQLScanner(); + s_pScanner->setScanner(); + s_pGarbageCollector = new OSQLParseNodes(); + + // auf 0 zuruecksetzen + memset(OSQLParser::s_nRuleIDs,0,sizeof(sal_uInt16) * OSQLParseNode::rule_count+1); + } + ++s_nRefCount; + + if (m_pContext == NULL) + // take the default context + m_pContext = &s_aDefaultContext; +} + +//----------------------------------------------------------------------------- +OSQLParser::~OSQLParser() +{ + { + ::osl::MutexGuard aGuard(s_aMutex); + DBG_ASSERT(s_nRefCount > 0, "OSQLParser::~OSQLParser() : suspicious call : have a refcount of 0 !"); + if (!--s_nRefCount) + { + s_pScanner->setScanner(sal_True); + delete s_pScanner; + s_pScanner = NULL; + + delete s_pGarbageCollector; + s_pGarbageCollector = NULL; + } + } + + delete m_pIntl; + + DBG_DTOR(OSQLParser,NULL); +} + +//----------------------------------------------------------------------------- +OSQLParseNode* OSQLParser::parseTree(String& rErrorMessage, + const String& rStatement, + sal_Bool bInternational) +{ + DBG_CHKTHIS(OSQLParser,NULL); + + // Guard the parsing + ::osl::MutexGuard aGuard(s_aMutex); + + // defines how to scan + s_pScanner->SetRule(s_pScanner->GetSQLRule()); // initial + s_pScanner->prepareScan(rStatement, m_pContext, bInternational); + + SQLyylval.pParseNode = NULL; + // SQLyypvt = NULL; + m_pParseTree = NULL; + m_sErrorMessage.Erase(); + + // ... und den Parser anwerfen ... + if (SQLyyparse() != 0) + { + // only set the error message, if it's not already set + if (!m_sErrorMessage.Len()) + m_sErrorMessage = s_pScanner->getErrorMessage(); + if (!m_sErrorMessage.Len()) + m_sErrorMessage = m_pContext->getErrorMessage(OParseContext::ERROR_GENERAL); + + rErrorMessage = m_sErrorMessage; + + // clear the garbage collector + while (!s_pGarbageCollector->empty()) + { + OSQLParseNode* pNode = *s_pGarbageCollector->begin(); + while (pNode->getParent()) + pNode = pNode->getParent(); + delete pNode; + } + return NULL; + } + else + { + s_pGarbageCollector->clear(); + + // Das Ergebnis liefern (den Root Parse Node): + + // DBG_ASSERT(Sdbyyval.pParseNode != NULL,"OSQLParser: Parser hat keinen ParseNode geliefert"); + // return Sdbyyval.pParseNode; + // geht nicht wegen Bug in MKS YACC-erzeugtem Code (es wird ein falscher ParseNode + // geliefert). + + // Stattdessen setzt die Parse-Routine jetzt den Member pParseTree + // - einfach diesen zurueckliefern: + DBG_ASSERT(m_pParseTree != NULL,"OSQLParser: Parser hat keinen ParseTree geliefert"); + return m_pParseTree; + } +} + +static char* __READONLY_DATA PREDICATE_CHECK = "PREDICATE "; +//----------------------------------------------------------------------------- +OSQLParseNode* OSQLParser::predicateTree(String& rErrorMessage, const String& rStatement, + const Reference< ::com::sun::star::util::XNumberFormatter > & xFormatter, + const Reference< XPropertySet > & xField) +{ + DBG_CHKTHIS(OSQLParser,NULL); + + // mutex for parsing + static ::osl::Mutex aMutex; + + // Guard the parsing + ::osl::MutexGuard aGuard(s_aMutex); + + // reset the parser + if (!m_pIntl) + m_pIntl = new International(m_pContext->getDefaultInternational()); + + m_xField = xField; + m_xFormatter = xFormatter; + + if (m_xField.is()) + { + sal_Int32 nType=0; + try + { + // get the field name + rtl::OUString aString; + + // retrieve the fields name + // #75243# use the RealName of the column if there is any otherwise the name which could be the alias + // of the field + if (m_xField->getPropertySetInfo()->hasPropertyByName(FIELD_STR_REALNAME)) + m_xField->getPropertyValue(FIELD_STR_REALNAME) >>= aString; + else + m_xField->getPropertyValue(FIELD_STR_NAME) >>= aString; + + m_sFieldName = aString; + + // get the field format key + m_xField->getPropertyValue(FIELD_STR_FORMATKEY) >>= m_nFormatKey; + + // get the field type + m_xField->getPropertyValue(FIELD_STR_TYPE) >>= nType; + } + catch ( ... ) + { + } + + if (m_nFormatKey && m_xFormatter.is()) + { + Any aValue = getNumberFormatProperty(m_xFormatter->getNumberFormatsSupplier(), m_nFormatKey, FIELD_STR_LOCALE); + DBG_ASSERT(aValue.getValueType() == ::getCppuType((const ::com::sun::star::lang::Locale*)0), "OSQLParser::PredicateTree : invalid language property !"); + + if (aValue.getValueType() == ::getCppuType((const ::com::sun::star::lang::Locale*)0)) + { + com::sun::star::lang::Locale aLocale; + aValue >>= aLocale; + *m_pIntl = International(ConvertIsoNamesToLanguage(aLocale.Language.getStr(), + aLocale.Country.getStr())); + } + } + else + *m_pIntl = m_pContext->getDefaultInternational(); + + switch (nType) + { + case DataType::DATE: + case DataType::TIME: + case DataType::TIMESTAMP: + s_pScanner->SetRule(s_pScanner->GetDATERule()); + break; + case DataType::CHAR: + case DataType::VARCHAR: + case DataType::LONGVARCHAR: + s_pScanner->SetRule(s_pScanner->GetSTRINGRule()); + break; + default: + if (m_pIntl->GetNumDecimalSep() == ',') + s_pScanner->SetRule(s_pScanner->GetGERRule()); + else + s_pScanner->SetRule(s_pScanner->GetENGRule()); + } + + } + else + s_pScanner->SetRule(s_pScanner->GetSQLRule()); + + s_pScanner->prepareScan(rStatement, m_pContext, sal_True); + + SQLyylval.pParseNode = NULL; + // SQLyypvt = NULL; + m_pParseTree = NULL; + m_sErrorMessage.Erase(); + + // ... und den Parser anwerfen ... + if (SQLyyparse() != 0) + { + m_sFieldName.Erase(); + m_xField = NULL; + m_xFormatter = NULL; + m_nFormatKey = 0; + + if (!m_sErrorMessage.Len()) + m_sErrorMessage = s_pScanner->getErrorMessage(); + if (!m_sErrorMessage.Len()) + m_sErrorMessage = m_pContext->getErrorMessage(OParseContext::ERROR_GENERAL); + + rErrorMessage = m_sErrorMessage; + + // clear the garbage collector + while (!s_pGarbageCollector->empty()) + { + OSQLParseNode* pNode = *s_pGarbageCollector->begin(); + while (pNode->getParent()) + pNode = pNode->getParent(); + delete pNode; + } + return NULL; + } + else + { + s_pGarbageCollector->clear(); + + m_sFieldName.Erase(); + m_xField = NULL; + m_xFormatter = NULL; + m_nFormatKey = 0; + + // Das Ergebnis liefern (den Root Parse Node): + + // Stattdessen setzt die Parse-Routine jetzt den Member pParseTree + // - einfach diesen zurueckliefern: + DBG_ASSERT(m_pParseTree != NULL,"OSQLParser: Parser hat keinen ParseTree geliefert"); + return m_pParseTree; + } +} + +//----------------------------------------------------------------------------- +ByteString OSQLParser::TokenIDToStr(sal_uInt32 nTokenID, OParseContext* pContext) +{ + ByteString aStr; + if (pContext) + aStr = pContext->getIntlKeywordAscii((OParseContext::InternationalKeyCode)nTokenID); + + if (!aStr.Len()) + { + aStr = yytname[YYTRANSLATE(nTokenID)]; + if(aStr.EqualsIgnoreCaseAscii("SQL_TOKEN_",0,10)) + aStr.Erase(0,10); + } + return aStr; +} + +//----------------------------------------------------------------------------- +/*sal_uInt32 OSQLParser::StrToTokenID(const ByteString & rName) +{ + ByteString aName; + if (rName.IsAlphaNumericAscii()) + aName = rName; + else + { + aName = "'"; + aName += rName; + aName += "'"; + } + + // Gewuenschten Token-Namen suchen: + for (sal_uInt32 i = 0; i < SQLyyntoken; i++) + { + if (aName == TokenTypes[i].name) + return TokenTypes[i].token; + } + + // Nicht gefunden + return 0; +}*/ + +//----------------------------------------------------------------------------- +String OSQLParser::RuleIDToStr(sal_uInt32 nRuleID) +{ + OSL_ENSHURE(nRuleID >= (sizeof yytname/sizeof yytname[0]), "Invalid nRuleId!"); + return String::CreateFromAscii(yytname[nRuleID]); +} + +//----------------------------------------------------------------------------- +sal_uInt32 OSQLParser::StrToRuleID(const ByteString & rValue) +{ + // In yysvar nach dem angegebenen Namen suchen, den ::com::sun::star::sdbcx::Index zurueckliefern + // (oder 0, wenn nicht gefunden) + static sal_Int32 nLen = sizeof(yytname)/sizeof(yytname[0]); + for (sal_uInt32 i = YYTRANSLATE(SQL_TOKEN_INVALIDSYMBOL); i < (nLen-1); i++) + { + if (yytname && rValue == yytname[i]) + return i; + } + + // Nicht gefunden + return 0; +} + +//----------------------------------------------------------------------------- +sal_uInt32 OSQLParser::RuleID(OSQLParseNode::Rule eRule) +{ + if (!s_nRuleIDs[eRule]) + { + switch (eRule) + { + case OSQLParseNode::select_statement: + s_nRuleIDs[eRule] = StrToRuleID("select_statement"); break; + case OSQLParseNode::from_clause: + s_nRuleIDs[eRule] = StrToRuleID("from_clause"); break; + case OSQLParseNode::table_ref_commalist: + s_nRuleIDs[eRule] = StrToRuleID("table_ref_commalist"); break; + case OSQLParseNode::table_exp: + s_nRuleIDs[eRule] = StrToRuleID("table_exp"); break; + case OSQLParseNode::table_ref: + s_nRuleIDs[eRule] = StrToRuleID("table_ref"); break; + case OSQLParseNode::table_name: + s_nRuleIDs[eRule] = StrToRuleID("table_name"); break; + case OSQLParseNode::opt_column_commalist: + s_nRuleIDs[eRule] = StrToRuleID("opt_column_commalist"); break; + case OSQLParseNode::column_commalist: + s_nRuleIDs[eRule] = StrToRuleID("column_commalist"); break; + case OSQLParseNode::column_ref_commalist: + s_nRuleIDs[eRule] = StrToRuleID("column_ref_commalist"); break; + case OSQLParseNode::column_ref: + s_nRuleIDs[eRule] = StrToRuleID("column_ref"); break; + case OSQLParseNode::opt_order_by_clause: + s_nRuleIDs[eRule] = StrToRuleID("opt_order_by_clause"); break; + case OSQLParseNode::ordering_spec_commalist: + s_nRuleIDs[eRule] = StrToRuleID("ordering_spec_commalist"); break; + case OSQLParseNode::ordering_spec: + s_nRuleIDs[eRule] = StrToRuleID("ordering_spec"); break; + case OSQLParseNode::opt_asc_desc: + s_nRuleIDs[eRule] = StrToRuleID("opt_asc_desc"); break; + case OSQLParseNode::where_clause: + s_nRuleIDs[eRule] = StrToRuleID("where_clause"); break; + case OSQLParseNode::opt_where_clause: + s_nRuleIDs[eRule] = StrToRuleID("opt_where_clause"); break; + case OSQLParseNode::search_condition: + s_nRuleIDs[eRule] = StrToRuleID("search_condition"); break; + case OSQLParseNode::comparison_predicate: + s_nRuleIDs[eRule] = StrToRuleID("comparison_predicate"); break; + case OSQLParseNode::between_predicate: + s_nRuleIDs[eRule] = StrToRuleID("between_predicate"); break; + case OSQLParseNode::like_predicate: + s_nRuleIDs[eRule] = StrToRuleID("like_predicate"); break; + case OSQLParseNode::opt_escape: + s_nRuleIDs[eRule] = StrToRuleID("opt_escape"); break; + case OSQLParseNode::test_for_null: + s_nRuleIDs[eRule] = StrToRuleID("test_for_null"); break; + case OSQLParseNode::scalar_exp_commalist: + s_nRuleIDs[eRule] = StrToRuleID("scalar_exp_commalist"); break; + case OSQLParseNode::scalar_exp: + s_nRuleIDs[eRule] = StrToRuleID("scalar_exp"); break; + case OSQLParseNode::parameter_ref: + s_nRuleIDs[eRule] = StrToRuleID("parameter_ref"); break; + case OSQLParseNode::parameter: + s_nRuleIDs[eRule] = StrToRuleID("parameter"); break; + case OSQLParseNode::general_set_fct: + s_nRuleIDs[eRule] = StrToRuleID("general_set_fct"); break; + case OSQLParseNode::range_variable: + s_nRuleIDs[eRule] = StrToRuleID("range_variable"); break; + case OSQLParseNode::column: + s_nRuleIDs[eRule] = StrToRuleID("column"); break; + case OSQLParseNode::delete_statement_positioned: + s_nRuleIDs[eRule] = StrToRuleID("delete_statement_positioned"); break; + case OSQLParseNode::delete_statement_searched: + s_nRuleIDs[eRule] = StrToRuleID("delete_statement_searched"); break; + case OSQLParseNode::update_statement_positioned: + s_nRuleIDs[eRule] = StrToRuleID("update_statement_positioned"); break; + case OSQLParseNode::update_statement_searched: + s_nRuleIDs[eRule] = StrToRuleID("update_statement_searched"); break; + case OSQLParseNode::assignment_commalist: + s_nRuleIDs[eRule] = StrToRuleID("assignment_commalist"); break; + case OSQLParseNode::assignment: + s_nRuleIDs[eRule] = StrToRuleID("assignment"); break; + case OSQLParseNode::values_or_query_spec: + s_nRuleIDs[eRule] = StrToRuleID("values_or_query_spec"); break; + case OSQLParseNode::insert_statement: + s_nRuleIDs[eRule] = StrToRuleID("insert_statement"); break; + case OSQLParseNode::insert_atom_commalist: + s_nRuleIDs[eRule] = StrToRuleID("insert_atom_commalist"); break; + case OSQLParseNode::insert_atom: + s_nRuleIDs[eRule] = StrToRuleID("insert_atom"); break; + case OSQLParseNode::predicate_check: + s_nRuleIDs[eRule] = StrToRuleID("predicate_check"); break; + case OSQLParseNode::qualified_join: + s_nRuleIDs[eRule] = StrToRuleID("qualified_join"); break; + case OSQLParseNode::cross_union: + s_nRuleIDs[eRule] = StrToRuleID("cross_union"); break; + case OSQLParseNode::select_sublist: + s_nRuleIDs[eRule] = StrToRuleID("select_sublist"); break; + case OSQLParseNode::derived_column: + s_nRuleIDs[eRule] = StrToRuleID("derived_column"); break; + case OSQLParseNode::column_val: + s_nRuleIDs[eRule] = StrToRuleID("column_val"); break; + case OSQLParseNode::set_fct_spec: + s_nRuleIDs[eRule] = StrToRuleID("set_fct_spec"); break; + case OSQLParseNode::boolean_term: + s_nRuleIDs[eRule] = StrToRuleID("boolean_term"); break; + case OSQLParseNode::boolean_primary: + s_nRuleIDs[eRule] = StrToRuleID("boolean_primary"); break; + case OSQLParseNode::num_value_exp: + s_nRuleIDs[eRule] = StrToRuleID("num_value_exp"); break; + case OSQLParseNode::join_type: + s_nRuleIDs[eRule] = StrToRuleID("join_type"); break; + case OSQLParseNode::position_exp: + s_nRuleIDs[eRule] = StrToRuleID("position_exp"); break; + case OSQLParseNode::extract_exp: + s_nRuleIDs[eRule] = StrToRuleID("extract_exp"); break; + case OSQLParseNode::length_exp: + s_nRuleIDs[eRule] = StrToRuleID("length_exp"); break; + case OSQLParseNode::char_value_fct: + s_nRuleIDs[eRule] = StrToRuleID("char_value_fct"); break; + case OSQLParseNode::odbc_call_spec: + s_nRuleIDs[eRule] = StrToRuleID("odbc_call_spec"); break; + case OSQLParseNode::in_predicate: + s_nRuleIDs[eRule] = StrToRuleID("in_predicate"); break; + case OSQLParseNode::existence_test: + s_nRuleIDs[eRule] = StrToRuleID("existence_test"); break; + case OSQLParseNode::unique_test: + s_nRuleIDs[eRule] = StrToRuleID("unique_test"); break; + case OSQLParseNode::all_or_any_predicate: + s_nRuleIDs[eRule] = StrToRuleID("all_or_any_predicate"); break; + case OSQLParseNode::named_columns_join: + s_nRuleIDs[eRule] = StrToRuleID("named_columns_join"); break; + case OSQLParseNode::join_condition: + s_nRuleIDs[eRule] = StrToRuleID("join_condition"); break; + case OSQLParseNode::joined_table: + s_nRuleIDs[eRule] = StrToRuleID("joined_table"); break; + case OSQLParseNode::boolean_factor: + s_nRuleIDs[eRule] = StrToRuleID("boolean_factor"); break; + case OSQLParseNode::not: + s_nRuleIDs[eRule] = StrToRuleID("not"); break; + case OSQLParseNode::boolean_test: + s_nRuleIDs[eRule] = StrToRuleID("boolean_test"); break; + case OSQLParseNode::manipulative_statement: + s_nRuleIDs[eRule] = StrToRuleID("manipulative_statement"); break; + case OSQLParseNode::subquery: + s_nRuleIDs[eRule] = StrToRuleID("subquery"); break; + case OSQLParseNode::value_exp_commalist: + s_nRuleIDs[eRule] = StrToRuleID("value_exp_commalist"); break; + case OSQLParseNode::odbc_fct_spec: + s_nRuleIDs[eRule] = StrToRuleID("odbc_fct_spec"); break; + case OSQLParseNode::union_statement: + s_nRuleIDs[eRule] = StrToRuleID("union_statement"); break; + case OSQLParseNode::outer_join_type: + s_nRuleIDs[eRule] = StrToRuleID("outer_join_type"); break; + case OSQLParseNode::char_value_exp: + s_nRuleIDs[eRule] = StrToRuleID("char_value_exp"); break; + case OSQLParseNode::term: + s_nRuleIDs[eRule] = StrToRuleID("term"); break; + case OSQLParseNode::value_exp_primary: + s_nRuleIDs[eRule] = StrToRuleID("value_exp_primary"); break; + case OSQLParseNode::value_exp: + s_nRuleIDs[eRule] = StrToRuleID("value_exp"); break; + default: + DBG_ERROR("interner Fehler: Regel nicht bekannt, in OSQLParser::RuleID nachtragen!"); + } + } + return s_nRuleIDs[(sal_uInt16)eRule]; +} + +//----------------------------------------------------------------------------- +sal_Int16 OSQLParser::buildNode(OSQLParseNode*& pAppend,OSQLParseNode* pLiteral,OSQLParseNode*& pCompare) +{ + OSQLParseNode* pColumnRef = new OSQLInternalNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::column_ref)); + pColumnRef->append(new OSQLInternalNode(m_sFieldName,SQL_NODE_NAME)); + OSQLParseNode* pComp = new OSQLInternalNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::comparison_predicate)); + pComp->append(pColumnRef); + pComp->append(pCompare); + pComp->append(pLiteral); + pAppend->append(pComp); + return 1; +} + +//----------------------------------------------------------------------------- +sal_Int16 OSQLParser::buildNode_STR_NUM(OSQLParseNode*& pAppend,OSQLParseNode*& pLiteral,OSQLParseNode*& pCompare) +{ + OSQLParseNode* pColumnRef = new OSQLInternalNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::column_ref)); + pColumnRef->append(new OSQLInternalNode(m_sFieldName,SQL_NODE_NAME)); + OSQLParseNode* pComp = new OSQLInternalNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::comparison_predicate)); + pComp->append(pColumnRef); + pComp->append(pCompare); + + if (m_nFormatKey) + { + sal_Int16 nScale = 0; + try + { + Any aValue = getNumberFormatProperty(m_xFormatter->getNumberFormatsSupplier(), + m_nFormatKey, rtl::OUString::createFromAscii("Decimals")); + aValue >>= nScale; + } + catch ( ... ) + { + } + + int nErrno=0; + double dValue = SolarMath::StringToDouble(pLiteral->getTokenValue().GetBuffer(), *m_pIntl, nErrno); + String aValue; + SolarMath::DoubleToString(aValue, dValue, 'F', nScale, m_pIntl->GetNumDecimalSep(), sal_True); + pComp->append(new OSQLInternalNode(aValue,SQL_NODE_STRING)); + } + else + pComp->append(new OSQLInternalNode(pLiteral->getTokenValue(),SQL_NODE_STRING)); + + pAppend->append(pComp); + + delete pLiteral; + pLiteral = NULL; + + return 1; +} + +//----------------------------------------------------------------------------- +sal_Int16 OSQLParser::buildNode_Date(const double& fValue, sal_Int16 nType, OSQLParseNode*& pAppend,OSQLParseNode* pLiteral,OSQLParseNode*& pCompare) +{ + OSQLParseNode* pColumnRef = new OSQLInternalNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::column_ref)); + pColumnRef->append(new OSQLInternalNode(m_sFieldName,SQL_NODE_NAME)); + OSQLParseNode* pComp = new OSQLInternalNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::comparison_predicate)); + pComp->append(pColumnRef); + pComp->append(pCompare); + + OSQLParseNode* pNewNode = new OSQLInternalNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::set_fct_spec)); + pNewNode->append(new OSQLInternalNode(String::CreateFromAscii("{"), SQL_NODE_PUNCTUATION)); + OSQLParseNode* pDateNode = new OSQLInternalNode(aEmptyString, SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::odbc_fct_spec)); + pNewNode->append(pDateNode); + pNewNode->append(new OSQLInternalNode(String::CreateFromAscii("}"), SQL_NODE_PUNCTUATION)); + + switch (nType) + { + case DataType::DATE: + { + Date aDate = ToDate(m_xFormatter->getNumberFormatsSupplier(), fValue); + String aString = ToDateString(aDate); + pDateNode->append(new OSQLInternalNode(aEmptyString, SQL_NODE_KEYWORD, SQL_TOKEN_D)); + pDateNode->append(new OSQLInternalNode(aString, SQL_NODE_STRING)); + break; + } + case DataType::TIME: + { + Time aTime = ToTime(fValue); + String aString = ToTimeString(aTime); + pDateNode->append(new OSQLInternalNode(aEmptyString, SQL_NODE_KEYWORD, SQL_TOKEN_T)); + pDateNode->append(new OSQLInternalNode(aString, SQL_NODE_STRING)); + break; + } + case DataType::TIMESTAMP: + { + DateTime aDateTime = ToDateTime(m_xFormatter->getNumberFormatsSupplier(), fValue); + if (aDateTime.GetMSFromTime() / fMilliSecondsPerDay) + { + String aString = ToDateTimeString(aDateTime); + pDateNode->append(new OSQLInternalNode(aEmptyString, SQL_NODE_KEYWORD, SQL_TOKEN_TS)); + pDateNode->append(new OSQLInternalNode(aString, SQL_NODE_STRING)); + } + else + { + pDateNode->append(new OSQLInternalNode(aEmptyString, SQL_NODE_KEYWORD, SQL_TOKEN_D)); + pDateNode->append(new OSQLInternalNode(ToDateString(aDateTime), SQL_NODE_STRING)); + } + break; + } + } + + pComp->append(pNewNode); + pAppend->append(pComp); + + delete pLiteral; + pLiteral = NULL; + + return 1; +} + +//----------------------------------------------------------------------------- +sal_Int16 OSQLParser::buildLikeRule(OSQLParseNode*& pAppend, OSQLParseNode*& pLiteral, const OSQLParseNode* pEscape) +{ + sal_Int16 nErg = 0; + sal_Int32 nType = 0; + + if (!m_xField.is()) + return nErg; + try + { + Any aValue; + { + aValue = m_xField->getPropertyValue(FIELD_STR_TYPE); + aValue >>= nType; + } + } + catch ( ... ) + { + return nErg; + } + + switch (nType) + { + case DataType::CHAR: + case DataType::VARCHAR: + case DataType::LONGVARCHAR: + if(pLiteral->isRule()) + { + pAppend->append(pLiteral); + nErg = 1; + } + else + { + switch(pLiteral->getNodeType()) + { + case SQL_NODE_STRING: + pLiteral->m_aNodeValue = ConvertLikeToken(pLiteral, pEscape, sal_False); + pAppend->append(pLiteral); + nErg = 1; + break; + case SQL_NODE_APPROXNUM: + if (m_xFormatter.is() && m_nFormatKey) + { + sal_Int16 nScale = 0; + try + { + Any aValue = getNumberFormatProperty(m_xFormatter->getNumberFormatsSupplier(), + m_nFormatKey, rtl::OUString::createFromAscii("Decimals")); + aValue >>= nScale; + } + catch ( ... ) + { + } + + int nErrno=0; + String aValue; + double dValue = SolarMath::StringToDouble(pLiteral->getTokenValue().GetBuffer(), OParseContext::getDefaultInternational(), nErrno); + SolarMath::DoubleToString(aValue, dValue, 'F', nScale, '.', sal_True); + pAppend->append(new OSQLInternalNode(aValue,SQL_NODE_STRING)); + } + else + pAppend->append(new OSQLInternalNode(pLiteral->getTokenValue(),SQL_NODE_STRING)); + + delete pLiteral; + nErg = 1; + break; + default: + { + m_sErrorMessage = m_pContext->getErrorMessage(OParseContext::ERROR_VALUE_NO_LIKE); + m_sErrorMessage.SearchAndReplace(String::CreateFromAscii("#1"),pLiteral->getTokenValue()); + } + } + } + break; + default: + m_sErrorMessage = m_pContext->getErrorMessage(OParseContext::ERROR_FIELD_NO_LIKE); + } + return nErg; +} +//----------------------------------------------------------------------------- +sal_Int16 OSQLParser::buildStringNodes(OSQLParseNode*& pLiteral) +{ + if(!pLiteral) + return 1; + + if(SQL_ISRULE(pLiteral,set_fct_spec) || SQL_ISRULE(pLiteral,general_set_fct) || SQL_ISRULE(pLiteral,column_ref) + || SQL_ISRULE(pLiteral,subquery)) + return 1; // here I have a function that I can't transform into a string + + if(pLiteral->getNodeType() == SQL_NODE_INTNUM || pLiteral->getNodeType() == SQL_NODE_APPROXNUM || pLiteral->getNodeType() == SQL_NODE_ACCESS_DATE) + { + OSQLParseNode* pParent = pLiteral->getParent(); + + OSQLParseNode* pNewNode = new OSQLInternalNode(pLiteral->getTokenValue(), SQL_NODE_STRING); + pParent->replace(pLiteral, pNewNode); + delete pLiteral; + pLiteral = NULL; + return 1; + } + + for(sal_uInt32 i=0;i<pLiteral->count();++i) + { + OSQLParseNode* pChild = pLiteral->getChild(i); + buildStringNodes(pChild); + } + if(SQL_ISRULE(pLiteral,term) || SQL_ISRULE(pLiteral,value_exp_primary)) + { + m_sErrorMessage = m_pContext->getErrorMessage(OParseContext::ERROR_INVALID_COMPARE); + return 0; + } + return 1; +} +//----------------------------------------------------------------------------- +sal_Int16 OSQLParser::buildComparsionRule(OSQLParseNode*& pAppend,OSQLParseNode* pLiteral) +{ + OSQLParseNode* pComp = new OSQLInternalNode(String('='), SQL_NODE_EQUAL); + return buildComparsionRule(pAppend,pLiteral,pComp); +} + +//----------------------------------------------------------------------------- +sal_Int16 OSQLParser::buildComparsionRule(OSQLParseNode*& pAppend,OSQLParseNode* pLiteral,OSQLParseNode*& pCompare) +{ + sal_Int16 nErg = 0; + if (m_xField.is()) + { + sal_Int32 nType = 0; + try + { + Any aValue; + { + aValue = m_xField->getPropertyValue(FIELD_STR_TYPE); + aValue >>= nType; + } + } + catch ( ... ) + { + return nErg; + } + + if (pLiteral->isRule() && !SQL_ISRULE(pLiteral,value_exp)) + { + switch(nType) + { + case DataType::CHAR: + case DataType::VARCHAR: + case DataType::LONGVARCHAR: + if(!SQL_ISRULE(pLiteral,char_value_exp) && !buildStringNodes(pLiteral)) + break; + default: + nErg = buildNode(pAppend,pLiteral,pCompare); + } + } + else + { + switch(pLiteral->getNodeType()) + { + case SQL_NODE_STRING: + switch(nType) + { + case DataType::CHAR: + case DataType::VARCHAR: + case DataType::LONGVARCHAR: + nErg = buildNode(pAppend,pLiteral,pCompare); + break; + case DataType::DATE: + case DataType::TIME: + case DataType::TIMESTAMP: + if (m_xFormatter.is()) + { + try + { + // do we have a date + double fValue = m_xFormatter->convertStringToNumber(m_nFormatKey, pLiteral->getTokenValue().GetBuffer()); + nErg = buildNode_Date(fValue, nType, pAppend,pLiteral,pCompare); + } + catch ( ... ) + { + try + { + Reference< ::com::sun::star::util::XNumberFormatsSupplier > xFormatSup = m_xFormatter->getNumberFormatsSupplier(); + Reference< ::com::sun::star::util::XNumberFormatTypes > xFormatTypes(xFormatSup->getNumberFormats(),UNO_QUERY); + if (xFormatTypes.is()) + { + String sLanguage, sCountry; + ConvertLanguageToIsoNames(m_pIntl->GetLanguage(), sLanguage, sCountry); + ::com::sun::star::lang::Locale aLocale(sLanguage.GetBuffer(), + sCountry.GetBuffer(), + rtl::OUString()); + + double fValue = m_xFormatter->convertStringToNumber( + xFormatTypes->getStandardFormat(::com::sun::star::util::NumberFormat::DATE, aLocale), + pLiteral->getTokenValue().GetBuffer()); + nErg = buildNode_Date(fValue, nType, pAppend,pLiteral,pCompare); + } + else + { + nErg = -1; + m_sErrorMessage = m_pContext->getErrorMessage(OParseContext::ERROR_INVALID_DATE_COMPARE); + } + + } + catch ( ... ) + { + nErg = -1; + m_sErrorMessage = m_pContext->getErrorMessage(OParseContext::ERROR_INVALID_DATE_COMPARE); + } + } + } + else + nErg = buildNode(pAppend,pLiteral,pCompare); + + break; + default: + m_sErrorMessage = m_pContext->getErrorMessage(OParseContext::ERROR_INVALID_DATE_COMPARE); + } + break; + case SQL_NODE_ACCESS_DATE: + switch(nType) + { + case DataType::DATE: + case DataType::TIME: + case DataType::TIMESTAMP: + if (m_xFormatter.is()) + { + try + { + // do we have a date + double fValue = m_xFormatter->convertStringToNumber(m_nFormatKey, pLiteral->getTokenValue().GetBuffer()); + nErg = buildNode_Date(fValue, nType, pAppend,pLiteral,pCompare); + } + catch ( ... ) + { + try + { + Reference< ::com::sun::star::util::XNumberFormatsSupplier > xFormatSup = m_xFormatter->getNumberFormatsSupplier(); + Reference< ::com::sun::star::util::XNumberFormatTypes > xFormatTypes(xFormatSup->getNumberFormats(),UNO_QUERY); + if (xFormatTypes.is()) + { + String sLanguage, sCountry; + ConvertLanguageToIsoNames(m_pIntl->GetLanguage(), sLanguage, sCountry); + ::com::sun::star::lang::Locale aLocale(sLanguage.GetBuffer(), + sCountry.GetBuffer(), + rtl::OUString()); + + double fValue = m_xFormatter->convertStringToNumber( + xFormatTypes->getStandardFormat(::com::sun::star::util::NumberFormat::DATE, aLocale), + pLiteral->getTokenValue().GetBuffer()); + nErg = buildNode_Date(fValue, nType, pAppend,pLiteral,pCompare); + } + else + { + nErg = -1; + m_sErrorMessage = m_pContext->getErrorMessage(OParseContext::ERROR_INVALID_DATE_COMPARE); + } + } + catch ( ... ) + { + nErg = -1; + m_sErrorMessage = m_pContext->getErrorMessage(OParseContext::ERROR_INVALID_DATE_COMPARE); + } + } + } + else + { + nErg = -1; + m_sErrorMessage = m_pContext->getErrorMessage(OParseContext::ERROR_INVALID_DATE_COMPARE); + } + break; + default: + m_sErrorMessage = m_pContext->getErrorMessage(OParseContext::ERROR_INVALID_DATE_COMPARE); + } + break; + case SQL_NODE_INTNUM: + switch(nType) + { + case DataType::BIT: + case DataType::DECIMAL: + case DataType::NUMERIC: + case DataType::TINYINT: + case DataType::SMALLINT: + case DataType::INTEGER: + case DataType::BIGINT: + case DataType::REAL: + case DataType::DOUBLE: + // kill thousand seperators if any + if (m_pIntl->GetNumDecimalSep() == ',' ) + { + pLiteral->m_aNodeValue.SearchAndReplaceAll('.', String()); + // and replace decimal + pLiteral->m_aNodeValue.SearchAndReplaceAll(',', '.'); + } + else + pLiteral->m_aNodeValue.SearchAndReplaceAll(',', String()); + nErg = buildNode(pAppend,pLiteral,pCompare); + break; + case DataType::CHAR: + case DataType::VARCHAR: + case DataType::LONGVARCHAR: + nErg = buildNode_STR_NUM(pAppend,pLiteral,pCompare); + break; + default: + m_sErrorMessage = m_pContext->getErrorMessage(OParseContext::ERROR_INVALID_INT_COMPARE); + } + break; + case SQL_NODE_APPROXNUM: + switch(nType) + { + case DataType::DECIMAL: + case DataType::NUMERIC: + case DataType::REAL: + case DataType::DOUBLE: + if (inPredicateCheck()) + { + // kill thousand seperators if any + if (m_pIntl->GetNumDecimalSep() == ',' ) + { + pLiteral->m_aNodeValue.SearchAndReplaceAll('.', String()); + // and replace decimal + pLiteral->m_aNodeValue.SearchAndReplaceAll(',', '.'); + } + else + pLiteral->m_aNodeValue.SearchAndReplaceAll(',', String()); + } + nErg = buildNode(pAppend,pLiteral,pCompare); + break; + case DataType::CHAR: + case DataType::VARCHAR: + case DataType::LONGVARCHAR: + nErg = buildNode_STR_NUM(pAppend,pLiteral,pCompare); + break; + case DataType::INTEGER: + default: + m_sErrorMessage = m_pContext->getErrorMessage(OParseContext::ERROR_INVALID_REAL_COMPARE); + } + break; + } + } + if (!nErg) + --nErg; + } + if (!pCompare->getParent()) // I have no parent so I was not used and I must die :-) + delete pCompare; + return nErg; +} + +//----------------------------------------------------------------------------- +void OSQLParser::reduceLiteral(OSQLParseNode*& pLiteral, sal_Bool bAppendBlank) +{ + DBG_ASSERT(pLiteral->isRule(), "This is no ::com::sun::star::chaos::Rule"); + DBG_ASSERT(pLiteral->count() == 2, "OSQLParser::ReduceLiteral() Invalid count"); + OSQLParseNode* pTemp = pLiteral; + String aValue; + if (bAppendBlank) + { + ((aValue = pLiteral->getChild(0)->getTokenValue()) += String(' ')) += + pLiteral->getChild(1)->getTokenValue(); + } + else + (aValue = pLiteral->getChild(0)->getTokenValue()) += + pLiteral->getChild(1)->getTokenValue(); + + pLiteral = new OSQLInternalNode(aValue,SQL_NODE_STRING); + delete pTemp; +} +// ------------------------------------------------------------------------- +void OSQLParser::error(char *fmt) +{ + if(!m_sErrorMessage.Len()) + { + m_sErrorMessage = m_pContext->getErrorMessage(OParseContext::ERROR_GENERAL); + m_sErrorMessage.AppendAscii(": "); + m_sErrorMessage += m_pContext->getErrorMessage(OParseContext::ERROR_GENERAL_HINT); + m_sErrorMessage.SearchAndReplaceAscii("#",String::CreateFromAscii(fmt)); + } +} +// ------------------------------------------------------------------------- +int OSQLParser::SQLlex() +{ + return s_pScanner->SQLlex(); +} +/*------------------------------------------------------------------------ + + $Log: not supported by cvs2svn $ + Revision 1.1 2000/07/25 10:39:29 oj + new revision + + Revision 1.0 21.07.2000 12:27:34 oj +------------------------------------------------------------------------*/ + diff --git a/connectivity/source/parse/sqlflex.l b/connectivity/source/parse/sqlflex.l new file mode 100644 index 000000000000..446ec2454aea --- /dev/null +++ b/connectivity/source/parse/sqlflex.l @@ -0,0 +1,592 @@ +%{ + +//-------------------------------------------------------------------------- +// +// $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/connectivity/source/parse/sqlflex.l,v 1.1.1.1 2000-09-18 16:14:28 hr Exp $ +// +// Copyright 2000 Sun Microsystems, Inc. All Rights Reserved. +// +// First creation: +// OJ +// +// Last change: +// $Author: hr $ $Date: 2000-09-18 16:14:28 $ $Revision: 1.1.1.1 $ +// +// Description: +// +// +//-------------------------------------------------------------------------- + +#define YY_EXIT 1 // YY_FATAL will not halt the application + +#ifndef _CSTDARG_ +#include <cstdarg> // std::va_list +#endif + +#ifndef _INC_STRING +#include <string.h> +#endif +#ifndef _SOLAR_H +#include <tools/solar.h> +#endif + +#ifndef _CONNECTIVITY_SQLINTERNALNODE_HXX +#include "internalnode.hxx" +#endif + +#ifndef _CONNECTIVITY_SQLYACC_HXX +#define _CONNECTIVITY_SQLYACC_HXX + +#ifndef SQLYYDEBUG +#define SQLYYDEBUG 1 +#endif + +#include "connectivity/sqlbison.hxx" +#endif +#ifndef _CONNECTIVITY_SQLSCAN_HXX +#include "sqlscan.hxx" +#endif +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif +#ifndef _CONNECTIVITY_SQLPARSE_HXX +#include <connectivity/sqlparse.hxx> +#endif +using namespace connectivity; + +//============================================================================= +// +// Erzeugung der Blaetter fuer die Token +// Blaetter werden generell vom Lexer erzeugt + +static String aEmptyString; + +static int gatherString(int delim, int nTyp); +static int gatherName(const char*); +static int gatherNamePre(const char* ); +// has to be set before the parser starts +OSQLScanner* xxx_pGLOBAL_SQLSCAN = NULL; + +#define SQL_NEW_NODE(text, token) \ + SQLyylval.pParseNode = new OSQLInternalNode(text, token); + +#define SQL_NEW_KEYWORD(token) \ + SQLyylval.pParseNode = new OSQLInternalNode(aEmptyString, SQL_NODE_KEYWORD, (token)); + +#define SQL_NEW_NAME SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_NAME) +#define SQL_NEW_INTNUM SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_INTNUM) +#define SQL_NEW_APPROXNUM SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_APPROXNUM) +#define SQL_NEW_STRING SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_STRING) +#define SQL_NEW_COMPARISON SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_COMPARISON) +#define SQL_NEW_AMMSC SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_AMMSC) +#define SQL_NEW_DATE SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_ACCESS_DATE) + +#define YY_INPUT(buf,result,max_size) \ +{ \ + buf[0] = xxx_pGLOBAL_SQLSCAN->SQLyygetc(); \ + result = buf[0] != -1; \ +} + +#define YY_FATAL_ERROR(msg) \ +{ \ + xxx_pGLOBAL_SQLSCAN->SQLyyerror(msg); \ +} + +// +//============================================================================= + +%} +%e 2500 +%n 2900 +%p 8500 + +%s SQL +%s PREDICATE_ENG +%s PREDICATE_GER +%s DATE +%s STRING + +%option noyywrap +%option never-interactive +%% + +[Aa][Ll][Ll] {SQL_NEW_KEYWORD(SQL_TOKEN_ALL); return SQL_TOKEN_ALL; } +[Aa][Ll][Tt][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_ALTER); return SQL_TOKEN_ALTER; } +[Aa][Nn][Dd] {SQL_NEW_KEYWORD(SQL_TOKEN_AND); return SQL_TOKEN_AND; } +[Aa][Nn][Yy] {SQL_NEW_KEYWORD(SQL_TOKEN_ANY); return SQL_TOKEN_ANY; } +[Aa][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_AS); return SQL_TOKEN_AS; } +[Aa][Ss][Cc] {SQL_NEW_KEYWORD(SQL_TOKEN_ASC); return SQL_TOKEN_ASC; } +[Aa][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_AT); return SQL_TOKEN_AT; } +[Aa][Uu][Tt][Hh][Oo][Rr][Ii][Zz][Aa][Tt][Ii][Oo][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_AUTHORIZATION); return SQL_TOKEN_AUTHORIZATION; } +[Aa][Vv][Gg] {SQL_NEW_KEYWORD(SQL_TOKEN_AVG); return SQL_TOKEN_AVG; } + +[Bb][Ee][Tt][Ww][Ee][Ee][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_BETWEEN); return SQL_TOKEN_BETWEEN; } +[Bb][Ii][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_BIT); return SQL_TOKEN_BIT; } +[Bb][Ii][Tt]_[Ll][Ee][Nn][Gg][Tt][Hh] {SQL_NEW_KEYWORD(SQL_TOKEN_BIT_LENGTH); return SQL_TOKEN_BIT_LENGTH; } +[Bb][Oo][Tt][Hh] {SQL_NEW_KEYWORD(SQL_TOKEN_BOTH); return SQL_TOKEN_BOTH; } +[Bb][Yy] {SQL_NEW_KEYWORD(SQL_TOKEN_BY); return SQL_TOKEN_BY; } + +[Cc][Aa][Ll][Ll] {SQL_NEW_KEYWORD(SQL_TOKEN_CALL); return SQL_TOKEN_CALL; } +[Cc][Aa][Ss][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_CAST); return SQL_TOKEN_CAST; } +[Cc][Hh][Aa][Rr]([Aa][Cc][Tt][Ee][Rr])? {SQL_NEW_KEYWORD(SQL_TOKEN_CHARACTER); return SQL_TOKEN_CHARACTER; } +[Cc][Hh][Aa][Rr]([Aa][Cc][Tt][Ee][Rr])?_[Ll][Ee][Nn][Gg][Tt][Hh] {SQL_NEW_KEYWORD(SQL_TOKEN_CHAR_LENGTH); return SQL_TOKEN_CHAR_LENGTH; } +[Cc][Hh][Ee][Cc][Kk] {SQL_NEW_KEYWORD(SQL_TOKEN_CHECK); return SQL_TOKEN_CHECK; } +[Cc][Oo][Ll][Ll][Aa][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_COLLATE); return SQL_TOKEN_COLLATE; } +[Cc][Oo][Mm][Mm][Ii][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_COMMIT); return SQL_TOKEN_COMMIT; } +[Cc][Oo][Nn][Tt][Ii][Nn][Uu][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_CONTINUE); return SQL_TOKEN_CONTINUE; } +[Cc][Oo][Nn][Vv][Ee][Rr][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_CONVERT); return SQL_TOKEN_CONVERT; } +[Cc][Oo][Uu][Nn][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_COUNT); return SQL_TOKEN_COUNT; } +[Cc][Rr][Ee][Aa][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_CREATE); return SQL_TOKEN_CREATE; } +[Cc][Rr][Oo][Ss][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_CROSS); return SQL_TOKEN_CROSS; } +[Cc][Uu][Rr][Rr][Ee][Nn][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT); return SQL_TOKEN_CURRENT; } +[Cc][Uu][Rr][Rr][Ee][Nn][Tt]_[Dd][Aa][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_DATE); return SQL_TOKEN_CURRENT_DATE; } +[Cc][Uu][Rr][Rr][Ee][Nn][Tt]_[Tt][Ii][Mm][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_TIME); return SQL_TOKEN_CURRENT_TIME; } +[Cc][Uu][Rr][Rr][Ee][Nn][Tt]_[Tt][Ii][Mm][Ee][Ss][Tt][Aa][Mm][Pp] {SQL_NEW_KEYWORD(SQL_TOKEN_CURRENT_TIMESTAMP); return SQL_TOKEN_CURRENT_TIMESTAMP; } +[Cc][Uu][Rr][Ss][Oo][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_CURSOR); return SQL_TOKEN_CURSOR; } + +[Dd] {SQL_NEW_KEYWORD(SQL_TOKEN_D); return SQL_TOKEN_D; } +[Dd][Aa][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_DATE); return SQL_TOKEN_DATE; } +[Dd][Aa][Yy] {SQL_NEW_KEYWORD(SQL_TOKEN_DAY); return SQL_TOKEN_DAY; } +[Dd][Ee][Cc] {SQL_NEW_KEYWORD(SQL_TOKEN_DEC); return SQL_TOKEN_DEC; } +[Dd][Ee][Cc][Ii][Mm][Aa][Ll] {SQL_NEW_KEYWORD(SQL_TOKEN_DECIMAL); return SQL_TOKEN_DECIMAL; } +[Dd][Ee][Cc][Ll][Aa][Rr][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_DECLARE); return SQL_TOKEN_DECLARE; } +[Dd][Ee][Ff][Aa][Uu][Ll][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_DEFAULT); return SQL_TOKEN_DEFAULT; } +[Dd][Ee][Ll][Ee][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_DELETE); return SQL_TOKEN_DELETE; } +[Dd][Ee][Ss][Cc] {SQL_NEW_KEYWORD(SQL_TOKEN_DESC); return SQL_TOKEN_DESC; } +[Dd][Ii][Ss][Tt][Ii][Nn][Cc][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_DISTINCT); return SQL_TOKEN_DISTINCT; } +[Dd][Oo][Uu][Bb][Ll][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_DOUBLE); return SQL_TOKEN_DOUBLE; } +[Dd][Rr][Oo][Pp] {SQL_NEW_KEYWORD(SQL_TOKEN_DROP); return SQL_TOKEN_DROP; } + +[Ee][Ss][Cc][Aa][Pp][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_ESCAPE); return SQL_TOKEN_ESCAPE; } +[Ee][Xx][Cc][Ee][Pp][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_EXCEPT); return SQL_TOKEN_EXCEPT; } +[Ee][Xx][Ii][Ss][Tt][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_EXISTS); return SQL_TOKEN_EXISTS; } +[Ee][Xx][Tt][Rr][Aa][Cc][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_EXTRACT); return SQL_TOKEN_EXTRACT; } + +[Ff][Aa][Ll][Ss][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_FALSE); return SQL_TOKEN_FALSE; } +[Ff][Ee][Tt][Cc][Hh] {SQL_NEW_KEYWORD(SQL_TOKEN_FETCH); return SQL_TOKEN_FETCH; } +[Ff][Ll][Oo][Aa][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_FLOAT); return SQL_TOKEN_FLOAT; } +[Ff][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_FN); return SQL_TOKEN_FN; } +[Ff][Oo][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_FOR); return SQL_TOKEN_FOR; } +[Ff][Oo][Rr][Ee][Ii][Gg][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_FOREIGN); return SQL_TOKEN_FOREIGN; } +[Ff][Oo][Uu][Nn][Dd] {SQL_NEW_KEYWORD(SQL_TOKEN_FOUND); return SQL_TOKEN_FOUND; } +[Ff][Rr][Oo][Mm] {SQL_NEW_KEYWORD(SQL_TOKEN_FROM); return SQL_TOKEN_FROM; } +[Ff][Uu][Ll][Ll] {SQL_NEW_KEYWORD(SQL_TOKEN_FULL); return SQL_TOKEN_FULL; } + +[Gg][Rr][Aa][Nn][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_GRANT); return SQL_TOKEN_GRANT; } +[Gg][Rr][Oo][Uu][Pp] {SQL_NEW_KEYWORD(SQL_TOKEN_GROUP); return SQL_TOKEN_GROUP; } + +[Hh][Aa][Vv][Ii][Nn][Gg] {SQL_NEW_KEYWORD(SQL_TOKEN_HAVING); return SQL_TOKEN_HAVING; } +[Hh][Oo][Uu][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_HOUR); return SQL_TOKEN_HOUR; } + +[Ii][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_IN); return SQL_TOKEN_IN; } +[Ii][Nn][Nn][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_INNER); return SQL_TOKEN_INNER; } +[Ii][Nn][Ss][Ee][Rr][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_INSERT); return SQL_TOKEN_INSERT; } +[Ii][Nn][Tt]([Ee][Gg][Ee][Rr])? {SQL_NEW_KEYWORD(SQL_TOKEN_INTEGER); return SQL_TOKEN_INTEGER; } +[Ii][Nn][Tt][Ee][Rr][Ss][Ee][Cc][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_INTERSECT); return SQL_TOKEN_INTERSECT; } +[Ii][Nn][Tt][Oo] {SQL_NEW_KEYWORD(SQL_TOKEN_INTO); return SQL_TOKEN_INTO; } +[Ii][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_IS); return SQL_TOKEN_IS; } + +[Jj][Oo][Ii][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_JOIN); return SQL_TOKEN_JOIN; } + +[Kk][Ee][Yy] {SQL_NEW_KEYWORD(SQL_TOKEN_KEY); return SQL_TOKEN_KEY; } + +[Ll][Ee][Aa][Dd][Ii][Nn][Gg] {SQL_NEW_KEYWORD(SQL_TOKEN_LEADING); return SQL_TOKEN_LEADING; } +[Ll][Ee][Ff][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_LEFT); return SQL_TOKEN_LEFT; } +[Ll][Ii][Kk][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_LIKE); return SQL_TOKEN_LIKE; } +[Ll][Oo][Cc][Aa][Ll] {SQL_NEW_KEYWORD(SQL_TOKEN_LOCAL); return SQL_TOKEN_LOCAL; } +[Ll][Oo][Ww][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_LOWER); return SQL_TOKEN_LOWER; } + +[Mm][Aa][Xx] {SQL_NEW_KEYWORD(SQL_TOKEN_MAX); return SQL_TOKEN_MAX; } +[Mm][Ii][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_MIN); return SQL_TOKEN_MIN; } +[Mm][Ii][Nn][Uu][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_MINUTE); return SQL_TOKEN_MINUTE; } +[Mm][Oo][Nn][Tt][Hh] {SQL_NEW_KEYWORD(SQL_TOKEN_MONTH); return SQL_TOKEN_MONTH; } + +[Nn][Aa][Tt][Uu][Rr][Aa][LL] {SQL_NEW_KEYWORD(SQL_TOKEN_NATURAL); return SQL_TOKEN_NATURAL; } +[Nn][Cc][Hh][Aa][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_NCHAR); return SQL_TOKEN_NCHAR; } +[Nn][Oo][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_NOT); return SQL_TOKEN_NOT; } +[Nn][Uu][Ll][Ll] {SQL_NEW_KEYWORD(SQL_TOKEN_NULL); return SQL_TOKEN_NULL; } +[Nn][Uu][Mm][Ee][Rr][Ii][Cc] {SQL_NEW_KEYWORD(SQL_TOKEN_NUMERIC); return SQL_TOKEN_NUMERIC; } + +[Oo][Cc][Tt][Ee][Tt]_[Ll][Ee][Nn][Gg][Tt][Hh] {SQL_NEW_KEYWORD(SQL_TOKEN_OCTECT_LENGTH); return SQL_TOKEN_OCTECT_LENGTH; } +[Oo][Ff] {SQL_NEW_KEYWORD(SQL_TOKEN_OF); return SQL_TOKEN_OF; } +[Oo][Jj] {SQL_NEW_KEYWORD(SQL_TOKEN_OJ); return SQL_TOKEN_OJ; } +[Oo][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_ON); return SQL_TOKEN_ON; } +[Oo][Pp][Tt][Ii][Oo][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_OPTION); return SQL_TOKEN_OPTION; } +[Oo][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_OR); return SQL_TOKEN_OR; } +[Oo][Rr][Dd][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_ORDER); return SQL_TOKEN_ORDER; } +[Oo][Uu][Tt][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_OUTER); return SQL_TOKEN_OUTER; } + +[Pp][Oo][Ss][Ii][Tt][Ii][Oo][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_POSITION); return SQL_TOKEN_POSITION; } +[Pp][Rr][Ee][Cc][Ii][Ss][Ii][Oo][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_PRECISION); return SQL_TOKEN_PRECISION; } +[Pp][Rr][Ii][Mm][Aa][Rr][Yy] {SQL_NEW_KEYWORD(SQL_TOKEN_PRIMARY); return SQL_TOKEN_PRIMARY; } +[Pp][Rr][Ii][Vv][Ii][Ll][Ee][Gg][Ee][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_PRIVILEGES); return SQL_TOKEN_PRIVILEGES; } +[Pp][Rr][Oo][Cc][Ee][Dd][Uu][Rr][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_PROCEDURE); return SQL_TOKEN_PROCEDURE; } +[Pp][Uu][Bb][Ll][Ii][Cc] {SQL_NEW_KEYWORD(SQL_TOKEN_PUBLIC); return SQL_TOKEN_PUBLIC; } + +[Rr][Ee][Aa][Ll] {SQL_NEW_KEYWORD(SQL_TOKEN_REAL); return SQL_TOKEN_REAL; } +[Rr][Ee][Ff][Ee][Rr][Ee][Nn][Cc][Ee][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_REFERENCES); return SQL_TOKEN_REFERENCES; } +[Rr][Oo][Ll][Ll][Bb][Aa][Cc][Kk] {SQL_NEW_KEYWORD(SQL_TOKEN_ROLLBACK); return SQL_TOKEN_ROLLBACK; } +[Rr][Ii][Gg][Hh][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_RIGHT); return SQL_TOKEN_RIGHT; } + +[Ss][Cc][Hh][Ee][Mm][Aa] {SQL_NEW_KEYWORD(SQL_TOKEN_SCHEMA); return SQL_TOKEN_SCHEMA; } +[Ss][Ee][Cc][Ee][Oo][Nn][Dd] {SQL_NEW_KEYWORD(SQL_TOKEN_SECOND); return SQL_TOKEN_SECOND; } +[Ss][Ee][Ll][Ee][Cc][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_SELECT); return SQL_TOKEN_SELECT; } +[Ss][Ee][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_SET); return SQL_TOKEN_SET; } +[Ss][Ii][Zz][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_SIZE); return SQL_TOKEN_SIZE; } +[Ss][Mm][Aa][Ll][Ll][Ii][Nn][Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_SMALLINT); return SQL_TOKEN_SMALLINT; } +[Ss][Oo][Mm][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_SOME); return SQL_TOKEN_SOME; } +[Ss][Uu][Bb][Ss][Tt][Rr][Ii][Nn][Gg] {SQL_NEW_KEYWORD(SQL_TOKEN_SUBSTRING); return SQL_TOKEN_SUBSTRING; } +[Ss][Uu][Mm] {SQL_NEW_KEYWORD(SQL_TOKEN_SUM); return SQL_TOKEN_SUM; } + +[Tt] {SQL_NEW_KEYWORD(SQL_TOKEN_T); return SQL_TOKEN_T; } +[Tt][Aa][Bb][Ll][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_TABLE); return SQL_TOKEN_TABLE; } +[Tt][Ii][Mm][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_TIME); return SQL_TOKEN_TIME; } +[Tt][Ii][Mm][Ee][Ss][Tt][Aa][Mm][Pp] {SQL_NEW_KEYWORD(SQL_TOKEN_TIMESTAMP); return SQL_TOKEN_TIMESTAMP; } +[Tt][Ii][Mm][Ee][Zz][Oo][Nn][Ee]_[Hh][Oo][Uu][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_TIMEZONE_HOUR); return SQL_TOKEN_TIMEZONE_HOUR; } +[Tt][Ii][Mm][Ee][Zz][Oo][Nn][Ee]_[Mm][Ii][Nn][Uu][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_TIMEZONE_MINUTE); return SQL_TOKEN_TIMEZONE_MINUTE; } +[Tt][Oo] {SQL_NEW_KEYWORD(SQL_TOKEN_TO); return SQL_TOKEN_TO; } +[Tt][Rr][Aa][Ii][Ll][Ii][Nn][Gg] {SQL_NEW_KEYWORD(SQL_TOKEN_TRAILING); return SQL_TOKEN_TRAILING; } +[Tt][Rr][Aa][Nn][Ss][Ll][Aa][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_TRANSLATE); return SQL_TOKEN_TRANSLATE; } +[Tt][Rr][Ii][Mm] {SQL_NEW_KEYWORD(SQL_TOKEN_TRIM); return SQL_TOKEN_TRIM; } +[Tt][Rr][Uu][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_TRUE); return SQL_TOKEN_TRUE; } +[Tt][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_TS); return SQL_TOKEN_TS; } + +[Uu][Nn][Ii][Oo][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_UNION); return SQL_TOKEN_UNION; } +[Uu][Nn][Ii][Qq][Uu][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_UNIQUE); return SQL_TOKEN_UNIQUE; } +[Uu][Nn][Kk][Nn][Oo][Ww][Nn] {SQL_NEW_KEYWORD(SQL_TOKEN_UNKNOWN); return SQL_TOKEN_UNKNOWN; } +[Uu][Pp][Pp][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_UPPER); return SQL_TOKEN_UPPER; } +[Uu][Pp][Dd][Aa][Tt][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_UPDATE); return SQL_TOKEN_UPDATE; } +[Uu][Ss][Aa][Gg][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_USAGE); return SQL_TOKEN_USAGE; } +[Uu][Ss][Ee][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_USER); return SQL_TOKEN_USER; } +[Uu][Ss][Ii][Nn][Gg] {SQL_NEW_KEYWORD(SQL_TOKEN_USING); return SQL_TOKEN_USING; } + +[Vv][Aa][Ll][Uu][Ee][Ss] {SQL_NEW_KEYWORD(SQL_TOKEN_VALUES); return SQL_TOKEN_VALUES; } +[Vv][Ii][Ee][Ww] {SQL_NEW_KEYWORD(SQL_TOKEN_VIEW); return SQL_TOKEN_VIEW; } + +[Ww][Hh][Ee][Rr][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_WHERE); return SQL_TOKEN_WHERE; } +[Ww][Ii][Tt][Hh] {SQL_NEW_KEYWORD(SQL_TOKEN_WITH); return SQL_TOKEN_WITH; } +[Ww][Oo][Rr][Kk] {SQL_NEW_KEYWORD(SQL_TOKEN_WORK); return SQL_TOKEN_WORK; } + +[Yy][Ee][Aa][Rr] {SQL_NEW_KEYWORD(SQL_TOKEN_YEAR); return SQL_TOKEN_YEAR; } + +[Zz][Oo][Nn][Ee] {SQL_NEW_KEYWORD(SQL_TOKEN_ZONE); return SQL_TOKEN_ZONE; } + +"<" { SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_LESS);return LESS;} +">" { SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_GREAT);return GREAT;} +"=" { SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_EQUAL);return EQUAL;} +"<=" { SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_LESSEQ);return LESSEQ;} +">=" { SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_GREATEQ);return GREATEQ;} +"<>" { SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_NOTEQUAL);return NOTEQUAL;} +"!=" { SQL_NEW_NODE(String::CreateFromAscii(SQLyytext), SQL_NODE_NOTEQUAL);return NOTEQUAL;} + + +[-+*/:(),.;?{}] { return SQLyytext[0]; } + +<SQL>[A-Za-z][A-Za-z0-9_]* {return gatherName( SQLyytext);} + +<SQL>([0-9]+) | +<SQL>([0-9]+"."[0-9]*) | +<SQL>("."[0-9]*) {SQL_NEW_INTNUM; return SQL_TOKEN_INTNUM;} + +<SQL>[0-9]+[eE][+-]?[0-9]+ | +<SQL>[0-9]+"."[0-9]*[eE][+-]?[0-9]+ | +<SQL>"."[0-9]*[eE][+-]?[0-9]+ {SQL_NEW_APPROXNUM; return SQL_TOKEN_APPROXNUM; } + +<PREDICATE_GER,PREDICATE_ENG,DATE>[A-Za-z][A-Za-z0-9_%.,*?]* {return gatherNamePre(SQLyytext);} + +<PREDICATE_GER,PREDICATE_ENG>([0-9]+) {SQL_NEW_INTNUM; return SQL_TOKEN_INTNUM;} +<PREDICATE_ENG>([0-9]{1,3}(","[0-9]{3})+) {SQL_NEW_INTNUM; return SQL_TOKEN_INTNUM;} +<PREDICATE_GER>([0-9]{1,3}("."[0-9]{3})+) {SQL_NEW_INTNUM; return SQL_TOKEN_INTNUM;} + +<PREDICATE_ENG>([0-9]+"."[0-9]+) | +<PREDICATE_ENG>([0-9]{1,3}(","[0-9]{3})+"."[0-9]+) | +<PREDICATE_ENG>("."[0-9]+) {SQL_NEW_APPROXNUM; return SQL_TOKEN_APPROXNUM; } +<PREDICATE_ENG>[0-9]+[eE][+-]?[0-9]+ | +<PREDICATE_ENG>[0-9]+"."[0-9]*[eE][+-]?[0-9]+ | +<PREDICATE_ENG>"."[0-9]*[eE][+-]?[0-9]+ {SQL_NEW_APPROXNUM; return SQL_TOKEN_APPROXNUM; } + +<PREDICATE_GER>([0-9]+","[0-9]+) | +<PREDICATE_GER>([0-9]{1,3}("."[0-9]{3})+","[0-9]+) | +<PREDICATE_GER>(","[0-9]+) {SQL_NEW_APPROXNUM; return SQL_TOKEN_APPROXNUM; } +<PREDICATE_GER>[0-9]+[eE][+-]?[0-9]+ | +<PREDICATE_GER>[0-9]+","[0-9]*[eE][+-]?[0-9]+ | +<PREDICATE_GER>","[0-9]*[eE][+-]?[0-9]+ {SQL_NEW_APPROXNUM; return SQL_TOKEN_APPROXNUM; } + +<PREDICATE_GER,PREDICATE_ENG>[0-9.,][A-Za-z0-9_.,%]* {return gatherNamePre(SQLyytext);} + +<SQL>\" { return gatherString('\"',0); } +<SQL>` { return gatherString('`' ,0); } + +<PREDICATE_GER,PREDICATE_ENG,DATE>"[" { return gatherString(']' ,0);} + +\' { return gatherString('\'',1); } + +<PREDICATE_GER,PREDICATE_ENG,DATE># { return gatherString('#' ,2); } + +<DATE>[0-9]{1,4}[^ ]*[0-9] | +<DATE>[0-9]{1,4}[^ ]*[0-9][ ][0-9]{1,4}[^ ]*[0-9] { SQL_NEW_DATE; return SQL_TOKEN_ACCESS_DATE;} + +<STRING>["-""+""*""/"":""("")"",""."";""?""{""}"] { return SQLyytext[0]; } /* */ +<STRING>"[" { return gatherString(']' ,0); } +<STRING>[^ ':[]* { return gatherNamePre(SQLyytext); } + +\n {} + +[ \t\r]+ ; + +"--".*$ ; + +. {YY_FATAL_ERROR("Invalid symbol"); return SQL_TOKEN_INVALIDSYMBOL;} + +%% + +/* + * Read SQL string literal + * Valid strings: + * '' 'a string' 'quote '' within string' + * "" "a string" "quote "" within string" + * nTyp == 0 -> SQL_NODE_NAME + * nTyp == 1 -> SQL_NODE_STRING + * nTyp == 2 -> SQL_NODE_ACCESS_DATE + */ +int gatherString( int delim, int nTyp) +{ + int ch; + static sal_Int32 BUFFERSIZE = 256; + static char* Buffer = new char[BUFFERSIZE]; + + char *s = Buffer; + int nPos = 0; + + while ((ch = yyinput()) != EOF) + { + if (ch == delim) + { + if ((ch = yyinput()) != delim) + { + if (ch != EOF) + unput(ch); + + *s = '\0'; + + switch(nTyp) + { + case 0: + SQL_NEW_NODE(String(Buffer,RTL_TEXTENCODING_UTF8), SQL_NODE_NAME); + return SQL_TOKEN_NAME; + case 1: + SQL_NEW_NODE(String(Buffer,RTL_TEXTENCODING_UTF8), SQL_NODE_STRING); + return SQL_TOKEN_STRING; + case 2: + SQL_NEW_NODE(String(Buffer,RTL_TEXTENCODING_UTF8), SQL_NODE_ACCESS_DATE); + return SQL_TOKEN_ACCESS_DATE; + } + } + else + { + *s++ = ch; + if (++nPos == BUFFERSIZE) + { + ByteString aBuf(Buffer); + delete Buffer; + BUFFERSIZE *=2; + Buffer = new char[BUFFERSIZE]; + for(xub_StrLen i=0;i<aBuf.Len();++i,++Buffer) + *Buffer = aBuf.GetChar(i); + s = &Buffer[nPos]; + } + } + + } + else if (ch == '\r' || ch == '\n') + break; + else + { + *s++ = ch; + if (++nPos == BUFFERSIZE) + { + ByteString aBuf(Buffer); + delete Buffer; + BUFFERSIZE *=2; + Buffer = new char[BUFFERSIZE]; + for(xub_StrLen i=0;i<aBuf.Len();++i,++Buffer) + *Buffer = aBuf.GetChar(i); + s = &Buffer[nPos]; + } + } + } + *s = '\0'; + YY_FATAL_ERROR("Unterminated name string"); + return SQL_TOKEN_INVALIDSYMBOL; +} + +/* + * Read SQL Name literal + * Valid Names or internatioanl keywords: + * As we have international keywords, we test first on them + */ +int gatherName(const char* text) +{ + OSL_ENSHURE(xxx_pGLOBAL_SQLSCAN,"You forgot to set the scanner!"); + int nToken = xxx_pGLOBAL_SQLSCAN->getInternationalTokenID(text); + switch (nToken) + { + case SQL_TOKEN_LIKE: + case SQL_TOKEN_NOT: + case SQL_TOKEN_NULL: + case SQL_TOKEN_TRUE: + case SQL_TOKEN_FALSE: + case SQL_TOKEN_IS: + case SQL_TOKEN_BETWEEN: + case SQL_TOKEN_OR: + case SQL_TOKEN_AND: + case SQL_TOKEN_COUNT: + case SQL_TOKEN_AVG: + case SQL_TOKEN_MAX: + case SQL_TOKEN_MIN: + case SQL_TOKEN_SUM: + SQL_NEW_KEYWORD(nToken); + return nToken; + default: + SQL_NEW_NODE(String::CreateFromAscii(text), SQL_NODE_NAME); + return SQL_TOKEN_NAME; + } +} +/** + Read SQL Name literal for predicate check + Valid Names or internatioanl keywords: + As we have international keywords, we test first on them +*/ +int gatherNamePre(const char* text) +{ + OSL_ENSHURE(xxx_pGLOBAL_SQLSCAN,"You forgot to set the scanner!"); + int nToken = xxx_pGLOBAL_SQLSCAN->getInternationalTokenID(text); + switch (nToken) + { + case SQL_TOKEN_LIKE: + case SQL_TOKEN_NOT: + case SQL_TOKEN_NULL: + case SQL_TOKEN_TRUE: + case SQL_TOKEN_FALSE: + case SQL_TOKEN_IS: + case SQL_TOKEN_BETWEEN: + case SQL_TOKEN_OR: + case SQL_TOKEN_AND: + case SQL_TOKEN_COUNT: + case SQL_TOKEN_AVG: + case SQL_TOKEN_MAX: + case SQL_TOKEN_MIN: + case SQL_TOKEN_SUM: + SQL_NEW_KEYWORD(nToken); + return nToken; + default: + // we need a special handling for parameter + if (yy_hold_char == ':') + { + SQL_NEW_NODE(String::CreateFromAscii(text), SQL_NODE_NAME); + return SQL_TOKEN_NAME; + } + else + { + SQL_NEW_NODE(String::CreateFromAscii(text), SQL_NODE_STRING); + return SQL_TOKEN_STRING; + } + } +} + +using namespace connectivity; + +static sal_uInt32 Intl_TokenID[] = +{ + SQL_TOKEN_LIKE, SQL_TOKEN_NOT, SQL_TOKEN_NULL, SQL_TOKEN_TRUE, + SQL_TOKEN_FALSE, SQL_TOKEN_IS, SQL_TOKEN_BETWEEN, SQL_TOKEN_OR, + SQL_TOKEN_AND, SQL_TOKEN_AVG, SQL_TOKEN_COUNT, SQL_TOKEN_MAX, + SQL_TOKEN_MIN, SQL_TOKEN_SUM +}; + +DBG_NAME(OSQLScanner); + +//------------------------------------------------------------------------------ +OSQLScanner::OSQLScanner() + : m_nCurrentPos(0) + , m_bInternational(sal_False) + , m_pContext(NULL) + , m_nRule(0) // 0 is INITIAL +{ + DBG_CTOR(OSQLScanner,NULL); +} + +//------------------------------------------------------------------------------ +OSQLScanner::~OSQLScanner() +{ + DBG_DTOR(OSQLScanner,NULL); +} + +//------------------------------------------------------------------------------ +void OSQLScanner::SQLyyerror(char *fmt) +{ + DBG_ASSERT(m_pContext, "OSQLScanner::SQLyyerror: No Context set"); + m_sErrorMessage = m_pContext->getErrorMessage(OParseContext::ERROR_GENERAL); + if (m_nCurrentPos < m_sStatement.Len()) + { + m_sErrorMessage.AppendAscii(": "); + m_sErrorMessage += m_pContext->getErrorMessage(OParseContext::ERROR_GENERAL_HINT); + m_sErrorMessage.SearchAndReplaceAscii("#",String::CreateFromAscii(SQLyytext)); + } +} + +//------------------------------------------------------------------------------ +void OSQLScanner::prepareScan(const String & rNewStatement, OParseContext* pContext, sal_Bool bInternational) +{ + DBG_CHKTHIS(OSQLScanner,NULL); + + BEGIN(m_nRule); + + m_sErrorMessage.Erase(); + m_sStatement = ByteString(rNewStatement, RTL_TEXTENCODING_UTF8); + m_nCurrentPos = 0; + m_bInternational = bInternational; + m_pContext = pContext; +} + +//------------------------------------------------------------------------------ +int OSQLScanner::SQLyygetc(void) +{ + return (m_nCurrentPos >= m_sStatement.Len()) ? -1 : m_sStatement.GetChar(m_nCurrentPos++); +} + +//------------------------------------------------------------------------------ +int OSQLScanner::getInternationalTokenID(const char* sToken) const +{ + DBG_ASSERT(m_pContext, "OSQLScanner::getInternationalTokenID: No Context set"); + return (m_bInternational) ? m_pContext->getIntlKeyCode(ByteString(sToken, RTL_TEXTENCODING_ASCII_US)) : 0; +} +// ------------------------------------------------------------------------- +int OSQLScanner::GetCurrentRule() const { return m_nRule; } +int OSQLScanner::GetGERRule() const { return PREDICATE_GER; } +int OSQLScanner::GetENGRule() const { return PREDICATE_ENG; } +int OSQLScanner::GetSQLRule() const { return SQL; } +int OSQLScanner::GetDATERule() const { return DATE; } +int OSQLScanner::GetSTRINGRule() const { return STRING; } +// ------------------------------------------------------------------------- +void OSQLScanner::setScanner(sal_Bool _bNull) +{ + xxx_pGLOBAL_SQLSCAN = _bNull ? NULL : this; +} +// ------------------------------------------------------------------------- +int OSQLScanner::SQLlex() +{ + return SQLyylex(); +} +/*------------------------------------------------------------------------ + + $Log: not supported by cvs2svn $ + Revision 1.2 2000/08/01 14:26:02 oj + modified + + Revision 1.1 2000/07/25 10:39:47 oj + new revision + + Revision 1.0 21.07.2000 10:54:08 oj +------------------------------------------------------------------------*/ + diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx new file mode 100644 index 000000000000..88e98fa418a7 --- /dev/null +++ b/connectivity/source/parse/sqliterator.cxx @@ -0,0 +1,1583 @@ +/************************************************************************* + * + * $RCSfile: sqliterator.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_PARSE_SQLITERATOR_HXX_ +#include "connectivity/sqliterator.hxx" +#endif + +#ifndef _CONNECTIVITY_SQLPARSE_HXX +#include <connectivity/sqlparse.hxx> +#endif +#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ +#include <com/sun/star/sdbc/ColumnValue.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifdef SQL_TEST_PARSETREEITERATOR +#include <iostream.h> +#endif +#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ +#include "connectivity/PColumn.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif + +using namespace connectivity; +using namespace connectivity::parse; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::sdbc; + +DBG_NAME(OSQLParseTreeIterator); +static String aEmptyString; + +class OPrivateColumns : public sdbcx::OCollection +{ + OSQLColumns m_aColumns; +protected: + virtual Reference< XNamed > createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(RuntimeException) {} + virtual Reference< XPropertySet > createEmptyObject() + { + return NULL; + } +public: + OPrivateColumns(const OSQLColumns& _rColumns, + ::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const ::std::vector< ::rtl::OUString> &_rVector + ) : sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector) + ,m_aColumns(_rColumns) + {} + ~OPrivateColumns() + { + disposing(); + } +}; +// ------------------------------------------------------------------------- +Reference< XNamed > OPrivateColumns::createObject(const ::rtl::OUString& _rName) +{ + return Reference< XNamed >(*find(m_aColumns.begin(),m_aColumns.end(),_rName,isCaseSensitive()),UNO_QUERY); +} +// ------------------------------------------------------------------------- +class OPrivateTables : public sdbcx::OCollection +{ + OSQLTables m_aTables; +protected: + virtual Reference< XNamed > createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(RuntimeException) {} + virtual Reference< XPropertySet > createEmptyObject() + { + return NULL; + } +public: + OPrivateTables(const OSQLTables& _rColumns, + ::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const ::std::vector< ::rtl::OUString> &_rVector + ) : sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector) + ,m_aTables(_rColumns) + {} +}; +// ------------------------------------------------------------------------- +Reference< XNamed > OPrivateTables::createObject(const ::rtl::OUString& _rName) +{ + return Reference< XNamed >(m_aTables.find(_rName)->second,UNO_QUERY); +} + +//----------------------------------------------------------------------------- +OSQLParseTreeIterator::OSQLParseTreeIterator() + : m_pParseTree(NULL) + , m_xTables(NULL) + , m_xDatabaseMetaData(NULL) +{ + DBG_CTOR(OSQLParseTreeIterator,NULL); + m_aSelectColumns = new OSQLColumns(); +} +//----------------------------------------------------------------------------- +OSQLParseTreeIterator::OSQLParseTreeIterator(const Reference< XNameAccess>& _xTables , + const Reference< XDatabaseMetaData>& _xDatabaseMetaData, + const OSQLParseNode* pRoot) + : m_xTables(_xTables) + , m_xDatabaseMetaData(_xDatabaseMetaData) + , m_aTables(_xDatabaseMetaData->storesMixedCaseQuotedIdentifiers()) + , m_aCaseEqual(_xDatabaseMetaData->storesMixedCaseQuotedIdentifiers()) +{ + DBG_CTOR(OSQLParseTreeIterator,NULL); + m_aSelectColumns = new OSQLColumns();// must be done because we need an empty column at zero + setParseTree(pRoot); +} +//----------------------------------------------------------------------------- +OSQLParseTreeIterator::OSQLParseTreeIterator(const OSQLParseTreeIterator & rIter) + :m_xTables(NULL) + ,m_pParseTree(NULL) + , m_xDatabaseMetaData(NULL) +{ + DBG_CTOR(OSQLParseTreeIterator,NULL); + + DBG_ERROR("OSQLParseTreeIterator: Copy-Konstruktor nicht implementiert!"); +} + +//----------------------------------------------------------------------------- +OSQLParseTreeIterator::~OSQLParseTreeIterator() +{ + DBG_DTOR(OSQLParseTreeIterator,NULL); + m_aTables.clear(); +} +// ------------------------------------------------------------------------- +Reference< XNameAccess > OSQLParseTreeIterator::getSelectAsNameAccess(::cppu::OWeakObject& _rParent,::osl::Mutex& _rMutex) const +{ + ::std::vector< ::rtl::OUString> aNames; + for(OSQLColumns::const_iterator aIter = m_aSelectColumns->begin(); aIter != m_aSelectColumns->end();++aIter) + aNames.push_back(getString((*aIter)->getFastPropertyValue(PROPERTY_ID_NAME))); + OPrivateColumns* pCols = new OPrivateColumns(*m_aSelectColumns,_rParent,_rMutex,aNames); + return pCols; +} +// ------------------------------------------------------------------------- +Reference< XNameAccess > OSQLParseTreeIterator::getTablesAsNameAccess(::cppu::OWeakObject& _rParent,::osl::Mutex& _rMutex) const +{ + ::std::vector< ::rtl::OUString> aNames; + for(OSQLTables::const_iterator aIter = m_aTables.begin(); aIter != m_aTables.end();++aIter) + { + Reference<XNamed> xName(aIter->second,UNO_QUERY); + aNames.push_back(xName->getName()); + } + OPrivateTables* pTabs = new OPrivateTables(m_aTables,_rParent,_rMutex,aNames); + return pTabs; +} +//----------------------------------------------------------------------------- +void OSQLParseTreeIterator::setParseTree(const OSQLParseNode * pNewParseTree) +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // alle Eingaben zur"uck setzen + // aIteratorStatus.Clear(); +// for(ULONG i=0; i< m_aTables.count();i++) +// delete m_aTables.getObject(i); + m_aTables.clear(); + + m_aSelectColumns->clear(); + + m_pParseTree = pNewParseTree; + if (!m_pParseTree) + { + m_eStatementType = SQL_STATEMENT_UNKNOWN; + return; + } + + // falls m_pParseTree aber keine Connection, dann Fehler + if(!m_xTables.is()) + { + //aIteratorStatus.setInvalidStatement(); + CallError(RET_BREAK); + return; + } + + // m_aTables.setCaseSensitive(TablesAreSensitive()); + + + // Statement-Typ ermitteln ... + if (SQL_ISRULE(m_pParseTree,select_statement) || SQL_ISRULE(m_pParseTree,union_statement) ) + { + m_eStatementType = SQL_STATEMENT_SELECT; + } + else if (SQL_ISRULE(m_pParseTree,insert_statement)) + { + m_eStatementType = SQL_STATEMENT_INSERT; + } + else if (SQL_ISRULE(m_pParseTree,update_statement_positioned)) + { + m_eStatementType = SQL_STATEMENT_UPDATE; + } + else if (SQL_ISRULE(m_pParseTree,update_statement_searched)) + { + m_eStatementType = SQL_STATEMENT_UPDATE; + } + else if (SQL_ISRULE(m_pParseTree,delete_statement_positioned)) + { + m_eStatementType = SQL_STATEMENT_DELETE; + } + else if (SQL_ISRULE(m_pParseTree,delete_statement_searched)) + { + m_eStatementType = SQL_STATEMENT_DELETE; + } + else if (m_pParseTree->count() == 3 && SQL_ISRULE(m_pParseTree->getChild(1),odbc_call_spec)) + { + m_eStatementType = SQL_STATEMENT_ODBC_CALL; + } + else + { + m_eStatementType = SQL_STATEMENT_UNKNOWN; + //aIteratorStatus.setInvalidStatement(); + CallError(RET_BREAK); + return; + } +} + +//----------------------------------------------------------------------------- +void OSQLParseTreeIterator::traverseOneTableName(const OSQLParseNode * pTableName, const String & rTableRange) +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + + DBG_ASSERT(pTableName != NULL,"OSQLParseTreeIterator::traverseOneTableName: pTableName == NULL"); + + String aTableName; + String aTableRange(rTableRange); + + // Tabellenname abholen + pTableName->parseNodeToStr(aTableName,m_xDatabaseMetaData,NULL,FALSE,FALSE); + // Wenn keine Range Variable angegeben, dann den Tabellennamen verwenden. + if (!aTableRange.Len()) + aTableRange = aTableName; + + if(aTableName.Len()) + { + try + { + if(!m_xTables->hasByName(aTableName)) // name not in XNameAccess + { + const ::rtl::OUString sAll = ::rtl::OUString::createFromAscii("%"); + Sequence< ::rtl::OUString > aSeq; + Reference< XResultSet> xRes = m_xDatabaseMetaData->getTables(Any(),sAll,aTableName,aSeq); + if(xRes.is() && xRes->next()) + { + ::rtl::OUString sCatalog, sSchema, sName; + Reference< XRow > xCurrentRow(xRes, UNO_QUERY); + sCatalog = xCurrentRow->getString(1); + sSchema = xCurrentRow->getString(2); + sName = xCurrentRow->getString(3); + + if(sCatalog.getLength()) + { + aTableName = sCatalog; + aTableName += m_xDatabaseMetaData->getCatalogSeparator().getStr(); + } + if(sSchema.getLength()) + { + aTableName += sSchema.getStr(); + aTableName += ::rtl::OUString::createFromAscii(".").getStr(); + } + aTableName += sName.getStr(); + } + } + Any aTable(m_xTables->getByName(aTableName)); + OSQLTable xSet; + + if(aTable >>= xSet) + m_aTables[aTableRange] = xSet; + }catch(...) + { + if (CallError(RET_CONTINUE)) + m_aTables[aTableRange] = NULL; // ich soll den Fehler ignorieren + } + + } + else + CallError(RET_BREAK,rTableRange); +} +//----------------------------------------------------------------------------- +OSQLParseNode * OSQLParseTreeIterator::getQualified_join(OSQLParseNode *pTableRef,String& aTableRange) +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + aTableRange.Erase(); + + OSQLParseNode *pNode = getTableRef(pTableRef->getChild(0),aTableRange); + if(pNode) + traverseOneTableName(pNode,aTableRange); + ULONG nPos = 4; + if(SQL_ISRULE(pTableRef,cross_union) || pTableRef->getChild(1)->getTokenID() != SQL_TOKEN_NATURAL) + nPos = 3; + + + pNode = getTableRef(pTableRef->getChild(nPos),aTableRange); + if(pNode) + traverseOneTableName(pNode,aTableRange); + return pNode; +} +//----------------------------------------------------------------------------- +OSQLParseNode * OSQLParseTreeIterator::getTableRef(OSQLParseNode *pTableRef,String& aTableRange) +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + OSQLParseNode *pTableName = pTableRef; + if (pTableName->count() == 4 ) + { + if(SQL_ISPUNCTUATION(pTableName->getChild(0),"{")) + { // { OJ joined_table } + getQualified_join(pTableName->getChild(2),aTableRange); + pTableName = NULL; + } + else + { + // Tabellennamen gefunden + if(!SQL_ISRULE(pTableName,table_name)) + pTableName = pTableRef->getChild(0); + aTableRange.Erase(); + if(pTableRef->count() == 4) + aTableRange = pTableRef->getChild(2)->getTokenValue(); // Tabellenrange an Pos 2 + } + } + else if(SQL_ISRULE(pTableName,qualified_join) || SQL_ISRULE(pTableName,cross_union)) + { + getQualified_join(pTableRef,aTableRange); + pTableName = NULL; + } + else if (SQL_ISRULE(pTableName,joined_table)) + { + // '(' qualified_join ')' + getQualified_join(pTableName->getChild(1),aTableRange); + pTableName = NULL; + } + else if(pTableRef->count() == 6) + { + // '(' joined_table ')' as range_variable op_column_commalist + if(SQL_ISRULE(pTableRef->getChild(1),qualified_join) || SQL_ISRULE(pTableRef->getChild(1),cross_union)) + getQualified_join(pTableRef->getChild(1),aTableRange); + else if(SQL_ISRULE(pTableRef->getChild(1),select_statement)) // Unterabfrage + getSelect_statement(pTableRef->getChild(1)); + else if(pTableRef->getChild(1)->count() == 4) + // pTableRef->getChild(1) ->> non_join_query_exp + getSelect_statement(pTableRef->getChild(0)); // query_exp SQL_TOKEN_UNION all query_term + else + {// nyi: tiefere Verschachtelung m"oglch + CallError(4); + } + } + return pTableName; +} +//----------------------------------------------------------------------------- +void OSQLParseTreeIterator::getSelect_statement(OSQLParseNode *pSelect) +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + if(SQL_ISRULE(pSelect,union_statement)) + { + getSelect_statement(pSelect->getChild(0)); + //getSelect_statement(pSelect->getChild(3)); + return; + } + OSQLParseNode * pTableRefCommalist = pSelect->getChild(3)->getChild(0)->getChild(1); + + DBG_ASSERT(pTableRefCommalist != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + DBG_ASSERT(SQL_ISRULE(pTableRefCommalist,table_ref_commalist),"OSQLParseTreeIterator: Fehler im Parse Tree"); + + OSQLParseNode * pTableName = NULL; + String aTableRange; + for (ULONG i = 0; i < pTableRefCommalist->count(); i++) + { // from clause durchlaufen + aTableRange.Erase(); + + if (SQL_ISRULE(pTableRefCommalist->getChild(i),table_name)) + { + pTableName = pTableRefCommalist->getChild(i); + traverseOneTableName(pTableName,aTableRange);// Keine Range Variable + } + else if (SQL_ISRULE(pTableRefCommalist->getChild(i),table_ref)) + { + // Tabellenreferenz kann aus Tabellennamen, Tabellennamen (+),'('joined_table')'(+) bestehen + pTableName = pTableRefCommalist->getChild(i)->getChild(0); + if (SQL_ISRULE(pTableName,table_name)) + { // Tabellennamen gefunden + if(pTableRefCommalist->getChild(i)->count() == 4) // Tabellenrange an Pos 2 + aTableRange = pTableRefCommalist->getChild(i)->getChild(2)->getTokenValue(); + traverseOneTableName(pTableName,aTableRange); + } + else if(SQL_ISPUNCTUATION(pTableName,"{")) + getQualified_join(pTableRefCommalist->getChild(i)->getChild(2),aTableRange); + else // '(' joined_table ')' as range_variable op_column_commalist + getTableRef(pTableRefCommalist->getChild(i),aTableRange); + } + else if (SQL_ISRULE(pTableRefCommalist->getChild(i),qualified_join) || SQL_ISRULE(pTableRefCommalist->getChild(i),cross_union) ) + { + // qualified_join oder cross_union vorhanden + getQualified_join(pTableRefCommalist->getChild(i),aTableRange); + } + else if (SQL_ISRULE(pTableRefCommalist->getChild(i),joined_table)) + { + // '(' qualified_join ')' + getQualified_join(pTableRefCommalist->getChild(i)->getChild(1),aTableRange); + } + else + { + CallError(3,aTableRange); + } + + // if (! aIteratorStatus.IsSuccessful()) break; + } +} +//----------------------------------------------------------------------------- +void OSQLParseTreeIterator::traverseTableNames() +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // aIteratorStatus.Clear(); + + if (m_pParseTree == NULL) { + //aIteratorStatus.setInvalidStatement(); + CallError(3); + return; + } + + OSQLParseNode * pTableName = NULL; + String aTableRange; + + // pTableName auf den (einzigen) Tabellennamen im Statement setzen. + // Je nach Statement (SELECT, INSERT, UPDATE, DELETE) an anderer Position. + // Bei Select koennen mehrere Tabellennamen auftreten, bei den uebrigen Statements + // ist ohnehin immer nur einer moeglich. + + if (m_eStatementType == SQL_STATEMENT_SELECT) + { + OSQLParseNode *pTmp = (OSQLParseNode *)m_pParseTree; + getSelect_statement(pTmp); + } + else if (m_eStatementType == SQL_STATEMENT_INSERT) + { + pTableName = m_pParseTree->getChild(2); + traverseOneTableName(pTableName,aTableRange); + } + else if (m_eStatementType == SQL_STATEMENT_UPDATE) + { + pTableName = m_pParseTree->getChild(1); + traverseOneTableName(pTableName,aTableRange); + } + else if (m_eStatementType == SQL_STATEMENT_DELETE) + { + pTableName = m_pParseTree->getChild(2); + traverseOneTableName(pTableName,aTableRange); + } else + { + CallError(5,aTableRange); + } +} +//----------------------------------------------------------------------------- +String OSQLParseTreeIterator::getColumnAlias(const OSQLParseNode* pDerivedColumn) const +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + String aColumnAlias; + if(pDerivedColumn->getChild(1)->count() == 2) + aColumnAlias = pDerivedColumn->getChild(1)->getChild(1)->getTokenValue(); + else if(!pDerivedColumn->getChild(1)->isRule()) + aColumnAlias = pDerivedColumn->getChild(1)->getTokenValue(); + return aColumnAlias; +} + +//----------------------------------------------------------------------------- +void OSQLParseTreeIterator::getColumnRange(const OSQLParseNode* pColumnRef,String &rColumnName,String &rTableRange) const +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + rColumnName.Erase(); + rTableRange.Erase(); + if(SQL_ISRULE(pColumnRef,column_ref))// ab hier ist es sicher eine Columnref + { + if(pColumnRef->count() > 1) + { + for(INT32 i=0;i<((INT32)pColumnRef->count())-2;i++) // mu"s signed sein, falls count == 1 + pColumnRef->getChild(i)->parseNodeToStr(rTableRange,m_xDatabaseMetaData,NULL,FALSE,FALSE); + // Spaltenname + rColumnName = pColumnRef->getChild(pColumnRef->count()-1)->getChild(0)->getTokenValue(); + } + else + rColumnName = pColumnRef->getChild(0)->getTokenValue(); + } + else if(SQL_ISRULE(pColumnRef,general_set_fct) || SQL_ISRULE(pColumnRef,set_fct_spec)) + { // Funktion + pColumnRef->parseNodeToStr(rColumnName,m_xDatabaseMetaData); + } + else if(pColumnRef->getNodeType() == SQL_NODE_NAME) + rColumnName = pColumnRef->getTokenValue(); +} + +//----------------------------------------------------------------------------- +BOOL OSQLParseTreeIterator::getColumnTableRange(const OSQLParseNode* pNode, String &rTableRange) const +{ + // Ermitteln ob alle Spalten zu einer Tabelle gehoeren + if (SQL_ISRULE(pNode,column_ref)) + { + String aColName, aTableRange; + getColumnRange(pNode, aColName, aTableRange); + if (!aTableRange.Len()) // keinen gefunden + { + // dann die Spalte in den Tabellen suchen + for (ConstOSQLTablesIterator aIter = m_aTables.begin(); aIter != m_aTables.end(); ++aIter) + { + if (aIter->second.is()) + { + try + { + Reference< XNameAccess > xColumns = aIter->second->getColumns(); + Any aColumn(xColumns->getByName(aColName)); + Reference< XFastPropertySet > xColumn; + + if (aColumn >>= xColumn) + { + aTableRange = aIter->first; + break; + } + } + catch(...) + { + } + } + } + if (!aTableRange.Len()) + return FALSE; + } + + + if (!rTableRange.Len()) + rTableRange = aTableRange; + else if (rTableRange != aTableRange) + return FALSE; + } + else + { + for (UINT32 i = 0, ncount = pNode->count(); i < ncount; i++) + { + if (!getColumnTableRange(pNode->getChild(i), rTableRange)) + return FALSE; + } + } + return TRUE; +} + +//----------------------------------------------------------------------------- +void OSQLParseTreeIterator::traverseSelectColumnNames(const OSQLParseNode* pSelectNode) +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // aIteratorStatus.Clear(); + + if (!pSelectNode || m_eStatementType != SQL_STATEMENT_SELECT || !m_aTables.size()) + { + //aIteratorStatus.setInvalidStatement(); + CallError(3); + return; + } + + if(SQL_ISRULE(pSelectNode,union_statement)) + { + traverseSelectColumnNames(pSelectNode->getChild(0)); +// traverseSelectColumnNames(pSelectNode->getChild(3)); + return; + } + + // nyi: mehr Pruefung auf korrekte Struktur! + if (pSelectNode->getChild(2)->isRule() && SQL_ISPUNCTUATION(pSelectNode->getChild(2)->getChild(0),"*")) + { + // SELECT * ... + setSelectColumnName(String::CreateFromAscii("*"), aEmptyString,aEmptyString); + } + else if (SQL_ISRULE(pSelectNode->getChild(2),scalar_exp_commalist)) + { + // SELECT column(,column) oder SELECT COUNT(*) ... + OSQLParseNode * pSelection = pSelectNode->getChild(2); + + for (ULONG i = 0; i < pSelection->count(); i++) + { + OSQLParseNode *pColumnRef = pSelection->getChild(i); + + if (SQL_ISRULE(pColumnRef,select_sublist)) + { + // alle Spalten der Tabelle + String aTableRange; + pColumnRef->getChild(0)->parseNodeToStr(aTableRange,m_xDatabaseMetaData,NULL,FALSE,FALSE); + setSelectColumnName(String::CreateFromAscii("*"), aEmptyString,aTableRange); + continue; + }else if (SQL_ISRULE(pColumnRef,derived_column)) + { + String aColumnAlias(getColumnAlias(pColumnRef)); // kann leer sein + String aColumnName; + String aTableRange; + BOOL bFkt(FALSE); + pColumnRef = pColumnRef->getChild(0); + if (SQL_ISRULE(pColumnRef,column_ref)) + { + getColumnRange(pColumnRef,aColumnName,aTableRange); + DBG_ASSERT(aColumnName.Len(),"Columnname darf nicht leer sein"); + } + else /*if (SQL_ISRULE(pColumnRef,general_set_fct) || SQL_ISRULE(pColumnRef,set_fct_spec) || + SQL_ISRULE(pColumnRef,position_exp) || SQL_ISRULE(pColumnRef,extract_exp) || + SQL_ISRULE(pColumnRef,length_exp) || SQL_ISRULE(pColumnRef,char_value_fct)|| + SQL_ISRULE(pColumnRef,num_value_exp) || SQL_ISRULE(pColumnRef,term))*/ + { + /* Funktionsaufruf vorhanden */ + pColumnRef->parseNodeToStr(aColumnName,m_xDatabaseMetaData,NULL,FALSE,TRUE); + + // gehoeren alle beteiligten Spalten der Funktion zu einer Tabelle + if (m_aTables.size() == 1) + { + aTableRange = m_aTables.begin()->first; + } + else + { + getColumnTableRange(pColumnRef,aTableRange); + } + bFkt = TRUE; + } + /* + else + { + aIteratorStatus.setStatementTooComplex(); + return; + } + */ + if(!aColumnAlias.Len()) + aColumnAlias = aColumnName; + setSelectColumnName(aColumnName,aColumnAlias,aTableRange,bFkt); + } + } + + } else + { + //aIteratorStatus.setInvalidStatement(); + CallError(3); + } +} + + +//----------------------------------------------------------------------------- +void OSQLParseTreeIterator::traverseOrderByColumnNames(const OSQLParseNode* pSelectNode) +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // aIteratorStatus.Clear(); + + if (pSelectNode == NULL) + { + //aIteratorStatus.setInvalidStatement(); + CallError(3); + return; + } + + if (m_eStatementType != SQL_STATEMENT_SELECT) + { + CallError(3); + //aIteratorStatus.setInvalidStatement(); + return; + } + + if(SQL_ISRULE(pSelectNode,union_statement)) + { + traverseOrderByColumnNames(pSelectNode->getChild(0)); + //traverseOrderByColumnNames(pSelectNode->getChild(3)); + return; + } + + DBG_ASSERT(pSelectNode->count() >= 4,"OSQLParseTreeIterator: Fehler im Parse Tree"); + + OSQLParseNode * pTableExp = pSelectNode->getChild(3); + DBG_ASSERT(pTableExp != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + DBG_ASSERT(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: Fehler im Parse Tree"); + DBG_ASSERT(pTableExp->count() == 5,"OSQLParseTreeIterator: Fehler im Parse Tree"); + + OSQLParseNode * pOptOrderByClause = pTableExp->getChild(4); + DBG_ASSERT(pOptOrderByClause != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + DBG_ASSERT(SQL_ISRULE(pOptOrderByClause,opt_order_by_clause),"OSQLParseTreeIterator: Fehler im Parse Tree"); + if (pOptOrderByClause->count() == 0) + return; + + DBG_ASSERT(pOptOrderByClause->count() == 3,"OSQLParseTreeIterator: Fehler im Parse Tree"); + + OSQLParseNode * pOrderingSpecCommalist = pOptOrderByClause->getChild(2); + DBG_ASSERT(pOrderingSpecCommalist != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + DBG_ASSERT(SQL_ISRULE(pOrderingSpecCommalist,ordering_spec_commalist),"OSQLParseTreeIterator: Fehler im Parse Tree"); + DBG_ASSERT(pOrderingSpecCommalist->count() > 0,"OSQLParseTreeIterator: Fehler im Parse Tree"); + + String aColumnName,aColumnAlias; + String aTableRange; + for (UINT32 i = 0; i < pOrderingSpecCommalist->count(); i++) + { + OSQLParseNode * pOrderingSpec = pOrderingSpecCommalist->getChild(i); + DBG_ASSERT(pOrderingSpec != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + DBG_ASSERT(SQL_ISRULE(pOrderingSpec,ordering_spec),"OSQLParseTreeIterator: Fehler im Parse Tree"); + DBG_ASSERT(pOrderingSpec->count() == 2,"OSQLParseTreeIterator: Fehler im Parse Tree"); + + OSQLParseNode * pColumnRef = pOrderingSpec->getChild(0); + aTableRange.Erase(); + aColumnName.Erase(); + if(SQL_ISRULE(pColumnRef,column_ref)) + { + // Column-Name (und TableRange): + if(SQL_ISRULE(pColumnRef,column_ref)) + getColumnRange(pColumnRef,aColumnName,aTableRange); + else // eine Expression + pColumnRef->parseNodeToStr(aColumnName,m_xDatabaseMetaData,NULL,FALSE,FALSE); + + DBG_ASSERT(aColumnName.Len(),"aColumnName darf nicht leer sein"); + } + else + { // here I found a predicate + pColumnRef->parseNodeToStr(aColumnName,m_xDatabaseMetaData,NULL,FALSE,FALSE); + } + DBG_ASSERT(pColumnRef != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + // Ascending/Descending + OSQLParseNode * pOptAscDesc = pOrderingSpec->getChild(1); + DBG_ASSERT(pOptAscDesc != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + + BOOL bAscending = TRUE; + if(pOptAscDesc) + { + if (SQL_ISTOKEN(pOptAscDesc,ASC)) + bAscending = TRUE; + else if (SQL_ISTOKEN(pOptAscDesc,DESC)) + bAscending = FALSE; + } + + setOrderByColumnName(aColumnName, aTableRange,bAscending); +// if (! aIteratorStatus.IsSuccessful()) +// return; + + } +} + +//----------------------------------------------------------------------------- +void OSQLParseTreeIterator::traverseSelectionCriteria(const OSQLParseNode* pSelectNode) +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // aIteratorStatus.Clear(); + + if (pSelectNode == NULL) + { + CallError(3); + //aIteratorStatus.setInvalidStatement(); + return; + } + + + // Parse Tree analysieren (je nach Statement-Typ) + // und Zeiger auf WHERE-Klausel setzen: + OSQLParseNode * pWhereClause = NULL; + + if (m_eStatementType == SQL_STATEMENT_SELECT) + { + if(SQL_ISRULE(pSelectNode,union_statement)) + { + traverseSelectionCriteria(pSelectNode->getChild(0)); + traverseSelectionCriteria(pSelectNode->getChild(3)); + return; + } + DBG_ASSERT(pSelectNode->count() >= 4,"OSQLParseTreeIterator: Fehler im Parse Tree"); + + OSQLParseNode * pTableExp = pSelectNode->getChild(3); + DBG_ASSERT(pTableExp != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + DBG_ASSERT(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: Fehler im Parse Tree"); + DBG_ASSERT(pTableExp->count() == 5,"OSQLParseTreeIterator: Fehler im Parse Tree"); + + pWhereClause = pTableExp->getChild(1); + } else if (SQL_ISRULE(pSelectNode,update_statement_searched)) { + DBG_ASSERT(pSelectNode->count() == 5,"OSQLParseTreeIterator: Fehler im Parse Tree"); + pWhereClause = pSelectNode->getChild(4); + } else if (SQL_ISRULE(pSelectNode,update_statement_positioned)) { + // nyi + DBG_ERROR("OSQLParseTreeIterator::getSelectionCriteria: positioned nyi"); + } else if (SQL_ISRULE(pSelectNode,delete_statement_searched)) { + DBG_ASSERT(pSelectNode->count() == 4,"OSQLParseTreeIterator: Fehler im Parse Tree"); + pWhereClause = pSelectNode->getChild(3); + } else if (SQL_ISRULE(pSelectNode,delete_statement_positioned)) { + // nyi + DBG_ERROR("OSQLParseTreeIterator::getSelectionCriteria: positioned nyi"); + } else { + // Anderes Statement. Keine Selektionskriterien. + return; + } + + if (! SQL_ISRULE(pWhereClause,where_clause)) { + // Die Where Clause ist meistens optional, d. h. es koennte sich auch + // um "optional_where_clause" handeln. + DBG_ASSERT(SQL_ISRULE(pWhereClause,opt_where_clause),"OSQLParseTreeIterator: Fehler im Parse Tree"); + return; + } + + // Wenn es aber eine where_clause ist, dann darf sie nicht leer sein: + DBG_ASSERT(pWhereClause->count() == 2,"OSQLParseTreeIterator: Fehler im Parse Tree"); + + OSQLParseNode * pComparisonPredicate = pWhereClause->getChild(1); + DBG_ASSERT(pComparisonPredicate != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + + + // + // Und nun die Vergleichskriterien abarbeiten (rekursiv, alles ist erstmal ein OR-Kriterium): + // + setORCriteriaPre(); + // if (! aIteratorStatus.IsSuccessful()) return; + + traverseORCriteria(pComparisonPredicate); + // if (! aIteratorStatus.IsSuccessful()) return; + + setORCriteriaPost(); + + // Fehler wird ggf. einfach weitergereicht. +} + +//----------------------------------------------------------------------------- +void OSQLParseTreeIterator::traverseORCriteria(OSQLParseNode * pSearchCondition) +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + + if ( + pSearchCondition->count() == 3 && + SQL_ISPUNCTUATION(pSearchCondition->getChild(0),"(") && + SQL_ISPUNCTUATION(pSearchCondition->getChild(2),")") + ) + { + // Runde Klammern um den Ausdruck + traverseORCriteria(pSearchCondition->getChild(1)); + } else if (SQL_ISRULE(pSearchCondition,search_condition) && + pSearchCondition->count() == 3 && + SQL_ISTOKEN(pSearchCondition->getChild(1),OR)) + { + // OR-Verknuepfung: + + for (int i = 0; i < 3; i++) { + if (i == 1) continue; // Schluesselwort OR ueberspringen + + // Ist das erste Element wieder eine OR-Verknuepfung? + if (i == 0 && + SQL_ISRULE(pSearchCondition->getChild(0),search_condition) && + pSearchCondition->getChild(0)->count() == 3 && + SQL_ISTOKEN(pSearchCondition->getChild(0)->getChild(1),OR)) + { + // Dann rekursiv absteigen ... + traverseORCriteria(pSearchCondition->getChild(0)); + + } else { + // AND-Kriterien ... + setANDCriteriaPre(); + // if (! aIteratorStatus.IsSuccessful()) break; + + traverseANDCriteria(pSearchCondition->getChild(i)); + // if (! aIteratorStatus.IsSuccessful()) break; + + setANDCriteriaPost(); + } + + // if (! aIteratorStatus.IsSuccessful()) break; + } + } else { + // Nur *ein* Kriterium oder eine AND-Verknuepfung von Kriterien. + // Direkt die AND-Kriterien behandeln. + setANDCriteriaPre(); + // if (! aIteratorStatus.IsSuccessful()) return; + + traverseANDCriteria(pSearchCondition); + // if (! aIteratorStatus.IsSuccessful()) return; + + setANDCriteriaPost(); + } + + // Fehler einfach weiterreichen. +} + +//----------------------------------------------------------------------------- +void OSQLParseTreeIterator::traverseANDCriteria(OSQLParseNode * pSearchCondition) +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + + if ( + SQL_ISRULE(pSearchCondition,boolean_primary) && + pSearchCondition->count() == 3 && + SQL_ISPUNCTUATION(pSearchCondition->getChild(0),"(") && + SQL_ISPUNCTUATION(pSearchCondition->getChild(2),")") + ) + { + // Runde Klammern + traverseANDCriteria(pSearchCondition->getChild(1)); + } + // Das erste Element ist eine OR-Verknuepfung + else if ( SQL_ISRULE(pSearchCondition,search_condition) && pSearchCondition->count() == 3 ) + { + // Dann rekursiv absteigen (dieselbe Row benutzen) ... + traverseORCriteria(pSearchCondition->getChild(0)); +// if (! aIteratorStatus.IsSuccessful()) +// return; + + // Und mit dem rechten Child weitermachen: + traverseANDCriteria(pSearchCondition->getChild(2)); + } + // Das erste Element ist (wieder) eine AND-Verknuepfung + else if ( SQL_ISRULE(pSearchCondition,boolean_term) && pSearchCondition->count() == 3 ) + { + // Dann rekursiv absteigen (dieselbe Row benutzen) ... + traverseANDCriteria(pSearchCondition->getChild(0)); +// if (! aIteratorStatus.IsSuccessful()) +// return; + + // Und mit dem rechten Child weitermachen: + traverseANDCriteria(pSearchCondition->getChild(2)); + } + // Sonst einzelne Suchkriterien wie =, !=, ..., LIKE, IS NULL usw. behandeln: + else if (SQL_ISRULE(pSearchCondition,comparison_predicate) ) + { + OSQLPredicateType ePredicateType; + OSQLParseNode *pPrec = pSearchCondition->getChild(1); + if (pPrec->getNodeType() == SQL_NODE_EQUAL) + ePredicateType = SQL_PRED_EQUAL; + else if (pPrec->getNodeType() == SQL_NODE_NOTEQUAL) + ePredicateType = SQL_PRED_NOTEQUAL; + else if (pPrec->getNodeType() == SQL_NODE_LESS) + ePredicateType = SQL_PRED_LESS; + else if (pPrec->getNodeType() == SQL_NODE_LESSEQ) + ePredicateType = SQL_PRED_LESSOREQUAL; + else if (pPrec->getNodeType() == SQL_NODE_GREATEQ) + ePredicateType = SQL_PRED_GREATEROREQUAL; + else if (pPrec->getNodeType() == SQL_NODE_GREAT) + ePredicateType = SQL_PRED_GREATER; + + String aValue; + pSearchCondition->getChild(2)->parseNodeToStr(aValue,m_xDatabaseMetaData,NULL,FALSE,FALSE); + traverseOnePredicate(pSearchCondition->getChild(0),ePredicateType,aValue,FALSE,pSearchCondition->getChild(2)); +// if (! aIteratorStatus.IsSuccessful()) +// return; + } + else if (SQL_ISRULE(pSearchCondition,like_predicate) /*&& SQL_ISRULE(pSearchCondition->getChild(0),column_ref)*/) + { + OSQLPredicateType ePredicateType; + + DBG_ASSERT(pSearchCondition->count() >= 5,"OSQLParseTreeIterator: Fehler im Parse Tree"); + + OSQLParseNode * pNum_value_exp = pSearchCondition->getChild(3); + OSQLParseNode * pOptEscape = pSearchCondition->getChild(4); + + if (pSearchCondition->getChild(1)->getTokenID() == SQL_TOKEN_NOT) + ePredicateType = SQL_PRED_NOTLIKE; + else + ePredicateType = SQL_PRED_LIKE; + + DBG_ASSERT(pNum_value_exp != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + DBG_ASSERT(pOptEscape != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + + if (pOptEscape->count() != 0) + { + // aIteratorStatus.setStatementTooComplex(); + return; + } + + String aValue; + OSQLParseNode * pParam = NULL; + if (SQL_ISRULE(pNum_value_exp,parameter)) + pParam = pNum_value_exp; + else if(pNum_value_exp->isToken()) + // Normaler Wert + aValue = pNum_value_exp->getTokenValue(); + else + { + pNum_value_exp->parseNodeToStr(aValue,m_xDatabaseMetaData,NULL,FALSE,FALSE); + pParam = pNum_value_exp; + } + + traverseOnePredicate(pSearchCondition->getChild(0),ePredicateType,aValue,FALSE,pParam); +// if (! aIteratorStatus.IsSuccessful()) +// return; + } + else if (SQL_ISRULE(pSearchCondition,test_for_null) /*&& SQL_ISRULE(pSearchCondition->getChild(0),column_ref)*/) + { + OSQLPredicateType ePredicateType; + + DBG_ASSERT(pSearchCondition->count() >= 3,"OSQLParseTreeIterator: Fehler im Parse Tree"); + DBG_ASSERT(SQL_ISTOKEN(pSearchCondition->getChild(1),IS),"OSQLParseTreeIterator: Fehler im Parse Tree") + + if (SQL_ISTOKEN(pSearchCondition->getChild(2),NOT) ) + ePredicateType = SQL_PRED_ISNOTNULL; + else + ePredicateType = SQL_PRED_ISNULL; + + String aString; + traverseOnePredicate(pSearchCondition->getChild(0),ePredicateType,aString,TRUE,NULL); + // if (! aIteratorStatus.IsSuccessful()) return; + } else { + // Etwas anderes unterstuetzen wir (noch) nicht. Basta! + // aIteratorStatus.setStatementTooComplex(); + } + // Fehler einfach weiterreichen. +} + +//----------------------------------------------------------------------------- +void OSQLParseTreeIterator::traverseOnePredicate( + OSQLParseNode * pColumnRef, + OSQLPredicateType ePredicateType, + String& rValue, + BOOL bCompareNull, + OSQLParseNode * pParseNode) +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + + // Column-Name (und TableRange): + String aColumnName; + String aTableRange; + getColumnRange(pColumnRef,aColumnName,aTableRange); + + String aName; + if (pParseNode) //event. Parameter, oder Columnref oder + { + if (SQL_ISRULE(pParseNode,parameter)) + { + DBG_ASSERT(pParseNode->count() > 0,"OSQLParseTreeIterator: Fehler im Parse Tree"); + OSQLParseNode * pMark = pParseNode->getChild(0); + + String aParameterName; + if (SQL_ISPUNCTUATION(pMark,"?")) + { + // Name = "?", da kein Parametername verfuegbar (z. B. bei Native SQL) + rValue = '?'; + aName = '?'; + } + else if (SQL_ISPUNCTUATION(pMark,":")) + { + rValue = pParseNode->getChild(1)->getTokenValue(); + aName = ':'; + } + else if (SQL_ISPUNCTUATION(pMark,"[")) + { + rValue = pParseNode->getChild(1)->getTokenValue(); + aName = '['; + } + else + { + DBG_ERROR("OSQLParseTreeIterator: Fehler im Parse Tree"); + } + } + else if (SQL_ISRULE(pParseNode,column_ref))// Column-Name (und TableRange): + getColumnRange(pParseNode,aName,rValue); + } + + // "set"-Routine aufrufen ... + if (bCompareNull) { + // nyi: was soll das? Vergleich auf NULL geht nur ueber IS NULL oder IS NOT NULL! + setPredicate(aColumnName, aTableRange,ePredicateType, String(), String()); + } else { + setPredicate(aColumnName, aTableRange, ePredicateType, rValue, aName); + } + + // Fehler einfach weiterreichen ... +} + +//----------------------------------------------------------------------------- +void OSQLParseTreeIterator::traverseAssignments() +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + + DBG_ERROR("OSQLParseTreeIterator::traverseAssignments: noch nicht implementiert"); +} + +//----------------------------------------------------------------------------- +void OSQLParseTreeIterator::traverseAll() +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + + traverseTableNames(); + // if (! aIteratorStatus.IsSuccessful()) return; + + if (m_eStatementType == SQL_STATEMENT_SELECT) + { + const OSQLParseNode* pSelectNode = m_pParseTree; + traverseSelectColumnNames(pSelectNode); +// if (! aIteratorStatus.IsSuccessful()) +// return; + traverseOrderByColumnNames(pSelectNode); +// if (! aIteratorStatus.IsSuccessful()) +// return; + traverseSelectionCriteria(pSelectNode); + // if (! aIteratorStatus.IsSuccessful()) + // return; + } + else if (m_eStatementType == SQL_STATEMENT_INSERT || m_eStatementType == SQL_STATEMENT_UPDATE) + { + traverseAssignments(); + // if (! aIteratorStatus.IsSuccessful()) + // return; + } else if (m_eStatementType == SQL_STATEMENT_INSERT) { + // schon alles erledigt + } else { + CallError(3); + //aIteratorStatus.setInvalidStatement(); + } +} + +// Dummy-Implementationen: + +//----------------------------------------------------------------------------- +void OSQLParseTreeIterator::setTableName(const String & rTableName, const String & rDBName, const String& rOwner, + const String & rTableRange) +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // nichts zu tun ... + +#ifdef SQL_TEST_PARSETREEITERATOR + cout << "OSQLParseTreeIterator::setTableName" + << (const char *) rTableName << ", " + << (const char *) rSchemaName << ", " + << (const char *) rTableRange + << "\n"; +#endif +} +//----------------------------------------------------------------------------- +void OSQLParseTreeIterator::appendColumns(const OSQLTable& _rTable) +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + if (!_rTable.is()) + return; + + Reference<XNameAccess> xColumns = _rTable->getColumns(); + + Sequence< ::rtl::OUString > aColNames = xColumns->getElementNames(); + const ::rtl::OUString* pBegin = aColNames.getConstArray(); + const ::rtl::OUString* pEnd = pBegin + aColNames.getLength(); + + for(;pBegin != pEnd;++pBegin) + { + OSQLColumns::const_iterator aIter = find(m_aSelectColumns->begin(),m_aSelectColumns->end(),*pBegin,m_aCaseEqual); + ::rtl::OUString aName(*pBegin); + sal_Int32 i=1; + while(aIter != m_aSelectColumns->end()) + { + aName = *pBegin + ::rtl::OUString::valueOf(i++); + aIter = find(m_aSelectColumns->begin(),m_aSelectColumns->end(),aName,m_aCaseEqual); + } + Reference< XFastPropertySet > xColumn; + if(xColumns->getByName(*pBegin) >>= xColumn) + { + OParseColumn* pColumn = new OParseColumn(xColumn,m_xDatabaseMetaData->storesMixedCaseQuotedIdentifiers()); + // pColumn->setTableName(aIter->first); + pColumn->setRealName(aName); + Reference< XFastPropertySet> xCol = pColumn; + m_aSelectColumns->push_back(xCol); + } + } +} +//----------------------------------------------------------------------------- +void OSQLParseTreeIterator::setSelectColumnName(const String & rColumnName,const String & rColumnAlias, const String & rTableRange,BOOL bFkt) +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + if(rColumnName.GetChar(0) == '*' && !rTableRange.Len()) + { // Suche "uber alle vorkommenden Tabellen + for(ConstOSQLTablesIterator aIter = m_aTables.begin(); aIter != m_aTables.end();++aIter) + appendColumns(aIter->second); + } + else if(rColumnName.GetChar(0) == '*' && rTableRange.Len()) // alle Columns aus dieser Tabelle + { + ConstOSQLTablesIterator aFind = m_aTables.find(rTableRange); + + if(aFind == m_aTables.end()) + { + String strExpression = rTableRange; + strExpression += '.'; + strExpression += rColumnName; + CallError(2, strExpression); + } + else + appendColumns(aFind->second); + } + else if(!rTableRange.Len())// ein Columnname existiert + { + if(!bFkt) + { + + UINT32 ncount = m_aSelectColumns->size(); + for(OSQLTablesIterator aIter = m_aTables.begin(); aIter != m_aTables.end(); ++aIter) + { + if (aIter->second.is()) + { + Reference<XNameAccess> xColumns = aIter->second->getColumns(); + + Reference< XFastPropertySet > xColumn; + if(xColumns->getByName(rColumnName) >>= xColumn) + { + String aNewColName(getUniqueColumnName(rColumnAlias)); + + OParseColumn* pColumn = new OParseColumn(xColumn,m_xDatabaseMetaData->storesMixedCaseQuotedIdentifiers()); + pColumn->setTableName(aIter->first); + pColumn->setName(aNewColName); + pColumn->setRealName(rColumnName); + + Reference< XFastPropertySet> xCol = pColumn; + m_aSelectColumns->push_back(xCol); + continue; // diese Column darf nur einmal vorkommen + } + } + } + if (ncount == m_aSelectColumns->size()) + { + String strExpression = rTableRange; + if (strExpression.Len()) + strExpression += '.'; + strExpression += rColumnName; + CallError(2, strExpression); + } + } + else + { + String aNewColName(getUniqueColumnName(rColumnAlias)); + + OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(), + ColumnValue::NULLABLE_UNKNOWN,0,0,DataType::VARCHAR,sal_False,sal_False,m_xDatabaseMetaData->storesMixedCaseQuotedIdentifiers()); + pColumn->setFunction(bFkt); + pColumn->setRealName(rColumnName); + + Reference< XFastPropertySet> xCol = pColumn; + m_aSelectColumns->push_back(xCol); + } + } + else // ColumnName und Tablename vorhanden + { + ConstOSQLTablesIterator aFind = m_aTables.find(rTableRange); + + BOOL bError = FALSE; + if (aFind->second.is()) + { + + if (bFkt) + { + String aNewColName(getUniqueColumnName(rColumnAlias)); + + OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(), + ColumnValue::NULLABLE_UNKNOWN,0,0,DataType::VARCHAR,sal_False,sal_False,m_xDatabaseMetaData->storesMixedCaseQuotedIdentifiers()); + pColumn->setFunction(sal_True); + pColumn->setRealName(rColumnName); + pColumn->setTableName(aFind->first); + + Reference< XFastPropertySet> xCol = pColumn; + m_aSelectColumns->push_back(xCol); + } + else + { + Reference< XFastPropertySet > xColumn; + if (aFind->second->getColumns()->getByName(rColumnName) >>= xColumn) + { + String aNewColName(getUniqueColumnName(rColumnAlias)); + + OParseColumn* pColumn = new OParseColumn(xColumn,m_xDatabaseMetaData->storesMixedCaseQuotedIdentifiers()); + pColumn->setName(aNewColName); + pColumn->setRealName(rColumnName); + pColumn->setTableName(aFind->first); + + Reference< XFastPropertySet> xCol = pColumn; + m_aSelectColumns->push_back(xCol); + } + else + bError = TRUE; + } + } + else + bError = TRUE; + + // Tabelle existiert nicht oder Feld nicht vorhanden + if (bError) + { + String strExpression = rTableRange; + if (strExpression.Len()) + strExpression += '.'; + strExpression += rColumnName; + if (!CallError(2, strExpression)) + return; + + String aNewColName(getUniqueColumnName(rColumnAlias)); + + OParseColumn* pColumn = new OParseColumn(aNewColName,::rtl::OUString(),::rtl::OUString(), + ColumnValue::NULLABLE_UNKNOWN,0,0,DataType::VARCHAR,sal_False,sal_False,m_xDatabaseMetaData->storesMixedCaseQuotedIdentifiers()); + pColumn->setFunction(sal_True); + + + Reference< XFastPropertySet> xCol = pColumn; + m_aSelectColumns->push_back(xCol); + } + } +} +//----------------------------------------------------------------------------- +String OSQLParseTreeIterator::getUniqueColumnName(const String & rColumnName) const +{ + ::rtl::OUString aAlias(rColumnName); + + OSQLColumns::const_iterator aIter = find(m_aSelectColumns->begin(),m_aSelectColumns->end(),aAlias,m_aCaseEqual); + sal_Int32 i=1; + while(aIter != m_aSelectColumns->end()) + { + (aAlias = rColumnName) += ::rtl::OUString::valueOf(i++); + aIter = find(m_aSelectColumns->begin(),m_aSelectColumns->end(),aAlias,m_aCaseEqual); + } + return aAlias; +} +//----------------------------------------------------------------------------- +void OSQLParseTreeIterator::setOrderByColumnName(const String & rColumnName, const String & rTableRange,BOOL bAscending) +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // nichts zu tun ... + +#ifdef SQL_TEST_PARSETREEITERATOR + cout << "OSQLParseTreeIterator::setOrderByColumnName: " + << (const char *) rColumnName << ", " + << (const char *) rTableRange << ", " + << (bAscending ? "TRUE" : "FALSE") + << "\n"; +#endif +} + +//----------------------------------------------------------------------------- +void OSQLParseTreeIterator::setORCriteriaPre() +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // nichts zu tun ... + +#ifdef SQL_TEST_PARSETREEITERATOR + cout << "OSQLParseTreeIterator::setORCriteriaPre\n"; +#endif +} + +//----------------------------------------------------------------------------- +void OSQLParseTreeIterator::setORCriteriaPost() +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // nichts zu tun ... + +#ifdef SQL_TEST_PARSETREEITERATOR + cout << "OSQLParseTreeIterator::setORCriteriaPost\n"; +#endif +} + +//----------------------------------------------------------------------------- +void OSQLParseTreeIterator::setANDCriteriaPre() +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // nichts zu tun ... + +#ifdef SQL_TEST_PARSETREEITERATOR + cout << "OSQLParseTreeIterator::setANDCriteriaPre\n"; +#endif +} + +//----------------------------------------------------------------------------- +void OSQLParseTreeIterator::setANDCriteriaPost() +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // nichts zu tun ... + +#ifdef SQL_TEST_PARSETREEITERATOR + cout << "OSQLParseTreeIterator::setANDCriteriaPost\n"; +#endif +} + +//----------------------------------------------------------------------------- +void OSQLParseTreeIterator::setPredicate(const String & rColumnName, + const String & rTableRange, + OSQLPredicateType ePredicateType, + const String & rValue, + const String & rParameterName) +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // nichts zu tun ... + +#ifdef SQL_TEST_PARSETREEITERATOR + cout << "OSQLParseTreeIterator::setPredicate: " + << (const char *) rColumnName << ", " + << (const char *) rTableRange << ", " + << (char) ePredicateType << ", " + << (const char *) rValue << ", " + << (const char *) rParameterName + << "\n"; +#endif +} + + +//----------------------------------------------------------------------------- +void OSQLParseTreeIterator::setAssign(const String & rColumnName, + const String & rValue, BOOL bsetNull, + const String & rParameterName) +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + // nichts zu tun ... + +#ifdef SQL_TEST_PARSETREEITERATOR + cout << "OSQLParseTreeIterator::setAssign: " + << (const char *) rColumnName << ", " + << (const char *) rValue << ", " + << (bsetNull ? "TRUE" : "FALSE") << ", " + << (const char *) rParameterName + << "\n"; +#endif +} + +//----------------------------------------------------------------------------- +const OSQLParseNode* OSQLParseTreeIterator::getWhereTree() const +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + + if (!m_pParseTree) + return NULL; + + // Parse Tree analysieren (je nach Statement-Typ) + // und Zeiger auf WHERE-Klausel setzen: + OSQLParseNode * pWhereClause = NULL; + if(getStatementType() == SQL_STATEMENT_SELECT) + { + DBG_ASSERT(m_pParseTree->count() >= 4,"ParseTreeIterator: Fehler im Parse Tree"); + OSQLParseNode * pTableExp = m_pParseTree->getChild(3); + DBG_ASSERT(pTableExp != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + DBG_ASSERT(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: Fehler im Parse Tree"); + DBG_ASSERT(pTableExp->count() == 5,"OSQLParseTreeIterator: Fehler im Parse Tree"); + + pWhereClause = pTableExp->getChild(1); + } + else if (SQL_ISRULE(m_pParseTree,update_statement_searched) || + SQL_ISRULE(m_pParseTree,delete_statement_searched)) + { + pWhereClause = m_pParseTree->getChild(m_pParseTree->count()-1); + } + if(pWhereClause->count() != 2) + pWhereClause = NULL; + return pWhereClause; +} + +//----------------------------------------------------------------------------- +const OSQLParseNode* OSQLParseTreeIterator::getOrderTree() const +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + + if (!m_pParseTree || getStatementType() != SQL_STATEMENT_SELECT) + return NULL; + + // Parse Tree analysieren (je nach Statement-Typ) + // und Zeiger auf ORDER-Klausel setzen: + OSQLParseNode * pOrderClause = NULL; + DBG_ASSERT(m_pParseTree->count() >= 4,"ParseTreeIterator: Fehler im Parse Tree"); + OSQLParseNode * pTableExp = m_pParseTree->getChild(3); + DBG_ASSERT(pTableExp != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + DBG_ASSERT(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: Fehler im Parse Tree"); + DBG_ASSERT(pTableExp->count() == 5,"OSQLParseTreeIterator: Fehler im Parse Tree"); + + pOrderClause = pTableExp->getChild(4); + // Wenn es aber eine order_by ist, dann darf sie nicht leer sein: + if(pOrderClause->count() != 3) + pOrderClause = NULL; + return pOrderClause; +} +//----------------------------------------------------------------------------- +const OSQLParseNode* OSQLParseTreeIterator::getGroupByTree() const +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + + if (!m_pParseTree || getStatementType() != SQL_STATEMENT_SELECT) + return NULL; + + // Parse Tree analysieren (je nach Statement-Typ) + // und Zeiger auf ORDER-Klausel setzen: + OSQLParseNode * pGroupClause = NULL; + DBG_ASSERT(m_pParseTree->count() >= 4,"ParseTreeIterator: Fehler im Parse Tree"); + OSQLParseNode * pTableExp = m_pParseTree->getChild(3); + DBG_ASSERT(pTableExp != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + DBG_ASSERT(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: Fehler im Parse Tree"); + DBG_ASSERT(pTableExp->count() == 5,"OSQLParseTreeIterator: Fehler im Parse Tree"); + + pGroupClause = pTableExp->getChild(3); + // Wenn es aber eine order_by ist, dann darf sie nicht leer sein: + if(pGroupClause->count() != 3) + pGroupClause = NULL; + return pGroupClause; +} +//----------------------------------------------------------------------------- +const OSQLParseNode* OSQLParseTreeIterator::getHavingTree() const +{ + DBG_CHKTHIS(OSQLParseTreeIterator,NULL); + + if (!m_pParseTree || getStatementType() != SQL_STATEMENT_SELECT) + return NULL; + + // Parse Tree analysieren (je nach Statement-Typ) + // und Zeiger auf ORDER-Klausel setzen: + OSQLParseNode * pHavingClause = NULL; + DBG_ASSERT(m_pParseTree->count() >= 4,"ParseTreeIterator: Fehler im Parse Tree"); + OSQLParseNode * pTableExp = m_pParseTree->getChild(3); + DBG_ASSERT(pTableExp != NULL,"OSQLParseTreeIterator: Fehler im Parse Tree"); + DBG_ASSERT(SQL_ISRULE(pTableExp,table_exp),"OSQLParseTreeIterator: Fehler im Parse Tree"); + DBG_ASSERT(pTableExp->count() == 5,"OSQLParseTreeIterator: Fehler im Parse Tree"); + + pHavingClause = pTableExp->getChild(3); + // Wenn es aber eine order_by ist, dann darf sie nicht leer sein: + if(pHavingClause->count() < 1) + pHavingClause = NULL; + return pHavingClause; +} +//----------------------------------------------------------------------------- +BOOL OSQLParseTreeIterator::CallError(USHORT nError,const String& rExpression) +{ +// SdbParseIteratorErrorInfo aErrorInfo; +// aErrorInfo.aStatus = rStatus; +// aErrorInfo.nErrorCode = nError; +// aErrorInfo.aExpression = rExpression; +// +// long nResult = aErrorHdl.Call(&aErrorInfo); +// if (nResult == RET_CONTINUE) + return TRUE; + +// if (nResult == RET_HANDLED) +// { +// // aIteratorStatus.set(SQL_STAT_SUCCESS); +// return FALSE; +// } +// +// aIteratorStatus = rStatus; +// return FALSE; +// +} + diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx new file mode 100644 index 000000000000..f35c06bf8f25 --- /dev/null +++ b/connectivity/source/parse/sqlnode.cxx @@ -0,0 +1,1399 @@ +/************************************************************************* + * + * $RCSfile: sqlnode.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_SQLNODE_HXX +#include <connectivity/sqlnode.hxx> +#endif +#ifndef _CONNECTIVITY_SQLPARSE_HXX +#include <connectivity/sqlparse.hxx> +#endif +#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_ +#include <com/sun/star/lang/Locale.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATTER_HPP_ +#include <com/sun/star/util/XNumberFormatter.hpp> +#endif +#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATTYPES_HPP_ +#include <com/sun/star/util/XNumberFormatTypes.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include <com/sun/star/beans/XPropertySet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#endif +#ifndef _TOOLS_INTN_HXX //autogen wg. International +#include <tools/intn.hxx> +#endif +#ifndef _ISOLANG_HXX +#include <tools/isolang.hxx> +#endif + +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::osl; +using namespace connectivity; + +extern Any getNumberFormatProperty(const Reference< XNumberFormatsSupplier > & xFormatter, + sal_Int32 nKey, + const rtl::OUString& ); +extern double ToDouble(const Time& rTime); +extern double ToDouble(const Reference< XNumberFormatsSupplier > & xSupplier, const Date& rDate); +extern String ConvertLikeToken(const OSQLParseNode* pTokenNode, const OSQLParseNode* pEscapeNode, sal_Bool bInternational); + +//------------------------------------------------------------------ +OSQLParseNode::SQLParseNodeParameter::SQLParseNodeParameter(const String& _rIdentifierQuote, const String& _rCatalogSep, + const Reference< XNumberFormatter > & _xFormatter, const Reference< XPropertySet > & _xField, const International& _rIntl, + const OParseContext* _pContext, sal_Bool _bIntl, sal_Bool _bQuote, char _cDecSep, + sal_Bool _bPredicate) + :aIdentifierQuote(_rIdentifierQuote) + ,aCatalogSeparator(_rCatalogSep) + ,rIntl(_rIntl) + ,rContext(_pContext ? *_pContext : OSQLParser::s_aDefaultContext) + ,bInternational(_bIntl) + ,bQuote(_bQuote) + ,cDecSep(_cDecSep) + ,xField(_xField) + ,xFormatter(_xFormatter) + ,bPredicate(_bPredicate) +{ +} + +//------------------------------------------------------------------ +String SetQuotation(const String& rValue, const String& rQuot, const String& rQuotToReplace) +{ + String rNewValue = rQuot; + rNewValue += rValue; + + xub_StrLen nIndex = (xub_StrLen)-1; // Quotes durch zweifache Quotes ersetzen, sonst kriegt der Parser Probleme + + if (rQuot.Len()) + { + do + { + nIndex+= 2; + nIndex = rNewValue.SearchAndReplace(rQuot,rQuotToReplace,nIndex); + } while (nIndex != STRING_NOTFOUND); + } + // rNewValue.SearchAndReplaceAll(rQuot,rQuotToReplace); + + rNewValue += rQuot; + return rNewValue; +} + + +//----------------------------------------------------------------------------- +String OSQLParseNode::convertDateString(const SQLParseNodeParameter& rParam, const String& rString) const +{ + xub_StrLen nIndex = 0; + sal_Int32 nYear = rString.GetToken(0,'-', nIndex).ToInt32(), + nMonth = rString.GetToken(0,'-', nIndex).ToInt32(), + nDay = rString.GetToken(0,'-', nIndex).ToInt32(); + + Date aDate(nDay,nMonth,nYear); + Reference< XNumberFormatsSupplier > xSupplier(rParam.xFormatter->getNumberFormatsSupplier()); + Reference< XNumberFormatTypes > xTypes(xSupplier->getNumberFormats(), UNO_QUERY); + + String sLanguage, sCountry; + ConvertLanguageToIsoNames(rParam.rIntl.GetLanguage(), sLanguage, sCountry); + Locale aLocale(sLanguage,sCountry,rtl::OUString()); + + double fDate = ToDouble(xSupplier, aDate); + sal_Int32 nKey = xTypes->getStandardIndex(aLocale) + 36; // XXX hack + return rParam.xFormatter->convertNumberToString(nKey, fDate); +} + +//----------------------------------------------------------------------------- +String OSQLParseNode::convertDateTimeString(const SQLParseNodeParameter& rParam, const String& rString) const +{ + xub_StrLen nIndex = 0; + sal_Int32 nYear = rString.GetToken(0,'-', nIndex).ToInt32(), + nMonth = rString.GetToken(0,'-', nIndex).ToInt32(), + nDay = rString.GetToken(0,'-', nIndex).ToInt32(); + + nIndex = 10; // eat white space + sal_Int32 nHour = rString.GetToken(0,':', nIndex).ToInt32(), + nMinute = rString.GetToken(0,':', nIndex).ToInt32(), + nSecond = rString.GetToken(0,':', nIndex).ToInt32(); + + Date aDate(nDay,nMonth,nYear); + Time aTime(nHour,nMinute,nSecond); + Reference< XNumberFormatsSupplier > xSupplier(rParam.xFormatter->getNumberFormatsSupplier()); + Reference< XNumberFormatTypes > xTypes(xSupplier->getNumberFormats(), UNO_QUERY); + + String sLanguage, sCountry; + ConvertLanguageToIsoNames(rParam.rIntl.GetLanguage(), sLanguage, sCountry); + Locale aLocale(sLanguage,sCountry,rtl::OUString()); + + double fDateTime = ToDouble(xSupplier, aDate) + ToDouble(aTime); + sal_Int32 nKey = xTypes->getStandardIndex(aLocale) + 51; // XXX hack + return rParam.xFormatter->convertNumberToString(nKey, fDateTime); +} + +//----------------------------------------------------------------------------- +String OSQLParseNode::convertTimeString(const SQLParseNodeParameter& rParam, const String& rString) const +{ + xub_StrLen nIndex = 0; + sal_Int32 nHour = rString.GetToken(0,':', nIndex).ToInt32(), + nMinute = rString.GetToken(0,':', nIndex).ToInt32(), + nSecond = rString.GetToken(0,':', nIndex).ToInt32(); + + Time aTime(nHour,nMinute,nSecond); + Reference< XNumberFormatsSupplier > xSupplier(rParam.xFormatter->getNumberFormatsSupplier()); + + Reference< XNumberFormatTypes > xTypes(xSupplier->getNumberFormats(), UNO_QUERY); + + String sLanguage, sCountry; + ConvertLanguageToIsoNames(rParam.rIntl.GetLanguage(), sLanguage, sCountry); + Locale aLocale(sLanguage,sCountry,rtl::OUString()); + + double fTime = ToDouble(aTime); + sal_Int32 nKey = xTypes->getStandardIndex(aLocale) + 41; // XXX hack + return rParam.xFormatter->convertNumberToString(nKey, fTime); +} + +DBG_NAME(OSQLParseNode); +//----------------------------------------------------------------------------- +OSQLParseNode::OSQLParseNode(const sal_Char * pNewValue, + SQLNodeType eNewNodeType, + sal_uInt32 nNewNodeID) + : m_aNodeValue(String::CreateFromAscii(pNewValue)) + , m_eNodeType(eNewNodeType) + , m_nNodeID(nNewNodeID) + , m_pParent(NULL) +{ + DBG_CTOR(OSQLParseNode,NULL); + DBG_ASSERT(m_eNodeType >= SQL_NODE_RULE && m_eNodeType <= SQL_NODE_ACCESS_DATE,"OSQLParseNode: mit unzulaessigem NodeType konstruiert"); +} +//----------------------------------------------------------------------------- +OSQLParseNode::OSQLParseNode(const ByteString &_rNewValue, + SQLNodeType eNewNodeType, + sal_uInt32 nNewNodeID) + : m_aNodeValue(String::CreateFromAscii(_rNewValue.GetBuffer())) + , m_eNodeType(eNewNodeType) + , m_nNodeID(nNewNodeID) + , m_pParent(NULL) +{ + DBG_CTOR(OSQLParseNode,NULL); + DBG_ASSERT(m_eNodeType >= SQL_NODE_RULE && m_eNodeType <= SQL_NODE_ACCESS_DATE,"OSQLParseNode: mit unzulaessigem NodeType konstruiert"); +} +//----------------------------------------------------------------------------- +OSQLParseNode::OSQLParseNode(const sal_Unicode * pNewValue, + SQLNodeType eNewNodeType, + sal_uInt32 nNewNodeID) + : m_aNodeValue(pNewValue) + , m_eNodeType(eNewNodeType) + , m_nNodeID(nNewNodeID) + , m_pParent(NULL) +{ + DBG_CTOR(OSQLParseNode,NULL); + DBG_ASSERT(m_eNodeType >= SQL_NODE_RULE && m_eNodeType <= SQL_NODE_ACCESS_DATE,"OSQLParseNode: mit unzulaessigem NodeType konstruiert"); +} +//----------------------------------------------------------------------------- +OSQLParseNode::OSQLParseNode(const String &_rNewValue, + SQLNodeType eNewNodeType, + sal_uInt32 nNewNodeID) + : m_aNodeValue(_rNewValue) + , m_eNodeType(eNewNodeType) + , m_nNodeID(nNewNodeID) + , m_pParent(NULL) +{ + DBG_CTOR(OSQLParseNode,NULL); + DBG_ASSERT(m_eNodeType >= SQL_NODE_RULE && m_eNodeType <= SQL_NODE_ACCESS_DATE,"OSQLParseNode: mit unzulaessigem NodeType konstruiert"); +} +//----------------------------------------------------------------------------- +OSQLParseNode::OSQLParseNode(const OSQLParseNode& rParseNode) +{ + DBG_CTOR(OSQLParseNode,NULL); + // klemm den getParent auf NULL + m_pParent = NULL; + + // kopiere die member + m_aNodeValue = rParseNode.m_aNodeValue; + m_eNodeType = rParseNode.m_eNodeType; + m_nNodeID = rParseNode.m_nNodeID; + + + // denk dran, dass von Container abgeleitet wurde, laut SV-Help erzeugt + // copy-Constructor des Containers einen neuen Container mit den gleichen + // Zeigern als Inhalt -> d.h. nach dem Kopieren des Container wird fuer + // alle Zeiger ungleich NULL eine Kopie hergestellt und anstelle des alten + // Zeigers wieder eingehangen. + + // wenn kein Blatt, dann SubTrees bearbeiten + for (::std::vector<OSQLParseNode*>::const_iterator i = rParseNode.m_aChilds.begin(); + i != rParseNode.m_aChilds.end(); i++) + append(new OSQLParseNode(**i)); +} + +//----------------------------------------------------------------------------- +OSQLParseNode& OSQLParseNode::operator=(const OSQLParseNode& rParseNode) +{ + DBG_CHKTHIS(OSQLParseNode,NULL); + + if (this != &rParseNode) + { + // kopiere die member - pParent bleibt der alte + m_aNodeValue = rParseNode.m_aNodeValue; + m_eNodeType = rParseNode.m_eNodeType; + m_nNodeID = rParseNode.m_nNodeID; + + for (::std::vector<OSQLParseNode*>::const_iterator i = m_aChilds.begin(); + i != m_aChilds.end(); i++) + delete *i; + + m_aChilds.clear(); + + for (::std::vector<OSQLParseNode*>::const_iterator j = rParseNode.m_aChilds.begin(); + j != rParseNode.m_aChilds.end(); j++) + append(new OSQLParseNode(**j)); + } + return *this; +} + +//----------------------------------------------------------------------------- +sal_Bool OSQLParseNode::operator==(OSQLParseNode& rParseNode) const +{ + DBG_CHKTHIS(OSQLParseNode,NULL); + + // die member muessen gleich sein + sal_Bool bResult = (m_nNodeID == rParseNode.m_nNodeID) && + (m_eNodeType == rParseNode.m_eNodeType) && + (m_aNodeValue == rParseNode.m_aNodeValue) && + count() == rParseNode.count(); + + // Parameters are not equal! + bResult = bResult && !SQL_ISRULE(this, parameter); + + // compare childs + for (sal_uInt32 i=0; bResult && i < count(); i++) + bResult = *getChild(i) == *rParseNode.getChild(i); + + return bResult; +} + +//----------------------------------------------------------------------------- +OSQLParseNode::~OSQLParseNode() +{ + DBG_DTOR(OSQLParseNode,NULL); + + for (::std::vector<OSQLParseNode*>::const_iterator i = m_aChilds.begin(); + i != m_aChilds.end(); i++) + delete *i; +} + +//----------------------------------------------------------------------------- +void OSQLParseNode::append(OSQLParseNode* pNewNode) +{ + DBG_CHKTHIS(OSQLParseNode,NULL); + DBG_ASSERT(pNewNode != NULL, "OSQLParseNode: ungueltiger NewSubTree"); + DBG_ASSERT(pNewNode->getParent() == NULL, "OSQLParseNode: Knoten ist kein Waise"); + DBG_ASSERT(::std::find(m_aChilds.begin(), m_aChilds.end(), pNewNode) == m_aChilds.end(), + "OSQLParseNode::append() Node already element of parent"); + + // stelle Verbindung zum getParent her: + pNewNode->setParent( this ); + // und haenge den SubTree hinten an + m_aChilds.push_back(pNewNode); +} + +//----------------------------------------------------------------------------- +void OSQLParseNode::parseNodeToStr(String& rString, + const Reference< XDatabaseMetaData > & xMeta, + OParseContext* pContext, + sal_Bool _bIntl, + sal_Bool _bQuote) const +{ + DBG_CHKTHIS(OSQLParseNode,NULL); + parseNodeToStr(rString, xMeta, Reference< XNumberFormatter >(), + Reference< XPropertySet >(), OParseContext::getDefaultInternational(), pContext, _bIntl, _bQuote, '.', sal_False); +} + +//----------------------------------------------------------------------------- +void OSQLParseNode::parseNodeToPredicateStr(String& rString, + const Reference< XDatabaseMetaData > & xMeta, + const Reference< XNumberFormatter > & xFormatter, + const International& rIntl, + OParseContext* pContext ) const +{ + DBG_CHKTHIS(OSQLParseNode,NULL); + DBG_ASSERT(xFormatter.is(), "OSQLParseNode::parseNodeToPredicateStr:: no formatter!"); + + if (xFormatter.is()) + parseNodeToStr(rString, xMeta, xFormatter, Reference< XPropertySet >(), rIntl, pContext, sal_True, sal_True, rIntl.GetNumDecimalSep(), sal_True); +} + +//----------------------------------------------------------------------------- +void OSQLParseNode::parseNodeToPredicateStr(String& rString, + const Reference< XDatabaseMetaData > & xMeta, + const Reference< XNumberFormatter > & xFormatter, + const Reference< XPropertySet > & _xField, + const International& rIntl, + OParseContext* pContext ) const +{ + DBG_CHKTHIS(OSQLParseNode,NULL); + DBG_ASSERT(xFormatter.is(), "OSQLParseNode::parseNodeToPredicateStr:: no formatter!"); + + if (xFormatter.is()) + parseNodeToStr(rString, xMeta, xFormatter, _xField, rIntl, pContext, sal_True, sal_True, rIntl.GetNumDecimalSep(), sal_True); +} + +//----------------------------------------------------------------------------- +void OSQLParseNode::parseNodeToStr(String& rString, + const Reference< XDatabaseMetaData > & xMeta, + const Reference< XNumberFormatter > & xFormatter, + const Reference< XPropertySet > & _xField, + const International& rIntl, + OParseContext* pContext, + sal_Bool _bIntl, + sal_Bool _bQuote, + char _cDecSep, + sal_Bool bPredicate) const +{ + DBG_CHKTHIS(OSQLParseNode,NULL); + DBG_ASSERT(xMeta.is(), "OSQLParseNode::parseNodeToStr:: no meta data!"); + + if (xMeta.is()) + { + String aIdentifierQuote(xMeta->getIdentifierQuoteString()); + String aCatalogSeparator(xMeta->getCatalogSeparator()); + + OSQLParseNode::parseNodeToStr(rString, + SQLParseNodeParameter(aIdentifierQuote, aCatalogSeparator, xFormatter, _xField, rIntl, pContext, _bIntl, _bQuote, _cDecSep, bPredicate)); + } +} +//----------------------------------------------------------------------------- +void OSQLParseNode::parseNodeToStr(String& rString, const SQLParseNodeParameter& rParam) const +{ + DBG_CHKTHIS(OSQLParseNode,NULL); + + if (!isToken()) + { + // einmal auswerten wieviel Subtrees dieser Knoten besitzt + sal_uInt32 nCount = count(); + + // parameter erhalten sonderbehandlung + if (SQL_ISRULE(this,parameter)) + { + if(rString.Len()) + rString += ' '; + if (nCount == 1) // ? + m_aChilds[0]->parseNodeToStr(rString, rParam); + else if (nCount == 2) // :Name + { + m_aChilds[0]->parseNodeToStr(rString, rParam); + rString += m_aChilds[1]->m_aNodeValue; + } // [Name] + else + { + m_aChilds[0]->parseNodeToStr(rString, rParam); + rString += m_aChilds[1]->m_aNodeValue; + rString += m_aChilds[2]->m_aNodeValue; + } + } + + else if(SQL_ISRULE(this,table_ref) && + ((nCount == 4 && SQL_ISPUNCTUATION(m_aChilds[0],"("))|| (nCount == 6 && SQL_ISPUNCTUATION(m_aChilds[0],"(")))) + tableRangeNodeToStr(rString, rParam); + // je nachdem ob international angegeben wird oder nicht wird like anders behandelt + // interanational: *, ? sind Platzhalter + // sonst SQL92 konform: %, _ + else if (SQL_ISRULE(this,like_predicate)) + likeNodeToStr(rString, rParam); + + else if (SQL_ISRULE(this,general_set_fct) || SQL_ISRULE(this,set_fct_spec) || + SQL_ISRULE(this,position_exp) || SQL_ISRULE(this,extract_exp) || + SQL_ISRULE(this,length_exp) || SQL_ISRULE(this,char_value_fct)) + { + if (!addDateValue(rString, rParam)) + { + // Funktionsname nicht quoten + SQLParseNodeParameter aNewParam(rParam); + aNewParam.bQuote = sal_False; + + m_aChilds[0]->parseNodeToStr(rString, aNewParam); + String aStringPara; + for (sal_uInt32 i=1; i<nCount; i++) + { + const OSQLParseNode * pSubTree = m_aChilds[i]; + if (pSubTree) + { + pSubTree->parseNodeToStr(aStringPara, rParam); + + // bei den CommaListen zwischen alle Subtrees Commas setzen + if ((m_eNodeType == SQL_NODE_COMMALISTRULE) && (i < (nCount - 1))) + aStringPara += String(','); + } + } + aStringPara.EraseTrailingChars(' '); + rString += aStringPara; + } + } + else + { + for (::std::vector<OSQLParseNode*>::const_iterator i = m_aChilds.begin(); + i != m_aChilds.end();) + { + const OSQLParseNode* pSubTree = *i; + if (pSubTree) + { + SQLParseNodeParameter aNewParam(rParam); + + // don't replace the field for subqueries + if (rParam.xField.is() && SQL_ISRULE(pSubTree,subquery)) + aNewParam.xField = NULL; + + // if there is a field given we don't display the fieldname, if there are any + if (rParam.xField.is() && SQL_ISRULE(pSubTree,column_ref)) + { + sal_Bool bFilter = sal_False; + // retrieve the fields name + String aFieldName; + try + { + // retrieve the fields name + rtl::OUString aString; + rParam.xField->getPropertyValue(String::CreateFromAscii("Name")) >>= aString; + aFieldName = aString.getStr(); + } + catch ( ... ) + { + } + + const OSQLParseNode* pCol = pSubTree->m_aChilds[pSubTree->count()-1]; + if ((SQL_ISRULE(pCol,column_val) && pCol->getChild(0)->getTokenValue().EqualsIgnoreCaseAscii(aFieldName)) || + pCol->getTokenValue().EqualsIgnoreCaseAscii(aFieldName)) + bFilter = sal_True; + + // ok we found the field, if the following node is the + // comparision operator '=' we filter it as well + if (bFilter) + { + if (SQL_ISRULE(this, comparison_predicate)) + { + ++i; + if(i != m_aChilds.end()) + { + pSubTree = *i; + if (pSubTree && pSubTree->getNodeType() == SQL_NODE_EQUAL) + i++; + } + } + else + i++; + } + else + { + pSubTree->parseNodeToStr(rString, aNewParam); + i++; + + // bei den CommaListen zwischen alle Subtrees Commas setzen + if ((m_eNodeType == SQL_NODE_COMMALISTRULE) && (i != m_aChilds.end())) + rString += String(','); + } + } + else + { + pSubTree->parseNodeToStr(rString, aNewParam); + i++; + + // bei den CommaListen zwischen alle Subtrees Commas setzen + if ((m_eNodeType == SQL_NODE_COMMALISTRULE) && (i != m_aChilds.end())) + { + if (SQL_ISRULE(this,value_exp_commalist) && rParam.bPredicate) + rString += String(';'); + else + rString += String(','); + } + } + } + } + } + } + else + { + // ein Blatt ist gefunden + // Inhalt dem Ausgabestring anfuegen + switch (m_eNodeType) + { + case SQL_NODE_KEYWORD: + { + if (rString.Len()) + rString += ' '; + + rString += String::CreateFromAscii( + OSQLParser::TokenIDToStr(m_nNodeID, &const_cast<OParseContext&>(rParam.rContext)).GetBuffer()); + } break; + case SQL_NODE_STRING: + if (rString.Len()) + rString += ' '; + rString += SetQuotation(m_aNodeValue,String::CreateFromAscii("\'"),String::CreateFromAscii("\'\'")); + break; + case SQL_NODE_NAME: + if (rString.Len()) + { + switch(ByteString::ConvertFromUnicode(rString.GetChar((rString.Len()-1)),RTL_TEXTENCODING_ASCII_US) ) + { + case ' ' : + case '.' : break; + default : + if (!rParam.aCatalogSeparator.Len() || rString.GetChar((sal_uInt32)(rString.Len()-1)) != rParam.aCatalogSeparator.GetChar(0)) + rString += ' '; break; + } + } + if (rParam.bQuote) + { + if (rParam.bPredicate) + { + rString.AppendAscii("["); + rString += m_aNodeValue; + rString.AppendAscii("]"); + } + else + rString += SetQuotation(m_aNodeValue, rParam.aIdentifierQuote.GetChar(0), rParam.aIdentifierQuote.GetChar(0)); + } + else + rString += m_aNodeValue; + break; + case SQL_NODE_ACCESS_DATE: + if (rString.Len()) + rString += ' '; + rString += '#'; + rString += m_aNodeValue; + rString += '#'; + break; + case SQL_NODE_INTNUM: + case SQL_NODE_APPROXNUM: + { + String aTmp = m_aNodeValue; + if (rParam.bInternational && rParam.bPredicate && rParam.cDecSep != '.') + aTmp.SearchAndReplaceAll('.', rParam.cDecSep); + + if (rString.Len()) + rString += ' '; + rString += aTmp; + + } break; + // fall through + default: + if (rString.Len() && m_aNodeValue.GetChar(0) != '.' && m_aNodeValue.GetChar(0) != ':' ) + { + switch( ByteString::ConvertFromUnicode(rString.GetChar(rString.Len()-1),RTL_TEXTENCODING_ASCII_US) ) + { + case ' ' : + case '.' : break; + default : + if (!rParam.aCatalogSeparator.Len() || rString.GetChar(rString.Len()-1) != rParam.aCatalogSeparator.GetChar(0)) + rString += ' '; break; + } + } + rString += m_aNodeValue; + } + } +} + +//----------------------------------------------------------------------------- +sal_Bool OSQLParseNode::addDateValue(String& rString, const SQLParseNodeParameter& rParam) const +{ + // special display for date/time values + if (rParam.bPredicate && SQL_ISRULE(this,set_fct_spec) && SQL_ISPUNCTUATION(m_aChilds[0],"{")) + { + const OSQLParseNode* pODBCNode = m_aChilds[1]; + const OSQLParseNode* pODBCNodeChild = pODBCNode->m_aChilds[0]; + + if (pODBCNodeChild->getNodeType() == SQL_NODE_KEYWORD && ( + SQL_ISTOKEN(pODBCNodeChild, D) || + SQL_ISTOKEN(pODBCNodeChild, T) || + SQL_ISTOKEN(pODBCNodeChild, TS) )) + { + if (rString.Len()) + rString += ' '; + rString += '#'; + if (SQL_ISTOKEN(pODBCNodeChild, D)) + rString += convertDateString(rParam, pODBCNode->m_aChilds[1]->getTokenValue()); + else if (SQL_ISTOKEN(pODBCNodeChild, T)) + rString += convertTimeString(rParam, pODBCNode->m_aChilds[1]->getTokenValue()); + else + rString += convertDateTimeString(rParam, pODBCNode->m_aChilds[1]->getTokenValue()); + + rString += '#'; + return sal_True; + } + } + return sal_False; +} + +//----------------------------------------------------------------------------- +void OSQLParseNode::replaceNodeValue(const String& rTableAlias,const String& rColumnName) +{ + for (sal_uInt32 i=0;i<count();++i) + { + if (SQL_ISRULE(this,column_ref) && count() == 1 && getChild(0)->getTokenValue() == rColumnName) + { + OSQLParseNode * pCol = removeAt((sal_uInt32)0); + append(new OSQLParseNode(rTableAlias,SQL_NODE_NAME)); + append(new OSQLParseNode(String::CreateFromAscii("."),SQL_NODE_PUNCTUATION)); + append(pCol); + } + else + getChild(i)->replaceNodeValue(rTableAlias,rColumnName); + } +} + +//----------------------------------------------------------------------------- +void OSQLParseNode::tableRangeNodeToStr(String& rString, const SQLParseNodeParameter& rParam) const +{ + sal_uInt32 nCount(count()); + rString += ' '; + + SQLParseNodeParameter aNewParam(rParam); + aNewParam.bQuote = sal_False; + if (nCount == 4) + { + m_aChilds[0]->parseNodeToStr(rString, rParam); + m_aChilds[1]->parseNodeToStr(rString, rParam); + m_aChilds[2]->parseNodeToStr(rString, aNewParam); + m_aChilds[3]->parseNodeToStr(rString, rParam); + } + else if(nCount == 6 && SQL_ISPUNCTUATION(m_aChilds[0],"(")) + { + m_aChilds[0]->parseNodeToStr(rString, rParam); + m_aChilds[1]->parseNodeToStr(rString, rParam); + m_aChilds[2]->parseNodeToStr(rString, rParam); + m_aChilds[3]->parseNodeToStr(rString, rParam); + m_aChilds[4]->parseNodeToStr(rString, aNewParam); + m_aChilds[5]->parseNodeToStr(rString, rParam); + } +} + +//----------------------------------------------------------------------------- +void OSQLParseNode::likeNodeToStr(String& rString, const SQLParseNodeParameter& rParam) const +{ + DBG_ASSERT(count() == 5,"count != 5: Prepare for GPF"); + + const OSQLParseNode* pEscNode = NULL; + const OSQLParseNode* pParaNode = NULL; + + SQLParseNodeParameter aNewParam(rParam); + aNewParam.bQuote = sal_True; + + // if there is a field given we don't display the fieldname, if there are any + sal_Bool bAddName = sal_True; + if (rParam.xField.is()) + { + // retrieve the fields name + String aFieldName; + try + { + // retrieve the fields name + rtl::OUString aString; + rParam.xField->getPropertyValue(String::CreateFromAscii("Name")) >>= aString; + aFieldName = aString.getStr(); + } + catch ( ... ) + { + } + + const OSQLParseNode* pCol = m_aChilds[0]->getChild(m_aChilds[0]->count()-1); + if ((SQL_ISRULE(pCol,column_val) && pCol->getChild(0)->getTokenValue().EqualsIgnoreCaseAscii(aFieldName)) || + pCol->getTokenValue().EqualsIgnoreCaseAscii(aFieldName) ) + bAddName = sal_False; + } + + if (bAddName) + m_aChilds[0]->parseNodeToStr(rString, aNewParam); + + m_aChilds[1]->parseNodeToStr(rString, aNewParam); + m_aChilds[2]->parseNodeToStr(rString, aNewParam); + + pParaNode = m_aChilds[3]; + pEscNode = m_aChilds[4]; + + if (pParaNode->isToken() && rParam.bInternational) + { + String aStr = ConvertLikeToken(pParaNode, pEscNode, sal_True); + rString += ' '; + rString += SetQuotation(aStr,String::CreateFromAscii("\'"),String::CreateFromAscii("\'\'")); + } + else + pParaNode->parseNodeToStr(rString, aNewParam); + + pEscNode->parseNodeToStr(rString, aNewParam); +} + +//----------------------------------------------------------------------------- +OSQLParseNode* OSQLParseNode::getByRule(OSQLParseNode::Rule eRule) const +{ + OSQLParseNode* pRetNode = 0; + if (isRule() && OSQLParser::RuleID(eRule) == getRuleID()) + pRetNode = (OSQLParseNode*)this; + else + { + for (::std::vector<OSQLParseNode*>::const_iterator i = m_aChilds.begin(); + !pRetNode && i != m_aChilds.end(); i++) + pRetNode = (*i)->getByRule(eRule); + } + return pRetNode; +} +//----------------------------------------------------------------------------- +OSQLParseNode* MakeANDNode(OSQLParseNode *pLeftLeaf,OSQLParseNode *pRightLeaf) +{ + OSQLParseNode* pNewNode = new OSQLParseNode(String(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::boolean_term)); + pNewNode->append(pLeftLeaf); + pNewNode->append(new OSQLParseNode(String::CreateFromAscii("AND"),SQL_NODE_KEYWORD,SQL_TOKEN_AND)); + pNewNode->append(pRightLeaf); + return pNewNode; +} +//----------------------------------------------------------------------------- +OSQLParseNode* MakeORNode(OSQLParseNode *pLeftLeaf,OSQLParseNode *pRightLeaf) +{ + OSQLParseNode* pNewNode = new OSQLParseNode(String(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::search_condition)); + pNewNode->append(pLeftLeaf); + pNewNode->append(new OSQLParseNode(String::CreateFromAscii("OR"),SQL_NODE_KEYWORD,SQL_TOKEN_OR)); + pNewNode->append(pRightLeaf); + return pNewNode; +} +//----------------------------------------------------------------------------- +void OSQLParseNode::disjunctiveNormalForm(OSQLParseNode*& pSearchCondition) +{ + if(!pSearchCondition) // no where condition at entry point + return; + + OSQLParseNode::absorptions(pSearchCondition); + // '(' search_condition ')' + if (SQL_ISRULE(pSearchCondition,boolean_primary)) + { + OSQLParseNode* pLeft = pSearchCondition->getChild(1); + disjunctiveNormalForm(pLeft); + } + // search_condition SQL_TOKEN_OR boolean_term + else if (SQL_ISRULE(pSearchCondition,search_condition)) + { + OSQLParseNode* pLeft = pSearchCondition->getChild(0); + disjunctiveNormalForm(pLeft); + + OSQLParseNode* pRight = pSearchCondition->getChild(2); + disjunctiveNormalForm(pRight); + } + // boolean_term SQL_TOKEN_AND boolean_factor + else if (SQL_ISRULE(pSearchCondition,boolean_term)) + { + OSQLParseNode* pLeft = pSearchCondition->getChild(0); + disjunctiveNormalForm(pLeft); + + OSQLParseNode* pRight = pSearchCondition->getChild(2); + disjunctiveNormalForm(pRight); + + OSQLParseNode* pNewNode = NULL; + // '(' search_condition ')' + if(pLeft->count() == 3 && SQL_ISRULE(pLeft,boolean_primary) && SQL_ISRULE(pLeft->getChild(1),search_condition)) + { + // and-or tree on left side + OSQLParseNode* pOr = pLeft->getChild(1); + OSQLParseNode* pNewLeft = NULL; + OSQLParseNode* pNewRight = NULL; + + // cut right from parent + pSearchCondition->removeAt(2); + + pNewRight = MakeANDNode(pOr->removeAt(2) ,pRight); + pNewLeft = MakeANDNode(pOr->removeAt((sal_uInt32)0) ,new OSQLParseNode(*pRight)); + pNewNode = MakeORNode(pNewLeft,pNewRight); + // and append new Node + pSearchCondition->getParent()->replace(pSearchCondition, pNewNode); + delete pSearchCondition; + + disjunctiveNormalForm(pNewNode); + } + else if(pRight->count() == 3 && SQL_ISRULE(pRight,boolean_primary) && SQL_ISRULE(pRight->getChild(1),search_condition)) + { + // and-or tree on right side + OSQLParseNode* pOr = pRight->getChild(1); + OSQLParseNode* pNewLeft = NULL; + OSQLParseNode* pNewRight = NULL; + + // cut left from parent + pSearchCondition->removeAt((sal_uInt32)0); + + pNewRight = MakeANDNode(pLeft,pOr->removeAt(2)); + pNewLeft = MakeANDNode(new OSQLParseNode(*pLeft),pOr->removeAt((sal_uInt32)0)); + pNewNode = MakeORNode(pNewLeft,pNewRight); + + // and append new Node + pSearchCondition->getParent()->replace(pSearchCondition, pNewNode); + delete pSearchCondition; + disjunctiveNormalForm(pNewNode); + } + else if(SQL_ISRULE(pLeft,boolean_primary) && (!SQL_ISRULE(pLeft->getChild(1),search_condition) || !SQL_ISRULE(pLeft->getChild(1),boolean_term))) + pSearchCondition->replace(pLeft, pLeft->removeAt(1)); + else if(SQL_ISRULE(pRight,boolean_primary) && (!SQL_ISRULE(pRight->getChild(1),search_condition) || !SQL_ISRULE(pRight->getChild(1),boolean_term))) + pSearchCondition->replace(pRight, pRight->removeAt(1)); + } +} +//----------------------------------------------------------------------------- +void OSQLParseNode::negateSearchCondition(OSQLParseNode*& pSearchCondition,sal_Bool bNegate) +{ + if(!pSearchCondition) // no where condition at entry point + return; + OSQLParseNode* pNode = NULL; + // '(' search_condition ')' + if (pSearchCondition->count() == 3 && SQL_ISRULE(pSearchCondition,boolean_primary)) + { + OSQLParseNode* pRight = pSearchCondition->getChild(1); + negateSearchCondition(pRight,bNegate); + } + // search_condition SQL_TOKEN_OR boolean_term + else if (SQL_ISRULE(pSearchCondition,search_condition)) + { + OSQLParseNode* pLeft = pSearchCondition->getChild(0); + OSQLParseNode* pRight = pSearchCondition->getChild(2); + if(bNegate) + { + OSQLParseNode* pNewNode = new OSQLParseNode(String(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::boolean_term)); + pNewNode->append(pSearchCondition->removeAt((sal_uInt32)0)); + pNewNode->append(new OSQLParseNode(String::CreateFromAscii("AND"),SQL_NODE_KEYWORD,SQL_TOKEN_AND)); + pNewNode->append(pSearchCondition->removeAt((sal_uInt32)1)); + pSearchCondition->getParent()->replace(pSearchCondition, pNewNode); + delete pSearchCondition; + pLeft = pNewNode->getChild(0); + pRight = pNewNode->getChild(2); + } + + negateSearchCondition(pLeft,bNegate); + negateSearchCondition(pRight,bNegate); + } + // boolean_term SQL_TOKEN_AND boolean_factor + else if (SQL_ISRULE(pSearchCondition,boolean_term)) + { + OSQLParseNode* pLeft = pSearchCondition->getChild(0); + OSQLParseNode* pRight = pSearchCondition->getChild(2); + if(bNegate) + { + OSQLParseNode* pNewNode = new OSQLParseNode(String(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::search_condition)); + pNewNode->append(pSearchCondition->removeAt((sal_uInt32)0)); + pNewNode->append(new OSQLParseNode(String::CreateFromAscii("OR"),SQL_NODE_KEYWORD,SQL_TOKEN_OR)); + pNewNode->append(pSearchCondition->removeAt((sal_uInt32)1)); + pSearchCondition->getParent()->replace(pSearchCondition, pNewNode); + delete pSearchCondition; + pLeft = pNewNode->getChild(0); + pRight = pNewNode->getChild(2); + } + + negateSearchCondition(pLeft,bNegate); + negateSearchCondition(pRight,bNegate); + } + // SQL_TOKEN_NOT boolean_test + else if (SQL_ISRULE(pSearchCondition,boolean_factor)) + { + OSQLParseNode *pNot = pSearchCondition->removeAt((sal_uInt32)0); + delete pNot; + OSQLParseNode *pBooleanTest = pSearchCondition->removeAt((sal_uInt32)0); + pBooleanTest->setParent(NULL); + pSearchCondition->getParent()->replace(pSearchCondition, pBooleanTest); + delete pSearchCondition; + if (!bNegate) + negateSearchCondition(pBooleanTest,sal_True); // negate all deeper values + } + // row_value_constructor comparison row_value_constructor + // row_value_constructor comparison any_all_some subquery + else if(bNegate && SQL_ISRULE(pSearchCondition,comparison_predicate) || SQL_ISRULE(pSearchCondition,all_or_any_predicate)) + { + OSQLParseNode* pComparison = pSearchCondition->getChild(1); + OSQLParseNode* pNewComparison = NULL; + switch(pComparison->getNodeType()) + { + case SQL_NODE_EQUAL: + pNewComparison = new OSQLParseNode(String::CreateFromAscii("<>"),SQL_NODE_NOTEQUAL,NOTEQUAL); + break; + case SQL_NODE_LESS: + pNewComparison = new OSQLParseNode(String::CreateFromAscii(">="),SQL_NODE_GREATEQ,GREATEQ); + break; + case SQL_NODE_GREAT: + pNewComparison = new OSQLParseNode(String::CreateFromAscii("<="),SQL_NODE_LESSEQ,LESSEQ); + break; + case SQL_NODE_LESSEQ: + pNewComparison = new OSQLParseNode(String::CreateFromAscii(">"),SQL_NODE_GREAT,GREAT); + break; + case SQL_NODE_GREATEQ: + pNewComparison = new OSQLParseNode(String::CreateFromAscii("<"),SQL_NODE_LESS,LESS); + break; + case SQL_NODE_NOTEQUAL: + pNewComparison = new OSQLParseNode(String::CreateFromAscii("="),SQL_NODE_EQUAL,EQUAL); + break; + } + pSearchCondition->replace(pComparison, pNewComparison); + delete pComparison; + } + + else if(bNegate && (SQL_ISRULE(pSearchCondition,test_for_null) || SQL_ISRULE(pSearchCondition,in_predicate) || + SQL_ISRULE(pSearchCondition,like_predicate) || SQL_ISRULE(pSearchCondition,between_predicate) || + SQL_ISRULE(pSearchCondition,boolean_test) )) + { + sal_uInt32 nNotPos = 0; + // row_value_constructor not SQL_TOKEN_IN in_predicate_value + // row_value_constructor not SQL_TOKEN_LIKE num_value_exp opt_escape + // row_value_constructor not SQL_TOKEN_BETWEEN row_value_constructor SQL_TOKEN_AND row_value_constructor + if(SQL_ISRULE(pSearchCondition,in_predicate) || SQL_ISRULE(pSearchCondition,like_predicate) || + SQL_ISRULE(pSearchCondition,between_predicate)) + nNotPos = 1; + // row_value_constructor SQL_TOKEN_IS not SQL_TOKEN_NULL + // boolean_primary SQL_TOKEN_IS not truth_value + else if(SQL_ISRULE(pSearchCondition,test_for_null) || SQL_ISRULE(pSearchCondition,boolean_test)) + nNotPos = 2; + + OSQLParseNode* pNot = pSearchCondition->getChild(nNotPos); + OSQLParseNode* pNotNot = NULL; + if(pNot->isRule()) + pNotNot = new OSQLParseNode(String::CreateFromAscii("NOT"),SQL_NODE_KEYWORD,SQL_TOKEN_NOT); + else + pNotNot = new OSQLParseNode(String(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::not)); + pSearchCondition->replace(pNot, pNotNot); + delete pNot; + } +} +//----------------------------------------------------------------------------- +void OSQLParseNode::eraseBraces(OSQLParseNode*& pSearchCondition) +{ + if (pSearchCondition && (SQL_ISRULE(pSearchCondition,boolean_primary) || (pSearchCondition->count() == 3 && SQL_ISPUNCTUATION(pSearchCondition->getChild(0),"(") && + SQL_ISPUNCTUATION(pSearchCondition->getChild(2),")")))) + { + OSQLParseNode* pRight = pSearchCondition->getChild(1); + absorptions(pRight); + // if child is not a or or and tree then delete () around child + if(!(SQL_ISRULE(pSearchCondition->getChild(1),boolean_term) || SQL_ISRULE(pSearchCondition->getChild(1),search_condition)) || + SQL_ISRULE(pSearchCondition->getChild(1),boolean_term) || // and can always stand without () + (SQL_ISRULE(pSearchCondition->getChild(1),search_condition) && SQL_ISRULE(pSearchCondition->getParent(),search_condition))) + { + OSQLParseNode* pNode = pSearchCondition->removeAt(1); + pSearchCondition->getParent()->replace(pSearchCondition, pNode); + delete pSearchCondition; + pSearchCondition = pNode; + } + } +} +//----------------------------------------------------------------------------- +void OSQLParseNode::absorptions(OSQLParseNode*& pSearchCondition) +{ + if(!pSearchCondition) // no where condition at entry point + return; + + eraseBraces(pSearchCondition); + + if(SQL_ISRULE(pSearchCondition,boolean_term) || SQL_ISRULE(pSearchCondition,search_condition)) + { + OSQLParseNode* pLeft = pSearchCondition->getChild(0); + absorptions(pLeft); + OSQLParseNode* pRight = pSearchCondition->getChild(2); + absorptions(pRight); + } + + // a and a || a or a + OSQLParseNode* pNewNode = NULL; + if(( SQL_ISRULE(pSearchCondition,boolean_term) || SQL_ISRULE(pSearchCondition,search_condition)) + && *pSearchCondition->getChild(0) == *pSearchCondition->getChild(2)) + { + pNewNode = pSearchCondition->removeAt((sal_uInt32)0); + pSearchCondition->getParent()->replace(pSearchCondition, pNewNode); + delete pSearchCondition; + pSearchCondition = pNewNode; + } + // (a or b) and a + else if(SQL_ISRULE(pSearchCondition,boolean_term) && SQL_ISRULE(pSearchCondition->getChild(0),boolean_primary) && + SQL_ISRULE(pSearchCondition->getChild(0)->getChild(1),search_condition) && + *pSearchCondition->getChild(0)->getChild(1)->getChild(0) == *pSearchCondition->getChild(2)) + { + pSearchCondition->getParent()->replace(pSearchCondition, pNewNode = pSearchCondition->removeAt(2)); + delete pSearchCondition; + pSearchCondition = pNewNode; + } + // a and ( a or b) + else if(SQL_ISRULE(pSearchCondition,boolean_term) && SQL_ISRULE(pSearchCondition->getChild(2),boolean_primary) && + SQL_ISRULE(pSearchCondition->getChild(2)->getChild(1),search_condition)) + + { + if(*pSearchCondition->getChild(2)->getChild(1)->getChild(0) == *pSearchCondition->getChild(0)) + { + pSearchCondition->getParent()->replace(pSearchCondition, pNewNode = pSearchCondition->removeAt((sal_uInt32)0)); + delete pSearchCondition; + pSearchCondition = pNewNode; + } + else if(*pSearchCondition->getChild(2)->getChild(1)->getChild(2) == *pSearchCondition->getChild(0)) + { + pSearchCondition->getParent()->replace(pSearchCondition, pNewNode = pSearchCondition->removeAt((sal_uInt32)2)); + delete pSearchCondition; + pSearchCondition = pNewNode; + } + } + // a or a and b || a or b and a + else if(SQL_ISRULE(pSearchCondition,search_condition) && SQL_ISRULE(pSearchCondition->getChild(2),boolean_term)) + { + if(*pSearchCondition->getChild(2)->getChild(0) == *pSearchCondition->getChild(0)) + { + pSearchCondition->getParent()->replace(pSearchCondition, pNewNode = pSearchCondition->removeAt((sal_uInt32)0)); + delete pSearchCondition; + pSearchCondition = pNewNode; + } + else if(*pSearchCondition->getChild(2)->getChild(2) == *pSearchCondition->getChild(0)) + { + pSearchCondition->getParent()->replace(pSearchCondition, pNewNode = pSearchCondition->removeAt((sal_uInt32)0)); + delete pSearchCondition; + pSearchCondition = pNewNode; + } + } + // a and b or a || b and a or a + else if(SQL_ISRULE(pSearchCondition,search_condition) && SQL_ISRULE(pSearchCondition->getChild(0),boolean_term)) + { + if(*pSearchCondition->getChild(0)->getChild(0) == *pSearchCondition->getChild(2)) + { + pSearchCondition->getParent()->replace(pSearchCondition, pNewNode = pSearchCondition->removeAt((sal_uInt32)2)); + delete pSearchCondition; + pSearchCondition = pNewNode; + } + else if(*pSearchCondition->getChild(0)->getChild(2) == *pSearchCondition->getChild(2)) + { + pSearchCondition->getParent()->replace(pSearchCondition, pNewNode = pSearchCondition->removeAt((sal_uInt32)2)); + delete pSearchCondition; + pSearchCondition = pNewNode; + } + } + eraseBraces(pSearchCondition); +} +//----------------------------------------------------------------------------- +void OSQLParseNode::compress(OSQLParseNode *&pSearchCondition) +{ + if(!pSearchCondition) // no where condition at entry point + return; + + OSQLParseNode::eraseBraces(pSearchCondition); + + if(SQL_ISRULE(pSearchCondition,boolean_term) || SQL_ISRULE(pSearchCondition,search_condition)) + { + OSQLParseNode* pLeft = pSearchCondition->getChild(0); + compress(pLeft); + + OSQLParseNode* pRight = pSearchCondition->getChild(2); + compress(pRight); + } + else if( SQL_ISRULE(pSearchCondition,boolean_primary) || (pSearchCondition->count() == 3 && SQL_ISPUNCTUATION(pSearchCondition->getChild(0),"(") && + SQL_ISPUNCTUATION(pSearchCondition->getChild(2),")"))) + { + OSQLParseNode* pRight = pSearchCondition->getChild(1); + compress(pRight); + // if child is not a or or and tree then delete () around child + if(!(SQL_ISRULE(pSearchCondition->getChild(1),boolean_term) || SQL_ISRULE(pSearchCondition->getChild(1),search_condition)) || + (SQL_ISRULE(pSearchCondition->getChild(1),boolean_term) && SQL_ISRULE(pSearchCondition->getParent(),boolean_term)) || + (SQL_ISRULE(pSearchCondition->getChild(1),search_condition) && SQL_ISRULE(pSearchCondition->getParent(),search_condition))) + { + OSQLParseNode* pNode = pSearchCondition->removeAt(1); + pSearchCondition->getParent()->replace(pSearchCondition, pNode); + delete pSearchCondition; + pSearchCondition = pNode; + } + } + + OSQLParseNode* pNewNode = NULL; + // or with two and trees where one element of the and trees are equal + if(SQL_ISRULE(pSearchCondition,search_condition) && SQL_ISRULE(pSearchCondition->getChild(0),boolean_term) && SQL_ISRULE(pSearchCondition->getChild(2),boolean_term)) + { + if(*pSearchCondition->getChild(0)->getChild(0) == *pSearchCondition->getChild(2)->getChild(0)) + { + OSQLParseNode* pLeft = pSearchCondition->getChild(0)->removeAt(2); + OSQLParseNode* pRight = pSearchCondition->getChild(2)->removeAt(2); + OSQLParseNode* pNode = MakeORNode(pLeft,pRight); + + OSQLParseNode* pNewRule = new OSQLParseNode(String(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::boolean_primary)); + pNewRule->append(new OSQLParseNode(String::CreateFromAscii("("),SQL_NODE_PUNCTUATION)); + pNewRule->append(pNode); + pNewRule->append(new OSQLParseNode(String::CreateFromAscii(")"),SQL_NODE_PUNCTUATION)); + + OSQLParseNode::eraseBraces(pLeft); + OSQLParseNode::eraseBraces(pRight); + + pNode = MakeANDNode(pSearchCondition->getChild(0)->removeAt((sal_uInt32)0),pNewRule); + pSearchCondition->getParent()->replace(pSearchCondition, pNode); + delete pSearchCondition; + pSearchCondition = pNode; + } + else if(*pSearchCondition->getChild(0)->getChild(2) == *pSearchCondition->getChild(2)->getChild(0)) + { + OSQLParseNode* pLeft = pSearchCondition->getChild(0)->removeAt((sal_uInt32)0); + OSQLParseNode* pRight = pSearchCondition->getChild(2)->removeAt(2); + OSQLParseNode* pNode = MakeORNode(pLeft,pRight); + + OSQLParseNode* pNewRule = new OSQLParseNode(String(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::boolean_primary)); + pNewRule->append(new OSQLParseNode(String::CreateFromAscii("("),SQL_NODE_PUNCTUATION)); + pNewRule->append(pNode); + pNewRule->append(new OSQLParseNode(String::CreateFromAscii(")"),SQL_NODE_PUNCTUATION)); + + OSQLParseNode::eraseBraces(pLeft); + OSQLParseNode::eraseBraces(pRight); + + pNode = MakeANDNode(pSearchCondition->getChild(0)->removeAt(1),pNewRule); + pSearchCondition->getParent()->replace(pSearchCondition, pNode); + delete pSearchCondition; + pSearchCondition = pNode; + } + else if(*pSearchCondition->getChild(0)->getChild(0) == *pSearchCondition->getChild(2)->getChild(2)) + { + OSQLParseNode* pLeft = pSearchCondition->getChild(0)->removeAt(2); + OSQLParseNode* pRight = pSearchCondition->getChild(2)->removeAt((sal_uInt32)0); + OSQLParseNode* pNode = MakeORNode(pLeft,pRight); + + OSQLParseNode* pNewRule = new OSQLParseNode(String(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::boolean_primary)); + pNewRule->append(new OSQLParseNode(String::CreateFromAscii("("),SQL_NODE_PUNCTUATION)); + pNewRule->append(pNode); + pNewRule->append(new OSQLParseNode(String::CreateFromAscii(")"),SQL_NODE_PUNCTUATION)); + + OSQLParseNode::eraseBraces(pLeft); + OSQLParseNode::eraseBraces(pRight); + + pNode = MakeANDNode(pSearchCondition->getChild(0)->removeAt((sal_uInt32)0),pNewRule); + pSearchCondition->getParent()->replace(pSearchCondition, pNode); + delete pSearchCondition; + pSearchCondition = pNode; + } + else if(*pSearchCondition->getChild(0)->getChild(2) == *pSearchCondition->getChild(2)->getChild(2)) + { + OSQLParseNode* pLeft = pSearchCondition->getChild(0)->removeAt((sal_uInt32)0); + OSQLParseNode* pRight = pSearchCondition->getChild(2)->removeAt((sal_uInt32)0); + OSQLParseNode* pNode = MakeORNode(pLeft,pRight); + + OSQLParseNode* pNewRule = new OSQLParseNode(String(),SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::boolean_primary)); + pNewRule->append(new OSQLParseNode(String::CreateFromAscii("("),SQL_NODE_PUNCTUATION)); + pNewRule->append(pNode); + pNewRule->append(new OSQLParseNode(String::CreateFromAscii(")"),SQL_NODE_PUNCTUATION)); + + OSQLParseNode::eraseBraces(pLeft); + OSQLParseNode::eraseBraces(pRight); + + pNode = MakeANDNode(pSearchCondition->getChild(0)->removeAt(1),pNewRule); + pSearchCondition->getParent()->replace(pSearchCondition, pNode); + delete pSearchCondition; + pSearchCondition = pNode; + } + } +} +//----------------------------------------------------------------------------- +void OSQLParseNode::showParseTree(String& rString, sal_uInt32 nLevel) +{ + DBG_CHKTHIS(OSQLParseNode,NULL); + + if (!isToken()) + { + for (sal_uInt32 j=0; j<nLevel; j++) {rString.AppendAscii("\t");}; + // Regelnamen als rule: ... + rString.AppendAscii("RULE_ID:\t "); + rString += (String) getRuleID(); + rString.AppendAscii("("); + rString += OSQLParser::RuleIDToStr(getRuleID()); + rString.AppendAscii(")"); + rString.AppendAscii("\n"); + + // einmal auswerten wieviel Subtrees dieser Knoten besitzt + sal_uInt32 nStop = count(); + // hol dir den ersten Subtree + for (::std::vector<OSQLParseNode*>::const_iterator i = m_aChilds.begin(); + i != m_aChilds.end(); i++) + (*i)->showParseTree(rString, nLevel+1); + } + else { + // ein Token gefunden + // tabs fuer das Einruecken entsprechend nLevel + for (sal_uInt32 j=0; j<nLevel; j++) {rString.AppendAscii("\t");}; + + switch (m_eNodeType) { + + case SQL_NODE_KEYWORD: + {rString.AppendAscii("SQL_KEYWORD:\t"); + rString += String::CreateFromAscii(OSQLParser::TokenIDToStr(getTokenID()).GetBuffer()); + rString.AppendAscii("\n"); + break;} + + case SQL_NODE_COMPARISON: + {rString.AppendAscii("SQL_COMPARISON:\t"); + rString += m_aNodeValue; // haenge Nodevalue an + rString.AppendAscii("\n"); // und beginne neu Zeile + break;} + + case SQL_NODE_NAME: + {rString.AppendAscii("SQL_NAME:\t"); + rString.AppendAscii("\""); + rString += m_aNodeValue; + rString.AppendAscii("\""); + rString.AppendAscii("\n"); + break;} + + case SQL_NODE_STRING: + {rString .AppendAscii("SQL_STRING:\t'"); + rString += m_aNodeValue; + rString .AppendAscii("'\n"); + break;} + + case SQL_NODE_INTNUM: + {rString .AppendAscii("SQL_INTNUM:\t"); + rString += m_aNodeValue; + rString .AppendAscii("\n"); + break;} + + case SQL_NODE_APPROXNUM: + {rString .AppendAscii("SQL_APPROXNUM:\t"); + rString += m_aNodeValue; + rString .AppendAscii("\n"); + break;} + + case SQL_NODE_PUNCTUATION: + {rString .AppendAscii("SQL_PUNCTUATION:\t"); + rString += m_aNodeValue; // haenge Nodevalue an + rString .AppendAscii("\n"); // und beginne neu Zeile + break;} + + case SQL_NODE_AMMSC: + {rString .AppendAscii("SQL_AMMSC:\t"); + rString += m_aNodeValue; // haenge Nodevalue an + rString .AppendAscii("\n"); // und beginne neu Zeile + break;} + + default: + DBG_ERROR("OSQLParser::ShowParseTree: unzulaessiger NodeType"); + } + }; +} + +// Insert-Methoden +//----------------------------------------------------------------------------- +void OSQLParseNode::insert(sal_uInt32 nPos, OSQLParseNode* pNewSubTree) +{ + DBG_ASSERT(pNewSubTree != NULL, "OSQLParseNode: ungueltiger NewSubTree"); + DBG_ASSERT(pNewSubTree->getParent() == NULL, "OSQLParseNode: Knoten ist kein Waise"); + + // stelle Verbindung zum getParent her: + pNewSubTree->setParent( this ); + m_aChilds.insert(m_aChilds.begin() + nPos); +} + +// removeAt-Methoden +//----------------------------------------------------------------------------- +OSQLParseNode* OSQLParseNode::removeAt(sal_uInt32 nPos) +{ + ::std::vector<OSQLParseNode*>::iterator aPos(m_aChilds.begin() + nPos); + OSQLParseNode* pNode = *aPos; + + // setze den getParent des removeten auf NULL + pNode->setParent( NULL ); + + m_aChilds.erase(aPos); + return pNode; +} +//----------------------------------------------------------------------------- +OSQLParseNode* OSQLParseNode::remove(OSQLParseNode* pSubTree) +{ + DBG_ASSERT(pSubTree != NULL, "OSQLParseNode: ungueltiger SubTree"); + ::std::vector<OSQLParseNode*>::iterator aPos = ::std::find(m_aChilds.begin(), m_aChilds.end(), pSubTree); + if (aPos != m_aChilds.end()) + { + // setze den getParent des removeten auf NULL + pSubTree->setParent( NULL ); + m_aChilds.erase(aPos); + return pSubTree; + } + else + return NULL; +} + +// Replace-Methoden +//----------------------------------------------------------------------------- +OSQLParseNode* OSQLParseNode::replaceAt(sal_uInt32 nPos, OSQLParseNode* pNewSubNode) +{ + DBG_ASSERT(pNewSubNode != NULL, "OSQLParseNode: invalid nodes"); + DBG_ASSERT(pNewSubNode->getParent() == NULL, "OSQLParseNode: node already has getParent"); + DBG_ASSERT(nPos < m_aChilds.size(), "OSQLParseNode: invalid position"); + DBG_ASSERT(::std::find(m_aChilds.begin(), m_aChilds.end(), pNewSubNode) == m_aChilds.end(), + "OSQLParseNode::Replace() Node already element of parent"); + + OSQLParseNode* pOldSubNode = m_aChilds[nPos]; + + // stelle Verbindung zum getParent her: + pNewSubNode->setParent( this ); + pOldSubNode->setParent( NULL ); + + m_aChilds[nPos] = pNewSubNode; + return pOldSubNode; +} + +//----------------------------------------------------------------------------- +OSQLParseNode* OSQLParseNode::replace (OSQLParseNode* pOldSubNode, OSQLParseNode* pNewSubNode ) +{ + DBG_ASSERT(pOldSubNode != NULL && pNewSubNode != NULL, "OSQLParseNode: invalid nodes"); + DBG_ASSERT(pNewSubNode->getParent() == NULL, "OSQLParseNode: node already has getParent"); + DBG_ASSERT(::std::find(m_aChilds.begin(), m_aChilds.end(), pOldSubNode) != m_aChilds.end(), + "OSQLParseNode::Replace() Node not element of parent"); + DBG_ASSERT(::std::find(m_aChilds.begin(), m_aChilds.end(), pNewSubNode) == m_aChilds.end(), + "OSQLParseNode::Replace() Node already element of parent"); + + pOldSubNode->setParent( NULL ); + pNewSubNode->setParent( this ); + ::std::replace(m_aChilds.begin(), m_aChilds.end(), pOldSubNode, pNewSubNode); + return pOldSubNode; +} + + diff --git a/connectivity/source/resource/makefile.mk b/connectivity/source/resource/makefile.mk new file mode 100644 index 000000000000..5d506ad9adb8 --- /dev/null +++ b/connectivity/source/resource/makefile.mk @@ -0,0 +1,84 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:14:28 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=connectivity +TARGET=resource + +# --- Settings ----------------------------------------------------- +.IF "$(DBGUTIL_OJ)"!="" +ENVCFLAGS+=/FR$(SLO)$/ +.ENDIF + +.INCLUDE : settings.mk +# --- Files -------------------------------------------------------- + +SLOFILES=\ + $(SLO)$/ModuleContext.obj \ + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + diff --git a/connectivity/source/sdbcx/VCatalog.cxx b/connectivity/source/sdbcx/VCatalog.cxx new file mode 100644 index 000000000000..1616aedf7421 --- /dev/null +++ b/connectivity/source/sdbcx/VCatalog.cxx @@ -0,0 +1,170 @@ +/************************************************************************* + * + * $RCSfile: VCatalog.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_SDBCX_CATALOG_HXX_ +#include "connectivity/sdbcx/VCatalog.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif + +using namespace connectivity::sdbcx; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +//------------------------------------------------------------------------------ +IMPLEMENT_SERVICE_INFO(OCatalog,"com.sun.star.sdbcx.VDatabaseDefinition","com.sun.star.sdbcx.DatabaseDefinition") +//------------------------------------------------------------------------------ +OCatalog::OCatalog(const Reference< XConnection> &_xConnection) : OCatalog_BASE(m_aMutex) + ,connectivity::OSubComponent<OCatalog>(_xConnection) + ,m_pTables(NULL) + ,m_pViews(NULL) + ,m_pGroups(NULL) + ,m_pUsers(NULL) +{ +} +//----------------------------------------------------------------------------- +OCatalog::~OCatalog() +{ + delete m_pTables; + delete m_pViews; + delete m_pGroups; + delete m_pUsers; +} +//----------------------------------------------------------------------------- +void SAL_CALL OCatalog::release() throw(RuntimeException) +{ + relase_ChildImpl(); + OCatalog_BASE::release(); +} +//------------------------------------------------------------------------------ +void SAL_CALL OCatalog::disposing() +{ + ::osl::MutexGuard aGuard(m_aMutex); + + if(m_pTables) + m_pTables->disposing(); + if(m_pViews) + m_pViews->disposing(); + if(m_pGroups) + m_pGroups->disposing(); + if(m_pUsers) + m_pUsers->disposing(); + + dispose_ChildImpl(); + OCatalog_BASE::disposing(); +} +//------------------------------------------------------------------------------ +// XTablesSupplier +Reference< XNameAccess > SAL_CALL OCatalog::getTables( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OCatalog_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return const_cast<OCatalog*>(this)->m_pTables; +} +// ------------------------------------------------------------------------- +// XViewsSupplier +Reference< XNameAccess > SAL_CALL OCatalog::getViews( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OCatalog_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return const_cast<OCatalog*>(this)->m_pViews; +} +// ------------------------------------------------------------------------- +// XUsersSupplier +Reference< XNameAccess > SAL_CALL OCatalog::getUsers( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OCatalog_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return const_cast<OCatalog*>(this)->m_pUsers; +} +// ------------------------------------------------------------------------- +// XGroupsSupplier +Reference< XNameAccess > SAL_CALL OCatalog::getGroups( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OCatalog_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return const_cast<OCatalog*>(this)->m_pGroups; +} +// ------------------------------------------------------------------------- +void ODescriptor::construct() +{ + sal_Int32 nAttrib = isNew() ? 0 : ::com::sun::star::beans::PropertyAttribute::READONLY; + registerProperty(connectivity::PROPERTY_NAME, PROPERTY_ID_NAME ,nAttrib,&m_Name,::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); +} + diff --git a/connectivity/source/sdbcx/VCollection.cxx b/connectivity/source/sdbcx/VCollection.cxx new file mode 100644 index 000000000000..aaabb43338ad --- /dev/null +++ b/connectivity/source/sdbcx/VCollection.cxx @@ -0,0 +1,238 @@ +/************************************************************************* + * + * $RCSfile: VCollection.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _CONNECTIVITY_ENUMHELPER_HXX_ +#include "enumhelper.hxx" +#endif + +using namespace connectivity::sdbcx; +using namespace connectivity; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::util; + +IMPLEMENT_SERVICE_INFO(OCollection,"com.sun.star.sdbcx.VContainer" , "com.sun.star.sdbcx.Container") + +// ------------------------------------------------------------------------- +void OCollection::disposing(void) +{ + m_aRefreshListeners.disposeAndClear(EventObject(static_cast<XWeak*>(this))); + + ::osl::MutexGuard aGuard(m_rMutex); + for( ObjectIter aIter = m_aNameMap.begin(); aIter != m_aNameMap.end(); ++aIter) + { + if((*aIter).second.is()) + { + Reference< XComponent > xComp2((*aIter).second, UNO_QUERY); + if(xComp2.is()) + xComp2->dispose(); + + (*aIter).second = Reference< XNamed >(); + } + } + m_aNameMap.clear(); + m_aElements.clear(); +} +// ------------------------------------------------------------------------- +Any SAL_CALL OCollection::getByIndex( sal_Int32 Index ) throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + if (Index < 0 || Index >= getCount()) + throw IndexOutOfBoundsException(); + + ObjectIter aIter = m_aElements[Index]; + Reference< XNamed > xName = (*aIter).second; + if(!(*aIter).second.is()) + { + xName = createObject((*aIter).first); + (*aIter).second = xName; + } + + return makeAny( Reference< XPropertySet >(xName,UNO_QUERY)); +} +// ------------------------------------------------------------------------- +Any SAL_CALL OCollection::getByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + + ObjectIter aIter = m_aNameMap.find(aName); + if(aIter == m_aNameMap.end()) + return Any(); + Reference< XNamed > xName = (*aIter).second; + if(!(*aIter).second.is()) + { + xName = createObject(aName); + (*aIter).second = xName; + } + + return makeAny( Reference< XPropertySet >(xName,UNO_QUERY)); +} +// ------------------------------------------------------------------------- +Sequence< ::rtl::OUString > SAL_CALL OCollection::getElementNames( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + sal_Int32 nLen = getCount(); + Sequence< ::rtl::OUString > aNameList(nLen); + + sal_Int32 i=0; + ::rtl::OUString* pStringArray = aNameList.getArray(); + // for( ::std::map< ::rtl::OUString, Object_BASE, ::utl::UStringLess> ::const_iterator aIter = m_aNameMap.begin(); aIter != m_aNameMap.end(); ++aIter) + for(::std::vector< ObjectIter >::const_iterator aIter = m_aElements.begin(); aIter != m_aElements.end();++aIter) + pStringArray[i++] = (*aIter)->first; + + return aNameList; +} +// ------------------------------------------------------------------------- +void SAL_CALL OCollection::refresh( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + for( ::std::map< ::rtl::OUString, Object_BASE, ::utl::UStringLess>::iterator aIter = m_aNameMap.begin(); aIter != m_aNameMap.end(); ++aIter) + { + if((*aIter).second.is()) + { + Reference< XComponent > xComp2((*aIter).second, UNO_QUERY); + if(xComp2.is()) + xComp2->dispose(); + + (*aIter).second = Reference< XNamed >(); + } + } + m_aNameMap.clear(); + m_aElements.clear(); + + impl_refresh(); + EventObject aEvt(static_cast<XWeak*>(this)); + NOTIFY_LISTENERS(m_aRefreshListeners, XRefreshListener, refreshed, aEvt); +} +// ------------------------------------------------------------------------- +// XDataDescriptorFactory +Reference< XPropertySet > SAL_CALL OCollection::createDataDescriptor( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + + return createEmptyObject(); +} +// ------------------------------------------------------------------------- +// XAppend +void SAL_CALL OCollection::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + + Reference< XNamed > xName(descriptor,UNO_QUERY); + if(xName.is()) + { + if(m_aNameMap.find(xName->getName()) != m_aNameMap.end()) + throw ElementExistException(xName->getName(),*this); + + m_aElements.push_back(m_aNameMap.insert(m_aNameMap.begin(), ObjectMap::value_type(xName->getName(),WeakReference< XNamed >(xName)))); + } +} +// ------------------------------------------------------------------------- +// XDrop +void SAL_CALL OCollection::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + + ObjectMap::iterator aIter = m_aNameMap.find(elementName); + if( aIter == m_aNameMap.end()) + throw NoSuchElementException(elementName,*this); + + for(::std::vector< ObjectIter >::size_type i=0;i<m_aElements.size();++i) + { + if(m_aElements[i] == aIter) + { + m_aElements.erase(m_aElements.begin()+i); + m_aNameMap.erase(aIter); + } + } +} +// ------------------------------------------------------------------------- +void SAL_CALL OCollection::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + if(index <0 || index > getCount()) + throw IndexOutOfBoundsException(::rtl::OUString(),*this); + + m_aNameMap.erase(m_aElements[index]); + m_aElements.erase(m_aElements.begin()+index); +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OCollection::findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + ObjectIter aIter = m_aNameMap.find(columnName); + if(aIter == m_aNameMap.end()) + throw ::com::sun::star::sdbc::SQLException(); + + return m_aElements.size() - (m_aElements.end() - ::std::find(m_aElements.begin(),m_aElements.end(),aIter)) +1; // because cloumns start at one +} +// ------------------------------------------------------------------------- +Reference< XEnumeration > SAL_CALL OCollection::createEnumeration( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + return new connectivity::OEnumerationByIndex( static_cast< XIndexAccess*>(this)); +} + diff --git a/connectivity/source/sdbcx/VColumn.cxx b/connectivity/source/sdbcx/VColumn.cxx new file mode 100644 index 000000000000..84b8a0dd8985 --- /dev/null +++ b/connectivity/source/sdbcx/VColumn.cxx @@ -0,0 +1,186 @@ +/************************************************************************* + * + * $RCSfile: VColumn.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ +#include "connectivity/sdbcx/VColumn.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif + +// ------------------------------------------------------------------------- +using namespace connectivity::sdbcx; +using namespace cppu; +using namespace connectivity; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +// using namespace ::com::sun::star::sdbc; + + +IMPLEMENT_SERVICE_INFO(OColumn,"com.sun.star.sdbcx.VColumn","com.sun.star.sdbcx.Column"); +// ------------------------------------------------------------------------- +OColumn::OColumn(sal_Bool _bCase) : OColumn_BASE(m_aMutex) + , ODescriptor(OColumn_BASE::rBHelper,_bCase,sal_True) + , m_Precision(0) + , m_Type(0) + , m_Scale(0) + , m_IsNullable(sal_True) + , m_IsAutoIncrement(sal_False) + , m_IsRowVersion(sal_False) + , m_IsCurrency(sal_False) +{ + construct(); +} +// ------------------------------------------------------------------------- +OColumn::OColumn( const ::rtl::OUString& _Name, + const ::rtl::OUString& _TypeName, + const ::rtl::OUString& _DefaultValue, + sal_Int32 _IsNullable, + sal_Int32 _Precision, + sal_Int32 _Scale, + sal_Int32 _Type, + sal_Bool _IsAutoIncrement, + sal_Bool _IsRowVersion, + sal_Bool _IsCurrency, + sal_Bool _bCase) + : OColumn_BASE(m_aMutex) + , ODescriptor(OColumn_BASE::rBHelper,_bCase) + , m_TypeName(_TypeName) + , m_DefaultValue(_DefaultValue) + , m_Precision(_Precision) + , m_Type(_Type) + , m_Scale(_Scale) + , m_IsNullable(_IsNullable) + , m_IsAutoIncrement(_IsAutoIncrement) + , m_IsRowVersion(_IsRowVersion) + , m_IsCurrency(_IsCurrency) +{ + m_Name = _Name; + + construct(); +} +// ------------------------------------------------------------------------- +Any SAL_CALL OColumn::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = ODescriptor::queryInterface( rType); + if(aRet.hasValue()) + return aRet; + return OColumn_BASE::queryInterface( rType); +} +// ------------------------------------------------------------------------- +Sequence< Type > SAL_CALL OColumn::getTypes( ) throw(RuntimeException) +{ + return ::utl::concatSequences(ODescriptor::getTypes(),OColumn_BASE::getTypes()); +} +// ------------------------------------------------------------------------- +void OColumn::construct() +{ + ODescriptor::construct(); + + sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY; + + registerProperty(connectivity::PROPERTY_TYPENAME, PROPERTY_ID_TYPENAME, nAttrib,&m_TypeName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(connectivity::PROPERTY_DESCRIPTION, PROPERTY_ID_DESCRIPTION, nAttrib,&m_Description, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(connectivity::PROPERTY_DEFAULTVALUE, PROPERTY_ID_DEFAULTVALUE, nAttrib,&m_DefaultValue, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(connectivity::PROPERTY_PRECISION, PROPERTY_ID_PRECISION, nAttrib,&m_Precision, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(connectivity::PROPERTY_TYPE, PROPERTY_ID_TYPE, nAttrib,&m_Type, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(connectivity::PROPERTY_SCALE, PROPERTY_ID_SCALE, nAttrib,&m_Scale, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(connectivity::PROPERTY_ISNULLABLE, PROPERTY_ID_ISNULLABLE, nAttrib,&m_IsNullable, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(connectivity::PROPERTY_ISAUTOINCREMENT, PROPERTY_ID_ISAUTOINCREMENT, nAttrib,&m_IsAutoIncrement, ::getBooleanCppuType()); + registerProperty(connectivity::PROPERTY_ISROWVERSION, PROPERTY_ID_ISROWVERSION, nAttrib,&m_IsRowVersion, ::getBooleanCppuType()); + registerProperty(connectivity::PROPERTY_ISCURRENCY, PROPERTY_ID_ISCURRENCY, nAttrib,&m_IsCurrency, ::getBooleanCppuType()); +} +// ------------------------------------------------------------------------- +void OColumn::disposing(void) +{ + OPropertySetHelper::disposing(); + + ::osl::MutexGuard aGuard(m_aMutex); + if (OColumn_BASE::rBHelper.bDisposed) + throw DisposedException(); +} +// ------------------------------------------------------------------------- +IPropertyArrayHelper* OColumn::createArrayHelper( ) const +{ + Sequence< Property > aProps; + describeProperties(aProps); + return new OPropertyArrayHelper(aProps); +} +// ------------------------------------------------------------------------- +IPropertyArrayHelper & OColumn::getInfoHelper() +{ + return *const_cast<OColumn*>(this)->getArrayHelper(); +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > SAL_CALL OColumn::createDataDescriptor( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OColumn_BASE::rBHelper.bDisposed) + throw DisposedException(); + return this; +} + diff --git a/connectivity/source/sdbcx/VGroup.cxx b/connectivity/source/sdbcx/VGroup.cxx new file mode 100644 index 000000000000..4143e1513f13 --- /dev/null +++ b/connectivity/source/sdbcx/VGroup.cxx @@ -0,0 +1,183 @@ +/************************************************************************* + * + * $RCSfile: VGroup.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_SDBCX_GROUP_HXX_ +#include "connectivity/sdbcx/VGroup.hxx" +#endif + +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_PRIVILEGE_HPP_ +#include <com/sun/star/sdbcx/Privilege.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_PRIVILEGEOBJECT_HPP_ +#include <com/sun/star/sdbcx/PrivilegeObject.hpp> +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif + + +// ------------------------------------------------------------------------- +using namespace connectivity::sdbcx; +using namespace connectivity; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::beans; + +IMPLEMENT_SERVICE_INFO(OGroup,"com.sun.star.sdbcx.VGroup","com.sun.star.sdbcx.Group"); +// ------------------------------------------------------------------------- +OGroup::OGroup(sal_Bool _bCase) : OGroup_BASE(m_aMutex) + , ODescriptor(OGroup_BASE::rBHelper,_bCase) + , m_pUsers(NULL) +{ +} +// ------------------------------------------------------------------------- +OGroup::OGroup(const ::rtl::OUString& _Name,sal_Bool _bCase) : OGroup_BASE(m_aMutex) + ,ODescriptor(OGroup_BASE::rBHelper,_bCase) + ,m_pUsers(NULL) +{ + m_Name = _Name; +} +// ------------------------------------------------------------------------- +Any SAL_CALL OGroup::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = ODescriptor::queryInterface( rType); + if(aRet.hasValue()) + return aRet; + return OGroup_BASE::queryInterface( rType); +} +// ------------------------------------------------------------------------- +Sequence< Type > SAL_CALL OGroup::getTypes( ) throw(RuntimeException) +{ + return ::utl::concatSequences(ODescriptor::getTypes(),OGroup_BASE::getTypes()); +} +// ------------------------------------------------------------------------- +void OGroup::disposing(void) +{ + OPropertySetHelper::disposing(); + + ::osl::MutexGuard aGuard(m_aMutex); + + if(m_pUsers) + m_pUsers->disposing(); +} +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper* OGroup::createArrayHelper( ) const +{ + Sequence< Property > aProps; + describeProperties(aProps); + return new ::cppu::OPropertyArrayHelper(aProps); +} +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper & OGroup::getInfoHelper() +{ + return *const_cast<OGroup*>(this)->getArrayHelper(); +} +// ------------------------------------------------------------------------- +Reference< XNameAccess > SAL_CALL OGroup::getUsers( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OGroup_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return const_cast<OGroup*>(this)->m_pUsers; +} +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OGroup::getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OGroup_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OGroup::getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OGroup_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return 0; +} +// ------------------------------------------------------------------------- +void SAL_CALL OGroup::grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OGroup_BASE::rBHelper.bDisposed) + throw DisposedException(); +} +// ------------------------------------------------------------------------- +void SAL_CALL OGroup::revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OGroup_BASE::rBHelper.bDisposed) + throw DisposedException(); +} + diff --git a/connectivity/source/sdbcx/VIndex.cxx b/connectivity/source/sdbcx/VIndex.cxx new file mode 100644 index 000000000000..982a51908e5b --- /dev/null +++ b/connectivity/source/sdbcx/VIndex.cxx @@ -0,0 +1,179 @@ +/************************************************************************* + * + * $RCSfile: VIndex.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_SDBCX_INDEX_HXX_ +#include "connectivity/sdbcx/VIndex.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ +#include "connectivity/sdbcx/VColumn.hxx" +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +// ------------------------------------------------------------------------- +using namespace connectivity; +using namespace connectivity::sdbcx; +using namespace cppu; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + +IMPLEMENT_SERVICE_INFO(OIndex,"com.sun.star.sdbcx.VIndex","com.sun.star.sdbcx.Index"); +// ------------------------------------------------------------------------- +OIndex::OIndex(sal_Bool _bCase) : OColumns_BASE(m_aMutex) + , ODescriptor(OColumns_BASE::rBHelper,_bCase,sal_True) + , m_pColumns(NULL) +{ +} +// ------------------------------------------------------------------------- +OIndex::OIndex( const ::rtl::OUString& _Name, + const ::rtl::OUString& _Catalog, + sal_Bool _isUnique, + sal_Bool _isPrimaryKeyIndex, + sal_Bool _isClustered, + sal_Bool _bCase) : OColumns_BASE(m_aMutex) + ,ODescriptor(OColumns_BASE::rBHelper,_bCase) + ,m_pColumns(NULL) + ,m_Catalog(_Catalog) + ,m_IsUnique(_isUnique) + ,m_IsPrimaryKeyIndex(_isPrimaryKeyIndex) + ,m_IsClustered(_isClustered) +{ + m_Name = _Name; +} +// ------------------------------------------------------------------------- +Any SAL_CALL OIndex::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = ODescriptor::queryInterface( rType); + if(aRet.hasValue()) + return aRet; + return OColumns_BASE::queryInterface( rType); +} +// ------------------------------------------------------------------------- +Sequence< Type > SAL_CALL OIndex::getTypes( ) throw(RuntimeException) +{ + return ::utl::concatSequences(ODescriptor::getTypes(),OColumns_BASE::getTypes()); +} +// ------------------------------------------------------------------------- +void OIndex::construct() +{ + ODescriptor::construct(); + + sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY; + + registerProperty(PROPERTY_CATALOG, PROPERTY_ID_CATALOG, nAttrib,&m_Catalog, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(PROPERTY_ISUNIQUE, PROPERTY_ID_ISUNIQUE, nAttrib,&m_IsUnique, ::getBooleanCppuType()); + registerProperty(PROPERTY_ISPRIMARYKEYINDEX,PROPERTY_ID_ISPRIMARYKEYINDEX, nAttrib,&m_IsPrimaryKeyIndex, ::getBooleanCppuType()); + registerProperty(PROPERTY_ISCLUSTERED, PROPERTY_ID_ISCLUSTERED, nAttrib,&m_IsClustered, ::getBooleanCppuType()); +} +// ------------------------------------------------------------------------- +void OIndex::disposing(void) +{ + OPropertySetHelper::disposing(); + + ::osl::MutexGuard aGuard(m_aMutex); + + if(m_pColumns) + m_pColumns->disposing(); +} +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper* OIndex::createArrayHelper( ) const +{ + Sequence< Property > aProps; + describeProperties(aProps); + return new ::cppu::OPropertyArrayHelper(aProps); +} +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper & OIndex::getInfoHelper() +{ + return *const_cast<OIndex*>(this)->getArrayHelper(); +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > SAL_CALL OIndex::createDataDescriptor( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OColumns_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return this; +} +// ------------------------------------------------------------------------- +Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OIndex::getColumns( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OColumns_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(!m_pColumns) + refreshColumns(); + + return const_cast<OIndex*>(this)->m_pColumns; +} + diff --git a/connectivity/source/sdbcx/VIndexColumn.cxx b/connectivity/source/sdbcx/VIndexColumn.cxx new file mode 100644 index 000000000000..71067e4d9b2d --- /dev/null +++ b/connectivity/source/sdbcx/VIndexColumn.cxx @@ -0,0 +1,113 @@ +/************************************************************************* + * + * $RCSfile: VIndexColumn.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_ +#include "connectivity/sdbcx/VIndexColumn.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif + +using namespace connectivity::sdbcx; +using namespace ::com::sun::star::beans; +// ------------------------------------------------------------------------- +OIndexColumn::OIndexColumn(sal_Bool _bCase) : OColumn(_bCase) + , m_IsAscending(sal_True) +{ + construct(); +} +// ------------------------------------------------------------------------- +OIndexColumn::OIndexColumn( sal_Bool _IsAscending, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _TypeName, + const ::rtl::OUString& _DefaultValue, + sal_Int32 _IsNullable, + sal_Int32 _Precision, + sal_Int32 _Scale, + sal_Int32 _Type, + sal_Bool _IsAutoIncrement, + sal_Bool _IsRowVersion, + sal_Bool _IsCurrency, + sal_Bool _bCase + ) : OColumn(_Name, + _TypeName, + _DefaultValue, + _IsNullable, + _Precision, + _Scale, + _Type, + _IsAutoIncrement, + _IsRowVersion, + _IsCurrency, + _bCase) + , m_IsAscending(_IsAscending) +{ + construct(); +} +// ------------------------------------------------------------------------- +void OIndexColumn::construct() +{ + sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY; + registerProperty(PROPERTY_ISASCENDING, PROPERTY_ID_ISASCENDING, nAttrib,&m_IsAscending, ::getBooleanCppuType()); +} + + diff --git a/connectivity/source/sdbcx/VKey.cxx b/connectivity/source/sdbcx/VKey.cxx new file mode 100644 index 000000000000..999d4a4c6c46 --- /dev/null +++ b/connectivity/source/sdbcx/VKey.cxx @@ -0,0 +1,187 @@ +/************************************************************************* + * + * $RCSfile: VKey.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef _CONNECTIVITY_SDBCX_KEY_HXX_ +#include "connectivity/sdbcx/VKey.hxx" +#endif + +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_ +#include <com/sun/star/sdbc/KeyRule.hpp> +#endif +#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ +#include "connectivity/sdbcx/VColumn.hxx" +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +// ------------------------------------------------------------------------- +using namespace connectivity; +using namespace connectivity::sdbcx; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + +IMPLEMENT_SERVICE_INFO(OKey,"com.sun.star.sdbcx.VKey","com.sun.star.sdbcx.Key"); +// ------------------------------------------------------------------------- +OKey::OKey(sal_Bool _bCase) : OColumns_BASE(m_aMutex) + , ODescriptor(OColumns_BASE::rBHelper,_bCase,sal_True) + , m_pColumns(NULL) +{ +} +// ------------------------------------------------------------------------- +OKey::OKey( const ::rtl::OUString& _Name, + const ::rtl::OUString& _ReferencedTable, + sal_Int32 _Type, + sal_Int32 _UpdateRule, + sal_Int32 _DeleteRule, + sal_Bool _bCase) : OColumns_BASE(m_aMutex) + ,ODescriptor(OColumns_BASE::rBHelper,_bCase) + ,m_pColumns(NULL) + ,m_ReferencedTable(_ReferencedTable) + ,m_Type(_Type) + ,m_UpdateRule(_UpdateRule) + ,m_DeleteRule(_DeleteRule) +{ + m_Name = _Name; +} +// ------------------------------------------------------------------------- +Any SAL_CALL OKey::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = ODescriptor::queryInterface( rType); + if(aRet.hasValue()) + return aRet; + return OColumns_BASE::queryInterface( rType); +} +// ------------------------------------------------------------------------- +Sequence< Type > SAL_CALL OKey::getTypes( ) throw(RuntimeException) +{ + return ::utl::concatSequences(ODescriptor::getTypes(),OColumns_BASE::getTypes()); +} +// ------------------------------------------------------------------------- +void OKey::construct() +{ + ODescriptor::construct(); + + sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY; + + registerProperty(PROPERTY_REFERENCEDTABLE, PROPERTY_ID_REFERENCEDTABLE, nAttrib,&m_ReferencedTable, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(PROPERTY_TYPE, PROPERTY_ID_TYPE, nAttrib,&m_Type, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(PROPERTY_UPDATERULE, PROPERTY_ID_UPDATERULE, nAttrib,&m_UpdateRule, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); + registerProperty(PROPERTY_DELETERULE, PROPERTY_ID_DELETERULE, nAttrib,&m_DeleteRule, ::getCppuType(reinterpret_cast<sal_Int32*>(NULL))); +} +// ------------------------------------------------------------------------- +void OKey::disposing(void) +{ + OPropertySetHelper::disposing(); + + ::osl::MutexGuard aGuard(m_aMutex); + + if(m_pColumns) + m_pColumns->disposing(); + + OColumns_BASE::disposing(); +} +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper* OKey::createArrayHelper( ) const +{ + Sequence< Property > aProps; + describeProperties(aProps); + return new ::cppu::OPropertyArrayHelper(aProps); +} +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper & OKey::getInfoHelper() +{ + return *const_cast<OKey*>(this)->getArrayHelper(); +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > SAL_CALL OKey::createDataDescriptor( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OColumns_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return this; +} +// ------------------------------------------------------------------------- +Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OKey::getColumns( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OColumns_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(!m_pColumns) + refreshColumns(); + + return const_cast<OKey*>(this)->m_pColumns; +} +// ------------------------------------------------------------------------- + + diff --git a/connectivity/source/sdbcx/VKeyColumn.cxx b/connectivity/source/sdbcx/VKeyColumn.cxx new file mode 100644 index 000000000000..25fab0a9c2c0 --- /dev/null +++ b/connectivity/source/sdbcx/VKeyColumn.cxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * $RCSfile: VKeyColumn.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_SDBCX_KEYCOLUMN_HXX_ +#include "connectivity/sdbcx/VKeyColumn.hxx" +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif + +using namespace connectivity::sdbcx; +using namespace ::com::sun::star::beans; + +// ------------------------------------------------------------------------- +OKeyColumn::OKeyColumn(sal_Bool _bCase) : OColumn(_bCase) +{ + construct(); +} +// ------------------------------------------------------------------------- +OKeyColumn::OKeyColumn( const ::rtl::OUString& _ReferencedColumn, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _TypeName, + const ::rtl::OUString& _DefaultValue, + sal_Int32 _IsNullable, + sal_Int32 _Precision, + sal_Int32 _Scale, + sal_Int32 _Type, + sal_Bool _IsAutoIncrement, + sal_Bool _IsRowVersion, + sal_Bool _IsCurrency, + sal_Bool _bCase + ) : OColumn(_Name, + _TypeName, + _DefaultValue, + _IsNullable, + _Precision, + _Scale, + _Type, + _IsAutoIncrement, + _IsRowVersion, + _IsCurrency, + _bCase) + , m_ReferencedColumn(_ReferencedColumn) +{ + construct(); +} +// ------------------------------------------------------------------------- +void OKeyColumn::construct() +{ + sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY; + registerProperty(PROPERTY_REFERENCEDCOLUMN, PROPERTY_ID_REFERENCEDCOLUMN, nAttrib,&m_ReferencedColumn, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); +} + diff --git a/connectivity/source/sdbcx/VTable.cxx b/connectivity/source/sdbcx/VTable.cxx new file mode 100644 index 000000000000..d833b5c756f7 --- /dev/null +++ b/connectivity/source/sdbcx/VTable.cxx @@ -0,0 +1,247 @@ +/************************************************************************* + * + * $RCSfile: VTable.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_SDBCX_TABLE_HXX_ +#include "connectivity/sdbcx/VTable.hxx" +#endif + +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ +#include "connectivity/sdbcx/VColumn.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_KEY_HXX_ +#include "connectivity/sdbcx/VKey.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_INDEX_HXX_ +#include "connectivity/sdbcx/VIndex.hxx" +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif + +// ------------------------------------------------------------------------- +using namespace connectivity; +using namespace connectivity::sdbcx; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + +IMPLEMENT_SERVICE_INFO(OTable,"com.sun.star.sdbcx.VTable","com.sun.star.sdbcx.Table"); +// ------------------------------------------------------------------------- +OTable::OTable(sal_Bool _bCase) : OTable_BASE(m_aMutex) + ,ODescriptor(OTable_BASE::rBHelper,_bCase,sal_True) + ,m_pIndexes(NULL) + ,m_pKeys(NULL) + ,m_pColumns(NULL) +{ +} +// -------------------------------------------------------------------------- +OTable::OTable( sal_Bool _bCase, + const ::rtl::OUString& _Name, const ::rtl::OUString& _Type, + const ::rtl::OUString& _Description,const ::rtl::OUString& _SchemaName, + const ::rtl::OUString& _CatalogName) : OTable_BASE(m_aMutex) + ,ODescriptor(OTable_BASE::rBHelper,_bCase) + ,m_pIndexes(NULL) + ,m_pKeys(NULL) + ,m_pColumns(NULL) + ,m_CatalogName(_CatalogName) + ,m_SchemaName(_SchemaName) + ,m_Description(_Description) + ,m_Type(_Type) +{ + m_Name = _Name; +} +// ------------------------------------------------------------------------- +Any SAL_CALL OTable::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = ODescriptor::queryInterface( rType); + if(aRet.hasValue()) + return aRet; + return OTable_BASE::queryInterface( rType); +} +// ------------------------------------------------------------------------- +Sequence< Type > SAL_CALL OTable::getTypes( ) throw(RuntimeException) +{ + return ::utl::concatSequences(ODescriptor::getTypes(),OTable_BASE::getTypes()); +} +// ------------------------------------------------------------------------- +void OTable::construct() +{ + ODescriptor::construct(); + + sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY; + + registerProperty(PROPERTY_CATALOGNAME, PROPERTY_ID_CATALOGNAME,nAttrib,&m_CatalogName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(PROPERTY_SCHEMANAME, PROPERTY_ID_SCHEMANAME, nAttrib,&m_SchemaName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(PROPERTY_DESCRIPTION, PROPERTY_ID_DESCRIPTION,nAttrib,&m_Description, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(PROPERTY_TYPE, PROPERTY_ID_TYPE, nAttrib,&m_Type, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); +} +// ------------------------------------------------------------------------- +void SAL_CALL OTable::disposing(void) +{ + ODescriptor::disposing(); + + ::osl::MutexGuard aGuard(m_aMutex); + + if(m_pIndexes) + m_pIndexes->disposing(); + if(m_pKeys) + m_pKeys->disposing(); + if(m_pColumns) + m_pColumns->disposing(); + +} +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper* OTable::createArrayHelper( ) const +{ + Sequence< Property > aProps; + describeProperties(aProps); + return new ::cppu::OPropertyArrayHelper(aProps); +} +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper & OTable::getInfoHelper() +{ + return *const_cast<OTable*>(this)->getArrayHelper(); +} +// ------------------------------------------------------------------------- +Reference< XPropertySet > SAL_CALL OTable::createDataDescriptor( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OTable_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return this; +} +// XColumnsSupplier +Reference< XNameAccess > SAL_CALL OTable::getColumns( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OTable_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(!m_pColumns) + refreshColumns(); + + return const_cast<OTable*>(this)->m_pColumns; +} +// ------------------------------------------------------------------------- +// XIndexesSupplier +Reference< XNameAccess > SAL_CALL OTable::getIndexes( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OTable_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(!m_pIndexes) + refreshIndexes(); + + return const_cast<OTable*>(this)->m_pIndexes; +} +// ------------------------------------------------------------------------- +// XKeysSupplier +Reference< XIndexAccess > SAL_CALL OTable::getKeys( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OTable_BASE::rBHelper.bDisposed) + throw DisposedException(); + + if(!m_pKeys) + refreshKeys(); + + return const_cast<OTable*>(this)->m_pKeys; +} +// ------------------------------------------------------------------------- +// XRename +void SAL_CALL OTable::rename( const ::rtl::OUString& newName ) throw(SQLException, ElementExistException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OTable_BASE::rBHelper.bDisposed) + throw DisposedException(); + +} +// ------------------------------------------------------------------------- +// XAlterTable +void SAL_CALL OTable::alterColumnByName( const ::rtl::OUString& colName, const Reference< XPropertySet >& descriptor ) throw(SQLException, NoSuchElementException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OTable_BASE::rBHelper.bDisposed) + throw DisposedException(); + +} +// ------------------------------------------------------------------------- +void SAL_CALL OTable::alterColumnByIndex( sal_Int32 index, const Reference< XPropertySet >& descriptor ) throw(SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OTable_BASE::rBHelper.bDisposed) + throw DisposedException(); + +} +// ------------------------------------------------------------------------- + + diff --git a/connectivity/source/sdbcx/VUser.cxx b/connectivity/source/sdbcx/VUser.cxx new file mode 100644 index 000000000000..5a2ba05efa9d --- /dev/null +++ b/connectivity/source/sdbcx/VUser.cxx @@ -0,0 +1,194 @@ +/************************************************************************* + * + * $RCSfile: VUser.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_SDBCX_USER_HXX_ +#include "connectivity/sdbcx/VUser.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_PRIVILEGE_HPP_ +#include <com/sun/star/sdbcx/Privilege.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_PRIVILEGEOBJECT_HPP_ +#include <com/sun/star/sdbcx/PrivilegeObject.hpp> +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_ +#include "connectivity/sdbcx/VCollection.hxx" +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif + +// ------------------------------------------------------------------------- +using namespace connectivity; +using namespace connectivity::sdbcx; +namespace starsdbc = ::com::sun::star::sdbc; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + +IMPLEMENT_SERVICE_INFO(OUser,"com.sun.star.sdbcx.VUser","com.sun.star.sdbcx.User"); +// ------------------------------------------------------------------------- +OUser::OUser(sal_Bool _bCase) : OUser_BASE(m_aMutex) + , ODescriptor(OUser_BASE::rBHelper,_bCase,sal_True) + , m_pGroups(NULL) +{ +} +// ------------------------------------------------------------------------- +OUser::OUser(const ::rtl::OUString& _Name,sal_Bool _bCase) : OUser_BASE(m_aMutex) + ,ODescriptor(OUser_BASE::rBHelper,_bCase) + ,m_pGroups(NULL) +{ + m_Name = _Name; +} +// ------------------------------------------------------------------------- +void OUser::disposing(void) +{ + OPropertySetHelper::disposing(); + ::osl::MutexGuard aGuard(m_aMutex); + if(m_pGroups) + m_pGroups->disposing(); +} +// ------------------------------------------------------------------------- +Any SAL_CALL OUser::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = ODescriptor::queryInterface( rType); + if(aRet.hasValue()) + return aRet; + return OUser_BASE::queryInterface( rType); +} +// ------------------------------------------------------------------------- +Sequence< Type > SAL_CALL OUser::getTypes( ) throw(RuntimeException) +{ + return ::utl::concatSequences(ODescriptor::getTypes(),OUser_BASE::getTypes()); +} +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper* OUser::createArrayHelper( ) const +{ + Sequence< Property > aProps; + describeProperties(aProps); + return new ::cppu::OPropertyArrayHelper(aProps); + +} +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper & OUser::getInfoHelper() +{ + return *const_cast<OUser*>(this)->getArrayHelper(); +} +// ------------------------------------------------------------------------- +// XUser +void SAL_CALL OUser::changePassword( const ::rtl::OUString& objPassword, const ::rtl::OUString& newPassword ) throw(::com::sun::star::sdbc::SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OUser_BASE::rBHelper.bDisposed) + throw DisposedException(); + + +} +// ------------------------------------------------------------------------- +// XGroupsSupplier +Reference< XNameAccess > SAL_CALL OUser::getGroups( ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OUser_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return const_cast<OUser*>(this)->m_pGroups; +} +// ------------------------------------------------------------------------- +// ------------------------------------------------------------------------- + +sal_Int32 SAL_CALL OUser::getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OUser_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return 0; +} +// ------------------------------------------------------------------------- +sal_Int32 SAL_CALL OUser::getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OUser_BASE::rBHelper.bDisposed) + throw DisposedException(); + + return 0; +} +// ------------------------------------------------------------------------- +void SAL_CALL OUser::grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OUser_BASE::rBHelper.bDisposed) + throw DisposedException(); +} +// ------------------------------------------------------------------------- +void SAL_CALL OUser::revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (OUser_BASE::rBHelper.bDisposed) + throw DisposedException(); +} + diff --git a/connectivity/source/sdbcx/VView.cxx b/connectivity/source/sdbcx/VView.cxx new file mode 100644 index 000000000000..c96fb19dd707 --- /dev/null +++ b/connectivity/source/sdbcx/VView.cxx @@ -0,0 +1,152 @@ +/************************************************************************* + * + * $RCSfile: VView.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_SDBCX_VIEW_HXX_ +#include "connectivity/sdbcx/VView.hxx" +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#include "propertyids.hxx" +#endif +#ifndef _UTL_SEQUENCE_HXX_ +#include <unotools/sequence.hxx> +#endif +// ------------------------------------------------------------------------- +using namespace connectivity; +using namespace connectivity::sdbcx; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; + +IMPLEMENT_SERVICE_INFO(OView,"com.sun.star.sdbcx.VView","com.sun.star.sdbcx.View"); +// ------------------------------------------------------------------------- +OView::OView(sal_Bool _bCase, + const ::rtl::OUString& _Name, + sal_Int32 _CheckOption, + const ::rtl::OUString& _Command, + const ::rtl::OUString& _SchemaName, + const ::rtl::OUString& _CatalogName) : ODescriptor(OViewHelper::rBHelper,_bCase) + ,m_CatalogName(_CatalogName) + ,m_SchemaName(_SchemaName) + ,m_Command(_Command) + ,m_CheckOption(_CheckOption) + +{ + m_Name = _Name; +} +// ------------------------------------------------------------------------- +OView::OView(sal_Bool _bCase): ODescriptor(OViewHelper::rBHelper,_bCase,sal_True) +{ +} +// ------------------------------------------------------------------------- +void OView::construct() +{ + ODescriptor::construct(); + + sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY; + + registerProperty(PROPERTY_CATALOGNAME, PROPERTY_ID_CATALOGNAME,nAttrib,&m_CatalogName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(PROPERTY_SCHEMANAME, PROPERTY_ID_SCHEMANAME, nAttrib,&m_SchemaName, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(PROPERTY_COMMAND, PROPERTY_ID_COMMAND, nAttrib,&m_Command, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL))); + registerProperty(PROPERTY_CHECKOPTION, PROPERTY_ID_CHECKOPTION,nAttrib,&m_CheckOption, ::getCppuType(reinterpret_cast< sal_Int32*>(NULL))); +} +// ------------------------------------------------------------------------- +void OView::disposing(void) +{ + OPropertySetHelper::disposing(); + + ::osl::MutexGuard aGuard(m_aMutex); +} +// ------------------------------------------------------------------------- +Sequence< Type > SAL_CALL OView::getTypes( ) throw(RuntimeException) +{ + Sequence< Type > aTypes(2); + aTypes.getArray()[0] = ::getCppuType(static_cast< Reference< ::com::sun::star::container::XNamed> *> (NULL)); + aTypes.getArray()[1] = ::getCppuType(static_cast< Reference< XServiceInfo> *> (NULL)); + + return ::utl::concatSequences(ODescriptor::getTypes(),aTypes); +} +// ------------------------------------------------------------------------- +Any SAL_CALL OView::queryInterface( const Type & rType ) throw(RuntimeException) +{ + Any aRet = ::cppu::queryInterface(rType,static_cast< ::com::sun::star::container::XNamed*> (this), + static_cast< XServiceInfo*> (this)); + if(aRet.hasValue()) + return aRet; + return ODescriptor::queryInterface( rType);; +} +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper* OView::createArrayHelper( ) const +{ + Sequence< Property > aProps; + describeProperties(aProps); + return new ::cppu::OPropertyArrayHelper(aProps); + +} +// ------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper & OView::getInfoHelper() +{ + return *const_cast<OView*>(this)->getArrayHelper(); +} + diff --git a/connectivity/source/sdbcx/makefile.mk b/connectivity/source/sdbcx/makefile.mk new file mode 100644 index 000000000000..ba058294ae32 --- /dev/null +++ b/connectivity/source/sdbcx/makefile.mk @@ -0,0 +1,161 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:14:29 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. +PRJINC=.. +PRJNAME=connectivity +TARGET=sdbcx + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ---------------------------------- +.IF "$(DBGUTIL_OJ)"!="" +ENVCFLAGS+=/FR$(SLO)$/ +.ENDIF + +.INCLUDE : settings.mk + +# --- Types ------------------------------------- + + +UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb +UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb + +UNOUCROUT=$(OUT)$/inc +INCPRE+=$(UNOUCROUT) + +# --- Types ------------------------------------- + +UNOTYPES+= \ + com.sun.star.util.XCancellable \ + com.sun.star.util.XNumberFormatter \ + com.sun.star.util.XRefreshable \ + com.sun.star.container.XNamed \ + com.sun.star.container.XEnumerationAccess \ + com.sun.star.uno.TypeClass \ + com.sun.star.uno.XWeak \ + com.sun.star.uno.XAggregation \ + com.sun.star.beans.XPropertyState \ + com.sun.star.beans.XPropertySet \ + com.sun.star.beans.PropertyValue \ + com.sun.star.beans.XMultiPropertySet \ + com.sun.star.beans.XFastPropertySet \ + com.sun.star.lang.XTypeProvider \ + com.sun.star.lang.EventObject \ + com.sun.star.lang.XComponent \ + com.sun.star.lang.IllegalArgumentException \ + com.sun.star.lang.DisposedException \ + com.sun.star.lang.XMultiServiceFactory \ + com.sun.star.lang.XSingleServiceFactory \ + com.sun.star.registry.XRegistryKey \ + com.sun.star.java.XJavaThreadRegister_11 \ + com.sun.star.java.XJavaVM \ + com.sun.star.sdbc.XConnection \ + com.sun.star.sdbc.XStatement \ + com.sun.star.sdbc.XResultSet \ + com.sun.star.sdbc.XResultSetMetaDataSupplier \ + com.sun.star.sdbc.XColumnLocate \ + com.sun.star.sdbc.XResultSetUpdate \ + com.sun.star.sdbc.XWarningsSupplier \ + com.sun.star.sdbc.XRowUpdate \ + com.sun.star.sdbc.XMultipleResults \ + com.sun.star.sdbc.XBatchExecution \ + com.sun.star.sdbc.XPreparedBatchExecution \ + com.sun.star.sdbc.XParameters \ + com.sun.star.sdbc.XOutParameters \ + com.sun.star.sdbc.DriverPropertyInfo \ + com.sun.star.sdbc.XDriver \ + com.sun.star.sdbc.XRow \ + com.sun.star.sdbc.SQLWarning \ + com.sun.star.sdbc.ColumnSearch \ + com.sun.star.sdbc.DataType \ + com.sun.star.sdbc.ResultSetConcurrency \ + com.sun.star.sdbc.ResultSetType \ + com.sun.star.sdbc.ColumnValue \ + com.sun.star.sdbcx.XAppend \ + com.sun.star.sdbcx.XDrop \ + com.sun.star.sdb.XColumnUpdate \ + com.sun.star.sdb.XColumn \ + + + +# --- Files ------------------------------------- + +SLOFILES=\ + $(SLO)$/VCollection.obj \ + $(SLO)$/VColumn.obj \ + $(SLO)$/VIndexColumn.obj \ + $(SLO)$/VKeyColumn.obj \ + $(SLO)$/VCatalog.obj \ + $(SLO)$/VUser.obj \ + $(SLO)$/VGroup.obj \ + $(SLO)$/VTable.obj \ + $(SLO)$/VKey.obj \ + $(SLO)$/VIndex.obj \ + $(SLO)$/VView.obj + + +# --- Targets ---------------------------------- + +.INCLUDE : target.mk + + diff --git a/connectivity/version.mk b/connectivity/version.mk new file mode 100644 index 000000000000..fc701334a7b4 --- /dev/null +++ b/connectivity/version.mk @@ -0,0 +1,175 @@ +#************************************************************************* +# +# $RCSfile: version.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:14:18 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +# ----------------------------ADO settings------------------------------------# +# target +ADO_TARGET=ado + +# the major +ADO_MAJOR=2 +# the minor +ADO_MINOR=0 +# the micro +ADO_MICRO=0 + +# this is a c++ compatible library +ADO_CPP=1 + +ADO=$(ADO_TARGET_TARGET)_$(CMPEXT) + +# ----------------------------ODBC settings-----------------------------------# +# target +ODBC_TARGET=odbc + +# the major +ODBC_MAJOR=2 +# the minor +ODBC_MINOR=0 +# the micro +ODBC_MICRO=0 + +# this is a c++ compatible library +ODBC_CPP=1 + +ODBC=$(ODBC_TARGET_TARGET)_$(CMPEXT) + +# ----------------------------JDBC settings-----------------------------------# +# target +JDBC_TARGET=jdbc + +# the major +JDBC_MAJOR=2 +# the minor +JDBC_MINOR=0 +# the micro +JDBC_MICRO=0 + +# this is a c++ compatible library +JDBC_CPP=1 + +JDBC=$(JDBC_TARGET_TARGET)_$(CMPEXT) + +# ----------------------------ADABAS settings-----------------------------------# +# target +ADABAS_TARGET=adabas + +# the major +ADABAS_MAJOR=2 +# the minor +ADABAS_MINOR=0 +# the micro +ADABAS_MICRO=0 + +# this is a c++ compatible library +ADABAS_CPP=1 + +ADABAS=$(ADABAS_TARGET_TARGET)_$(CMPEXT) + +# ----------------------------OTERRO settings-----------------------------------# +# target +OTERRO_TARGET=oterro + +# the major +OTERRO_MAJOR=2 +# the minor +OTERRO_MINOR=0 +# the micro +OTERRO_MICRO=0 + +# this is a c++ compatible library +OTERRO_CPP=1 + +OTERRO=$(OTERRO_TARGET_TARGET)_$(CMPEXT) + +# -----------------------DRIVER MANAGER settings--------------------------------# +# target +SDBC_TARGET=sdbc + +# the major +SDBC_MAJOR=2 +# the minor +SDBC_MINOR=0 +# the micro +SDBC_MICRO=0 + +# this is a c++ compatible library +SDBC_CPP=1 + +SDBC=$(SDBC_TARGET_TARGET)_$(CMPEXT) + +# ----------------------------DBASE settings-----------------------------------# +# target +DBASE_TARGET=dbase + +# the major +DBASE_MAJOR=2 +# the minor +DBASE_MINOR=0 +# the micro +DBASE_MICRO=0 + +# this is a c++ compatible library +DBASE_CPP=1 + +DBASE=$(DBASE_TARGET_TARGET)_$(CMPEXT) + + diff --git a/connectivity/workben/TT/StartTest.class b/connectivity/workben/TT/StartTest.class Binary files differnew file mode 100644 index 000000000000..28791c43eb9c --- /dev/null +++ b/connectivity/workben/TT/StartTest.class diff --git a/connectivity/workben/TT/StartTest.java b/connectivity/workben/TT/StartTest.java new file mode 100644 index 000000000000..b102ca62026a --- /dev/null +++ b/connectivity/workben/TT/StartTest.java @@ -0,0 +1,327 @@ +/************************************************************************* + * + * $RCSfile: StartTest.java,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +package workben.tt; + +import java.lang.Object; +import java.io.*; +import workben.odbc.*; + +import com.sun.star.comp.servicemanager.ServiceManager; +// import java.io.IOException; + +//import com.sun.star.beans.PropertyValue; +//import com.sun.star.beans.PropertyState; +import com.sun.star.connection.XConnector; +import com.sun.star.connection.XConnection; +import com.sun.star.bridge.XBridge; + +// import com.sun.star.comp.bootstrap.Bootstrap; + +// import com.sun.star.io.XInputStream; +// import com.sun.star.io.XOutputStream; + +// import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.lang.XServiceInfo; + +import com.sun.star.uno.IBridge; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.uno.XNamingService; + +import com.sun.star.sdbc.*; +// import com.sun.star.sdbc.XConnection; +// import com.sun.star.uno.Enum; + +// import com.sun.star.lib.uno.typeinfo.ParameterTypeInfo; +// import com.sun.star.lib.uno.typeinfo.TypeInfo; + +public class StartTest +{ + //########################################################### + //# allgemeine Variablen # + //########################################################### + private static java.util.Hashtable ConfigItems = new java.util.Hashtable(); + //########################################################### + //# ResultSetToStringBuffer # + //########################################################### + static StringBuffer ResultSetToStringBuffer(com.sun.star.sdbc.XResultSet results) + { + com.sun.star.sdbc.XRow Row; + com.sun.star.sdbc.XResultSetMetaDataSupplier rsmds; + com.sun.star.sdbc.XResultSetMetaData rsmd; + + StringBuffer buf = new StringBuffer(); + + try + { + rsmds = (com.sun.star.sdbc.XResultSetMetaDataSupplier)UnoRuntime.queryInterface(com.sun.star.sdbc.XResultSetMetaDataSupplier.class,results); + rsmd = rsmds.getMetaData(); + int numCols = rsmd.getColumnCount(); + int i; + + // get column header info + for (i=1; i <= numCols; i++) + { + if (i == 1) buf.append("\""); + if (i > 1) buf.append("\"\t\""); + buf.append(rsmd.getColumnLabel(i)); + } + buf.append("\"\r\n"); + + + + while (results.next()) + { + Row = (com.sun.star.sdbc.XRow)UnoRuntime.queryInterface(com.sun.star.sdbc.XRow.class, results); + for (i=1; i <= numCols; i++) + { + if (i == 1) buf.append("\""); + if (i > 1) buf.append("\"\t\""); + buf.append(Row.getString(i)); + } + buf.append("\"\r\n"); + } + return(buf); + } + catch (Exception e) + { + System.out.println("Exception at ResultSetToStringBuffer : " + e); + return(buf); + } + } + + //########################################################### + //# printStringBuffer # + //########################################################### + + static void printStringBuffer(StringBuffer buf) + { + FileWriter f1; + try + { + f1 = new FileWriter("d:\\data\\sdbc\\test.log",true); + int maxStrings = buf.length() - 1; + //System.out.println(maxStrings); + for(int i=0 ; i<=maxStrings ; i++) + { + f1.write(buf.charAt(i)); + } + f1.close(); + } + catch( IOException e ) + { + System.out.println("Error: can't create logfile"); + } + } + + //########################################################### + //# neededServices # + //########################################################### + static String neededServices[] = new String[] { + "com.sun.star.comp.servicemanager.ServiceManager", + "com.sun.star.comp.loader.JavaLoader", + "com.sun.star.comp.connections.Connector", + "com.sun.star.comp.connections.Acceptor" + }; + + //########################################################### + //# readConfigFile # + //########################################################### + static void readConfigFile(String sFileName) + { + BufferedReader confFile; + try + { + confFile = new BufferedReader(new FileReader(sFileName)); + ConfigItems.put("ConnectString",confFile.readLine()); + ConfigItems.put("user",confFile.readLine()); + ConfigItems.put("password",confFile.readLine()); + ConfigItems.put("ToTest",confFile.readLine()); + ConfigItems.put("LogFile",confFile.readLine()); + confFile.close(); + } + catch(Exception e) + { + System.out.println(e); + } + } + + //########################################################### + //# MAIN # + //########################################################### + + public static void main(String argv[]) throws Exception + { + + //Die Parameter auslesen + +// if(argv.length == 0) +// { +// System.out.println("missing parameter"); +// System.exit(0); +// } + + //readConfigFile(argv[0]); + + //////////////////////// + + com.sun.star.comp.servicemanager.ServiceManager smgr = new com.sun.star.comp.servicemanager.ServiceManager(); + smgr.addFactories(neededServices); + + XConnector xConnector = (XConnector)smgr.createInstance("com.sun.star.connection.Connector"); + if(xConnector == null) System.err.println("no connector!"); + + XConnection xConn = xConnector.connect("socket,host=localhost,port=6001"); + if(xConn == null) System.err.println("no XConnection!"); + + IBridge iBridge = UnoRuntime.getBridgeByName("java", null, "remote", null, new Object[]{"iiop", xConn, null}); + + Object rInitialObject = iBridge.mapInterfaceFrom("classic_uno", XInterface.class); + + if(rInitialObject != null) + { + System.err.println("got the remote object"); + System.out.println("before naming service !"); + try + { + XNamingService rName = (XNamingService)UnoRuntime.queryInterface(XNamingService.class, rInitialObject ); + try + { + if(rName != null) + { + System.err.println("got the remote naming service !"); + Object rXsmgr = rName.getRegisteredObject("StarOffice.ServiceManager"); + XMultiServiceFactory rSmgr = (XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, rXsmgr); + if(rSmgr != null) + { + System.out.println("got the remote service manager !"); + Object rDriver = rSmgr.createInstance("com.sun.star.sdbc.ADriver"); + if(rDriver != null) + { + System.out.println("got a com.sun.star.sdbc.Driver !"); + com.sun.star.sdbc.XDriver xDriver = (XDriver)UnoRuntime.queryInterface(com.sun.star.sdbc.XDriver.class,rDriver); + if(xDriver != null) + { + com.sun.star.sdbc.XConnection xConnection = null; + try + { + com.sun.star.beans.PropertyValue [] ConInfo = new com.sun.star.beans.PropertyValue[] + { + new com.sun.star.beans.PropertyValue("user",0,"qsuser",com.sun.star.beans.PropertyState.DIRECT_VALUE), + new com.sun.star.beans.PropertyValue("password",0,"qsuser",com.sun.star.beans.PropertyState.DIRECT_VALUE) + }; + xConnection = xDriver.connect("sdbc:ado:PROVIDER=SQLOLEDB;DATA SOURCE=sqllab2",ConInfo); + + if(xConnection != null) + { + System.out.println("got a connection!"); + com.sun.star.sdbc.XDatabaseMetaData dmd; + com.sun.star.sdbc.XStatement stmt; + com.sun.star.sdbc.XResultSet result; + com.sun.star.sdbc.XRow row; + try + { + stmt = xConnection.createStatement(); + stmt.executeUpdate("insert into testtab values(4,'vier')"); + result = stmt.executeQuery("select * from testtab where int = 4"); + com.sun.star.sdbc.XResultSetMetaDataSupplier rsmds; + + rsmds = (com.sun.star.sdbc.XResultSetMetaDataSupplier)UnoRuntime.queryInterface(com.sun.star.sdbc.XResultSetMetaDataSupplier.class,result); + com.sun.star.sdbc.XResultSetMetaData xMD = rsmds.getMetaData(); + System.out.println("Anzahl Spalten = " + xMD.getColumnCount()); + if(result.next()) + { + row = (com.sun.star.sdbc.XRow)UnoRuntime.queryInterface(com.sun.star.sdbc.XRow.class,result); + String xx = row.getString(1); + } + } + catch (Exception e) + { + System.out.println("Exception beim Aufruf der Tests"); + } + } + } + catch(Exception e) + { + System.out.println("exception while connecting!"); + e.printStackTrace(); + } + xConnection.close(); + } + } + } + } + } + catch(Exception t) + { + } + } + catch(Exception e1) + { + System.err.println("exception from getRegisteredObject!"); + } + } + System.out.println("FERTIG"); + System.exit(0); + } + }// die Klammer der ganzen Klasse + diff --git a/connectivity/workben/little/main.cxx b/connectivity/workben/little/main.cxx new file mode 100644 index 000000000000..6fb949fe4159 --- /dev/null +++ b/connectivity/workben/little/main.cxx @@ -0,0 +1,170 @@ +/************************************************************************* + * + * $RCSfile: main.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:14:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _CONNECTIVITY_SQLPARSE_HXX +#include <connectivity/sqlparse.hxx> +#endif + +#ifndef _CONNECTIVITY_PARSE_SQLITERATOR_HXX_ +#include "connectivity/sqliterator.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XTablesSupplier.hpp> +#endif +#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp> +#include <com/sun/star/sdbc/XResultSet.hpp> +#include <com/sun/star/sdbc/XResultSetMetaData.hpp> +#include <com/sun/star/sdbc/XRow.hpp> +#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> + +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYSTATE_HPP_ +#include <com/sun/star/beans/PropertyState.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ +#include <com/sun/star/beans/PropertyValue.hpp> +#endif +#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_ +#include <unotools/processfactory.hxx> +#endif +#ifndef _CPPUHELPER_SERVICEFACTORY_HXX_ +#include <cppuhelper/servicefactory.hxx> +#endif +#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ +#include <com/sun/star/sdbc/XConnection.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_XDRIVER_HPP_ +#include <com/sun/star/sdbc/XDriver.hpp> +#endif +#include "connectivity/sqlnode.hxx" + +using namespace connectivity; +using namespace com::sun::star::sdbc; +using namespace com::sun::star; +using namespace com::sun::star::uno; +using namespace com::sun::star::beans; +using namespace rtl; +using namespace cppu; + + +#if (defined UNX) || (defined OS2) +void main( int argc, char * argv[] ) +#else +void _cdecl main( int argc, char * argv[] ) +#endif + +{ + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> m_xConnection; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver> m_xDriver; + + try{ + Reference< ::com::sun::star::lang::XMultiServiceFactory > xFac = + createRegistryServiceFactory(OUString::createFromAscii("g:\\office50\\program\\applicat.rdb"),OUString()); + if(!xFac.is()) + return; + + m_xDriver = Reference<XDriver>(xFac->createInstance(OUString::createFromAscii("com.sun.star.sdbc.driver.dbase.Driver")),UNO_QUERY); + if(m_xDriver.is()) + { + + Sequence<PropertyValue> aValue; + // aValue.getArray()[0] = PropertyValue( OUString::createFromAscii("user"),0,makeAny(OUString::createFromAscii("TEST1")),PropertyState_DIRECT_VALUE); + // aValue.getArray()[1] = PropertyValue( OUString::createFromAscii("password"),0,makeAny(OUString::createFromAscii("TEST1")),PropertyState_DIRECT_VALUE); + // + m_xConnection = m_xDriver->connect(OUString::createFromAscii("sdbc:dbase:g:\\"),aValue); + if(m_xConnection.is()) + { + Reference<XStatement> xStmt = m_xConnection->createStatement(); + if(xStmt.is()) + { + Reference<XResultSet> xRes = xStmt->executeQuery(OUString::createFromAscii("SELECT * FROM Tele")); + if(xRes.is()) + { + ::rtl::OUString aPat = ::rtl::OUString::createFromAscii("%s\t"); + Reference<XRow> xRow(xRes,UNO_QUERY); + Reference<XResultSetMetaData> xMeta = Reference<XResultSetMetaDataSupplier>(xRes,UNO_QUERY)->getMetaData(); + for(sal_Int32 i=1;i<xMeta->getColumnCount();++i) + { + wprintf(aPat.getStr(), xMeta->getColumnName(i).getStr()); + } + printf("----------------------------------------------------------------------\n"); + while(xRes->next()) + { + for(sal_Int32 j=1;j<xMeta->getColumnCount();++j) + wprintf(aPat.getStr(), xRow->getString(j).getStr()); + printf("\n"); + } + } + } + } + + } + } + catch(...) + { + printf("Exception thrown!\n"); + + } + sal_Int32 d; + scanf("%d",&d); +} + diff --git a/connectivity/workben/little/makefile.mk b/connectivity/workben/little/makefile.mk new file mode 100644 index 000000000000..84825a725377 --- /dev/null +++ b/connectivity/workben/little/makefile.mk @@ -0,0 +1,101 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:14:29 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..\.. + +PRJNAME=connectivity +TARGET=little +TARGETTYPE=CUI +LIBTARGET=NO +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Files -------------------------------------------------------- +OBJFILES= $(OBJ)$/main.obj + +APP1TARGET= $(TARGET) +APP1OBJS= $(OBJFILES) +APPSTDLIBS=$(SALLIB) \ + $(VOSLIB) \ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(SLB)$/sql.lib + + +# ... cfgapi .............................. +APP1STDLIBS = $(APPSTDLIBS) + +APP1STDLIBS+=$(STDLIBCPP) + +.IF "$(GUI)"=="WNT" +APP1STDLIBS+=$(LIBCIMT) +.ENDIF + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx new file mode 100644 index 000000000000..346eef20f4a1 --- /dev/null +++ b/desktop/inc/app.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * $RCSfile: app.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:15:12 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _DESK_APP_HXX +#define _DESK_APP_HXX + +#ifndef _OFF_APP_HXX //autogen +#include <sfx2/app.hxx> +#endif + +/*-------------------------------------------------------------------- + Beschreibung: Applikations-Klasse + --------------------------------------------------------------------*/ +class Desktop : public SfxApplicationClass +{ +public: + Desktop(); + virtual void Main(); + virtual void SystemSettingsChanging( AllSettings& rSettings, Window* pFrame ); +}; + +#endif diff --git a/desktop/prj/d.lst b/desktop/prj/d.lst new file mode 100644 index 000000000000..2ebe2723f8fd --- /dev/null +++ b/desktop/prj/d.lst @@ -0,0 +1,10 @@ +..\%__SRC%\bin\soffice.exe %_DEST%\bin%_EXT%\soffice.exe +..\%__SRC%\bin\wrp?????.dll %_DEST%\bin%_EXT%\wrp?????.dll + +..\%__SRC%\bin\soffice %_DEST%\bin%_EXT%\soffice.bin +..\%__SRC%\bin\sweb %_DEST%\bin%_EXT%\sweb.bin +..\%__SRC%\bin\javaldx %_DEST%\bin%_EXT%\javaldx +dos: chmod 775 ..\script\soffice.sh +dos: attrib -r ..\script\soffice.sh +dos: any2all -u -f ../script/soffice.sh +..\script\soffice.sh %_DEST%\bin%_EXT%\soffice diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx new file mode 100644 index 000000000000..d910978b82fe --- /dev/null +++ b/desktop/source/app/app.cxx @@ -0,0 +1,119 @@ +/************************************************************************* + * + * $RCSfile: app.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:15:12 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include "app.hxx" +#include "wrapper.hxx" + +#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_ +#include <com/sun/star/uno/Reference.h> +#endif +#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_ +#include <com/sun/star/lang/XComponent.hpp> +#endif + +#include <offmgr/app.hxx> +#include <unotools/processfactory.hxx> + +#if SUPD>592 +#include <setup2/installer.hxx> +#endif + +#define DEFINE_CONST_UNICODE(CONSTASCII) UniString(RTL_CONSTASCII_USTRINGPARAM(CONSTASCII##)) + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; + +Desktop aDesktop; + +Desktop::Desktop() +{ +} + +void Desktop::Main() +{ + SetAppName( DEFINE_CONST_UNICODE("soffice") ); + +#if SUPD>592 + Installer* pInstaller = new Installer; + pInstaller->InitializeInstallation( Application::GetAppFileName() ); + delete pInstaller; +#endif + + RegisterServices(); + OfficeWrapper* pWrapper = new OfficeWrapper( ::utl::getProcessServiceFactory() ); +// Reference < XComponent > xWrapper( ::utl::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.office.OfficeWrapper" ) ), UNO_QUERY ); + SfxApplicationClass::Main(); +// xWrapper->dispose(); + if( pWrapper!=NULL) + { + delete pWrapper; + pWrapper=NULL; + } + Reference< XComponent > xSMGRComponent( ::utl::getProcessServiceFactory(), UNO_QUERY ); + if( xSMGRComponent.is()==sal_True ) + xSMGRComponent->dispose(); +} + +void Desktop::SystemSettingsChanging( AllSettings& rSettings, Window* pFrame ) +{ + OFF_APP()->SystemSettingsChanging( rSettings, pFrame ); +} + diff --git a/desktop/source/app/exports.dxp b/desktop/source/app/exports.dxp new file mode 100644 index 000000000000..9630d7e06768 --- /dev/null +++ b/desktop/source/app/exports.dxp @@ -0,0 +1,3 @@ +component_getImplementationEnvironment +component_writeInfo +component_getFactory diff --git a/desktop/source/app/makefile.mk b/desktop/source/app/makefile.mk new file mode 100644 index 000000000000..fcd426ef3141 --- /dev/null +++ b/desktop/source/app/makefile.mk @@ -0,0 +1,124 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:15:12 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=desktop +TARGET=wrp +LIBTARGET=NO +AUTOSEG=true + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(UPD)minor.mk +RSCUPDVER=$(RSCREVISION)(SV$(UPD)$(UPDMINOR)) + +# --- Files -------------------------------------------------------- + +OBJFILES = \ + $(OBJ)$/app.obj \ + $(OBJ)$/wrapper.obj + +#SLOFILES = \ +# $(SLO)$/wrapper.obj + +#SHL1OBJS= $(SLOFILES) +#SHL1TARGET= $(TARGET)$(UPD)$(DLLPOSTFIX) + +#SHL1IMPLIB= iwrp +#SHL1STDLIBS= \ +# $(SCHLIB) \ +# $(SMLIB) \ +# $(SIMLIB) \ +# $(SWLIB) \ +# $(SDLIB) \ +# $(SCLIB) \ +# $(SBALIB) \ +# $(OFALIB) \ +# $(SVXLIB) \ +# $(SFXLIB) \ +# $(TOOLSLIB) \ +# $(UNOTOOLSLIB) \ +# $(SVLLIB) \ +# $(SVTOOLLIB) \ +# $(SOTLIB) \ +# $(SO2LIB) \ +# $(SALLIB) \ +# $(CPPULIB) \ +# $(CPPUHELPERLIB) \ +# $(VCLLIB) +# +#SHL1DEPN= makefile.mk +#SHL1DEF= $(MISC)$/$(SHL1TARGET).def +# +#DEF1NAME= $(SHL1TARGET) +#DEF1EXPORTFILE= exports.dxp +# +# --- Targets ------------------------------------------------------ + +.IF "$(depend)" != "" +SRCFILES=$(SRC1FILES) +.ENDIF + +.INCLUDE : target.mk + diff --git a/desktop/util/makefile.mk b/desktop/util/makefile.mk new file mode 100644 index 000000000000..454a22a3fc42 --- /dev/null +++ b/desktop/util/makefile.mk @@ -0,0 +1,191 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:15:12 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=.. + +PRJNAME=desktop +TARGET=soffice +GEN_HID=TRUE + +# --- Settings ----------------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +VERINFONAME=verinfo + +#IENV=$(IENV);..\res + +# --- Resourcen ---------------------------------------------------- + +.IF "$(GUI)" == "WNT" +RCFILES=verinfo.rc +.ENDIF + +# --- Linken der Applikation --------------------------------------- + +.IF "$(OS)" == "LINUX" +# #74158# linux needs sal/vos/tools at end of link list, solaris needs it first, +# winXX is handled like solaris for now +APP1_STDPRE= +APP1_STDPOST=$(CPPULIB) $(CPPUHELPERLIB) $(UNOLIB) $(TOOLSLIB) \ + $(VOSLIB) $(SALLIB) +.ELSE +APP1_STDPRE=$(SALLIB) $(VOSLIB) $(TOOLSLIB) $(UNOLIB) $(CPPULIB) \ + $(CPPUHELPERLIB) +APP1_STDPOST= +.ENDIF + +APP1TARGET=$(TARGET) + +APP1STDLIBS= \ + $(APP1_STDPRE) \ + $(SFX2LIB) \ + $(BASICLIB) \ + $(SO2LIB) \ + $(SJLIB) \ + $(TKLIB) \ + $(SVTOOLLIB) \ + $(SETUPLIB) \ + $(SVLLIB) \ + $(SVMEMLIB) \ + $(OFALIB) \ + $(ONELIB) \ + $(VCLLIB) \ + $(SOTLIB) \ + $(APP1_STDPOST) \ + $(SCHLIB) \ + $(SMLIB) \ + $(SIMLIB) \ + $(SWLIB) \ + $(SDLIB) \ + $(SCLIB) \ + $(SBALIB) \ + $(SVXLIB) \ + $(UNOTOOLSLIB) + +.IF "$(OS)" == "SOLARIS" +# for Java applets +APP1STDLIBS+= -lXm +.ENDIF + +.IF "$(GUI)" == "UNX" +.IF "$(OS)" == "LINUX" + +APP1STDLIBS+= -lXt -lXmu -lXext -lX11 -lSM -lICE + +.ENDIF +.ENDIF + + +.IF "$(GUI)" == "MAC" +APP1STDLIBS+=$(SOLARLIBDIR)$/SALMAIN.OBJ \ + $(SOLARLIBDIR)$/NOSHAREDMAIN.LIB \ + $(SOLARLIBDIR)$/aofa.lib +MACRES += writer.r +.ENDIF + + +APP1DEPN= \ + $(APP1RES) \ + verinfo.rc + +APP1OBJS= \ + $(OBJ)$/app.obj \ + $(OBJ)$/wrapper.obj + +#APP1STACK=64000 + +APP1DEF= $(MISCX)$/$(TARGET).def + +APP1RES= $(RES)$/desktop.res + +APP1ICON=soffice.ico +APP1VERINFO=verinfo.rc +APP1LINKRES=$(MISC)$/$(TARGET).res + + + +# --- Targets ------------------------------------------------------------- + +.INCLUDE : target.mk + +# ------------------------------------------------------------------------- +# MAC +# ------------------------------------------------------------------------- + +.IF "$(GUI)" == "MAC" + +$(MISCX)$/$(APP1TARGET).def : makefile + echo "kein Def-File bei Applikationen" + +.ENDIF + +.IF "$(GUI)" == "WNT" + +$(MISCX)$/$(APP1TARGET).def : makefile + echo NAME soffice >$@ + echo DESCRIPTION 'StarDesktop Version 5' >>$@ + echo DATA READ WRITE NONSHARED >>$@ +.ENDIF + diff --git a/desktop/util/soffice.ico b/desktop/util/soffice.ico Binary files differnew file mode 100644 index 000000000000..88ccf5e5a6a0 --- /dev/null +++ b/desktop/util/soffice.ico diff --git a/desktop/util/verinfo.rc b/desktop/util/verinfo.rc new file mode 100644 index 000000000000..5f340b5fbe4d --- /dev/null +++ b/desktop/util/verinfo.rc @@ -0,0 +1,347 @@ +#************************************************************************* +# +# $RCSfile: verinfo.rc,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:15:12 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc.. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +#define VERSION 5 +#define SUBVERSION 20 +#define VERVARIANT 0 +// .0 + VER_CONCEPT +// .100 + VER_ALPHA +// .200 + VER_BETA +// .300 + VER_GAMMA +// .500 + VER_FINAL +//#define VER_CONCEPT 0 +//#define VER_BETA 6 +#define VER_FINAL 0 + +#define VER_DAY 9 +#define VER_MONTH 5 +#define VER_YEAR 2000 + +// ----------------------------------------------------------------------- + +#if !defined(ENGLISH) +#define LG_D // generate always german version +#endif + +#define VER_FIRSTYEAR 89 + +#include <windows.h> +#include "verinfo.hrc" + +#ifdef WIN32 +#define FOR_WIN_X " (32 Bit)" +#else +#define FOR_WIN_X "" +#endif + +// ----------------------------------------------------------------------- +// language/character set specification table +// ----------------------------------------------------------------------- + +RCD_LANGUAGE rcdata +{ +#ifdef LG_D + "040704B0", // Germany -> Unicode + "040704E4", // Germany -> Windows, Multilingual +#else + "040904B0", // Germany -> Unicode + "040904E4", // USA -> Windows, Multilingual +#endif + "04090000", // USA -> 7-Bit-ASCII + 0 // end of table +} + +// ----------------------------------------------------------------------- +// version information +// ----------------------------------------------------------------------- + +VS_VERSION_INFO versioninfo + fileversion VERSION, SUBVERSION, VERVARIANT, VER_COUNT + productversion VERSION, SUBVERSION, VERVARIANT, VER_COUNT + fileflagsmask 0x3F + fileflags +#if defined(DEBUG) + VS_FF_DEBUG | +#endif +#ifdef VER_PREL + VS_FF_PRERELEASE | +#endif + 0 +#ifndef WIN32 + fileos VOS_DOS_WINDOWS16 +#else + fileos VOS_NT_WINDOWS32 +#endif + filetype VFT_APP + { + block "StringFileInfo" + { +#ifdef LG_D + block "040704E4" + { + // German StringTable + value "CompanyName", "Sun Microsystems, Inc.\0" + value "ProductName", "StarOffice für Windows" FOR_WIN_X "\0" + value "FileDescription", "StarOffice " S_VERSION "\0" + value "FileVersion", PPS(VER_LEVEL) "\0" + value "ProductVersion", PPS(VER_LEVEL) "\0" + value "OriginalFilename", "SOFFICE.EXE\0" + value "InternalName", "SOFFICE\0" + value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + value "LegalTrademarks", + "International Electronic Thesaurus Copyright 1992 " + "und International CorrectSpell Copyright 1991, " + "beide von Lernout & Hauspie Speech Products N.V. " + "Alle Rechte vorbehalten. " + "International CorrectSpell ist ein Warenzeichen von " + "Lernout & Hauspie Speech Products N.V." + "Oterro ist ein Warenzeichen von R:BASE Technologies, Inc. " + "Word for Word (R) Copyright (C) 1996 Inso Corporation. " + "Alle Rechte vorbehalten.\0" + } +#else + block "040904E4" + { + // International StringTable + value "CompanyName", "Sun Microsystems, Inc.\0" + value "ProductName", "StarOffice for Windows" FOR_WIN_X "\0" + value "FileDescription", "StarOffice " S_VERSION "\0" + value "FileVersion", PPS(VER_LEVEL) "\0" + value "ProductVersion", PPS(VER_LEVEL) "\0" + value "OriginalFilename", "SOFFICE.EXE\0" + value "InternalName", "SOFFICE\0" + value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + value "LegalTrademarks", + "International Electronic Thesaurus Copyright 1992 " + "and International CorrectSpell Copyright 1991, " + "both by Lernout & Hauspie Speech Products N.V. " + "All rights reserved. " + "International CorrectSpell is a trademark of " + "Lernout & Hauspie Speech Products N.V. " + "Oterro is a trademark of R:BASE Technologies, Inc. " + "Word for Word (R) Copyright (C) 1996 Inso Corporation. " + "All rights reserved.\0" + } +#endif + } + + block "VarFileInfo" + { +#ifdef LG_D + value "Translation", 0x0407, 1252 +#else + value "Translation", 0x0409, 1252 +#endif + } + } + +// version binary entry +VS_VERSION_INFO rcdata +{ + 0xF0, "sw", 0x0F, VER_YEAR, VER_MONTH, VER_DAY, + VERSION, SUBVERSION, VERVARIANT, VER_COUNT +}; + + +2 ICON "..\\res\\Writer.ico" +//2 ICON "..\\res\\doc_sw.ico" +3 ICON "..\\res\\Calc.ico" +//3 ICON "..\\res\\doc_sc.ico" +4 ICON "..\\res\\Impress.ico" +//4 ICON "..\\res\\doc_sdd.ico" +5 ICON "..\\res\\Draw.ico" +//5 ICON "..\\res\\doc_sda.ico" +6 ICON "..\\res\\Chart.ico" +//6 ICON "..\\res\\doc_sch.ico" +7 ICON "..\\res\\Math.ico" +//7 ICON "..\\res\\doc_sm.ico" +8 ICON "..\\res\\doc_ww.ico" +9 ICON "..\\res\\Global.ico" +//9 ICON "..\\res\\doc_gl.ico" +10 ICON "..\\res\\storage.ico" +11 ICON "..\\res\\doc_ww.ico" +12 ICON "..\\res\\frameset.ico" +13 ICON "..\\res\\prg_sweb.ico" +14 ICON "..\\res\\Bild.ico" +//14 ICON "..\\res\\doc_sim.ico" +15 ICON "..\\res\\Html_doku.ico" +//15 ICON "..\\res\\doc_web.ico" +16 ICON "..\\res\\massage2.ico" +//16 ICON "..\\res\\mailnews.ico" +17 ICON "..\\res\\ftp.ico" +18 ICON "..\\res\\Schedule_task_folder.ico" +//18 ICON "..\\res\\sc_todo.ico" +19 ICON "..\\res\\schedule_appointment_folder.ico" +//19 ICON "..\\res\\sc_time.ico" +// HRO: All icons added +20 ICON "..\\res\\doc_sd.ico" +21 ICON "..\\res\\message_NONRECOV_LOC_ERROR.ico" +22 ICON "..\\res\\message_OUT_CONFIRMED.ico" +23 ICON "..\\res\\message_OUT_WRITTEN.ico" +24 ICON "..\\res\\news.ico" +25 ICON "..\\res\\news_aboniert.ico" +26 ICON "..\\res\\news_FOLDER_SOMEREADNEWS_NO_BODY.ico" +27 ICON "..\\res\\news_gelesen.ico" +28 ICON "..\\res\\news_gelesen_thread_killed.ico" +29 ICON "..\\res\\folder_app.ico" +30 ICON "..\\res\\Frameset_vor.ico" +31 ICON "..\\res\\Gallery.ico" +32 ICON "..\\res\\Gallery_cd.ico" +33 ICON "..\\res\\Gallery_neues_thema.ico" +34 ICON "..\\res\\Gallery_schreibgeschuetz.ico" +35 ICON "..\\res\\datenbank_abfragen.ico" +36 ICON "..\\res\\datenbank_abfragen_111.ico" +37 ICON "..\\res\\datenbank_abfragen_folder.ico" +38 ICON "..\\res\\datenbank_abfragen2.ico" +39 ICON "..\\res\\datenbank_berichte.ico" +40 ICON "..\\res\\datenbank_berichte2.ico" +41 ICON "..\\res\\Datenbank_Formular.ico" +42 ICON "..\\res\\Datenbank_Formular2.ico" +43 ICON "..\\res\\box_project.ico" +44 ICON "..\\res\\Calc_vor.ico" +45 ICON "..\\res\\Chart_vor.ico" +46 ICON "..\\res\\checkmark.ico" +47 ICON "..\\res\\checkmark2.ico" +48 ICON "..\\res\\datenbank.ico" +49 ICON "..\\res\\app.ico" +50 ICON "..\\res\\app_run.ico" +51 ICON "..\\res\\Arbeitsplatz.ico" +52 ICON "..\\res\\bookmark_SUBSCR_DEFAULT.ico" +53 ICON "..\\res\\bookmark_SUBSCR_ERROR.ico" +54 ICON "..\\res\\bookmark_SUBSCR_IN_PROGRESS.ico" +55 ICON "..\\res\\news_marked_killed_read.ico" +56 ICON "..\\res\\news_marked_killed_unread.ico" +57 ICON "..\\res\\news_marked_read.ico" +58 ICON "..\\res\\news_marked_unread.ico" +59 ICON "..\\res\\news_NEWS_NO_BODY.ico" +60 ICON "..\\res\\news_NEWS_NO_BODY_READ.ico" +61 ICON "..\\res\\news_service.ico" +62 ICON "..\\res\\news_SOMEREADNEWS.ico" +63 ICON "..\\res\\mails_POP3_NO_BODY_READ.ico" +64 ICON "..\\res\\mailserver.ico" +65 ICON "..\\res\\massage1.ico" +66 ICON "..\\res\\Math_vor.ico" +67 ICON "..\\res\\message_EXT_ERROR.ico" +68 ICON "..\\res\\message_nonrec_loc_err2.ico" +69 ICON "..\\res\\mail3.ico" +70 ICON "..\\res\\mails_DOC_POP3_SOMEREAD_NO_BODY.ico" +71 ICON "..\\res\\mails_high_read.ico" +72 ICON "..\\res\\mails_high_unread.ico" +73 ICON "..\\res\\mails_low_read.ico" +74 ICON "..\\res\\mails_low_unread.ico" +75 ICON "..\\res\\mails_normal_read.ico" +76 ICON "..\\res\\mails_normal_unread.ico" +77 ICON "..\\res\\startmenue_user_2.ico" +78 ICON "..\\res\\startmenue_user_3.ico" +79 ICON "..\\res\\startmenue_user_4.ico" +80 ICON "..\\res\\startmenue_user_5.ico" +81 ICON "..\\res\\startmenue_user_7.ico" +82 ICON "..\\res\\startmenue_user_8.ico" +83 ICON "..\\res\\startmenue_user_9.ico" +84 ICON "..\\res\\table_folder.ico" +85 ICON "..\\res\\datenbank_relation.ico" +86 ICON "..\\res\\datenbank_tabellen.ico" +87 ICON "..\\res\\datenbank_tabellen_folder.ico" +88 ICON "..\\res\\datenbank_tabellen_pfeil.ico" +89 ICON "..\\res\\desktop.ico" +90 ICON "..\\res\\desktop_aktive.ico" +91 ICON "..\\res\\Draw_vor.ico" +92 ICON "..\\res\\SCHEDULE_SERVERS.ico" +93 ICON "..\\res\\Schedule_task.ico" +94 ICON "..\\res\\soplayer_impress_doc.ico" +95 ICON "..\\res\\startmenue_user_1.ico" +96 ICON "..\\res\\startmenue_user_10.ico" +97 ICON "..\\res\\startmenue_user_11.ico" +98 ICON "..\\res\\startmenue_user_12.ico" +99 ICON "..\\res\\news_ungelesen.ico" +100 ICON "..\\res\\news_ungelesen_thread_killed.ico" +101 ICON "..\\res\\newsgroup.ico" +102 ICON "..\\res\\player2.ico" +103 ICON "..\\res\\schedule.ico" +104 ICON "..\\res\\Schedule_appointment.ico" +105 ICON "..\\res\\schedule_server.ico" +106 ICON "..\\res\\Writer_vor.ico" +107 ICON "..\\res\\trash.ico" +108 ICON "..\\res\\trash_full.ico" +109 ICON "..\\res\\url.ico" +110 ICON "..\\res\\VIM.ico" +111 ICON "..\\res\\VIM_BBOARD.ico" +112 ICON "..\\res\\VIM_INBOX.ico" +113 ICON "..\\res\\Vorlage.ico" +114 ICON "..\\res\\welten.ico" +115 ICON "..\\res\\prg_sw10.ico" +116 ICON "..\\res\\leeres_dokument.ico" +117 ICON "..\\res\\macrolib.ico" +118 ICON "..\\res\\mail_inbox.ico" +119 ICON "..\\res\\mail_out_high.ico" +120 ICON "..\\res\\mail_out_low.ico" +121 ICON "..\\res\\mail_out_normal.ico" +122 ICON "..\\res\\mail_outbox_full.ico" +123 ICON "..\\res\\MAIL_SENTBOX.ico" +124 ICON "..\\res\\help.ico" +125 ICON "..\\res\\Html_doku_vor.ico" +126 ICON "..\\res\\imap.ico" +127 ICON "..\\res\\impress_compressed.ico" +128 ICON "..\\res\\Impress_vor.ico" + + + diff --git a/desktop/util/writer.r b/desktop/util/writer.r new file mode 100644 index 000000000000..2a0ec2722900 --- /dev/null +++ b/desktop/util/writer.r @@ -0,0 +1 @@ +//*************************************************************************
//*
//* $Workfile: writer.r $
//*
//* Ersterstellung KH
//*
//* Letzte Aenderung $Author: hr $ $Date: 2000-09-18 16:15:12 $
//* $Revision: 1.1.1.1 $
//*
//* $Logfile: T:/desktop/util/writer.r_v $
//*
//* Copyright (c) 1990 - 1995, STAR DIVISION
//*
//*************************************************************************
#include "Types.r"
//#ifndef MAINSHLBNAME
// #define MAINSHLBNAME "Sw356MP Library"
//#endif
//
//resource 'STR#' (2001, "MainShlbName", purgeable) {
// { /* array StringArray: 2 elements */
// /* [1] */
// MAINSHLBNAME,
// /* [2] */
// "Test"
// }
//};
resource 'SIZE' (-1) {
reserved,
acceptSuspendResumeEvents,
reserved,
canBackground,
multiFinderAware,
backgroundAndForeground,
dontGetFrontClicks,
ignoreChildDiedEvents,
is32BitCompatible,
isHighLevelEventAware,
onlyLocalHLEvents,
isStationeryAware,
dontUseTextEditServices,
true,
reserved,
reserved,
7096000,
3584000
};
resource 'SIZE' (0) {
reserved,
acceptSuspendResumeEvents,
reserved,
canBackground,
multiFinderAware,
backgroundAndForeground,
dontGetFrontClicks,
ignoreChildDiedEvents,
is32BitCompatible,
isHighLevelEventAware,
onlyLocalHLEvents,
isStationeryAware,
dontUseTextEditServices,
true,
reserved,
reserved,
7096000,
3584000
};
resource 'ics8' (128) {
$"EFF0 EF00 0000 0000 F900 0000 0000 0000"
$"F0EF F000 0000 00F9 D257 0000 0000 0000"
$"EFF0 EF00 0000 7A00 00D2 F900 0000 0000"
$"EFF0 F000 00FA 00F9 FA00 D256 0000 0000"
$"F0EF F000 7B00 FA00 F9FF 00D2 F900 0000"
$"EFEF EFFA 00F9 0000 00F9 FF00 D2F9 0000"
$"F0F0 F900 FA00 0000 0000 FAF9 00D2 F900"
$"EFF9 00FA 00FA F9FA F9FA F9FA FF00 D2F9"
$"F0EF FAF9 FAE5 E6E6 05E5 D2D2 F9FA F900"
$"EFF0 F900 00E6 E505 0505 E6E5 D2F9 0000"
$"F0F9 0000 F7E5 E6E5 05E6 E5E6 E5D2 FF00"
$"EF00 0000 E5E6 E5D2 D2E5 E6E5 E6D2 FF00"
$"F900 FAE6 E5E6 D2E5 D2E5 E5E6 D2D2 F9FA"
$"00FA 00E6 2BD2 E5E6 E5D2 E6E5 D2D2 C9F9"
$"F9C9 2B2B F7D2 E6E5 E6D2 E5E6 F9D2 C2FA"
$"FA00 C3D2 D2D2 E5E6 C2E5 C9F9 D2C3 FAF9"
};
resource 'ics8' (129) {
$"00FF FFFF FFFF FFFF FFFF FF00 0000 0000"
$"00FF F5F5 F5F5 F5F5 F5F5 FFFF 0000 0000"
$"00FF F5EC ECEC F5F5 F5F5 FFF8 FF00 0000"
$"00FF F5EC ECEC FFFF 00FF FFFF FFFF 0000"
$"00FF F5EC ECEC 0000 0000 00F5 F5FF 0000"
$"00FF F5EC ECF5 FFFF FF00 FFF5 F5FF 0000"
$"00FF F5EC F5F5 0000 0000 00F5 F5FF 0000"
$"00FF F5EC F5F5 FF00 FFFF FFF5 F5FF 0000"
$"00FF F5EC F5F5 0000 0000 00F5 F5FF 0000"
$"00FF F5EC ECF5 FFFF FF00 FFF5 F5FF 0000"
$"00FF F5EC ECEC 0000 0000 00F5 F5FF 0000"
$"00FF F5EC ECEC FF00 FFFF FFF5 F5FF 0000"
$"00FF F5EC ECEC 0000 0000 00F5 F5FF 0000"
$"00FF F5EC ECEC FFFF FF00 FFF5 F5FF 0000"
$"00FF F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000"
$"00FF FFFF FFFF FFFF FFFF FFFF FFFF"
};
resource 'ics8' (130) {
$"00FF FFFF FFFF FFFF FFFF FFFF 0000 0000"
$"00FF F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"00FF F5EC ECEC FFF5 FFFF F5FF FFFF 0000"
$"00FF F5EC ECEC F5F5 F5F5 F5FF F5FF 0000"
$"00FF F5EC ECEC FFFF F5FF F5FF F5FF 0000"
$"00FF F5EC ECF5 F5F5 F5F5 F5FF F5FF 0000"
$"00FF F5EC F5F5 FFF5 FFFF F5FF F5FF 0000"
$"00FF F5EC F5F5 F5F5 F5F5 F5FF F5FF 0000"
$"00FF F5EC ECF5 FFFF F5FF F5FF F5FF 0000"
$"00FF F5EC ECEC F5F5 F5F5 F5FF F5FF 0000"
$"00FF F5EC ECEC FFF5 FFFF FFFF F5FF 0000"
$"00FF F5EC ECEC F5F5 FF2B FFF5 F5FF 0000"
$"00FF F5F5 F5F5 F5F5 FFFF F5F5 F5FF 0000"
$"00FF FFFF FFFF FFFF FFF5 F5FF F5FF 0000"
$"0000 00FF F5F5 F5F5 F5F5 F5F5 F5FF 0000"
$"0000 00FF FFFF FFFF FFFF FFFF FFFF"
};
resource 'ics8' (131) {
$"00FF FFFF FFFF FFFF FFFF FF00 0000 0000"
$"00FF F5F5 F5F5 F5F5 F5F5 FFFF 0000 0000"
$"00FF F5EC ECEC F5F5 F5F5 FF2B FF00 0000"
$"00FF F5EC ECEC F5F5 F5F5 FFFF FFFF 0000"
$"00FF F5EC ECEC F5F5 F5F5 F5F5 F5FF 0000"
$"00FF F5EC ECF5 F5F5 F5F5 F5F5 F5FF 0000"
$"00FF F5EC FFF5 FFFF F5FF FFF5 F5FF 0000"
$"00FF F5EC F5F5 F5F5 F5F5 F5F5 F5FF 0000"
$"00FF F5EC FFFF FFFF F5FF FFF5 F5FF 0000"
$"00FF F5EC ECF5 F5F5 F5F5 F5F5 F5FF 0000"
$"00FF F5EC FFFF F5FF FFF5 FFF5 F5FF 0000"
$"00FF F5EC ECEC F5F5 F5F5 F5F5 F5FF 0000"
$"00FF F5EC ECEC F5F5 F5F5 F5F5 F5FF 0000"
$"00FF F5EC ECEC F5F5 F5F5 F5F5 F5FF 0000"
$"00FF F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000"
$"00FF FFFF FFFF FFFF FFFF FFFF FFFF"
};
resource 'ics8' (132) {
$"0000 FFFF FFFF FFFF FFFF FFFF 0000 0000"
$"0000 FF00 0000 0000 0000 FF00 FF00 0000"
$"0000 FF00 ECEC ECC0 4848 FF00 00FF 0000"
$"0000 FF00 ECEC ECC0 0000 FFFF FFFF 0000"
$"0000 FF00 ECEC ECFF 0000 0000 00FF 0000"
$"0000 FF00 ECEC C000 FFFF 00FF FFFF 0000"
$"0000 FF00 EC00 48FF 0000 FF00 00FF 0000"
$"0000 FF00 EC00 C000 FFFF 00FF FFFF 0000"
$"0000 FF00 EC00 48FF 0000 FF00 00FF 0000"
$"0000 FF00 ECEC 48FF 0000 FF00 00FF 0000"
$"0000 FF00 ECEC B000 FFFF 00FF FFFF 0000"
$"0000 FF00 ECEC ECFF 0000 FF00 00FF 0000"
$"0000 FF00 ECEC ECFF 0000 FF00 00FF 0000"
$"0000 FF00 ECEC EC00 FFFF 00FF FFFF 0000"
$"0000 FF00 0000 0000 0000 0000 00FF 0000"
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF"
};
resource 'ics8' (133) {
$"00FF FFFF FFFF FFFF FFFF FFFF 0000 0000"
$"00FF F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"00FF F5EC ECEC C048 48C0 48FF FFFF 0000"
$"00FF F5EC ECEC 00FF FF00 FFFF 00FF 0000"
$"00FF F5EC ECEC FFF5 F5FF 00FF 00FF 0000"
$"00FF F5EC EC48 FFF5 F5FF 00FF FFFF 0000"
$"00FF F5EC F5C0 00FF FF00 FFFF 00FF 0000"
$"00FF F5EC F548 FFF5 F5FF F5FF 00FF 0000"
$"00FF F5EC EC48 FFF5 F5FF F5FF FFFF 0000"
$"00FF F5EC ECEC 00FF FF00 FFFF 00FF 0000"
$"00FF F5EC ECEC FFF5 FFFF FFFF 00FF 0000"
$"00FF F5EC ECEC FFF5 FF2B FF00 FFFF 0000"
$"00FF F5F5 F5F5 F5F5 FFFF 0000 00FF 0000"
$"00FF FFFF FFFF FFFF FF00 FF00 00FF 0000"
$"0000 00FF 0000 0000 0000 0000 00FF 0000"
$"0000 00FF FFFF FFFF FFFF FFFF FFFF"
};
resource 'ics8' (134) {
$"00FF FFFF FFFF FFFF FFFF FF00 0000 0000"
$"00FF F5F5 F5F5 F5F5 F5F5 FFFF 0000 0000"
$"00FF F5EC ECEC FAFA FAFA FF00 FF00 0000"
$"00FF F5EC ECEC FAFC FCFC FFFF FFFF 0000"
$"00FF F5EC ECEC FAFC 05EC F5F5 F5FF 0000"
$"00FF F5EC ECF5 FAFC D8E3 F5F5 FFFF 0000"
$"00FF F5EC F5F5 FAFC F5F5 F5FF F5FF 0000"
$"00FF F5EC F5F5 FAFC F5FF FFF5 F5FF 0000"
$"00FF F5EC F5F5 FAFF FFF5 F5F5 F5FF 0000"
$"00FF F5EC ECF5 FFF5 F5F5 2BF5 F5FF 0000"
$"00FF F5EC ECEC F5FA FA2B 2B2B F5FF 0000"
$"00FF F5EC ECEC F5FA FAF5 2BF5 F5FF 0000"
$"00FF F5EC ECEC F5F5 F5F8 F5F5 F5FF 0000"
$"00FF F5EC ECEC F5F5 F8F8 F8F5 F5FF 0000"
$"00FF F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000"
$"00FF FFFF FFFF FFFF FFFF FFFF FFFF"
};
resource 'ics8' (135) {
$"00FF FFFF FFFF FFFF FFFF FFFF FF00 0000"
$"00FF F5F5 F5F5 F5F5 F5F5 F5F5 FF00 0000"
$"00FF F5EC ECEC FAFA FAFA FAFA FFFF FF00"
$"00FF F5EC ECEC FAFC FCFC FCFC FFF5 FF00"
$"00FF F5EC ECF5 FAFC 05EC F5F5 FFF5 FF00"
$"00FF F5EC F5F5 FAFC D8E3 F5F5 FFF5 FF00"
$"00FF F5EC F5F5 FAFC 0000 FFFF FFF5 FF00"
$"00FF F5EC F5F5 FAFC FFFF F5F5 FFF5 FF00"
$"00FF F5EC ECF5 FFFF F5F5 F5F5 FFF5 FF00"
$"00FF F5EC ECEC F5F5 F5F5 F5F5 FFF5 FF00"
$"00FF F5EC ECEC FAFA F5FF FFFF FFF5 FF00"
$"00FF F5EC ECEC FAFA F5FF 2BFF F5F5 FF00"
$"00FF F5F5 F5F5 F5F5 F5FF FFF5 F5F5 FF00"
$"00FF FFFF FFFF FFFF FFFF F5F5 F5F5 FF00"
$"0000 00FF F5F5 F5F5 F5F5 F5F5 F5F5 FF00"
$"0000 00FF FFFF FFFF FFFF FFFF FFFF FF"
};
resource 'ics8' (136) {
$"00FF FFFF FFFF FFFF FFFF FF00 0000 0000"
$"00FF F5F5 F5F5 F5F5 F5F5 FFFF 0000 0000"
$"00FF F5EC ECEC FCF5 F5F5 FFF5 FF00 0000"
$"00FF F5EC ECEC FAF5 F5F5 FFFF FFFF 0000"
$"00FF F5EC ECEC FCF5 05EC ECF5 F5FF 0000"
$"00FF F5EC ECF5 FA05 05EC ECEC F5FF 0000"
$"00FF F5EC F5F5 FC05 0505 ECEC F5FF 0000"
$"00FF F5EC F5F5 FA05 05D8 13D8 F5FF 0000"
$"00FF F5EC F5F5 FCF5 D813 D8F5 F5FF 0000"
$"00FF F5EC ECF5 FAF5 F5F5 F5F5 C0FF 0000"
$"00FF F5EC ECEC FCF5 F5C0 F5C0 F5FF 0000"
$"00FF F5EC ECEC FAF5 C0F5 C0F5 F5FF 0000"
$"00FF F5EC ECEC FCF5 F5F5 F5F5 F5FF 0000"
$"00FF F5EC ECEC FAFC FAFC FAFC F5FF 0000"
$"00FF F5F5 F5F5 0000 0000 00F5 F5FF 0000"
$"00FF FFFF FFFF FFFF FFFF FFFF FFFF"
};
resource 'ics8' (137) {
$"00FF FFFF FFFF FFFF FFFF FFFF FF00 0000"
$"00FF F5F5 F5F5 F5F5 F5F5 F5F5 FF00 0000"
$"00FF F5EC ECEC F505 ECEC F5F5 FFFF FF00"
$"00FF F5EC ECC0 0505 ECEC ECF5 FFF5 FF00"
$"00FF F5EC ECFB 0505 05EC ECF5 FFF5 FF00"
$"00FF F5EC F5F9 0505 D813 D8F5 FFF5 FF00"
$"00FF F5EC F5FB F5D8 13D8 F5F5 FFF5 FF00"
$"00FF F5EC F5F9 F5F5 F5F5 F5C0 FFF5 FF00"
$"00FF F5EC ECFB F5F5 C0F5 C000 FFF5 FF00"
$"00FF F5EC ECC0 F5C0 F5C0 0000 FFF5 FF00"
$"00FF F5EC ECEC F5F5 F5FF FFFF FFF5 FF00"
$"00FF F5EC ECC0 FBF9 FBFF 2BFF F5F5 FF00"
$"00FF F5F5 F5F5 F5F5 F5FF FFF5 F5F5 FF00"
$"00FF FFFF FFFF FFFF FFFF F5F5 F5F5 FF00"
$"0000 00FF F5F5 F5F5 F5F5 F5F5 F5F5 FF00"
$"0000 00FF FFFF FFFF FFFF FFFF FFFF FF"
};
resource 'ics8' (138) {
$"0000 FFFF FFFF FFFF FFFF FF00 0000 0000"
$"0000 FFF5 F5F5 F5F5 F5F5 FFFF 0000 0000"
$"0000 FFF5 ECEC ECFD D8F5 FF2B FF00 0000"
$"0000 FFF5 ECEC ECFD D8D8 FFFF FFFF 0000"
$"0000 FFF5 ECEC ECFD 0505 05FD F5FF 0000"
$"0000 FFF5 ECEC F5FD 05E3 00FD F5FF 0000"
$"0000 FFF5 ECF5 F5FD FDFD FDFD F5FF 0000"
$"0000 FFF5 ECF5 F5FD E3E3 E3FD F5FF 0000"
$"0000 FFF5 ECF5 F5FD E3E3 E3FD F5FF 0000"
$"0000 FFF5 ECEC F5FD FDFD FDFD F5FF 0000"
$"0000 FFF5 ECEC ECFD 2B2B 2BFD F5FF 0000"
$"0000 FFF5 ECEC ECFD 2B00 00FD F5FF 0000"
$"0000 FFF5 ECEC ECFD FDFD FDFD F5FF 0000"
$"0000 FFF5 ECEC ECFD 05E3 E3FD F5FF 0000"
$"0000 FFF5 F5F5 F5F5 F5F5 F5F5 F5FF 0000"
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF"
};
resource 'ics8' (139) {
$"00FF FFFF FFFF FFFF FFFF FFFF FF00 0000"
$"00FF F5F5 F5F5 F5F5 F5F5 F5F5 FF00 0000"
$"00FF F5EC ECEC F5FD ECEC FDF5 FFFF FF00"
$"00FF F5EC ECEC F5FD FDFD FDF5 FFF5 FF00"
$"00FF F5EC ECEC F5FD E3D8 FDF5 FFF5 FF00"
$"00FF F5EC EC00 F5FD D8E3 FDF5 FFF5 FF00"
$"00FF F5EC 0000 F5FD FDFD FDF5 FFF5 FF00"
$"00FF F5EC 0000 F5FD E3E3 FDF5 FFF5 FF00"
$"00FF F5EC EC00 F5FD E3E3 FDF5 FFF5 FF00"
$"00FF F5EC ECEC F5FD FDFD FDF5 FFF5 FF00"
$"00FF F5EC ECEC F5FD 05FF FFFF FFF5 FF00"
$"00FF F5EC ECEC F5FD 05FF 2BFF F5F5 FF00"
$"00FF F5F5 F5F5 F5F5 F5FF FFF5 FDF5 FF00"
$"00FF FFFF FFFF FFFF FFFF F505 FDF5 FF00"
$"0000 00FF F5F5 F5F5 F5F5 F5F5 F5F5 FF00"
$"0000 00FF FFFF FFFF FFFF FFFF FFFF FF"
};
resource 'ics8' (140) {
$"00FF FFFF FFFF FFFF FFFF FF00 0000 0000"
$"00FF F5F5 F5F5 F5F5 F5F5 FFFF 0000 0000"
$"00FF F5EC ECEC F5F5 F5F5 FF2B FF00 0000"
$"00FF F5EC ECEC F5F5 F5F5 FFFF FFFF 0000"
$"00FF F5EC ECB0 FFFF FFFF FFF5 F5FF 0000"
$"00FF F5EC ECFF FFF5 F5F5 FFF5 F5FF 0000"
$"00FF F5EC F500 FFFF F5F5 F5F5 F5FF 0000"
$"00FF F5EC F505 F7FF FFF5 F5F5 F5FF 0000"
$"00FF F5EC F5F7 0500 FFFF F5F5 F5FF 0000"
$"00FF F5EC EC00 0000 FFFF F5F5 F5FF 0000"
$"00FF F5EC ECEC 00FF FFF5 F5F5 F5FF 0000"
$"00FF F5EC ECEC FFFF F5F5 F5F5 F5FF 0000"
$"00FF F5EC ECB0 FFF5 F5F5 FFF5 F5FF 0000"
$"00FF F5EC ECB0 FFFF FFFF FFF5 F5FF 0000"
$"00FF F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000"
$"00FF FFFF FFFF FFFF FFFF FFFF FFFF"
};
resource 'ics8' (141) {
$"00FF FFFF FFFF FFFF FFFF FFFF FF00 0000"
$"00FF F5F5 F5F5 F5F5 F5F5 F5F5 FF00 0000"
$"00FF F5EC ECEC FFFF FFFF FFF5 FFFF FF00"
$"00FF F5EC ECEC FFF5 F5F5 FFF5 FFF5 FF00"
$"00FF F5EC ECF5 FFFF F5F5 F5F5 FFF5 FF00"
$"00FF F5EC F5F5 F5FF FFF5 F5F5 FFF5 FF00"
$"00FF F5EC F505 2BF5 FFFF F5F5 FFF5 FF00"
$"00FF F5EC F52B 05F5 FFFF F5F5 FFF5 FF00"
$"00FF F5EC ECF5 F5FF FFF5 F5F5 FFF5 FF00"
$"00FF F5EC ECEC FFFF F5F5 F5F5 FFF5 FF00"
$"00FF F5EC ECEC FFF5 F5FF FFFF FFF5 FF00"
$"00FF F5EC ECEC FFFF FFFF 2BFF F5F5 FF00"
$"00FF F5F5 F5F5 F5F5 F5FF FFF5 F5F5 FF00"
$"00FF FFFF FFFF FFFF FFFF F5F5 F5F5 FF00"
$"0000 00FF F5F5 F5F5 F5F5 F5F5 F5F5 FF00"
$"0000 00FF FFFF FFFF FFFF FFFF FFFF FF"
};
resource 'ics8' (142) {
$"EFF0 EF00 0000 0000 F900 0000 0000 0000"
$"F0EF F000 0000 00F9 D257 0000 0000 0000"
$"EFF0 EF00 0000 7A00 00D2 F900 0000 0000"
$"EFF0 F000 00FA 00F9 FA00 D256 0000 0000"
$"F0EF F000 7B00 FA00 F9FF 00D2 F900 0000"
$"EFEF EFFA 00F9 0000 00F9 FF00 D2F9 0000"
$"F0F0 F900 FA00 0000 0000 FAF9 00D2 F900"
$"EFF9 00FA 00FA F9FA F9FA F9FA FF00 D2F9"
$"F0EF FAF9 FAE5 E6E6 05E5 D2D2 F9FA F900"
$"EFF0 F900 00E6 E505 0505 E6E5 D2F9 0000"
$"F0F9 0000 F7E5 E6E5 05E6 E5E6 E5D2 FF00"
$"EF00 0000 E5E6 E5D2 D2E5 E6E5 E6D2 FF00"
$"F900 FAE6 E5E6 D2E5 D2E5 E5E6 D2D2 F9FA"
$"00FA 00E6 2BD2 E5E6 E5D2 E6E5 D2D2 C9F9"
$"F9C9 2B2B F7D2 E6E5 E6D2 E5E6 F9D2 C2FA"
$"FA00 C3D2 D2D2 E5E6 C2E5 C9F9 D2C3 FAF9"
};
resource 'ics4' (128) {
$"6660 0000 D000 0000 6660 000D 6D00 0000"
$"6660 00D0 06D0 0000 6660 0D0D D06D 0000"
$"6660 D0D0 DF06 D000 666D 0D00 0DF0 6D00"
$"66D0 D000 00DD 06D0 6D0D 0DDD DDDD F06D"
$"66DD D999 1966 DDD0 66D0 0991 1199 6D00"
$"6D00 C999 1999 96F0 6000 9996 6999 96F0"
$"D0D9 9969 6999 66DD 0D09 C699 9699 669D"
$"D9CC C699 9699 D67D D086 6699 799D 68DD"
};
resource 'ics4' (129) {
$"0FFF FFFF FFF0 0000 0F00 0000 00FF 0000"
$"0F06 6600 00FC F000 0F06 66FF 0FFF FF00"
$"0F06 6600 0000 0F00 0F06 60FF F0F0 0F00"
$"0F06 0000 0000 0F00 0F06 00F0 FFF0 0F00"
$"0F06 0000 0000 0F00 0F06 60FF F0F0 0F00"
$"0F06 6600 0000 0F00 0F06 66F0 FFF0 0F00"
$"0F06 6600 0000 0F00 0F06 66FF F0F0 0F00"
$"0F00 0000 0000 0F00 0FFF FFFF FFFF FF"
};
resource 'ics4' (130) {
$"0FFF FFFF FFFF 0000 0F00 0000 000F 0000"
$"0F06 66F0 FF0F FF00 0F06 6600 000F 0F00"
$"0F06 66FF 0F0F 0F00 0F06 6000 000F 0F00"
$"0F06 00F0 FF0F 0F00 0F06 0000 000F 0F00"
$"0F06 60FF 0F0F 0F00 0F06 6600 000F 0F00"
$"0F06 66F0 FFFF 0F00 0F06 6600 FCF0 0F00"
$"0F00 0000 FF00 0F00 0FFF FFFF F00F 0F00"
$"000F 0000 0000 0F00 000F FFFF FFFF FF"
};
resource 'ics4' (131) {
$"0FFF FFFF FFF0 0000 0F00 0000 00FF 0000"
$"0F06 6600 00FC F000 0F06 6600 00FF FF00"
$"0F06 6600 0000 0F00 0F06 6000 0000 0F00"
$"0F06 F0FF 0FF0 0F00 0F06 0000 0000 0F00"
$"0F06 FFFF 0FF0 0F00 0F06 6000 0000 0F00"
$"0F06 FF0F F0F0 0F00 0F06 6600 0000 0F00"
$"0F06 6600 0000 0F00 0F06 6600 0000 0F00"
$"0F00 0000 0000 0F00 0FFF FFFF FFFF FF"
};
resource 'ics4' (132) {
$"00FF FFFF FFFF 0000 00F0 0000 00F0 F000"
$"00F0 6667 CCF0 0F00 00F0 6667 00FF FF00"
$"00F0 666F 0000 0F00 00F0 6670 FF0F FF00"
$"00F0 60CF 00F0 0F00 00F0 6070 FF0F FF00"
$"00F0 60CF 00F0 0F00 00F0 66CF 00F0 0F00"
$"00F0 6650 FF0F FF00 00F0 666F 00F0 0F00"
$"00F0 666F 00F0 0F00 00F0 6660 FF0F FF00"
$"00F0 0000 0000 0F00 00FF FFFF FFFF FF"
};
resource 'ics4' (133) {
$"0FFF FFFF FFFF 0000 0F00 0000 000F 0000"
$"0F06 6670 070F FF00 0F06 660F F0FF 0F00"
$"0F06 66F0 0F0F 0F00 0F06 60F0 0F0F FF00"
$"0F06 070F F0FF 0F00 0F06 00F0 0F0F 0F00"
$"0F06 60F0 0F0F FF00 0F06 660F F0FF 0F00"
$"0F06 66F0 FFFF 0F00 0F06 66F0 FCF0 FF00"
$"0F00 0000 FF00 0F00 0FFF FFFF F0F0 0F00"
$"000F 0000 0000 0F00 000F FFFF FFFF FF"
};
resource 'ics4' (134) {
$"0FFF FFFF FFF0 0000 0F00 0000 00FF 0000"
$"0F06 66DD DDF0 F000 0F06 66DE EEFF FF00"
$"0F06 66DE 1600 0F00 0F06 60DE 3800 FF00"
$"0F06 00DE 000F 0F00 0F06 00DE 0FF0 0F00"
$"0F06 00DF F000 0F00 0F06 60F0 00C0 0F00"
$"0F06 660D DCCC 0F00 0F06 660D D0C0 0F00"
$"0F06 6600 0C00 0F00 0F06 6600 CCC0 0F00"
$"0F00 0000 0000 0F00 0FFF FFFF FFFF FF"
};
resource 'ics4' (135) {
$"0FFF FFFF FFFF F000 0F00 0000 0000 F000"
$"0F06 66DD DDDD FFF0 0F06 66DE EEEE F0F0"
$"0F06 60DE 1600 F0F0 0F06 00DE 3800 F0F0"
$"0F06 00DE 00FF F0F0 0F06 00DE FF00 F0F0"
$"0F06 60FF 0000 F0F0 0F06 6600 0000 F0F0"
$"0F06 66FF 0FFF F0F0 0F06 66FF 0F0F 00F0"
$"0F00 0000 0FF0 00F0 0FFF FFFF FF00 00F0"
$"000F 0000 0000 00F0 000F FFFF FFFF FFF0"
};
resource 'ics4' (136) {
$"0FFF FFFF FFF0 0000 0F00 0000 00FF 0000"
$"0F06 66E0 00F0 F000 0F06 66D0 00FF FF00"
$"0F06 66E0 1660 0F00 0F06 60D1 1666 0F00"
$"0F06 00E1 1166 0F00 0F06 00D1 1343 0F00"
$"0F06 00E0 3430 0F00 0F06 60D0 0000 7F00"
$"0F06 66E0 0707 0F00 0F06 66D0 7070 0F00"
$"0F06 66E0 0000 0F00 0F06 66DE DEDE 0F00"
$"0F00 0000 0000 0F00 0FFF FFFF FFFF FF"
};
resource 'ics4' (137) {
$"0FFF FFFF FFFF F000 0F00 0000 0000 F000"
$"0F06 6601 6600 FFF0 0F06 6711 6660 F0F0"
$"0F06 6E11 1660 F0F0 0F06 0D11 3C30 F0F0"
$"0F06 0E03 C300 F0F0 0F06 0D00 0007 F0F0"
$"0F06 6E00 7070 F0F0 0F06 6707 0700 F0F0"
$"0F06 6600 0FFF F0F0 0F06 67ED EF0F 00F0"
$"0F00 0000 0FF0 00F0 0FFF FFFF FF00 00F0"
$"000F 0000 0000 00F0 000F FFFF FFFF FFF0"
};
resource 'ics4' (138) {
$"00FF FFFF FFF0 0000 00F0 0000 00FF 0000"
$"00F0 666E 30FC F000 00F0 666F 33FF FF00"
$"00F0 666E 111E 0F00 00F0 660F 180F 0F00"
$"00F0 600E FEFE 0F00 00F0 600F 888F 0F00"
$"00F0 600E 888E 0F00 00F0 660F EFEF 0F00"
$"00F0 666E CCCE 0F00 00F0 666F C00F 0F00"
$"00F0 666E FEFE 0F00 00F0 666F 188F 0F00"
$"00F0 0000 0000 0F00 00FF FFFF FFFF FF"
};
resource 'ics4' (139) {
$"0FFF FFFF FFFF F000 0F00 0000 0000 F000"
$"0F06 660A 66A0 FFF0 0F06 660A AAA0 F0F0"
$"0F06 660A 83A0 F0F0 0F06 600A 38A0 F0F0"
$"0F06 000A AAA0 F0F0 0F06 000A 88A0 F0F0"
$"0F06 600A 88A0 F0F0 0F06 660A AAA0 F0F0"
$"0F06 660A 1FFF F0F0 0F06 660A 1FCF 00F0"
$"0F00 0000 0FF0 A0F0 0FFF FFFF FF01 A0F0"
$"000F 0000 0000 00F0 000F FFFF FFFF FFF0"
};
resource 'ics4' (140) {
$"0FFF FFFF FFF0 0000 0F00 0000 00FF 0000"
$"0F06 6600 00FC F000 0F06 6600 00FF FF00"
$"0F06 6FFF FFF0 0F00 0F06 6FF0 00F0 0F00"
$"0F06 00FF 0000 0F00 0F06 01CF F000 0F00"
$"0F06 0C10 FF00 0F00 0F06 6000 FF00 0F00"
$"0F06 660F F000 0F00 0F06 66FF 0000 0F00"
$"0F06 65F0 00F0 0F00 0F06 65FF FFF0 0F00"
$"0F00 0000 0000 0F00 0FFF FFFF FFFF FF"
};
resource 'ics4' (141) {
$"0FFF FFFF FFFF F000 0F00 0000 0000 F000"
$"0F06 66FF FFF0 FFF0 0F06 66F0 00F0 F0F0"
$"0F06 60FF 0000 F0F0 0F06 000F F000 F0F0"
$"0F06 01C0 FF00 F0F0 0F06 0C10 FF00 F0F0"
$"0F06 600F F000 F0F0 0F06 66FF 0000 F0F0"
$"0F06 66F0 0FFF F0F0 0F06 66FF FFCF 00F0"
$"0F00 0000 0FF0 00F0 0FFF FFFF FF00 00F0"
$"000F 0000 0000 00F0 000F FFFF FFFF FFF0"
};
resource 'ics4' (142) {
$"6660 0000 D000 0000 6660 000D 6D00 0000"
$"6660 00D0 06D0 0000 6660 0D0D D06D 0000"
$"6660 D0D0 DF06 D000 666D 0D00 0DF0 6D00"
$"66D0 D000 00DD 06D0 6D0D 0DDD DDDD F06D"
$"66DD D999 1966 DDD0 66D0 0991 1199 6D00"
$"6D00 C999 1999 96F0 6000 9996 6999 96F0"
$"D0D9 9969 6999 66DD 0D09 C699 9699 669D"
$"D9CC C699 9699 D67D D086 6699 799D 68DD"
};
resource 'ics#' (128) {
{ /* array: 2 elements */
/* [1] */
$"E000 E080 E040 E4A0 E250 F028 C824 955A"
$"EF74 C638 8FFE 9776 3DDD 5F76 4BDF BDEA",
/* [2] */
$"E000 E180 E3C0 E7E0 EFF0 FFF8 FFFC FFFE"
$"FFFE FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
}
};
resource 'ics#' (129) {
{ /* array: 2 elements */
/* [1] */
$"7FE0 4430 4428 477C 4404 4BA4 5004 52E4"
$"5004 4BA4 4404 46E4 4404 47A4 4404 7FFC",
/* [2] */
$"7FE0 7FF0 7FF8 7FFC 7FFC 7FFC 7FFC 7FFC"
$"7FFC 7FFC 7FFC 7FFC 7FFC 7FFC 7FFC 7FFC"
}
};
resource 'ics#' (130) {
{ /* array: 2 elements */
/* [1] */
$"7FF0 4410 46DC 4414 4754 4814 52D4 5014"
$"4B54 4414 46F4 44A4 44C4 7F94 1004 1FFC",
/* [2] */
$"7FF0 7FF0 7FFC 7FFC 7FFC 7FFC 7FFC 7FFC"
$"7FFC 7FFC 7FFC 7FFC 7FFC 7FFC 1FFC 1FFC"
}
};
resource 'ics#' (131) {
{ /* array: 2 elements */
/* [1] */
$"7FE0 4830 4828 483C 4804 5004 6B64 6004"
$"6F64 5004 4DA4 4804 4804 4804 4804 7FFC",
/* [2] */
$"7FE0 7FF0 7FF8 7FFC 7FFC 7FFC 7FFC 7FFC"
$"7FFC 7FFC 7FFC 7FFC 7FFC 7FFC 7FFC 7FFC"
}
};
resource 'ics#' (132) {
{ /* array: 2 elements */
/* [1] */
$"3FF0 2228 2324 233C 2304 26DC 2924 2EDC"
$"2924 2524 22DC 2324 2324 22DC 2204 3FFC",
/* [2] */
$"3FF0 3FF8 3FFC 3FFC 3FFC 3FFC 3FFC 3FFC"
$"3FFC 3FFC 3FFC 3FFC 3FFC 3FFC 3FFC 3FFC"
}
};
resource 'ics#' (133) {
{ /* array: 2 elements */
/* [1] */
$"7FF0 4410 465C 45B4 4654 4A5C 55B4 5254"
$"4A5C 45B4 46F4 46AC 44C4 7FA4 1004 1FFC",
/* [2] */
$"7FF0 7FF0 7FFC 7FFC 7FFC 7FFC 7FFC 7FFC"
$"7FFC 7FFC 7FFC 7FFC 7FFC 7FFC 1FFC 1FFC"
}
};
resource 'ics#' (134) {
{ /* array: 2 elements */
/* [1] */
$"7FE0 4830 4BE8 4A3C 4AC4 52CC 6214 6264"
$"6184 5224 4DD4 49A4 4844 48E4 4804 7FFC",
/* [2] */
$"7FE0 7FF0 7FF8 7FFC 7FFC 7FFC 7FFC 7FFC"
$"7FFC 7FFC 7FFC 7FFC 7FFC 7FFC 7FFC 7FFC"
}
};
resource 'ics#' (135) {
{ /* array: 2 elements */
/* [1] */
$"7FF8 4808 4BFE 4A0A 4ACA 52CA 623A 60CA"
$"530A 4C0A 4B7A 4B52 4862 7FC2 1002 1FFE",
/* [2] */
$"7FF8 7FF8 7FFE 7FFE 7FFE 7FFE 7FFE 7FFE"
$"7FFE 7FFE 7FFE 7FFE 7FFE 7FFE 1FFE 1FFE"
}
};
resource 'ics#' (136) {
{ /* array: 2 elements */
/* [1] */
$"7FE0 4830 4A28 483C 4AE4 5174 6334 6154"
$"62A4 500C 4A54 48A4 4A04 4954 4804 7FFC",
/* [2] */
$"7FE0 7FF0 7FF8 7FFC 7FFC 7FFC 7FFC 7FFC"
$"7FFC 7FFC 7FFC 7FFC 7FFC 7FFC 7FFC 7FFC"
}
};
resource 'ics#' (137) {
{ /* array: 2 elements */
/* [1] */
$"7FF8 4808 4DCE 4AEA 4E6A 52AA 654A 601A"
$"52AA 494A 4C7A 4A52 4862 7FC2 1002 1FFE",
/* [2] */
$"7FF8 7FF8 7FFE 7FFE 7FFE 7FFE 7FFE 7FFE"
$"7FFE 7FFE 7FFE 7FFE 7FFE 7FFE 1FFE 1FFE"
}
};
resource 'ics#' (138) {
{ /* array: 2 elements */
/* [1] */
$"3FE0 2230 22A8 22FC 2294 2494 28F4 2894"
$"2894 24F4 2294 2294 22F4 2294 2204 3FFC",
/* [2] */
$"3FE0 3FF0 3FF8 3FFC 3FFC 3FFC 3FFC 3FFC"
$"3FFC 3FFC 3FFC 3FFC 3FFC 3FFC 3FFC 3FFC"
}
};
resource 'ics#' (139) {
{ /* array: 2 elements */
/* [1] */
$"7FF8 4408 452E 45EA 452A 492A 51EA 512A"
$"492A 45EA 457A 4552 446A 7FCA 1002 1FFE",
/* [2] */
$"7FF8 7FF8 7FFE 7FFE 7FFE 7FFE 7FFE 7FFE"
$"7FFE 7FFE 7FFE 7FFE 7FFE 7FFE 1FFE 1FFE"
}
};
resource 'ics#' (140) {
{ /* array: 2 elements */
/* [1] */
$"7FE0 4830 4828 483C 4FE4 5624 6304 6184"
$"60C4 50C4 4984 4B04 4E24 4FE4 4804 7FFC",
/* [2] */
$"7FE0 7FF0 7FF8 7FFC 7FFC 7FFC 7FFC 7FFC"
$"7FFC 7FFC 7FFC 7FFC 7FFC 7FFC 7FFC 7FFC"
}
};
resource 'ics#' (141) {
{ /* array: 2 elements */
/* [1] */
$"7FF8 4808 4FEE 4E2A 4B0A 518A 60CA 60CA"
$"518A 4B0A 4E7A 4FD2 4862 7FC2 1002 1FFE",
/* [2] */
$"7FF8 7FF8 7FFE 7FFE 7FFE 7FFE 7FFE 7FFE"
$"7FFE 7FFE 7FFE 7FFE 7FFE 7FFE 1FFE 1FFE"
}
};
resource 'ics#' (142) {
{ /* array: 2 elements */
/* [1] */
$"E000 E080 E040 E4A0 E250 F028 C824 955A"
$"EF74 C638 8FFE 9776 3DDD 5F76 4BDF BDEA",
/* [2] */
$"E000 E180 E3C0 E7E0 EFF0 FFF8 FFFC FFFE"
$"FFFE FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
}
};
resource 'ICN#' (128) {
{ /* array: 2 elements */
/* [1] */
$"0000 0000 F800 8000 F801 C000 F802 6000"
$"F804 7000 F80C 9800 F818 4C00 F824 9600"
$"F820 1700 F888 2180 F810 01C0 F920 0A60"
$"F800 0130 F401 2258 C108 995C D205 5704"
$"8450 5D87 E843 7760 C1AC 1CC6 F040 0774"
$"FA5C 1DD8 FC57 7770 FA1D 5DDC F977 7774"
$"F55D DDDC FA77 7774 F5DD DDDC FB77 7774"
$"F5DD DDDC FB77 7774 F1DD DDD8 FF77 7770",
/* [2] */
$"0000 0000 F800 8000 F801 C000 F803 E000"
$"F807 F000 F80F F800 F81F FC00 F83F FE00"
$"F83F FF00 F8FF FF80 F9FF FFC0 FBFF FFE0"
$"FFFF FFF0 FFFF FFF8 FFFF FFFC FFFF FFFE"
$"FFFF FFFE FFFF FFFE FFFF FFFE FFFF FFFE"
$"FFFF FFFC FFFF FFFC FFFF FFFC FFFF FFFC"
$"FFFF FFFC FFFF FFFC FFFF FFFC FFFF FFFC"
$"FFFF FFFC FFFF FFFC FFFF FFFC FFFF FFFC"
}
};
resource 'ICN#' (129) {
{ /* array: 2 elements */
/* [1] */
$"1FFF FE00 1040 0300 1040 0280 1040 0240"
$"1040 0220 104D 7E10 1040 03F8 105E 7688"
$"1040 0008 10AD 6B48 1100 0008 115D D748"
$"1200 0008 12D7 6DC8 1200 0008 12BE F6C8"
$"1200 0008 12DD BB08 1100 0008 1176 AAC8"
$"1080 0008 105B BD48 1040 0008 1056 F6C8"
$"1040 0008 105C EE48 1040 0008 105D 7348"
$"1040 0008 1040 0008 1040 0008 1FFF FFF8",
/* [2] */
$"1FFF FE00 1FFF FF00 1FFF FF80 1FFF FFC0"
$"1FFF FFE0 1FFF FFF0 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
}
};
resource 'ICN#' (130) {
{ /* array: 2 elements */
/* [1] */
$"3FFF FFF0 2080 0010 2080 0010 2080 001C"
$"2080 0014 20DB DD14 2080 0014 209D 6D14"
$"2100 0014 22B5 D694 2200 0014 25BD EE14"
$"2400 0014 24B7 9B94 2400 0014 25DC DD94"
$"2400 0014 22DF 3614 2200 0014 216E F594"
$"2080 0014 20E7 7A94 2080 0014 20DE 6FE4"
$"2080 0844 20CD A8A4 2080 0904 20B7 6AA4"
$"2080 0C04 3FFF F804 0800 0004 0FFF FFFC",
/* [2] */
$"3FFF FFF0 3FFF FFF0 3FFF FFF0 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 0FFF FFFC 0FFF FFFC"
}
};
resource 'ICN#' (131) {
{ /* array: 2 elements */
/* [1] */
$"3FFF FC00 2100 0600 2100 0500 2100 0480"
$"2100 0440 2100 0420 2100 07F0 2100 0010"
$"2100 0010 2200 0010 2400 0010 25DD DB10"
$"2800 0010 2800 0010 29DE F710 2800 0010"
$"2800 0010 29BF BB10 2400 0010 2400 0010"
$"2200 0010 2100 0010 2100 0010 2100 0010"
$"2100 0010 2100 0010 2100 0010 2100 0010"
$"2100 0010 2100 0010 2100 0010 3FFF FFF0",
/* [2] */
$"3FFF FC00 3FFF FE00 3FFF FF00 3FFF FF80"
$"3FFF FFC0 3FFF FFE0 3FFF FFF0 3FFF FFF0"
$"3FFF FFF0 3FFF FFF0 3FFF FFF0 3FFF FFF0"
$"3FFF FFF0 3FFF FFF0 3FFF FFF0 3FFF FFF0"
$"3FFF FFF0 3FFF FFF0 3FFF FFF0 3FFF FFF0"
$"3FFF FFF0 3FFF FFF0 3FFF FFF0 3FFF FFF0"
$"3FFF FFF0 3FFF FFF0 3FFF FFF0 3FFF FFF0"
$"3FFF FFF0 3FFF FFF0 3FFF FFF0 3FFF FFF0"
}
};
resource 'ICN#' (132) {
{ /* array: 2 elements */
/* [1] */
$"1FFF FE00 1040 0300 1075 EA80 1044 0A40"
$"107B F620 1044 0A10 1044 0BF8 1044 0808"
$"107B F7F8 1084 0808 1134 0808 1104 0808"
$"12FB F7F8 1204 0808 1274 0808 1204 0808"
$"12FB F7F8 1104 0808 1134 0808 1104 0808"
$"10FB F7F8 1044 0808 1054 0808 1044 0808"
$"107B F7F8 1044 0808 1054 0808 1044 0808"
$"107B F7F8 1044 0808 1040 0008 1FFF FFF8",
/* [2] */
$"1FFF FE00 1FFF FF00 1FFF FF80 1FFF FFC0"
$"1FFF FFE0 1FFF FFF0 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
}
};
resource 'ICN#' (133) {
{ /* array: 2 elements */
/* [1] */
$"3FFF FFF0 2080 0010 2085 EBD0 2084 081C"
$"20FB F7F4 2084 0814 2094 0814 2084 081C"
$"21FB F7F4 2204 0814 2274 0814 2404 081C"
$"25FB F7F4 2404 0814 24F4 0814 2404 081C"
$"25FB F7F4 2204 0814 2274 0814 2104 081C"
$"20FB F7F4 2084 0814 2094 0814 2084 0FEC"
$"20FB F844 2084 0884 2094 0904 2084 0AFC"
$"2080 0C04 3FFF FA04 0800 0004 0FFF FFFC",
/* [2] */
$"3FFF FFF0 3FFF FFF0 3FFF FFF0 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 0FFF FFFC 0FFF FFFC"
}
};
resource 'ICN#' (134) {
{ /* array: 2 elements */
/* [1] */
$"3FFF FC00 2100 0600 217F FD00 2140 0480"
$"2140 0440 214F FC20 2149 87F0 214A 4010"
$"214C 2790 224C 2030 244A 4ED0 2449 8110"
$"2848 0210 284B 6C10 284B 1010 284B 6010"
$"2848 8790 284B 0850 2444 1030 244B F830"
$"2233 F830 2143 F830 2103 F850 2103 FF90"
$"2103 FC10 2103 F610 2100 6B10 2100 D590"
$"2101 FFD0 2100 0010 2100 0010 3FFF FFF0",
/* [2] */
$"3FFF FC00 3FFF FE00 3FFF FF00 3FFF FF80"
$"3FFF FFC0 3FFF FFE0 3FFF FFF0 3FFF FFF0"
$"3FFF FFF0 3FFF FFF0 3FFF FFF0 3FFF FFF0"
$"3FFF FFF0 3FFF FFF0 3FFF FFF0 3FFF FFF0"
$"3FFF FFF0 3FFF FFF0 3FFF FFF0 3FFF FFF0"
$"3FFF FFF0 3FFF FFF0 3FFF FFF0 3FFF FFF0"
$"3FFF FFF0 3FFF FFF0 3FFF FFF0 3FFF FFF0"
$"3FFF FFF0 3FFF FFF0 3FFF FFF0 3FFF FFF0"
}
};
resource 'ICN#' (135) {
{ /* array: 2 elements */
/* [1] */
$"3FFF FFF0 2100 0010 217F FFD0 2140 001C"
$"2140 0014 215F FFD4 2153 0014 2154 8014"
$"2258 4F34 2458 4054 2454 9D94 2853 0214"
$"2850 0414 2856 D814 2856 2014 2856 C014"
$"2851 0F14 2456 1094 2448 2054 2217 F054"
$"2167 F054 2187 F054 2107 F094 2107 FFF4"
$"2107 E824 2107 D844 2100 A884 2101 F904"
$"2100 0A04 3FFF FC04 0800 0004 0FFF FFFC",
/* [2] */
$"3FFF FFF0 3FFF FFF0 3FFF FFF0 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 0FFF FFFC 0FFF FFFC"
}
};
resource 'ICN#' (136) {
{ /* array: 2 elements */
/* [1] */
$"1FFF FE00 1080 0300 1088 0280 1098 0240"
$"1088 0220 1088 0210 109C 1FF8 1088 6788"
$"1088 87C8 1118 87C8 1209 07E8 1209 07E8"
$"141D 0FE8 1409 1AA8 1408 B548 1418 EAD8"
$"1408 75A8 1408 1E28 121C 0048 1208 6048"
$"1108 6088 1098 9088 1088 8908 1089 0708"
$"109B 0308 108B 0008 1088 0408 108F FFE8"
$"1081 2488 1080 0008 1080 0008 1FFF FFF8",
/* [2] */
$"1FFF FE00 1FFF FF00 1FFF FF80 1FFF FFC0"
$"1FFF FFE0 1FFF FFF0 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
}
};
resource 'ICN#' (137) {
{ /* array: 2 elements */
/* [1] */
$"3FFF FFF0 2100 0010 2100 0010 2170 781C"
$"2121 9E14 2122 1F14 2162 1F14 2124 1F94"
$"2224 1F94 2474 3F94 2424 6A94 2822 D514"
$"2863 AB54 2821 D694 2820 7894 2870 0114"
$"2821 8114 2421 8214 2462 4214 2222 2414"
$"2124 1C14 216C 0C14 212C 0014 2120 0FE4"
$"213F F844 2104 9884 2100 0904 2100 0A04"
$"2100 0C04 3FFF F804 0800 0004 0FFF FFFC",
/* [2] */
$"3FFF FFF0 3FFF FFF0 3FFF FFF0 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 0FFF FFFC 0FFF FFFC"
}
};
resource 'ICN#' (138) {
{ /* array: 2 elements */
/* [1] */
$"1FFF FE00 1040 0300 105E AA80 105C 4240"
$"1056 2A20 1055 0210 105F FFF8 105F FFE8"
$"105E AAE8 109C 81E8 1116 14A8 1114 16A8"
$"121E 82E8 121C 25E8 121E 80E8 121F FFE8"
$"1217 FFA8 1214 00A8 111C AAE8 111D 54E8"
$"109C 2AE8 105D 44E8 1054 0AA8 1055 14A8"
$"105F FFE8 105F FFE8 105C 20E8 105D 52E8"
$"1054 09A8 1055 40A8 1040 0008 1FFF FFF8",
/* [2] */
$"1FFF FE00 1FFF FF00 1FFF FF80 1FFF FFC0"
$"1FFF FFE0 1FFF FFF0 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
}
};
resource 'ICN#' (139) {
{ /* array: 2 elements */
/* [1] */
$"3FFF FFF0 2080 0010 20AC 5550 20AA 2B5C"
$"20BD 55D4 20BF FFD4 20BF FFD4 20BD 03D4"
$"212C 2B54 222D 2D54 223D 05D4 243C 4BD4"
$"243D ABD4 243F FFD4 242F FF54 2428 0154"
$"2439 55D4 223A A9D4 2238 55D4 213A 89D4"
$"20A8 1554 20AA 2954 20BF FFD4 20BF FFE4"
$"20B8 4854 20BA A8B4 20A8 1974 20AA 8A74"
$"2080 0DD4 3FFF F854 0800 0004 0FFF FFFC",
/* [2] */
$"3FFF FFF0 3FFF FFF0 3FFF FFF0 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 0FFF FFFC 0FFF FFFC"
}
};
resource 'ICN#' (140) {
{ /* array: 2 elements */
/* [1] */
$"1FFF FE00 1080 0300 1080 0280 1080 0240"
$"1080 0220 1080 6210 1080 0FF8 1080 0188"
$"109F FE08 111F FF08 121E 0308 120E 0008"
$"1407 0108 1403 8008 1411 C008 1448 E008"
$"1440 F048 1400 70C8 1208 3048 1200 6008"
$"1100 C008 1081 8008 1083 0088 1086 0088"
$"108C 0188 109F FF08 109F FF08 1080 0008"
$"1098 0008 1098 0008 1080 0008 1FFF FFF8",
/* [2] */
$"1FFF FE00 1FFF FF00 1FFF FF80 1FFF FFC0"
$"1FFF FFE0 1FFF FFF0 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"1FFF FFF8 1FFF FFF8 1FFF FFF8 1FFF FFF8"
}
};
resource 'ICN#' (141) {
{ /* array: 2 elements */
/* [1] */
$"3FFF FFF0 2080 0010 2080 0010 2080 C01C"
$"2080 1814 2080 0314 20BF FC14 20BF FE14"
$"213C 0614 221C 0014 220E 0214 2407 0014"
$"2407 8014 2421 C014 2481 E014 2480 E114"
$"2400 6014 2210 C014 2201 8014 2103 0014"
$"2086 0114 208C 0114 2098 0314 20BF FFE4"
$"20BF F844 2080 0884 20B0 0904 20B0 0A04"
$"2080 0C04 3FFF F804 0800 0004 0FFF FFFC",
/* [2] */
$"3FFF FFF0 3FFF FFF0 3FFF FFF0 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 3FFF FFFC 3FFF FFFC"
$"3FFF FFFC 3FFF FFFC 0FFF FFFC 0FFF FFFC"
}
};
resource 'ICN#' (142) {
{ /* array: 2 elements */
/* [1] */
$"0000 0000 F800 8000 F801 C000 F802 6000"
$"F804 7000 F80C 9800 F818 4C00 F824 9600"
$"F820 1700 F888 2180 F810 01C0 F920 0A60"
$"F800 0130 F401 2258 C108 995C D205 5704"
$"8450 5D87 E843 7760 C1AC 1CC6 F040 0774"
$"FA5C 1DD8 FC57 7770 FA1D 5DDC F977 7774"
$"F55D DDDC FA77 7774 F5DD DDDC FB77 7774"
$"F5DD DDDC FB77 7774 F1DD DDD8 FF77 7770",
/* [2] */
$"0000 0000 F800 8000 F801 C000 F803 E000"
$"F807 F000 F80F F800 F81F FC00 F83F FE00"
$"F83F FF00 F8FF FF80 F9FF FFC0 FBFF FFE0"
$"FFFF FFF0 FFFF FFF8 FFFF FFFC FFFF FFFE"
$"FFFF FFFE FFFF FFFE FFFF FFFE FFFF FFFE"
$"FFFF FFFC FFFF FFFC FFFF FFFC FFFF FFFC"
$"FFFF FFFC FFFF FFFC FFFF FFFC FFFF FFFC"
$"FFFF FFFC FFFF FFFC FFFF FFFC FFFF FFFC"
}
};
resource 'icl8' (128) {
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"F0EF F0EF F000 0000 0000 0000 0000 0000"
$"FA00 0000 0000 0000 0000 0000 0000 0000"
$"F0EF F0EF F000 0000 0000 0000 0000 00FA"
$"D2FA 0000 0000 0000 0000 0000 0000 0000"
$"EFF0 EFF0 EF00 0000 0000 0000 0000 FA00"
$"F9D2 FA00 0000 0000 0000 0000 0000 0000"
$"F0EF F0EF F000 0000 0000 0000 00FA 0000"
$"00FA D2FA 0000 0000 0000 0000 0000 0000"
$"EFF0 EFF0 EF00 0000 0000 0000 FAFF 0000"
$"FA00 57D2 FA00 0000 0000 0000 0000 0000"
$"EFF0 EFF0 EF00 0000 0000 00FA FF00 F7F9"
$"00FF 00F9 D2FA 0000 0000 0000 0000 0000"
$"F0EF F0EF F000 0000 0000 FA00 00FA F900"
$"FA00 00FA F9D2 FA00 0000 0000 0000 0000"
$"EFF0 EFF0 EF00 0000 007B FF00 00F9 0000"
$"00F9 00FF 00FA D2FA 0000 0000 0000 0000"
$"F0EF F0EF F000 0000 FA00 002B FA00 0000"
$"0000 FA00 0000 F9D2 FA00 0000 0000 0000"
$"EFF0 EFF0 EF00 00F9 0000 00FA 0000 0000"
$"0000 00F9 0000 00FA D2FA 0000 0000 0000"
$"F0EF F0EF F000 F9FF 0000 FA00 0000 0000"
$"0000 0000 FA00 FFF9 F9D2 FA00 0000 0000"
$"EFF0 EFF0 EFF9 0000 F7F9 0000 0000 0000"
$"0000 0000 00F9 00FF 00F9 D2FA 0000 0000"
$"F0EF EFF0 F9FF 0000 F900 0000 0000 F9FA"
$"00F9 FAF9 FA00 FA00 00FA F9D2 FA00 0000"
$"EFF0 F0F9 0000 00FA 0000 0000 FAF9 00F9"
$"FA00 F9FA FFF9 F9FA 00FF 00FA D2FA 0000"
$"EFF0 F9FF 0000 FA00 0000 00F9 00FA 00C9"
$"00D2 00D2 C2EF F0F0 F900 0000 F9D2 7B00"
$"F0F9 0000 00FA 0000 00FA 00D2 0000 C200"
$"05E6 E5E6 D2E5 EFEF F0F9 0000 00FA D2FA"
$"EFEF FA00 FA00 0000 F9D2 0000 D2F9 E6E6"
$"05E5 E6E5 E5E6 E6E5 EFF0 FA00 0000 F900"
$"F0EF EFF9 0000 00FA FA00 C300 FAE6 E505"
$"0505 E5D2 D2E5 E5F9 E6E5 EFF9 00FA 8C00"
$"F0EF F0F0 FA00 F900 00D2 00F9 E505 0505"
$"0505 0505 E5D2 E6E6 E5EF F0FF F98C 0000"
$"EFF0 EFEF F0F9 FA00 F9D2 FAD2 C8E5 E505"
$"0505 E6E5 E6E5 E6EF E6E5 E6FF FF00 0000"
$"EFF0 EFF0 EFFA 0000 D2FA 00C2 E5E5 E6E6"
$"05E6 D2E6 E5E6 E5E5 E5E6 FFE5 F000 0000"
$"F0EF F0EF F0F9 FAF9 0000 E6E6 E5E6 E5E5"
$"05E5 E6D2 E6E5 E6EF E5EF E5FF F0FF 0000"
$"EFF0 EFF0 F900 00FA D2C2 C9C2 E6E5 D2E5"
$"E6D2 D2D2 E5E5 E6E5 E6E5 FFEF E5FF 0000"
$"F0EF F0EF 00FA 00D2 F9EB D2C9 E5D2 D2E6"
$"D2D2 D2E5 E6E6 E5E6 EFE6 E5E6 EFFF 0000"
$"EFF0 EFEF FAF9 D200 D2D2 D2D2 D2D2 D2D2"
$"E5E6 E5E6 E5E5 E6E5 E6E5 F0EF F0FF 0000"
$"F0EF F0F0 00D2 00D2 D2D2 D2E5 E5E6 E5E6"
$"D2E5 D2E5 E6E5 E5E6 EFE5 EFE5 EFFF 0000"
$"EFF0 EFF0 F900 D2D2 D2D2 E5E5 E6E5 E6E5"
$"E5D2 E5E6 E5E6 E5E6 E5EF E5FF EFFF 0000"
$"EFEF F0EF 00D2 00D2 D2E5 E6E6 E5E6 E5E6"
$"E6D2 D2E5 E6E5 E6E5 EFF0 FFE5 FFFF 0000"
$"F0F0 EFF0 FAF9 D2D2 D2E6 E5E5 E6E5 E6E5"
$"E5D2 D2E5 E6E5 E6E5 F0E6 E5EF FFFF 0000"
$"EFEF F0EF F000 F0D2 D2D2 E6E5 E6E5 E6E5"
$"E6D2 D2D2 E5E6 EFE6 EFF0 EFFF FF00 0000"
$"F0F0 EFF0 EFFA C2F0 EFD2 D2D2 E5E6 E5E6"
$"D2D2 F0D2 D2EF F0EF F0EF FFFF FF"
};
resource 'icl8' (129) {
$"0000 00FF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FF00 0000 0000 0000 0000"
$"0000 00FF F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 FFFF 0000 0000 0000 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 FF2B FF00 0000 0000 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 FF2B 2BFF 0000 0000 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 FF2B 2B2B FF00 0000 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 FFFF F5FF"
$"F5FF FFFF FFFF FF2B 2B2B 2BFF 0000 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 FFFF FFFF FFFF FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5FF FFFF FFF5"
$"F5FF FFFF F5FF FFF5 FFF5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECF5 FFF5 FFFF F5FF"
$"F5FF FFF5 FFF5 FFFF F5FF F5F5 FF00 0000"
$"0000 00FF F5EC ECEC F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC F5FF F5FF FFFF F5FF"
$"FFFF F5FF F5FF FFFF F5FF F5F5 FF00 0000"
$"0000 00FF F5EC ECF5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECF5 FFFF F5FF F5FF FFFF"
$"F5FF FFF5 FFFF F5FF FFFF F5F5 FF00 0000"
$"0000 00FF F5EC ECF5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECF5 FFF5 FFFF FFFF FFF5"
$"FFFF FFFF F5FF FFF5 FFFF F5F5 FF00 0000"
$"0000 00FF F5EC ECF5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECF5 FFFF F5FF FFFF F5FF"
$"FFF5 FFFF FFF5 FFFF F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC F5FF FFFF F5FF FFF5"
$"FFF5 FFF5 FFF5 FFF5 FFFF F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5FF FFF5 FFFF"
$"FFF5 FFFF FFFF F5FF F5FF F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5FF F5FF FFF5"
$"FFFF FFFF F5FF FFF5 FFFF F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5FF FFFF F5F5"
$"FFFF FFF5 FFFF FFF5 F5FF F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5FF FFFF F5FF"
$"F5FF FFFF F5F5 FFFF F5FF F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FF"
};
resource 'icl8' (130) {
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF 0000 0000"
$"0000 FFF5 F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF FFFF 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECFF F5FF FFF5 FFFF"
$"FFFF F5FF FFFF F5FF F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5FF FFFF F5FF"
$"F5FF FFF5 FFFF F5FF F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECF5 FFF5 FFFF F5FF F5FF"
$"FFFF F5FF F5FF FFF5 FFF5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECF5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC F5FF FFF5 FFFF FFFF F5FF"
$"FFFF FFF5 FFFF FFF5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC F5F5 FFF5 FFFF F5FF FFFF"
$"FFF5 F5FF FFF5 FFFF FFF5 F5FF F5FF 0000"
$"0000 FFF5 ECEC F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC F5FF FFFF F5FF FFFF F5F5"
$"FFFF F5FF FFFF F5FF FFF5 F5FF F5FF 0000"
$"0000 FFF5 ECEC F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECF5 FFFF F5FF FFFF FFFF"
$"F5F5 FFFF F5FF FFF5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECF5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC F5FF FFF5 FFFF FFF5"
$"FFFF FFFF F5FF F5FF FFF5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECFF FFF5 F5FF FFFF"
$"F5FF FFFF FFF5 FFF5 FFF5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECFF F5FF FFFF FFF5"
$"F5FF FFF5 FFFF FFFF FFFF FFF5 F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 FF2B 2B2B 2BFF F5F5 F5FF 0000"
$"0000 FFF5 ECEC ECEC ECFF F5F5 FFFF F5FF"
$"FFF5 FFF5 FF2B 2B2B FFF5 FFF5 F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 FF2B 2BFF F5F5 F5F5 F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 FFFF F5FF FFFF"
$"F5FF FFF5 FF2B FFF5 FFF5 FFF5 F5FF 0000"
$"0000 FFF5 F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 FFFF F5F5 F5F5 F5F5 F5FF 0000"
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFF5 F5F5 F5F5 F5F5 F5FF 0000"
$"0000 0000 FFF5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000"
$"0000 0000 FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
};
resource 'icl8' (131) {
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF 0000 0000 0000 0000 0000"
$"0000 FFF5 F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5FF FF00 0000 0000 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5FF 2BFF 0000 0000 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5FF 2B2B FF00 0000 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5FF 2B2B 2BFF 0000 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5FF 2B2B 2B2B FF00 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5FF FFFF FFFF FFFF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECF5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECFF FFFF F5FF FFFF F5FF"
$"FFFF F5FF FFF5 FFFF F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC F5FF FFFF F5FF FFFF FFF5"
$"FFFF FFFF F5FF FFFF F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC F5FF FFF5 FFFF FFFF FFFF"
$"FFF5 FFFF FFF5 FFFF F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECF5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECF5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF"
};
resource 'icl8' (132) {
$"0000 00FF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FF00 0000 0000 0000 0000"
$"0000 00FF F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 FFFF 0000 0000 0000 0000"
$"0000 00FF F5EC ECEC ECEC FFFF 48C0 48FF"
$"FFFF FF48 C048 FF2B FF00 0000 0000 0000"
$"0000 00FF F5EC ECEC ECEC 4848 48C0 4848"
$"4848 4848 C048 FF2B 2BFF 0000 0000 0000"
$"0000 00FF F5EC ECEC ECEC C0C0 C000 FFFF"
$"FFFF FFFF 00FF FF2B 2B2B FF00 0000 0000"
$"0000 00FF F5EC ECEC ECEC 4848 48FF F5F5"
$"F5F5 F5F5 FFF5 FF2B 2B2B 2BFF 0000 0000"
$"0000 00FF F5EC ECEC ECEC 4848 48FF F5F5"
$"F5F5 F5F5 FFF5 FFFF FFFF FFFF FF00 0000"
$"0000 00FF F5EC ECEC ECEC 4848 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC C0C0 C000 FFFF"
$"FFFF FFFF 00FF FFFF FFFF FFFF FF00 0000"
$"0000 00FF F5EC ECEC EC48 4848 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC 4848 FFFF 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC 4848 4848 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECF5 C0C0 C0C0 C000 FFFF"
$"FFFF FFFF 00FF FFFF FFFF FFFF FF00 0000"
$"0000 00FF F5EC ECF5 4848 4848 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECF5 48FF FFFF 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECF5 4848 4848 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECF5 C0C0 C0C0 C000 FFFF"
$"FFFF FFFF 00FF FFFF FFFF FFFF FF00 0000"
$"0000 00FF F5EC ECF5 4848 4848 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC 4848 FFFF 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC 4848 4848 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECC0 C0C0 C000 FFFF"
$"FFFF FFFF 00FF FFFF FFFF FFFF FF00 0000"
$"0000 00FF F5EC ECEC ECEC 4848 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC 48FF 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC 4848 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC C0C0 C000 FFFF"
$"FFFF FFFF 00FF FFFF FFFF FFFF FF00 0000"
$"0000 00FF F5EC ECEC ECEC 4848 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC 48FF 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC 4848 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC C0C0 C000 FFFF"
$"FFFF FFFF 00FF FFFF FFFF FFFF FF00 0000"
$"0000 00FF F5EC ECEC ECEC 4848 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FF"
};
resource 'icl8' (133) {
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF 0000 0000"
$"0000 FFF5 F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC EC48 4848 48C0 48FF"
$"FFFF FF48 C048 FFFF FFFF 48FF 0000 0000"
$"0000 FFF5 ECEC ECEC EC48 4848 48C0 4848"
$"4848 4848 C048 4848 4848 48FF FFFF 0000"
$"0000 FFF5 ECEC ECEC ECC0 C0C0 C000 FFFF"
$"FFFF FFFF 00FF FFFF FFFF FFFF 00FF 0000"
$"0000 FFF5 ECEC ECEC EC48 4848 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5FF 00FF 0000"
$"0000 FFF5 ECEC ECEC EC48 48FF 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5FF 00FF 0000"
$"0000 FFF5 ECEC ECEC EC48 4848 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5FF FFFF 0000"
$"0000 FFF5 ECEC ECEC C0C0 C0C0 C000 FFFF"
$"FFFF FFFF 00FF FFFF FFFF FFFF 00FF 0000"
$"0000 FFF5 ECEC EC48 4848 4848 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5FF 00FF 0000"
$"0000 FFF5 ECEC EC48 48FF FFFF 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5FF 00FF 0000"
$"0000 FFF5 ECEC F548 4848 4848 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5FF FFFF 0000"
$"0000 FFF5 ECEC F5C0 C0C0 C0C0 C000 FFFF"
$"FFFF FFFF 00FF FFFF FFFF FFFF 00FF 0000"
$"0000 FFF5 ECEC F548 4848 4848 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5FF 00FF 0000"
$"0000 FFF5 ECEC F548 FFFF FFFF 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5FF 00FF 0000"
$"0000 FFF5 ECEC F548 4848 4848 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5FF FFFF 0000"
$"0000 FFF5 ECEC F5C0 C0C0 C0C0 C000 FFFF"
$"FFFF FFFF 00FF FFFF FFFF FFFF 00FF 0000"
$"0000 FFF5 ECEC EC48 4848 4848 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5FF 00FF 0000"
$"0000 FFF5 ECEC EC48 48FF FFFF 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5FF 00FF 0000"
$"0000 FFF5 ECEC ECEC 4848 4848 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5FF FFFF 0000"
$"0000 FFF5 ECEC ECEC ECC0 C0C0 C000 FFFF"
$"FFFF FFFF 00FF FFFF FFFF FFFF 00FF 0000"
$"0000 FFF5 ECEC ECEC EC48 4848 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5FF 00FF 0000"
$"0000 FFF5 ECEC ECEC EC48 48FF 48FF F5F5"
$"F5F5 F5F5 FFF5 F5F5 F5F5 F5FF 00FF 0000"
$"0000 FFF5 ECEC ECEC EC48 4848 48FF F5F5"
$"F5F5 F5F5 FFFF FFFF FFFF FF00 FFFF 0000"
$"0000 FFF5 ECEC ECEC ECC0 C0C0 C000 FFFF"
$"FFFF FFFF FF2B 2B2B 2BFF 0000 00FF 0000"
$"0000 FFF5 ECEC ECEC EC48 4848 48FF F5F5"
$"F5F5 F5F5 FF2B 2B2B FF00 0000 00FF 0000"
$"0000 FFF5 ECEC ECEC EC48 48FF 48FF F5F5"
$"F5F5 F5F5 FF2B 2BFF 0000 0000 00FF 0000"
$"0000 FFF5 ECEC ECEC EC48 4848 48FF F5F5"
$"F5F5 F5F5 FF2B FF00 FFFF FFFF FFFF 0000"
$"0000 FFF5 F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 FFFF 0000 0000 0000 00FF 0000"
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FF00 FF00 0000 0000 00FF 0000"
$"0000 0000 FF00 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 00FF 0000"
$"0000 0000 FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
};
resource 'icl8' (134) {
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF 0000 0000 0000 0000 0000"
$"0000 FFF5 F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5FF FF00 0000 0000 0000 0000"
$"0000 FFF5 ECEC ECEC ECFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF 2BFF 0000 0000 0000 0000"
$"0000 FFF5 ECEC ECEC ECFF 2B2B 2B2B 2B2B"
$"2B2B 2B2B 2BFF 2B2B FF00 0000 0000 0000"
$"0000 FFF5 ECEC ECEC ECFF 2BF8 F8F8 F8F8"
$"F8F8 F8F8 F8FF 2B2B 2BFF 0000 0000 0000"
$"0000 FFF5 ECEC ECEC ECFF 2BF8 FFFF FFFF"
$"FFFF FFFF FFFF 2B2B 2B2B FF00 0000 0000"
$"0000 FFF5 ECEC ECEC ECFF 2BF8 FFF5 F505"
$"ECF5 F5F5 F5FF FFFF FFFF FFFF 0000 0000"
$"0000 FFF5 ECEC ECEC ECFF 2BF8 FFF5 0505"
$"ECEC F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECFF 2BF8 FF05 0505"
$"ECEC ECF5 F5FF FFFF FFF5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC F5FF 2BF8 FFD8 D8D8"
$"E3E3 E3F5 F5F5 F5F5 F5F5 FFFF 0000 0000"
$"0000 FFF5 ECEC ECF5 F5FF 2BF8 FFF5 D8D8"
$"E3E3 F5F5 FFFF FFF5 FFFF F5FF 0000 0000"
$"0000 FFF5 ECEC ECF5 F5FF 2BF8 FFF5 F5D8"
$"E3F5 F5F5 F5F5 F5FF F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC F5F5 F5FF 2BF8 FFF5 F5F5"
$"F5F5 F5F5 F5F5 FFF5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC F5F5 F5FF 2BF8 FFF5 FFFF"
$"F5FF FFF5 FFFF F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC F5F5 F5FF 2BF8 FFF5 FFFF"
$"F5F5 F5FF F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC F5F5 F5FF 2BF8 FFF5 FFFF"
$"F5FF FFF5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC F5F5 F5FF 2BF8 FFF5 F5F5"
$"FFF5 F5F5 F5FF FFFF FFF5 F5FF 0000 0000"
$"0000 FFF5 ECEC F5F5 F5FF 2BF8 FFF5 FFFF"
$"F5F5 F5F5 FFF6 F6F6 F6FF F5FF 0000 0000"
$"0000 FFF5 ECEC ECF5 F5FF 2BF8 F5FF F5F5"
$"F5F5 F5FF F6F6 F6F6 F6F6 FFFF 0000 0000"
$"0000 FFF5 ECEC ECF5 F5FF F5F5 FFF5 FFFF"
$"FFFF FFFF FFF6 F6F6 F6F6 FFFF 0000 0000"
$"0000 FFF5 ECEC ECEC F5F5 FFFF F5F5 FFFA"
$"FAFA FAFA FFF6 F6F6 F6F6 FFFF 0000 0000"
$"0000 FFF5 ECEC ECEC ECFF F5F5 F5F5 FFFA"
$"FAFA FAFA FFF6 F6F6 F6F6 FFFF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 FFFA"
$"FAFA FAFA FFF6 F6F6 F6FF F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 FFFA"
$"FAFA FAFA FFFF FFFF FFF5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 FFFA"
$"FAFA FAFF F8FF F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 FFFF"
$"FFFF FFF8 F8F8 FFF5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5FF F8F8 F8F8 F8FF F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"FFF8 F8F8 F8F8 F8F8 FFF5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5FF"
$"FFFF FFFF FFFF FFFF FFFF F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF"
};
resource 'icl8' (135) {
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF 0000 0000"
$"0000 FFF5 F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECFF 2B2B 2B2B 2B2B"
$"2B2B 2B2B 2B2B 2B2B 2B2B F5FF FFFF 0000"
$"0000 FFF5 ECEC ECEC ECFF 2BF8 F8F8 F8F8"
$"F8F8 F8F8 F8F8 F8F8 F8F8 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECFF 2BFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECFF 2BFF F5F5 05EC"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECFF 2BFF F505 05EC"
$"ECF5 F5F5 F5F5 F5F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC F5FF 2BFF 0505 05EC"
$"ECEC F5F5 FFFF FFFF F5F5 FFFF F5FF 0000"
$"0000 FFF5 ECEC ECF5 F5FF 2BFF D8D8 D8E3"
$"E3E3 F5F5 F5F5 F5F5 F5FF F5FF F5FF 0000"
$"0000 FFF5 ECEC ECF5 F5FF 2BFF F5D8 D8E3"
$"E3F5 F5FF FFFF F5FF FFF5 F5FF F5FF 0000"
$"0000 FFF5 ECEC F5F5 F5FF 2BFF F5F5 D8E3"
$"F5F5 F5F5 F5F5 FFF5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC F5F5 F5FF 2BFF F5F5 F5F5"
$"F5F5 F5F5 F5FF F5F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC F5F5 F5FF 2BFF F5FF FFF5"
$"FFFF F5FF FFF5 F5F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC F5F5 F5FF 2BFF F5FF FFF5"
$"F5F5 FFF5 F5F5 F5F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC F5F5 F5FF 2BFF F5FF FFF5"
$"FFFF F5F5 F5F5 F5F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC F5F5 F5FF 2BFF F5F5 F5FF"
$"F5F5 F5F5 FFFF FFFF F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECF5 F5FF 2BFF F5FF FFF5"
$"F5F5 F5FF F6F6 F6F6 FFF5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECF5 F5FF 2B00 FFF5 F5F5"
$"F5F5 FFF6 F6F6 2BF6 F6FF F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC F5F5 F5FF F5FF FFFF"
$"FFFF FFFF F6F6 F6F6 F6FF F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECFF FFF5 F5FF FAFA"
$"FAFA FAFF F6F6 F6F6 F6FF F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5FF FAFA"
$"FAFA FAFF F62B F6F6 F6FF F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5FF FAFA"
$"FAFA FAFF F6F6 F6F6 FFF5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5FF FAFA"
$"FAFA FAFF FFFF FFFF FFFF FFFF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5FF FAFA"
$"FAFA FFF8 FF2B 2B2B 2B2B FFF5 F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5FF FFFF"
$"FFFF F8F8 FF2B 2B2B 2BFF F5F5 F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"FFF8 F8F8 FF2B 2B2B FFF5 F5F5 F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5FF"
$"FFFF FFFF FF2B 2BFF F5F5 F5F5 F5FF 0000"
$"0000 FFF5 F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 FF2B FFF5 F5F5 F5F5 F5FF 0000"
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF F5F5 F5F5 F5F5 F5FF 0000"
$"0000 0000 FFF5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000"
$"0000 0000 FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
};
resource 'icl8' (136) {
$"0000 00FF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FF00 0000 0000 0000 0000"
$"0000 00FF F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 FFFF 0000 0000 0000 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 FFF5 F5F5"
$"F5F5 F5F5 F5F5 FF2B FF00 0000 0000 0000"
$"0000 00FF F5EC ECEC ECEC F5FF FFF5 F5F5"
$"F5F5 F5F5 F5F5 FF2B 2BFF 0000 0000 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 FFF5 F5F5"
$"F5F5 F5F5 F5F5 FF2B 2B2B FF00 0000 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 FFF5 F5F5"
$"F5F5 F5F5 F5F5 FF2B 2B2B 2BFF 0000 0000"
$"0000 00FF F5EC ECEC ECEC F5FF FFFF F5F5"
$"F5F5 F5FF FFFF FFFF FFFF FFFF FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 FFF5 F5F5"
$"F5FF FF05 05FF ECFF FFF5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 FFF5 F5F5"
$"FF05 0505 05FF ECEC ECFF F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECF5 F5FF FFF5 F5F5"
$"FF05 0505 05FF ECEC ECFF F5F5 FF00 0000"
$"0000 00FF F5EC ECEC F5F5 F5F5 FFF5 F5FF"
$"0505 0505 05FF ECEC ECEC FFF5 FF00 0000"
$"0000 00FF F5EC ECEC F5F5 F5F5 FFF5 F5FF"
$"0505 0505 05FF ECEC ECEC FFF5 FF00 0000"
$"0000 00FF F5EC ECF5 F5F5 F5FF FFFF F5FF"
$"0505 0505 FFFF FFFF FFFF FFF5 FF00 0000"
$"0000 00FF F5EC ECF5 F5F5 F5F5 FFF5 F5FF"
$"0505 05FF D813 D813 D813 FFF5 FF00 0000"
$"0000 00FF F5EC ECF5 F5F5 F5F5 FFF5 F5F5"
$"FF05 FFD8 13D8 13D8 13FF F5F5 FF00 0000"
$"0000 00FF F5EC ECF5 F5F5 F5FF FFF5 F5F5"
$"FFFF D813 D813 D813 D8FF F5C0 FF00 0000"
$"0000 00FF F5EC ECF5 F5F5 F5F5 FFF5 F5F5"
$"F5FF FFD8 13D8 13FF FFF5 C0F5 FF00 0000"
$"0000 00FF F5EC ECF5 F5F5 F5F5 FFF5 F5F5"
$"F5F5 F5FF FFFF FFF5 F5F5 C0F5 FF00 0000"
$"0000 00FF F5EC ECEC F5F5 F5FF FFFF F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5C0 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC F5F5 F5F5 FFF5 F5F5"
$"F5C0 C0F5 F5F5 F5F5 F5C0 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECF5 F5F5 FFF5 F5F5"
$"F5C0 C0F5 F5F5 F5F5 C0F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5FF FFF5 F5F5"
$"C0F5 F5C0 F5F5 F5F5 C0F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 FFF5 F5F5"
$"C0F5 F5F5 C0F5 F5C0 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 FFF5 F5C0"
$"F5F5 F5F5 F5C0 C0C0 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5FF FFF5 C0C0"
$"F5F5 F5F5 F5F5 C0C0 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 FFF5 C0C0"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 FFF5 F5F5"
$"F5F5 F5F5 F5FF F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFF5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 F5F5 F5FF"
$"F5F5 FFF5 F5FF F5F5 FFF5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FF"
};
resource 'icl8' (137) {
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF 0000 0000"
$"0000 FFF5 F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECFF FFFF F5F5 F5F5"
$"F5FF FFFF FFF5 F5F5 F5F5 F5FF FFFF 0000"
$"0000 FFF5 ECEC ECEC EC00 FFF5 F5F5 F5FF"
$"FF05 05FF ECFF FFF5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC EC00 FFF5 F5F5 FF05"
$"0505 05FF ECEC ECFF F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECFF FFF5 F5F5 FF05"
$"0505 05FF ECEC ECFF F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 FFF5 F5FF 0505"
$"0505 05FF ECEC ECEC FFF5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC F5F5 FFF5 F5FF 0505"
$"0505 05FF ECEC ECEC FFF5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECF5 F5FF FFFF F5FF 0505"
$"0505 FFFF FFFF FFFF FFF5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECF5 F5F5 FFF5 F5FF 0505"
$"05FF D813 D813 D813 FFF5 F5FF F5FF 0000"
$"0000 FFF5 ECEC F5F5 F5F5 FFF5 F5F5 FF05"
$"FFD8 13D8 13D8 13FF F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC F5F5 F5FF FFF5 F5F5 FFFF"
$"D813 D813 D813 D8FF F5C0 F5FF F5FF 0000"
$"0000 FFF5 ECEC F5F5 F5F5 FFF5 F5F5 F5FF"
$"FFD8 13D8 13FF FFF5 C0F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC F5F5 F5F5 FFF5 F5F5 F5F5"
$"F5FF FFFF FFF5 F5F5 C0F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC F5F5 F5FF FFFF F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5C0 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC F5F5 F5F5 FFF5 F5F5 F5C0"
$"C0F5 F5F5 F5F5 F5C0 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECF5 F5F5 FFF5 F5F5 F5C0"
$"C0F5 F5F5 F5F5 C0F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECF5 F5FF FFF5 F5F5 C0F5"
$"F5C0 F5F5 F5F5 C0F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC F5F5 FFF5 F5F5 C0F5"
$"F5F5 C0F5 F5C0 F5F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 FFF5 F5C0 F5F5"
$"F5F5 F5C0 C0C0 F5F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECFF FFF5 C0C0 F5F5"
$"F5F5 F5F5 C0C0 F5F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 FFF5 C0C0 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 FFF5 F5F5 F5F5"
$"F5F5 F5F5 FFFF FFFF FFFF FFF5 F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 FFFF FFFF FFFF"
$"FFFF FFFF FF2B 2B2B 2BFF F5F5 F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5FF F5F5"
$"FFF5 F5FF FF2B 2B2B FFF5 F5F5 F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 FF2B 2BFF F5F5 F5F5 F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 FF2B FFF5 F5F5 F5F5 F5FF 0000"
$"0000 FFF5 F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 FFFF F5F5 F5F5 F5F5 F5FF 0000"
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFF5 F5F5 F5F5 F5F5 F5FF 0000"
$"0000 0000 FFF5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000"
$"0000 0000 FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
};
resource 'icl8' (138) {
$"0000 00FF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FF00 0000 0000 0000 0000"
$"0000 00FF F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 FFFF 0000 0000 0000 0000"
$"0000 00FF F5EC ECEC ECEC F5FD FDFD D8D8"
$"D8D8 D8D8 D8D8 FF2B FF00 0000 0000 0000"
$"0000 00FF F5EC ECEC ECEC F5FD FDFD D8F9"
$"F9D8 F9F9 D8D8 FF2B 2BFF 0000 0000 0000"
$"0000 00FF F5EC ECEC ECEC F5FD 00FD D8D8"
$"F9F9 D8D8 D8F9 FF2B 2B2B FF00 0000 0000"
$"0000 00FF F5EC ECEC ECEC F5FD 00FD F9D8"
$"D8F9 F9D8 F9D8 FF2B 2B2B 2BFF 0000 0000"
$"0000 00FF F5EC ECEC ECEC F5FD FDFD FDFD"
$"FDFD FDFD FDFD FFFF FFFF FFFF FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5FD FDFD FDFD"
$"FDFD FDFD FDFD FDFD FDFD FDF5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5FD FDFD E3E3"
$"E3E3 E3E3 E3E3 E3E3 FDFD FDF5 FF00 0000"
$"0000 00FF F5EC ECEC ECF5 F5FD FDFD E3F9"
$"E3F9 F9F9 F9F9 F9E3 FDFD FDF5 FF00 0000"
$"0000 00FF F5EC ECEC F5F5 F5FD 00FD E3F9"
$"F9F9 F9E3 F9E3 F9E3 FD00 FDF5 FF00 0000"
$"0000 00FF F5EC ECEC F5F5 F5FD 00FD E3F9"
$"E3F9 F9E3 F9E3 E3F9 FD00 FDF5 FF00 0000"
$"0000 00FF F5EC ECF5 F5F5 F5FD FDFD E3F9"
$"E3F9 F9F9 F9F9 E3F9 FDFD FDF5 FF00 0000"
$"0000 00FF F5EC ECF5 F5F5 F5FD FDFD E3F9"
$"F9F9 E3F9 F9E3 F9E3 FDFD FDF5 FF00 0000"
$"0000 00FF F5EC ECF5 F5F5 F5FD FDFD E3F9"
$"E3E3 F9E3 F9E3 F9E3 FDFD FDF5 FF00 0000"
$"0000 00FF F5EC ECF5 F5F5 F5FD FDFD FDFD"
$"FDFD FDFD FDFD FDFD FDFD FDF5 FF00 0000"
$"0000 00FF F5EC ECF5 F5F5 F5FD 00FD FDFD"
$"FDFD FDFD FDFD FDFD FD00 FDF5 FF00 0000"
$"0000 00FF F5EC ECF5 F5F5 F5FD 00FD 2B2B"
$"2B2B 2B2B 2B2B 2B2B FD00 FDF5 FF00 0000"
$"0000 00FF F5EC ECEC F5F5 F5FD FDFD 2BF9"
$"F92B F9F9 F9F9 F92B FDFD FDF5 FF00 0000"
$"0000 00FF F5EC ECEC F5F5 F5FD FDFD 2BF9"
$"F9F9 2BF9 F9F9 F92B FDFD FDF5 FF00 0000"
$"0000 00FF F5EC ECEC ECF5 F5FD FDFD 2BF9"
$"2BF9 F92B F92B F92B FDFD FDF5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5FD FDFD 2BF9"
$"F9F9 F92B F9F9 F92B FDFD FDF5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5FD 00FD 2BF9"
$"2B2B 2BF9 F92B F92B FD00 FDF5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5FD 00FD 2BF9"
$"F92B 2BF9 F9F9 F92B FD00 FDF5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5FD FDFD FDFD"
$"FDFD FDFD FDFD FDFD FDFD FDF5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5FD FDFD FDFD"
$"FDFD FDFD FDFD FDFD FDFD FDF5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5FD FDFD 0505"
$"0505 FC05 0505 0505 FDFD FDF5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5FD FDFD 05FC"
$"FCFC FCFC 0505 FC05 FDFD FDF5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5FD F5FD 05FC"
$"05FC 05FC FC05 FCFC FDF5 FDF5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5FD F5FD 05FC"
$"05FC 0505 0505 0505 FDF5 FDF5 FF00 0000"
$"0000 00FF F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FF"
};
resource 'icl8' (139) {
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF 0000 0000"
$"0000 FFF5 F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 FDF5 FDD8 D8F9"
$"F9D8 D8D8 F9D8 D8FD F5FD F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 FDF5 FDF9 D8D8"
$"F9F9 D8F9 D8D8 D8FD F5FD F5FF FFFF 0000"
$"0000 FFF5 ECEC ECEC ECF5 FDFD FDFD FDFD"
$"FDFD FDFD FDFD FDFD FDFD F5FF 00FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 FDFD FDFD FDFD"
$"FDFD FDFD FDFD FDFD FDFD F5FF 00FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 FDFD FDE3 E3E3"
$"E3E3 E3E3 E3E3 E3FD FDFD F5FF 00FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 FDFD FDE3 F9E3"
$"F9F9 F9F9 F9F9 E3FD FDFD F5FF 00FF 0000"
$"0000 FFF5 ECEC ECEC F5F5 FD00 FDE3 F9F9"
$"F9F9 E3F9 E3F9 E3FD 00FD F5FF 00FF 0000"
$"0000 FFF5 ECEC ECF5 F5F5 FD00 FDE3 F9E3"
$"F9F9 E3F9 E3E3 F9FD 00FD F5FF 00FF 0000"
$"0000 FFF5 ECEC ECF5 F5F5 FDFD FDE3 F9E3"
$"F9F9 F9F9 F9E3 F9FD FDFD F5FF 00FF 0000"
$"0000 FFF5 ECEC F5F5 F5F5 FDFD FDE3 F9F9"
$"F9E3 F9F9 E3F9 E3FD FDFD F5FF 00FF 0000"
$"0000 FFF5 ECEC F5F5 F5F5 FDFD FDE3 F9E3"
$"E3F9 E3F9 E3F9 E3FD FDFD F5FF 00FF 0000"
$"0000 FFF5 ECEC F5F5 F5F5 FDFD FDFD FDFD"
$"FDFD FDFD FDFD FDFD FDFD F5FF 00FF 0000"
$"0000 FFF5 ECEC F5F5 F5F5 FD00 FDFD FDFD"
$"FDFD FDFD FDFD FDFD 00FD F5FF 00FF 0000"
$"0000 FFF5 ECEC F5F5 F5F5 FD00 FD2B 2B2B"
$"2B2B 2B2B 2B2B 2BFD 00FD F5FF 00FF 0000"
$"0000 FFF5 ECEC F5F5 F5F5 FDFD FD2B F9F9"
$"2BF9 F9F9 F9F9 2BFD FDFD F5FF 00FF 0000"
$"0000 FFF5 ECEC ECF5 F5F5 FDFD FD2B F9F9"
$"F92B F9F9 F9F9 2BFD FDFD F5FF 00FF 0000"
$"0000 FFF5 ECEC ECF5 F5F5 FDFD FD2B F92B"
$"F9F9 2BF9 2BF9 2BFD FDFD F5FF 00FF 0000"
$"0000 FFF5 ECEC ECEC F5F5 FDFD FD2B F9F9"
$"F9F9 2BF9 F9F9 2BFD FDFD F5FF 00FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 FD00 FD2B F92B"
$"2B2B F9F9 2BF9 2BFD 00FD F5FF 00FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 FD00 FD2B F9F9"
$"2B2B F9F9 F9F9 2BFD 00FD F5FF 00FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 FDFD FDFD FDFD"
$"FDFD FDFD FDFD FDFD FDFD F5FF 00FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 FDFD FDFD FDFD"
$"FDFD FDFD FFFF FFFF FFFF FFF5 00FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 FDFD FD05 0505"
$"05F9 0505 FF2B 2B2B 2BFF F5FD 00FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 FDFD FD05 F9F9"
$"F9F9 F905 FF2B 2B2B FFF5 FDFD 00FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 FDF5 FD05 F905"
$"F905 F9F9 FF2B 2BFF F5FD FDFD 00FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 FDF5 FD05 F905"
$"F905 0505 FF2B FFF5 05FD FDFD 00FF 0000"
$"0000 FFF5 F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 FFFF F5FC FCFD F5FD 00FF 0000"
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFF5 0505 05FD F5FD 00FF 0000"
$"0000 0000 FF00 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 00FF 0000"
$"0000 0000 FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
};
resource 'icl8' (140) {
$"0000 00FF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FF00 0000 0000 0000 0000"
$"0000 00FF F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 FFFF 0000 0000 0000 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 FF2B FF00 0000 0000 0000"
$"0000 00FF F5EC ECEC ECEC F5F9 F52B F5F5"
$"2B2B F5F5 F5F5 FF2B 2BFF 0000 0000 0000"
$"0000 00FF F5EC ECEC ECEC F52B F52B F5F9"
$"F5F5 F5F5 F5F5 FF2B 2B2B FF00 0000 0000"
$"0000 00FF F5EC ECEC ECEC F52B F52B F5F5"
$"F5E3 E3F5 F5F5 FF2B 2B2B 2BFF 0000 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 F5F5 F52B"
$"2BF5 F5F5 E3E3 FFFF FFFF FFFF FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 F5F5 F5F5"
$"F5F5 F52B 0000 2BE3 E3F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5FF FFFF FFFF"
$"FFFF FFFF FFFF FFF5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECF5 F5FF FFFF FFFF"
$"FFFF FFFF FFFF FFFF F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC F5F5 F5FF FFFF FFF5"
$"F5F5 F52B F5F5 FFFF F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC F5F9 F5F5 FFFF FFF9"
$"F5F5 F5F9 F5F5 F52B F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECF5 F5F5 F52B 00FF FFFF"
$"F5F5 F52B F5F5 F5FF F52B F5F5 FF00 0000"
$"0000 00FF F5EC ECF5 0505 0505 0500 FFFF"
$"FFF5 F5F5 2BF9 F52B F52B F5F5 FF00 0000"
$"0000 00FF F5EC ECF5 05F9 F9FF F905 00FF"
$"FFFF F5F5 F5F5 F5F5 F52B F5F5 FF00 0000"
$"0000 00FF F5EC ECF5 05FF F905 E305 0500"
$"FFFF FFF5 F5F5 F52B F5F5 2BF5 FF00 0000"
$"0000 00FF F5EC ECF5 05FF 05F9 F9F9 052B"
$"FFFF FFFF F52B F5F5 F5FF F5F5 FF00 0000"
$"0000 00FF F5EC ECF5 F5F9 0505 F905 052B"
$"00FF FFFF F5F5 F5F5 FFFF F5F5 FF00 0000"
$"0000 00FF F5EC ECEC F5F5 0505 FF05 0500"
$"0000 FFFF F5F5 2BF5 F5FF F5F5 FF00 0000"
$"0000 00FF F5EC ECEC F5F5 0505 0505 0500"
$"00FF FF2B F5F5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECF5 F5F5 F5F5 F52B"
$"FFFF F52B F5F5 2BF5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5F9 F9F5 F5FF"
$"FFF5 F5F5 F5F5 2BF5 F5F5 2BF5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5F5 F52B FFFF"
$"F5F5 F5F5 F5F5 F5F5 FFF5 2BF5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F52B F5FF FF2B"
$"F5F5 F5F5 F5F5 F5F5 FFF5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F52B FFFF F5F5"
$"F52B F5F5 2BF5 2BFF FFF5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5FF FFFF FFFF"
$"FFFF FFFF FFFF FFFF F9F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5FF FFFF FFFF"
$"FFFF FFFF FFFF FFFF 2BF5 2BF5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F52B 2BF5 F52B"
$"F5F5 2BF5 F52B 2BF5 F5F5 F5F5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5D8 D8F9 F5F5"
$"F5F5 F5F5 F5F5 F5F9 F9F5 2BF5 FF00 0000"
$"0000 00FF F5EC ECEC ECEC F5D8 D8F9 F52B"
$"F9F5 F52B F5F5 F5F9 2B2B F5F5 FF00 0000"
$"0000 00FF F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F52B F5F5 F5F5 F5F5 F5F5 FF00 0000"
$"0000 00FF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FF"
};
resource 'icl8' (141) {
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF 0000 0000"
$"0000 FFF5 F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 2BF5 2BF5 F9F5"
$"F52B F5F5 F52B F5F5 F5F5 F5FF 0000 0000"
$"0000 FFF5 ECEC ECEC ECF5 2BF5 2BF5 F5F5"
$"E3E3 F5F5 F52B 2BF5 F52B F5FF FFFF 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 2B2B"
$"F5F5 F5E3 E3F5 F5F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F5F5 F5F5"
$"F5F5 2B00 002B E3E3 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 FFFF FFFF FFFF"
$"FFFF FFFF FFFF F5F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFF5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC F5F5 FFFF FFFF F5F5"
$"F5F5 2BF5 F5FF FFF5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECF5 2BF5 F5FF FFFF F9F5"
$"F5F5 F9F5 F5F5 2BF5 2BF5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECF5 2BF5 2BF5 FFFF FFF5"
$"F5F5 2BF5 F5F5 FFF5 2BF5 F5FF F5FF 0000"
$"0000 FFF5 ECEC F5F5 F5F5 F5F5 F5FF FFFF"
$"F5F5 F52B F9F5 2BF5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC F505 0505 0505 F5FF FFFF"
$"FFF5 F5F5 F5F5 F5F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC F505 F9F9 FFF9 0500 00FF"
$"FFFF F5F5 F5F5 2BF5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC F505 FFF9 0505 0505 2BFF"
$"FFFF FFF5 2BF5 F5F5 2BF5 F5FF F5FF 0000"
$"0000 FFF5 ECEC F505 FF05 F9F9 F905 2B00"
$"FFFF FFF5 F5F5 F5FF 2BF5 F5FF F5FF 0000"
$"0000 FFF5 ECEC F5F5 F905 05F9 0505 0000"
$"00FF FFF5 F52B F5F5 F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECF5 F505 05FF 0505 0000"
$"FFFF 2BF5 F5F5 F5F5 F52B F5FF F5FF 0000"
$"0000 FFF5 ECEC ECF5 F5F5 F5F5 F5F5 2BFF"
$"FFF5 2BF5 F52B F5F5 F52B F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC F5F5 F5F5 F5F5 FFFF"
$"F5F5 F5F5 F52B F5F5 F52B F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 2BFF FFF5"
$"F5F5 2BF5 F5F5 F5FF F52B F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 2BF5 FFFF 2BF5"
$"F5F5 F5F5 F5F5 F5FF F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 2BFF FFF5 F5F5"
$"2BF5 F52B F52B FFFF F5F5 F5FF F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFF5 F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 FFFF FFFF FFFF"
$"FFFF FFFF FF2B 2B2B 2BFF F5F5 F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 F5F5 F500 F5F5"
$"F5F5 F5F5 FF2B 2B2B FFF5 F5F5 F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 D8D8 F52B 2BF5"
$"F52B F5F5 FF2B 2BFF F5F5 F5F5 F5FF 0000"
$"0000 FFF5 ECEC ECEC ECF5 D8D8 2BF5 2BF5"
$"F5F5 F5F5 FF2B FFF5 F5F5 F5F5 F5FF 0000"
$"0000 FFF5 F5F5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 FFFF F5F5 F5F5 F5F5 F5FF 0000"
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFF5 F5F5 F5F5 F5F5 F5FF 0000"
$"0000 0000 FFF5 F5F5 F5F5 F5F5 F5F5 F5F5"
$"F5F5 F5F5 F5F5 F5F5 F5F5 F5F5 F5FF 0000"
$"0000 0000 FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
};
resource 'icl8' (142) {
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"F0EF F0EF F000 0000 0000 0000 0000 0000"
$"FA00 0000 0000 0000 0000 0000 0000 0000"
$"F0EF F0EF F000 0000 0000 0000 0000 00FA"
$"D2FA 0000 0000 0000 0000 0000 0000 0000"
$"EFF0 EFF0 EF00 0000 0000 0000 0000 FA00"
$"F9D2 FA00 0000 0000 0000 0000 0000 0000"
$"F0EF F0EF F000 0000 0000 0000 00FA 0000"
$"00FA D2FA 0000 0000 0000 0000 0000 0000"
$"EFF0 EFF0 EF00 0000 0000 0000 FAFF 0000"
$"FA00 57D2 FA00 0000 0000 0000 0000 0000"
$"EFF0 EFF0 EF00 0000 0000 00FA FF00 F7F9"
$"00FF 00F9 D2FA 0000 0000 0000 0000 0000"
$"F0EF F0EF F000 0000 0000 FA00 00FA F900"
$"FA00 00FA F9D2 FA00 0000 0000 0000 0000"
$"EFF0 EFF0 EF00 0000 007B FF00 00F9 0000"
$"00F9 00FF 00FA D2FA 0000 0000 0000 0000"
$"F0EF F0EF F000 0000 FA00 002B FA00 0000"
$"0000 FA00 0000 F9D2 FA00 0000 0000 0000"
$"EFF0 EFF0 EF00 00F9 0000 00FA 0000 0000"
$"0000 00F9 0000 00FA D2FA 0000 0000 0000"
$"F0EF F0EF F000 F9FF 0000 FA00 0000 0000"
$"0000 0000 FA00 FFF9 F9D2 FA00 0000 0000"
$"EFF0 EFF0 EFF9 0000 F7F9 0000 0000 0000"
$"0000 0000 00F9 00FF 00F9 D2FA 0000 0000"
$"F0EF EFF0 F9FF 0000 F900 0000 0000 F9FA"
$"00F9 FAF9 FA00 FA00 00FA F9D2 FA00 0000"
$"EFF0 F0F9 0000 00FA 0000 0000 FAF9 00F9"
$"FA00 F9FA FFF9 F9FA 00FF 00FA D2FA 0000"
$"EFF0 F9FF 0000 FA00 0000 00F9 00FA 00C9"
$"00D2 00D2 C2EF F0F0 F900 0000 F9D2 7B00"
$"F0F9 0000 00FA 0000 00FA 00D2 0000 C200"
$"05E6 E5E6 D2E5 EFEF F0F9 0000 00FA D2FA"
$"EFEF FA00 FA00 0000 F9D2 0000 D2F9 E6E6"
$"05E5 E6E5 E5E6 E6E5 EFF0 FA00 0000 F900"
$"F0EF EFF9 0000 00FA FA00 C300 FAE6 E505"
$"0505 E5D2 D2E5 E5F9 E6E5 EFF9 00FA 8C00"
$"F0EF F0F0 FA00 F900 00D2 00F9 E505 0505"
$"0505 0505 E5D2 E6E6 E5EF F0FF F98C 0000"
$"EFF0 EFEF F0F9 FA00 F9D2 FAD2 C8E5 E505"
$"0505 E6E5 E6E5 E6EF E6E5 E6FF FF00 0000"
$"EFF0 EFF0 EFFA 0000 D2FA 00C2 E5E5 E6E6"
$"05E6 D2E6 E5E6 E5E5 E5E6 FFE5 F000 0000"
$"F0EF F0EF F0F9 FAF9 0000 E6E6 E5E6 E5E5"
$"05E5 E6D2 E6E5 E6EF E5EF E5FF F0FF 0000"
$"EFF0 EFF0 F900 00FA D2C2 C9C2 E6E5 D2E5"
$"E6D2 D2D2 E5E5 E6E5 E6E5 FFEF E5FF 0000"
$"F0EF F0EF 00FA 00D2 F9EB D2C9 E5D2 D2E6"
$"D2D2 D2E5 E6E6 E5E6 EFE6 E5E6 EFFF 0000"
$"EFF0 EFEF FAF9 D200 D2D2 D2D2 D2D2 D2D2"
$"E5E6 E5E6 E5E5 E6E5 E6E5 F0EF F0FF 0000"
$"F0EF F0F0 00D2 00D2 D2D2 D2E5 E5E6 E5E6"
$"D2E5 D2E5 E6E5 E5E6 EFE5 EFE5 EFFF 0000"
$"EFF0 EFF0 F900 D2D2 D2D2 E5E5 E6E5 E6E5"
$"E5D2 E5E6 E5E6 E5E6 E5EF E5FF EFFF 0000"
$"EFEF F0EF 00D2 00D2 D2E5 E6E6 E5E6 E5E6"
$"E6D2 D2E5 E6E5 E6E5 EFF0 FFE5 FFFF 0000"
$"F0F0 EFF0 FAF9 D2D2 D2E6 E5E5 E6E5 E6E5"
$"E5D2 D2E5 E6E5 E6E5 F0E6 E5EF FFFF 0000"
$"EFEF F0EF F000 F0D2 D2D2 E6E5 E6E5 E6E5"
$"E6D2 D2D2 E5E6 EFE6 EFF0 EFFF FF00 0000"
$"F0F0 EFF0 EFFA C2F0 EFD2 D2D2 E5E6 E5E6"
$"D2D2 F0D2 D2EF F0EF F0EF FFFF FF"
};
resource 'icl4' (128) {
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"6666 6000 0000 0000 D000 0000 0000 0000"
$"6666 6000 0000 000D 6D00 0000 0000 0000"
$"6666 6000 0000 00D0 D6D0 0000 0000 0000"
$"6666 6000 0000 0D00 0D6D 0000 0000 0000"
$"6666 6000 0000 DF00 D0D6 D000 0000 0000"
$"6666 6000 000D F0CD 0F0D 6D00 0000 0000"
$"6666 6000 00D0 0DD0 D00D D6D0 0000 0000"
$"6666 6000 0DF0 0D00 0D0F 0D6D 0000 0000"
$"6666 6000 D00C D000 00D0 00D6 D000 0000"
$"6666 600D 000D 0000 000D 000D 6D00 0000"
$"6666 60DF 00D0 0000 0000 D0FD D6D0 0000"
$"6666 6D00 CD00 0000 0000 0D0F 0D6D 0000"
$"6666 DF00 D000 00DD 0DDD D0D0 0DD6 D000"
$"666D 000D 0000 DD0D D0DD FDDD 0F0D 6D00"
$"66DF 00D0 000D 0D09 0606 7666 D000 D6D0"
$"6D00 0D00 0D06 0070 1999 6966 6D00 0D6D"
$"66D0 D000 D600 6D99 1999 9999 66D0 00D0"
$"666D 000D D080 D991 1196 699D 996D 0D50"
$"6666 D0D0 060D 9111 1111 9699 966F D500"
$"6666 6DD0 D6D6 9991 1199 9996 999F F000"
$"6666 6D00 6D07 9999 1969 9999 99F9 6000"
$"6666 6DDD 0099 9999 1996 9996 969F 6F00"
$"6666 D00D 6797 9969 9666 9999 99F6 9F00"
$"6666 0D06 D669 9669 6669 9999 6999 6F00"
$"6666 DD60 6666 6666 9999 9999 9966 6F00"
$"6666 0606 6669 9999 6969 9999 6969 6F00"
$"6666 D066 6699 9999 9699 9999 969F 6F00"
$"6666 0606 6999 9999 9669 9999 66F9 FF00"
$"6666 DD66 6999 9999 9669 9999 6996 FF00"
$"6666 6066 6699 9999 9666 9969 666F F000"
$"6666 6D76 6666 9999 6666 6666 66FF F0"
};
resource 'icl4' (129) {
$"000F FFFF FFFF FFFF FFFF FFF0 0000 0000"
$"000F 0000 0000 0000 0000 00FF 0000 0000"
$"000F 0666 6600 0000 0000 00FC F000 0000"
$"000F 0666 6600 0000 0000 00FC CF00 0000"
$"000F 0666 6600 0000 0000 00FC CCF0 0000"
$"000F 0666 6600 FF0F 0FFF FFFC CCCF 0000"
$"000F 0666 6600 0000 0000 00FF FFFF F000"
$"000F 0666 660F FFF0 0FFF 0FF0 F000 F000"
$"000F 0666 6600 0000 0000 0000 0000 F000"
$"000F 0666 60F0 FF0F 0FF0 F0FF 0F00 F000"
$"000F 0666 0000 0000 0000 0000 0000 F000"
$"000F 0666 0F0F FF0F FF0F 0FFF 0F00 F000"
$"000F 0660 0000 0000 0000 0000 0000 F000"
$"000F 0660 FF0F 0FFF 0FF0 FF0F FF00 F000"
$"000F 0660 0000 0000 0000 0000 0000 F000"
$"000F 0660 F0FF FFF0 FFFF 0FF0 FF00 F000"
$"000F 0660 0000 0000 0000 0000 0000 F000"
$"000F 0660 FF0F FF0F F0FF F0FF 0000 F000"
$"000F 0666 0000 0000 0000 0000 0000 F000"
$"000F 0666 0FFF 0FF0 F0F0 F0F0 FF00 F000"
$"000F 0666 6000 0000 0000 0000 0000 F000"
$"000F 0666 660F F0FF F0FF FF0F 0F00 F000"
$"000F 0666 6600 0000 0000 0000 0000 F000"
$"000F 0666 660F 0FF0 FFFF 0FF0 FF00 F000"
$"000F 0666 6600 0000 0000 0000 0000 F000"
$"000F 0666 660F FF00 FFF0 FFF0 0F00 F000"
$"000F 0666 6600 0000 0000 0000 0000 F000"
$"000F 0666 660F FF0F 0FFF 00FF 0F00 F000"
$"000F 0666 6600 0000 0000 0000 0000 F000"
$"000F 0666 6600 0000 0000 0000 0000 F000"
$"000F 0000 0000 0000 0000 0000 0000 F000"
$"000F FFFF FFFF FFFF FFFF FFFF FFFF F0"
};
resource 'icl4' (130) {
$"00FF FFFF FFFF FFFF FFFF FFFF FFFF 0000"
$"00F0 0000 0000 0000 0000 0000 000F 0000"
$"00F0 6666 6000 0000 0000 0000 000F 0000"
$"00F0 6666 6000 0000 0000 0000 000F FF00"
$"00F0 6666 6000 0000 0000 0000 000F 0F00"
$"00F0 6666 6F0F F0FF FF0F FF0F 000F 0F00"
$"00F0 6666 6000 0000 0000 0000 000F 0F00"
$"00F0 6666 600F FF0F 0FF0 FF0F 000F 0F00"
$"00F0 6666 0000 0000 0000 0000 000F 0F00"
$"00F0 6660 F0FF 0F0F FF0F 0FF0 F00F 0F00"
$"00F0 6660 0000 0000 0000 0000 000F 0F00"
$"00F0 660F F0FF FF0F FFF0 FFF0 000F 0F00"
$"00F0 6600 0000 0000 0000 0000 000F 0F00"
$"00F0 6600 F0FF 0FFF F00F F0FF F00F 0F00"
$"00F0 6600 0000 0000 0000 0000 000F 0F00"
$"00F0 660F FF0F FF00 FF0F FF0F F00F 0F00"
$"00F0 6600 0000 0000 0000 0000 000F 0F00"
$"00F0 6660 FF0F FFFF 00FF 0FF0 000F 0F00"
$"00F0 6660 0000 0000 0000 0000 000F 0F00"
$"00F0 6666 0FF0 FFF0 FFFF 0F0F F00F 0F00"
$"00F0 6666 6000 0000 0000 0000 000F 0F00"
$"00F0 6666 6FF0 0FFF 0FFF F0F0 F00F 0F00"
$"00F0 6666 6000 0000 0000 0000 000F 0F00"
$"00F0 6666 6F0F FFF0 0FF0 FFFF FFF0 0F00"
$"00F0 6666 6000 0000 0000 FCCC CF00 0F00"
$"00F0 6666 6F00 FF0F F0F0 FCCC F0F0 0F00"
$"00F0 6666 6000 0000 0000 FCCF 0000 0F00"
$"00F0 6666 60FF 0FFF 0FF0 FCF0 F0F0 0F00"
$"00F0 0000 0000 0000 0000 FF00 0000 0F00"
$"00FF FFFF FFFF FFFF FFFF F000 0000 0F00"
$"0000 F000 0000 0000 0000 0000 0000 0F00"
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF FF"
};
resource 'icl4' (131) {
$"00FF FFFF FFFF FFFF FFFF FF00 0000 0000"
$"00F0 0000 0000 0000 0000 0FF0 0000 0000"
$"00F0 6666 6000 0000 0000 0FCF 0000 0000"
$"00F0 6666 6000 0000 0000 0FCC F000 0000"
$"00F0 6666 6000 0000 0000 0FCC CF00 0000"
$"00F0 6666 6000 0000 0000 0FCC CCF0 0000"
$"00F0 6666 6000 0000 0000 0FFF FFFF 0000"
$"00F0 6666 6000 0000 0000 0000 000F 0000"
$"00F0 6666 6000 0000 0000 0000 000F 0000"
$"00F0 6666 0000 0000 0000 0000 000F 0000"
$"00F0 6660 0000 0000 0000 0000 000F 0000"
$"00F0 666F FF0F FF0F FF0F F0FF 000F 0000"
$"00F0 6600 0000 0000 0000 0000 000F 0000"
$"00F0 6600 0000 0000 0000 0000 000F 0000"
$"00F0 660F FF0F FFF0 FFFF 0FFF 000F 0000"
$"00F0 6600 0000 0000 0000 0000 000F 0000"
$"00F0 6600 0000 0000 0000 0000 000F 0000"
$"00F0 660F F0FF FFFF F0FF F0FF 000F 0000"
$"00F0 6660 0000 0000 0000 0000 000F 0000"
$"00F0 6660 0000 0000 0000 0000 000F 0000"
$"00F0 6666 0000 0000 0000 0000 000F 0000"
$"00F0 6666 6000 0000 0000 0000 000F 0000"
$"00F0 6666 6000 0000 0000 0000 000F 0000"
$"00F0 6666 6000 0000 0000 0000 000F 0000"
$"00F0 6666 6000 0000 0000 0000 000F 0000"
$"00F0 6666 6000 0000 0000 0000 000F 0000"
$"00F0 6666 6000 0000 0000 0000 000F 0000"
$"00F0 6666 6000 0000 0000 0000 000F 0000"
$"00F0 6666 6000 0000 0000 0000 000F 0000"
$"00F0 6666 6000 0000 0000 0000 000F 0000"
$"00F0 0000 0000 0000 0000 0000 000F 0000"
$"00FF FFFF FFFF FFFF FFFF FFFF FFFF"
};
resource 'icl4' (132) {
$"000F FFFF FFFF FFFF FFFF FFF0 0000 0000"
$"000F 0000 0000 0000 0000 00FF 0000 0000"
$"000F 0666 66FF 070F FFF0 70FC F000 0000"
$"000F 0666 6600 0700 0000 70FC CF00 0000"
$"000F 0666 6677 70FF FFFF 0FFC CCF0 0000"
$"000F 0666 6600 0F00 0000 F0FC CCCF 0000"
$"000F 0666 6600 0F00 0000 F0FF FFFF F000"
$"000F 0666 6600 0F00 0000 F000 0000 F000"
$"000F 0666 6677 70FF FFFF 0FFF FFFF F000"
$"000F 0666 6000 0F00 0000 F000 0000 F000"
$"000F 0666 00FF 0F00 0000 F000 0000 F000"
$"000F 0666 0000 0F00 0000 F000 0000 F000"
$"000F 0660 7777 70FF FFFF 0FFF FFFF F000"
$"000F 0660 0000 0F00 0000 F000 0000 F000"
$"000F 0660 0FFF 0F00 0000 F000 0000 F000"
$"000F 0660 0000 0F00 0000 F000 0000 F000"
$"000F 0660 7777 70FF FFFF 0FFF FFFF F000"
$"000F 0660 0000 0F00 0000 F000 0000 F000"
$"000F 0666 00FF 0F00 0000 F000 0000 F000"
$"000F 0666 0000 0F00 0000 F000 0000 F000"
$"000F 0666 6777 70FF FFFF 0FFF FFFF F000"
$"000F 0666 6600 0F00 0000 F000 0000 F000"
$"000F 0666 660F 0F00 0000 F000 0000 F000"
$"000F 0666 6600 0F00 0000 F000 0000 F000"
$"000F 0666 6677 70FF FFFF 0FFF FFFF F000"
$"000F 0666 6600 0F00 0000 F000 0000 F000"
$"000F 0666 660F 0F00 0000 F000 0000 F000"
$"000F 0666 6600 0F00 0000 F000 0000 F000"
$"000F 0666 6677 70FF FFFF 0FFF FFFF F000"
$"000F 0666 6600 0F00 0000 F000 0000 F000"
$"000F 0000 0000 0000 0000 0000 0000 F000"
$"000F FFFF FFFF FFFF FFFF FFFF FFFF F0"
};
resource 'icl4' (133) {
$"00FF FFFF FFFF FFFF FFFF FFFF FFFF 0000"
$"00F0 0000 0000 0000 0000 0000 000F 0000"
$"00F0 6666 6000 070F FFF0 70FF FF0F 0000"
$"00F0 6666 6000 0700 0000 7000 000F FF00"
$"00F0 6666 6777 70FF FFFF 0FFF FFFF 0F00"
$"00F0 6666 6000 0F00 0000 F000 000F 0F00"
$"00F0 6666 600F 0F00 0000 F000 000F 0F00"
$"00F0 6666 6000 0F00 0000 F000 000F FF00"
$"00F0 6666 7777 70FF FFFF 0FFF FFFF 0F00"
$"00F0 6660 0000 0F00 0000 F000 000F 0F00"
$"00F0 6660 0FFF 0F00 0000 F000 000F 0F00"
$"00F0 6600 0000 0F00 0000 F000 000F FF00"
$"00F0 6607 7777 70FF FFFF 0FFF FFFF 0F00"
$"00F0 6600 0000 0F00 0000 F000 000F 0F00"
$"00F0 6600 FFFF 0F00 0000 F000 000F 0F00"
$"00F0 6600 0000 0F00 0000 F000 000F FF00"
$"00F0 6607 7777 70FF FFFF 0FFF FFFF 0F00"
$"00F0 6660 0000 0F00 0000 F000 000F 0F00"
$"00F0 6660 0FFF 0F00 0000 F000 000F 0F00"
$"00F0 6666 0000 0F00 0000 F000 000F FF00"
$"00F0 6666 6777 70FF FFFF 0FFF FFFF 0F00"
$"00F0 6666 6000 0F00 0000 F000 000F 0F00"
$"00F0 6666 600F 0F00 0000 F000 000F 0F00"
$"00F0 6666 6000 0F00 0000 FFFF FFF0 FF00"
$"00F0 6666 6777 70FF FFFF F000 0F00 0F00"
$"00F0 6666 6000 0F00 0000 F000 F000 0F00"
$"00F0 6666 600F 0F00 0000 F00F 0000 0F00"
$"00F0 6666 6000 0F00 0000 F0F0 FFFF FF00"
$"00F0 0000 0000 0000 0000 FF00 0000 0F00"
$"00FF FFFF FFFF FFFF FFFF F0F0 0000 0F00"
$"0000 F000 0000 0000 0000 0000 0000 0F00"
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF FF"
};
resource 'icl4' (134) {
$"00FF FFFF FFFF FFFF FFFF FF00 0000 0000"
$"00F0 0000 0000 0000 0000 0FF0 0000 0000"
$"00F0 6666 6FFF FFFF FFFF FF0F 0000 0000"
$"00F0 6666 6FCC CCCC CCCC CF00 F000 0000"
$"00F0 6666 6FCD DDDD DDDD DF00 0F00 0000"
$"00F0 6666 6FCD FFFF FFFF FF00 00F0 0000"
$"00F0 6666 6FCD F001 6000 0FFF FFFF 0000"
$"00F0 6666 6FCD F011 6600 0000 000F 0000"
$"00F0 6666 6FCD F111 6660 0FFF F00F 0000"
$"00F0 6666 0FCD F333 8880 0000 00FF 0000"
$"00F0 6660 0FCD F033 8800 FFF0 FF0F 0000"
$"00F0 6660 0FCD F003 8000 000F 000F 0000"
$"00F0 6600 0FCD F000 0000 00F0 000F 0000"
$"00F0 6600 0FCD F0FF 0FF0 FF00 000F 0000"
$"00F0 6600 0FCD F0FF 000F 0000 000F 0000"
$"00F0 6600 0FCD F0FF 0FF0 0000 000F 0000"
$"00F0 6600 0FCD F000 F000 0FFF F00F 0000"
$"00F0 6600 0FCD F0FF 0000 F0C0 CF0F 0000"
$"00F0 6660 0FCD 0F00 000F 0C0C 0CFF 0000"
$"00F0 6660 0F00 F0FF FFFF F0C0 C0FF 0000"
$"00F0 6666 00FF 00FD DDDD FC0C 0CFF 0000"
$"00F0 6666 6F00 00FD DDDD F0C0 C0FF 0000"
$"00F0 6666 6000 00FD DDDD FC0C 0F0F 0000"
$"00F0 6666 6000 00FD DDDD FFFF F00F 0000"
$"00F0 6666 6000 00FD DDDF CF00 000F 0000"
$"00F0 6666 6000 00FF FFFC DCF0 000F 0000"
$"00F0 6666 6000 0000 0FCD CDCF 000F 0000"
$"00F0 6666 6000 0000 FCDC DCDC F00F 0000"
$"00F0 6666 6000 000F FFFF FFFF FF0F 0000"
$"00F0 6666 6000 0000 0000 0000 000F 0000"
$"00F0 0000 0000 0000 0000 0000 000F 0000"
$"00FF FFFF FFFF FFFF FFFF FFFF FFFF"
};
resource 'icl4' (135) {
$"00FF FFFF FFFF FFFF FFFF FFFF FFFF 0000"
$"00F0 0000 0000 0000 0000 0000 000F 0000"
$"00F0 6666 6FFF FFFF FFFF FFFF FF0F 0000"
$"00F0 6666 6FCC CCCC CCCC CCCC CC0F FF00"
$"00F0 6666 6FCC CCCC CCCC CCCC CC0F 0F00"
$"00F0 6666 6FCF FFFF FFFF FFFF FF0F 0F00"
$"00F0 6666 6FCF 0016 0000 0000 000F 0F00"
$"00F0 6666 6FCF 0116 6000 0000 000F 0F00"
$"00F0 6666 0FCF 1116 6600 FFFF 00FF 0F00"
$"00F0 6660 0FCF 3338 8800 0000 0F0F 0F00"
$"00F0 6660 0FCF 0338 800F FF0F F00F 0F00"
$"00F0 6600 0FCF 0038 0000 00F0 000F 0F00"
$"00F0 6600 0FCF 0000 0000 0F00 000F 0F00"
$"00F0 6600 0FCF 0FF0 FF0F F000 000F 0F00"
$"00F0 6600 0FCF 0FF0 00F0 0000 000F 0F00"
$"00F0 6600 0FCF 0FF0 FF00 0000 000F 0F00"
$"00F0 6600 0FCF 000F 0000 FFFF 000F 0F00"
$"00F0 6660 0FCF 0FF0 000F 0C0C F00F 0F00"
$"00F0 6660 0FC0 F000 00F0 C0C0 CF0F 0F00"
$"00F0 6666 000F 0FFF FFFF 0C0C 0F0F 0F00"
$"00F0 6666 6FF0 0FDD DDDF C0C0 CF0F 0F00"
$"00F0 6666 6000 0FDD DDDF 0C0C 0F0F 0F00"
$"00F0 6666 6000 0FDD DDDF C0C0 F00F 0F00"
$"00F0 6666 6000 0FDD DDDF FFFF FFFF 0F00"
$"00F0 6666 6000 0FDD DDFC F000 00F0 0F00"
$"00F0 6666 6000 0FFF FFCD F000 0F00 0F00"
$"00F0 6666 6000 0000 FCDC F000 F000 0F00"
$"00F0 6666 6000 000F FFFF F00F 0000 0F00"
$"00F0 0000 0000 0000 0000 F0F0 0000 0F00"
$"00FF FFFF FFFF FFFF FFFF FF00 0000 0F00"
$"0000 F000 0000 0000 0000 0000 0000 0F00"
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF FF"
};
resource 'icl4' (136) {
$"000F FFFF FFFF FFFF FFFF FFF0 0000 0000"
$"000F 0000 0000 0000 0000 00FF 0000 0000"
$"000F 0666 6600 F000 0000 00FC F000 0000"
$"000F 0666 660F F000 0000 00FC CF00 0000"
$"000F 0666 6600 F000 0000 00FC CCF0 0000"
$"000F 0666 6600 F000 0000 00FC CCCF 0000"
$"000F 0666 660F FF00 000F FFFF FFFF F000"
$"000F 0666 6600 F000 0FF1 1F6F F000 F000"
$"000F 0666 6600 F000 F111 1F66 6F00 F000"
$"000F 0666 600F F000 F111 1F66 6F00 F000"
$"000F 0666 0000 F00F 1111 1F66 66F0 F000"
$"000F 0666 0000 F00F 1111 1F66 66F0 F000"
$"000F 0660 000F FF0F 1111 FFFF FFF0 F000"
$"000F 0660 0000 F00F 111F 3C3C 3CF0 F000"
$"000F 0660 0000 F000 F1F3 C3C3 CF00 F000"
$"000F 0660 000F F000 FF3C 3C3C 3F07 F000"
$"000F 0660 0000 F000 0FF3 C3CF F070 F000"
$"000F 0660 0000 F000 000F FFF0 0070 F000"
$"000F 0666 000F FF00 0000 0000 0700 F000"
$"000F 0666 0000 F000 0770 0000 0700 F000"
$"000F 0666 6000 F000 0770 0000 7000 F000"
$"000F 0666 660F F000 7007 0000 7000 F000"
$"000F 0666 6600 F000 7000 7007 0000 F000"
$"000F 0666 6600 F007 0000 0777 0000 F000"
$"000F 0666 660F F077 0000 0077 0000 F000"
$"000F 0666 6600 F077 0000 0000 0000 F000"
$"000F 0666 6600 F000 0000 0F00 0000 F000"
$"000F 0666 6600 FFFF FFFF FFFF FFF0 F000"
$"000F 0666 6600 000F 00F0 0F00 F000 F000"
$"000F 0666 6600 0000 0000 0000 0000 F000"
$"000F 0000 0000 0000 0000 0000 0000 F000"
$"000F FFFF FFFF FFFF FFFF FFFF FFFF F0"
};
resource 'icl4' (137) {
$"00FF FFFF FFFF FFFF FFFF FFFF FFFF 0000"
$"00F0 0000 0000 0000 0000 0000 000F 0000"
$"00F0 6666 6000 0000 0000 0000 000F 0000"
$"00F0 6666 6FFF 0000 0FFF F000 000F FF00"
$"00F0 6666 60F0 000F F11F 6FF0 000F 0F00"
$"00F0 6666 60F0 00F1 111F 666F 000F 0F00"
$"00F0 6666 6FF0 00F1 111F 666F 000F 0F00"
$"00F0 6666 60F0 0F11 111F 6666 F00F 0F00"
$"00F0 6666 00F0 0F11 111F 6666 F00F 0F00"
$"00F0 6660 0FFF 0F11 11FF FFFF F00F 0F00"
$"00F0 6660 00F0 0F11 1F3C 3C3C F00F 0F00"
$"00F0 6600 00F0 00F1 F3C3 C3CF 000F 0F00"
$"00F0 6600 0FF0 00FF 3C3C 3C3F 070F 0F00"
$"00F0 6600 00F0 000F F3C3 CFF0 700F 0F00"
$"00F0 6600 00F0 0000 0FFF F000 700F 0F00"
$"00F0 6600 0FFF 0000 0000 0007 000F 0F00"
$"00F0 6600 00F0 0007 7000 0007 000F 0F00"
$"00F0 6660 00F0 0007 7000 0070 000F 0F00"
$"00F0 6660 0FF0 0070 0700 0070 000F 0F00"
$"00F0 6666 00F0 0070 0070 0700 000F 0F00"
$"00F0 6666 60F0 0700 0007 7700 000F 0F00"
$"00F0 6666 6FF0 7700 0000 7700 000F 0F00"
$"00F0 6666 60F0 7700 0000 0000 000F 0F00"
$"00F0 6666 60F0 0000 0000 FFFF FFF0 0F00"
$"00F0 6666 60FF FFFF FFFF FCCC CF00 0F00"
$"00F0 6666 6000 0F00 F00F FCCC F000 0F00"
$"00F0 6666 6000 0000 0000 FCCF 0000 0F00"
$"00F0 6666 6000 0000 0000 FCF0 0000 0F00"
$"00F0 0000 0000 0000 0000 FF00 0000 0F00"
$"00FF FFFF FFFF FFFF FFFF F000 0000 0F00"
$"0000 F000 0000 0000 0000 0000 0000 0F00"
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF FF"
};
resource 'icl4' (138) {
$"000F FFFF FFFF FFFF FFFF FFF0 0000 0000"
$"000F 0000 0000 0000 0000 00FF 0000 0000"
$"000F 0666 660E FE33 3333 33FC F000 0000"
$"000F 0666 660F EF3D D3DD 33FC CF00 0000"
$"000F 0666 660E 0E33 DD33 3DFC CCF0 0000"
$"000F 0666 660F 0FD3 3DD3 D3FC CCCF 0000"
$"000F 0666 660E FEFE FEFE FEFF FFFF F000"
$"000F 0666 660F EFEF EFEF EFEF EFE0 F000"
$"000F 0666 660E FE88 8888 8888 FEF0 F000"
$"000F 0666 600F EF8D 8DDD DDD8 EFE0 F000"
$"000F 0666 000E 0E8D DDD8 D8D8 F0F0 F000"
$"000F 0666 000F 0F8D 8DD8 D88D E0E0 F000"
$"000F 0660 000E FE8D 8DDD DD8D FEF0 F000"
$"000F 0660 000F EF8D DD8D D8D8 EFE0 F000"
$"000F 0660 000E FE8D 88D8 D8D8 FEF0 F000"
$"000F 0660 000F EFEF EFEF EFEF EFE0 F000"
$"000F 0660 000E 0EFE FEFE FEFE F0F0 F000"
$"000F 0660 000F 0FCC CCCC CCCC E0E0 F000"
$"000F 0666 000E FECD DCDD DDDC FEF0 F000"
$"000F 0666 000F EFCD DDCD DDDC EFE0 F000"
$"000F 0666 600E FECD CDDC DCDC FEF0 F000"
$"000F 0666 660F EFCD DDDC DDDC EFE0 F000"
$"000F 0666 660E 0ECD CCCD DCDC F0F0 F000"
$"000F 0666 660F 0FCD DCCD DDDC E0E0 F000"
$"000F 0666 660E FEFE FEFE FEFE FEF0 F000"
$"000F 0666 660F EFEF EFEF EFEF EFE0 F000"
$"000F 0666 660E FE11 11F1 1111 FEF0 F000"
$"000F 0666 660F EF1F EFEF 11E1 EFE0 F000"
$"000F 0666 660E 0E1E 1E1E F1FE F0F0 F000"
$"000F 0666 660F 0F1F 1F11 1111 E0E0 F000"
$"000F 0000 0000 0000 0000 0000 0000 F000"
$"000F FFFF FFFF FFFF FFFF FFFF FFFF F0"
};
resource 'icl4' (139) {
$"00FF FFFF FFFF FFFF FFFF FFFF FFFF 0000"
$"00F0 0000 0000 0000 0000 0000 000F 0000"
$"00F0 6666 60F0 F33D D333 D33E 0E0F 0000"
$"00F0 6666 60E0 ED33 DD3D 333F 0F0F FF00"
$"00F0 6666 60FE FEFE FEFE FEFE FE0F 0F00"
$"00F0 6666 60EF EFEF EFEF EFEF EF0F 0F00"
$"00F0 6666 60FE F888 8888 888E FE0F 0F00"
$"00F0 6666 60EF E8D8 DDDD DD8F EF0F 0F00"
$"00F0 6666 00F0 F8DD DD8D 8D8E 0E0F 0F00"
$"00F0 6660 00E0 E8D8 DD8D 88DF 0F0F 0F00"
$"00F0 6660 00FE F8D8 DDDD D8DE FE0F 0F00"
$"00F0 6600 00EF E8DD D8DD 8D8F EF0F 0F00"
$"00F0 6600 00FE F8D8 8D8D 8D8E FE0F 0F00"
$"00F0 6600 00EF EFEF EFEF EFEF EF0F 0F00"
$"00F0 6600 00F0 FEFE FEFE FEFE 0E0F 0F00"
$"00F0 6600 00E0 ECCC CCCC CCCF 0F0F 0F00"
$"00F0 6600 00FE FCDD CDDD DDCE FE0F 0F00"
$"00F0 6660 00EF ECDD DCDD DDCF EF0F 0F00"
$"00F0 6660 00FE FCDC DDCD CDCE FE0F 0F00"
$"00F0 6666 00EF ECDD DDCD DDCF EF0F 0F00"
$"00F0 6666 60F0 FCDC CCDD CDCE 0E0F 0F00"
$"00F0 6666 60E0 ECDD CCDD DDCF 0F0F 0F00"
$"00F0 6666 60FE FEFE FEFE FEFE FE0F 0F00"
$"00F0 6666 60EF EFEF EFEF FFFF FFF0 0F00"
$"00F0 6666 60FE F111 1D11 FCCC CF0E 0F00"
$"00F0 6666 60EF E1DD DDD1 FCCC F0EF 0F00"
$"00F0 6666 60F0 F1D1 D1DD FCCF 0EFE 0F00"
$"00F0 6666 60E0 E1D1 D111 FCF0 1FEF 0F00"
$"00F0 0000 0000 0000 0000 FF0E EE0E 0F00"
$"00FF FFFF FFFF FFFF FFFF F011 1F0F 0F00"
$"0000 F000 0000 0000 0000 0000 0000 0F00"
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF FF"
};
resource 'icl4' (140) {
$"000F FFFF FFFF FFFF FFFF FFF0 0000 0000"
$"000F 0000 0000 0000 0000 00FF 0000 0000"
$"000F 0666 6600 0000 0000 00FC F000 0000"
$"000F 0666 660D 0C00 CC00 00FC CF00 0000"
$"000F 0666 660C 0C0D 0000 00FC CCF0 0000"
$"000F 0666 660C 0C00 0880 00FC CCCF 0000"
$"000F 0666 6600 000C C000 88FF FFFF F000"
$"000F 0666 6600 0000 000C 00C8 8000 F000"
$"000F 0666 660F FFFF FFFF FFF0 0000 F000"
$"000F 0666 600F FFFF FFFF FFFF 0000 F000"
$"000F 0666 000F FFF0 000C 00FF 0000 F000"
$"000F 0666 0D00 FFFD 000D 000C 0000 F000"
$"000F 0660 000C 0FFF 000C 000F 0C00 F000"
$"000F 0660 1111 10FF F000 CD0C 0C00 F000"
$"000F 0660 1DDF D10F FF00 0000 0C00 F000"
$"000F 0660 1FD1 8110 FFF0 000C 00C0 F000"
$"000F 0660 1F1D DD1C FFFF 0C00 0F00 F000"
$"000F 0660 0D11 D11C 0FFF 0000 FF00 F000"
$"000F 0666 0011 F110 00FF 00C0 0F00 F000"
$"000F 0666 0011 1110 0FFC 0000 0000 F000"
$"000F 0666 6000 000C FF0C 00C0 0000 F000"
$"000F 0666 660D D00F F000 00C0 00C0 F000"
$"000F 0666 6600 0CFF 0000 0000 F0C0 F000"
$"000F 0666 660C 0FFC 0000 0000 F000 F000"
$"000F 0666 660C FF00 0C00 C0CF F000 F000"
$"000F 0666 660F FFFF FFFF FFFF D000 F000"
$"000F 0666 660F FFFF FFFF FFFF C0C0 F000"
$"000F 0666 660C C00C 00C0 0CC0 0000 F000"
$"000F 0666 6603 3D00 0000 000D D0C0 F000"
$"000F 0666 6603 3D0C D00C 000D CC00 F000"
$"000F 0000 0000 0000 000C 0000 0000 F000"
$"000F FFFF FFFF FFFF FFFF FFFF FFFF F0"
};
resource 'icl4' (141) {
$"00FF FFFF FFFF FFFF FFFF FFFF FFFF 0000"
$"00F0 0000 0000 0000 0000 0000 000F 0000"
$"00F0 6666 60C0 C0D0 0C00 0C00 000F 0000"
$"00F0 6666 60C0 C000 8800 0CC0 0C0F FF00"
$"00F0 6666 6000 00CC 0008 8000 000F 0F00"
$"00F0 6666 6000 0000 00C0 0C88 000F 0F00"
$"00F0 6666 60FF FFFF FFFF FF00 000F 0F00"
$"00F0 6666 60FF FFFF FFFF FFF0 000F 0F00"
$"00F0 6666 00FF FF00 00C0 0FF0 000F 0F00"
$"00F0 6660 C00F FFD0 00D0 00C0 C00F 0F00"
$"00F0 6660 C0C0 FFF0 00C0 00F0 C00F 0F00"
$"00F0 6600 0000 0FFF 000C D0C0 000F 0F00"
$"00F0 6601 1111 0FFF F000 0000 000F 0F00"
$"00F0 6601 DDFD 100F FF00 00C0 000F 0F00"
$"00F0 6601 FD11 11CF FFF0 C000 C00F 0F00"
$"00F0 6601 F1DD D1C0 FFF0 000F C00F 0F00"
$"00F0 6600 D11D 1100 0FF0 0C00 000F 0F00"
$"00F0 6660 011F 1100 FFC0 0000 0C0F 0F00"
$"00F0 6660 0000 00CF F0C0 0C00 0C0F 0F00"
$"00F0 6666 0000 00FF 0000 0C00 0C0F 0F00"
$"00F0 6666 6000 CFF0 00C0 000F 0C0F 0F00"
$"00F0 6666 60C0 FFC0 0000 000F 000F 0F00"
$"00F0 6666 60CF F000 C00C 0CFF 000F 0F00"
$"00F0 6666 60FF FFFF FFFF FFFF FFF0 0F00"
$"00F0 6666 60FF FFFF FFFF F000 0F00 0F00"
$"00F0 6666 6000 0000 0000 F000 F000 0F00"
$"00F0 6666 6033 0CC0 0C00 F00F 0000 0F00"
$"00F0 6666 6033 C0C0 0000 F0F0 0000 0F00"
$"00F0 0000 0000 0000 0000 FF00 0000 0F00"
$"00FF FFFF FFFF FFFF FFFF F000 0000 0F00"
$"0000 F000 0000 0000 0000 0000 0000 0F00"
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF FF"
};
resource 'icl4' (142) {
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"6666 6000 0000 0000 D000 0000 0000 0000"
$"6666 6000 0000 000D 6D00 0000 0000 0000"
$"6666 6000 0000 00D0 D6D0 0000 0000 0000"
$"6666 6000 0000 0D00 0D6D 0000 0000 0000"
$"6666 6000 0000 DF00 D0D6 D000 0000 0000"
$"6666 6000 000D F0CD 0F0D 6D00 0000 0000"
$"6666 6000 00D0 0DD0 D00D D6D0 0000 0000"
$"6666 6000 0DF0 0D00 0D0F 0D6D 0000 0000"
$"6666 6000 D00C D000 00D0 00D6 D000 0000"
$"6666 600D 000D 0000 000D 000D 6D00 0000"
$"6666 60DF 00D0 0000 0000 D0FD D6D0 0000"
$"6666 6D00 CD00 0000 0000 0D0F 0D6D 0000"
$"6666 DF00 D000 00DD 0DDD D0D0 0DD6 D000"
$"666D 000D 0000 DD0D D0DD FDDD 0F0D 6D00"
$"66DF 00D0 000D 0D09 0606 7666 D000 D6D0"
$"6D00 0D00 0D06 0070 1999 6966 6D00 0D6D"
$"66D0 D000 D600 6D99 1999 9999 66D0 00D0"
$"666D 000D D080 D991 1196 699D 996D 0D50"
$"6666 D0D0 060D 9111 1111 9699 966F D500"
$"6666 6DD0 D6D6 9991 1199 9996 999F F000"
$"6666 6D00 6D07 9999 1969 9999 99F9 6000"
$"6666 6DDD 0099 9999 1996 9996 969F 6F00"
$"6666 D00D 6797 9969 9666 9999 99F6 9F00"
$"6666 0D06 D669 9669 6669 9999 6999 6F00"
$"6666 DD60 6666 6666 9999 9999 9966 6F00"
$"6666 0606 6669 9999 6969 9999 6969 6F00"
$"6666 D066 6699 9999 9699 9999 969F 6F00"
$"6666 0606 6999 9999 9669 9999 66F9 FF00"
$"6666 DD66 6999 9999 9669 9999 6996 FF00"
$"6666 6066 6699 9999 9666 9969 666F F000"
$"6666 6D76 6666 9999 6666 6666 66FF F0"
};
resource 'FREF' (128) {
'APPL',
0,
""
};
resource 'FREF' (129) {
'SW/©',
1,
""
};
resource 'FREF' (130) {
'TEXT',
2,
""
};
resource 'FREF' (131) {
'sW/©',
3,
""
};
// Writer 2.0
resource 'FREF' (132) {
'SDwr',
4,
""
};
// Writer 2.0 Vorlage
resource 'FREF' (133) {
'SWwv',
5,
""
};
// Excel
resource 'FREF' (134) {
'XLS ',
6,
""
};
resource 'FREF' (135) {
'RTF ',
7,
""
};
// Word 6
resource 'FREF' (136) {
'W6BN',
8,
""
};
resource 'FREF' (137) {
'SVsc',
9,
""
};
resource 'FREF' (138) {
'sVsc',
10,
""
};
resource 'FREF' (139) {
'SVsd',
11,
""
};
resource 'FREF' (140) {
'sVsd',
12,
""
};
resource 'FREF' (141) {
'SVsh',
13,
""
};
resource 'FREF' (142) {
'sVsh',
14,
""
};
resource 'FREF' (143) {
'SVsi',
15,
""
};
resource 'FREF' (144) {
'sVsi',
16,
""
};
resource 'FREF' (145) {
'SVsm',
17,
""
};
resource 'FREF' (146) {
'sVsm',
18,
""
};
resource 'FREF' (147) {
'SVfs',
19,
""
};
resource 'BNDL' (128) {
'SVdt',
0,
{ /* array TypeArray: 2 elements */
/* [1] */
'FREF',
{ /* array IDArray: 20 elements */
/* [1] */
0, 128,
/* [2] */
1, 129,
/* [3] */
2, 130,
/* [4] */
3, 131,
/* [5] */
4, 132,
/* [6] */
5, 133,
/* [7] */
6, 134,
/* [8] */
7, 135,
/* [9] */
8, 136,
/* [10] */
9, 137,
/* [11] */
10, 138,
/* [12] */
11, 139,
/* [13] */
12, 140,
/* [14] */
13, 141,
/* [15] */
14, 142,
/* [16] */
15, 143,
/* [17] */
16, 144,
/* [18] */
17, 145,
/* [19] */
18, 146,
/* [20] */
19, 147
},
/* [2] */
'ICN#',
{ /* array IDArray: 20 elements */
/* [1] */
0, 128,
/* [2] */
1, 129,
/* [3] */
2, 131,
/* [4] */
3, 130,
/* [5] */
4, 0,
/* [6] */
5, 0,
/* [7] */
6, 0,
/* [8] */
7, 0,
/* [9] */
8, 0,
/* [10] */
9, 132,
/* [11] */
10, 133,
/* [12] */
11, 134,
/* [13] */
12, 135,
/* [14] */
13, 136,
/* [15] */
14, 137,
/* [16] */
15, 138,
/* [17] */
16, 139,
/* [18] */
17, 140,
/* [19] */
18, 141,
/* [20] */
19, 142
}
}
};
data 'cicn' (2001, "mrj bar") {
$"0000 0000 8010 0000 0000 0020 0020 0000"
$"0000 0000 0000 0048 0000 0048 0000 0000"
$"0004 0001 0004 0000 0000 0000 0000 0000"
$"0000 0000 0000 0004 0000 0000 0020 0020"
$"0000 0000 0004 0000 0000 0020 0020 0000"
$"0000 FC00 0000 FC00 0000 FC00 0000 FC00"
$"0000 FC00 0000 FC00 0000 FC00 0000 FC00"
$"0000 FC00 0000 FC00 0000 FC00 0000 FC00"
$"0000 FC00 0000 FC00 0000 FC00 0000 FC00"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 FC00 0000 8400 0000 C400 0000 E400"
$"0000 F400 0000 FC00 0000 9C00 0000 8C00"
$"0000 C400 0000 E400 0000 F400 0000 FC00"
$"0000 9C00 0000 8C00 0000 C400 0000 E400"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0007 0000 FFFF FFFF"
$"FFFF 0001 FFFF FFFF 3333 0002 FFFF CCCC"
$"0000 0003 3333 3333 3333 0004 4444 4444"
$"4444 0005 2222 2222 2222 0006 1111 1111"
$"1111 000F 0000 0000 0000 FFFF FF00 0000"
$"0000 0000 0000 0000 0000 F122 4300 0000"
$"0000 0000 0000 0000 0000 F422 2600 0000"
$"0000 0000 0000 0000 0000 F5F2 2F00 0000"
$"0000 0000 0000 0000 0000 F5FF FF00 0000"
$"0000 0000 0000 0000 0000 F1FF FF00 0000"
$"0000 0000 0000 0000 0000 F22F FF00 0000"
$"0000 0000 0000 0000 0000 F222 FF00 0000"
$"0000 0000 0000 0000 0000 F422 2F00 0000"
$"0000 0000 0000 0000 0000 F5F2 2F00 0000"
$"0000 0000 0000 0000 0000 F5FF FF00 0000"
$"0000 0000 0000 0000 0000 F1FF FF00 0000"
$"0000 0000 0000 0000 0000 F22F FF00 0000"
$"0000 0000 0000 0000 0000 F222 FF00 0000"
$"0000 0000 0000 0000 0000 F422 2F00 0000"
$"0000 0000 0000 0000 0000 F5F2 2F00 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000"
}; diff --git a/eventattacher/prj/d.lst b/eventattacher/prj/d.lst new file mode 100644 index 000000000000..a787c3a4c3c0 --- /dev/null +++ b/eventattacher/prj/d.lst @@ -0,0 +1,2 @@ +..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\* +..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\* diff --git a/eventattacher/source/eventattacher.cxx b/eventattacher/source/eventattacher.cxx new file mode 100644 index 000000000000..266ae173f781 --- /dev/null +++ b/eventattacher/source/eventattacher.cxx @@ -0,0 +1,969 @@ +/************************************************************************* + * + * $RCSfile: eventattacher.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:15:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _OSL_DIAGNOSE_H_ +#include <osl/diagnose.h> +#endif + +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_ +#include <com/sun/star/lang/XInitialization.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_ +#include <com/sun/star/registry/XRegistryKey.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XINTROSPECTION_HPP_ +#include <com/sun/star/beans/XIntrospection.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_METHODCONCEPT_HPP_ +#include <com/sun/star/beans/MethodConcept.hpp> +#endif +#ifndef _COM_SUN_STAR_SCRIPT_XEVENTATTACHER_HPP_ +#include <com/sun/star/script/XEventAttacher.hpp> +#endif +#ifndef _COM_SUN_STAR_SCRIPT_XTYPECONVERTER_HPP_ +#include <com/sun/star/script/XTypeConverter.hpp> +#endif +#ifndef _COM_SUN_STAR_SCRIPT_XALLLISTENER_HPP_ +#include <com/sun/star/script/XAllListener.hpp> +#endif +#ifndef _COM_SUN_STAR_SCRIPT_XINVOCATIONADAPTERFACTORY_HPP_ +#include <com/sun/star/script/XInvocationAdapterFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_REFLECTION_XIDLREFLECTION_HPP_ +#include <com/sun/star/reflection/XIdlReflection.hpp> +#endif + +// InvocationToAllListenerMapper +#ifndef _COM_SUN_STAR_SCRIPT_XINVOCATION_HPP_ +#include <com/sun/star/script/XInvocation.hpp> +#endif + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif +#ifndef _CPPUHELPER_FACTORY_HXX_ +#include <cppuhelper/factory.hxx> +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif +#ifndef _CPPUHELPER_IMPLBASE3_HXX_ +#include <cppuhelper/implbase3.hxx> +#endif + +using namespace com::sun::star::uno; +using namespace com::sun::star::registry; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::script; +using namespace com::sun::star::reflection; +using namespace cppu; +using namespace osl; +using namespace rtl; + + +#define SERVICENAME "com.sun.star.script.EventAttacher" +#define IMPLNAME "com.sun.star.comp.EventAttacher" + +namespace comp_EventAttacher { + +//************************************************************************* +// class InvocationToAllListenerMapper +// helper class to map XInvocation to XAllListener +//************************************************************************* +class InvocationToAllListenerMapper : public WeakImplHelper1< XInvocation > +{ +public: + InvocationToAllListenerMapper( const Reference< XIdlClass >& ListenerType, + const Reference< XAllListener >& AllListener, const Any& Helper ); + + // XInvocation + virtual Reference< XIntrospectionAccess > SAL_CALL getIntrospection(void) throw( RuntimeException ); + virtual Any SAL_CALL invoke(const OUString& FunctionName, const Sequence< Any >& Params, Sequence< sal_Int16 >& OutParamIndex, Sequence< Any >& OutParam) + throw( IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException ); + virtual void SAL_CALL setValue(const OUString& PropertyName, const Any& Value) + throw( UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException ); + virtual Any SAL_CALL getValue(const OUString& PropertyName) throw( UnknownPropertyException, RuntimeException ); + virtual sal_Bool SAL_CALL hasMethod(const OUString& Name) throw( RuntimeException ); + virtual sal_Bool SAL_CALL hasProperty(const OUString& Name) throw( RuntimeException ); + +private: + Reference< XIdlReflection > m_xCoreReflection; + Reference< XAllListener > m_xAllListener; + Reference< XIdlClass > m_xListenerType; + Any m_Helper; +}; + + +// Function to replace AllListenerAdapterService::createAllListerAdapter +Reference< XInterface > createAllListenerAdapter +( + const Reference< XInvocationAdapterFactory >& xInvocationAdapterFactory, + const Reference< XIdlClass >& xListenerType, + const Reference< XAllListener >& xListener, + const Any& Helper +) +{ + Reference< XInterface > xAdapter; + if( xInvocationAdapterFactory.is() && xListenerType.is() && xListener.is() ) + { + Reference< XInvocation > xInvocationToAllListenerMapper = + (XInvocation*)new InvocationToAllListenerMapper( xListenerType, xListener, Helper ); + Type aListenerType( xListenerType->getTypeClass(), xListenerType->getName()); + xAdapter = xInvocationAdapterFactory->createAdapter( xInvocationToAllListenerMapper, aListenerType ); + } + return xAdapter; +} + + +//-------------------------------------------------------------------------------------------------- +// InvocationToAllListenerMapper +InvocationToAllListenerMapper::InvocationToAllListenerMapper + ( const Reference< XIdlClass >& ListenerType, const Reference< XAllListener >& AllListener, const Any& Helper ) + : m_xAllListener( AllListener ) + , m_Helper( Helper ) + , m_xListenerType( ListenerType ) +{ +} + +//************************************************************************* +Reference< XIntrospectionAccess > SAL_CALL InvocationToAllListenerMapper::getIntrospection(void) + throw( RuntimeException ) +{ + return Reference< XIntrospectionAccess >(); +} + +//************************************************************************* +Any SAL_CALL InvocationToAllListenerMapper::invoke(const OUString& FunctionName, const Sequence< Any >& Params, + Sequence< sal_Int16 >& OutParamIndex, Sequence< Any >& OutParam) + throw( IllegalArgumentException, CannotConvertException, + InvocationTargetException, RuntimeException ) +{ + Any aRet; + + // Check if to firing or approveFiring has to be called + Reference< XIdlMethod > xMethod = m_xListenerType->getMethod( FunctionName ); + sal_Bool bApproveFiring = sal_False; + if( !xMethod.is() ) + return aRet; + Reference< XIdlClass > xReturnType = xMethod->getReturnType(); + Sequence< Reference< XIdlClass > > aExceptionSeq = xMethod->getExceptionTypes(); + if( ( xReturnType.is() && xReturnType->getTypeClass() != TypeClass_VOID ) || + aExceptionSeq.getLength() > 0 ) + { + bApproveFiring = sal_True; + } + else + { + Sequence< ParamInfo > aParamSeq = xMethod->getParameterInfos(); + sal_uInt32 nParamCount = aParamSeq.getLength(); + if( nParamCount > 1 ) + { + const ParamInfo* pInfos = aParamSeq.getConstArray(); + for( sal_uInt32 i = 0 ; i < nParamCount ; i++ ) + { + if( pInfos[ i ].aMode != ParamMode_IN ) + { + bApproveFiring = sal_True; + break; + } + } + } + } + + AllEventObject aAllEvent; + aAllEvent.Source = (OWeakObject*) this; + aAllEvent.Helper = m_Helper; + aAllEvent.ListenerType = Type(m_xListenerType->getTypeClass(), m_xListenerType->getName()); + aAllEvent.MethodName = FunctionName; + aAllEvent.Arguments = Params; + if( bApproveFiring ) + aRet = m_xAllListener->approveFiring( aAllEvent ); + else + m_xAllListener->firing( aAllEvent ); + return aRet; +} + +//************************************************************************* +void SAL_CALL InvocationToAllListenerMapper::setValue(const OUString& PropertyName, const Any& Value) + throw( UnknownPropertyException, CannotConvertException, + InvocationTargetException, RuntimeException ) +{ +} + +//************************************************************************* +Any SAL_CALL InvocationToAllListenerMapper::getValue(const OUString& PropertyName) + throw( UnknownPropertyException, RuntimeException ) +{ + return Any(); +} + +//************************************************************************* +sal_Bool SAL_CALL InvocationToAllListenerMapper::hasMethod(const OUString& Name) + throw( RuntimeException ) +{ + Reference< XIdlMethod > xMethod = m_xListenerType->getMethod( Name ); + return xMethod.is(); +} + +//************************************************************************* +sal_Bool SAL_CALL InvocationToAllListenerMapper::hasProperty(const OUString& Name) + throw( RuntimeException ) +{ + Reference< XIdlField > xField = m_xListenerType->getField( Name ); + return xField.is(); +} + +//************************************************************************* +// class EventAttacherImpl +// represents an implementation of the EventAttacher service +//************************************************************************* +class EventAttacherImpl : public WeakImplHelper3 < XEventAttacher, XInitialization, XServiceInfo > +{ +public: + EventAttacherImpl( const Reference< XMultiServiceFactory >& ); + ~EventAttacherImpl(); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) throw(RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException); + virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(RuntimeException); + static OUString SAL_CALL getImplementationName_Static( ); + static Sequence< OUString > SAL_CALL getSupportedServiceNames_Static( ); + + // XInitialization + virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) + throw( Exception, RuntimeException); + + // Methoden von XEventAttacher + virtual Reference< XEventListener > SAL_CALL attachListener(const Reference< XInterface >& xObject, + const Reference< XAllListener >& AllListener, const Any& Helper, + const OUString& ListenerType, const OUString& AddListenerParam) + throw( IllegalArgumentException, ServiceNotRegisteredException, CannotCreateAdapterException, IntrospectionException, RuntimeException ); + virtual Reference< XEventListener > SAL_CALL attachSingleEventListener(const Reference< XInterface >& xObject, + const Reference< XAllListener >& AllListener, const Any& Helper, + const OUString& ListenerType, const OUString& AddListenerParam, + const OUString& EventMethod) + throw( IllegalArgumentException, ServiceNotRegisteredException, CannotCreateAdapterException, IntrospectionException, RuntimeException ); + virtual void SAL_CALL removeListener(const Reference< XInterface >& xObject, + const OUString& ListenerType, const OUString& AddListenerParam, + const Reference< XEventListener >& aToRemoveListener) + throw( IllegalArgumentException, ServiceNotRegisteredException, IntrospectionException, RuntimeException ); + + // used by FilterAllListener_Impl + Reference< XTypeConverter > getConverter() throw( Exception ); + + friend class FilterAllListenerImpl; +private: + Mutex m_aMutex; + Reference< XMultiServiceFactory > m_xSMgr; + + // Services merken + Reference< XIntrospection > m_xIntrospection; + Reference< XIdlReflection > m_xReflection; + Reference< XTypeConverter > m_xConverter; + Reference< XInvocationAdapterFactory > m_xInvocationAdapterFactory; + + // needed services + Reference< XIntrospection > getIntrospection() throw( Exception ); + Reference< XIdlReflection > getReflection() throw( Exception ); + Reference< XInvocationAdapterFactory > getInvocationAdapterService() throw( Exception ); +}; + + +//************************************************************************* +EventAttacherImpl::EventAttacherImpl( const Reference< XMultiServiceFactory >& rSMgr ) + : m_xSMgr( rSMgr ) +{ +} + +//************************************************************************* +EventAttacherImpl::~EventAttacherImpl() +{ +} + +//************************************************************************* +Reference< XInterface > SAL_CALL EventAttacherImpl_CreateInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( Exception ) +{ + Reference< XInterface > xRet; + XEventAttacher *pEventAttacher = (XEventAttacher*) new EventAttacherImpl(rSMgr); + + if (pEventAttacher) + { + xRet = Reference<XInterface>::query(pEventAttacher); + } + + return xRet; +} + +//************************************************************************* +OUString SAL_CALL EventAttacherImpl::getImplementationName( ) + throw(RuntimeException) +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM( IMPLNAME ) ); +} + +//************************************************************************* +sal_Bool SAL_CALL EventAttacherImpl::supportsService( const OUString& ServiceName ) + throw(RuntimeException) +{ + Sequence< OUString > aSNL = getSupportedServiceNames(); + const OUString * pArray = aSNL.getArray(); + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) + if( pArray[i] == ServiceName ) + return sal_True; + return sal_False; +} + +//************************************************************************* +Sequence<OUString> SAL_CALL EventAttacherImpl::getSupportedServiceNames( ) + throw(RuntimeException) +{ + return getSupportedServiceNames_Static(); +} + +//************************************************************************* +Sequence<OUString> SAL_CALL EventAttacherImpl::getSupportedServiceNames_Static( ) +{ + OUString aStr( RTL_CONSTASCII_USTRINGPARAM( SERVICENAME ) ); + return Sequence< OUString >( &aStr, 1 ); +} + +//************************************************************************* +void SAL_CALL EventAttacherImpl::initialize(const Sequence< Any >& Arguments) throw( Exception, RuntimeException ) +{ + // get services from the argument list + const Any * pArray = Arguments.getConstArray(); + for( sal_Int32 i = 0; i < Arguments.getLength(); i++ ) + { + if( pArray[i].getValueType().getTypeClass() != TypeClass_INTERFACE ) + throw IllegalArgumentException(); + + // InvocationAdapter service ? + Reference< XInvocationAdapterFactory > xALAS; + pArray[i] >>= xALAS; + if( xALAS.is() ) + { + Guard< Mutex > aGuard( m_aMutex ); + m_xInvocationAdapterFactory = xALAS; + } + // Introspection service ? + Reference< XIntrospection > xI; + pArray[i] >>= xI; + if( xI.is() ) + { + Guard< Mutex > aGuard( m_aMutex ); + m_xIntrospection = xI; + } + // Reflection service ? + Reference< XIdlReflection > xIdlR; + pArray[i] >>= xIdlR; + if( xIdlR.is() ) + { + Guard< Mutex > aGuard( m_aMutex ); + m_xReflection = xIdlR; + } + // Converter Service ? + Reference< XTypeConverter > xC; + pArray[i] >>= xC; + if( xC.is() ) + { + Guard< Mutex > aGuard( m_aMutex ); + m_xConverter = xC; + } + + // no right interface + if( !xALAS.is() && !xI.is() && !xIdlR.is() && !xC.is() ) + throw IllegalArgumentException(); + } +} + +//************************************************************************* +//*** Private Hilfs-Methoden *** +Reference< XIntrospection > EventAttacherImpl::getIntrospection() throw( Exception ) +{ + Guard< Mutex > aGuard( m_aMutex ); + // Haben wir den Service schon? Sonst anlegen + if( !m_xIntrospection.is() ) + { + Reference< XInterface > xIFace( m_xSMgr->createInstance( rtl::OUString::createFromAscii("com.sun.star.beans.Introspection") ) ); + m_xIntrospection = Reference< XIntrospection >( xIFace, UNO_QUERY ); + } + return m_xIntrospection; +} + +//************************************************************************* +//*** Private Hilfs-Methoden *** +Reference< XIdlReflection > EventAttacherImpl::getReflection() throw( Exception ) +{ + Guard< Mutex > aGuard( m_aMutex ); + // Haben wir den Service schon? Sonst anlegen + if( !m_xReflection.is() ) + { + Reference< XInterface > xIFace( m_xSMgr->createInstance( rtl::OUString::createFromAscii("com.sun.star.reflection.CoreReflection") ) ); + m_xReflection = Reference< XIdlReflection >( xIFace, UNO_QUERY); + } + return m_xReflection; +} + +//************************************************************************* +//*** Private Hilfs-Methoden *** +Reference< XInvocationAdapterFactory > EventAttacherImpl::getInvocationAdapterService() throw( Exception ) +{ + Guard< Mutex > aGuard( m_aMutex ); + // Haben wir den Service schon? Sonst anlegen + if( !m_xInvocationAdapterFactory.is() ) + { + Reference< XInterface > xIFace( m_xSMgr->createInstance( rtl::OUString::createFromAscii("com.sun.star.script.InvocationAdapterFactory") ) ); + m_xInvocationAdapterFactory = Reference< XInvocationAdapterFactory >( xIFace, UNO_QUERY ); + } + return m_xInvocationAdapterFactory; +} + + +//************************************************************************* +//*** Private Hilfs-Methoden *** +Reference< XTypeConverter > EventAttacherImpl::getConverter() throw( Exception ) +{ + Guard< Mutex > aGuard( m_aMutex ); + // Haben wir den Service schon? Sonst anlegen + if( !m_xConverter.is() ) + { + Reference< XInterface > xIFace( m_xSMgr->createInstance( rtl::OUString::createFromAscii("com.sun.star.script.Converter") ) ); + m_xConverter = Reference< XTypeConverter >( xIFace, UNO_QUERY ); + } + return m_xConverter; +} + +//------------------------------------------------------------------------ +//------------------------------------------------------------------------ +//------------------------------------------------------------------------ +// Implementation eines EventAttacher-bezogenen AllListeners, der +// nur einzelne Events an einen allgemeinen AllListener weiterleitet +class FilterAllListenerImpl : public WeakImplHelper1< XAllListener > +{ +public: + FilterAllListenerImpl( EventAttacherImpl * pEA_, const OUString& EventMethod_, + const Reference< XAllListener >& AllListener_ ); + + // XAllListener + virtual void SAL_CALL firing(const AllEventObject& Event) throw( RuntimeException ); + virtual Any SAL_CALL approveFiring(const AllEventObject& Event) throw( InvocationTargetException, RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing(const EventObject& Source) throw( RuntimeException ); + +private: + // convert + void convertToEventReturn( Any & rRet, const Type& rRetType ) + throw( CannotConvertException ); + + EventAttacherImpl * m_pEA; + Reference< XInterface > m_xEAHold; + OUString m_EventMethod; + Reference< XAllListener > m_AllListener; +}; + +//************************************************************************* +FilterAllListenerImpl::FilterAllListenerImpl( EventAttacherImpl * pEA_, const OUString& EventMethod_, + const Reference< XAllListener >& AllListener_ ) + : m_pEA( pEA_ ) + , m_xEAHold( *pEA_ ) + , m_EventMethod( EventMethod_ ) + , m_AllListener( AllListener_ ) +{ +} + +//************************************************************************* +void SAL_CALL FilterAllListenerImpl::firing(const AllEventObject& Event) + throw( RuntimeException ) +{ + // Nur durchreichen, wenn es die richtige Methode ist + if( Event.MethodName == m_EventMethod && m_AllListener.is() ) + m_AllListener->firing( Event ); +} + +//************************************************************************* +// Convert to the standard event return +void FilterAllListenerImpl::convertToEventReturn( Any & rRet, const Type & rRetType ) + throw( CannotConvertException ) +{ + // no return value? Set to the specified values + if( rRet.getValueType().getTypeClass() == TypeClass_VOID ) + { + switch( rRetType.getTypeClass() ) + { + case TypeClass_INTERFACE: + { + rRet <<= Reference< XInterface >(); + } + break; + + case TypeClass_BOOLEAN: + rRet <<= sal_True; + break; + + case TypeClass_STRING: + rRet <<= OUString(); + break; + + case TypeClass_FLOAT: rRet <<= float(0); break; + case TypeClass_DOUBLE: rRet <<= double(0.0); break; + case TypeClass_BYTE: rRet <<= sal_uInt8( 0 ); break; + case TypeClass_SHORT: rRet <<= sal_Int16( 0 ); break; + case TypeClass_LONG: rRet <<= sal_Int32( 0 ); break; + case TypeClass_UNSIGNED_SHORT: rRet <<= sal_uInt16( 0 ); break; + case TypeClass_UNSIGNED_LONG: rRet <<= sal_uInt32( 0 ); break; + break; + } + } + else if( !rRet.getValueType().equals( rRetType ) ) + { + Reference< XTypeConverter > xConverter = m_pEA->getConverter(); + if( xConverter.is() ) + rRet = xConverter->convertTo( rRet, rRetType ); + else + throw CannotConvertException(); // TODO TypeConversionException + } +} + +//************************************************************************* +Any SAL_CALL FilterAllListenerImpl::approveFiring( const AllEventObject& Event ) + throw( InvocationTargetException, RuntimeException ) +{ + Any aRet; + + // Nur durchreichen, wenn es die richtige Methode ist + if( Event.MethodName == m_EventMethod && m_AllListener.is() ) + aRet = m_AllListener->approveFiring( Event ); + else + { + // Convert to the standard event return + try + { + Reference< XIdlClass > xListenerType = m_pEA->getReflection()-> + forName( Event.ListenerType.getTypeName() ); + Reference< XIdlMethod > xMeth = xListenerType->getMethod( Event.MethodName ); + if( xMeth.is() ) + { + Reference< XIdlClass > xRetType = xMeth->getReturnType(); + Type aRetType( xRetType->getTypeClass(), xRetType->getName() ); + convertToEventReturn( aRet, aRetType ); + } + } + catch( CannotConvertException& e ) + { + throw InvocationTargetException( OUString(), Reference< XInterface >(), Any(&e, ::getCppuType( (CannotConvertException*)0)) ); + } + } + return aRet; +} + +//************************************************************************* +void FilterAllListenerImpl::disposing(const EventObject& Source) + throw( RuntimeException ) +{ + // TODO: ??? +} + + +//************************************************************************* +Reference< XEventListener > EventAttacherImpl::attachListener +( + const Reference< XInterface >& xObject, + const Reference< XAllListener >& AllListener, + const Any& Helper, + const OUString& ListenerType, + const OUString& AddListenerParam +) + throw( IllegalArgumentException, ServiceNotRegisteredException, CannotCreateAdapterException, IntrospectionException, RuntimeException ) +{ + if( !xObject.is() || !AllListener.is() ) + throw IllegalArgumentException(); + + Reference< XEventListener > xRet = NULL; + + // InvocationAdapterService holen + Reference< XInvocationAdapterFactory > xInvocationAdapterFactory = getInvocationAdapterService(); + if( !xInvocationAdapterFactory.is() ) + throw ServiceNotRegisteredException(); + + // Listener-Klasse per Reflection besorgen + Reference< XIdlReflection > xReflection = getReflection(); + if( !xReflection.is() ) + throw ServiceNotRegisteredException(); + + // Anmelden, dazu passende addListener-Methode aufrufen + // Zunaechst ueber Introspection gehen, da die Methoden in der gleichen + // Weise analysiert werden koennen. Fuer bessere Performance entweder + // hier nochmal implementieren oder die Impl-Methode der Introspection + // fuer diesen Zweck konfigurierbar machen. + + // Introspection-Service holen + Reference< XIntrospection > xIntrospection = getIntrospection(); + if( !xIntrospection.is() ) + return xRet; + + // und unspecten + Any aObjAny( &xObject, ::getCppuType( (const Reference< XInterface > *)0) ); + + Reference< XIntrospectionAccess > xAccess = xIntrospection->inspect( aObjAny ); + if( !xAccess.is() ) + return xRet; + + // Name der addListener-Methode zusammenbasteln + OUString aAddListenerName; + OUString aListenerName( ListenerType ); + sal_Int32 nIndex = aListenerName.lastIndexOf( '.' ); + // set index to the interface name without package name + if( nIndex == -1 ) + // not found + nIndex = 0; + else + nIndex++; + if( aListenerName[nIndex] == 'X' ) + // erase X from the interface name + aListenerName = aListenerName.copy( nIndex +1 ); + aAddListenerName = OUString( RTL_CONSTASCII_USTRINGPARAM( "add" ) ) + aListenerName; + + // Methoden nach der passenden addListener-Methode durchsuchen + Sequence< Reference< XIdlMethod > > aMethodSeq = xAccess->getMethods( MethodConcept::LISTENER ); + sal_uInt32 i, nLen = aMethodSeq.getLength(); + const Reference< XIdlMethod >* pMethods = aMethodSeq.getConstArray(); + + for( i = 0 ; i < nLen ; i++ ) + { + // Methode ansprechen + const Reference< XIdlMethod >& rxMethod = pMethods[i]; + + // Ist es die richtige Methode? + OUString aMethName = rxMethod->getName(); + + if( aAddListenerName == aMethName ) + { + Sequence< Reference< XIdlClass > > params = rxMethod->getParameterTypes(); + sal_uInt32 nParamCount = params.getLength(); + + Reference< XIdlClass > xListenerType; + if( nParamCount == 1 ) + xListenerType = params.getConstArray()[0]; + else if( nParamCount == 2 ) + xListenerType = params.getConstArray()[1]; + + // Adapter zum eigentlichen Listener-Typ anfordern + Reference< XInterface > xAdapter = createAllListenerAdapter + ( xInvocationAdapterFactory, xListenerType, AllListener, Helper ); + + if( !xAdapter.is() ) + throw CannotCreateAdapterException(); + xRet = Reference< XEventListener >( xAdapter, UNO_QUERY ); + + + // Nur der Listener als Parameter? + if( nParamCount == 1 ) + { + Sequence< Any > args( 1 ); + args.getArray()[0] <<= xAdapter; + try + { + rxMethod->invoke( aObjAny, args ); + } + catch( InvocationTargetException& ) + { + throw IntrospectionException(); + } + } + // Sonst den Zusatzparameter mit uebergeben + else if( nParamCount == 2 ) + { + Sequence< Any > args( 2 ); + Any* pAnys = args.getArray(); + + // Typ des 1. Parameters pruefen + Reference< XIdlClass > xParamClass = params.getConstArray()[0]; + if( xParamClass->getTypeClass() == TypeClass_STRING ) + { + pAnys[0] <<= AddListenerParam; + } + + // 2. Parameter == Listener? TODO: Pruefen! + pAnys[1] <<= xAdapter; + + // TODO: Konvertierung String -> ? + // else + try + { + rxMethod->invoke( aObjAny, args ); + } + catch( InvocationTargetException& ) + { + throw IntrospectionException(); + } + } + break; + // else... + // Alles andere wird nicht unterstuetzt + } + } + + return xRet; +} + +// XEventAttacher +Reference< XEventListener > EventAttacherImpl::attachSingleEventListener +( + const Reference< XInterface >& xObject, + const Reference< XAllListener >& AllListener, + const Any& Helper, + const OUString& ListenerType, + const OUString& AddListenerParam, + const OUString& EventMethod +) + throw( IllegalArgumentException, ServiceNotRegisteredException, CannotCreateAdapterException, IntrospectionException, RuntimeException ) +{ + // FilterListener anmelden + Reference< XAllListener > aFilterListener = (XAllListener*) + new FilterAllListenerImpl( this, EventMethod, AllListener ); + return attachListener( xObject, aFilterListener, Helper, ListenerType, AddListenerParam); +} + +// XEventAttacher +void EventAttacherImpl::removeListener +( + const Reference< XInterface >& xObject, + const OUString& ListenerType, + const OUString& AddListenerParam, + const Reference< XEventListener >& aToRemoveListener +) + throw( IllegalArgumentException, ServiceNotRegisteredException, IntrospectionException, RuntimeException ) +{ + if( !xObject.is() || !aToRemoveListener.is() ) + throw IllegalArgumentException(); + + // Listener-Klasse per Reflection besorgen + Reference< XIdlReflection > xReflection = getReflection(); + if( !xReflection.is() ) + throw ServiceNotRegisteredException(); + + // Abmelden, dazu passende removeListener-Methode aufrufen + // Zunaechst ueber Introspection gehen, da die Methoden in der gleichen + // Weise analysiert werden koennen. Fuer bessere Performance entweder + // hier nochmal implementieren oder die Impl-Methode der Introspection + // fuer diesen Zweck konfigurierbar machen. + + // Introspection-Service holen + Reference< XIntrospection > xIntrospection = getIntrospection(); + if( !xIntrospection.is() ) + throw ServiceNotRegisteredException(); + + // und inspecten + Any aObjAny( &xObject, ::getCppuType( (const Reference< XInterface > *)0) ); + Reference< XIntrospectionAccess > xAccess = xIntrospection->inspect( aObjAny ); + if( !xAccess.is() ) + throw IntrospectionException(); + + // Name der removeListener-Methode zusammenbasteln + OUString aRemoveListenerName; + OUString aListenerName( ListenerType ); + sal_Int32 nIndex = aListenerName.lastIndexOf( '.' ); + // set index to the interface name without package name + if( nIndex == -1 ) + // not found + nIndex = 0; + else + nIndex++; + if( aListenerName[nIndex] == 'X' ) + // erase X from the interface name + aListenerName = aListenerName.copy( nIndex +1 ); + aRemoveListenerName = OUString( RTL_CONSTASCII_USTRINGPARAM("remove") ) + aListenerName; + + // Methoden nach der passenden addListener-Methode durchsuchen + Sequence< Reference< XIdlMethod > > aMethodSeq = xAccess->getMethods( MethodConcept::LISTENER ); + sal_uInt32 i, nLen = aMethodSeq.getLength(); + const Reference< XIdlMethod >* pMethods = aMethodSeq.getConstArray(); + for( i = 0 ; i < nLen ; i++ ) + { + // Methode ansprechen + const Reference< XIdlMethod >& rxMethod = pMethods[i]; + + // Ist es die richtige Methode? + if( aRemoveListenerName == rxMethod->getName() ) + { + Sequence< Reference< XIdlClass > > params = rxMethod->getParameterTypes(); + sal_uInt32 nParamCount = params.getLength(); + + // Nur der Listener als Parameter? + if( nParamCount == 1 ) + { + Sequence< Any > args( 1 ); + args.getArray()[0] <<= aToRemoveListener; + try + { + rxMethod->invoke( aObjAny, args ); + } + catch( InvocationTargetException& ) + { + throw IntrospectionException(); + } + } + // Sonst den Zusatzparameter mit uebergeben + else if( nParamCount == 2 ) + { + Sequence< Any > args( 2 ); + Any* pAnys = args.getArray(); + + // Typ des 1. Parameters pruefen + Reference< XIdlClass > xParamClass = params.getConstArray()[0]; + if( xParamClass->getTypeClass() == TypeClass_STRING ) + pAnys[0] <<= AddListenerParam; + + // 2. Parameter == Listener? TODO: Pruefen! + pAnys[1] <<= aToRemoveListener; + + // TODO: Konvertierung String -> ? + // else + try + { + rxMethod->invoke( aObjAny, args ); + } + catch( InvocationTargetException& ) + { + throw IntrospectionException(); + } + } + break; + } + } +} + +} + +extern "C" +{ +//================================================================================================== +void SAL_CALL component_getImplementationEnvironment( + const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv ) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} +//================================================================================================== +sal_Bool SAL_CALL component_writeInfo( + void * pServiceManager, void * pRegistryKey ) +{ + if (pRegistryKey) + { + try + { + // DefaultRegistry + Reference< XRegistryKey > xNewKey( + reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( + OUString( RTL_CONSTASCII_USTRINGPARAM( "/" IMPLNAME "/UNO/SERVICES") ))); + + Sequence< OUString > & rSNL = + ::comp_EventAttacher::EventAttacherImpl::getSupportedServiceNames_Static(); + const OUString * pArray = rSNL.getConstArray(); + for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) + xNewKey->createKey( pArray[nPos] ); + + return sal_True; + } + catch (InvalidRegistryException &) + { + OSL_ENSHURE( sal_False, "### InvalidRegistryException!" ); + } + } + return sal_False; +} +//================================================================================================== +void * SAL_CALL component_getFactory( + const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) +{ + void * pRet = 0; + + if (pServiceManager && rtl_str_compare( pImplName, IMPLNAME ) == 0) + { + Reference< XSingleServiceFactory > xFactory( createOneInstanceFactory( + reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + OUString( RTL_CONSTASCII_USTRINGPARAM( pImplName ) ), + ::comp_EventAttacher::EventAttacherImpl_CreateInstance, + ::comp_EventAttacher::EventAttacherImpl::getSupportedServiceNames_Static() ) ); + + if (xFactory.is()) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + } + + return pRet; +} +} + + + diff --git a/eventattacher/source/makefile.mk b/eventattacher/source/makefile.mk new file mode 100644 index 000000000000..e0d2f4f11f6d --- /dev/null +++ b/eventattacher/source/makefile.mk @@ -0,0 +1,132 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:15:25 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* +PRJ=.. + +PRJNAME= eventattacher +TARGET= evtatt +USE_DEFFILE= TRUE +NO_BSYMBOLIC= TRUE +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# ------------------------------------------------------------------ + +UNOUCRRDB= $(SOLARBINDIR)$/applicat.rdb +UNOUCRDEP= $(UNOUCRRDB) + +UNOUCROUT= $(OUT)$/inc +INCPRE+= $(OUT)$/inc + +UNOTYPES= \ + com.sun.star.registry.XRegistryKey \ + com.sun.star.lang.XServiceInfo \ + com.sun.star.lang.XInitialization \ + com.sun.star.lang.XTypeProvider \ + com.sun.star.lang.XMultiServiceFactory \ + com.sun.star.lang.XSingleServiceFactory \ + com.sun.star.beans.XIntrospection \ + com.sun.star.beans.MethodConcept \ + com.sun.star.script.XEventAttacher \ + com.sun.star.script.XTypeConverter \ + com.sun.star.script.XInvocationAdapterFactory \ + com.sun.star.script.XInvocation \ + com.sun.star.script.XAllListener \ + com.sun.star.reflection.XIdlReflection \ + com.sun.star.uno.TypeClass \ + com.sun.star.uno.XInterface \ + com.sun.star.uno.XWeak \ + com.sun.star.uno.XAggregation + + +SLOFILES= \ + $(SLO)$/eventattacher.obj +# NETBSD: somewhere we have to instantiate the static data members. +# NETBSD-1.2.1 doesn't know about weak symbols so the default mechanism for GCC won't work. +# SCO and MACOSX: the linker does know about weak symbols, but we can't ignore multiple defined symbols +.IF "$(OS)"=="NETBSD" || "$(OS)"=="SCO" || "$(OS)$(COM)"=="OS2GCC" || "$(OS)"=="MACOSX" +SLOFILES+=$(SLO)$/staticmb.obj +.ENDIF + +SHL1TARGET= $(TARGET) + +SHL1STDLIBS= \ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(VOSLIB) \ + $(SALLIB) + +SHL1DEPN= +SHL1IMPLIB= i$(TARGET) +SHL1LIBS= $(SLB)$/$(TARGET).lib +SHL1DEF= $(MISC)$/$(SHL1TARGET).def + +DEF1NAME= $(SHL1TARGET) +DEF1EXPORTFILE= exports.dxp + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk |