diff options
79 files changed, 31435 insertions, 0 deletions
diff --git a/framework/inc/classes/framecontainer.hxx b/framework/inc/classes/framecontainer.hxx new file mode 100644 index 000000000000..1f6c6c01b024 --- /dev/null +++ b/framework/inc/classes/framecontainer.hxx @@ -0,0 +1,417 @@ +/************************************************************************* + * + * $RCSfile: framecontainer.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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 __FRAMEWORK_CLASSES_FRAMECONTAINER_HXX_ +#define __FRAMEWORK_CLASSES_FRAMECONTAINER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_ +#include <macros/debug.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_ +#include <com/sun/star/frame/XFrame.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_ +#include <com/sun/star/uno/Reference.h> +#endif + +#ifndef __SGI_STL_VECTOR +#include <stl/vector> +#endif + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +#define XFRAME ::com::sun::star::frame::XFrame +#define REFERENCE ::com::sun::star::uno::Reference +#define SEQUENCE ::com::sun::star::uno::Sequence +#define STLVECTOR ::std::vector + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implement a container to hold childs of frame, task or desktop + @descr Every object of frame, task or desktop hold reference to his childs. These container is used as helper + to do this. Some helper-classe like OFrames or OTasksAccess use it to. They hold a pointer to an instance + of this class, which is a member of a frame, task or desktop! You can append and remove frames. + It's possible to set one of these frames as active or deactive. You could have full index-access to + container-items. To block append- or remove-calls, its possible to set a lock. Nobody can change the container + the lock is set. But don't forget to unlock the container again! + These class is NOT threadsafe! + + @implements - + @base - + + @ATTENTION This class is not threadsafe. + + @devstatus deprecated +*//*-*************************************************************************************************************/ + +class FrameContainer +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor + @descr This will initialize an empty container. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + FrameContainer(); + + /*-****************************************************************************************************//** + @short standard destructor to delete instance + @descr This will clear the container, if programmer forget this. + + @seealso method clear() + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~FrameContainer(); + + /*-****************************************************************************************************//** + @short append a new frame to the end of container + @descr The reference must be valid! If it's not, we do nothing. + If a lock is set, we do nothing to. + (In debug version an assertion is thrown to show the programmer possible problems!) + + @seealso - + + @param "xFrame" is the frame to add in container. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void append( const REFERENCE< XFRAME >& xFrame ); + + /*-****************************************************************************************************//** + @short remove an existing frame from the container + @descr The reference must be valid! If element not exist in container we do nothing. + If a lock is set, we do nothing to. + (In debug version an assertion is thrown to show the programmer possible problems!) + + @seealso method clear() + + @param "xFrame" is the frame to remove from the container. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void remove( const REFERENCE< XFRAME >& xFrame ); + + /*-****************************************************************************************************//** + @short ask for an existing frame in container + @descr Use it to get information about existing items in container. + The reference must be valid! The lock is ignored! (We do not change the content of container.) + + @seealso - + + @param "xFrame" is the frame to search. + @return sal_True , if frame exist<BR> + sal_False, other way. + + @onerror We return sal_False. + *//*-*****************************************************************************************************/ + + sal_Bool exist( const REFERENCE< XFRAME >& xFrame ); + + /*-****************************************************************************************************//** + @short clear the container and free memory + @descr This will clear the container. If you call this method again and the container is already empty, we do nothing! + If a lock is set, we do nothing. + (In debug version an assertion is thrown to show the programmer this problem!) + + @seealso method remove() + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void clear(); + + /*-****************************************************************************************************//** + @short lock container + @descr You can use some methods of this class to have full access to the container by index! + But if someone add or remove frames to/from container we have a problem.... + With this method you can LOCK the container and all append()-, remove()- and clear()-calls are blocked. + But ... don't forget to unlock ... !!! + + @seealso method unlock() + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void lock(); + + /*-****************************************************************************************************//** + @short unlock container + @descr You can use some methods of this class to break full access to the container by index! + From now, all access methods by index are blocked. Append(), remove() and clear() are non blocked. + + @seealso method lock() + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void unlock(); + + /*-****************************************************************************************************//** + @short get count of items in container + @descr We ignore the lock - because caller can know these value but he can use it for + direct indexaccess only, if a lock is set! + + @seealso - + + @param - + @return count of container items. + + @onerror - + *//*-*****************************************************************************************************/ + + sal_uInt32 getCount() const; + + /*-****************************************************************************************************//** + @short get item of container by index + @descr If no lock is set, we return NULL. The index must in range [0 ... count-1]! + + @seealso - + + @param - + @return Frame item, if index valid<BR> + NULL, other way. + + @onerror We return NULL! + *//*-*****************************************************************************************************/ + + REFERENCE< XFRAME > operator[]( sal_uInt32 nIndex ) const; + + /*-****************************************************************************************************//** + @short get all current items of container as snapshot + @descr No lock must set. We return a snapshot only. + + @seealso - + + @param - + @return Sequence of frames + + @onerror - + *//*-*****************************************************************************************************/ + + SEQUENCE< REFERENCE< XFRAME > > getAllElements(); + + /*-****************************************************************************************************//** + @short ask it to get information about existing elements + @descr No lock must set. We use current container items only. + + @seealso - + + @param - + @return sal_True , if one or more elements exist<BR> + sal_False, other way. + + @onerror We return sal_False. + *//*-*****************************************************************************************************/ + + sal_Bool hasElements() const; + + /*-****************************************************************************************************//** + @short set the current active frame in container + @descr Some implementations like Desktop or Frame need an active frame. + But this frame must be a child of these objects! Its not possible to hold an extra reference + for these special case. Its better to control this rule by the container himself. + He know, which frame is child or not. + + @seealso method Desktop::setActiveFrame() + @seealso method Frame::setActiveFrame() + + @param "xFrame" must a valid reference to an existing frame in container. + @return - + + @onerror If refrence not valid, we throw an assertion! + *//*-*****************************************************************************************************/ + + void setActive( const REFERENCE< XFRAME >& xFrame ); + + /*-****************************************************************************************************//** + @short get the current active frame in container. + @descr - + + @seealso method Desktop::getActiveFrame() + @seealso method Frame::getActiveFrame() + + @param - + @return A valid reference, if an active one exist. + A null-reference, other way. + + @onerror We return a null-reference. + *//*-*****************************************************************************************************/ + + REFERENCE< XFRAME > getActive() const; + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + //------------------------------------------------------------------------------------------------------------- + // debug methods + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short debug-method to check incoming parameter of some other mehods of this class + @descr The following methods are used to check parameters for other methods + of this class. The return value is used directly for an ASSERT(...). + + @seealso ASSERTs in implementation! + + @param references to checking variables + @return sal_False on invalid parameter<BR> + sal_True otherway + + @onerror - + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + private: + + sal_Bool impldbg_checkParameter_append ( const REFERENCE< XFRAME >& xFrame ) const; + sal_Bool impldbg_checkParameter_remove ( const REFERENCE< XFRAME >& xFrame ) const; + sal_Bool impldbg_checkParameter_exist ( const REFERENCE< XFRAME >& xFrame ) const; + sal_Bool impldbg_checkParameter_IndexOperator ( sal_uInt32 nIndex ) const; + sal_Bool impldbg_checkParameter_setActive ( const REFERENCE< XFRAME >& xFrame ) const; + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // private variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + sal_Bool m_bLock ; /// lock to block append()-, remove()- or clear()-calls + STLVECTOR< REFERENCE< XFRAME > > m_aContainer ; /// list to hold all frames + REFERENCE< XFRAME > m_xActiveFrame ; /// one container item can be the current active frame. Its neccessary for Desktop or Frame implementation. + +}; // class FrameContainer + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_CLASSES_FRAMECONTAINER_HXX_ diff --git a/framework/inc/classes/servicemanager.hxx b/framework/inc/classes/servicemanager.hxx new file mode 100644 index 000000000000..0ee10abafe34 --- /dev/null +++ b/framework/inc/classes/servicemanager.hxx @@ -0,0 +1,247 @@ +/************************************************************************* + * + * $RCSfile: servicemanager.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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 __FRAMEWORK_CLASSES_SERVICEMANAGER_HXX_ +#define __FRAMEWORK_CLASSES_SERVICEMANAGER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_OMUTEXMEMBER_HXX_ +#include <helper/omutexmember.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_ +#include <macros/debug.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_ +#include <com/sun/star/uno/Reference.h> +#endif + +#ifndef _RTL_USTRING_ +#include <rtl/ustring> +#endif + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +#define REFERENCE ::com::sun::star::uno::Reference +#define XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory +#define OUSTRING ::rtl::OUString + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short create a new global servicemanager + @descr A global servicemanager is neccessary to instanciate UNO-services. To do this, you need + a factory to create new objects with special type. That's the reason for a servicemanager. + + @implements - + @base OMutexMember + + @devstatus deprecated +*//*-*************************************************************************************************************/ + +class ServiceManager : public OMutexMember // Struct for right initalization of mutex member! +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor + @descr This method don't initialize the new global servicemanager! + Use getManager() function to do this. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + ServiceManager(); + + /*-****************************************************************************************************//** + @short standard destructor to delete instance + @descr Here is a good place to destroy the global manager instance! + But we don't do it in these implementation. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~ServiceManager(); + + /*-****************************************************************************************************//** + @short return a reference to the global servicemanager instance + @descr This method create a new manager only at first call. We confiscate this with a static + pointer, which will be initialized only, if it NULL! + Then you can call this method everytime to get a reference to the manager. + + @seealso - + + @param - + @return A reference to the global servicemanager. It can be NULL! + + @onerror We return a null-reference. + *//*-*****************************************************************************************************/ + + REFERENCE< XMULTISERVICEFACTORY > getManager(); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short create a new global servicemanager instance + @descr Is a helper-method for getManager(). + + @seealso method getManager() + + @param - + @return A reference to a new initialized servicemanager with a valid registry. + It can be NULL, if an error occured. + + @onerror Return a NULL-reference. + *//*-*****************************************************************************************************/ + + REFERENCE< XMULTISERVICEFACTORY > impl_createManager(); + + //------------------------------------------------------------------------------------------------------------- + // debug methods + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short debug-method to check incoming parameter of some other mehods of this class + @descr The following methods are used to check parameters for other methods + of this class. The return value is used directly for an ASSERT(...). + + @seealso ASSERTs in implementation! + + @param references to checking variables + @return sal_False on invalid parameter<BR> + sal_True otherway + + @onerror - + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + private: + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // private variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + +}; // class ServiceManager + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_CLASSES_SERVICEMANAGER_HXX_ diff --git a/framework/inc/classes/taskcreator.hxx b/framework/inc/classes/taskcreator.hxx new file mode 100644 index 000000000000..b435c0ae59aa --- /dev/null +++ b/framework/inc/classes/taskcreator.hxx @@ -0,0 +1,240 @@ +/************************************************************************* + * + * $RCSfile: taskcreator.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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 __FRAMEWORK_CLASSES_TASKCREATOR_HXX_ +#define __FRAMEWORK_CLASSES_TASKCREATOR_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_MACROS_GENERIC_HXX_ +#include <macros/generic.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_ +#include <macros/debug.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_ +#include <com/sun/star/frame/XFrame.hpp> +#endif + +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_ +#include <com/sun/star/uno/Reference.h> +#endif + +#ifndef _RTL_USTRING_ +#include <rtl/ustring> +#endif + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +#define OUSTRING ::rtl::OUString +#define REFERENCE ::com::sun::star::uno::Reference +#define XFRAME ::com::sun::star::frame::XFrame +#define XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short a helper to create new tasks or plugin frames for "_blank" or FrameSearchFlag::CREATE at desktop + @descr There are different places to create new tasks/plugin frames. Its not easy to service this code! + Thats the reason for this helper. These implementation is not thread safe! + + @implements - + @base - + + @devstatus deprecated +*//*-*************************************************************************************************************/ + +class TaskCreator +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor + @descr Initialize some member. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + TaskCreator( const REFERENCE< XMULTISERVICEFACTORY >& xFactory ); + + /*-****************************************************************************************************//** + @short standard destructor to delete instance + @descr Clear all member. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~TaskCreator(); + + /*-****************************************************************************************************//** + @short create a new task/plugin frame + @descr With these methods you can create a new empty system task or a new empty plugin frame + in a browser window. + + @seealso - + + @param "sName", name of new task + @return A reference to the new created task/plugin. (It's a frame too ... frame is the baseclass of a task!) + + @onerror We return a null-reference. + *//*-*****************************************************************************************************/ + + REFERENCE< XFRAME > createNewSystemTask ( const OUSTRING& sName ); + REFERENCE< XFRAME > createNewBrowserTask( const OUSTRING& sName ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + //------------------------------------------------------------------------------------------------------------- + // debug methods + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short debug-method to check incoming parameter of some other mehods of this class + @descr The following methods are used to check parameters for other methods + of this class. The return value is used directly for an ASSERT(...). + + @seealso ASSERTs in implementation! + + @param references to checking variables + @return sal_False on invalid parameter<BR> + sal_True otherway + + @onerror - + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + private: + + sal_Bool impldbg_checkParameter_createNewSystemTask ( const OUSTRING& sName ); + sal_Bool impldbg_checkParameter_createNewBrowserTask( const OUSTRING& sName ); + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // private variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + REFERENCE< XMULTISERVICEFACTORY > m_xFactory ; + +}; // class TaskCreator + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_CLASSES_TASKCREATOR_HXX_ diff --git a/framework/inc/classes/wildcard.hxx b/framework/inc/classes/wildcard.hxx new file mode 100644 index 000000000000..26a7d0c744db --- /dev/null +++ b/framework/inc/classes/wildcard.hxx @@ -0,0 +1,225 @@ +/************************************************************************* + * + * $RCSfile: wildcard.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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 __FRAMEWORK_CLASSES_WILDCARD_HXX_ +#define __FRAMEWORK_CLASSES_WILDCARD_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_ +#include <macros/debug.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#ifndef _RTL_USTRING_ +#include <rtl/ustring> +#endif + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +#define OUSTRING ::rtl::OUString + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implement wildcard-mechanism for unicode + @descr This class can be used to get information about the matching of a pattern to a given text. + It's suitable for 8-Bit- AND 16-Bit-strings! + + @implements - + @base - + + @ATTENTION This class is'nt threadsafe! + + @devstatus deprecated +*//*-*************************************************************************************************************/ + +class Wildcard +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard ctor + @descr We do nothing here. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + Wildcard(); + + /*-****************************************************************************************************//** + @short standard dtor + @descr We do nothing here. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~Wildcard(); + + //--------------------------------------------------------------------------------------------------------- + // interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short try to find an agreement between given text and searchpattern + @descr You can use wildcards in pattern only! + + @seealso - + + @param "sText" is the text, in which we search given pattern. + @param "sPattern" is the searched pattern with includes wildcards. + @return sal_True , if pattern was found. + @return sal_False, if pattern don't match the text. + + @onerror - + *//*-*****************************************************************************************************/ + + static sal_Bool match( const OUSTRING& sText , + const OUSTRING& sPattern ); + + //--------------------------------------------------------------------------------------------------------- + // debug and test methods + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short debug-methods to check incoming parameter of some other mehods of this class + @descr The follow methods are used to check parameters for other methods + of this class. The return value is used directly for an ASSERT(...). + This mechanism is active in debug version only! + + @seealso FRAMEWORK_ASSERT in implementation! + + @param references to checking variables + @return sal_False on invalid parameter + @return sal_True otherwise + + @onerror - + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + static sal_Bool impldbg_checkParameter_match( const OUSTRING& sText , + const OUSTRING& sPattern ); + + #endif // #ifdef ENABLE_ASSERTIONS + + /*-****************************************************************************************************//** + @short test implementation of match() with different examples + @descr If TESTMODE activated, you cann call these method to start and log some special examples. + Do this if you have changed the implementation of method match() to test it. + + @seealso - + + @param - + @return - + + @onerror Error-conditions are written to file or show in a messagebox. + Thhat depends from current setting of ASSERT_OUTPUTTYPE. (see debug.hxx for further informations.) + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_CLASSDEBUG + + void impldbg_testWildcard(); + + #endif // #ifdef ENABLE_CLASSDEBUG + +}; // class Wildcard + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_CLASSES_WILDCARD_HXX_ diff --git a/framework/inc/helper/oframes.hxx b/framework/inc/helper/oframes.hxx new file mode 100644 index 000000000000..dd7587eda0fe --- /dev/null +++ b/framework/inc/helper/oframes.hxx @@ -0,0 +1,437 @@ +/************************************************************************* + * + * $RCSfile: oframes.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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 __FRAMEWORK_HELPER_OFRAMES_HXX_ +#define __FRAMEWORK_HELPER_OFRAMES_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_CLASSES_FRAMECONTAINER_HXX_ +#include <classes/framecontainer.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_GENERIC_HXX_ +#include <macros/generic.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_XINTERFACE_HXX_ +#include <macros/xinterface.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_ +#include <macros/debug.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XFRAMES_HPP_ +#include <com/sun/star/frame/XFrames.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_ +#include <com/sun/star/frame/XFrame.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +#ifndef _CPPUHELPER_WEAKREF_HXX_ +#include <cppuhelper/weakref.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +#define ANY ::com::sun::star::uno::Any +#define INDEXOUTOFBOUNDSEXCEPTION ::com::sun::star::lang::IndexOutOfBoundsException +#define MUTEX ::osl::Mutex +#define OWEAKOBJECT ::cppu::OWeakObject +#define RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException +#define UNOTYPE ::com::sun::star::uno::Type +#define WEAKREFERENCE ::com::sun::star::uno::WeakReference +#define WRAPPEDTARGETEXCEPTION ::com::sun::star::lang::WrappedTargetException +#define XFRAME ::com::sun::star::frame::XFrame +#define XFRAMES ::com::sun::star::frame::XFrames +#define XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implement XFrames, XIndexAccess and XElementAccess interfaces as helper for services + @descr Use this class as helper for these interfaces. We share mutex and framecontainer with ouer owner. + The framecontainer is a member of it from type "FrameContainer". That means; + we have the same information as ouer owner. In current implementation we use mutex and lock-mechanism + to prevent against compete access. In future we plan support of semaphore! + + @devstatus deprecated + @implements XInterface + XFrames + XIndexAccess + XElementAccess + [ XDebugging if TEST_TREE is defined! ] + @base OWeakObject + + @ATTENTION Don't use this class as direct member - use it dynamicly. Do not derive from this class. + We hold a weakreference to ouer owner not to ouer superclass. + + @devstatus deprecated +*//*-*************************************************************************************************************/ + +//class OFrames : DERIVE_FROM_XSPECIALDEBUGINTERFACE // => These macro will expand to nothing, if no testmode is set in debug.h! +class OFrames : public XFRAMES , //=> XIndexAccess => XElementAccess + public OWEAKOBJECT +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard ctor + @descr These initialize a new instance of this class with all needed informations for work. + We share mutex and framecontainer with owner implementation! + + @seealso - + + @param "xFactory" , reference to factory which has created ouer owner(!). We can use these to create new uno-services. + @param "aMutex" , reference to shared mutex of owner implementation. + @param "xOwner" , reference to ouer owner. We hold a wekreference to prevent us against cross-references! + @param "pFrameContainer" , pointer to shared framecontainer of owner. It's valid only, if weakreference is valid! + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + OFrames( const REFERENCE< XMULTISERVICEFACTORY >& xFactory , + MUTEX& aMutex , + const REFERENCE< XFRAME >& xOwner , + FrameContainer* pFrameContainer ); + + //--------------------------------------------------------------------------------------------------------- + // XInterface + //--------------------------------------------------------------------------------------------------------- + + DECLARE_XINTERFACE +// DECLARE_XSPECIALDEBUGINTERFACE // => These macro will expand to nothing, if no testmode is set in debug.h! + + //--------------------------------------------------------------------------------------------------------- + // XFrames + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short append frame to container + @descr We share the container with ouer owner. We can do this only, if no lock is set on container. + Valid references are accepted only! + + @seealso class FrameContainer + + @param "xFrame", reference to an existing frame to append. + @return - + + @onerror We do nothing in release or throw an assert in debug version. + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL append( const REFERENCE< XFRAME >& xFrame ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short remove frame from container + @descr This is the companion to append(). We only accept valid references and don't work, if + a lock is set. + + @seealso class FrameContainer + + @param "xFrame", reference to an existing frame to remove. + @return - + + @onerror We do nothing in release or throw an assert in debug version. + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL remove( const REFERENCE< XFRAME >& xFrame ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short return list of all applicable frames for given flags + @descr Call these to get a list of all frames, which are match with given search flags. + + @seealso - + + @param "nSearchFlag", flags to search right frames. + @return A list of founded frames. + + @onerror An empty list is returned. + *//*-*****************************************************************************************************/ + + virtual SEQUENCE< REFERENCE< XFRAME > > SAL_CALL queryFrames( sal_Int32 nSearchFlags ) throw( RUNTIMEEXCEPTION ); + + //--------------------------------------------------------------------------------------------------------- + // XIndexAccess + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short get count of all current frames in container + @descr This is the beginning of full index-access. With a count you can step over all items in container. + Next call shuod be getByIndex(). But these mechanism works only, if no lock in container is set! + + @seealso class FrameContainer + @seealso method getByIndex() + + @param - + @return Count of current items in container. + + @onerror If a lock is set, we return 0 for prevent further access! + *//*-*****************************************************************************************************/ + + virtual sal_Int32 SAL_CALL getCount() throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short get specified container item by index + @descr If you called getCount() successful - this method return the specified element as an Any. + You must observe the range from 0 to count-1! Otherwise an IndexOutOfBoundsException is thrown. + + @seealso class FrameContainer + @seealso method getCount() + + @param "nIndex", valid index to get container item. + @return A container item (specified by index) wrapped in an Any. + + @onerror If a lock is set, we return an empty Any! + @onerror If index out of range, an IndexOutOfBoundsException is thrown. + *//*-*****************************************************************************************************/ + + virtual ANY SAL_CALL getByIndex( sal_Int32 nIndex ) throw( INDEXOUTOFBOUNDSEXCEPTION , + WRAPPEDTARGETEXCEPTION , + RUNTIMEEXCEPTION ); + + //--------------------------------------------------------------------------------------------------------- + // XElementAccess + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short get uno-type of all container items + @descr In current implementation type is fixed to XFrame! + (container-lock is ignored) + + @seealso - + + @param - + @return A uno-type descriptor. + + @onerror - + *//*-*****************************************************************************************************/ + + virtual UNOTYPE SAL_CALL getElementType() throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short get fill state of current container + @descr Call these to get information about, if items exist in container or not. + (container-lock is ignored) + + @seealso - + + @param - + @return sal_True, if container contains some items. + @return sal_False, otherwise. + + @onerror We return sal_False. + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL hasElements() throw( RUNTIMEEXCEPTION ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + /*-****************************************************************************************************//** + @short standard destructor + @descr This method destruct an instance of this class and clear some member. + This method is protected, because its not allowed to use this class as a member! + You MUST use a dynamical instance (pointer). That's the reason for a protected dtor. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~OFrames(); + + /*-****************************************************************************************************//** + @short reset instance to default values + @descr There are two ways to delete an instance of this class.<BR> + 1) delete with destructor<BR> + 2) dispose from parent or factory ore ...<BR> + This method do the same for both ways! It free used memory and release references ... + + @seealso method dispose() (if it exist!) + @seealso destructor ~TaskEnumeration() + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void impl_resetObject(); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short append one sequence to another + @descr There is no operation to add to sequences! Use this helper-method to do this. + + @seealso class Sequence + + @param "seqDestination", reference to sequence on which operation will append the other sequence. + @param "seqSource" , reference to sequence for append. + @return "seqDestination" is parameter AND return value at the same time. + + @onerror - + *//*-*****************************************************************************************************/ + + void impl_appendSequence( SEQUENCE< REFERENCE< XFRAME > >& seqDestination , + const SEQUENCE< REFERENCE< XFRAME > >& seqSource ); + + //------------------------------------------------------------------------------------------------------------- + // debug methods + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short debug-method to check incoming parameter of some other mehods of this class + @descr The following methods are used to check parameters for other methods + of this class. The return value is used directly for an ASSERT(...). + + @seealso ASSERTs in implementation! + + @param references to checking variables + @return sal_False ,on invalid parameter + @return sal_True ,otherwise + + @onerror - + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + private: + + sal_Bool impldbg_checkParameter_OFramesCtor ( const REFERENCE< XMULTISERVICEFACTORY >& xFactory , + MUTEX& aMutex , + const REFERENCE< XFRAME >& xOwner , + FrameContainer* pFrameContainer ); + sal_Bool impldbg_checkParameter_append ( const REFERENCE< XFRAME >& xFrame ); + sal_Bool impldbg_checkParameter_remove ( const REFERENCE< XFRAME >& xFrame ); + sal_Bool impldbg_checkParameter_queryFrames ( sal_Int32 nSearchFlags ); + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + REFERENCE< XMULTISERVICEFACTORY > m_xFactory ; /// reference to global servicemanager + MUTEX& m_aMutex ; /// shared mutex with owner of an instance of this class + WEAKREFERENCE< XFRAME > m_xOwner ; /// reference to owner of this instance (Hold no hard reference!) + FrameContainer* m_pFrameContainer ; /// with owner shared list to hold all direct childs of an XFramesSupplier + sal_Bool m_bRecursiveSearchProtection ; /// flag to protect against recursive searches of frames at parents + +}; // class OFrames + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_HELPER_OFRAMES_HXX_ diff --git a/framework/inc/helper/opluginframedispatcher.hxx b/framework/inc/helper/opluginframedispatcher.hxx new file mode 100644 index 000000000000..cdb27689b23f --- /dev/null +++ b/framework/inc/helper/opluginframedispatcher.hxx @@ -0,0 +1,485 @@ +/************************************************************************* + * + * $RCSfile: opluginframedispatcher.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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 __FRAMEWORK_HELPER_OPLUGINFRAMEDISPATCHER_HXX_ +#define __FRAMEWORK_HELPER_OPLUGINFRAMEDISPATCHER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_HELPER_OMUTEXMEMBER_HXX_ +#include <helper/omutexmember.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_GENERIC_HXX_ +#include <macros/generic.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_XINTERFACE_HXX_ +#include <macros/xinterface.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_ +#include <macros/debug.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_ +#include <com/sun/star/frame/XFrame.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XDISPATCH_HPP_ +#include <com/sun/star/frame/XDispatch.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDER_HPP_ +#include <com/sun/star/frame/XDispatchProvider.hpp> +#endif + +#ifndef _COM_SUN_STAR_MOZILLA_XPLUGININSTANCE_HPP_ +#include <com/sun/star/mozilla/XPluginInstance.hpp> +#endif + +#ifndef _COM_SUN_STAR_MOZILLA_XPLUGININSTANCEPEER_HPP_ +#include <com/sun/star/mozilla/XPluginInstancePeer.hpp> +#endif + +#ifndef _COM_SUN_STAR_MOZILLA_XPLUGININSTANCENOTIFYSINK_HPP_ +#include <com/sun/star/mozilla/XPluginInstanceNotifySink.hpp> +#endif + +#ifndef _COM_SUN_STAR_UTIL_URL_HPP_ +#include <com/sun/star/util/URL.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_DISPATCHDESCRIPTOR_HPP_ +#include <com/sun/star/frame/DispatchDescriptor.hpp> +#endif + +#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_ +#include <com/sun/star/io/XInputStream.hpp> +#endif + +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ +#include <com/sun/star/beans/PROPERTYVALUE.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +#ifndef _CPPUHELPER_WEAKREF_HXX_ +#include <cppuhelper/weakref.hxx> +#endif + +#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_ +#include <cppuhelper/interfacecontainer.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +#define DISPATCHDESCRIPTOR ::com::sun::star::frame::DispatchDescriptor +#define MUTEX ::osl::Mutex +#define OMULTITYPEINTERFACECONTAINERHELPERVAR ::cppu::OMultiTypeInterfaceContainerHelperVar +#define OUSTRING ::rtl::OUString +#define OWEAKOBJECT ::cppu::OWeakObject +#define PROPERTYVALUE ::com::sun::star::beans::PropertyValue +#define REFERENCE ::com::sun::star::uno::Reference +#define RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException +#define SEQUENCE ::com::sun::star::uno::Sequence +#define UNOURL ::com::sun::star::util::URL +#define WEAKREFERENCE ::com::sun::star::uno::WeakReference +#define XDISPATCH ::com::sun::star::frame::XDispatch +#define XDISPATCHPROVIDER ::com::sun::star::frame::XDispatchProvider +#define XFRAME ::com::sun::star::frame::XFrame +#define XINPUTSTREAM ::com::sun::star::io::XInputStream +#define XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory +#define XPLUGININSTANCE ::com::sun::star::mozilla::XPluginInstance +#define XPLUGININSTANCENOTIFYSINK ::com::sun::star::mozilla::XPluginInstanceNotifySink +#define XPLUGININSTANCEPEER ::com::sun::star::mozilla::XPluginInstancePeer +#define XSTATUSLISTENER ::com::sun::star::frame::XStatusListener + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +struct tIMPLExtractedArguments +{ + OUSTRING sReferrer ; // Value of extracted referrer argument + REFERENCE< XINPUTSTREAM > xPostDataStream ; // Value of extracted data stream for posting + + sal_Int32 nValidMask ; // state of extracted arguments +}; + +/*-************************************************************************************************************//** + Use OMultiTypeInterfaceContainerHelperVar-template to create new class to get a container + to combine string values with listeners. +*//*-*************************************************************************************************************/ + +struct IMPL_hashCode +{ + size_t operator()(const OUSTRING& sString) const + { + return sString.hashCode(); + } +}; + +typedef OMULTITYPEINTERFACECONTAINERHELPERVAR< OUSTRING , + IMPL_hashCode , + std::equal_to< OUSTRING > > IMPL_ListenerContainerHelper ; + +/*-************************************************************************************************************//** + @short - + @descr - + + @implements XInterface + XDispatchProvider + XDispatch + XPluginInstanceNotifySink + [ XDebugging if ENABLE_SERVICEDEBUG is defined! ] + @base OWeakObject + + @devstatus deprecated +*//*-*************************************************************************************************************/ + +//class OPlugInFrameDispatcher : DERIVE_FROM_XSPECIALDEBUGINTERFACE // => These macro will expand to nothing, if no testmode is set in debug.h! +class OPlugInFrameDispatcher : public XDISPATCHPROVIDER , + public XDISPATCH , + public XPLUGININSTANCENOTIFYSINK , + public OWEAKOBJECT +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard ctor + @descr These initialize a new instance of ths class with needed informations for work. + + @seealso using at owner + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + OPlugInFrameDispatcher( const REFERENCE< XMULTISERVICEFACTORY >& xFactory , + MUTEX& aMutex , + const REFERENCE< XPLUGININSTANCE >& xOwner , + const REFERENCE< XPLUGININSTANCEPEER >& xPlugInDLL ); + + //--------------------------------------------------------------------------------------------------------- + // XInterface + //--------------------------------------------------------------------------------------------------------- + + DECLARE_XINTERFACE +// DECLARE_XSPECIALDEBUGINTERFACE // => These macro will expand to nothing, if no testmode is set in debug.h! + + //--------------------------------------------------------------------------------------------------------- + // XDispatchProvider + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short search a dispatcher for given URL + @descr If no interceptor is set on owner, we search for right frame and dispatch URL to it. + If no frame was found, we do nothing. + + @seealso - + + @param "aURL" , URL to dispatch. + @param "sTargetFrameName" , name of searched frame. + @param "nSearchFlags" , flags for searching. + @return A reference a dispatcher for these URL (if someone was found!). + + @onerror We return a NULL-reference. + *//*-*****************************************************************************************************/ + + virtual REFERENCE< XDISPATCH > SAL_CALL queryDispatch( const UNOURL& aURL , + const OUSTRING& sTargetFrameName , + sal_Int32 nSearchFlags ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short search dispatcher for more the one URL + @descr Call this method, if you search dispatcher for more then one URL at the same time. + ( But these mode is not supported yet! ) + + @seealso - + + @param "seqDescripts", descriptor to search more then one dispatcher. + @return A list of founded dispatcher. (if somewhere exist!) + + @onerror An empty list is returned. + *//*-*****************************************************************************************************/ + + virtual SEQUENCE< REFERENCE< XDISPATCH > > SAL_CALL queryDispatches( const SEQUENCE< DISPATCHDESCRIPTOR >& seqDescripts ) throw( RUNTIMEEXCEPTION ); + + //--------------------------------------------------------------------------------------------------------- + // XDispatch + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short dispatch URL with arguments + @descr This class implement XDispatch interface to. We use the implementation of ouer owner + directly to do this. He must support a function impl_loadComponent(). + + @seealso methode <owner>::impl_loadComponent() + + @param "aURL" , URL to dispatch. + @param "seqArguments" , list of optional arguments. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL dispatch( const UNOURL& aURL , + const SEQUENCE< PROPERTYVALUE >& seqArguments) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short add listener for state events + @descr - + + @seealso - + + @param "xControl" , reference to a valid listener for state events. + @param "aURL" , URL about listener will be informed, if something occured. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL addStatusListener( const REFERENCE< XSTATUSLISTENER >& xControl, + const UNOURL& aURL ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short remove listener + @descr - + + @seealso - + + @param "xControl" , reference to a valid listener. + @param "aURL" , URL on which listener has registered. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL removeStatusListener( const REFERENCE< XSTATUSLISTENER >& xControl, + const UNOURL& aURL ) throw( RUNTIMEEXCEPTION ); + + //--------------------------------------------------------------------------------------------------------- + // XPluginInstanceNotifySink + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void SAL_CALL notifyURL( const OUSTRING& sURL ) throw( RUNTIMEEXCEPTION ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + /*-****************************************************************************************************//** + @short standard destructor + @descr This method destruct an instance of this class and clear some member. + This method is protected, because its not allowed to use an instance of this class as a member! + You MUST use a pointer. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~OPlugInFrameDispatcher(); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + tIMPLExtractedArguments impl_extractArguments( const SEQUENCE< PROPERTYVALUE >& seqArguments ); + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void impl_sendStatusEvent( const OUSTRING& sURL , + sal_Bool bLoadingSuccessful ); + + //------------------------------------------------------------------------------------------------------------- + // debug methods + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short debug-method to check incoming parameter of some other mehods of this class + @descr The following methods are used to check parameters for other methods + of this class. The return value is used directly for an ASSERT(...). + + @seealso ASSERTs in implementation! + + @param references to checking variables + @return sal_False on invalid parameter<BR> + sal_True otherway + + @onerror - + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + private: + + sal_Bool impldbg_checkParameter_OPlugInFrameDispatcherCtor ( const REFERENCE< XMULTISERVICEFACTORY >& xFactory , + MUTEX& aMutex , + const REFERENCE< XPLUGININSTANCE >& xOwner , + const REFERENCE< XPLUGININSTANCEPEER >& xPlugInDLL ); + sal_Bool impldbg_checkParameter_queryDispatch ( const UNOURL& aURL , + const OUSTRING& sTargetFrameName , + sal_Int32 nSearchFlags ); + sal_Bool impldbg_checkParameter_queryDispatches ( const SEQUENCE< DISPATCHDESCRIPTOR >& seqDescriptor ); + sal_Bool impldbg_checkParameter_dispatch ( const UNOURL& aURL , + const SEQUENCE< PROPERTYVALUE >& seqArguments ); + sal_Bool impldbg_checkParameter_addStatusListener ( const REFERENCE< XSTATUSLISTENER >& xControl , + const UNOURL& aURL ); + sal_Bool impldbg_checkParameter_removeStatusListener ( const REFERENCE< XSTATUSLISTENER >& xControl , + const UNOURL& aURL ); + sal_Bool impldbg_checkParameter_notifyURL ( const OUSTRING& sURL ); + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + REFERENCE< XMULTISERVICEFACTORY > m_xFactory ; /// servicemanager to create uno services + MUTEX& m_aMutex ; /// shared mutex with owner instance + WEAKREFERENCE< XPLUGININSTANCE > m_xOwnerWeak ; /// weakreference to owner (Don't use a hard reference. Owner can't delete us then!) + REFERENCE< XPLUGININSTANCEPEER > m_xPlugInDLL ; /// Interface for communication with browser. + OUSTRING m_sTargetFrameName ; /// We need it as target for get/postURL. + IMPL_ListenerContainerHelper m_aListenerContainer ; /// Container to combine listeners and URLs. + +}; // class OPlugInFrameDispatcher + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_HELPER_OPLUGINFRAMEDISPATCHER_HXX_ diff --git a/framework/inc/helper/otasksaccess.hxx b/framework/inc/helper/otasksaccess.hxx new file mode 100644 index 000000000000..ff05771ca754 --- /dev/null +++ b/framework/inc/helper/otasksaccess.hxx @@ -0,0 +1,344 @@ +/************************************************************************* + * + * $RCSfile: otasksaccess.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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 __FRAMEWORK_HELPER_OTASKSACCESS_HXX_ +#define __FRAMEWORK_HELPER_OTASKSACCESS_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_CLASSES_FRAMECONTAINER_HXX_ +#include <classes/framecontainer.hxx> +#endif + +#ifndef __FRAMEWORK_HELPER_OMUTEXMEMBER_HXX_ +#include <helper/omutexmember.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_GENERIC_HXX_ +#include <macros/generic.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_XINTERFACE_HXX_ +#include <macros/xinterface.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_ +#include <macros/debug.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_CONTAINER_XENUMERATIONACCESS_HPP_ +#include <com/sun/star/container/XEnumerationAccess.hpp> +#endif + +#ifndef _COM_SUN_STAR_CONTAINER_XELEMENTACCESS_HPP_ +#include <com/sun/star/container/XElementAccess.hpp> +#endif + +#ifndef _COM_SUN_STAR_CONTAINER_XENUMERATION_HPP_ +#include <com/sun/star/container/XEnumeration.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XDESKTOP_HPP_ +#include <com/sun/star/frame/XDesktop.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +#ifndef _CPPUHELPER_WEAKREF_HXX_ +#include <cppuhelper/weakref.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +#define ANY ::com::sun::star::uno::Any +#define EVENTOBJECT ::com::sun::star::lang::EventObject +#define NOSUCHELEMENTEXCEPTION ::com::sun::star::container::NoSuchElementException +#define OWEAKOBJECT ::cppu::OWeakObject +#define REFERENCE ::com::sun::star::uno::Reference +#define RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException +#define UNOTYPE ::com::sun::star::uno::Type +#define WEAKREFERENCE ::com::sun::star::uno::WeakReference +#define WRAPPEDTARGETEXCEPTION ::com::sun::star::lang::WrappedTargetException +#define XDESKTOP ::com::sun::star::frame::XDesktop +#define XELEMENTACCESS ::com::sun::star::container::XElementAccess +#define XENUMERATION ::com::sun::star::container::XEnumeration +#define XENUMERATIONACCESS ::com::sun::star::container::XEnumerationAccess +#define XTASK ::com::sun::star::frame::XTask +#define MUTEX ::osl::Mutex + +//_________________________________________________________________________________________________________________ +// switches +// Use these to de/activate some features of this implementation. +// (for debugging or testing!) +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implement XEnumerationAccess interface as helper to create many oneway enumeration of tasks + @descr We share mutex and framecontainer with ouer owner and have full access to his child tasks. + (Ouer owner can be the Desktop only!) We create oneway enumerations on demand. These "lists" + can be used for one time only. Step during the list from first to last element. + (The type of created enumerations is OTasksEnumeration.) + + @implements XInterface + XEnumerationAccess + XElementAccess + [ XDebugging if TEST_TREE is defined! ] + @base OWeakObject + + @devstatus deprecated +*//*-*************************************************************************************************************/ + +//class OTasksAccess : DERIVE_FROM_XSPECIALDEBUGINTERFACE // => These macro will expand to nothing, if no testmode is set in debug.h! +class OTasksAccess : public XENUMERATIONACCESS , // => XElementAccess + public OWEAKOBJECT +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short constructor to initialize this instance + @descr A desktop will create an enumeration-access-object. An enumeration is a oneway-list and a + snapshot of the tasklist of current tasks of desktop. + But we need a instance to create more then one enumerations to the same tasklist! + + @seealso class Desktop + @seealso class OTasksEnumeration + + @param "xOwner" is a reference to ouer owner and must be the desktop! + @param "pTasks" is a pointer to the taskcontainer of the desktop. We need it to create a new enumeration. + @param "aMutex" is a reference to the shared mutex of ouer owner(the desktop). + @return - + + @onerror Do nothing and reset this object to default with an empty list. + *//*-*****************************************************************************************************/ + + OTasksAccess( const REFERENCE< XDESKTOP >& xOwner , + FrameContainer* pTasks , + MUTEX& aMutex ); + + //--------------------------------------------------------------------------------------------------------- + // XInterface + //--------------------------------------------------------------------------------------------------------- + + DECLARE_XINTERFACE +// DECLARE_XSPECIALDEBUGINTERFACE // => These macro will expand to nothing, if no testmode is set in debug.h! + + //--------------------------------------------------------------------------------------------------------- + // XEnumerationAccess + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short create a new enumeration of tasks + @descr You can call this method to get a new snapshot to all tasks of the desktop as an enumeration. + + @seealso interface XEnumerationAccess + @seealso interface XEnumeration + @seealso class Desktop + + @param - + @return If the desktop and some tasks exist => a valid reference to an enumeration<BR> + An NULL-reference, other way. + + @onerror - + *//*-*****************************************************************************************************/ + + virtual REFERENCE< XENUMERATION > SAL_CALL createEnumeration() throw( RUNTIMEEXCEPTION ); + + //--------------------------------------------------------------------------------------------------------- + // XElementAccess + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short get the type of elements in enumeration + @descr - + + @seealso interface XElementAccess + @seealso class TasksEnumeration + + @param - + @return The uno-type XTask. + + @onerror - + *//*-*****************************************************************************************************/ + + virtual UNOTYPE SAL_CALL getElementType() throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short get state of tasklist of enumeration. + @descr - + + @seealso interface XElementAccess + + @param - + @return sal_True ,if more then 0 elements exist. + @return sal_False ,otherwise. + + @onerror - + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL hasElements() throw( RUNTIMEEXCEPTION ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + /*-****************************************************************************************************//** + @short standard destructor + @descr This method destruct an instance of this class and clear some member. + Don't use an instance of this class as normal member. Use it dynamicly with a pointer. + We hold a weakreference to ouer owner and not to ouer superclass! + Thats the reason for a protected dtor. + + @seealso class Desktop + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~OTasksAccess(); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + //------------------------------------------------------------------------------------------------------------- + // debug methods + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short debug-method to check incoming parameter of some other mehods of this class + @descr The following methods are used to check parameters for other methods + of this class. The return value is used directly for an ASSERT(...). + + @seealso ASSERTs in implementation! + + @param references to checking variables + @return sal_False ,on invalid parameter. + @return sal_True ,otherwise + + @onerror - + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + private: + + sal_Bool impldbg_checkParameter_OTasksAccessCtor( const REFERENCE< XDESKTOP >& xOwner , + FrameContainer* pTasks , + MUTEX& aMutex ) const; + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + MUTEX& m_aMutex ; /// shared mutex with owner + WEAKREFERENCE< XDESKTOP > m_xOwner ; /// weak reference to the desktop object! + FrameContainer* m_pTasks ; /// pointer to list of current tasks on desktop (is a member of class Desktop!) + /// This pointer is valid only, if weakreference can be locked. + +}; // class OTasksAccess + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_HELPER_OTASKSACCESS_HXX_ diff --git a/framework/inc/helper/otasksenumeration.hxx b/framework/inc/helper/otasksenumeration.hxx new file mode 100644 index 000000000000..86c7b75bc0b6 --- /dev/null +++ b/framework/inc/helper/otasksenumeration.hxx @@ -0,0 +1,341 @@ +/************************************************************************* + * + * $RCSfile: otasksenumeration.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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 __FRAMEWORK_HELPER_OTASKSENUMERATION_HXX_ +#define __FRAMEWORK_HELPER_OTASKSENUMERATION_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_OMUTEXMEMBER_HXX_ +#include <helper/omutexmember.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_GENERIC_HXX_ +#include <macros/generic.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_XINTERFACE_HXX_ +#include <macros/xinterface.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_ +#include <macros/debug.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_LANG_XEVENTLISTENER_HPP_ +#include <com/sun/star/lang/XEventListener.hpp> +#endif + +#ifndef _COM_SUN_STAR_CONTAINER_XENUMERATION_HPP_ +#include <com/sun/star/container/XEnumeration.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XTASK_HPP_ +#include <com/sun/star/frame/XTask.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_ +#include <com/sun/star/frame/XFrame.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +#define ANY ::com::sun::star::uno::Any +#define EVENTOBJECT ::com::sun::star::lang::EventObject +#define NOSUCHELEMENTEXCEPTION ::com::sun::star::container::NoSuchElementException +#define OWEAKOBJECT ::cppu::OWeakObject +#define REFERENCE ::com::sun::star::uno::Reference +#define SEQUENCE ::com::sun::star::uno::Sequence +#define RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException +#define UNOTYPE ::com::sun::star::uno::Type +#define WRAPPEDTARGETEXCEPTION ::com::sun::star::lang::WrappedTargetException +#define XENUMERATION ::com::sun::star::container::XEnumeration +#define XEVENTLISTENER ::com::sun::star::lang::XEventListener +#define XFRAME ::com::sun::star::frame::XFrame +#define XTASK ::com::sun::star::frame::XTask + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implement a helper for a oneway enumeration of tasks + @descr You can step during this list only for one time! Its a snapshot. + Don't forget to release the reference. You are the owner of an instance of this implementation. + You cant use this as a baseclass. Please use it as a dynamical object for return. + + @implements XInterface + XEventListener + XEnumeration + [ XDebugging, if TEST_TREE is defined! ] + @base OMutexMember + OWeakObject + + @devstatus deprecated +*//*-*************************************************************************************************************/ + +//class OTasksEnumeration : DERIVE_FROM_XSPECIALDEBUGINTERFACE // => These macro will expand to nothing, if no testmode is set in debug.h! +class OTasksEnumeration : public XEVENTLISTENER , + public XENUMERATION , + public OMutexMember , + public OWEAKOBJECT +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short constructor to initialize this enumeration + @descr An enumeration is a list with oneway-access! You can get every member only for one time. + This method allow to initialize this oneway list with values. + + @seealso - + + @param "seqTasks" is a sequence of interfaces, which are tasks. + @return - + + @onerror Do nothing and reset this object to default with an empty list. + *//*-*****************************************************************************************************/ + + OTasksEnumeration( const SEQUENCE< REFERENCE< XFRAME > >& seqTasks ); + + //--------------------------------------------------------------------------------------------------------- + // XInterface + //--------------------------------------------------------------------------------------------------------- + + DECLARE_XINTERFACE +// DECLARE_XSPECIALDEBUGINTERFACE // => These macro will expand to nothing, if no testmode is set in debug.h! + + //--------------------------------------------------------------------------------------------------------- + // XEventListener + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short last chance to release all references and free memory + @descr This method is called, if the enumeration is used completly and has no more elements. + Then we must destroy ouer list and release all references to other objects. + + @seealso interface XEventListener + + @param "aEvent" describe the source of this event. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL disposing( const EVENTOBJECT& aEvent ) throw( RUNTIMEEXCEPTION ); + + //--------------------------------------------------------------------------------------------------------- + // XEnumeration + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short check count of accessible elements of enumeration + @descr You can call this method to get information about accessible elements in future. + Elements you have already getted are not accessible! + + @seealso interface XEnumeration + + @param - + @return sal_True = if more elements accessible<BR> + sal_False = other way + + @onerror sal_False<BR> + (List is emtpy and there no accessible elements ...) + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL hasMoreElements() throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short give the next element, if some exist + @descr If a call "hasMoreElements()" return true, you can get the next element of list. + + @seealso interface XEnumeration + + @param - + @return A Reference to a task, safed in an Any-structure. + + @onerror If end of enumeration is arrived or there are no elements in list => a NoSuchElementException is thrown. + *//*-*****************************************************************************************************/ + + virtual ANY SAL_CALL nextElement() throw( NOSUCHELEMENTEXCEPTION , + WRAPPEDTARGETEXCEPTION , + RUNTIMEEXCEPTION ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + /*-****************************************************************************************************//** + @short standard destructor + @descr This method destruct an instance of this class and clear some member. + We make it protected, because its not supported to use this class as normal instance! + You must create it dynamical in memory and use a pointer. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~OTasksEnumeration(); + + /*-****************************************************************************************************//** + @short reset instance to default values + + @descr There are two ways to delete an instance of this class.<BR> + 1) delete with destructor<BR> + 2) dispose from parent or factory ore ...<BR> + This method do the same for both ways! It free used memory and release references ... + + @seealso method dispose() + @seealso destructor ~TaskEnumeration() + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void impl_resetObject(); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + //------------------------------------------------------------------------------------------------------------- + // debug methods + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short debug-method to check incoming parameter of some other mehods of this class + @descr The following methods are used to check parameters for other methods + of this class. The return value is used directly for an ASSERT(...). + + @seealso ASSERT in implementation! + + @param references to checking variables + @return sal_False on invalid parameter<BR> + sal_True otherway + + @onerror - + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + private: + + sal_Bool impldbg_checkParameter_OTasksEnumerationCtor ( const SEQUENCE< REFERENCE< XFRAME > >& seqTasks ); + sal_Bool impldbg_checkParameter_disposing ( const EVENTOBJECT& aEvent ); + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + sal_uInt32 m_nPosition ; /// current position in enumeration + SEQUENCE< REFERENCE< XTASK > > m_seqTasks ; /// list of current tasks + +}; // class OTasksEnumeration + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_HELPER_OTASKSENUMERATION_HXX_ diff --git a/framework/inc/macros/debug.hxx b/framework/inc/macros/debug.hxx new file mode 100644 index 000000000000..4239419bc156 --- /dev/null +++ b/framework/inc/macros/debug.hxx @@ -0,0 +1,152 @@ +/************************************************************************* + * + * $RCSfile: debug.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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 __FRAMEWORK_MACROS_DEBUG_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_HXX_ + +//***************************************************************************************************************** +// Disable all feature of this file in produkt version! +// But enable normal assertion handling (as messagebox) in normal debug version. +// User can overwrite these adjustment with his own values! We will do it only if nothing is set. +//***************************************************************************************************************** + +#ifndef DEBUG + #undef ENABLE_LOGMECHANISM + #undef ENABLE_ASSERTIONS + #undef ENABLE_EVENTDEBUG + #undef ENABLE_MUTEXDEBUG + #undef ENABLE_REGISTRATIONDEBUG + #undef ENABLE_TARGETINGDEBUG + #undef ENABLE_PLUGINDEBUG +#else + // Enable log mechanism for assertion handling. + #ifndef ENABLE_LOGMECHANISM + #define ENABLE_LOGMECHANISM + #endif + // Enable assertion handling himself. + // The default logtype is MESSAGEBOX. + // see "assertion.hxx" for further informations + #ifndef ENABLE_ASSERTIONS + #define ENABLE_ASSERTIONS + #endif +#endif + +//***************************************************************************************************************** +// generic macros for logging +//***************************************************************************************************************** + +#ifndef __FRAMEWORK_MACROS_DEBUG_LOGMECHANISM_HXX_ +#include <macros/debug/logmechanism.hxx> +#endif + +//***************************************************************************************************************** +// special macros for assertion handling +//***************************************************************************************************************** + +#ifndef __FRAMEWORK_MACROS_DEBUG_ASSERTION_HXX_ +#include <macros/debug/assertion.hxx> +#endif + +//***************************************************************************************************************** +// special macros for event handling +//***************************************************************************************************************** + +#ifndef __FRAMEWORK_MACROS_DEBUG_EVENT_HXX_ +#include <macros/debug/event.hxx> +#endif + +//***************************************************************************************************************** +// special macros to debug mutex handling +//***************************************************************************************************************** + +#ifndef __FRAMEWORK_MACROS_DEBUG_MUTEX_HXX_ +#include <macros/debug/mutex.hxx> +#endif + +//***************************************************************************************************************** +// special macros to debug service registration +//***************************************************************************************************************** + +#ifndef __FRAMEWORK_MACROS_DEBUG_REGISTRATION_HXX_ +#include <macros/debug/registration.hxx> +#endif + +//***************************************************************************************************************** +// special macros to debug targeting of frames +//***************************************************************************************************************** + +#ifndef __FRAMEWORK_MACROS_DEBUG_TARGETING_HXX_ +#include <macros/debug/targeting.hxx> +#endif + +//***************************************************************************************************************** +// special macros to debug our plugin and his asynchronous methods! +//***************************************************************************************************************** + +#ifndef __FRAMEWORK_MACROS_DEBUG_PLUGIN_HXX_ +#include <macros/debug/plugin.hxx> +#endif + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_HXX_ diff --git a/framework/inc/macros/debug/assertion.hxx b/framework/inc/macros/debug/assertion.hxx new file mode 100644 index 000000000000..e2c97ea4a05c --- /dev/null +++ b/framework/inc/macros/debug/assertion.hxx @@ -0,0 +1,151 @@ +/************************************************************************* + * + * $RCSfile: assertion.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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 __FRAMEWORK_MACROS_DEBUG_ASSERTION_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_ASSERTION_HXX_ + +//***************************************************************************************************************** +// special macros for assertion handling +//***************************************************************************************************************** + +#ifdef ENABLE_ASSERTIONS + + //_____________________________________________________________________________________________________________ + // includes + //_____________________________________________________________________________________________________________ + + #ifndef _OSL_DIAGNOSE_H_ + #include <osl/diagnose.h> + #endif + + /*_____________________________________________________________________________________________________________ + LOGFILE_ASSERTIONS + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_ASSERTIONS + #define LOGFILE_ASSERTIONS \ + "assertions.log" + #endif + + /*_____________________________________________________________________________________________________________ + LOG_ASSERT( BCONDITION, STEXT ) + + Forward assertion to logfile (if condition is FALSE - like a DBG_ASSERT!) and continue with program. + Set LOGTYPE to LOGTYPE_FILECONTINUE to do this. + BCONDITION is inserted in "(...)" because user can call this macro with an complex expression! + _____________________________________________________________________________________________________________*/ + + #if LOGTYPE==LOGTYPE_FILECONTINUE + #define LOG_ASSERT( BCONDITION, STEXT ) \ + if ( ( BCONDITION ) == sal_False ) \ + { \ + WRITE_LOGFILE( LOGFILE_ASSERTIONS, STEXT ) \ + } + #endif + + /*_____________________________________________________________________________________________________________ + LOG_ASSERT( BCONDITION, STEXT ) + + Forward assertion to file and exit the program. + Set LOGTYPE to LOGTYPE_FILEEXIT to do this. + BCONDITION is inserted in "(...)" because user can call this macro with an complex expression! + _____________________________________________________________________________________________________________*/ + + #if LOGTYPE==LOGTYPE_FILEXIT + #define LOG_ASSERT( BCONDITION, STEXT ) \ + if ( ( BCONDITION ) == sal_False ) \ + { \ + WRITE_LOGFILE( LOGFILE_ASSERTIONS, STEXT ) \ + exit(-1); \ + } + #endif + + /*_____________________________________________________________________________________________________________ + LOG_ASSERT( BCONDITION, STEXT ) + + Forward assertions to messagebox. (We use OSL_ENSHURE to do this.) + Set LOGTYPE to LOGTYPE_MESSAGEBOX to do this. + BCONDITION is inserted in "(...)" because user can call this macro with an complex expression! + _____________________________________________________________________________________________________________*/ + + #if LOGTYPE==LOGTYPE_MESSAGEBOX + #define LOG_ASSERT( BCONDITION, STEXT ) \ + OSL_ENSHURE( ( BCONDITION ), STEXT ); + #endif + +#else // #ifdef ENABLE_ASSERTIONS + + /*_____________________________________________________________________________________________________________ + If right testmode is'nt set - implements these macro empty! + _____________________________________________________________________________________________________________*/ + + #undef LOGFILE_ASSERTIONS + #define LOG_ASSERT( BCONDITION, STEXT ) + +#endif // #ifdef ENABLE_ASSERTIONS + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_ASSERTION_HXX_ diff --git a/framework/inc/macros/debug/event.hxx b/framework/inc/macros/debug/event.hxx new file mode 100644 index 000000000000..9638cdff6c39 --- /dev/null +++ b/framework/inc/macros/debug/event.hxx @@ -0,0 +1,166 @@ +/************************************************************************* + * + * $RCSfile: event.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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 __FRAMEWORK_MACROS_DEBUG_EVENT_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_EVENT_HXX_ + +//************************************************************************************************************* +// special macros for event handling +//************************************************************************************************************* + +#ifdef ENABLE_EVENTDEBUG + + //_________________________________________________________________________________________________________________ + // includes + //_________________________________________________________________________________________________________________ + + #ifndef _RTL_STRBUF_HXX_ + #include <rtl/strbuf.hxx> + #endif + + /*_____________________________________________________________________________________________________________ + LOGFILE_EVENTDEBUG + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_EVENTDEBUG + #define LOGFILE_EVENTDEBUG \ + "events.log" + #endif + + /*_____________________________________________________________________________________________________________ + LOG_FRAMEACTIONEVENT( SFRAMETYPE, SFRAMENAME, AFRAMEACTION ) + + Use this macro to print debug informations about sending of events to listener for controling right order. + ( Use new scope in macro to declare sBuffer more then on time in same "parentscope"! ) + _____________________________________________________________________________________________________________*/ + + #define LOG_FRAMEACTIONEVENT( SFRAMETYPE, SFRAMENAME, AFRAMEACTION ) \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "[ " ); \ + sBuffer.append( SFRAMETYPE ); \ + sBuffer.append( " ] \"" ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "\" send event \"" ); \ + switch( AFRAMEACTION ) \ + { \ + case ::com::sun::star::frame::FrameAction_COMPONENT_ATTACHED : sBuffer.append("COMPONENT ATTACHED" ); \ + break; \ + case ::com::sun::star::frame::FrameAction_COMPONENT_DETACHING : sBuffer.append("COMPONENT DETACHING" ); \ + break; \ + case ::com::sun::star::frame::FrameAction_COMPONENT_REATTACHED : sBuffer.append("COMPONENT REATTACHED" ); \ + break; \ + case ::com::sun::star::frame::FrameAction_FRAME_ACTIVATED : sBuffer.append("FRAME ACTIVATED" ); \ + break; \ + case ::com::sun::star::frame::FrameAction_FRAME_DEACTIVATING : sBuffer.append("FRAME DEACTIVATING" ); \ + break; \ + case ::com::sun::star::frame::FrameAction_CONTEXT_CHANGED : sBuffer.append("CONTEXT CHANGED" ); \ + break; \ + case ::com::sun::star::frame::FrameAction_FRAME_UI_ACTIVATED : sBuffer.append("FRAME UI ACTIVATED" ); \ + break; \ + case ::com::sun::star::frame::FrameAction_FRAME_UI_DEACTIVATING : sBuffer.append("FRAME UI DEACTIVATING" ); \ + break; \ + case ::com::sun::star::frame::FrameAction_MAKE_FIXED_SIZE : sBuffer.append("MAKE_FIXED_SIZE" ); \ + break; \ + default: sBuffer.append("... ERROR: invalid FrameAction detected!" ); \ + break; \ + } \ + sBuffer.append( " ... event to listener.\n\n" ); \ + WRITE_LOGFILE( LOGFILE_EVENTDEBUG, sBuffer.makeStringAndClear().getStr() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_FRAMEACTIONEVENT( SFRAMETYPE, SFRAMENAME ) + + These macro log information about sending of dispose events to listener. + ( Use new scope in macro to declare sBuffer more then on time in same "parentscope"! ) + _____________________________________________________________________________________________________________*/ + + #define LOG_DISPOSEEVENT( SFRAMETYPE, SFRAMENAME ) \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "[ " ); \ + sBuffer.append( SFRAMETYPE ); \ + sBuffer.append( " ] \"" ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "\" send dispose event to listener.\n\n"); \ + WRITE_LOGFILE( LOGFILE_EVENTDEBUG, sBuffer.makeStringAndClear().getStr() ) \ + } + +#else // #ifdef ENABLE_EVENTDEBUG + + /*_____________________________________________________________________________________________________________ + If right testmode is'nt set - implements these macros empty! + _____________________________________________________________________________________________________________*/ + + #undef LOGFILE_EVENTDEBUG + #define LOG_FRAMEACTIONEVENT( SFRAMETYPE, SFRAMENAME, AFRAMEACTION ) + #define LOG_DISPOSEEVENT( SFRAMETYPE, SFRAMENAME ) + +#endif // #ifdef ENABLE_EVENTDEBUG + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_EVENT_HXX_ diff --git a/framework/inc/macros/debug/logmechanism.hxx b/framework/inc/macros/debug/logmechanism.hxx new file mode 100644 index 000000000000..4bed94c69edc --- /dev/null +++ b/framework/inc/macros/debug/logmechanism.hxx @@ -0,0 +1,127 @@ +/************************************************************************* + * + * $RCSfile: logmechanism.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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 __FRAMEWORK_MACROS_DEBUG_LOGMECHANISM_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_LOGMECHANISM_HXX_ + +//***************************************************************************************************************** +// generic macros for logging +//***************************************************************************************************************** + +#ifdef ENABLE_LOGMECHANISM + + //_____________________________________________________________________________________________________________ + // includes + //_____________________________________________________________________________________________________________ + + #include <stdio.h> + + /*_____________________________________________________________________________________________________________ + WRITE_LOGFILE( SFILENAME, STEXT ) + + Log any information in file. We append any information at file and don't clear it anymore. + ( Use new scope in macro to declare pFile more then on time in same "parentscope"! + Don't control pFile before access! What will you doing if its not valid? Log an error ... + An error and an error is an error ... ) + _____________________________________________________________________________________________________________*/ + + #define WRITE_LOGFILE( SFILENAME, STEXT ) \ + { \ + FILE* pFile = fopen( SFILENAME, "a" ); \ + fprintf( pFile, STEXT ); \ + fclose ( pFile ); \ + } + + /*_____________________________________________________________________________________________________________ + LOGTYPE + + For other debug macros we need information about the output mode. If user forget to set this information we + do it for him. Valid values are: LOGTYPE_FILECONTINUE + LOGTYPE_FILEEXIT + LOGTYPE_MESSAGEBOX + The normal case is LOGTYPE_MESSAGEBOX to show assertions in normal manner! + _____________________________________________________________________________________________________________*/ + + #define LOGTYPE_MESSAGEBOX 1 + #define LOGTYPE_FILECONTINUE 2 + #define LOGTYPE_FILEEXIT 3 + + #ifndef LOGTYPE + #define LOGTYPE \ + LOGTYPE_MESSAGEBOX + #endif + +#else // #ifdef ENABLE_LOGMECHANISM + + /*_____________________________________________________________________________________________________________ + If right testmode is'nt set - implements these macro empty! + _____________________________________________________________________________________________________________*/ + + #define WRITE_LOGFILE( SFILENAME, STEXT ) + #undef LOGTYPE + +#endif // #ifdef ENABLE_LOGMECHANISM + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_LOGMECHANISM_HXX_ diff --git a/framework/inc/macros/debug/mutex.hxx b/framework/inc/macros/debug/mutex.hxx new file mode 100644 index 000000000000..1b45026979a9 --- /dev/null +++ b/framework/inc/macros/debug/mutex.hxx @@ -0,0 +1,206 @@ +/************************************************************************* + * + * $RCSfile: mutex.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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 __FRAMEWORK_MACROS_DEBUG_MUTEX_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_MUTEX_HXX_ + +//***************************************************************************************************************** +// special macros for mutex handling +//***************************************************************************************************************** + +#ifdef ENABLE_MUTEXDEBUG + + //_____________________________________________________________________________________________________________ + // includes + //_____________________________________________________________________________________________________________ + + #ifndef _RTL_STRBUF_HXX_ + #include <rtl/strbuf.hxx> + #endif + + #ifndef _OSL_MUTEX_HXX_ + #include <osl/mutex.hxx> + #endif + + /*_____________________________________________________________________________________________________________ + LOGFILE_MUTEX + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_MUTEX + #define LOGFILE_MUTEX \ + "mutex.log" + #endif + + /*_____________________________________________________________________________________________________________ + LOCK_MUTEX( AGUARD, AMUTEX, SMETHOD ) + + These macro define a clearable guard and log information about result of this mutex aquire. + If you will see a "block statement" without a "successfull statement" you know ... + these can be a deadlock or something else is wrong! + _____________________________________________________________________________________________________________*/ + + #define LOCK_MUTEX( AGUARD, AMUTEX, SMETHOD ) \ + /* Use new scope to declare necessary variables as localy private! */ \ + { \ + if ( AMUTEX.tryToAcquire() == sal_False ) \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "mutex aquire block at \"" ); \ + sBuffer.append( SMETHOD ); \ + sBuffer.append( "\" ...\n" ); \ + WRITE_LOGFILE( LOGFILE_MUTEX, sBuffer.makeStringAndClear().getStr() ); \ + } \ + else \ + { /* Don't forget to release successfull aquired mutex again! */ \ + AMUTEX.release(); \ + } \ + } \ + /* These line must be in parent scope because the guard is used there! */ \ + ::osl::ClearableMutexGuard AGUARD( AMUTEX ); \ + /* Use new scope to declare necessary variables as localy private! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "mutex successfull aquired at \"" ); \ + sBuffer.append( SMETHOD ); \ + sBuffer.append( "\" ....\n" ); \ + WRITE_LOGFILE( LOGFILE_MUTEX, sBuffer.makeStringAndClear().getStr() ); \ + } + + /*_____________________________________________________________________________________________________________ + LOCK_GLOBALMUTEX( AGUARD, SMETHOD ) + + These macro define a clearable guard and log information about result of this mutex aquire. + As mutex we use the osl global mutex automaticly. + If you will see a "block statement" without a "successfull statement" you know ... + these can be a deadlock or something else is wrong! + _____________________________________________________________________________________________________________*/ + + #define LOCK_GLOBALMUTEX( AGUARD, SMETHOD ) \ + /* Use new scope to declare necessary variables as localy private! */ \ + { \ + if ( ::osl::Mutex::getGlobalMutex()->tryToAcquire() == sal_False ) \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "\tAttention:\tglobal mutex aquire block at \"" ); \ + sBuffer.append( SMETHOD ); \ + sBuffer.append( "\" ...\n" ); \ + WRITE_LOGFILE( LOGFILE_MUTEX, sBuffer.makeStringAndClear().getStr() ); \ + } \ + else \ + { /* Don't forget to release successfull aquired mutex again! */ \ + ::osl::Mutex::getGlobalMutex()->release(); \ + } \ + } \ + /* These line must be in parent scope because the guard is used there! */ \ + ::osl::ClearableMutexGuard AGUARD( ::osl::Mutex::getGlobalMutex() ); \ + /* Use new scope to declare necessary variables as localy private! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "global mutex successfull aquired at \""); \ + sBuffer.append( SMETHOD ); \ + sBuffer.append( "\" ....\n" ); \ + WRITE_LOGFILE( LOGFILE_MUTEX, sBuffer.makeStringAndClear().getStr() ); \ + } + + /*_____________________________________________________________________________________________________________ + UNLOCK_MUTEX( AGUARD, SMETHOD ) + + Use this macro to unlock any locked mutex in same scope. + We will log some information for you. + _____________________________________________________________________________________________________________*/ + + #define UNLOCK_MUTEX( AGUARD, SMETHOD ) \ + AGUARD.clear(); \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "mutex cleared at \"" ); \ + sBuffer.append( SMETHOD ); \ + sBuffer.append( "\" sucessful ...\n" ); \ + WRITE_LOGFILE( LOGFILE_MUTEX, sBuffer.makeStringAndClear().getStr() ); \ + } + +#else // #ifdef ENABLE_MUTEXDEBUG + + /*_____________________________________________________________________________________________________________ + If right testmode is'nt set - implements these macro with normal functionality! + We need the guard but not the log mechanism. + _____________________________________________________________________________________________________________*/ + + #undef LOGFILE_MUTEX + + #define LOCK_MUTEX( AGUARD, AMUTEX, SMETHOD ) \ + ::osl::ClearableMutexGuard AGUARD( AMUTEX ); + + #define LOCK_GLOBALMUTEX( AGUARD, SMETHOD ) \ + ::osl::ClearableMutexGuard AGUARD( ::osl::Mutex::getGlobalMutex() ); + + #define UNLOCK_MUTEX( AGUARD, SMETHOD ) \ + AGUARD.clear(); + +#endif // #ifdef ENABLE_MUTEXDEBUG + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_MUTEX_HXX_ diff --git a/framework/inc/macros/debug/plugin.hxx b/framework/inc/macros/debug/plugin.hxx new file mode 100644 index 000000000000..8cb05cbc7d15 --- /dev/null +++ b/framework/inc/macros/debug/plugin.hxx @@ -0,0 +1,232 @@ +/************************************************************************* + * + * $RCSfile: plugin.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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 __FRAMEWORK_MACROS_DEBUG_PLUGIN_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_PLUGIN_HXX_ + +//***************************************************************************************************************** +// special macros to debug asynchronous methods of plugin frame +//***************************************************************************************************************** + +#ifdef ENABLE_PLUGINDEBUG + + //_____________________________________________________________________________________________________________ + // includes + //_____________________________________________________________________________________________________________ + + #ifndef _RTL_STRBUF_HXX_ + #include <rtl/strbuf.hxx> + #endif + + #ifndef _RTL_STRING_HXX_ + #include <rtl/string.hxx> + #endif + + /*_____________________________________________________________________________________________________________ + LOGFILE_PLUGIN + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_PLUGIN + #define LOGFILE_PLUGIN \ + "plugin.log" + #endif + + /*_____________________________________________________________________________________________________________ + LOG_URLSEND( SFRAMENAME, SSENDMODE, SINTERNALURL, SEXTERNALURL ) + + Our plugin forward special url's to plugin dll, browser and webserver. + We convert internal url's to an external notation. + With this macro you can log some parameter of this operation. + _____________________________________________________________________________________________________________*/ + + #define LOG_URLSEND( SFRAMENAME, SSENDMODE, SINTERNALURL, SEXTERNALURL ) \ + /* Use new scope to declare local private variables! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "PlugInFrame [ \"" ); \ + sBuffer.append( SFRAMENAME ); \ + sBuffer.append( "\" ] send " ); \ + sBuffer.append( SSENDMODE ); \ + sBuffer.append( "( internalURL=\"" ); \ + sBuffer.append( U2B( SINTERNALURL ) ); \ + sBuffer.append( "\", externalURL=\""); \ + sBuffer.append( U2B( SEXTERNALURL ) ); \ + sBuffer.append( "\" ) to browser.\n"); \ + WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear().getStr() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_URLRECEIVE( SFRAMENAME, SRECEIVEMODE, SEXTERNALURL, SINTERNALURL ) + + A plugin frame can get a url request in two different modes. + 1) newURL() + 2) newStream() + We convert external url's to an internal notation. + With this macro you can log some parameter of this operations. + _____________________________________________________________________________________________________________*/ + + #define LOG_URLRECEIVE( SFRAMENAME, SRECEIVEMODE, SEXTERNALURL, SINTERNALURL ) \ + /* Use new scope to declare local private variables! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "PlugInFrame [ \"" ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "\" ] receive " ); \ + sBuffer.append( SRECEIVEMODE ); \ + sBuffer.append( "( externalURL=\"" ); \ + sBuffer.append( U2B( SEXTERNALURL ) ); \ + sBuffer.append( "\", internalURL=\"" ); \ + sBuffer.append( U2B( SINTERNALURL ) ); \ + sBuffer.append( "\" ) from browser.\n" ); \ + WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear().getStr() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_PARAMETER_NEWURL( SFRAMENAME, SMIMETYPE, SURL, AANY ) + + Log information about parameter of a newURL() at a plugin frame. + _____________________________________________________________________________________________________________*/ + + #define LOG_PARAMETER_NEWURL( SFRAMENAME, SMIMETYPE, SURL, AANY ) \ + /* Use new scope to declare local private variables! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "PlugInFrame [ \"" ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "\" ] called with newURL( \"" ); \ + sBuffer.append( U2B( SMIMETYPE ) ); \ + sBuffer.append( "\", \"" ); \ + sBuffer.append( U2B( SURL ) ); \ + sBuffer.append( "\", " ); \ + if( AANY.hasValue() == sal_True ) \ + { \ + sBuffer.append( "filled Any )" ); \ + } \ + else \ + { \ + sBuffer.append( "empty Any )" ); \ + } \ + sBuffer.append( "\n" ); \ + WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear().getStr() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_PARAMETER_NEWSTREAM( SFRAMENAME, SMIMETYPE, SURL, ASTREAM, AANY ) + + Log information about parameter of a newStream() at a plugin frame. + _____________________________________________________________________________________________________________*/ + + #define LOG_PARAMETER_NEWSTREAM( SFRAMENAME, SMIMETYPE, SURL, XSTREAM, AANY ) \ + /* Use new scope to declare local private variables! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "PlugInFrame [ \"" ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "\" ] called with newStream( \""); \ + sBuffer.append( U2B( SMIMETYPE ) ); \ + sBuffer.append( "\", \"" ); \ + sBuffer.append( U2B( SURL ) ); \ + sBuffer.append( "\", " ); \ + if( XSTREAM.is() == sal_True ) \ + { \ + sal_Int32 nBytes = XSTREAM->available(); \ + OString sInfo("Stream with "); \ + sInfo += OString::valueOf( (sal_Int32)nBytes ); \ + sInfo += " Bytes, "; \ + sBuffer.append( sInfo ); \ + } \ + else \ + { \ + sBuffer.append( "empty Stream, " ); \ + } \ + if( AANY.hasValue() == sal_True ) \ + { \ + sBuffer.append( "filled Any )" ); \ + } \ + else \ + { \ + sBuffer.append( "empty Any )" ); \ + } \ + sBuffer.append( "\n" ); \ + WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear().getStr() ) \ + } + +#else // #ifdef ENABLE_PLUGINDEBUG + + /*_____________________________________________________________________________________________________________ + If right testmode is'nt set - implements these macro empty! + _____________________________________________________________________________________________________________*/ + + #undef LOGFILE_PLUGIN + #define LOG_URLSEND( SFRAMENAME, SSENDMODE, SINTERNALURL, SEXTERNALURL ) + #define LOG_URLRECEIVE( SFRAMENAME, SRECEIVEMODE, SEXTERNALURL, SINTERNALURL ) + #define LOG_PARAMETER_NEWURL( SFRAMENAME, SMIMETYPE, SURL, AANY ) + #define LOG_PARAMETER_NEWSTREAM( SFRAMENAME, SMIMETYPE, SURL, XSTREAM, AANY ) + +#endif // #ifdef ENABLE_PLUGINDEBUG + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_PLUGIN_HXX_ diff --git a/framework/inc/macros/debug/registration.hxx b/framework/inc/macros/debug/registration.hxx new file mode 100644 index 000000000000..9c35acc0fb15 --- /dev/null +++ b/framework/inc/macros/debug/registration.hxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * $RCSfile: registration.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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 __FRAMEWORK_MACROS_DEBUG_REGISTRATION_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_REGISTRATION_HXX_ + +//***************************************************************************************************************** +// special macros for assertion handling +//***************************************************************************************************************** + +#ifdef ENABLE_REGISTRATIONDEBUG + + //_____________________________________________________________________________________________________________ + // includes + //_____________________________________________________________________________________________________________ + + #ifndef _RTL_STRBUF_HXX_ + #include <rtl/strbuf.hxx> + #endif + + /*_____________________________________________________________________________________________________________ + LOGFILE_ASSERTIONS + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_REGISTRATION + #define LOGFILE_REGISTRATION \ + "registration.log" + #endif + + /*_____________________________________________________________________________________________________________ + LOG_REGISTRATION_WRITEINFO( SINFOTEXT ) + + Write informations for component_writeInfo() in log file. + _____________________________________________________________________________________________________________*/ + + #define LOG_REGISTRATION_WRITEINFO( SINFOTEXT ) \ + { \ + ::rtl::OStringBuffer sOut( 1024 ); \ + sOut.append( "component_writeInfo():" ); \ + sOut.append( SINFOTEXT ); \ + WRITE_LOGFILE( LOGFILE_REGISTRATION, sOut.makeStringAndClear().getStr() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_REGISTRATION_WRITEINFO( SINFOTEXT ) + + Write informations for component_getFactory() in log file. + _____________________________________________________________________________________________________________*/ + + #define LOG_REGISTRATION_GETFACTORY( SINFOTEXT ) \ + { \ + ::rtl::OStringBuffer sOut( 1024 ); \ + sOut.append( "component_getFactory():" ); \ + sOut.append( SINFOTEXT ); \ + WRITE_LOGFILE( LOGFILE_REGISTRATION, sOut.makeStringAndClear().getStr() ) \ + } + +#else // #ifdef ENABLE_REGISTRATIONDEBUG + + /*_____________________________________________________________________________________________________________ + If right testmode is'nt set - implements these macro empty! + _____________________________________________________________________________________________________________*/ + + #undef LOGFILE_REGISTRATION + #define LOG_REGISTRATION_WRITEINFO( SINFOTEXT ) + #define LOG_REGISTRATION_GETFACTORY( SINFOTEXT ) + +#endif // #ifdef ENABLE_REGISTRATIONDEBUG + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_REGISTRATION_HXX_ diff --git a/framework/inc/macros/debug/targeting.hxx b/framework/inc/macros/debug/targeting.hxx new file mode 100644 index 000000000000..3745e731e918 --- /dev/null +++ b/framework/inc/macros/debug/targeting.hxx @@ -0,0 +1,296 @@ +/************************************************************************* + * + * $RCSfile: targeting.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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 __FRAMEWORK_MACROS_DEBUG_TARGETING_HXX_ +#define __FRAMEWORK_MACROS_DEBUG_TARGETING_HXX_ + +//***************************************************************************************************************** +// special macros for targeting of frames +//***************************************************************************************************************** + +#ifdef ENABLE_TARGETINGDEBUG + + //_____________________________________________________________________________________________________________ + // includes + //_____________________________________________________________________________________________________________ + + #ifndef _RTL_STRBUF_HXX_ + #include <rtl/strbuf.hxx> + #endif + + /*_____________________________________________________________________________________________________________ + LOGFILE_TARGETING + + For follow macros we need a special log file. If user forget to specify anyone, we must do it for him! + _____________________________________________________________________________________________________________*/ + + #ifndef LOGFILE_TARGETING + #define LOGFILE_TARGETING \ + "targeting.log" + #endif + + /*_____________________________________________________________________________________________________________ + LOG_PARAMETER_FINDFRAME( SSERVICE, SFRAMENAME, STARGETNAME, NSEARCHFLAGS ) + + With this macro you can log informations about search parameter of method "findFrame()" of an service. + Use it at beginning of search only! + _____________________________________________________________________________________________________________*/ + + #define LOG_PARAMETER_FINDFRAME( SSERVICE, SFRAMENAME, STARGETNAME, NSEARCHFLAGS ) \ + /* Use new scope to prevent code against multiple variable defines! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "\n************************************************\n" ); \ + sBuffer.append( "[ " ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "] " ); \ + sBuffer.append( SSERVICE ); \ + sBuffer.append( "::findFrame( \"" ); \ + sBuffer.append( U2B( STARGETNAME ) ); \ + sBuffer.append( "\", " ); \ + sBuffer.append( ::rtl::OString::valueOf( sal_Int32( NSEARCHFLAGS ) ) ); \ + sBuffer.append( " )\n" ); \ + WRITE_LOGFILE( LOGFILE_TARGETING, sBuffer.makeStringAndClear().getStr() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_PARAMETER_QUERYDISPATCH( SSERVICE, SFRAMENAME, AURL, STARGETNAME, NSEARCHFLAGS ) + + With this macro you can log informations about search parameter of method "queryDispatch()" of an service. + Use it at beginning of search only! + _____________________________________________________________________________________________________________*/ + + #define LOG_PARAMETER_QUERYDISPATCH( SSERVICE, SFRAMENAME, AURL, STARGETNAME, NSEARCHFLAGS ) \ + /* Use new scope to prevent code against multiple variable defines! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "[ " ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "] " ); \ + sBuffer.append( SSERVICE ); \ + sBuffer.append( "::queryDispatch( \"" ); \ + sBuffer.append( U2B( AURL.Complete ) ); \ + sBuffer.append( "\", \"" ); \ + sBuffer.append( U2B( STARGETNAME ) ); \ + sBuffer.append( "\", " ); \ + sBuffer.append( ::rtl::OString::valueOf( sal_Int32( NSEARCHFLAGS ) ) ); \ + sBuffer.append( " )\n" ); \ + WRITE_LOGFILE( LOGFILE_TARGETING, sBuffer.makeStringAndClear().getStr() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_PARAMETER_LOADCOMPONENTFROMURL( SSERVICE, SFRAMENAME, SURL, STARGETNAME, NSEARCHFLAGS, SEQPARAMETER ) + + With this macro you can log informations about search parameter of method "loadComponentFromURL()" of an service. + Use it at beginning of search only! + _____________________________________________________________________________________________________________*/ + + #define LOG_PARAMETER_LOADCOMPONENTFROMURL( SSERVICE, SFRAMENAME, SURL, STARGETNAME, NSEARCHFLAGS, SEQPARAMETER ) \ + /* Use new scope to prevent code against multiple variable defines! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "[ " ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "] " ); \ + sBuffer.append( SSERVICE ); \ + sBuffer.append( "::loadComponentFromURL( \"" ); \ + sBuffer.append( U2B( SURL ) ); \ + sBuffer.append( "\", \"" ); \ + sBuffer.append( U2B( STARGETNAME ) ); \ + sBuffer.append( "\", " ); \ + sBuffer.append( ::rtl::OString::valueOf( sal_Int32( NSEARCHFLAGS ) ) ); \ + sBuffer.append( ", " ); \ + sal_Int32 nCount = SEQPARAMETER.getLength(); \ + for( sal_Int32 nParameter=0; nParameter<nCount; ++nParameter ) \ + { \ + sBuffer.append( U2B( SEQPARAMETER[nParameter].Name )); \ + if( nParameter<(nCount-1) ) \ + { \ + sBuffer.append( " | " ); \ + } \ + } \ + sBuffer.append( " )\n" ); \ + WRITE_LOGFILE( LOGFILE_TARGETING, sBuffer.makeStringAndClear().getStr() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_TARGETINGSTEP( SSERVICE, SFRAMENAME, SINFOMESSAGE ) + + With this macro you can log informations about search steps. + _____________________________________________________________________________________________________________*/ + + #define LOG_TARGETINGSTEP( SSERVICE, SFRAMENAME, SINFOMESSAGE ) \ + /* Use new scope to prevent code against multiple variable defines! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "\t[ " ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "] " ); \ + sBuffer.append( SSERVICE ); \ + sBuffer.append( ": \"" ); \ + sBuffer.append( SINFOMESSAGE ); \ + sBuffer.append( "\"\n" ); \ + WRITE_LOGFILE( LOGFILE_TARGETING, sBuffer.makeStringAndClear().getStr() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_RESULT_FINDFRAME( SSERVICE, SFRAMENAME, XFRAME ) + + With this macro you can log informations about search result of "findFrame()". + Use it at the end of this method only! + _____________________________________________________________________________________________________________*/ + + #define LOG_RESULT_FINDFRAME( SSERVICE, SFRAMENAME, XFRAME ) \ + /* Use new scope to prevent code against multiple variable defines! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "[ " ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "] " ); \ + sBuffer.append( SSERVICE ); \ + if( XFRAME.is() == sal_True ) \ + { \ + sBuffer.append( "::findframe() return with valid frame."); \ + } \ + else \ + { \ + sBuffer.append( "::findframe() return with NULL frame!" ); \ + } \ + sBuffer.append( "\n" ); \ + WRITE_LOGFILE( LOGFILE_TARGETING, sBuffer.makeStringAndClear().getStr() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_RESULT_QUERYDISPATCH( SSERVICE, SFRAMENAME, XDISPATCHER ) + + With this macro you can log informations about search result of "queryDispatch()". + Use it at the end of this method only! + _____________________________________________________________________________________________________________*/ + + #define LOG_RESULT_QUERYDISPATCH( SSERVICE, SFRAMENAME, XDISPATCHER ) \ + /* Use new scope to prevent code against multiple variable defines! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "[ " ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "] " ); \ + sBuffer.append( SSERVICE ); \ + if( XDISPATCHER.is() == sal_True ) \ + { \ + sBuffer.append( "::queryDispatch() return with valid dispatcher." ); \ + } \ + else \ + { \ + sBuffer.append( "::queryDispatch() return with NULL dispatcher!" ); \ + } \ + sBuffer.append( "\n" ); \ + WRITE_LOGFILE( LOGFILE_TARGETING, sBuffer.makeStringAndClear().getStr() ) \ + } + + /*_____________________________________________________________________________________________________________ + LOG_RESULT_LOADCOMPONENTFROMURL( SSERVICE, SFRAMENAME, XCOMPONENT ) + + With this macro you can log informations about search result of "loadComponentFromURL()". + Use it at the end of this method only! + _____________________________________________________________________________________________________________*/ + + #define LOG_RESULT_LOADCOMPONENTFROMURL( SSERVICE, SFRAMENAME, XCOMPONENT ) \ + /* Use new scope to prevent code against multiple variable defines! */ \ + { \ + ::rtl::OStringBuffer sBuffer(1024); \ + sBuffer.append( "[ " ); \ + sBuffer.append( U2B( SFRAMENAME ) ); \ + sBuffer.append( "] " ); \ + sBuffer.append( SSERVICE ); \ + if( XCOMPONENT.is() == sal_True ) \ + { \ + sBuffer.append( "::loadComponentFromURL() return with valid component." ); \ + } \ + else \ + { \ + sBuffer.append( "::loadComponentFromURL() return with NULL component!" ); \ + } \ + sBuffer.append( "\n" ); \ + WRITE_LOGFILE( LOGFILE_TARGETING, sBuffer.makeStringAndClear().getStr() ) \ + } + +#else // #ifdef ENABLE_TARGETINGDEBUG + + /*_____________________________________________________________________________________________________________ + If right testmode is'nt set - implements these macro empty! + _____________________________________________________________________________________________________________*/ + + #undef LOGFILE_TARGETING + #define LOG_PARAMETER_FINDFRAME( SSERVICE, SFRAMENAME, STARGETNAME, NSEARCHFLAGS ) + #define LOG_PARAMETER_QUERYDISPATCH( SSERVICE, SFRAMENAME, AURL, STARGETNAME, NSEARCHFLAGS ) + #define LOG_PARAMETER_LOADCOMPONENTFROMURL( SSERVICE, SFRAMENAME, SURL, STARGETNAME, NSEARCHFLAGS, SEQPARAMETER ) + #define LOG_TARGETINGSTEP( SSERVICE, SFRAMENAME, SINFOMESSAGE ) + #define LOG_RESULT_FINDFRAME( SSERVICE, SFRAMENAME, XFRAME ) + #define LOG_RESULT_QUERYDISPATCH( SSERVICE, SFRAMENAME, XDISPATCHER ) + #define LOG_RESULT_LOADCOMPONENTFROMURL( SSERVICE, SFRAMENAME, XCOMPONENT ) + +#endif // #ifdef ENABLE_TARGETINGDEBUG + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_TARGETING_HXX_ diff --git a/framework/inc/macros/generic.hxx b/framework/inc/macros/generic.hxx new file mode 100644 index 000000000000..2f559f170c55 --- /dev/null +++ b/framework/inc/macros/generic.hxx @@ -0,0 +1,121 @@ +/************************************************************************* + * + * $RCSfile: generic.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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 __FRAMEWORK_MACROS_GENERIC_HXX_ +#define __FRAMEWORK_MACROS_GENERIC_HXX_ + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#ifndef _RTL_USTRING_ +#include <rtl/ustring> +#endif + +#ifndef _RTL_USTRING_HXX_ +#include <rtl/ustring.hxx> +#endif + +#ifndef _RTL_TEXTENC_H +#include <rtl/textenc.h> +#endif + +//***************************************************************************************************************** +// generic macros +//***************************************************************************************************************** + +/*_________________________________________________________________________________________________________________ + DECLARE_ASCII( SASCIIVALUE ) + + Use it to declare a constant ascii value at compile time in code. + zB. OUSting sTest = DECLARE_ASCII( "Test" ) +_________________________________________________________________________________________________________________*/ + +#define DECLARE_ASCII( SASCIIVALUE ) \ + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SASCIIVALUE )) + +/*_________________________________________________________________________________________________________________ + U2B( SUNICODEVALUE ) + B2U( SASCIIVALUE ) + U2B_ENC( SUNICODEVALUE, AENCODING ) + B2U_ENC( SASCIIVALUE, AENCODING ) + + Use it to convert unicode strings to ascii values and reverse ... + We use UTF8 as default textencoding. If you will change this use U2B_ENC and B2U_ENC! +_________________________________________________________________________________________________________________*/ + +#define U2B( SUNICODEVALUE ) \ + ::rtl::OUStringToOString( SUNICODEVALUE, RTL_TEXTENCODING_UTF8 ) + +#define B2U( SASCIIVALUE ) \ + ::rtl::OUStringToOString( SASCIIVALUE, RTL_TEXTENCODING_UTF8 ) + +#define U2B_ENC( SUNICODEVALUE, AENCODING ) \ + ::rtl::OUStringToOString( SUNICODEVALUE, AENCODING ) + +#define B2U_ENC( SASCIIVALUE, AENCODING ) \ + ::rtl::OUStringToOString( SASCIIVALUE, AENCODING ) + +//***************************************************************************************************************** +// end of file +//***************************************************************************************************************** + +#endif // #ifndef __FRAMEWORK_MACROS_GENERIC_HXX_ diff --git a/framework/inc/macros/registration.hxx b/framework/inc/macros/registration.hxx new file mode 100644 index 000000000000..8a8f8ece4dfc --- /dev/null +++ b/framework/inc/macros/registration.hxx @@ -0,0 +1,271 @@ +/************************************************************************* + * + * $RCSfile: registration.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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 __FRAMEWORK_MACROS_REGISTRATION_HXX_ +#define __FRAMEWORK_MACROS_REGISTRATION_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_ +#include <macros/debug.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_ +#include <com/sun/star/registry/XRegistryKey.hpp> +#endif + +#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#endif + +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif + +#ifndef _COM_SUN_STAR_REGISTRY_INVALIDREGISTRYEXCEPTION_HPP_ +#include <com/sun/star/registry/InvalidRegistryException.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +//namespace framework{ + +/*_________________________________________________________________________________________________________________ + + macros for registration of services + Please use follow public macros only! + + 1) COMPONENTINFO( CLASS ) => use it as parameter for COMPONENT_WRITEINFO( INFOS ) + 2) IFFACTORY( CLASS ) => use it as parameter for COMPONENT_GETFACTORY( IFFACTORIES ) + 3) COMPONENTGETIMPLEMENTATIONENVIRONMENT => use it to define exported function component_getImplementationEnvironment() + 4) COMPONENTWRITEINFO( INFOS ) => use it to define exported function component_writeInfo() + 5) COMPONENTGETFACTORY( IFFACTORIES ) => use it to define exported function component_getFactory() + +_________________________________________________________________________________________________________________*/ + +//***************************************************************************************************************** +// public +// use it as parameter for COMPONENT_WRITEINFO( INFOS ) +//***************************************************************************************************************** +#define COMPONENTINFO( CLASS ) \ + try \ + { \ + /* Set default result of follow operations !!! */ \ + bReturn = sal_False; \ + /* Do the follow only, if given key is valid ! */ \ + if ( xKey.is() == sal_True ) \ + { \ + LOG_REGISTRATION_WRITEINFO( "\t\t\txKey is valid ...\n" ) \ + /* Build new keyname */ \ + sKeyName = DECLARE_ASCII( "/" ); \ + sKeyName += CLASS::impl_getStaticImplementationName(); \ + sKeyName += DECLARE_ASCII( "/UNO/SERVICES" ); \ + LOG_REGISTRATION_WRITEINFO( "\t\t\tcreate key \"" ) \ + LOG_REGISTRATION_WRITEINFO( U2B( sKeyName ) ) \ + LOG_REGISTRATION_WRITEINFO( "\" ...\n" ) \ + /* Create new key with new name. */ \ + xNewKey = xKey->createKey( sKeyName ); \ + /* If this new key valid ... */ \ + if ( xNewKey.is() == sal_True ) \ + { \ + LOG_REGISTRATION_WRITEINFO( "\t\t\t\ttsuccessful ...\n" ) \ + /* Get information about supported services. */ \ + seqServiceNames = CLASS::impl_getStaticSupportedServiceNames() ; \ + pArray = seqServiceNames.getArray() ; \ + nLength = seqServiceNames.getLength() ; \ + nCounter = 0 ; \ + /* Then set this information on this key. */ \ + for ( nCounter = 0; nCounter < nLength; ++nCounter ) \ + { \ + LOG_REGISTRATION_WRITEINFO( "\t\t\t\twrite key \"" ) \ + LOG_REGISTRATION_WRITEINFO( U2B( pArray[nCounter] ) ) \ + LOG_REGISTRATION_WRITEINFO( "\" to registry ...\n" ) \ + xNewKey->createKey( pArray[nCounter] ); \ + } \ + /* Result of this operations = OK. */ \ + bReturn = sal_True ; \ + } \ + } \ + } \ + catch( ::com::sun::star::registry::InvalidRegistryException& ) \ + { \ + LOG_REGISTRATION_WRITEINFO( "\n\nERROR:\nInvalidRegistryException detected\n\n" ) \ + bReturn = sal_False ; \ + } + +//***************************************************************************************************************** +// public +// use it as parameter for COMPONENT_GETFACTORY( IFFACTORIES ) +//***************************************************************************************************************** +#define IFFACTORY( CLASS ) \ + /* If searched name found ... */ \ + /* You can't add some statements before follow line ... Here can be an ELSE-statement! */ \ + if ( CLASS::impl_getStaticImplementationName().equals( ::rtl::OUString::createFromAscii( pImplementationName ) ) ) \ + { \ + LOG_REGISTRATION_GETFACTORY( "\t\tImplementationname found - try to create factory! ...\n" ) \ + /* ... then create right factory for this service. */ \ + /* xFactory and xServiceManager are local variables of method which use this macro. */ \ + xFactory = CLASS::impl_createFactory( xServiceManager ); \ + } + +//***************************************************************************************************************** +// public +// define helper to get information about service environment +//***************************************************************************************************************** +#define COMPONENTGETIMPLEMENTATIONENVIRONMENT \ + extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvironmentTypeName , \ + uno_Environment** ppEnvironment ) \ + { \ + *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ; \ + } + +//***************************************************************************************************************** +// public +// define registration of service +//***************************************************************************************************************** +#define COMPONENTWRITEINFO( INFOS ) \ + extern "C" sal_Bool SAL_CALL component_writeInfo( void* pServiceManager , \ + void* pRegistryKey ) \ + { \ + LOG_REGISTRATION_WRITEINFO( "\t[start]\n" ) \ + /* Set default return value for this operation - if it failed. */ \ + sal_Bool bReturn = sal_False ; \ + if ( pRegistryKey != NULL ) \ + { \ + LOG_REGISTRATION_WRITEINFO( "\t\tpRegistryKey is valid ...\n" ) \ + /* Define variables for following helper macros! */ \ + /* bReturn will set automaticly. */ \ + ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > xKey ; \ + ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > xNewKey ; \ + ::com::sun::star::uno::Sequence< ::rtl::OUString > seqServiceNames ; \ + const ::rtl::OUString* pArray ; \ + sal_Int32 nLength ; \ + sal_Int32 nCounter ; \ + ::rtl::OUString sKeyName ; \ + xKey = reinterpret_cast< ::com::sun::star::registry::XRegistryKey* >( pRegistryKey ); \ + /* This parameter will expand to */ \ + /* "COMPONENT_INFO(a) */ \ + /* ... */ \ + /* COMPONENT_INFO(z)" */ \ + INFOS \ + } \ + LOG_REGISTRATION_WRITEINFO( "\t[end]\n" ) \ + /* Return with result of this operation. */ \ + return bReturn ; \ + } + +//***************************************************************************************************************** +// public +// define method to instanciate new services +//***************************************************************************************************************** +#define COMPONENTGETFACTORY( IFFACTORIES ) \ + extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplementationName , \ + void* pServiceManager , \ + void* pRegistryKey ) \ + { \ + LOG_REGISTRATION_GETFACTORY( "\t[start]\n" ) \ + /* Set default return value for this operation - if it failed. */ \ + void* pReturn = NULL ; \ + if ( \ + ( pImplementationName != NULL ) && \ + ( pServiceManager != NULL ) \ + ) \ + { \ + LOG_REGISTRATION_GETFACTORY( "\t\tpImplementationName and pServiceManager are valid ...\n" ) \ + /* Define variables which are used in following macros. */ \ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > xFactory ; \ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager ; \ + xServiceManager = reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >( pServiceManager ) ; \ + /* These parameter will expand to */ \ + /* "IF_NAME_CREATECOMPONENTFACTORY(a) */ \ + /* else */ \ + /* ... */ \ + /* else */ \ + /* IF_NAME_CREATECOMPONENTFACTORY(z)" */ \ + IFFACTORIES \ + /* Factory is valid, if service was found. */ \ + if ( xFactory.is() == sal_True ) \ + { \ + LOG_REGISTRATION_GETFACTORY( "\t\t\txFactory valid - service was found ...\n" ) \ + xFactory->acquire(); \ + pReturn = xFactory.get(); \ + } \ + } \ + LOG_REGISTRATION_GETFACTORY( "\t[end]\n" ) \ + /* Return with result of this operation. */ \ + return pReturn ; \ + } + +//} // namespace framework + +#endif // #ifndef __FRAMEWORK_MACROS_REGISTRATION_HXX_ diff --git a/framework/inc/macros/xinterface.hxx b/framework/inc/macros/xinterface.hxx new file mode 100644 index 000000000000..f0477a9aa159 --- /dev/null +++ b/framework/inc/macros/xinterface.hxx @@ -0,0 +1,580 @@ +/************************************************************************* + * + * $RCSfile: xinterface.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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 __FRAMEWORK_MACROS_XINTERFACE_HXX_ +#define __FRAMEWORK_MACROS_XINTERFACE_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_UNO_RUNTIMEEXCEPTION_HPP_ +#include <com/sun/star/uno/RuntimeException.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_UNO_ANY_H_ +#include <com/sun/star/uno/Any.h> +#endif + +#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_ +#include <com/sun/star/uno/Reference.h> +#endif + +#ifndef _COM_SUN_STAR_UNO_TYPE_H_ +#include <com/sun/star/uno/Type.h> +#endif + +#ifndef _CPPUHELPER_QUERYINTERFACE_HXX_ +#include <cppuhelper/queryinterface.hxx> +#endif + +#ifndef _RTL_USTRING_ +#include <rtl/ustring> +#endif + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +/*_________________________________________________________________________________________________________________ + + macros for declaration and definition of XInterface + Please use follow public macros only! + + 1) DEFINE_XINTERFACE => use it in header to declare XInterface and his methods + 2) DIRECT_INTERFACE( INTERFACE ) => use it as parameter INTERFACEx at 4) if interface not ambigous + 3) DERIVED_INTERFACE( BASEINTERFACE, DERIVEDINTERFACE ) => use it as parameter INTERFACEx at 4) if interface can be ambigous + 4) DECLARE_XINTERFACE_0( CLASS, BASECLASS ) => use it to define implementation of XInterface for 0 additional interface to baseclass + DECLARE_XINTERFACE_1( CLASS, BASECLASS, INTERFACE1 ) => use it to define implementation of XInterface for 1 additional interface to baseclass + ... + DECLARE_XINTERFACE_16( CLASS, BASECLASS, INTERFACE1, ... , INTERFACE16 ) + +_________________________________________________________________________________________________________________*/ + +//***************************************************************************************************************** +// private +// implementation of XInterface::aquire() +// XInterface::release() +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XINTERFACE_AQUIRE_RELEASE( CLASS, BASECLASS ) \ + void SAL_CALL CLASS::acquire() throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + /* Don't use mutex in methods of XInterface! */ \ + BASECLASS::acquire(); \ + } \ + \ + void SAL_CALL CLASS::release() throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + /* Don't use mutex in methods of XInterface! */ \ + BASECLASS::release(); \ + } + +//***************************************************************************************************************** +// private +// implementation of XInterface::queryInterface() without any other interfaces! +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XINTERFACE_QUERYINTERFACE_PURE( CLASS, BASECLASS ) \ + ::com::sun::star::uno::Any SAL_CALL CLASS::queryInterface( const ::com::sun::star::uno::Type& aType ) throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + /* Attention: Don't use mutex or guard in this method!!! Is a method of XInterface. */ \ + /* I have no own supported interfaces ... */ \ + /* ... ask baseclass for interfaces! */ \ + return BASECLASS::queryInterface( aType ); \ + } + +//***************************************************************************************************************** +// private +// implementation of XInterface::queryInterface() with max. 12 other interfaces! +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XINTERFACE_QUERYINTERFACE( CLASS, BASECLASS, INTERFACES ) \ + ::com::sun::star::uno::Any SAL_CALL CLASS::queryInterface( const ::com::sun::star::uno::Type& aType ) throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + /* Attention: Don't use mutex or guard in this method!!! Is a method of XInterface. */ \ + /* Ask for my own supported interfaces ... */ \ + ::com::sun::star::uno::Any aReturn ( ::cppu::queryInterface INTERFACES \ + ); \ + /* If searched interface not supported by this class ... */ \ + if ( aReturn.hasValue() == sal_False ) \ + { \ + /* ... ask baseclass for interfaces! */ \ + aReturn = BASECLASS::queryInterface( aType ); \ + } \ + /* Return result of this search. */ \ + return aReturn; \ + } + +//***************************************************************************************************************** +// private +// implementation of XInterface::queryInterface() with more then 12 other interfaces! +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XINTERFACE_QUERYINTERFACE_LARGE( CLASS, BASECLASS, INTERFACES_FIRST, INTERFACES_SECOND ) \ + ::com::sun::star::uno::Any SAL_CALL CLASS::queryInterface( const ::com::sun::star::uno::Type& aType ) throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + /* Attention: Don't use mutex or guard in this method!!! Is a method of XInterface. */ \ + /* Ask for my own supported interfaces ... */ \ + ::com::sun::star::uno::Any aReturn ( ::cppu::queryInterface INTERFACES_FIRST \ + ); \ + /* If searched interface not supported by first group ... */ \ + if ( aReturn.hasValue() == sal_False ) \ + { \ + /* ... search in second group. (cppuhelper support 12 items only!) */ \ + aReturn = ::cppu::queryInterface INTERFACES_SECOND ; \ + /* If searched interface not supported by this class ... */ \ + if ( aReturn.hasValue() == sal_False ) \ + { \ + /* ... ask baseclass for interfaces! */ \ + aReturn = BASECLASS::queryInterface( aType ); \ + } \ + } \ + /* Return result of this search. */ \ + return aReturn; \ + } + +//***************************************************************************************************************** +// private +// complete implementation of XInterface for different use cases +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XINTERFACE_PURE( CLASS, BASECLASS ) \ + PRIVATE_DEFINE_XINTERFACE_AQUIRE_RELEASE( CLASS, BASECLASS ) \ + PRIVATE_DEFINE_XINTERFACE_QUERYINTERFACE_PURE( CLASS, BASECLASS ) + +#define PRIVATE_DEFINE_XINTERFACE( CLASS, BASECLASS, INTERFACES ) \ + PRIVATE_DEFINE_XINTERFACE_AQUIRE_RELEASE( CLASS, BASECLASS ) \ + PRIVATE_DEFINE_XINTERFACE_QUERYINTERFACE( CLASS, BASECLASS, INTERFACES ) + +#define PRIVATE_DEFINE_XINTERFACE_LARGE( CLASS, BASECLASS, INTERFACES_FIRST, INTERFACES_SECOND ) \ + PRIVATE_DEFINE_XINTERFACE_AQUIRE_RELEASE( CLASS, BASECLASS ) \ + PRIVATE_DEFINE_XINTERFACE_QUERYINTERFACE_LARGE( CLASS, BASECLASS, INTERFACES_FIRST, INTERFACES_SECOND ) + +//***************************************************************************************************************** +// private +// help macros to replace INTERFACES in queryInterface() [see before] +//***************************************************************************************************************** +//#ifdef ENABLE_SERVICEDEBUG +// #define PRIVATE_DEFINE_INTERFACE_1( INTERFACE1 ) \ +// static_cast< XSPECIALDEBUGINTERFACE##* >( this ), \ +// INTERFACE1 +//#else + #define PRIVATE_DEFINE_INTERFACE_1( INTERFACE1 ) \ + INTERFACE1 +//#endif // #ifdef ENABLE_SERVICEDEBUG + +#define PRIVATE_DEFINE_INTERFACE_2( INTERFACE1, INTERFACE2 ) \ + PRIVATE_DEFINE_INTERFACE_1( INTERFACE1 ), \ + INTERFACE2 + +#define PRIVATE_DEFINE_INTERFACE_3( INTERFACE1, INTERFACE2, INTERFACE3 ) \ + PRIVATE_DEFINE_INTERFACE_2( INTERFACE1, INTERFACE2 ), \ + INTERFACE3 + +#define PRIVATE_DEFINE_INTERFACE_4( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4 ) \ + PRIVATE_DEFINE_INTERFACE_3( INTERFACE1, INTERFACE2, INTERFACE3 ), \ + INTERFACE4 + +#define PRIVATE_DEFINE_INTERFACE_5( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5 ) \ + PRIVATE_DEFINE_INTERFACE_4( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4 ), \ + INTERFACE5 + +#define PRIVATE_DEFINE_INTERFACE_6( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6 ) \ + PRIVATE_DEFINE_INTERFACE_5( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5 ), \ + INTERFACE6 + +#define PRIVATE_DEFINE_INTERFACE_7( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7 ) \ + PRIVATE_DEFINE_INTERFACE_6( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6 ), \ + INTERFACE7 + +#define PRIVATE_DEFINE_INTERFACE_8( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8 ) \ + PRIVATE_DEFINE_INTERFACE_7( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7 ), \ + INTERFACE8 + +#define PRIVATE_DEFINE_INTERFACE_9( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9 ) \ + PRIVATE_DEFINE_INTERFACE_8( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8 ), \ + INTERFACE9 + +#define PRIVATE_DEFINE_INTERFACE_10( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10 ) \ + PRIVATE_DEFINE_INTERFACE_9( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9 ), \ + INTERFACE10 + +#define PRIVATE_DEFINE_INTERFACE_11( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11 ) \ + PRIVATE_DEFINE_INTERFACE_10( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10 ), \ + INTERFACE11 + +//***************************************************************************************************************** +// public +// help macros for follow XInterface definitions +//***************************************************************************************************************** + +// Use it as parameter for DEFINE_XINTERFACE_X(), if you CAN use an interface directly in queryInterface()! +#define DIRECT_INTERFACE( INTERFACE ) \ + static_cast< INTERFACE* >( this ) + +// Use it as parameter for DEFINE_XINTERFACE_X(), if you CAN'T use an interface directly in queryInterface()! +// (zB at ambigous errors!) +#define DERIVED_INTERFACE( BASEINTERFACE, DERIVEDINTERFACE ) \ + static_cast< BASEINTERFACE* >( static_cast< DERIVEDINTERFACE* >( this ) ) + +//***************************************************************************************************************** +// public +// declaration of XInterface +//***************************************************************************************************************** +#define DECLARE_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( ::com::sun::star::uno::RuntimeException ); \ + virtual void SAL_CALL release ( ) throw( ::com::sun::star::uno::RuntimeException ); + +//***************************************************************************************************************** +// public +// implementation of XInterface +//***************************************************************************************************************** + +// implementation of XInterface with 0 additional interface for queryInterface() +#define DEFINE_XINTERFACE_0( CLASS, BASECLASS ) \ + PRIVATE_DEFINE_XINTERFACE_PURE ( CLASS, \ + BASECLASS \ + ) + +// implementation of XInterface with 1 additional interface for queryInterface() +#define DEFINE_XINTERFACE_1( CLASS, BASECLASS, INTERFACE1 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_1 ( INTERFACE1 \ + ) \ + ) \ + ) + +// implementation of XInterface with 2 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_2( CLASS, BASECLASS, INTERFACE1, INTERFACE2 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_2 ( INTERFACE1 , \ + INTERFACE2 \ + ) \ + ) \ + ) + +// implementation of XInterface with 3 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_3( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_3 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 \ + ) \ + ) \ + ) + +// implementation of XInterface with 4 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_4( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_4 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 \ + ) \ + ) \ + ) + +// implementation of XInterface with 5 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_5( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_5 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 \ + ) \ + ) \ + ) + +// implementation of XInterface with 6 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_6( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_6 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 \ + ) \ + ) \ + ) + +// implementation of XInterface with 7 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_7( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_7 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 \ + ) \ + ) \ + ) + +// implementation of XInterface with 8 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_8( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_8 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 \ + ) \ + ) \ + ) + +// implementation of XInterface with 9 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_9( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_9 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 \ + ) \ + ) \ + ) + +// implementation of XInterface with 10 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_10( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_10 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 \ + ) \ + ) \ + ) + +// implementation of XInterface with 11 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_11( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11 ) \ + PRIVATE_DEFINE_XINTERFACE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ) \ + ) + +// implementation of XInterface with 12 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_12( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_1 ( INTERFACE12 \ + ) \ + ) \ + ) + +// implementation of XInterface with 13 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_13( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_2 ( INTERFACE12 , \ + INTERFACE13 \ + ) \ + ) \ + ) + +// implementation of XInterface with 14 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_14( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13, INTERFACE14 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_3 ( INTERFACE12 , \ + INTERFACE13 , \ + INTERFACE14 \ + ) \ + ) \ + ) + +// implementation of XInterface with 15 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_15( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13, INTERFACE14, INTERFACE15 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_4 ( INTERFACE12 , \ + INTERFACE13 , \ + INTERFACE14 , \ + INTERFACE15 \ + ) \ + ) \ + ) + +// implementation of XInterface with 16 additional interfaces for queryInterface() +#define DEFINE_XINTERFACE_16( CLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13, INTERFACE14, INTERFACE15, INTERFACE16 ) \ + PRIVATE_DEFINE_XINTERFACE_LARGE ( CLASS, \ + BASECLASS, \ + ( aType, PRIVATE_DEFINE_INTERFACE_11 ( INTERFACE1 , \ + INTERFACE2 , \ + INTERFACE3 , \ + INTERFACE4 , \ + INTERFACE5 , \ + INTERFACE6 , \ + INTERFACE7 , \ + INTERFACE8 , \ + INTERFACE9 , \ + INTERFACE10 , \ + INTERFACE11 \ + ) \ + ), \ + ( aType, PRIVATE_DEFINE_INTERFACE_5 ( INTERFACE12 , \ + INTERFACE13 , \ + INTERFACE14 , \ + INTERFACE15 , \ + INTERFACE16 \ + ) \ + ) \ + ) + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_MACROS_XINTERFACE_HXX_ diff --git a/framework/inc/macros/xserviceinfo.hxx b/framework/inc/macros/xserviceinfo.hxx new file mode 100644 index 000000000000..b7e30c580f74 --- /dev/null +++ b/framework/inc/macros/xserviceinfo.hxx @@ -0,0 +1,277 @@ +/************************************************************************* + * + * $RCSfile: xserviceinfo.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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 __FRAMEWORK_MACROS_XSERVICEINFO_HXX_ +#define __FRAMEWORK_MACROS_XSERVICEINFO_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_UNO_EXCEPTION_HPP_ +#include <com/sun/star/uno/Exception.hpp> +#endif + +#ifndef _COM_SUN_STAR_UNO_RUNTIMEEXCEPTION_HPP_ +#include <com/sun/star/uno/RuntimeException.hpp> +#endif + +#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#endif + +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_UNO_ANY_H_ +#include <com/sun/star/uno/Any.h> +#endif + +#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_ +#include <com/sun/star/uno/Reference.h> +#endif + +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_ +#include <com/sun/star/uno/Sequence.h> +#endif + +#ifndef _COM_SUN_STAR_UNO_TYPE_H_ +#include <com/sun/star/uno/Type.h> +#endif + +#ifndef _CPPUHELPER_FACTORY_HXX_ +#include <cppuhelper/factory.hxx> +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#ifndef _RTL_USTRING_ +#include <rtl/ustring> +#endif + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +/*_________________________________________________________________________________________________________________ + + macros for declaration and definition of XServiceInfo + Please use follow public macros only! + + 1) DECLARE_XSERVICEINFO => use it to declare XServiceInfo in your header + 2) DEFINE_XSERVICEINFO_MULTISERVICE( CLASS, SERVICENAME, IMPLEMENTATIONNAME ) => use it to define XServiceInfo for multi service mode + 3) DEFINE_XSERVICEINFO_ONEINSTANCESERVICE( CLASS, SERVICENAME, IMPLEMENTATIONNAME ) => use it to define XServiceInfo for one instance service mode + +_________________________________________________________________________________________________________________*/ + +//***************************************************************************************************************** +// private +// implementation of XServiceInfo and helper functions +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XSERVICEINFO( CLASS, SERVICENAME, IMPLEMENTATIONNAME ) \ + /*===========================================================================================================*/ \ + /* XServiceInfo */ \ + /*===========================================================================================================*/ \ + ::rtl::OUString SAL_CALL CLASS::getImplementationName() throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + return impl_getStaticImplementationName(); \ + } \ + \ + /*===========================================================================================================*/ \ + /* XServiceInfo */ \ + /*===========================================================================================================*/ \ + sal_Bool SAL_CALL CLASS::supportsService( const ::rtl::OUString& sServiceName ) throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + /* Set default return value. */ \ + sal_Bool bReturn = sal_False ; \ + /* Get names of all supported servicenames. */ \ + ::com::sun::star::uno::Sequence< ::rtl::OUString > seqServiceNames = getSupportedServiceNames(); \ + const ::rtl::OUString* pArray = seqServiceNames.getConstArray(); \ + sal_Int32 nCounter = 0; \ + sal_Int32 nLength = seqServiceNames.getLength(); \ + /* Search for right name in list. */ \ + while ( \ + ( nCounter < nLength ) && \ + ( bReturn == sal_False ) \ + ) \ + { \ + /* Is name was found, say "YES, SERVICE IS SUPPORTED." and break loop. */ \ + if ( pArray[nCounter] == sServiceName ) \ + { \ + bReturn = sal_True ; \ + } \ + /* Else step to next element in list. */ \ + ++nCounter; \ + } \ + /* Return state of search. */ \ + return bReturn; \ + } \ + \ + /*===========================================================================================================*/ \ + /* XServiceInfo */ \ + /*===========================================================================================================*/ \ + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL CLASS::getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + return impl_getStaticSupportedServiceNames(); \ + } \ + \ + /*===========================================================================================================*/ \ + /* Helper for XServiceInfo */ \ + /*===========================================================================================================*/ \ + ::com::sun::star::uno::Sequence< ::rtl::OUString > CLASS::impl_getStaticSupportedServiceNames() \ + { \ + ::com::sun::star::uno::Sequence< ::rtl::OUString > seqServiceNames( 1 ); \ + seqServiceNames.getArray() [0] = SERVICENAME ; \ + return seqServiceNames; \ + } \ + \ + /*===========================================================================================================*/ \ + /* Helper for XServiceInfo */ \ + /*===========================================================================================================*/ \ + ::rtl::OUString CLASS::impl_getStaticImplementationName() \ + { \ + return IMPLEMENTATIONNAME ; \ + } \ + \ + /*===========================================================================================================*/ \ + /* Helper for registry */ \ + /*===========================================================================================================*/ \ + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL CLASS::impl_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) throw( ::com::sun::star::uno::Exception ) \ + { \ + return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >( *new CLASS( xServiceManager ) ); \ + } + +//***************************************************************************************************************** +// private +// definition of helper function createFactory() for multiple services +//***************************************************************************************************************** +#define PRIVATE_DEFINE_SINGLEFACTORY( CLASS ) \ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > CLASS::impl_createFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) \ + { \ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > xReturn ( cppu::createSingleFactory ( xServiceManager , \ + CLASS::impl_getStaticImplementationName() , \ + CLASS::impl_createInstance , \ + CLASS::impl_getStaticSupportedServiceNames() \ + ) \ + ); \ + return xReturn; \ + } + +//***************************************************************************************************************** +// private +// definition of helper function createFactory() for one instance services +//***************************************************************************************************************** +#define PRIVATE_DEFINE_ONEINSTANCEFACTORY( CLASS ) \ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > CLASS::impl_createFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) \ + { \ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > xReturn ( cppu::createOneInstanceFactory ( xServiceManager , \ + CLASS::impl_getStaticImplementationName() , \ + CLASS::impl_createInstance , \ + CLASS::impl_getStaticSupportedServiceNames() \ + ) \ + ); \ + return xReturn; \ + } + +//***************************************************************************************************************** +// public +// declaration of XServiceInfo and helper functions +//***************************************************************************************************************** +#define DECLARE_XSERVICEINFO \ + /* XServiceInfo */ \ + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); \ + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& sServiceName ) throw( ::com::sun::star::uno::RuntimeException ); \ + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); \ + /* Helper for XServiceInfo */ \ + static ::com::sun::star::uno::Sequence< ::rtl::OUString > impl_getStaticSupportedServiceNames(); \ + static ::rtl::OUString impl_getStaticImplementationName(); \ + /* Helper for registry */ \ + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL impl_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) throw( ::com::sun::star::uno::Exception ); \ + static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > impl_createFactory ( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + +//***************************************************************************************************************** +// public +// implementation of XServiceInfo +//***************************************************************************************************************** +#define DEFINE_XSERVICEINFO_MULTISERVICE( CLASS, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_XSERVICEINFO( CLASS, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_SINGLEFACTORY( CLASS ) + +#define DEFINE_XSERVICEINFO_ONEINSTANCESERVICE( CLASS, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_XSERVICEINFO( CLASS, SERVICENAME, IMPLEMENTATIONNAME ) \ + PRIVATE_DEFINE_ONEINSTANCEFACTORY( CLASS ) + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_MACROS_XSERVICEINFO_HXX_ diff --git a/framework/inc/macros/xtypeprovider.hxx b/framework/inc/macros/xtypeprovider.hxx new file mode 100644 index 000000000000..1b13e59476b2 --- /dev/null +++ b/framework/inc/macros/xtypeprovider.hxx @@ -0,0 +1,657 @@ +/************************************************************************* + * + * $RCSfile: xtypeprovider.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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 __FRAMEWORK_MACROS_XTYPEPROVIDER_HXX_ +#define __FRAMEWORK_MACROS_XTYPEPROVIDER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_ +#include <com/sun/star/lang/XTypeProvider.hpp> +#endif + +#ifndef _COM_SUN_STAR_UNO_RUNTIMEEXCEPTION_HPP_ +#include <com/sun/star/uno/RuntimeException.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_UNO_ANY_H_ +#include <com/sun/star/uno/Any.h> +#endif + +#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_ +#include <com/sun/star/uno/Reference.h> +#endif + +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_ +#include <com/sun/star/uno/Sequence.h> +#endif + +#ifndef _COM_SUN_STAR_UNO_TYPE_H_ +#include <com/sun/star/uno/Type.h> +#endif + +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#ifndef _RTL_USTRING_ +#include <rtl/ustring> +#endif + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +/*_________________________________________________________________________________________________________________ + + macros for declaration and definition of XTypeProvider + Please use follow public macros only! + + 1) DEFINE_XTYPEPROVIDER => use it in header to declare XTypeProvider and his methods + 2) DECLARE_TYPEPROVIDER_0( CLASS ) => use it to define implementation of XTypeProvider for 0 supported type + DECLARE_TYPEPROVIDER_1( CLASS, TYPE1 ) => use it to define implementation of XTypeProvider for 1 supported type + ... + DECLARE_TYPEPROVIDER_16( CLASS, TYPE1, ... , TYPE16 ) + 3) DEFINE_XTYPEPROVIDER_1_WITH_BASECLASS( CLASS, BASECLASS, TYPE1 ) => use it to define implementation of XTypeProvider for 1 additional supported type to baseclass + ... + DEFINE_XTYPEPROVIDER_5_WITH_BASECLASS( CLASS, BASECLASS, TYPE1, ..., TYPE5 ) + +_________________________________________________________________________________________________________________*/ + +//***************************************************************************************************************** +// private +// implementation of XTypeProvider::getImplementationId() +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XTYPEPROVIDER_ID( CLASS ) \ + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL CLASS::getImplementationId() throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + /* Create one Id for all instances of this class. */ \ + /* Use ethernet address to do this! (sal_True) */ \ + /* Optimize this method */ \ + /* We initialize a static variable only one time. And we don't must use a mutex at every call! */ \ + /* For the first call; pID is NULL - for the second call pID is different from NULL! */ \ + static ::cppu::OImplementationId* pID = NULL ; \ + if ( pID == NULL ) \ + { \ + /* Ready for multithreading; get global mutex for first call of this method only! see before */ \ + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \ + /* Control these pointer again ... it can be, that another instance will be faster then these! */ \ + if ( pID == NULL ) \ + { \ + /* Create a new static ID ... */ \ + static ::cppu::OImplementationId aID( sal_False ); \ + /* ... and set his address to static pointer! */ \ + pID = &aID ; \ + } \ + } \ + return pID->getImplementationId(); \ + } + +//***************************************************************************************************************** +// private +// implementation of XTypeProvider::getTypes() with max. 12 interfaces! +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XTYPEPROVIDER_TYPES( CLASS, TYPES ) \ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL CLASS::getTypes() throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + /* Optimize this method ! */ \ + /* We initialize a static variable only one time. */ \ + /* And we don't must use a mutex at every call! */ \ + /* For the first call; pTypeCollection is NULL - */ \ + /* for the second call pTypeCollection is different from NULL! */ \ + static ::cppu::OTypeCollection* pTypeCollection = NULL ; \ + if ( pTypeCollection == NULL ) \ + { \ + /* Ready for multithreading; get global mutex for first call of this method only! see before */ \ + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \ + /* Control these pointer again ... it can be, that another instance will be faster then these! */ \ + if ( pTypeCollection == NULL ) \ + { \ + /* Create a static typecollection ... */ \ + static ::cppu::OTypeCollection aTypeCollection TYPES ; \ + /* ... and set his address to static pointer! */ \ + pTypeCollection = &aTypeCollection ; \ + } \ + } \ + return pTypeCollection->getTypes(); \ + } + +//***************************************************************************************************************** +// private +// implementation of XTypeProvider::getTypes() with more then 12 interfaces! +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XTYPEPROVIDER_TYPES_LARGE( CLASS, TYPES_FIRST, TYPES_SECOND ) \ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL CLASS::getTypes() throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + /* Optimize this method ! */ \ + /* We initialize a static variable only one time. */ \ + /* And we don't must use a mutex at every call! */ \ + /* For the first call; pTypeCollection is NULL - */ \ + /* for the second call pTypeCollection is different from NULL! */ \ + static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >* pTypeCollection = NULL ; \ + if ( pTypeCollection == NULL ) \ + { \ + /* Ready for multithreading; get global mutex for first call of this method only! see before */ \ + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \ + /* Control these pointer again ... it can be, that another instance will be faster then these! */ \ + if ( pTypeCollection == NULL ) \ + { \ + /* Create two typecollections */ \ + /* (cppuhelper support 12 items per collection only!) */ \ + ::cppu::OTypeCollection aTypeCollection1 TYPES_FIRST ; \ + ::cppu::OTypeCollection aTypeCollection2 TYPES_SECOND ; \ + /* Copy all items from both sequences to one result list! */ \ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > seqTypes1 = aTypeCollection1.getTypes(); \ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > seqTypes2 = aTypeCollection2.getTypes(); \ + sal_Int32 nCount1 = seqTypes1.getLength(); \ + sal_Int32 nCount2 = seqTypes2.getLength(); \ + static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > seqResult ( nCount1+nCount2 ); \ + sal_Int32 nSource = 0; \ + sal_Int32 nDestination= 0; \ + while( nSource<nCount1 ) \ + { \ + seqResult[nDestination] = seqTypes1[nSource]; \ + ++nSource; \ + ++nDestination; \ + } \ + nSource = 0; \ + while( nSource<nCount2 ) \ + { \ + seqResult[nDestination] = seqTypes2[nSource]; \ + ++nSource; \ + ++nDestination; \ + } \ + /* ... and set his address to static pointer! */ \ + pTypeCollection = &seqResult; \ + } \ + } \ + return *pTypeCollection; \ + } + +//***************************************************************************************************************** +// private +// implementation of XTypeProvider::getTypes() with using max. 12 interfaces + baseclass! +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XTYPEPROVIDER_TYPES_BASECLASS( CLASS, BASECLASS, TYPES ) \ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL CLASS::getTypes() throw( ::com::sun::star::uno::RuntimeException ) \ + { \ + /* Optimize this method ! */ \ + /* We initialize a static variable only one time. */ \ + /* And we don't must use a mutex at every call! */ \ + /* For the first call; pTypeCollection is NULL - */ \ + /* for the second call pTypeCollection is different from NULL! */ \ + static ::cppu::OTypeCollection* pTypeCollection = NULL ; \ + if ( pTypeCollection == NULL ) \ + { \ + /* Ready for multithreading; get global mutex for first call of this method only! see before */ \ + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \ + /* Control these pointer again ... it can be, that another instance will be faster then these! */ \ + if ( pTypeCollection == NULL ) \ + { \ + /* Create two static typecollections ... */ \ + static ::cppu::OTypeCollection aTypeCollection( TYPES, BASECLASS::getTypes() ); \ + /* ... and set his address to static pointer! */ \ + pTypeCollection = &aTypeCollection; \ + } \ + } \ + return pTypeCollection->getTypes(); \ + } + +//***************************************************************************************************************** +// private +// help macros to replace TYPES in getTypes() [see before] +//***************************************************************************************************************** +//#ifdef ENABLE_SERVICEDEBUG +//#define PRIVATE_DEFINE_TYPE_1( TYPE1 ) \ +// ::getCppuType(( const ::com::sun::star::uno::Reference< XSPECIALDEBUGINTERFACE >*)NULL ), \ +// ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE1 >*)NULL ) +//#else +#define PRIVATE_DEFINE_TYPE_1( TYPE1 ) \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE1 >*)NULL ) +//#endif // #ifdef ENABLE_SERVICEDEBUG + +#define PRIVATE_DEFINE_TYPE_2( TYPE1, TYPE2 ) \ + PRIVATE_DEFINE_TYPE_1( TYPE1 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE2 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_3( TYPE1, TYPE2, TYPE3 ) \ + PRIVATE_DEFINE_TYPE_2( TYPE1, TYPE2 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE3 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_4( TYPE1, TYPE2, TYPE3, TYPE4 ) \ + PRIVATE_DEFINE_TYPE_3( TYPE1, TYPE2, TYPE3 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE4 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_5( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5 ) \ + PRIVATE_DEFINE_TYPE_4( TYPE1, TYPE2, TYPE3, TYPE4 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE5 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_6( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6 ) \ + PRIVATE_DEFINE_TYPE_5( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE6 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_7( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7 ) \ + PRIVATE_DEFINE_TYPE_6( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE7 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_8( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8 ) \ + PRIVATE_DEFINE_TYPE_7( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE8 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_9( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9 ) \ + PRIVATE_DEFINE_TYPE_8( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE9 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_10( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10 ) \ + PRIVATE_DEFINE_TYPE_9( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE10 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_11( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11 ) \ + PRIVATE_DEFINE_TYPE_10( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE11 >*)NULL ) + +#define PRIVATE_DEFINE_TYPE_12( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12 ) \ + PRIVATE_DEFINE_TYPE_11( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11 ), \ + ::getCppuType(( const ::com::sun::star::uno::Reference< TYPE12 >*)NULL ) + +//***************************************************************************************************************** +// private +// complete implementation of XTypeProvider +//***************************************************************************************************************** +#define PRIVATE_DEFINE_XTYPEPROVIDER_PURE( CLASS ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_ID( CLASS ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_TYPES( CLASS, ::getCppuType(( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider >*)NULL ) ) + +#define PRIVATE_DEFINE_XTYPEPROVIDER( CLASS, TYPES ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_ID( CLASS ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_TYPES( CLASS, TYPES ) + +#define PRIVATE_DEFINE_XTYPEPROVIDER_LARGE( CLASS, TYPES_FIRST, TYPES_SECOND ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_ID( CLASS ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_TYPES_LARGE( CLASS, TYPES_FIRST, TYPES_SECOND ) + +#define PRIVATE_DEFINE_XTYPEPROVIDER_BASECLASS( CLASS, BASECLASS, TYPES ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_ID( CLASS ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_TYPES_BASECLASS( CLASS, BASECLASS, TYPES ) + +//***************************************************************************************************************** +// public +// declaration of XTypeProvider +//***************************************************************************************************************** +#define DECLARE_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 ); + +//***************************************************************************************************************** +// public +// implementation of XTypeProvider +//***************************************************************************************************************** +// implementation of XTypeProvider without additional interface for getTypes() +// XTypeProvider is used as the only one interface automaticly. +// Following defines don't use XTypeProvider automaticly!!!! +#define DEFINE_XTYPEPROVIDER_0( CLASS ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_PURE( CLASS ) + +// implementation of XTypeProvider with 1 additional interface for getTypes() +#define DEFINE_XTYPEPROVIDER_1( CLASS, TYPE1 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_1 ( TYPE1 \ + )) \ + ) + +// implementation of XTypeProvider with 2 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_2( CLASS, TYPE1, TYPE2 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_2 ( TYPE1 , \ + TYPE2 \ + )) \ + ) + +// implementation of XTypeProvider with 3 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_3( CLASS, TYPE1, TYPE2, TYPE3 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_3 ( TYPE1 , \ + TYPE2 , \ + TYPE3 \ + )) \ + ) + +// implementation of XTypeProvider with 4 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_4( CLASS, TYPE1, TYPE2, TYPE3, TYPE4 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_4 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 \ + )) \ + ) + +// implementation of XTypeProvider with 5 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_5( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_5 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 \ + )) \ + ) + +// implementation of XTypeProvider with 6 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_6( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_6 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 \ + )) \ + ) + +// implementation of XTypeProvider with 7 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_7( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_7 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 \ + )) \ + ) + +// implementation of XTypeProvider with 8 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_8( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_8 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 \ + )) \ + ) + +// implementation of XTypeProvider with 9 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_9( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_9 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 \ + )) \ + ) + +// implementation of XTypeProvider with 10 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_10( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER ( CLASS, \ + (PRIVATE_DEFINE_TYPE_10 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 \ + )) \ + ) + +// implementation of XTypeProvider with 11 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_11( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_10 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 \ + )), \ + (PRIVATE_DEFINE_TYPE_1 ( TYPE11 \ + )) \ + ) + +// implementation of XTypeProvider with 12 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_12( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_10 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 \ + )), \ + (PRIVATE_DEFINE_TYPE_2 ( TYPE11 , \ + TYPE12 \ + )) \ + ) + +// implementation of XTypeProvider with 13 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_13( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_10 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 \ + )), \ + (PRIVATE_DEFINE_TYPE_3 ( TYPE11 , \ + TYPE12 , \ + TYPE13 \ + )) \ + ) + +// implementation of XTypeProvider with 14 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_14( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13, TYPE14 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_10 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 \ + )), \ + (PRIVATE_DEFINE_TYPE_4 ( TYPE11 , \ + TYPE12 , \ + TYPE13 , \ + TYPE14 \ + )) \ + ) + +// implementation of XTypeProvider with 15 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_15( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13, TYPE14, TYPE15 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_10 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 \ + )), \ + (PRIVATE_DEFINE_TYPE_5 ( TYPE11 , \ + TYPE12 , \ + TYPE13 , \ + TYPE14 , \ + TYPE15 \ + )) \ + ) + +// implementation of XTypeProvider with 16 additional interfaces for getTypes() +#define DEFINE_XTYPEPROVIDER_16( CLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13, TYPE14, TYPE15, TYPE16 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_LARGE ( CLASS, \ + (PRIVATE_DEFINE_TYPE_10 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 , \ + TYPE6 , \ + TYPE7 , \ + TYPE8 , \ + TYPE9 , \ + TYPE10 \ + )), \ + (PRIVATE_DEFINE_TYPE_6 ( TYPE11 , \ + TYPE12 , \ + TYPE13 , \ + TYPE14 , \ + TYPE15 , \ + TYPE16 \ + )) \ + ) + +// implementation of XTypeProvider with 1 additional interface for getTypes() AND using 1 baseclass +#define DEFINE_XTYPEPROVIDER_1_WITH_BASECLASS( CLASS, BASECLASS, TYPE1 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_BASECLASS ( CLASS, \ + BASECLASS, \ + (PRIVATE_DEFINE_TYPE_1 ( TYPE1 \ + )) \ + ) + +// implementation of XTypeProvider with 2 additional interface for getTypes() AND using 1 baseclass +#define DEFINE_XTYPEPROVIDER_2_WITH_BASECLASS( CLASS, BASECLASS, TYPE1, TYPE2 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_BASECLASS ( CLASS, \ + BASECLASS, \ + (PRIVATE_DEFINE_TYPE_2 ( TYPE1 , \ + TYPE2 \ + )) \ + ) + +// implementation of XTypeProvider with 3 additional interface for getTypes() AND using 1 baseclass +#define DEFINE_XTYPEPROVIDER_3_WITH_BASECLASS( CLASS, BASECLASS, TYPE1, TYPE2, TYPE3 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_BASECLASS ( CLASS, \ + BASECLASS, \ + (PRIVATE_DEFINE_TYPE_3 ( TYPE1 , \ + TYPE2 , \ + TYPE3 \ + )) \ + ) +// implementation of XTypeProvider with 4 additional interface for getTypes() AND using 1 baseclass +#define DEFINE_XTYPEPROVIDER_4_WITH_BASECLASS( CLASS, BASECLASS, TYPE1, TYPE2, TYPE3, TYPE4 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_BASECLASS ( CLASS, \ + BASECLASS, \ + (PRIVATE_DEFINE_TYPE_4 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 \ + )) \ + ) +// implementation of XTypeProvider with 5 additional interface for getTypes() AND using 1 baseclass +#define DEFINE_XTYPEPROVIDER_5_WITH_BASECLASS( CLASS, BASECLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5 ) \ + PRIVATE_DEFINE_XTYPEPROVIDER_BASECLASS ( CLASS, \ + BASECLASS, \ + (PRIVATE_DEFINE_TYPE_5 ( TYPE1 , \ + TYPE2 , \ + TYPE3 , \ + TYPE4 , \ + TYPE5 \ + )) \ + ) + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_MACROS_XTYPEPROVIDER_HXX_ diff --git a/framework/inc/services/frame.hxx b/framework/inc/services/frame.hxx new file mode 100644 index 000000000000..a7b220cbce51 --- /dev/null +++ b/framework/inc/services/frame.hxx @@ -0,0 +1,1412 @@ +/************************************************************************* + * + * $RCSfile: frame.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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 __FRAMEWORK_SERVICES_FRAME_HXX_ +#define __FRAMEWORK_SERVICES_FRAME_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_CLASSES_FRAMECONTAINER_HXX_ +#include <classes/framecontainer.hxx> +#endif + +#ifndef __FRAMEWORK_HELPER_OMUTEXMEMBER_HXX_ +#include <helper/omutexmember.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_GENERIC_HXX_ +#include <macros/generic.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_ +#include <macros/debug.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_XINTERFACE_HXX_ +#include <macros/xinterface.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_XTYPEPROVIDER_HXX_ +#include <macros/xtypeprovider.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_XSERVICEINFO_HXX_ +#include <macros/xserviceinfo.hxx> +#endif + +#ifndef __FRAMEWORK_DEFINES_HXX_ +#include <defines.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_FRAME_XBROWSEHISTORYREGISTRY_HPP_ +#include <com/sun/star/frame/XBrowseHistoryRegistry.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XCONTROLLER_HPP_ +#include <com/sun/star/frame/XController.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XDISPATCH_HPP_ +#include <com/sun/star/frame/XDispatch.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDER_HPP_ +#include <com/sun/star/frame/XDispatchProvider.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDERINTERCEPTION_HPP_ +#include <com/sun/star/frame/XDispatchProviderInterception.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDERINTERCEPTOR_HPP_ +#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> +#endif + +#ifndef _COM_SUN_STAR_LANG_XEVENTLISTENER_HPP_ +#include <com/sun/star/lang/XEventListener.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_ +#include <com/sun/star/frame/XFrame.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XFRAMEACTIONLISTENER_HPP_ +#include <com/sun/star/frame/XFrameActionListener.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XFRAMES_HPP_ +#include <com/sun/star/frame/XFrames.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XFRAMESSUPPLIER_HPP_ +#include <com/sun/star/frame/XFramesSupplier.hpp> +#endif + +#ifndef _COM_SUN_STAR_TASK_XSTATUSINDICATOR_HPP_ +#include <com/sun/star/task/XStatusIndicator.hpp> +#endif + +#ifndef _COM_SUN_STAR_TASK_XSTATUSINDICATORSUPPLIER_HPP_ +#include <com/sun/star/task/XStatusIndicatorSupplier.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_XTOPWINDOWLISTENER_HPP_ +#include <com/sun/star/awt/XTopWindowListener.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_ +#include <com/sun/star/awt/XWindow.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_XWINDOWLISTENER_HPP_ +#include <com/sun/star/awt/XWindowListener.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_XFOCUSLISTENER_HPP_ +#include <com/sun/star/awt/XFocusListener.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_FOCUSEVENT_HPP_ +#include <com/sun/star/awt/FocusEvent.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_ +#include <cppuhelper/interfacecontainer.hxx> +#endif + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +#ifndef _RTL_STRING_HXX_ +#include <rtl/string.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +#define ANY ::com::sun::star::uno::Any +#define DISPATCHDESCRIPTOR ::com::sun::star::frame::DispatchDescriptor +#define EVENTOBJECT ::com::sun::star::lang::EventObject +#define FOCUSEVENT ::com::sun::star::awt::FocusEvent +#define FRAMEACTION ::com::sun::star::frame::FrameAction +#define INDEXOUTOFBOUNDSEXCEPTION ::com::sun::star::lang::IndexOutOfBoundsException +#define OINTERFACECONTAINERHELPER ::cppu::OInterfaceContainerHelper +#define OMULTITYPEINTERFACECONTAINERHELPER ::cppu::OMultiTypeInterfaceContainerHelper +#define OSTRING ::rtl::OString +#define OUSTRING ::rtl::OUString +#define OWEAKOBJECT ::cppu::OWeakObject +#define PROPERTYVALUE ::com::sun::star::beans::PropertyValue +#define RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException +#define UNOURL ::com::sun::star::util::URL +#define WINDOWEVENT ::com::sun::star::awt::WindowEvent +#define WRAPPEDTARGETEXCEPTION ::com::sun::star::lang::WrappedTargetException +#define XBROWSEHISTORYREGISTRY ::com::sun::star::frame::XBrowseHistoryRegistry +#define XCONTROLLER ::com::sun::star::frame::XController +#define XDISPATCH ::com::sun::star::frame::XDispatch +#define XDISPATCHPROVIDER ::com::sun::star::frame::XDispatchProvider +#define XDISPATCHPROVIDERINTERCEPTION ::com::sun::star::frame::XDispatchProviderInterception +#define XDISPATCHPROVIDERINTERCEPTOR ::com::sun::star::frame::XDispatchProviderInterceptor +#define XEVENTLISTENER ::com::sun::star::lang::XEventListener +#define XFOCUSLISTENER ::com::sun::star::awt::XFocusListener +#define XFRAME ::com::sun::star::frame::XFrame +#define XFRAMEACTIONLISTENER ::com::sun::star::frame::XFrameActionListener +#define XFRAMELOADER ::com::sun::star::frame::XFrameLoader +#define XFRAMES ::com::sun::star::frame::XFrames +#define XFRAMESSUPPLIER ::com::sun::star::frame::XFramesSupplier +#define XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory +#define XSERVICEINFO ::com::sun::star::lang::XServiceInfo +#define XSTATUSINDICATOR ::com::sun::star::task::XStatusIndicator +#define XSTATUSINDICATORSUPPLIER ::com::sun::star::task::XStatusIndicatorSupplier +#define XTOPWINDOWLISTENER ::com::sun::star::awt::XTopWindowListener +#define XTYPEPROVIDER ::com::sun::star::lang::XTypeProvider +#define XWINDOW ::com::sun::star::awt::XWindow +#define XWINDOWLISTENER ::com::sun::star::awt::XWindowListener + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implements a normal frame of hierarchy + @descr An instance of these class can be a normal node in frame tree only. The highest level to be allowed is 3! + On 1 stand the desktop himself as the only one, on 2 are all tasks present ... and then comes frames only. + A frame support influencing of his subtree, find of subframes, activate- and deactivate-mechanism as well as + set/get of a frame window, component or controller. + + @implements XInterface + XTypeProvider + XServiceInfo + XFramesSupplier + XFrame + XComponent + XStatusIndicatorSupplier + XDispatchProvider + XDispatchProviderInterception + XBrowseHistoryRegistry + XEventListener + XWindowListener + XTopWindowListener + XFocusListener + [ XDebugging, if TEST_TREE is defined! ] + @base OMutexMember + OWeakObject + + @devstatus deprecated +*//*-*************************************************************************************************************/ + +//class Frame : DERIVE_FROM_XSPECIALDEBUGINTERFACE // => These macro will expand to nothing, if no testmode is set in debug.h! +class Frame : public XTYPEPROVIDER , + public XSERVICEINFO , + public XFRAMESSUPPLIER , // => XFrame , XComponent + public XSTATUSINDICATORSUPPLIER , + public XDISPATCHPROVIDER , + public XDISPATCHPROVIDERINTERCEPTION , + public XBROWSEHISTORYREGISTRY , + public XWINDOWLISTENER , // => XEventListener + public XTOPWINDOWLISTENER , + public XFOCUSLISTENER , + public OMutexMember , // Struct for right initalization of mutex member! Must be first of baseclasses. + public OWEAKOBJECT +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor to create instance by factory + @descr This constructor initialize a new instance of this class by valid factory, + and will be set valid values on his member and baseclasses. + + @seealso - + + @param "xFactory" is the multi service manager, which create this instance. + The value must be different from NULL! + @return - + + @onerror ASSERT in debug version or nothing in relaese version. + *//*-*****************************************************************************************************/ + + Frame( const REFERENCE< XMULTISERVICEFACTORY >& xFactory ); + + /*-****************************************************************************************************//** + @short standard destructor + @descr This method destruct an instance of this class and clear some member. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~Frame(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + //--------------------------------------------------------------------------------------------------------- + + DECLARE_XINTERFACE + DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO +// DECLARE_XSPECIALDEBUGINTERFACE // => These macro will expand to nothing, if no testmode is set in debug.h! + + //--------------------------------------------------------------------------------------------------------- + // XFramesSupplier + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short return access to append or remove childs on desktop + @descr We don't implement these interface directly. We use a helper class to do this. + If you wish to add or delete childs to/from the container, call these method to get + a reference to the helper. + + @seealso class OFrames + + @param - + @return A reference to the helper. + + @onerror A null reference is returned. + *//*-*****************************************************************************************************/ + + virtual REFERENCE< XFRAMES > SAL_CALL getFrames() throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short get the current active child frame + @descr It must be a frameto. Direct childs of a frame are frames only! No task or desktop is accepted. + We don't save this information directly in this class. We use ouer container-helper + to do that. + + @seealso class OFrameContainer + @seealso method setActiveFrame() + + @param - + @return A reference to ouer current active childframe, if anyone exist. + @return A null reference, if nobody is active. + + @onerror A null reference is returned. + *//*-*****************************************************************************************************/ + + virtual REFERENCE< XFRAME > SAL_CALL getActiveFrame() throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short set the new active direct child frame + @descr It must be a frame to. Direct childs of frame are frames only! No task or desktop is accepted. + We don't save this information directly in this class. We use ouer container-helper + to do that. + + @seealso class OFrameContainer + @seealso method getActiveFrame() + + @param "xFrame", reference to new active child. It must be an already existing child! + @return - + + @onerror An assertion is thrown, if given frame is'nt already a child of us. + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL setActiveFrame( const REFERENCE< XFRAME >& xFrame ) throw( RUNTIMEEXCEPTION ); + + //--------------------------------------------------------------------------------------------------------- + // XStatusIndicatorSupplier + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short not implemented yet! + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual REFERENCE< XSTATUSINDICATOR > SAL_CALL getStatusIndicator() throw( RUNTIMEEXCEPTION ); + + //--------------------------------------------------------------------------------------------------------- + // XDispatchProvider + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + + @descr This method searches for a dispatch for the specified DispatchDescriptor. + The FrameSearchFlags and the FrameName of the DispatchDescriptor are + treated as described for findFrame. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual REFERENCE< XDISPATCH > SAL_CALL queryDispatch( const UNOURL& aURL , + const OUSTRING& sTargetFrameName, + sal_Int32 nSearchFlags ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr Returns a sequence of dispatches. For details see the queryDispatch method. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual SEQUENCE< REFERENCE< XDISPATCH > > SAL_CALL queryDispatches( const SEQUENCE< DISPATCHDESCRIPTOR >& seqDescriptor ) throw( RUNTIMEEXCEPTION ); + + //--------------------------------------------------------------------------------------------------------- + // XDispatchProviderInterception + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL registerDispatchProviderInterceptor( const REFERENCE< XDISPATCHPROVIDERINTERCEPTOR >& xInterceptor ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL releaseDispatchProviderInterceptor( const REFERENCE< XDISPATCHPROVIDERINTERCEPTOR >& xInterceptor ) throw( RUNTIMEEXCEPTION ); + + //--------------------------------------------------------------------------------------------------------- + // XBrowseHistoryRegistry + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL updateViewData( const ANY& aValue ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL createNewEntry( const OUSTRING& sURL , + const SEQUENCE< PROPERTYVALUE >& seqArguments, + const OUSTRING& sTitle ) throw( RUNTIMEEXCEPTION ); + + //--------------------------------------------------------------------------------------------------------- + // XWindowListener + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL windowResized( const WINDOWEVENT& aEvent ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL windowMoved( const WINDOWEVENT& aEvent ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL windowShown( const EVENTOBJECT& aEvent ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL windowHidden( const EVENTOBJECT& aEvent ) throw( RUNTIMEEXCEPTION ); + + //--------------------------------------------------------------------------------------------------------- + // XTopWindowListener + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL windowOpened( const EVENTOBJECT& aEvent ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL windowClosing( const EVENTOBJECT& aEvent ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL windowClosed( const EVENTOBJECT& aEvent ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL windowMinimized( const EVENTOBJECT& aEvent ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL windowNormalized( const EVENTOBJECT& aEvent ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL windowActivated( const EVENTOBJECT& aEvent ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL windowDeactivated( const EVENTOBJECT& aEvent ) throw( RUNTIMEEXCEPTION ); + + //--------------------------------------------------------------------------------------------------------- + // XFrame + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL initialize( const REFERENCE< XWINDOW >& xWindow ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr The ContainerWindow property is used as a VclContainer for the Component + in this frame. So this object implements a XVclContainer interface too. + The instantiation of the ContainerWindow is done by the derived frame class. + The frame is the owner of its ContainerWindow. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual REFERENCE< XWINDOW > SAL_CALL getContainerWindow() throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL setCreator( const REFERENCE< XFRAMESSUPPLIER >& xCreator ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr The Creator is the parent frame container. If it is NULL, the frame is the uppermost one. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual REFERENCE< XFRAMESSUPPLIER > SAL_CALL getCreator() throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual OUSTRING SAL_CALL getName() throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL setName( const OUSTRING& sName ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr This method searches for a frame with the specified name. + Frames may contain other frames (e.g. a frameset) and may + be contained in other frames. This hierarchie ist searched by + this method. + First some special names are taken into account, i.e. "", + "_self", "_top", "_active" etc. The FrameSearchFlags are ignored + when comparing these names with aTargetFrameName, further steps are + controlled by the FrameSearchFlags. If allowed, the name of the frame + itself is compared with the desired one, then ( again if allowed ) + the method findFrame is called for all children of the frame. + At last findFrame may be called for the parent frame ( if allowed ). + If no Frame with the given name is found until the top frames container, + a new top Frame is created, if this is allowed by a special + FrameSearchFlag. The new Frame also gets the desired name. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual REFERENCE< XFRAME > SAL_CALL findFrame( const OUSTRING& sTargetFrameName , + sal_Int32 nSearchFlags ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr Returns sal_True, if this frame is a "top frame", otherwise sal_False. + The "m_bIsFrameTop" member must be set in the ctor of the derived frame class. + A top frame is a member of the top frame container or a member of the + task frame container. Both containers can create new frames if the findFrame + method of their XFrame interface is called with a frame name not yet known. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL isTop() throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL activate() throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL deactivate() throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL isActive() throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL setComponent( const REFERENCE< XWINDOW >& xComponentWindow , + const REFERENCE< XCONTROLLER >& xController ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr Frames are used to display components. The actual displayed component is + held by the ComponentWindow property. If the component implements only a + XVclComponent interface, the communication between the frame and the + component is very restricted. Better integration is achievable through a + XController interface. + If the component wants other objects to be able to get information about its + ResourceDescriptor ( e.g. for an implementation of a browse history ) it has + to implement a XModel interface. + This frame is the owner of the ComponentWindow. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual REFERENCE< XWINDOW > SAL_CALL getComponentWindow() throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual REFERENCE< XCONTROLLER > SAL_CALL getController() throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL contextChanged() throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL addFrameActionListener( const REFERENCE< XFRAMEACTIONLISTENER >& xListener ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL removeFrameActionListener( const REFERENCE< XFRAMEACTIONLISTENER >& xListener ) throw( RUNTIMEEXCEPTION ); + + //--------------------------------------------------------------------------------------------------------- + // XComponent + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + + @descr The owner of this object calles the dispose method if the object + should be destroyed. All other objects and components, that are registered + as an EventListener are forced to release their references to this object. + Furthermore this frame is removed from its parent frame container to release + this reference. The reference attributes are disposed and released also. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL dispose() throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr Adds an EventListener to this object. If the dispose method is called on + this object, the disposing method of the listener is called. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL addEventListener( const REFERENCE< XEVENTLISTENER >& xListener ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr Removes an EventListener. If another object that has registered itself as + an EventListener is disposed it must deregister by calling this method. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL removeEventListener( const REFERENCE< XEVENTLISTENER >& xListener ) throw( RUNTIMEEXCEPTION ); + + //--------------------------------------------------------------------------------------------------------- + // XEventListener + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + + @descr This object is forced to release all references to the interfaces given + by the parameter Source. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL disposing( const EVENTOBJECT& aEvent ) throw( RUNTIMEEXCEPTION ); + + //--------------------------------------------------------------------------------------------------------- + // XFocusListener + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL focusGained( const FOCUSEVENT& aEvent ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL focusLost( const FOCUSEVENT& aEvent ) throw( RUNTIMEEXCEPTION ); + + //--------------------------------------------------------------------------------------------------------- + // public but impl method for direct helper access of class "DispatchProvider". + // Don't use this in another context! + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short search for last destination of load component by means of dispatch(...) + @descr This is a HACK for XDispatch->dispatch(...) calls. You don't get any information about + the destination frame, which has loaded a component in loadComponentFromURL()! + But we will set a flag m_bILoadLastComponent in impl_loadComponent() if loading successfull. + With these impl method you can find this frame and return his component ... + If this method found any frame we must reset ouer special flag! + + @seealso method impl_loadComponent() + @seealso method loadComponentFromURL() + + @param - + @return A reference to frame, which has loaded the last component. + + @onerror A null reference is returned. + *//*-*****************************************************************************************************/ + + REFERENCE< XFRAME > impl_searchLastLoadedComponent(); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void impl_setContainerWindow( const REFERENCE< XWINDOW >& xWindow ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void impl_setComponentWindow( const REFERENCE< XWINDOW >& xWindow ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void impl_setController( const REFERENCE< XCONTROLLER >& xController ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void impl_sendFrameActionEvent( const FRAMEACTION& aAction ); + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void impl_sendDisposeEvent(); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + sal_Bool impl_willFrameTop( const REFERENCE< XFRAMESSUPPLIER >& xParent ); + + /*-****************************************************************************************************//** + @short resize ouer componentwindow + @descr We have get a resize event or a new component. Then we must resize ouer component window too. + There are two places in this implementation to do this. Thats why we implement this helper function. + + @seealso method windowResized() + @seealso method impl_loadComponent() + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void impl_resizeComponentWindow(); + + //------------------------------------------------------------------------------------------------------------- + // debug methods + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short debug-method to check incoming parameter of some other mehods of this class + @descr The following methods are used to check parameters for other methods + of this class. The return value is used directly for an ASSERT(...). + + @seealso ASSERTs in implementation! + + @param references to checking variables + @return sal_False ,on invalid parameter + @return sal_True ,otherwise + + @onerror - + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + private: + + sal_Bool impldbg_checkParameter_append ( const REFERENCE< XFRAME >& xFrame ); + sal_Bool impldbg_checkParameter_queryFrames ( sal_Int32 nSearchFlags ); + sal_Bool impldbg_checkParameter_remove ( const REFERENCE< XFRAME >& xFrame ); + sal_Bool impldbg_checkParameter_setActiveFrame ( const REFERENCE< XFRAME >& xFrame ); + sal_Bool impldbg_checkParameter_queryDispatch ( const UNOURL& aURL , + const OUSTRING& sTargetFrameName , + sal_Int32 nSearchFlags ); + sal_Bool impldbg_checkParameter_queryDispatches ( const SEQUENCE< DISPATCHDESCRIPTOR >& seqDescriptor ); + sal_Bool impldbg_checkParameter_registerDispatchProviderInterceptor ( const REFERENCE< XDISPATCHPROVIDERINTERCEPTOR >& xInterceptor ); + sal_Bool impldbg_checkParameter_releaseDispatchProviderInterceptor ( const REFERENCE< XDISPATCHPROVIDERINTERCEPTOR >& xInterceptor ); + sal_Bool impldbg_checkParameter_updateViewData ( const ANY& aValue ); + sal_Bool impldbg_checkParameter_createNewEntry ( const OUSTRING& sURL , + const SEQUENCE< PROPERTYVALUE >& seqArguments , + const OUSTRING& sTitle ); + sal_Bool impldbg_checkParameter_windowResized ( const WINDOWEVENT& aEvent ); + sal_Bool impldbg_checkParameter_windowActivated ( const EVENTOBJECT& aEvent ); + sal_Bool impldbg_checkParameter_windowDeactivated ( const EVENTOBJECT& aEvent ); + sal_Bool impldbg_checkParameter_initialize ( const REFERENCE< XWINDOW >& xWindow ); + sal_Bool impldbg_checkParameter_setCreator ( const REFERENCE< XFRAMESSUPPLIER >& xCreator ); + sal_Bool impldbg_checkParameter_setName ( const OUSTRING& sName ); + sal_Bool impldbg_checkParameter_findFrame ( const OUSTRING& sTargetFrameName , + sal_Int32 nSearchFlags ); + sal_Bool impldbg_checkParameter_setComponent ( const REFERENCE< XWINDOW >& xComponentWindow , + const REFERENCE< XCONTROLLER >& xController ); + sal_Bool impldbg_checkParameter_addFrameActionListener ( const REFERENCE< XFRAMEACTIONLISTENER >& xListener ); + sal_Bool impldbg_checkParameter_removeFrameActionListener ( const REFERENCE< XFRAMEACTIONLISTENER >& xListener ); + sal_Bool impldbg_checkParameter_addEventListener ( const REFERENCE< XEVENTLISTENER >& xListener ); + sal_Bool impldbg_checkParameter_removeEventListener ( const REFERENCE< XEVENTLISTENER >& xListener ); + sal_Bool impldbg_checkParameter_disposing ( const EVENTOBJECT& aEvent ); + sal_Bool impldbg_checkParameter_focusGained ( const FOCUSEVENT& aEvent ); + sal_Bool impldbg_checkParameter_focusLost ( const FOCUSEVENT& aEvent ); + + #endif // #ifdef ENABLE_ASSERTIONS + + /*-****************************************************************************************************//** + @short debug-method to get information about current container content + @descr You can use this method to print informations about the frames in container. + If you call these from top to bottom in the whole tree, you will get a snapshot of the tree. + + @seealso method Desktop::impldbg_printTree() + + @param "nLevel" is the level in tree. The top has level 0, childs of desktop 1 and so on... + @return The collected informations about ouer own container AND subtree as "string-stream". + + @onerror - + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_SERVICEDEBUG // Only active in debug version. + + OUSTRING impldbg_getTreeNames( sal_Int16 nLevel ); + + #endif // #ifdef ENABLE_SERVICEDEBUG + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + protected: + + // But some variables are used in derived classes! + // Make it protected for directly access. + OUSTRING m_sName ; /// name of this frame + REFERENCE< XFRAMESSUPPLIER > m_xParent ; /// parent of this frame + REFERENCE< XDISPATCHPROVIDERINTERCEPTOR > m_xInterceptor ; /// current interceptor for dispatches + REFERENCE< XDISPATCHPROVIDER > m_xDispatchHelper ; /// helper for XDispatchProvider and XDispatch interfaces + REFERENCE< XMULTISERVICEFACTORY > m_xFactory ; /// reference to factory, which has create this instance + REFERENCE< XWINDOW > m_xContainerWindow ; /// containerwindow of this frame for embedded components + sal_Bool m_bRecursiveSearchProtection ; /// protect against recursion while searching in parent frames + FrameContainer m_aChildFrameContainer ; /// array of child frames + + private: + + REFERENCE< XSTATUSINDICATOR > m_xIndicator ; /// reference to current statusindicator + REFERENCE< XWINDOW > m_xComponentWindow ; /// window of the actual component + REFERENCE< XCONTROLLER > m_xController ; /// controller of the actual frame + eACTIVESTATE m_eActiveState ; /// state, if i'am a member of active path in tree or i have the focus or ... + sal_Bool m_bIsFrameTop ; /// frame has no parent or the parent is a taskor the desktop + sal_Bool m_bConnected ; /// due to FrameActionEvent + sal_Bool m_bAlreadyDisposed ; /// protect egainst recursive dispose calls + sal_Bool m_bILoadLastComponent ; /// help flag to find last destination of dispatch(...) in tree! see impl_searchLastLoadedComponent() for further informations + OMULTITYPEINTERFACECONTAINERHELPER m_aListenerContainer ; /// container for ALL Listener + REFERENCE< XFRAMES > m_xFramesHelper ; /// helper for XFrames, XIndexAccess and XElementAccess interfaces + +}; // class Frame + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_FRAME_HXX_ diff --git a/framework/inc/services/frameloaderfactory.hxx b/framework/inc/services/frameloaderfactory.hxx new file mode 100644 index 000000000000..ded4b83dcc96 --- /dev/null +++ b/framework/inc/services/frameloaderfactory.hxx @@ -0,0 +1,500 @@ +/************************************************************************* + * + * $RCSfile: frameloaderfactory.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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 __FRAMEWORK_SERVICES_FRAMELOADERFACTORY_HXX_ +#define __FRAMEWORK_SERVICES_FRAMELOADERFACTORY_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_CLASSES_REGISTRYCACHE_HXX_ +#include <classes/registrycache.hxx> +#endif + +#ifndef __FRAMEWORK_HELPER_OMUTEXMEMBER_HXX_ +#include <helper/omutexmember.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_GENERIC_HXX_ +#include <macros/generic.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_ +#include <macros/debug.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_XINTERFACE_HXX_ +#include <macros/xinterface.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_XTYPEPROVIDER_HXX_ +#include <macros/xtypeprovider.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_XSERVICEINFO_HXX_ +#include <macros/xserviceinfo.hxx> +#endif + +#ifndef __FRAMEWORK_DEFINES_HXX_ +#include <defines.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif + +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ +#include <com/sun/star/beans/PropertyValue.hpp> +#endif + +#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_ +#include <com/sun/star/io/XInputStream.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XFRAMELOADERQUERY_HPP_ +#include <com/sun/star/frame/XFrameLoaderQuery.hpp> +#endif + +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include <com/sun/star/beans/XPropertySet.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +#define ANY ::com::sun::star::uno::Any +#define OWEAKOBJECT ::cppu::OWeakObject +#define PROPERTYVALUE ::com::sun::star::beans::PropertyValue +#define RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException +#define XFRAMELOADERQUERY ::com::sun::star::frame::XFrameLoaderQuery +#define XINPUTSTREAM ::com::sun::star::io::XInputStream +#define XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory +#define XPROPERTYSET ::com::sun::star::beans::XPropertySet +#define XSERVICEINFO ::com::sun::star::lang::XServiceInfo +#define XTYPEPROVIDER ::com::sun::star::lang::XTypeProvider +#define XINTERFACE ::com::sun::star::uno::XInterface + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +struct tIMPLExtractedArguments +{ + OUSTRING sMimeType ; + sal_Int32 nFlags ; + OUSTRING sFilterName ; + sal_Int32 nClipboardFormat ; + OUSTRING sDetectService ; + REFERENCE< XINPUTSTREAM > xInputStream ; + + sal_Int32 nValidMask ; +}; + +/*-************************************************************************************************************//** + @short factory to create frameloader-objects + @descr These class can be used to create new loader for specified contents. + We use cached values of the registry to lay down, wich frameloader match + a given URL or filtername. To do this, we use the XMultiServiceFactory-interface. + + @ATTENTION In a specialmode of these implementation we support a simple filterdetection. + But there is no special interface. You must call some existing methods in another context! + see createInstanceWithArguments() fo rfurther informations! + + @implements XInterface + XTypeProvider + XServiceInfo + XFrameLoaderQuery + XMultiServiceFactory + XDebugging [Exist in debug version only, if ENABLE_SERVICEDEBUG is set!] + @base OMutexMember + OWeakObject + + @devstatus deprecated +*//*-*************************************************************************************************************/ + +//class FrameLoaderFactory : DERIVE_FROM_XSPECIALDEBUGINTERFACE // => These macro will expand to nothing, if no testmode is set in debug.h! +class FrameLoaderFactory : public XTYPEPROVIDER , + public XSERVICEINFO , + public XFRAMELOADERQUERY , + public XMULTISERVICEFACTORY , + public OMutexMember , // Struct for right initalization of mutex member! + public OWEAKOBJECT +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor + @descr Initialize a new instance and fill the registrycache with values. + To do this - xFactory must be valid! + + @seealso class RegistryCache + @seealso member m_aRegistryCache + + @param "xFactory", factory which has created us. + @return - + + @onerror An ASSERTION is thrown in debug version, if xFactory is invalid or cache can't filled. + *//*-*****************************************************************************************************/ + + FrameLoaderFactory( const REFERENCE< XMULTISERVICEFACTORY >& xFactory ); + + /*-****************************************************************************************************//** + @short standard destructor to delete instance + @descr We use it to clear ouer cache. + + @seealso class RegistryCache + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~FrameLoaderFactory(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + //--------------------------------------------------------------------------------------------------------- + + DECLARE_XINTERFACE + DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO +// DECLARE_XSPECIALDEBUGINTERFACE // => These macro will expand to nothing, if no testmode is set in debug.h! + + //--------------------------------------------------------------------------------------------------------- + // XFrameLoaderQuery + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual SEQUENCE< OUSTRING > SAL_CALL getAvailableFilterNames() throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual SEQUENCE< PROPERTYVALUE > SAL_CALL getLoaderProperties( const OUSTRING& sFilterName ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual OUSTRING SAL_CALL searchFilter( const OUSTRING& sURL, const SEQUENCE< PROPERTYVALUE >& seqArguments ) throw( RUNTIMEEXCEPTION ); + + //--------------------------------------------------------------------------------------------------------- + // XMultiServiceFactory + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short create a new frameloder (without arguments!) + @descr We search for an agreement between given servicespecifier and cache-content. + If we found some information, who match the specifier, we create the registered frameloader. + Otherwise - we return NULL. + + @seealso method impl_createFrameLoader() + @seealso method createInstanceWithArguments() + + @param "sServiceSpecifier", specifier/URL or name of searched frameloader. + @return A reference to a new created frameloader. + + @onerror A null reference is returned. + *//*-*****************************************************************************************************/ + + virtual REFERENCE< XINTERFACE > SAL_CALL createInstance( const OUSTRING& sServiceSpecifier ) throw( EXCEPTION , + RUNTIMEEXCEPTION); + + /*-****************************************************************************************************//** + @short create a new frameloder + @descr We search for an agreement between given servicespecifier and cache-content. + If we found some information, who match the specifier, we create the registered frameloader. + Otherwise - we return NULL. + You can give us some optional arguments to initialize the new frameloader. + + @seealso method impl_createFrameLoader() + @seealso method createInstance() + + @param "sServiceSpecifier", specifier/URL or name of searched frameloader. + @param "seqArguments", list of optional arguments for initializing of new frameloader. + @return A reference to a new created frameloader. + + @onerror A null reference is returned. + + @ATTENTION Because of missing filterdetection, we HACK this method and support a SPECIALMODE! + If you call this method with an empty "sServiceSpecifier" and ONE string-argument - a FilterName - + we return a propertyset for access to all informations of these specified filter. + You can get alist of all supported filternames by calling of "getAvailableServiceNames()". + *//*-*****************************************************************************************************/ + + virtual REFERENCE< XINTERFACE > SAL_CALL createInstanceWithArguments( const OUSTRING& sServiceSpecifier , + const SEQUENCE< ANY >& seqArguments ) throw( EXCEPTION , + RUNTIMEEXCEPTION); + + /*-****************************************************************************************************//** + @short not supported yet + @descr - + + @seealso - + + @param - + @return - + + @onerror - + + @ATTENTION Because of missing filterdetection, we HACK this method and support a SPECIALMODE! + You can call these method to get names of all supported filternames for creation of new + frameloader! see "createInstanceWithArguments()" for further informations. + *//*-*****************************************************************************************************/ + + virtual SEQUENCE< OUSTRING > SAL_CALL getAvailableServiceNames() throw( RUNTIMEEXCEPTION ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short search for a frame loader which match given parameter + @descr These method is a helper for interface methods to search a frame loader. + We search in ouer registrycache for matching of different parameters of a registered loader + with given URL. If someone found - we return the index in ouer cache of founded item! + Caller can use these index for faster access. If we return the name of found loader, caller + must search this name again if he wish to have full access to other properties of it! + + @seealso method searchFilter() + @seealso method createInstanceWithArguments() + @seealso class RegistryCache + + @param "sURL", servicespecifier for new frameloader + @param "seqArguments", list of optional parameter for new frameloader + @return The index of found item in cache or INVALID_CACHE_POSITION if no item was found. + + @onerror INVALID_CACHE_POSITION is returned. + *//*-*****************************************************************************************************/ + + sal_uInt32 impl_searchFrameLoader( const OUSTRING& sURL , + const SEQUENCE< PROPERTYVALUE >& seqArguments ); + + /*-****************************************************************************************************//** + @short extract all arguments from given property-sequence, which are important for us + @descr Ouer methods are called with an optional list of arguments - sometimes. + And we must have informations about existing arguments. + This is the reason for this method. They will extract all neccessary arguments from sequence + and collect informations about his values and his valid-state! (exist, non exist, valid ...) + Unknown arguments are ignored! + + @seealso method impl_createFrameLoader() + + @param "seqArguments", list of optional parameter to extract informations. + @return A structure with all informatons about existing arguments in sequence. + + @onerror State flags of values are set to INVALID! + *//*-*****************************************************************************************************/ + + tIMPLExtractedArguments impl_extractArguments( const SEQUENCE< PROPERTYVALUE >& seqArguments ); + + /*-****************************************************************************************************//** + @short ask special detect service of a frameloader for matching with given document parameter + @descr A frameloader CAN register a detect service [with an interface XExtendedFilterDetection] + to check given URL in a special way. He can parse the URL; look in stream or something else. + If he can handle these document, the return value is a valid filtername; an empty name + otherwise. + + @seealso interface XExtendedFilterDetection + @seealso const group DetectState + + @param "sDetectService", implementationname of detect service of frameloader + @param "sURL", URL for loading. + @param "sFilterName", possible filtername of frameloader + @param "seqArguments", list of optional parameter for given URL. + @return A valid filtername is returned. + + @onerror An empty name is returned. + *//*-*****************************************************************************************************/ + OUSTRING impl_extendedDetect( const OUSTRING& sDetectService , + const OUSTRING& sFilterName , + const OUSTRING& sURL , + const SEQUENCE< PROPERTYVALUE >& seqArguments ); + + /*-****************************************************************************************************//** + @short extract the extension of a given URL + @descr We are a uno service and can't use special parse objects to extract informations from an URL. + We make itself with normal string functions! The extension is all below last "." in string + with no "/" before! + + @seealso class InetURLObject (!) + + @param "sURL", URL to extract extension. + @return A extracted extension. + + @onerror An empty string is returned. + *//*-*****************************************************************************************************/ + + OUSTRING impl_getExtensionFromURL( const OUSTRING& sURL ); + + //------------------------------------------------------------------------------------------------------------- + // debug methods + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short debug-method to check incoming parameter of some other mehods of this class + @descr The following methods are used to check parameters for other methods + of this class. The return value is used directly for an ASSERT(...). + + @seealso ASSERTs in implementation! + + @param references to checking variables + @return sal_False ,on invalid parameter + @return sal_True ,otherwise + + @onerror - + *//*-*****************************************************************************************************/ + + + #ifdef ENABLE_ASSERTIONS + + private: + + sal_Bool impldbg_checkParameter_getLoaderProperties ( const OUSTRING& sFilterName ); + sal_Bool impldbg_checkParameter_searchFilter ( const OUSTRING& sURL , + const SEQUENCE< PROPERTYVALUE >& seqArguments ); + sal_Bool impldbg_checkParameter_FrameLoaderFactoryCtor ( const REFERENCE< XMULTISERVICEFACTORY >& xFactory ); + sal_Bool impldbg_checkParameter_createInstanceWithArguments ( const OUSTRING& sServiceSpecifier , + const SEQUENCE< ANY >& seqArguments ); + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // private variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + REFERENCE< XMULTISERVICEFACTORY > m_xFactory ; + RegistryCache m_aRegistryCache ; + +}; // class FrameLoaderFactory + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_FRAMELOADERFACTORY_HXX_ diff --git a/framework/inc/services/task.hxx b/framework/inc/services/task.hxx new file mode 100644 index 000000000000..d0a7eb4b2990 --- /dev/null +++ b/framework/inc/services/task.hxx @@ -0,0 +1,756 @@ +/************************************************************************* + * + * $RCSfile: task.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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 __FRAMEWORK_SERVICES_TASK_HXX_ +#define __FRAMEWORK_SERVICES_TASK_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_SERVICES_FRAME_HXX_ +#include <services/frame.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_GENERIC_HXX_ +#include <macros/generic.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_ +#include <macros/debug.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_XINTERFACE_HXX_ +#include <macros/xinterface.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_XTYPEPROVIDER_HXX_ +#include <macros/xtypeprovider.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_XSERVICEINFO_HXX_ +#include <macros/xserviceinfo.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_FRAME_XTASK_HPP_ +#include <com/sun/star/frame/XTask.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_POINT_HPP_ +#include <com/sun/star/awt/Point.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_SIZE_HPP_ +#include <com/sun/star/awt/Size.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +#ifndef _CPPUHELPER_PROPSHLP_HXX +#include <cppuhelper/propshlp.hxx> +#endif + +#include <tools/link.hxx> +#include <vcl/evntpost.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +#define ILLEGALARGUMENTEXCEPTION ::com::sun::star::lang::IllegalArgumentException +#define IPROPERTYARRAYHELPER ::cppu::IPropertyArrayHelper +#define OBROADCASTHELPER ::cppu::OBroadcastHelper +#define OPROPERTYSETHELPER ::cppu::OPropertySetHelper +#define PROPERTY ::com::sun::star::beans::Property +#define UNOPOINT ::com::sun::star::awt::Point +#define UNOSIZE ::com::sun::star::awt::Size +#define XPROPERTYSETINFO ::com::sun::star::beans::XPropertySetInfo +#define XTASK ::com::sun::star::frame::XTask +#define RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException +#define EXCEPTION ::com::sun::star::uno::Exception + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implements an special frame - a task frame + + @descr - + + @implements XTask + + @base Frame + OPropertySet +*//*-*************************************************************************************************************/ + +class Task : public XTASK , // => XFrame => XComponent + public Frame , // Order of baseclasses is neccessary for right initialization! + public OBROADCASTHELPER , + public OPROPERTYSETHELPER +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor to create instance + + @descr This constructor initialize a new instance of this class, + and will be set valid values on his member and baseclasses. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + Task( const REFERENCE< XMULTISERVICEFACTORY >& xFactory ); + + /*-****************************************************************************************************//** + @short standard destructor + + @descr This method destruct an instance of this class and clear some member. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~Task(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + //--------------------------------------------------------------------------------------------------------- + + DECLARE_XINTERFACE + DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------------------------------------------- + // XTask + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL close() throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL tileWindows() throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL arrangeWindowsVertical() throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL arrangeWindowsHorizontal() throw( RUNTIMEEXCEPTION ); + + //--------------------------------------------------------------------------------------------------------- + // XComponent + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + + @descr We must overwrite this method, because baseclass Frame implements XFrame and XComponent. + XTask is derived from these classes to! The compiler don't know, which base is the right one. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL dispose() throw( RUNTIMEEXCEPTION ) + { + Frame::dispose(); + } + + /*-*******************************************************************************************************/ + virtual void SAL_CALL addEventListener( const REFERENCE< XEVENTLISTENER >& xListener ) throw( RUNTIMEEXCEPTION ) + { + Frame::addEventListener( xListener ); + } + + /*-*******************************************************************************************************/ + virtual void SAL_CALL removeEventListener( const REFERENCE< XEVENTLISTENER >& xListener ) throw( RUNTIMEEXCEPTION ) + { + Frame::removeEventListener( xListener ); + } + + //--------------------------------------------------------------------------------------------------------- + // XFrame + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + + @descr We must overwrite this method, because baseclass Frame implements XFrame and XComponent. + XTask is derived from these classes to! The compiler don't know, which base is right. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL initialize( const REFERENCE< XWINDOW >& xWindow ) throw( RUNTIMEEXCEPTION ) + { + Frame::initialize( xWindow ); + } + + /*-*******************************************************************************************************/ + virtual REFERENCE< XWINDOW > SAL_CALL getContainerWindow() throw( RUNTIMEEXCEPTION ) + { + return Frame::getContainerWindow(); + } + + /*-****************************************************************************************************/ + virtual void SAL_CALL setCreator( const REFERENCE< XFRAMESSUPPLIER >& xCreator ) throw( RUNTIMEEXCEPTION ) + { + Frame::setCreator( xCreator ); + } + + /*-****************************************************************************************************/ + virtual REFERENCE< XFRAMESSUPPLIER > SAL_CALL getCreator() throw( RUNTIMEEXCEPTION ) + { + return Frame::getCreator(); + } + + /*-****************************************************************************************************/ + virtual OUSTRING SAL_CALL getName() throw( RUNTIMEEXCEPTION ) + { + return Frame::getName(); + } + + /*-****************************************************************************************************/ + virtual void SAL_CALL setName( const OUSTRING& sName ) throw( RUNTIMEEXCEPTION ) + { + Frame::setName( sName ); + } + + /*-*******************************************************************************************************/ + virtual sal_Bool SAL_CALL isTop() throw( RUNTIMEEXCEPTION ) + { + return Frame::isTop(); + } + + /*-*******************************************************************************************************/ + virtual void SAL_CALL activate() throw( RUNTIMEEXCEPTION ) + { + Frame::activate(); + } + + /*-*******************************************************************************************************/ + virtual void SAL_CALL deactivate() throw( RUNTIMEEXCEPTION ) + { + Frame::deactivate(); + } + + /*-*******************************************************************************************************/ + virtual sal_Bool SAL_CALL isActive() throw( RUNTIMEEXCEPTION ) + { + return Frame::isActive(); + } + + /*-*******************************************************************************************************/ + virtual sal_Bool SAL_CALL setComponent( const REFERENCE< XWINDOW >& xComponentWindow , + const REFERENCE< XCONTROLLER >& xController ) throw( RUNTIMEEXCEPTION ) + { + return Frame::setComponent( xComponentWindow, xController ); + } + + /*-*******************************************************************************************************/ + virtual REFERENCE< XWINDOW > SAL_CALL getComponentWindow() throw( RUNTIMEEXCEPTION ) + { + return Frame::getComponentWindow(); + } + + /*-*******************************************************************************************************/ + virtual REFERENCE< XCONTROLLER > SAL_CALL getController() throw( RUNTIMEEXCEPTION ) + { + return Frame::getController(); + } + + /*-*******************************************************************************************************/ + virtual void SAL_CALL contextChanged() throw( RUNTIMEEXCEPTION ) + { + Frame::contextChanged(); + } + + /*-*******************************************************************************************************/ + virtual void SAL_CALL addFrameActionListener( const REFERENCE< XFRAMEACTIONLISTENER >& xListener ) throw( RUNTIMEEXCEPTION ) + { + Frame::addFrameActionListener( xListener ); + } + + /*-*******************************************************************************************************/ + virtual void SAL_CALL removeFrameActionListener( const REFERENCE< XFRAMEACTIONLISTENER >& xListener ) throw( RUNTIMEEXCEPTION ) + { + Frame::removeFrameActionListener( xListener ); + } + + /*-****************************************************************************************************//** + @short - + + @descr This method searches for a frame with the specified name. + Frames may contain other frames (e.g. a frameset) and may + be contained in other frames. This hierarchie ist searched by + this method. + First some special names are taken into account, i.e. "", + "_self", "_top", "_active" etc. The FrameSearchFlags are ignored + when comparing these names with aTargetFrameName, further steps are + controlled by the FrameSearchFlags. If allowed, the name of the frame + itself is compared with the desired one, then ( again if allowed ) + the method findFrame is called for all children of the frame. + At last findFrame may be called for the parent frame ( if allowed ). + If no Frame with the given name is found until the top frames container, + a new top Frame is created, if this is allowed by a special + FrameSearchFlag. The new Frame also gets the desired name. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual REFERENCE< XFRAME > SAL_CALL findFrame( const OUSTRING& sTargetFrameName , + sal_Int32 nSearchFlags ) throw( RUNTIMEEXCEPTION ); + + //--------------------------------------------------------------------------------------------------------- + // XTopWindowListener + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL windowClosing( const EVENTOBJECT& aEvent ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL windowActivated( const EVENTOBJECT& aEvent ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL windowDeactivated( const EVENTOBJECT& aEvent ) throw( RUNTIMEEXCEPTION ); + + //--------------------------------------------------------------------------------------------------------- + // XEventListener + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + + @descr This object is forced to release all references to the interfaces given + by the parameter Source. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL disposing( const EVENTOBJECT& aEvent ) throw( RUNTIMEEXCEPTION ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + //--------------------------------------------------------------------------- + // OPropertySetHelper + //--------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short try to convert a property value + @descr This method is calling from helperclass "OPropertySetHelper". + Don't use this directly! + You must try to convert the value of given propertyhandle and + return results of this operation. This will be use to ask vetoable + listener. If no listener have a veto, we will change value realy! + ( in method setFastPropertyValue_NoBroadcast(...) ) + + @seealso OPropertySetHelper + @seealso setFastPropertyValue_NoBroadcast() + + @param "aConvertedValue" new converted value of property + @param "aOldValue" old value of property + @param "nHandle" handle of property + @param "aValue" new value of property + + @return sal_True if value will be changed, sal_FALSE otherway + + @onerror IllegalArgumentException, if you call this with an invalid argument + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL convertFastPropertyValue( ANY& aConvertedValue , + ANY& aOldValue , + sal_Int32 nHandle , + const ANY& aValue ) throw( ILLEGALARGUMENTEXCEPTION ); + + /*-****************************************************************************************************//** + @short set value of a transient property + @descr This method is calling from helperclass "OPropertySetHelper". + Don't use this directly! + Handle and value are valid everyway! You must set the new value only. + After this, baseclass send messages to all listener automaticly. + + @seealso OPropertySetHelper + + @param "nHandle" handle of property to change + @param "aValue" new value of property + + @return - + + @onerror An exception is thrown. + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , + const ANY& aValue ) throw( EXCEPTION ); + + /*-****************************************************************************************************//** + @short get value of a transient property + @descr This method is calling from helperclass "OPropertySetHelper". + Don't use this directly! + + @seealso OPropertySetHelper + + @param "nHandle" handle of property to change + @param "aValue" current value of property + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL getFastPropertyValue( ANY& aValue , + sal_Int32 nHandle ) const; + + /*-****************************************************************************************************//** + @short return structure and information about transient properties + @descr This method is calling from helperclass "OPropertySetHelper". + Don't use this directly! + + @seealso OPropertySetHelper + + @param - + + @return structure with property-informations + + @onerror - + *//*-*****************************************************************************************************/ + + virtual IPROPERTYARRAYHELPER& SAL_CALL getInfoHelper(); + + /*-****************************************************************************************************//** + @short return propertysetinfo + @descr You can call this method to get information about transient properties + of this object. + + @seealso OPropertySetHelper + @seealso XPropertySet + @seealso XMultiPropertySet + + @param - + + @return reference to object with information [XPropertySetInfo] + + @onerror - + *//*-*****************************************************************************************************/ + + virtual REFERENCE< XPROPERTYSETINFO > SAL_CALL getPropertySetInfo(); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + DECL_LINK( Close_Impl, void* ); + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + sal_Bool impl_tryToChangeProperty( sal_Bool bProperty , + const ANY& aValue , + ANY& aOldValue , + ANY& aConvertedValue ) throw( ILLEGALARGUMENTEXCEPTION ); + sal_Bool impl_tryToChangeProperty( const OUSTRING& sProperty , + const ANY& aValue , + ANY& aOldValue , + ANY& aConvertedValue ) throw( ILLEGALARGUMENTEXCEPTION ); + sal_Bool impl_tryToChangeProperty( const UNOPOINT& aProperty , + const ANY& aValue , + ANY& aOldValue , + ANY& aConvertedValue ) throw( ILLEGALARGUMENTEXCEPTION ); + sal_Bool impl_tryToChangeProperty( const UNOSIZE& aProperty , + const ANY& aValue , + ANY& aOldValue , + ANY& aConvertedValue ) throw( ILLEGALARGUMENTEXCEPTION ); + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + static const SEQUENCE< PROPERTY > impl_getStaticPropertyDescriptor(); + + //------------------------------------------------------------------------------------------------------------- + // debug methods + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short debug-method to check incoming parameter of some other mehods of this class + @descr The following methods are used to check parameters for other methods + of this class. The return value is used directly for an ASSERT(...). + + @seealso ASSERTs in implementation! + + @param references to checking variables + @return sal_False on invalid parameter<BR> + sal_True otherway + + @onerror - + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + private: + + // Not used in the moment! + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + protected: + + // But some values are neede by derived classes! + sal_Bool m_bIsPlugIn ; /// In objects of these class this member is set to FALSE. + /// But in derived class PlugInFrame it's overwrited with TRUE! + + private: + + // Properties + sal_Bool m_bIsAlwaysVisible ; + sal_Bool m_bIsFloating ; + UNOPOINT m_aPosition ; + UNOSIZE m_aSize ; + OUSTRING m_sTitle ; + ::vcl::EventPoster m_aPoster ; + +}; // class Tasks + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_TASKS_HXX_ diff --git a/framework/prj/d.lst b/framework/prj/d.lst new file mode 100644 index 000000000000..a93c4f143295 --- /dev/null +++ b/framework/prj/d.lst @@ -0,0 +1,6 @@ +mkdir: %_DEST%\inc%_EXT%\framework + +..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\* +..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\* +..\%__SRC%\bin\*.exe %_DEST%\bin%_EXT%\* +..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\* diff --git a/framework/source/application/framework.cxx b/framework/source/application/framework.cxx new file mode 100644 index 000000000000..8c2ed764700b --- /dev/null +++ b/framework/source/application/framework.cxx @@ -0,0 +1,383 @@ +/************************************************************************* + * + * $RCSfile: framework.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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): _______________________________________ + * + * + ************************************************************************/ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_HELPER_OPIPECONNECTION_HXX_ +#include <helper/opipeconnection.hxx> +#endif + +#ifndef __FRAMEWORK_HELPER_OINSTANCEPROVIDER_HXX_ +#include <helper/oinstanceprovider.hxx> +#endif + +#ifndef __FRAMEWORK_CLASSES_SERVICEMANAGER_HXX_ +#include <classes/servicemanager.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_ +#include <macros/debug.hxx> +#endif + +#ifndef __FRAMEWORK_DEFINES_HXX_ +#include <defines.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_FRAME_XDESKTOP_HPP_ +#include <com/sun/star/frame/XDesktop.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_ +#include <com/sun/star/frame/XFrame.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_ +#include <com/sun/star/awt/XWindow.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XFRAMELOADER_HPP_ +#include <com/sun/star/frame/XFrameLoader.hpp> +#endif + +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ +#include <com/sun/star/beans/PropertyValue.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XLOADEVENTLISTENER_HPP_ +#include <com/sun/star/frame/XLoadEventListener.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDER_HPP_ +#include <com/sun/star/frame/XDispatchProvider.hpp> +#endif + +#ifndef _COM_SUN_STAR_UTIL_URL_HPP_ +#include <com/sun/star/util/URL.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HPP_ +#include <com/sun/star/frame/FrameSearchFlag.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XFRAMES_HPP_ +#include <com/sun/star/frame/XFrames.hpp> +#endif + +#ifndef _COM_SUN_STAR_CONNECTION_XConnection_HPP_ +#include <com/sun/star/connection/XConnection.hpp> +#endif + +#ifndef _COM_SUN_STAR_BRIDGE_XBridgeFactory_HPP_ +#include <com/sun/star/bridge/XBridgeFactory.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_ +#include <unotools/processfactory.hxx> +#endif + +#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_ +#include <com/sun/star/uno/Reference.h> +#endif + +#ifndef _RTL_USTRING_ +#include <rtl/ustring> +#endif + +#ifndef _RTL_USTRBUF_HXX_ +#include <rtl/ustrbuf.hxx> +#endif + +#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ +#include <toolkit/helper/vclunohelper.hxx> +#endif + +#ifndef _SVT_UNOIFACE_HXX +#include <svtools/unoiface.hxx> +#endif + +#ifndef _SV_SVAPP_HXX +#include <vcl/svapp.hxx> +#endif + +#ifndef _SV_WRKWIN_HXX +#include <vcl/wrkwin.hxx> +#endif + +#ifndef _VOS_PROCESS_HXX_ +#include <vos/process.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +using namespace ::rtl ; +using namespace ::vos ; +using namespace ::utl ; +using namespace ::framework ; +using namespace ::com::sun::star::uno ; +using namespace ::com::sun::star::lang ; +using namespace ::com::sun::star::frame ; +using namespace ::com::sun::star::awt ; +using namespace ::com::sun::star::beans ; +using namespace ::com::sun::star::util ; +using namespace ::com::sun::star::connection ; +using namespace ::com::sun::star::bridge ; + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +#define APPLICATIONNAME "FrameWork" +#define COMMANDARGUMENT_PLUGIN DECLARE_ASCII("-plugin" ) +#define NAME_PLUGINBRIDGE DECLARE_ASCII("mozilla plugin bridge" ) +#define PROTOCOL_PLUGINBRIDGE DECLARE_ASCII("urp" ) + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short normal application + @descr An instance of these class can be a normal node in frame tree only. The highest level to be allowed is 3! + On 1 stand the desktop himself as the only one, on 2 are all tasks present ... and then comes frames only. + A frame support influencing of his subtree, find of subframes, activate- and deactivate-mechanism as well as + set/get of a frame window, component or controller. + + @implements XInterface + XTypeProvider + XServiceInfo + XFramesSupplier + XFrame + XComponent + XStatusIndicatorSupplier + XDispatchProvider + XDispatchProviderInterception + XBrowseHistoryRegistry + XLoadEventListener + XEventListener + XWindowListener + XTopWindowListener + [ XDebugging, if TEST_TREE is defined! ] + @base OMutexMember + OWeakObject + + @devstatus deprecated +*//*-*************************************************************************************************************/ +class FrameWork : public Application +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + void Main(); + + private: + void impl_analyzeCommandArguments(); + + private: + sal_Bool m_bUsePlugIn ; + +}; // class FrameWork + +//_________________________________________________________________________________________________________________ +// definitions +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// global variables +//_________________________________________________________________________________________________________________ + +FrameWork aFrameWork ; + +//_________________________________________________________________________________________________________________ +// definitions +//_________________________________________________________________________________________________________________ + +//***************************************************************************************************************** +// private methods +//***************************************************************************************************************** +void FrameWork::impl_analyzeCommandArguments() +{ + // First reset all member variables which present states of incoming arguments! + m_bUsePlugIn = sal_False; // depends from "/plugin" + + // Then step over all given arguments and search for supported one. + OStartupInfo aInfo ; + OUString sArgument ; + sal_uInt32 nCount = aInfo.getCommandArgCount(); + for ( sal_uInt32 nArgument=0; nArgument<nCount; ++nArgument ) + { + // If extraction of current argument successfull ... + if ( aInfo.getCommandArg( nArgument, sArgument ) == osl_Process_E_None ) + { + // ... search for matching with supported values. + if ( sArgument == COMMANDARGUMENT_PLUGIN ) + { + // We found "/plugin" => set internal equivalent. + m_bUsePlugIn = sal_True; + } + } + } +} + +//_________________________________________________________________________________________________________________ +// main +//_________________________________________________________________________________________________________________ + +void FrameWork::Main() +{ + //------------------------------------------------------------------------------------------------------------- + // a) Initialize ouer application + + // Analyze command arguments. + impl_analyzeCommandArguments(); + + // Create new global servicemanager. + ServiceManager aManager; + Reference< XMultiServiceFactory > xGlobalServiceManager = aManager.getManager(); + + if ( xGlobalServiceManager.is() == sal_True ) + { + // If it was successful - set in as static value in UNOTOOLS! + setProcessServiceFactory( xGlobalServiceManager ); + // Initialize toolkit. + InitExtVclToolkit(); + + //--------------------------------------------------------------------------------------------------------- + // b) Create root of ouer frame tree + + // Create top of frame hierarchy - the desktop. + Reference< XDesktop > xDesktop( xGlobalServiceManager->createInstance( SERVICENAME_DESKTOP ), UNO_QUERY ); + // Safe impossible cases + // We need the desktop for working. + LOG_ASSERT( !(xDesktop.is()==sal_False), "FrameWork::Main()\nCan't instanciate desktop!Servicename unknown?\n" ) + + //--------------------------------------------------------------------------------------------------------- + // c) Initialize connection to possible PlugIn dll. + if ( m_bUsePlugIn == sal_True ) + { + Reference< XConnection > xConnection = new OPipeConnection( xGlobalServiceManager ); + Reference< XBridgeFactory > xBridgeFactory ( xGlobalServiceManager->createInstance( SERVICENAME_BRIDGEFACTORY ), UNO_QUERY ); + if ( + ( xConnection.is() == sal_True ) && + ( xBridgeFactory.is() == sal_True ) + ) + { + Reference< XBridge > xBridge = xBridgeFactory->createBridge( NAME_PLUGINBRIDGE , + PROTOCOL_PLUGINBRIDGE , + xConnection , + new OInstanceProvider( xGlobalServiceManager ) ); + } + else + { + // Error handling ... !? + LOG_ASSERT( sal_False, "FrameWork::Main()\nNo connection to plugin. Initialization of bridge failed.\n" ) + } + } + + //--------------------------------------------------------------------------------------------------------- + // d) Initialize new task with a HTML-URL in it. + + // Cast desktop to right interface to do this. + Reference< XDispatchProvider > xDispatchProvider( xDesktop, UNO_QUERY ); + // Safe impossible cases. + // Desktop MUST support these interface! + LOG_ASSERT( !(xDispatchProvider.is()==sal_False), "FrameWork::Main()\nDesktop don't support XDispatchProvider interface.\n" ) + if ( xDispatchProvider.is() == sal_True ) + { + // Build URL ... + OUString sURL( RTL_CONSTASCII_USTRINGPARAM( "file://e|/dokumentation/Documentation/projekte/services/inimanager/inimanager/index.html" )); + URL aURL; + aURL.Complete = sURL; + // ... and dispatch it. + Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch( aURL, FRAMETYPE_BLANK, 0 ); + xDispatch->dispatch( aURL, Sequence< PropertyValue >() ); + + // Use special feature of desktop service and log current tree state in file. +// LOG_TREE( xDesktop ) + + // Build URL ... + sURL = OUString( RTL_CONSTASCII_USTRINGPARAM( "file://d|/menu.htm" )); + aURL.Complete = sURL; + // ... and dispatch it. + xDispatch = xDispatchProvider->queryDispatch( aURL, FRAMETYPE_BLANK, 0 ); + xDispatch->dispatch( aURL, Sequence< PropertyValue >() ); + + // Use special feature of desktop service and log current tree state in file. +// LOG_TREE( xDesktop ) + } + + // Set running-mode for application. + Execute(); + } +} diff --git a/framework/source/application/makefile.mk b/framework/source/application/makefile.mk new file mode 100644 index 000000000000..b5b460ce867f --- /dev/null +++ b/framework/source/application/makefile.mk @@ -0,0 +1,123 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:29: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=..$/.. + +PRJNAME= framework +TARGET= framework +LIBTARGET= NO +ENABLE_EXCEPTIONS= TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Files -------------------------------------------------------- + +SLOFILES= $(SLO)$/framework.obj + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + +# ------------------------------------------------------------------ +# Windows +# ------------------------------------------------------------------ + +.IF "$(GUI)" == "WIN" + +$(MISC)$/$(TARGET).def: makefile + echo NAME $(TARGET) >$@ + echo DESCRIPTION 'Framework - Testprogramm' >>$@ + echo EXETYPE WINDOWS >>$@ + echo STUB 'winSTUB.EXE' >>$@ + echo PROTMODE >>$@ + echo CODE PRELOAD MOVEABLE DISCARDABLE >>$@ + echo DATA PRELOAD MOVEABLE MULTIPLE >>$@ + echo HEAPSIZE 8192 >>$@ + echo STACKSIZE 32768 >>$@ + +.ENDIF +# +## ------------------------------------------------------------------ +## OS2 +## ------------------------------------------------------------------ +# +#.IF "$(GUI)" == "OS2" +# +#$(MISC)$/$(TARGET).def: makefile +# echo NAME $(TARGET) WINDOWAPI >$@ +# echo DESCRIPTION 'Framework - Testprogramm' >>$@ +#.IF "$(COM)" != "BLC" +# echo STUB 'os2STUB.EXE' >>$@ +#.ENDIF +#.IF "$(COM)"!="MTW" +# echo EXETYPE OS2 >>$@ +#.ENDIF +# echo PROTMODE >>$@ +# echo CODE LOADONCALL >>$@ +# echo DATA PRELOAD MULTIPLE >>$@ +# echo HEAPSIZE 16384 >>$@ +# echo STACKSIZE 32768 >>$@ +# +#.ENDIF diff --git a/framework/source/classes/framecontainer.cxx b/framework/source/classes/framecontainer.cxx new file mode 100644 index 000000000000..f5fac6b9ff6e --- /dev/null +++ b/framework/source/classes/framecontainer.cxx @@ -0,0 +1,455 @@ +/************************************************************************* + * + * $RCSfile: framecontainer.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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): _______________________________________ + * + * + ************************************************************************/ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_FRAMECONTAINER_HXX_ +#include <classes/framecontainer.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +using namespace ::std ; +using namespace ::com::sun::star::uno ; +using namespace ::com::sun::star::frame ; + +//_________________________________________________________________________________________________________________ +// non exported const +//_________________________________________________________________________________________________________________ + +#define LOCK_OFF sal_False +#define LOCK_ON sal_True + +//_________________________________________________________________________________________________________________ +// non exported definitions +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +FrameContainer::FrameContainer() + : m_bLock ( LOCK_OFF ) +{ +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +FrameContainer::~FrameContainer() +{ + // Don't forget to free memory! + clear(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void FrameContainer::append( const Reference< XFrame >& xFrame ) +{ + // Safe impossible cases + // This method is not defined for ALL incoming parameters! + LOG_ASSERT( impldbg_checkParameter_append( xFrame ), "FrameContainer::append()\nInvalid parameter detected!\n" ) + // Warn programmer at already existing elements in container. + LOG_ASSERT( !(exist(xFrame)==sal_True), "FrameContainer::append()\nNew frame already exist in container!\n" ) + + // Work only, if container not locked! + if ( m_bLock == LOCK_OFF ) + { + // Append new frame to container. + m_aContainer.push_back( xFrame ); + } + // Else; Warn programmer. + LOG_ASSERT( !(m_bLock==LOCK_ON), "FrameContainer::append()\nContainer is locked! You can't append frame.\n" ) +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void FrameContainer::remove( const Reference< XFrame >& xFrame ) +{ + // Safe impossible cases + // This method is not defined for ALL incoming parameters! + LOG_ASSERT( impldbg_checkParameter_remove( xFrame ), "FrameContainer::remove()\nInvalid parameter detected!\n" ) + // Warn programmer at non existing elements in container. + LOG_ASSERT( !(exist(xFrame)==sal_False), "FrameContainer::append()\nFrame to remove not exist in container!\n" ) + + // Work only, if container not locked! + if ( m_bLock == LOCK_OFF ) + { + // Search frame and remove it from container ... + vector< Reference< XFrame > >::iterator aSearchedItem = find( m_aContainer.begin(), m_aContainer.end(), xFrame ); + // ... if it exist. + if ( aSearchedItem != m_aContainer.end() ) + { + m_aContainer.erase( aSearchedItem ); + // And if removed frame the current active frame - reset state variable. + if ( m_xActiveFrame == xFrame ) + { + m_xActiveFrame = Reference< XFrame >(); + } + } + } + // Else; Warn programmer. + LOG_ASSERT( !(m_bLock==LOCK_ON), "FrameContainer::remove()\nContainer is locked! You can't remove frame.\n" ) +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool FrameContainer::exist( const REFERENCE< XFRAME >& xFrame ) +{ + // Safe impossible cases + // This method is not defined for ALL incoming parameters! + LOG_ASSERT( impldbg_checkParameter_exist( xFrame ), "FrameContainer::exist()\nInvalid parameter detected!\n" ) + + // Set default return value. + sal_Bool bExist = sal_False; + + // We ignore the lock, because we do not change the content of container! + // Search frame. + vector< Reference< XFrame > >::iterator aSearchedItem = find( m_aContainer.begin(), m_aContainer.end(), xFrame ); + // If it exist ... + if ( aSearchedItem != m_aContainer.end() ) + { + // Set new return value. + bExist = sal_True; + } + // Return result of this operation. + return bExist; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void FrameContainer::clear() +{ + // This method is only allowed, if no lock is set! + // Warn programmer, if its not true. + LOG_ASSERT( !(m_bLock==LOCK_ON), "FrameContainer::clear()\nContainer is locked! You can't clear it.\n" ) + if ( m_bLock == LOCK_OFF ) + { + // Clear the container ... + m_aContainer.clear(); + // ... and don't forget to reset the active frame. + // Its an reference to a valid container-item. + // But no container item => no active frame! + m_xActiveFrame = Reference< XFrame >(); + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void FrameContainer::lock() +{ + // Lock the container and block all append(), remove() and clear() calls. + m_bLock = LOCK_ON; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void FrameContainer::unlock() +{ + // Unlock the container and block all getCount() and operator[] calls. + m_bLock = LOCK_OFF; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_uInt32 FrameContainer::getCount() const +{ + // Return size of current container. + // We ignore the lock, because you can ask for count of container elements ... + // but if you will have full index access you must lock it! + return (sal_uInt32)m_aContainer.size(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +Reference< XFrame > FrameContainer::operator[]( sal_uInt32 nIndex ) const +{ + // Safe impossible cases + // This method is not defined for ALL incoming parameters! + LOG_ASSERT( impldbg_checkParameter_IndexOperator( nIndex ), "FrameContainer::operator[]()\nInvalid parameter detected!\n" ) + + // Set default return value. + Reference< XFrame > xFrame; + + // This operation is allowed only, if lock is set. + // Warn programmer, if this not true. + LOG_ASSERT( !(m_bLock==LOCK_OFF), "FrameContainer::operator[]()\nContainer is not locked! You can't do this.\n" ) + + if ( m_bLock == LOCK_ON ) + { + try + { + // Get element form container WITH automatic test of ranges! + // If index not valid, a out_of_range exception is thrown. + xFrame = m_aContainer.at( nIndex ); + } + catch( out_of_range& ) + { + // The index is not valid for current container-content ... + // ... but we must handle this case! + // We return a NULL reference. + xFrame = Reference< XFrame >(); + } + } + + // Return result of this operation. + return xFrame; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +Sequence< Reference< XFrame > > FrameContainer::getAllElements() +{ + // Lock the container for this method. + // Nobody should append or remove anything between creation of snapshot. + // But - don't forget to unlock the container. + m_bLock = LOCK_ON; + + // Get memory for return sequence. + sal_uInt32 nCount = (sal_uInt32)m_aContainer.size(); + Sequence< Reference< XFrame > > seqReturn( nCount ); + + // Copy from container to return list. + Reference< XFrame >* pArray = seqReturn.getArray(); + for ( sal_uInt32 nPosition=0; nPosition<nCount; ++nPosition ) + { + pArray[nPosition] = m_aContainer[nPosition]; + } + + // Don't forget this! + m_bLock = LOCK_OFF; + + // Return result of this operation. + return seqReturn; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool FrameContainer::hasElements() const +{ + // Has container some elements? + return ( m_aContainer.size() > 0 ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void FrameContainer::setActive( const Reference< XFrame >& xFrame ) +{ + // Safe impossible cases + // This method is not defined for ALL incoming parameters! + // BUT we accept null refrences for reset active state. => No frame is active then. + LOG_ASSERT( impldbg_checkParameter_setActive( xFrame ), "FrameContainer::setActive()\nInvalid parameter detected!\n" ) + // The new active frame MUST exist in container. + // Control this. + LOG_ASSERT( !(xFrame.is()==sal_True && exist(xFrame)==sal_False), "FrameContainer::setActive()\nThe new active frame is not a member of current container!You cant activate it.\n" ) + + // All incoming parameters are controlled. + // We have a new active frame or a null reference to reset this state. + // Actualize member. + m_xActiveFrame = xFrame; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +Reference< XFrame > FrameContainer::getActive() const +{ + // Return member. + // The correct state of this variable we have controlled in setActive()! + // But we accept null reference for these variable. => There is no active frame in the moment. + return m_xActiveFrame; +} + +//_________________________________________________________________________________________________________________ +// debug methods +//_________________________________________________________________________________________________________________ + +/*----------------------------------------------------------------------------------------------------------------- + The follow methods checks the parameter for other functions. If a parameter or his value is non valid, + we return "sal_False". (else sal_True) This mechanism is used to throw an ASSERT! + + ATTENTION + + If you miss a test for one of this parameters, contact the autor or add it himself !(?) + But ... look for right testing! See using of this methods! +-----------------------------------------------------------------------------------------------------------------*/ + +#ifdef ENABLE_ASSERTIONS + +//***************************************************************************************************************** +// We accept valid references for working with container only. +sal_Bool FrameContainer::impldbg_checkParameter_append( const Reference< XFrame >& xFrame ) const +{ + // Set default return value. + sal_Bool bOK = sal_True; + // Check parameter. + if ( + ( &xFrame == NULL ) || + ( xFrame.is() == sal_False ) + ) + { + bOK = sal_False ; + } + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +// We accept valid references for working with container only. +sal_Bool FrameContainer::impldbg_checkParameter_remove( const Reference< XFrame >& xFrame ) const +{ + // Set default return value. + sal_Bool bOK = sal_True; + // Check parameter. + if ( + ( &xFrame == NULL ) || + ( xFrame.is() == sal_False ) + ) + { + bOK = sal_False ; + } + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +// We accept valid references for working with container only. +sal_Bool FrameContainer::impldbg_checkParameter_exist( const Reference< XFrame >& xFrame ) const +{ + // Set default return value. + sal_Bool bOK = sal_True; + // Check parameter. + if ( + ( &xFrame == NULL ) || + ( xFrame.is() == sal_False ) + ) + { + bOK = sal_False ; + } + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +// The index in to the container must be in range of 0 and count-1! +sal_Bool FrameContainer::impldbg_checkParameter_IndexOperator( sal_uInt32 nIndex ) const +{ + // Set default return value. + sal_Bool bOK = sal_True; + // Check parameter. + if ( + ( nIndex >= (sal_uInt32)m_aContainer.size() ) + ) + { + bOK = sal_False ; + } + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +// setActive accept valid- or null-reference but no null-pointer! +sal_Bool FrameContainer::impldbg_checkParameter_setActive( const Reference< XFrame >& xFrame ) const +{ + // Set default return value. + sal_Bool bOK = sal_True; + // Check parameter. + if ( + ( &xFrame == NULL ) + ) + { + bOK = sal_False ; + } + // Return result of check. + return bOK ; +} + +#endif // #ifdef ENABLE_ASSERTIONS + +} // namespace framework diff --git a/framework/source/classes/makefile.mk b/framework/source/classes/makefile.mk new file mode 100644 index 000000000000..f9a59a83677c --- /dev/null +++ b/framework/source/classes/makefile.mk @@ -0,0 +1,87 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:29: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): _______________________________________ +# +# +# +#************************************************************************* +PRJ=..$/.. + +PRJNAME= framework +TARGET= fwk_classes +USE_DEFFILE= TRUE +NO_BSYMBOLIC= TRUE +ENABLE_EXCEPTIONS= TRUE +BOOTSTRAP_SERVICE= FALSE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Generate ----------------------------------------------------- + +SLOFILES= $(SLO)$/servicemanager.obj \ + $(SLO)$/registrycache.obj \ + $(SLO)$/wildcard.obj \ + $(SLO)$/framecontainer.obj \ + $(SLO)$/taskcreator.obj + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/framework/source/classes/taskcreator.cxx b/framework/source/classes/taskcreator.cxx new file mode 100644 index 000000000000..05b6c4545cc8 --- /dev/null +++ b/framework/source/classes/taskcreator.cxx @@ -0,0 +1,293 @@ +/************************************************************************* + * + * $RCSfile: taskcreator.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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): _______________________________________ + * + * + ************************************************************************/ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_CLASSES_TASKCREATOR_HXX_ +#include <classes/taskcreator.hxx> +#endif + +#ifndef __FRAMEWORK_DEFINES_HXX_ +#include <defines.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_AWT_XTOOLKIT_HPP_ +#include <com/sun/star/awt/XToolkit.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_ +#include <com/sun/star/awt/XWindow.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_XWINDOWPEER_HPP_ +#include <com/sun/star/awt/XWindowPeer.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XFRAMESSUPPLIER_HPP_ +#include <com/sun/star/frame/XFramesSupplier.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_AWT_WINDOWDESCRIPTOR_HPP_ +#include <com/sun/star/awt/WindowDescriptor.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_WINDOWATTRIBUTE_HPP_ +#include <com/sun/star/awt/WindowAttribute.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_RECTANGLE_HPP_ +#include <com/sun/star/awt/Rectangle.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_ +#include <com/sun/star/awt/PosSize.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// includes of my own project +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +using namespace ::com::sun::star::awt ; +using namespace ::com::sun::star::frame ; +using namespace ::com::sun::star::lang ; +using namespace ::com::sun::star::uno ; +using namespace ::rtl ; + +//_________________________________________________________________________________________________________________ +// non exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// non exported definitions +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +TaskCreator::TaskCreator( const Reference< XMultiServiceFactory >& xFactory ) + // Init member + : m_xFactory( xFactory ) +{ +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +TaskCreator::~TaskCreator() +{ + // Free memory and release used references. + m_xFactory = Reference< XMultiServiceFactory >(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +Reference< XFrame > TaskCreator::createNewSystemTask( const OUString& sName ) +{ + // Safe impossible cases. + // Method is not designed for all incoming parameter! + LOG_ASSERT( impldbg_checkParameter_createNewSystemTask( sName ), "TaskCreator::createNewSystemTask()\nInvalid parameter detected!\n" ) + + // We must append a new task at our desktop. + // If no desktop exist we cant work correctly. + // Desktop is an one instance service. We will get a reference to it only! + Reference< XFramesSupplier > xDesktop( m_xFactory->createInstance( SERVICENAME_DESKTOP ), UNO_QUERY ); + // Create the new task. + Reference< XFrame > xTask( m_xFactory->createInstance( SERVICENAME_TASK ), UNO_QUERY ); + // Get the toolkit to create a blank window for the new task. + Reference< XToolkit > xToolkit( m_xFactory->createInstance( SERVICENAME_VCLTOOLKIT ), UNO_QUERY ); + // Safe impossible cases + LOG_ASSERT( !(xDesktop.is()==sal_False), "TaskCreator::createNewSystemTask()\nServicename of Desktop is unknown!\n" ) + LOG_ASSERT( !(xTask.is() ==sal_False), "TaskCreator::createNewSystemTask()\nServicename of Task is unknown!\n" ) + LOG_ASSERT( !(xToolkit.is()==sal_False), "TaskCreator::createNewSystemTask()\nServicename of VCLToolkit is unknown!\n" ) + if ( + ( xDesktop.is() == sal_True ) && + ( xTask.is() == sal_True ) && + ( xToolkit.is() == sal_True ) + ) + { + // Describe the window properties. + WindowDescriptor aDescriptor; + aDescriptor.Type = WindowClass_TOP ; + aDescriptor.WindowServiceName = DECLARE_ASCII("window") ; + aDescriptor.ParentIndex = -1 ; + aDescriptor.Parent = Reference< XWindowPeer >() ; + aDescriptor.Bounds = Rectangle(0,0,0,0) ; + aDescriptor.WindowAttributes = WindowAttribute::BORDER | + WindowAttribute::MOVEABLE | + WindowAttribute::SIZEABLE | + WindowAttribute::CLOSEABLE ; + // Create a new blank window and set it on this instance. + Reference< XWindowPeer > xPeer = xToolkit->createWindow( aDescriptor ); + Reference< XWindow > xWindow ( xPeer, UNO_QUERY ); + if ( + ( xWindow.is() == sal_True ) && + ( xTask.is() == sal_True ) + ) + { + // Don't forget to create tree-bindings! Set this desktop as parent of new task ... + // ... and append it to his container. + // (Parent will automaticly set by "append()"!) + xTask->setName( sName ); + xDesktop->getFrames()->append( xTask ); + // Set window on task. + xTask->initialize( xWindow ); + /* HACK for VCL */ + xWindow->setPosSize ( 0, 0, 500, 500, PosSize::POSSIZE ); + xWindow->setEnable ( sal_True ); + /* HACK for VCL */ + } + } + + // Return result of this operation. + return xTask; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +Reference< XFrame > TaskCreator::createNewBrowserTask( const OUString& sName ) +{ + // Safe impossible cases. + // Method is not designed for all incoming parameter! + LOG_ASSERT( impldbg_checkParameter_createNewBrowserTask( sName ), "TaskCreator::createNewBrowserTask()\nInvalid parameter detected!\n" ) + // Set default return value if method failed. + Reference< XFrame > xPlugInFrame; + + LOG_ASSERT( sal_False, "TaskCreator::createNewBrowserTask()\nNot supported yet! Return empty reference.\n" ) + + // Return result of operation. + return xPlugInFrame; +} + +//_________________________________________________________________________________________________________________ +// debug methods +//_________________________________________________________________________________________________________________ + +/*----------------------------------------------------------------------------------------------------------------- + The follow methods checks the parameter for other functions. If a parameter or his value is non valid, + we return "sal_False". (else sal_True) This mechanism is used to throw an ASSERT! + + ATTENTION + + If you miss a test for one of this parameters, contact the autor or add it himself !(?) + But ... look for right testing! See using of this methods! +-----------------------------------------------------------------------------------------------------------------*/ + +#ifdef ENABLE_ASSERTIONS + +//***************************************************************************************************************** +// We look for invalid pointer only. An empty name is allowd! +sal_Bool TaskCreator::impldbg_checkParameter_createNewSystemTask( const OUString& sName ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + // Check parameter. + if ( + ( &sName == NULL ) + ) + { + bOK = sal_False ; + } + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +// We look for invalid pointer only. An empty name is allowd! +sal_Bool TaskCreator::impldbg_checkParameter_createNewBrowserTask( const OUString& sName ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + // Check parameter. + if ( + ( &sName == NULL ) + ) + { + bOK = sal_False ; + } + // Return result of check. + return bOK ; +} + +#endif // #ifdef ENABLE_ASSERTIONS + +} // namespace framework diff --git a/framework/source/helper/makefile.mk b/framework/source/helper/makefile.mk new file mode 100644 index 000000000000..163707bcb40f --- /dev/null +++ b/framework/source/helper/makefile.mk @@ -0,0 +1,91 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:29: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): _______________________________________ +# +# +# +#************************************************************************* +PRJ=..$/.. + +PRJNAME= framework +TARGET= fwk_helper +USE_DEFFILE= TRUE +NO_BSYMBOLIC= TRUE +ENABLE_EXCEPTIONS= TRUE +BOOTSTRAP_SERVICE= FALSE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Generate ----------------------------------------------------- + +SLOFILES= $(SLO)$/otasksaccess.obj \ + $(SLO)$/otasksenumeration.obj \ + $(SLO)$/odispatchprovider.obj \ + $(SLO)$/odesktopdispatcher.obj \ + $(SLO)$/oframes.obj \ + $(SLO)$/opluginframedispatcher.obj \ + $(SLO)$/oinstanceprovider.obj \ + $(SLO)$/opluginframefactory.obj \ + $(SLO)$/opipeconnection.obj + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/framework/source/helper/oframes.cxx b/framework/source/helper/oframes.cxx new file mode 100644 index 000000000000..9b9410e2e90f --- /dev/null +++ b/framework/source/helper/oframes.cxx @@ -0,0 +1,604 @@ +/************************************************************************* + * + * $RCSfile: oframes.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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): _______________________________________ + * + * + ************************************************************************/ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_HELPER_OFRAMES_HXX_ +#include <helper/oframes.hxx> +#endif + +#ifndef __FRAMEWORK_DEFINES_HXX_ +#include <defines.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_FRAME_XDESKTOP_HPP_ +#include <com/sun/star/frame/XDesktop.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HPP_ +#include <com/sun/star/frame/FrameSearchFlag.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +using namespace ::com::sun::star::container ; +using namespace ::com::sun::star::frame ; +using namespace ::com::sun::star::lang ; +using namespace ::com::sun::star::uno ; +using namespace ::cppu ; +using namespace ::osl ; +using namespace ::rtl ; +using namespace ::std ; + +//_________________________________________________________________________________________________________________ +// non exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// non exported definitions +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +OFrames::OFrames( const Reference< XMultiServiceFactory >& xFactory , + Mutex& aMutex , + const Reference< XFrame >& xOwner , + FrameContainer* pFrameContainer ) + // Init baseclasses first + : OWeakObject ( ) + // Init member + , m_xFactory ( xFactory ) + , m_aMutex ( aMutex ) + , m_xOwner ( xOwner ) + , m_pFrameContainer ( pFrameContainer ) + , m_bRecursiveSearchProtection( PROTECTION_OFF ) +{ + // Safe impossible cases + // Method is not defined for ALL incoming parameters! + LOG_ASSERT( impldbg_checkParameter_OFramesCtor( xFactory, aMutex, xOwner, pFrameContainer ), "OFrames::OFrames()\nInvalid parameter detected!\n" ) +} + +//***************************************************************************************************************** +// (proteced!) destructor +//***************************************************************************************************************** +OFrames::~OFrames() +{ + // Reset instance, free memory .... + impl_resetObject(); +} + +//***************************************************************************************************************** +// XInterface +//***************************************************************************************************************** + +DEFINE_XINTERFACE_3 ( OFrames , + OWeakObject , + DIRECT_INTERFACE(XFrames ), + DIRECT_INTERFACE(XIndexAccess ), + DIRECT_INTERFACE(XElementAccess ) + ) + +// Attention: If you have enabled any testmode different from TEST_NOTHING => you have declared XDebugging-interface automaticly! +// Bhere is no macro to define and implement the right methods. You are the only one, who know - how you will use this mechanism. +// It exist a macro to switch on or off your implementation only. +// ENABLE_SERVICEDEBUG must be defined, to activate your code! + +//#ifdef ENABLE_SERVICEDEBUG + + // Debug mechanism for services is not used in this implementation. + // This define will expand to nothing if SERVICEDEBUG_ENABLED unknown! + // But if you will implement your own code - activate this define before ... and deactivate follow line. +// DEFINE_EMPTY_XSPECIALDEBUGINTERFACE( OFrames ) + +//#endif // #ifdef ENABLE_SERVICEDEBUG + +//***************************************************************************************************************** +// XFrames +//***************************************************************************************************************** +void SAL_CALL OFrames::append( const Reference< XFrame >& xFrame ) throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "OFrames::append()" ) + + // Safe impossible cases + // Method is not defined for ALL incoming parameters! + LOG_ASSERT( impldbg_checkParameter_append( xFrame ), "OFrames::append()\nInvalid parameter detected!\n" ) + + // Do the follow only, if owner instance valid! + // Lock owner for follow operations - make a "hard reference"! + Reference< XFramesSupplier > xOwner( m_xOwner.get(), UNO_QUERY ); + if ( xOwner.is() == sal_True ) + { + // Append frame to the end of the container ... + m_pFrameContainer->append( xFrame ); + // Set owner of this instance as parent of the new frame in container! + xFrame->setCreator( xOwner ); + } + // Else; Do nothing! Ouer owner is dead. + LOG_ASSERT( !(xOwner.is()==sal_False), "OFrames::append()\nOuer owner is dead - you can't append any frames ...!\n" ) +} + +//***************************************************************************************************************** +// XFrames +//***************************************************************************************************************** +void SAL_CALL OFrames::remove( const Reference< XFrame >& xFrame ) throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "OFrames::remove()" ) + + // Safe impossible cases + // Method is not defined for ALL incoming parameters! + LOG_ASSERT( impldbg_checkParameter_remove( xFrame ), "OFrames::remove()\nInvalid parameter detected!\n" ) + + // Do the follow only, if owner instance valid! + // Lock owner for follow operations - make a "hard reference"! + Reference< XFramesSupplier > xOwner( m_xOwner.get(), UNO_QUERY ); + if ( xOwner.is() == sal_True ) + { + // Search frame and remove it from container ... + m_pFrameContainer->remove( xFrame ); + // Don't reset owner-property of removed frame! + // This must do the caller of this method himself. + // See documentation of interface XFrames for further informations. + } + // Else; Do nothing! Ouer owner is dead. + LOG_ASSERT( !(xOwner.is()==sal_False), "OFrames::remove()\nOuer owner is dead - you can't remove any frames ...!\n" ) +} + +//***************************************************************************************************************** +// XFrames +//***************************************************************************************************************** +Sequence< Reference< XFrame > > SAL_CALL OFrames::queryFrames( sal_Int32 nSearchFlags ) throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "OFrames::queryFrames()" ) + + // Safe impossible cases + // Method is not defined for ALL incoming parameters! + LOG_ASSERT( impldbg_checkParameter_queryFrames( nSearchFlags ), "OFrames::queryFrames()\nInvalid parameter detected!\n" ) + + // Set default return value. (empty sequence) + Sequence< Reference< XFrame > > seqFrames; + + // Do the follow only, if owner instance valid. + // Lock owner for follow operations - make a "hard reference"! + Reference< XFrame > xOwner( m_xOwner.get(), UNO_QUERY ); + if ( xOwner.is() == sal_True ) + { + // This class is a helper for services, which must implement XFrames. + // His parent and childs are MY parent and childs to. + // All searchflags are supported by this implementation! + // If some flags should not be supported - don't call me with this flags!!! + + //_____________________________________________________________________________________________________________ + // Search with AUTO-flag is not supported yet! + // We think about right implementation. + LOG_ASSERT( !(nSearchFlags & FrameSearchFlag::AUTO), "OFrames::queryFrames()\nSearch with AUTO-flag is not supported yet!\nWe think about right implementation.\n" ) + + //_____________________________________________________________________________________________________________ + // Search for ALL and GLOBAL is superflous! + // We support all necessary flags, from which these two flags are derived. + // ALL = PARENT + SELF + CHILDREN + SIBLINGS + // GLOBAL = ALL + TASKS +// LOG_ASSERT( !(nSearchFlags & FrameSearchFlag::ALL ), "OFrames::queryFrames()\nSearch for ALL is superflous!\nWe support all necessary flags, from which these flag is derived.\n" ) +// LOG_ASSERT( !(nSearchFlags & FrameSearchFlag::GLOBAL ), "OFrames::queryFrames()\nSearch for GLOBAL is superflous!\nWe support all necessary flags, from which these flag is derived.\n" ) + + //_____________________________________________________________________________________________________________ + // I have only one parent - the parent of the owner of this instance! + // Ask him for all frames with these flags and collect it in a list for return. + if ( + ( nSearchFlags & FrameSearchFlag::PARENT ) || + ( nSearchFlags & FrameSearchFlag::SIBLINGS ) + ) + { + // Don't search in THIS instance again, if search for parents and his childs was started here! + if ( m_bRecursiveSearchProtection == PROTECTION_ON ) + { + // Else; start a new search. + // Protect this instance against recursive calls from parents. + m_bRecursiveSearchProtection = PROTECTION_ON; + // Ask parent of my owner for frames and append results to return list. + Reference< XFrames > xParent( xOwner->getCreator(), UNO_QUERY ); + // If a parent exist ... + if ( xParent.is() == sal_True ) + { + // ... ask him for right frames. + impl_appendSequence( seqFrames, xParent->queryFrames( nSearchFlags ) ); + } + // Other way; if no parent exist - do nothing. The owner can only be the Desktop himself! + // But safe impossible cases! + // If the owner not the Desktop - we have an break in ouer frame-hierarchy. Every frame (not the desktop) must have a parent! + #if ( TESTMODE==TEST_ERRORS || TESTMODE==FULL ) + Reference< XDesktop > xDesktopInterface( xOwner, UNO_QUERY ); + LOG_ASSERT( !(xParent.is()==sal_False && xDesktopInterface.is()==sal_False), "OFrames::queryFrames()\nBreak in frame hierarchy detected!There is no parent at my owner and its not the Desktop.\n" ) + #endif // #if ( TESTMODE==TEST_ERRORS || TESTMODE==FULL ) + // We have all searched informations. + // Reset protection-mode. + m_bRecursiveSearchProtection = PROTECTION_OFF; + } + } + + // Don't search at childs for parents and siblings! + // Why not? + // PARENT = my owner = SELF + // SIBLINGS = childs of my owner = CHILDREN + nSearchFlags = nSearchFlags & UNMASK_PARENT ; + nSearchFlags = nSearchFlags & UNMASK_SIBLINGS ; + + //_____________________________________________________________________________________________________________ + // If i'am searched himself - add my owner parent to result list. + if ( nSearchFlags & FrameSearchFlag::SELF ) + { + // Build new sequence with THIS as the only one item. + Reference< XFrame > xSelf( (OWeakObject*)this, UNO_QUERY ); + Sequence< Reference< XFrame > > seqSelf( 1 ); + seqSelf.getArray()[0] = xSelf; + // Append these new sequence to result list. + impl_appendSequence( seqFrames, seqSelf ); + } + + //_____________________________________________________________________________________________________________ + // If searched for children, step over all elements in container and collect the informations. + if ( nSearchFlags & FrameSearchFlag::CHILDREN ) + { + // Don't search for parents, siblings and self at childrens! + // These things are supported by this instance himself. + sal_Int32 nChildSearchFlags = FrameSearchFlag::SELF | FrameSearchFlag::CHILDREN; + // Step over all items of container and ask childrens for frames. + // But first lock the container! see class FrameContainer for further informations. + m_pFrameContainer->lock(); + sal_uInt32 nCount = m_pFrameContainer->getCount(); + for ( sal_uInt32 nIndex=1; nIndex<=nCount; ++nIndex ) + { + // We don't must control this conversion. + // We have done this at append()! + Reference< XFrames > xItem( (*m_pFrameContainer)[nIndex], UNO_QUERY ); + impl_appendSequence( seqFrames, xItem->queryFrames( nChildSearchFlags ) ); + } + // Don't forget to unlock the container. + m_pFrameContainer->unlock(); + } + + //_____________________________________________________________________________________________________________ + // If searched for tasks ... + if ( nSearchFlags & FrameSearchFlag::TASKS ) + { + LOG_ASSERT( sal_False, "OFrames::queryFrames()\nSearch for tasks not supported yet!\n" ) + } + } + // Else; Do nothing! Ouer owner is dead. + LOG_ASSERT( !(xOwner.is()==sal_False), "OFrames::queryFrames()\nOuer owner is dead - you can't query for frames ...!\n" ) + + // Resturn result of this operation. + return seqFrames; +} + +//***************************************************************************************************************** +// XIndexAccess +//***************************************************************************************************************** +sal_Int32 SAL_CALL OFrames::getCount() throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "OFrames::getCount()" ) + + // Set default return value. + sal_Int32 nCount = 0; + + // Do the follow only, if owner instance valid. + // Lock owner for follow operations - make a "hard reference"! + Reference< XFrame > xOwner( m_xOwner.get(), UNO_QUERY ); + if ( xOwner.is() == sal_True ) + { + // Set CURRENT size of container for return. + nCount = m_pFrameContainer->getCount(); + } + + // Return result. + return nCount; +} + +//***************************************************************************************************************** +// XIndexAccess +//***************************************************************************************************************** +Any SAL_CALL OFrames::getByIndex( sal_Int32 nIndex ) throw( IndexOutOfBoundsException , + WrappedTargetException , + RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "OFrames::getByIndex()" ) + + // Set default return value. + Any aReturnValue; + + // Do the follow only, if owner instance valid. + // Lock owner for follow operations - make a "hard reference"! + Reference< XFrame > xOwner( m_xOwner.get(), UNO_QUERY ); + if ( xOwner.is() == sal_True ) + { + // Get element form container. + // (If index not valid, FrameContainer return NULL!) + aReturnValue <<= (*m_pFrameContainer)[nIndex]; + } + + // Return result of this operation. + return aReturnValue; +} + +//***************************************************************************************************************** +// XElementAccess +//***************************************************************************************************************** +Type SAL_CALL OFrames::getElementType() throw( RuntimeException ) +{ + // This "container" support XFrame-interfaces only! + return ::getCppuType( (const Reference< XFrame >*)NULL ); +} + +//***************************************************************************************************************** +// XElementAccess +//***************************************************************************************************************** +sal_Bool SAL_CALL OFrames::hasElements() throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "OFrames::hasElements()" ) + + // Set default return value. + sal_Bool bHasElements = sal_False; + // Do the follow only, if owner instance valid. + // Lock owner for follow operations - make a "hard reference"! + Reference< XFrame > xOwner( m_xOwner.get(), UNO_QUERY ); + if ( xOwner.is() == sal_True ) + { + // If some elements exist ... + if ( m_pFrameContainer->getCount() > 0 ) + { + // ... change this state value! + bHasElements = sal_True; + } + } + // Return result of this operation. + return bHasElements; +} + +//***************************************************************************************************************** +// proteced method +//***************************************************************************************************************** +void OFrames::impl_resetObject() +{ + // Attention: + // Write this for multiple calls - NOT AT THE SAME TIME - but for more then one call again)! + // It exist two ways to call this method. From destructor and from disposing(). + // I can't say, which one is the first. Normaly the disposing-call - but other way .... + + // This instance can't work if the weakreference to owner is invalid! + // Destroy this to reset this object. + m_xOwner = WeakReference< XFrame >(); + // Reset pointer to shared container to! + m_pFrameContainer = NULL; +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +void OFrames::impl_appendSequence( Sequence< Reference< XFrame > >& seqDestination , + const Sequence< Reference< XFrame > >& seqSource ) +{ + // Get some informations about the sequences. + sal_Int32 nSourceCount = seqSource.getLength(); + sal_Int32 nDestinationCount = seqDestination.getLength(); + const Reference< XFrame >* pSourceAccess = seqSource.getConstArray(); + Reference< XFrame >* pDestinationAccess = seqDestination.getArray(); + + // Get memory for result list. + Sequence< Reference< XFrame > > seqResult ( nSourceCount + nDestinationCount ); + Reference< XFrame >* pResultAccess = seqResult.getArray(); + sal_Int32 nResultPosition = 0; + + // Copy all items from first sequence. + for ( sal_Int32 nSourcePosition=0; nSourcePosition<nSourceCount; ++nSourcePosition ) + { + pResultAccess[nResultPosition] = pSourceAccess[nSourcePosition]; + ++nResultPosition; + } + + // Don't manipulate nResultPosition between these two loops! + // Its the current position in the result list. + + // Copy all items from second sequence. + for ( sal_Int32 nDestinationPosition=0; nDestinationPosition<nDestinationCount; ++nDestinationPosition ) + { + pResultAccess[nResultPosition] = pDestinationAccess[nDestinationPosition]; + ++nResultPosition; + } + + // Return result of this operation. + seqDestination.realloc( 0 ); + seqDestination = seqResult; +} + +//_________________________________________________________________________________________________________________ +// debug methods +//_________________________________________________________________________________________________________________ + +/*----------------------------------------------------------------------------------------------------------------- + The follow methods checks the parameter for other functions. If a parameter or his value is non valid, + we return "sal_False". (else sal_True) This mechanism is used to throw an ASSERT! + + ATTENTION + + If you miss a test for one of this parameters, contact the autor or add it himself !(?) + But ... look for right testing! See using of this methods! +-----------------------------------------------------------------------------------------------------------------*/ + +#ifdef ENABLE_ASSERTIONS + +//***************************************************************************************************************** +// An instance of this class can only work with valid initialization. +// We share the mutex with ouer owner class, need a valid factory to instanciate new services and +// use the access to ouer owner for some operations. +sal_Bool OFrames::impldbg_checkParameter_OFramesCtor( const Reference< XMultiServiceFactory >& xFactory , + Mutex& aMutex , + const Reference< XFrame >& xOwner , + FrameContainer* pFrameContainer ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + // Check parameter. + if ( + ( &xFactory == NULL ) || + ( &aMutex == NULL ) || + ( &xOwner == NULL ) || + ( xFactory.is() == sal_False ) || + ( xOwner.is() == sal_False ) || + ( m_pFrameContainer == NULL ) + ) + { + bOK = sal_False ; + } + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +// Its only allowed to add valid references to container. +// AND - alle frames must support XFrames-interface! +sal_Bool OFrames::impldbg_checkParameter_append( const Reference< XFrame >& xFrame ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + // Check parameter. + if ( + ( &xFrame == NULL ) || + ( xFrame.is() == sal_False ) + ) + { + bOK = sal_False ; + } + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +// Its only allowed to add valid references to container... +// ... => You can only delete valid references! +sal_Bool OFrames::impldbg_checkParameter_remove( const Reference< XFrame >& xFrame ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + // Check parameter. + if ( + ( &xFrame == NULL ) || + ( xFrame.is() == sal_False ) + ) + { + bOK = sal_False ; + } + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +// A search for frames must initiate with right flags. +// Some one are superflous and not supported yet. But here we control only the range of incoming parameter! +sal_Bool OFrames::impldbg_checkParameter_queryFrames( sal_Int32 nSearchFlags ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + // Check parameter. + if ( + ( nSearchFlags != FrameSearchFlag::AUTO ) && + ( !( nSearchFlags & FrameSearchFlag::PARENT ) ) && + ( !( nSearchFlags & FrameSearchFlag::SELF ) ) && + ( !( nSearchFlags & FrameSearchFlag::CHILDREN ) ) && + ( !( nSearchFlags & FrameSearchFlag::CREATE ) ) && + ( !( nSearchFlags & FrameSearchFlag::SIBLINGS ) ) && + ( !( nSearchFlags & FrameSearchFlag::TASKS ) ) && + ( !( nSearchFlags & FrameSearchFlag::ALL ) ) && + ( !( nSearchFlags & FrameSearchFlag::GLOBAL ) ) + ) + { + bOK = sal_False ; + } + // Return result of check. + return bOK ; +} + +#endif // #ifdef ENABLE_ASSERTIONS + +} // namespace framework diff --git a/framework/source/register/makefile.mk b/framework/source/register/makefile.mk new file mode 100644 index 000000000000..a6af168fb720 --- /dev/null +++ b/framework/source/register/makefile.mk @@ -0,0 +1,86 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:29: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): _______________________________________ +# +# +# +#************************************************************************* +PRJ=..$/.. + +PRJNAME= framework +TARGET= fwk_register +USE_DEFFILE= TRUE +NO_BSYMBOLIC= TRUE +ENABLE_EXCEPTIONS= TRUE +BOOTSTRAP_SERVICE= FALSE +LIBTARGET= NO + +# --- Settings ----------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Generate ----------------------------------------------------- + +SLOFILES= \ + $(SLO)$/registerservices.obj \ + $(SLO)$/registerbaehservices.obj + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx new file mode 100644 index 000000000000..837530e6ef4d --- /dev/null +++ b/framework/source/register/registerservices.cxx @@ -0,0 +1,117 @@ +/************************************************************************* + * + * $RCSfile: registerservices.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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): _______________________________________ + * + * + ************************************************************************/ + +//_________________________________________________________________________________________________________________ +// includes of my own project +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_MACROS_REGISTRATION_HXX_ +#include <macros/registration.hxx> +#endif + +/*================================================================================================================= + Add new include and new register info to for new services. + + Example: + + #ifndef __YOUR_SERVICE_1_HXX_ + #include <service1.hxx> + #endif + + #ifndef __YOUR_SERVICE_2_HXX_ + #include <service2.hxx> + #endif + + COMPONENTGETIMPLEMENTATIONENVIRONMENT + + COMPONENTWRITEINFO ( COMPONENTINFO( Service1 ) + COMPONENTINFO( Service2 ) + ) + + COMPONENTGETFACTORY ( IFFACTORIE( Service1 ) + else + IFFACTORIE( Service2 ) + ) +=================================================================================================================*/ + +#ifndef __FRAMEWORK_SERVICES_TASK_HXX_ +#include <services/task.hxx> +#endif + +#ifndef __FRAMEWORK_SERVICES_FRAME_HXX_ +#include <services/frame.hxx> +#endif + +#ifndef __FRAMEWORK_SERVICES_FRAMELOADERFACTORY_HXX_ +#include <services/frameloaderfactory.hxx> +#endif + +COMPONENTGETIMPLEMENTATIONENVIRONMENT + +COMPONENTWRITEINFO ( COMPONENTINFO( ::framework::Task ) + COMPONENTINFO( ::framework::Frame ) + COMPONENTINFO( ::framework::FrameLoaderFactory ) + ) + +COMPONENTGETFACTORY ( IFFACTORY( ::framework::Task ) else + IFFACTORY( ::framework::Frame ) else + IFFACTORY( ::framework::FrameLoaderFactory ) + ) diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx new file mode 100644 index 000000000000..7e459408309a --- /dev/null +++ b/framework/source/services/frame.cxx @@ -0,0 +1,2739 @@ +/************************************************************************* + * + * $RCSfile: frame.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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): _______________________________________ + * + * + ************************************************************************/ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_SERVICES_FRAME_HXX_ +#include <services/frame.hxx> +#endif + +#ifndef __FRAMEWORK_HELPER_ODISPATCHPROVIDER_HXX_ +#include <helper/odispatchprovider.hxx> +#endif + +#ifndef __FRAMEWORK_HELPER_OFRAMES_HXX_ +#include <helper/oframes.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_AWT_XDEVICE_HPP_ +#include <com/sun/star/awt/XDevice.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_XTOPWINDOW_HPP_ +#include <com/sun/star/awt/XTopWindow.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XTASK_HPP_ +#include <com/sun/star/frame/XTask.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XDESKTOP_HPP_ +#include <com/sun/star/frame/XDesktop.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_ +#include <com/sun/star/awt/PosSize.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HPP_ +#include <com/sun/star/frame/FrameSearchFlag.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ + +#ifndef _CPPUHELPER_QUERYINTERFACE_HXX_ +#include <cppuhelper/queryinterface.hxx> +#endif + +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif + +#ifndef _CPPUHELPER_FACTORY_HXX_ +#include <cppuhelper/factory.hxx> +#endif + +#ifndef _RTL_USTRBUF_HXX_ +#include <rtl/ustrbuf.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +using namespace ::com::sun::star::awt ; +using namespace ::com::sun::star::beans ; +using namespace ::com::sun::star::container ; +using namespace ::com::sun::star::frame ; +using namespace ::com::sun::star::lang ; +using namespace ::com::sun::star::task ; +using namespace ::com::sun::star::uno ; +using namespace ::com::sun::star::util ; +using namespace ::cppu ; +using namespace ::osl ; +using namespace ::rtl ; + +//_________________________________________________________________________________________________________________ +// non exported const +//_________________________________________________________________________________________________________________ + +#define DEFAULT_EACTIVESTATE INACTIVE +#define DEFAULT_BRECURSIVESEARCHPROTECTION sal_False +#define DEFAULT_BISFRAMETOP sal_True +#define DEFAULT_BALREADYDISPOSED sal_False +#define DEFAULT_BCONNECTED sal_True +#define DEFAULT_BILOADLASTCOMPONENT sal_False +#define DEFAULT_SNAME OUString() + +//_________________________________________________________________________________________________________________ +// non exported definitions +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +Frame::Frame( const Reference< XMultiServiceFactory >& xFactory ) + // Init baseclasses first + // Attention: + // Don't change order of initialization! + // OMutexMember is a struct with a mutex as member. We can't use a mutex as member, while + // we must garant right initialization and a valid value of this! First initialize + // baseclasses and then members. And we need the mutex for other baseclasses !!! + : OMutexMember ( ) + , OWeakObject ( ) + // Init member + , m_xFactory ( xFactory ) + , m_aListenerContainer ( m_aMutex ) + , m_aChildFrameContainer ( ) + // Init flags + , m_eActiveState ( DEFAULT_EACTIVESTATE ) + , m_bRecursiveSearchProtection( DEFAULT_BRECURSIVESEARCHPROTECTION) + , m_bIsFrameTop ( DEFAULT_BISFRAMETOP ) + , m_bAlreadyDisposed ( DEFAULT_BALREADYDISPOSED ) + , m_bConnected ( DEFAULT_BCONNECTED ) + , m_bILoadLastComponent ( DEFAULT_BILOADLASTCOMPONENT ) + , m_sName ( DEFAULT_SNAME ) +{ + // We cant create the dispatchhelper and frameshelper, because they hold wekreferences to us! + // But with a HACK (++refcount) its "OK" :-( + ++m_refCount ; + + // Initialize a new dispatchhelper-object to handle dispatches PRIVATE! + ODispatchProvider* pDispatchHelper = new ODispatchProvider( m_xFactory, this, m_aMutex ); + m_xDispatchHelper = Reference< XDispatchProvider >( (OWeakObject*)pDispatchHelper, UNO_QUERY ); + + // Initialize a new frameshelper-object to handle indexaccess and elementaccess! + // Attention: OFrames need the this-pointer for initializing. You must use "this" directly. + // If you define an extra variable to do that (like: Reference< XFrame > xTHIS( ... )) and + // forget to clear this reference BEFORE "--m_refCount" (!), your refcount will be less then 0 + // and the new Desktop-instance will be destroyed instantly!!!... + OFrames* pFramesHelper = new OFrames( m_xFactory, m_aMutex, this, &m_aChildFrameContainer ); + m_xFramesHelper = Reference< XFrames >( (OWeakObject*)pFramesHelper, UNO_QUERY ); + + // Safe impossible cases + // We can't work without these helpers! + LOG_ASSERT( !(m_xDispatchHelper.is()==sal_False), "Frame::Frame()\nDispatchHelper is not valid. XDispatchProvider and XDispatch are not supported!\n" ) + LOG_ASSERT( !(m_xFramesHelper.is ()==sal_False), "Frame::Frame()\nFramesHelper is not valid. XFrames, XIndexAccess and XElementAcces are not supported!\n") + + // Don't forget these - or we live for ever! + --m_refCount ; +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +Frame::~Frame() +{ +} + +//***************************************************************************************************************** +// XInterface, XTypeProvider, XServiceInfo +//***************************************************************************************************************** + +DEFINE_XINTERFACE_13 ( Frame , + OWeakObject , + DIRECT_INTERFACE(XTypeProvider ), + DIRECT_INTERFACE(XServiceInfo ), + DIRECT_INTERFACE(XFramesSupplier ), + DIRECT_INTERFACE(XFrame ), + DIRECT_INTERFACE(XComponent ), + DIRECT_INTERFACE(XStatusIndicatorSupplier ), + DIRECT_INTERFACE(XDispatchProvider ), + DIRECT_INTERFACE(XDispatchProviderInterception ), + DIRECT_INTERFACE(XBrowseHistoryRegistry ), + DIRECT_INTERFACE(XWindowListener ), + DIRECT_INTERFACE(XTopWindowListener ), + DIRECT_INTERFACE(XFocusListener ), + DERIVED_INTERFACE(XEventListener, XWindowListener ) + ) + +DEFINE_XTYPEPROVIDER_13 ( Frame , + XTypeProvider , + XServiceInfo , + XFramesSupplier , + XFrame , + XComponent , + XStatusIndicatorSupplier , + XDispatchProvider , + XDispatchProviderInterception , + XBrowseHistoryRegistry , + XWindowListener , + XTopWindowListener , + XFocusListener , + XEventListener + ) + +DEFINE_XSERVICEINFO_MULTISERVICE ( Frame , + SERVICENAME_FRAME , + IMPLEMENTATIONNAME_FRAME + ) + +// Attention: If you have enabled any testmode different from TEST_NOTHING => you have declared XDebugging-interface automaticly! +// Bhere is no macro to define and implement the right methods. You are the only one, who know - how you will use this mechanism. +// It exist a macro to switch on or off your implementation only. +// ENABLE_SERVICEDEBUG must be defined, to activate your code! +/* +#ifdef ENABLE_SERVICEDEBUG + + // In these implementation we use "dumpVariable()" to activate some special debug-operations. + OUString SAL_CALL Frame::dumpVariable( const OUString& sVariableName , + sal_Int16 nCallStackPos ) throw( RuntimeException ) + { + // Set default return value. + OUString sReturn; + + // We have a private impldbg-method to print out the current content of ouer frame hierarchy - the tree. + // This mechanism is started on desktop. We collect the names of all ouer own and sub-frames and return the informations to caller. + if ( + ( sVariableName.equals( DUMPVARIABLE_TREEINFO ) == sal_True ) && + ( nCallStackPos > 0 ) + ) + { + sReturn = impldbg_getTreeNames( nCallStackPos ); + } + else + // Safe impossible cases + // This method and his interface is used in a special context. + // If somebody don't know this and these implementation is invalid (zB. interface exported in release version!?) + // => we have problems! + { + LOG_ASSERT( sal_True, "Desktop::dumpVariable()\nERROR\nSpecial debug mode of service is used in another context!Please contact programmer.\n\n" ) + } + + // Return result of DEBUG. + return sReturn; + } + + // Follow methods are unused in these implementation! + sal_Int32 SAL_CALL Frame::setBreakPoint( const OUString& aModuleName, sal_Int32 nSourceCodeLine, sal_Bool bOn ) throw( RuntimeException ) { return 0; } + void SAL_CALL Frame::clearAllBreakPoints( const OUString& aModuleName ) throw( RuntimeException ) {} + OUString SAL_CALL Frame::eval( const OUString& aSourceCode, sal_Int16 nCallStackPos ) throw( RuntimeException ) { return OUString(); } + Sequence< OUString > SAL_CALL Frame::getStackTrace() throw( RuntimeException ) { return Sequence< OUString >(); } + CONTEXTINFORMATION SAL_CALL Frame::getContextInformation( sal_Int16 nCallStackPos) throw( RuntimeException ) { return CONTEXTINFORMATION(); } + void SAL_CALL Frame::setVariable( const OUString& aVariableName, const OUSTRING& aValue, sal_Int16 nCallStackPos ) throw( RuntimeException ) {} + sal_Bool SAL_CALL Frame::isVariable( const OUString& aVariableName, sal_Int16 nCallStackPos ) throw( RuntimeException ) { return sal_False; } + void SAL_CALL Frame::stop() throw( RuntimeException ) {} + void SAL_CALL Frame::stepOver() throw( RuntimeException ) {} + void SAL_CALL Frame::stepIn() throw( RuntimeException ) {} + void SAL_CALL Frame::stepOut() throw( RuntimeException ) {} + void SAL_CALL Frame::doContinue() throw( RuntimeException ) {} + +#endif // #ifdef ENABLE_SERVICEDEBUG +*/ +//***************************************************************************************************************** +// XFramesSupplier +//***************************************************************************************************************** +Reference< XFrames > SAL_CALL Frame::getFrames() throw( RuntimeException ) +{ + // Return access to all child frames to caller. + // Ouer childframe container is implemented in helper class OFrames and used as a member m_xFramesHelper! + return m_xFramesHelper; +} + +//***************************************************************************************************************** +// XFramesSupplier +//***************************************************************************************************************** +Reference< XFrame > SAL_CALL Frame::getActiveFrame() throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::getActiveFrame()" ) + + // Return current active frame. + // This information is avaliable on the container. + return m_aChildFrameContainer.getActive(); +} + +//***************************************************************************************************************** +// XFramesSupplier +//***************************************************************************************************************** +void SAL_CALL Frame::setActiveFrame( const Reference< XFrame >& xFrame ) throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::setActiveFrame()" ) + + // Safe impossible cases + // This method is not defined for all incoming parameters. + // I accept valid frames only. No tasks or desktops! + // (But a NULL-reference stop down search in tree and is allowed!) + LOG_ASSERT( impldbg_checkParameter_setActiveFrame( xFrame ), "Frame::setActiveFrame()\nInvalid parameter detected.\n" ) + + // We don't safe the current active frame directly in this class! We set the information at container. + // This is neccessar to control, if the active frame is a direct child of us! + Reference< XFrame > xActiveChild = m_aChildFrameContainer.getActive(); + + // Don't work, if "new" active frame is'nt different from current one! + if ( xActiveChild != xFrame ) + { + // Set the new active child frame. + m_aChildFrameContainer.setActive( xFrame ); + if( isActive() && xActiveChild.is() ) + xActiveChild->deactivate(); + } +} + +//***************************************************************************************************************** +// XStatusIndicatorSupplier +//***************************************************************************************************************** +Reference< XStatusIndicator > SAL_CALL Frame::getStatusIndicator() throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::getStatusIndicator()" ) + + // If no indicator exist ... + if ( m_xIndicator.is() == sal_False ) + { + // ... create a new one. + /*ASMUSS*/ + } + + // Return indicator reference. + return m_xIndicator; +} + +//***************************************************************************************************************** +// XDispatchProvider +//***************************************************************************************************************** +Reference< XDispatch > SAL_CALL Frame::queryDispatch( const URL& aURL , + const OUString& sTargetFrameName, + sal_Int32 nSearchFlags ) throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::queryDispatch()" ) + // Safe impossible cases + LOG_ASSERT( impldbg_checkParameter_queryDispatch( aURL, sTargetFrameName, nSearchFlags ), "Frame::queryDispatch()\nInvalid parameter detected.\n" ) + + // Set default return value. + Reference< XDispatch > xReturn; + + // An interceptor can break ouer path to dispatch queries! + // Is there an interceptor set on this instance? + if ( m_xInterceptor.is() == sal_True ) + { + // Yes; Then forward query to this instance and set results for return. + xReturn = m_xInterceptor->queryDispatch( aURL, sTargetFrameName, nSearchFlags ); + } + else + { + // No; Then use ouer own dispatchhelper to do this and set results for return. + xReturn = m_xDispatchHelper->queryDispatch( aURL, sTargetFrameName, nSearchFlags ); + } + + // Return results of this operation. + return xReturn; +} + +//***************************************************************************************************************** +// XDispatchProvider +//***************************************************************************************************************** +Sequence< Reference< XDispatch > > SAL_CALL Frame::queryDispatches( const Sequence< DispatchDescriptor >& seqDescriptor ) throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::queryDispatches()" ) + // Safe impossible cases + LOG_ASSERT( impldbg_checkParameter_queryDispatches( seqDescriptor ), "Frame::queryDispatches()\nInvalid parameter detected.\n" ) + + // Set default return value. + Sequence< Reference< XDispatch > > seqReturn; + + // An interceptor can break ouer path to dispatch queries! + // Is there an interceptor set on this instance? + if ( m_xInterceptor.is() == sal_True ) + { + // Yes; Then forward query to this instance and set results for return. + seqReturn = m_xInterceptor->queryDispatches( seqDescriptor ); + } + else + { + // No; Then use ouer own dispatchhelper to do this and set results for return. + seqReturn = m_xDispatchHelper->queryDispatches( seqDescriptor ); + } + + // Return results of this operation. + return seqReturn; +} + +//***************************************************************************************************************** +// XDispatchProviderInterception +//***************************************************************************************************************** +void SAL_CALL Frame::registerDispatchProviderInterceptor( const Reference< XDispatchProviderInterceptor >& xInterceptor ) throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::registerDispatchProviderInterceptor()" ) + + // Safe impossible cases + LOG_ASSERT( impldbg_checkParameter_registerDispatchProviderInterceptor( xInterceptor ), "Frame::registerDispatchProviderInterceptor()\nInvalid parameter detected.\n" ) + + if ( m_xInterceptor.is() ) + { + // There is already an interceptor; the new one will become it as master. + xInterceptor->setSlaveDispatchProvider ( Reference< XDispatchProvider >( m_xInterceptor, UNO_QUERY ) ); + m_xInterceptor->setMasterDispatchProvider ( Reference< XDispatchProvider >( xInterceptor , UNO_QUERY ) ); + } + else + { + // It is the first interceptor; pass own dispatch provider as a slave. + xInterceptor->setSlaveDispatchProvider( m_xDispatchHelper ); + } + + // Set the new interceptor at frame. + // Frame is the master of the first interceptor. + m_xInterceptor = xInterceptor; + m_xInterceptor->setMasterDispatchProvider( this ); +} + +//***************************************************************************************************************** +// XDispatchProviderInterception +//***************************************************************************************************************** +void SAL_CALL Frame::releaseDispatchProviderInterceptor( const Reference< XDispatchProviderInterceptor >& xInterceptor ) throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::releaseDispatchProviderInterceptor()" ) + + // Safe impossible cases + LOG_ASSERT( impldbg_checkParameter_releaseDispatchProviderInterceptor( xInterceptor ), "Frame::releaseDispatchProviderInterceptor()\nInvalid parameter detected.\n" ) + + // Get slave and master of given interceptor. + Reference< XDispatchProvider > xSlave ( xInterceptor->getSlaveDispatchProvider() , UNO_QUERY ); + Reference< XDispatchProviderInterceptor > xMaster ( xInterceptor->getMasterDispatchProvider() , UNO_QUERY ); + + if ( xMaster.is() == sal_True ) + { + // Old master may be an interceptor too, must be reconnected. + if ( xSlave.is() == sal_True ) + { + xMaster->setSlaveDispatchProvider( xSlave ); + } + else + { + xMaster->setSlaveDispatchProvider( m_xDispatchHelper ); + } + } + + // Unchain the interceptor that has to be removed. + xInterceptor->setSlaveDispatchProvider( Reference< XDispatchProvider >() ); + xInterceptor->setMasterDispatchProvider( Reference< XDispatchProvider >() ); + + if ( m_xInterceptor == xInterceptor ) + { + // First interceptor was removed; its old slave will become the new interceptor. + m_xInterceptor = Reference< XDispatchProviderInterceptor >( xSlave, UNO_QUERY ); + } +} + +//***************************************************************************************************************** +// XBrowseHistoryRegistry +//***************************************************************************************************************** +void SAL_CALL Frame::updateViewData( const Any& aValue ) throw( RuntimeException ) +{ + LOG_ASSERT( sal_False, "Frame::updateViewData()\nNot implemented yet!\n" ) +} + +//***************************************************************************************************************** +// XBrowseHistoryRegistry +//***************************************************************************************************************** +void SAL_CALL Frame::createNewEntry( const OUString& sURL , + const Sequence< PropertyValue >& seqArguments, + const OUString& sTitle ) throw( RuntimeException ) +{ + LOG_ASSERT( sal_False, "Frame::createNewEntry()\nNot implemented yet!\n" ) +} + +//***************************************************************************************************************** +// XWindowListener +//***************************************************************************************************************** +void SAL_CALL Frame::windowResized( const WindowEvent& aEvent ) throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::windowResized()" ) + + // Safe impossible cases + LOG_ASSERT( impldbg_checkParameter_windowResized( aEvent ), "Frame::windowResized()\nInvalid parameter detected.\n" ) + + // If we have a current component window - we must resize it! + impl_resizeComponentWindow(); + + /*ASMUSS + if ( pIndicator && pIndicator->IsVisible() ) + { + // substract height of indicator window + Point aPos( aRectangleObject.TopLeft() ); + long nHeight = pIndicator->GetSizePixel().Height(); + aSize.Height() -= nHeight; + + // reposition indicatorwindow at the bottom its parent + pIndicator->SetPosSizePixel( 0, aPos.Y() + aSize.Height(), aSize.Width(), nHeight, WINDOW_POSSIZE_POSSIZE ); + } + */ +} + +//***************************************************************************************************************** +// XWindowListener +//***************************************************************************************************************** +void SAL_CALL Frame::windowMoved( const WindowEvent& aEvent ) throw( RuntimeException ) +{ +} + +//***************************************************************************************************************** +// XWindowListener +//***************************************************************************************************************** +void SAL_CALL Frame::windowShown( const EventObject& aEvent ) throw( RuntimeException ) +{ +} + +//***************************************************************************************************************** +// XWindowListener +//***************************************************************************************************************** +void SAL_CALL Frame::windowHidden( const EventObject& aEvent ) throw( RuntimeException ) +{ +} + +//***************************************************************************************************************** +// XTopWindowListener +//***************************************************************************************************************** +void SAL_CALL Frame::windowOpened( const EventObject& aEvent ) throw( RuntimeException ) +{ +} + +//***************************************************************************************************************** +// XTopWindowListener +//***************************************************************************************************************** +void SAL_CALL Frame::windowClosing( const EventObject& aEvent ) throw( RuntimeException ) +{ +} + +//***************************************************************************************************************** +// XTopWindowListener +//***************************************************************************************************************** +void SAL_CALL Frame::windowClosed( const EventObject& aEvent ) throw( RuntimeException ) +{ +} + +//***************************************************************************************************************** +// XTopWindowListener +//***************************************************************************************************************** +void SAL_CALL Frame::windowMinimized( const EventObject& aEvent ) throw( RuntimeException ) +{ +} + +//***************************************************************************************************************** +// XTopWindowListener +//***************************************************************************************************************** +void SAL_CALL Frame::windowNormalized( const EventObject& aEvent ) throw( RuntimeException ) +{ +} + +//***************************************************************************************************************** +// XTopWindowListener +//***************************************************************************************************************** +void SAL_CALL Frame::windowActivated( const EventObject& aEvent ) throw( RuntimeException ) +{ + // Activate the new active path from here to top. + if ( m_eActiveState == INACTIVE ) + { + LOCK_MUTEX( aGuard, m_aMutex, "Frame::windowActivated()" ) + + // Safe impossible cases + LOG_ASSERT( impldbg_checkParameter_windowActivated( aEvent ), "Frame::windowActivated()\nInvalid parameter detected.\n" ) + + setActiveFrame( Reference< XFrame >() ); + activate(); + } +} + +//***************************************************************************************************************** +// XTopWindowListener +//***************************************************************************************************************** +void SAL_CALL Frame::windowDeactivated( const EventObject& aEvent ) throw( RuntimeException ) +{ +} + +//***************************************************************************************************************** +// XFrame +//***************************************************************************************************************** +void SAL_CALL Frame::initialize( const Reference< XWindow >& xWindow ) throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::initialize()" ) + + // Safe impossible cases + LOG_ASSERT( impldbg_checkParameter_initialize( xWindow ), "Frame::initialize()\nInvalid parameter detected.\n" ) + LOG_ASSERT( !(m_xContainerWindow.is() == sal_True ) , "Frame::initialize()\nMethod already called! Don't do it again.\n") + + // Protection against more then one calls ... + if ( m_xContainerWindow.is() == sal_False ) + { + // ... and set the new window. + impl_setContainerWindow( xWindow ); + } +} + +//***************************************************************************************************************** +// XFrame +//***************************************************************************************************************** +Reference< XWindow > SAL_CALL Frame::getContainerWindow() throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::getContainerWindow()" ) + + // Return reference to my own window - if it exist! + return m_xContainerWindow; +} + +//***************************************************************************************************************** +// XFrame +//***************************************************************************************************************** +void SAL_CALL Frame::setCreator( const Reference< XFramesSupplier >& xCreator ) throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::setCreator()" ) + + // Safe impossible cases + LOG_ASSERT( impldbg_checkParameter_setCreator( xCreator ), "Frame::setCreator()\nInvalid parameter detected.\n" ) + + // Safe new reference to different parent. + m_xParent = xCreator; + // Set/reset "is top" flag, if ouer new parent a frame, task or a desktop. + m_bIsFrameTop = impl_willFrameTop( m_xParent ); +} + +//***************************************************************************************************************** +// XFrame +//***************************************************************************************************************** +Reference< XFramesSupplier > SAL_CALL Frame::getCreator() throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::getCreator()" ) + + // Return reference to my creator - It's my parent too. + return m_xParent; +} + +//***************************************************************************************************************** +// XFrame +//***************************************************************************************************************** +OUString SAL_CALL Frame::getName() throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::getName()" ) + + // Return name of this frame. + return m_sName; +} + +//***************************************************************************************************************** +// XFrame +//***************************************************************************************************************** +void SAL_CALL Frame::setName( const OUString& sName ) throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::setName()" ) + + // Safe impossible cases + LOG_ASSERT( impldbg_checkParameter_setName( sName ), "Frame::setName()\nInvalid parameter detected.\n" ) + + // Take the new one. + m_sName = sName; +} + +//***************************************************************************************************************** +// XFrame +//***************************************************************************************************************** +Reference< XFrame > SAL_CALL Frame::findFrame( const OUString& sTargetFrameName , + sal_Int32 nSearchFlags ) throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::findFrame()" ) + // Safe impossible cases + LOG_ASSERT( impldbg_checkParameter_findFrame( sTargetFrameName, nSearchFlags ), "Frame::findFrame()\nInvalid parameter detected.\n" ) + // Log some special informations about search. (Active in debug version only, if special mode is set!) + LOG_PARAMETER_FINDFRAME( "Frame", m_sName, sTargetFrameName, nSearchFlags ) + + // Set default return Value, if method failed + Reference< XFrame > xReturn = Reference< XFrame >(); + + // Protection against recursion while searching in parent frames! + // See search for PARENT for further informations. + if ( m_bRecursiveSearchProtection == sal_False ) + { + //************************************************************************************************************* + // 1) Search for "_self" or ""!. We handle this as self too! + //************************************************************************************************************* + if ( + ( sTargetFrameName == FRAMETYPE_SELF ) || + ( sTargetFrameName.getLength() < 1 ) + ) + { + LOG_TARGETINGSTEP( "Frame", m_sName, "react to \"_self\" or \"\"" ) + xReturn = Reference< XFrame >( static_cast< OWeakObject* >( this ), UNO_QUERY ); + } + else + //************************************************************************************************************* + // 2) If "_top" searched and we have no parent set us for return himself. + //************************************************************************************************************* + if( sTargetFrameName == FRAMETYPE_TOP ) + { + LOG_TARGETINGSTEP( "Frame", m_sName, "react to \"_top\"" ) + if( m_xParent.is() == sal_False ) + { + // If no parent well known we are the top frame! + LOG_TARGETINGSTEP( "Frame", m_sName, "no parent exist!" ) + xReturn = Reference< XFrame >( static_cast< OWeakObject* >( this ), UNO_QUERY ); + } + else + { + // If parent well kwnown we must forward searching to it. + LOG_TARGETINGSTEP( "Frame", m_sName, "parent exist!" ) + xReturn = m_xParent->findFrame( FRAMETYPE_TOP, 0 ); + } + } + else + //************************************************************************************************************* + // 3) If "_parent" searched and we have any one, set it for return. + //************************************************************************************************************* + if( sTargetFrameName == FRAMETYPE_PARENT ) + { + LOG_TARGETINGSTEP( "Frame", m_sName, "react to \"_parent\"" ) + if( m_xParent.is() == sal_True ) + { + // If parent well kwnown we must return it as result. + LOG_TARGETINGSTEP( "Frame", m_sName, "parent exist!" ) + xReturn = Reference< XFrame >( m_xParent, UNO_QUERY ); + } + else + { + // Else we can't return anything and our default is used! + LOG_TARGETINGSTEP( "Frame", m_sName, "no parent exist!" ) + } + } + else + //************************************************************************************************************* + // 4) Forward "_blank" to desktop. He can create new task only! + // (Look for existing parent!) + //************************************************************************************************************* + if( sTargetFrameName == FRAMETYPE_BLANK ) + { + LOG_TARGETINGSTEP( "Frame", m_sName, "react to \"_blank\"" ) + if( m_xParent.is() == sal_True ) + { + LOG_TARGETINGSTEP( "Frame", m_sName, "forward \"_blank\" to parent" ) + xReturn = m_xParent->findFrame( FRAMETYPE_BLANK, 0 ); + } + else + { + // Else we cant create this new frame! + LOG_TARGETINGSTEP( "Frame", m_sName, "can create new frame for \"_blank\"" ) + } + } + else + //************************************************************************************************************* + // ATTENTION! + // We have searched for special targets only ... but now we must search for any named frames and use search + // flags to do that! + //************************************************************************************************************* + { + //********************************************************************************************************* + // At first we must filter all other special target names! + // You can disable this statement if all these cases are handled before ... + //********************************************************************************************************* +/* + if ( + ( sTargetFrameName != FRAMETYPE_SELF ) && + ( sTargetFrameName != FRAMETYPE_PARENT) && + ( sTargetFrameName != FRAMETYPE_TOP ) && + ( sTargetFrameName != FRAMETYPE_BLANK ) && + ( sTargetFrameName.getLength() > 0 ) + ) +*/ + { + //***************************************************************************************************** + // 5) If SELF searched and given name is the right one, we can return us as result. + //***************************************************************************************************** + if ( + ( nSearchFlags & FrameSearchFlag::SELF ) && + ( sTargetFrameName == m_sName ) + ) + { + LOG_TARGETINGSTEP( "Frame", m_sName, "react to SELF" ) + xReturn = Reference< XFrame >( static_cast< OWeakObject* >( this ), UNO_QUERY ); + } + //***************************************************************************************************** + // 6) If SELF searched and given name is the right one, we can return us as result. + //***************************************************************************************************** + if ( + ( xReturn.is() == sal_False ) && + ( nSearchFlags & FrameSearchFlag::PARENT ) && + ( m_xParent.is() == sal_True ) + ) + { + // We must protect us against searching from top to bottom! + m_bRecursiveSearchProtection = sal_True ; + LOG_TARGETINGSTEP( "Frame", m_sName, "forward PARENT to parent" ) + xReturn = m_xParent->findFrame( sTargetFrameName, nSearchFlags ); + m_bRecursiveSearchProtection = sal_False ; + } + //************************************************************************************************************* + // 7) Search for CHILDREN. + //************************************************************************************************************* + if ( + ( xReturn.is() == sal_False ) && + ( nSearchFlags & FrameSearchFlag::CHILDREN ) && + ( m_aChildFrameContainer.hasElements() == sal_True ) + ) + { + LOG_TARGETINGSTEP( "Frame", m_sName, "react to CHILDREN" ) + // Search at own container of childframes if allowed. + // Lock the container. Nobody should append or remove elements during next time. + // But don't forget to unlock it again! + m_aChildFrameContainer.lock(); + + // First search only for direct subframes. + // Break loop, if something was found or all container items was compared. + sal_uInt32 nCount = m_aChildFrameContainer.getCount(); + sal_uInt32 nPosition = 0; + while ( + ( xReturn.is() == sal_False ) && + ( nPosition < nCount ) + ) + { + xReturn = m_aChildFrameContainer[nPosition]->findFrame( sTargetFrameName, FrameSearchFlag::SELF ); + ++nPosition; + } + + // If no direct subframe was found, search now subframes of subframes. + nPosition = 0; + while ( + ( xReturn.is() == sal_False ) && + ( nPosition < nCount ) + ) + { + xReturn = m_aChildFrameContainer[nPosition]->findFrame( sTargetFrameName, FrameSearchFlag::CHILDREN ); + ++nPosition; + } + + // Don't forget to unlock the container! + m_aChildFrameContainer.unlock(); + } + //************************************************************************************************************* + // 8) Search for SIBLINGS. + // Attention: + // Continue search on brothers ( subframes of parent ) but don't let them search their brothers too ... + // If FrameSearchFlag_CHILDREN is set, the children of the brothers will be searched also, otherwise not. + //************************************************************************************************************* + if ( + ( xReturn.is() == sal_False ) && + ( nSearchFlags & FrameSearchFlag::SIBLINGS ) && + ( m_xParent.is() == sal_True ) + ) + { + LOG_TARGETINGSTEP( "Frame", m_sName, "react to SIBLINGS" ) + // Get all siblings from ouer parent and collect some informations about result set. + // Count of siblings, access to list ... + Reference< XFrames > xFrames = m_xParent->getFrames(); + Sequence< Reference< XFrame > > seqFrames = xFrames->queryFrames( FrameSearchFlag::CHILDREN ); + Reference< XFrame >* pArray = seqFrames.getArray(); + sal_uInt16 nCount = (sal_uInt16)seqFrames.getLength(); + + Reference< XFrame > xThis ( (OWeakObject*)this, UNO_QUERY ); + Reference< XFrame > xSearchFrame; + + // Search siblings "pure" - no search on brothers of brothers - no search at children of siblings! + // Break loop, if something was found or all items was threated. + sal_uInt16 nPosition = 0; + while ( + ( xReturn.is() == sal_False ) && + ( nPosition < nCount ) + ) + { + // Exclude THIS frame! We are a child of ouer parent and exist in result list of "queryFrames()" too. + if ( pArray[nPosition] != xThis ) + { + xReturn = pArray[nPosition]->findFrame( sTargetFrameName, FrameSearchFlag::SELF ); + } + ++nPosition; + } + + // If no sibling match ouer search, try it again with children of ouer siblings. + nPosition = 0; + while ( + ( xReturn.is() == sal_False ) && + ( nPosition < nCount ) + ) + { + // Exclude THIS frame again. + if ( pArray[nPosition] != xThis ) + { + xReturn = pArray[nPosition]->findFrame( sTargetFrameName, FrameSearchFlag::CHILDREN ); + } + ++nPosition; + } + } + //************************************************************************************************************* + // 9) Search for TASKS. + // Attention: + // The Task-implementation control these flag too! But if search started from the bottom of the tree, we must + // forward it to ouer parents. They can be tasks only! + //************************************************************************************************************* + if ( + ( xReturn.is() == sal_False ) && + ( nSearchFlags & FrameSearchFlag::TASKS ) && + ( m_xParent.is() == sal_True ) + ) + { + // We must protect us against recursive calls from top to bottom. + m_bRecursiveSearchProtection = sal_True ; + LOG_TARGETINGSTEP( "Frame", m_sName, "forward TASKS to parent" ) + xReturn = m_xParent->findFrame( sTargetFrameName, nSearchFlags ); + m_bRecursiveSearchProtection = sal_False; + } + //************************************************************************************************************* + // 10) If CREATE is set we must forward call to desktop. He is the only one, who can do that. + //************************************************************************************************************* + /* + Praeprozessor Bug! + Wenn nach CREATE ein Space steht wird versucht es durch das Define CREATE aus tools/rtti.hxx zu ersetzen + was fehlschlaegt und die naechsten 3 Klammern ")){" unterschlaegt! + Dann meckert der Compiler das natuerlich an ... + */ + if((xReturn.is()==sal_False)&&(nSearchFlags&FrameSearchFlag::CREATE)&&(m_xParent.is()==sal_True)) + { + LOG_TARGETINGSTEP( "Frame", m_sName, "forward CREATE to parent" ) + xReturn = m_xParent->findFrame( sTargetFrameName, FrameSearchFlag::CREATE ); + } + } + } + } + + // Log some special informations about search. (Active in debug version only, if special mode is set!) + LOG_RESULT_FINDFRAME( "Frame", m_sName, xReturn ) + // Return with result of operation. + return xReturn; +} + +/* +Reference< XFrame > SAL_CALL Frame::findFrame( const OUString& sTargetFrameName , + sal_Int32 nSearchFlags ) throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::findFrame()" ) + // Safe impossible cases + LOG_ASSERT( impldbg_checkParameter_findFrame( sTargetFrameName, nSearchFlags ), "Frame::findFrame()\nInvalid parameter detected.\n" ) + // Log some special informations about search. (Active in debug version only, if special mode in debug.h is set!) + LOG_PARAMETER_FINDFRAME( "Frame", m_sName, sTargetFrameName, nSearchFlags ) + + // Set default return Value, if method failed + Reference< XFrame > xReturn = Reference< XFrame >(); + + // protect against recursion while searching in parent frames! + if ( m_bRecursiveSearchProtection == sal_False ) + { + // Attention: First look for special target frame names! Then use searchflags. + + //************************************************************************************************************* + // 1) Search for "_self" or ""!. We handle this as self too! + //************************************************************************************************************* + if ( + ( xReturn.is() == sal_False ) && + ( + ( sTargetFrameName == FRAMETYPE_SELF ) || + ( sTargetFrameName.getLength() < 1 ) + ) + ) + { + xReturn = Reference< XFrame >( static_cast< OWeakObject* >( this ), UNO_QUERY ); + // Log some special informations about search. (Active in debug version only, if special mode in debug.h is set!) + LOG_TARGETINGSTEP( "Frame", m_sName, xReturn.is() ? "_self found" : "_self failed" ) + } + + //************************************************************************************************************* + // 2) If "_parent" searched and we have any one, set it for return. + //************************************************************************************************************* + if ( + ( xReturn.is() == sal_False ) && + ( m_xParent.is() == sal_True ) && + ( sTargetFrameName == FRAMETYPE_PARENT ) + ) + { + xReturn = Reference< XFrame >( m_xParent, UNO_QUERY ); + // Log some special informations about search. (Active in debug version only, if special mode in debug.h is set!) + LOG_TARGETINGSTEP( "Frame", m_sName, xReturn.is() ? "_parent found" : "_parent failed" ) + } + + //************************************************************************************************************* + // 3) If "_top" searched and we have no parent set us for return himself. + //************************************************************************************************************* + if ( + ( xReturn.is() == sal_False ) && + ( sTargetFrameName == FRAMETYPE_TOP ) + ) + { + if( m_xParent.is() == sal_False ) + { + // If no parent well known we are the top frame! + xReturn = Reference< XFrame >( static_cast< OWeakObject* >( this ), UNO_QUERY ); + } + else + { + // If parent well kwnown we must forward search to it. + xReturn = m_xParent->findFrame( FRAMETYPE_TOP, 0 ); + } + // Log some special informations about search. (Active in debug version only, if special mode in debug.h is set!) + LOG_TARGETINGSTEP( "Frame", m_sName, xReturn.is() ? "_top found" : "_top failed" ) + } + + //************************************************************************************************************* + // 4) Forward "_blank" to parent. Desktop can create new task only! + // (Look for existing parent!) + //************************************************************************************************************* + if ( + ( xReturn.is() == sal_False ) && + ( m_xParent.is() == sal_True ) && + ( sTargetFrameName == FRAMETYPE_BLANK ) + ) + { + xReturn = m_xParent->findFrame( FRAMETYPE_BLANK, 0 ); + // Log some special informations about search. (Active in debug version only, if special mode in debug.h is set!) + LOG_TARGETINGSTEP( "Frame", m_sName, xReturn.is() ? "_blank found" : "_blank failed" ) + } + + //************************************************************************************************************* + // 5) Search for SELF. + //************************************************************************************************************* + if ( + ( xReturn.is() == sal_False ) && + ( nSearchFlags & FrameSearchFlag::SELF ) && + ( sTargetFrameName == m_sName ) + ) + { + xReturn = Reference< XFrame >( static_cast< OWeakObject* >( this ), UNO_QUERY ); + // Log some special informations about search. (Active in debug version only, if special mode in debug.h is set!) + LOG_TARGETINGSTEP( "Frame", m_sName, xReturn.is() ? "SELF found" : "SELF failed" ) + } + + //************************************************************************************************************* + // 6) Search for PARENT. + //************************************************************************************************************* + if ( + ( xReturn.is() == sal_False ) && + ( m_xParent.is() == sal_True ) && + ( nSearchFlags & FrameSearchFlag::PARENT ) + ) + { + m_bRecursiveSearchProtection = sal_True ; + + xReturn = m_xParent->findFrame( sTargetFrameName, nSearchFlags ); + // Log some special informations about search. (Active in debug version only, if special mode in debug.h is set!) +// LOG_SEARCHRESULT( m_sName, xReturn.is() ? "PARENT found" : "PARENT failed" ) + + m_bRecursiveSearchProtection = sal_False ; + } + + //************************************************************************************************************* + // 7) Search for SIBLINGS. + // Attention: + // Continue search on brothers ( subframes of parent ) but don't let them search their brothers too ... + // If FrameSearchFlag_CHILDREN is set, the children of the brothers will be searched also, otherwise not. + //************************************************************************************************************* + if ( + ( xReturn.is() == sal_False ) && + ( m_xParent.is() == sal_True ) && + ( nSearchFlags & FrameSearchFlag::SIBLINGS ) + ) + { + // Get all siblings from ouer parent and collect some informations about result set. + // Count of siblings, access to list ... + Reference< XFrames > xFrames = m_xParent->getFrames(); + Sequence< Reference< XFrame > > seqFrames = xFrames->queryFrames( FrameSearchFlag::SIBLINGS ); + Reference< XFrame >* pArray = seqFrames.getArray(); + sal_uInt16 nCount = (sal_uInt16)seqFrames.getLength(); + + Reference< XFrame > xThis ( (OWeakObject*)this, UNO_QUERY ); + Reference< XFrame > xSearchFrame; + + // Search siblings "pure" - no search on brothers of brothers - no search at children of siblings! + // Break loop, if something was found or all items was treated. + sal_uInt16 nPosition = 0; + while ( + ( xReturn.is() == sal_False ) && + ( nPosition < nCount ) + ) + { + // Exclude THIS frame! We are a child of ouer parent and exist in result list of "queryFrames()" to. + if ( pArray[nPosition] != xThis ) + { + xReturn = pArray[nPosition]->findFrame( sTargetFrameName, FrameSearchFlag::SELF ); + } + ++nPosition; + } + + // If no sibling match ouer search, try it again with children of ouer siblings. + nPosition = 0; + while ( + ( xReturn.is() == sal_False ) && + ( nPosition < nCount ) + ) + { + // Exclude THIS frame again. + if ( pArray[nPosition] != xThis ) + { + xReturn = pArray[nPosition]->findFrame( sTargetFrameName, FrameSearchFlag::CHILDREN ); + } + ++nPosition; + } + // Log some special informations about search. (Active in debug version only, if special mode in debug.h is set!) +// LOG_SEARCHRESULT( m_sName, xReturn.is() ? "SIBLINGS found" : "SIBLINGS failed" ) + } + + //************************************************************************************************************* + // 8) Search for TASKS. + // Attention: + // The Task-implementation control these flag to! But if search started from the bottom of the tree, we must + // forward it to ouer parents. They can be tasks only! + //************************************************************************************************************* + if ( + ( xReturn.is() == sal_False ) && + ( m_xParent.is() == sal_True ) && + ( nSearchFlags & FrameSearchFlag::TASKS ) + ) + { + m_bRecursiveSearchProtection = sal_True ; + + Reference< XFrame > xParentFrame( m_xParent, UNO_QUERY ); + xReturn = xParentFrame->findFrame( sTargetFrameName, nSearchFlags | FrameSearchFlag::CHILDREN | FrameSearchFlag::SIBLINGS ); + // Log some special informations about search. (Active in debug version only, if special mode in debug.h is set!) +// LOG_SEARCHRESULT( m_sName, xReturn.is() ? "TASKS found" : "TASKS failed" ) + + m_bRecursiveSearchProtection = sal_False; + } + + //************************************************************************************************************* + // 9) Search for CHILDREN. + //************************************************************************************************************* + if ( + ( xReturn.is() == sal_False ) && + ( m_aChildFrameContainer.hasElements() == sal_True ) && + ( nSearchFlags & FrameSearchFlag::CHILDREN ) + ) + { + // Search at own container of childframes if allowed. + // Lock the container. Nobody should append or remove elements during next time. + // But don't forget to unlock it again! + m_aChildFrameContainer.lock(); + + // First search only for direct subframes. + // Break loop, if something was found or all container items was compared. + sal_uInt32 nCount = m_aChildFrameContainer.getCount(); + sal_uInt32 nPosition = 0; + while ( + ( xReturn.is() == sal_False ) && + ( nPosition < nCount ) + ) + { + xReturn = m_aChildFrameContainer[nPosition]->findFrame( sTargetFrameName, FrameSearchFlag::SELF ); + ++nPosition; + } + + // If no direct subframe was found, search now subframes of subframes. + nPosition = 0; + while ( + ( xReturn.is() == sal_False ) && + ( nPosition < nCount ) + ) + { + xReturn = m_aChildFrameContainer[nPosition]->findFrame( sTargetFrameName, FrameSearchFlag::CHILDREN ); + ++nPosition; + } + + // Don't forget to unlock the container! + m_aChildFrameContainer.unlock(); + // Log some special informations about search. (Active in debug version only, if special mode in debug.h is set!) +// LOG_SEARCHRESULT( m_sName, xReturn.is() ? "CHILDREN found" : "CHILDREN failed" ) + } + + + +/* + + + //************************************************************************************************************* + if ( + ( xParentFrame.is() == sal_True ) && + ( sTargetFrameName.compareToAscii( "_tool:", 6 ) == STRINGEQUAL ) && + ( nSearchFlags & FrameSearchFlag::PARENT ) + ) + { + // Maybe the tool frame lies above. + // Return ouer parent as found frame. + xReturn = xParentFrame; + } + //************************************************************************************************************* + //************************************************************************************************************* + if ( + ( xParentFrame.is() == sal_True ) && + ( sTargetFrameName.compareTo( FRAMETYPE_PARENT ) == STRINGEQUAL ) && + ( xParentFrame.is() == sal_True ) + ) + { + // Return the XFrame interface from the parent container. + xReturn = xParentFrame; + } + else + //************************************************************************************************************* + if ( + ( sTargetFrameName.compareTo( FRAMETYPE_TOP ) == STRINGEQUAL ) || + ( sTargetFrameName.compareTo( FRAMETYPE_DOCUMENT) == STRINGEQUAL ) + ) + { + // Return the XFrame interface of the uppermost XFrameContainer. + // If there no parent - we are the topframe himself! + if ( m_bIsFrameTop == sal_True ) + { + xReturn = Reference< XFrame >( (OWeakObject*)this, UNO_QUERY ); + } + else + if ( xParentFrame.is() == sal_True ) + { + xReturn = xParentFrame->findFrame( sTargetFrameName, nSearchFlags ); + } + } + else + //************************************************************************************************************* + if ( + ( sTargetFrameName.compareTo( FRAMETYPE_BEAMER ) == STRINGEQUAL ) || + ( sTargetFrameName.compareTo( FRAMETYPE_EXPLORER ) == STRINGEQUAL ) || + ( sTargetFrameName.compareTo( FRAMETYPE_PARTWINDOW ) == STRINGEQUAL ) + ) + { + //ASMUSS + sal_uInt16 nID; + + if ( sTargetFrameName.compareToAscii( "_beamer" ) == COMPARE_EQUAL ) + nId = SID_BROWSER; + else if ( aName.CompareToAscii("_explorer") == COMPARE_EQUAL ) + nId = SID_EXPLORER; + else if ( aName.CompareToAscii("_partwindow") == COMPARE_EQUAL ) + nId = SID_PARTWIN; + + SfxApplication *pApp = SFX_APP(); + if ( !pApp->HasChildWindow( nId ) ) + { + // Beamer nicht da + if ( ( nSearchFlags & ::com::sun::star::frame::FrameSearchFlag::CREATE ) == 0 ) + return ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > (); + + pApp->SetChildWindow( nId, sal_True ); + pApp->GetBindings().Invalidate( nId ); + } + + SfxChildWindow *pChild = pApp->GetChildWindow( nId ); + if ( pChild ) + { + // SBI: #62242 der _explorer hat kein SfxExplorerHorizDockWnd_Impl - ChildWindow + // sodern ein SfxExplorerDockWnd_Impl + if ( SID_BROWSER == nId ) + { + // Einen versteckten Beamer gebe ich nur raus, wenn ich zum Erzeugen + // gen"otigt werde + SfxExplorerHorizDockWnd_Impl *pBeamer = (SfxExplorerHorizDockWnd_Impl*) pChild->GetWindow(); + if ( pBeamer->IsAutoHide_Impl() && ( ( nSearchFlags & ::com::sun::star::frame::FrameSearchFlag::CREATE ) == 0 ) ) + return ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > (); + } + + return pChild->GetFrame(); + } + else + return ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > (); + } + else + //************************************************************************************************************* + // Get a new TaskFrame and a TopFrame inside the task. + if ( sTargetFrameName.compareTo( FRAMETYPE_BLANK ) == STRINGEQUAL ) + { + //ASMUSS + SfxTask *pTask = SfxTaskManager::CreateTask(); + SfxFrame *pFrame = pTask->CreateFrame(); + return pFrame->GetFrameInterface(); + } + else + //************************************************************************************************************* + // Search parent if allowed; parent may create a new frame. + if ( + ( nSearchFlags & FrameSearchFlag::PARENT ) && + ( xParentFrame.is() == sal_True ) && + ( + ( m_bIsFrameTop == sal_True ) || + ( nSearchFlags & FrameSearchFlag::TASKS ) + ) + ) + { + m_bRecursiveSearchProtection = sal_True ; + xReturn = xParentFrame->findFrame( sTargetFrameName, nSearchFlags | FrameSearchFlag::CHILDREN | FrameSearchFlag::SIBLINGS ); + m_bRecursiveSearchProtection = sal_False; + } + else + //************************************************************************************************************* + // Create a new TopFrame. + if ( + ( m_bIsFrameTop == sal_True ) && + ( nSearchFlags & ( FrameSearchFlag::CREATE | FrameSearchFlag::TASKS ) ) + ) + { + /*ASMUSS + if ( pOwner ) + { + SfxTask *pTask = pOwner->GetTask(); + if ( pTask ) + { + SfxFrame *pFrame = pTask->CreateFrame(); + pFrame->SetFrameName( aTargetframename ); + return pFrame->GetFrameInterface(); + } + } + else if ( nSearchFlags & ::com::sun::star::frame::FrameSearchFlag::TASKS ) + { + SfxTask* pTask = SfxTaskManager::CreateTask(); + SfxFrame *pFrame = pTask->CreateFrame(); + pFrame->SetFrameName( aTargetframename ); + return pFrame->GetFrameInterface(); + } + } + } + + // Log some special informations about search. (Active in debug version only, if special mode in debug.h is set!) +// LOG_SEARCHRESULT( m_sName, "End of search in Frame" ) + + // Return result of this operation. + return xReturn; +} +*/ +//***************************************************************************************************************** +// XFrame +//***************************************************************************************************************** +sal_Bool SAL_CALL Frame::isTop() throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::isTop()" ) + + // Return state of this instance. + // This information is set in setCreator()! + // We are top, if ouer parent is a task or the desktop. + return m_bIsFrameTop; +} + +//***************************************************************************************************************** +// XFrame +//***************************************************************************************************************** +void SAL_CALL Frame::activate() throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::activate()" ) + + // Get the current active child frame. + Reference< XFrame > xActiveChild = m_aChildFrameContainer.getActive(); + + //_____________________________________________________________________________________________________________ + // 1) + // If I'am not active before ... + if ( m_eActiveState == INACTIVE ) + { + // ... do it then. + m_eActiveState = ACTIVE; + // Deactivate sibling path and forward activation to parent ... if any parent exist! + if ( m_xParent.is() == sal_True ) + { + // Everytime set THIS frame as active child of parent and activate it. + // We MUST have a valid path from bottom to top as active path! + // But we must deactivate the old active sibling path first. + + // Attention: Deactivation of an active path, deactivate the whole path ... from bottom to top! + // But we wish to deactivate founded sibling-tree only. + // [ see deactivate() / step 4) for further informations! ] + + m_xParent->setActiveFrame( this ); + + // Then we can activate from here to top. + // Attention: We are ACTIVE now. And the parent will call activate() at us! + // But we do nothing then! We are already activated. + m_xParent->activate(); + } + // Its neccessary to send event NOW - not before. + // Activation goes from bottom to top! + // Thats the reason to activate parent first and send event now. + impl_sendFrameActionEvent( FrameAction_FRAME_ACTIVATED ); + } + + //_____________________________________________________________________________________________________________ + // 2) + // Else; + // I was active before or current activated and there is a path from here to bottom, who CAN be active. + // But ouer direct child of path is not active yet. + // (It can be, if activation occur in the middle of a current path!) + // In these case we activate path to bottom to set focus on right frame! + if ( + ( m_eActiveState == ACTIVE ) && + ( xActiveChild.is() == sal_True ) && + ( xActiveChild->isActive() == sal_False ) + ) + { + xActiveChild->activate(); + } + + //_____________________________________________________________________________________________________________ + // 3) + // I was active before or current activated. But if i have no active child => i will become the focus! + if ( + ( m_eActiveState == ACTIVE ) && + ( xActiveChild.is() == sal_False ) + ) + { + // Set FOCUS-state and send event to all listener. +// if( m_xComponentWindow.is() == sal_True ) +// { +// m_xComponentWindow->setFocus(); +// } + m_eActiveState = FOCUS; + impl_sendFrameActionEvent( FrameAction_FRAME_UI_ACTIVATED ); + } +} + +//***************************************************************************************************************** +// XFrame +//***************************************************************************************************************** +void SAL_CALL Frame::deactivate() throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::deactivate()" ) + + // Work only, if there something to do! + if ( m_eActiveState != INACTIVE ) + { + //_____________________________________________________________________________________________________________ + // 1) + // Deactivate all active childs. + Reference< XFrame > xActiveChild = m_aChildFrameContainer.getActive(); + if (( xActiveChild.is() == sal_True ) && ( xActiveChild->isActive() == sal_True )) + { + xActiveChild->deactivate(); + } + + //_____________________________________________________________________________________________________________ + // 2) + // If i have the focus - i will lost it now. + if ( m_eActiveState == FOCUS ) + { + // Set new state INACTIVE(!) and send message to all listener. + // Don't set ACTIVE as new state. This frame is deactivated for next time - due to activate(). + m_eActiveState = ACTIVE; + impl_sendFrameActionEvent( FrameAction_FRAME_UI_DEACTIVATING ); + } + + //_____________________________________________________________________________________________________________ + // 3) + // If i'am active - i will be deactivated now. + if ( m_eActiveState == ACTIVE ) + { + // Set new state and send message to all listener. + m_eActiveState = INACTIVE; + impl_sendFrameActionEvent( FrameAction_FRAME_DEACTIVATING ); + } + + //_____________________________________________________________________________________________________________ + // 4) + // If there is a path from here to my parent ... + // ... I'am on the top or in the middle of deactivated subtree and action was started here. + // I must deactivate all frames from here to top, which are members of current path. + // Stop, if THESE frame not the active frame of ouer parent! + Reference< XFrame > xTHIS( (OWeakObject*)this, UNO_QUERY ); + if ( + ( m_xParent.is() == sal_True ) && + ( m_xParent->getActiveFrame() == xTHIS ) + ) + { + // We MUST break the path - otherwise we will get the focus - not ouer parent! ... + // Attention: Ouer parent don't call us again - WE ARE NOT ACTIVE YET! + // [ see step 3 and condition "if ( m_eActiveState!=INACTIVE ) ..." in this method! ] + m_xParent->deactivate(); + } + } +} + +//***************************************************************************************************************** +// XFrame +//***************************************************************************************************************** +sal_Bool SAL_CALL Frame::isActive() throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::isActive()" ) + + // Set default return value to NO. + sal_Bool bReturn = sal_False; + + // If i'am a member of the current active path ... reset return value to YES. + if ( + ( m_eActiveState == ACTIVE ) || + ( m_eActiveState == FOCUS ) + ) + { + bReturn = sal_True; + } + + // Return result of this operation. + return bReturn; +} + +//***************************************************************************************************************** +// XFrame +//***************************************************************************************************************** +sal_Bool SAL_CALL Frame::setComponent( const Reference< XWindow >& xComponentWindow , + const Reference< XController >& xController ) throw( RuntimeException ) +{ + /* HACK for sfx2! */ + if ( xController.is() && !xComponentWindow.is() ) + return sal_False; + /* HACK for sfx2! */ + + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::setComponent()" ) + // Safe impossible cases + LOG_ASSERT( impldbg_checkParameter_setComponent( xComponentWindow, xController ), "Frame::setComponent()\nInvalid parameter detected.\n" ) + + // Release current component, if any exist. + if ( + ( m_xController.is() == sal_True ) || + ( m_xComponentWindow.is() == sal_True ) + ) + { + // Send FrameAction-event to all listener. + impl_sendFrameActionEvent( FrameAction_COMPONENT_DETACHING ); + } + + // always release controller before releasing window, because controller may want to access its window + sal_Bool bNewController = ( m_xController != xController ); + sal_Bool bNewWindow = ( m_xComponentWindow != xComponentWindow ); + + if( bNewController == sal_True ) + { + impl_setController( Reference< XController >() ); + } + if( bNewWindow == sal_True ) + { + impl_setComponentWindow( xComponentWindow ); + } + if( bNewController == sal_True ) + { + impl_setController( xController ); + } + + // Send FrameActionEvent to all listener + if ( + ( m_xController.is() == sal_True ) || + ( m_xComponentWindow.is() == sal_True ) + ) + { + if ( m_bConnected == sal_True ) + { + impl_sendFrameActionEvent( FrameAction_COMPONENT_REATTACHED ); + } + else + { + impl_sendFrameActionEvent( FrameAction_COMPONENT_ATTACHED ); + } + } + + m_bConnected = sal_True; + + // A new component don't know anything about current active/focus states! + // We must tell her these now. + if ( + ( m_eActiveState == FOCUS ) && + ( m_xComponentWindow.is() == sal_True ) + ) + { + m_xComponentWindow->setFocus(); + } + + // Return with result of this operation. + return sal_True; +} + +//***************************************************************************************************************** +// XFrame +//***************************************************************************************************************** +Reference< XWindow > SAL_CALL Frame::getComponentWindow() throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::getComponentWindow()" ) + + return m_xComponentWindow; +} + +//***************************************************************************************************************** +// XFrame +//***************************************************************************************************************** +Reference< XController > SAL_CALL Frame::getController() throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::getController()" ) + + // Return current controller. + return m_xController; +} + +//***************************************************************************************************************** +// XFrame +//***************************************************************************************************************** +void SAL_CALL Frame::contextChanged() throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::contextChanged()" ) + // Send event to all istener for frame actions. + impl_sendFrameActionEvent( FrameAction_CONTEXT_CHANGED ); +} + +//***************************************************************************************************************** +// XFrame +//***************************************************************************************************************** +void SAL_CALL Frame::addFrameActionListener( const Reference< XFrameActionListener >& xListener ) throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::addFrameActionListener()" ) + + // Safe impossible cases + LOG_ASSERT( impldbg_checkParameter_addFrameActionListener( xListener ), "Frame::addFrameActionListener()\nInvalid parameter detected.\n" ) + + // Add listener to container + m_aListenerContainer.addInterface( ::getCppuType( ( const Reference< XFrameActionListener >* ) NULL ), xListener ); +} + +//***************************************************************************************************************** +// XFrame +//***************************************************************************************************************** +void SAL_CALL Frame::removeFrameActionListener( const Reference< XFrameActionListener >& xListener ) throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::removeFrameActionListener()" ) + + // Safe impossible cases + LOG_ASSERT( impldbg_checkParameter_removeFrameActionListener( xListener ), "Frame::removeFrameActionListener()\nInvalid parameter detected.\n" ) + + // Rmove listener from container + m_aListenerContainer.removeInterface( ::getCppuType( ( const Reference< XFrameActionListener >* ) NULL ), xListener ); +} + +//***************************************************************************************************************** +// XComponent +//***************************************************************************************************************** +void SAL_CALL Frame::dispose() throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::dispose()" ) + + // Protection against recursive disposing! + if ( m_bAlreadyDisposed == sal_False ) + { + // Set flag against recursive or following calls. + m_bAlreadyDisposed = sal_True ; + // Send message to all DISPOSE-listener. + impl_sendDisposeEvent(); + // Free memory, release references and ... + /* // Cancel current loading. + if ( m_xLoader.is() == sal_True ) + { + m_xLoader->cancel(); + m_xLoader = Reference< XFrameLoader >(); + } + */ + // Delete current component and controller. + setComponent( Reference< XWindow >(), Reference< XController >() ); + + // Tell all listeners to release this object. + Reference< XFrame > xThis( (OWeakObject*)this, UNO_QUERY ); + + EventObject aEvent; + aEvent.Source = xThis; + m_aListenerContainer.disposeAndClear( aEvent ); + + // Force parent container to forget this frame. + // ( It's contained in m_xParent and so no XEventListener for m_xParent! ) + if ( m_xParent.is() == sal_True ) + { + m_xParent->getFrames()->remove( xThis ); + m_xParent=Reference< XFramesSupplier >(); + } + + // Release current interceptor. + while ( m_xInterceptor.is() == sal_True ) + { + releaseDispatchProviderInterceptor( m_xInterceptor ); + } + + // Release current indicator. + m_xIndicator = Reference< XStatusIndicator >(); + + // If we have our own window ... release it! + if ( m_xContainerWindow.is() == sal_True ) + { + impl_setContainerWindow( Reference< XWindow >() ); + } + + // Forget global servicemanager + m_xFactory = Reference< XMultiServiceFactory >(); + + // Free memory for container and other helper. + m_aChildFrameContainer.clear(); + m_xFramesHelper = Reference< XFrames >(); + + // Reset flags and other members ... + m_eActiveState = DEFAULT_EACTIVESTATE ; + m_bRecursiveSearchProtection = DEFAULT_BRECURSIVESEARCHPROTECTION; + m_bIsFrameTop = DEFAULT_BISFRAMETOP ; + m_bAlreadyDisposed = DEFAULT_BALREADYDISPOSED ; + m_bConnected = DEFAULT_BCONNECTED ; + m_bILoadLastComponent = DEFAULT_BILOADLASTCOMPONENT ; + m_sName = DEFAULT_SNAME ; + } +} + +//***************************************************************************************************************** +// XComponent +//***************************************************************************************************************** +void SAL_CALL Frame::addEventListener( const Reference< XEventListener >& xListener ) throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::addEventListener()" ) + + // Safe impossible cases + LOG_ASSERT( impldbg_checkParameter_addEventListener( xListener ), "Frame::addEventListener()\nInvalid parameter detected.\n" ) + + // Add listener to container. + m_aListenerContainer.addInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), xListener ); +} + +//***************************************************************************************************************** +// XComponent +//***************************************************************************************************************** +void SAL_CALL Frame::removeEventListener( const Reference< XEventListener >& xListener ) throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::removeEventListener()" ) + + // Safe impossible cases + LOG_ASSERT( impldbg_checkParameter_removeEventListener( xListener ), "Frame::removeEventListener()\nInvalid parameter detected.\n" ) + + // Add listener to container. + m_aListenerContainer.removeInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), xListener ); +} + +//***************************************************************************************************************** +// XEventListener +//***************************************************************************************************************** +void SAL_CALL Frame::disposing( const EventObject& aEvent ) throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::disposing()" ) + + // Safe impossible cases + LOG_ASSERT( impldbg_checkParameter_disposing( aEvent ), "Frame::disposing()\nInvalid parameter detected.\n" ) + + // This instance is forced to release references to the specified interfaces by event-source. + if ( aEvent.Source == m_xContainerWindow ) + { + impl_setContainerWindow( Reference< XWindow >() ); + } +} + +//***************************************************************************************************************** +// XFocusListener +//***************************************************************************************************************** +void SAL_CALL Frame::focusGained( const FocusEvent& aEvent ) throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::focusGained()" ) + // Safe impossible cases + LOG_ASSERT( impldbg_checkParameter_focusGained( aEvent ), "Frame::focusGained()\nInvalid parameter detected.\n" ) +/* + // We must safe this new state, send event to listener ... + m_eActiveState = FOCUS; + impl_sendFrameActionEvent( FrameAction_FRAME_UI_ACTIVATED ); + // ... and forward our new focus to our component window! + if( m_xComponentWindow.is() == sal_True ) + { + m_xComponentWindow->setFocus(); + } +*/ + if( m_xComponentWindow.is() == sal_True ) + { + m_xComponentWindow->setFocus(); + } +} + +//***************************************************************************************************************** +// XFocusListener +//***************************************************************************************************************** +void SAL_CALL Frame::focusLost( const FocusEvent& aEvent ) throw( RuntimeException ) +{ + // Ready for multithreading + LOCK_MUTEX( aGuard, m_aMutex, "Frame::focusLost()" ) + // Safe impossible cases + LOG_ASSERT( impldbg_checkParameter_focusLost( aEvent ), "Frame::focusLost()\nInvalid parameter detected.\n" ) +/* + // We must send UI_DEACTIVATING to our listener and forget our current FOCUS state! + m_eActiveState = ACTIVE; + impl_sendFrameActionEvent( FrameAction_FRAME_UI_DEACTIVATING ); +*/ +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +void Frame::impl_setContainerWindow( const Reference< XWindow >& xWindow ) +{ + // Remove this instance himself from "old" window-listener-container. + if ( m_xContainerWindow.is() == sal_True ) + { + m_xContainerWindow->removeWindowListener( this ); + m_xContainerWindow->removeFocusListener( this ); + } + + // Remember old window; dispose later to avoid flickering. + Reference< XWindow > xOld = m_xContainerWindow; + // Safe new window reference. + m_xContainerWindow = xWindow; + // Dispose old window now. + if ( xOld.is() == sal_True ) + { + // All VclComponents are XComponents; so call dispose before discarding + // a Reference< XVclComponent >, because this frame is the owner of the Component. + xOld->setVisible( sal_False ); + xOld->dispose(); + } + + // Register this instance himself as new listener. + if ( m_xContainerWindow.is() == sal_True ) + { + m_xContainerWindow->addWindowListener( this ); + m_xContainerWindow->addFocusListener( this ); + } + + // If new window a on top, register this instance a listener to. + Reference< XTopWindow > xTopWindow( m_xContainerWindow, UNO_QUERY ); + if ( xTopWindow.is() == sal_True ) + { + xTopWindow->addTopWindowListener( this ); + } +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +void Frame::impl_setComponentWindow( const Reference< XWindow >& xWindow ) +{ + // Work only, if window will changing. + if ( xWindow != m_xComponentWindow ) + { + // Remember old component; dispose later to avoid flickering. + Reference< XWindow > xOld = m_xComponentWindow; + // Take the new one. + m_xComponentWindow = xWindow; + // Set correct size before showing the window. + impl_resizeComponentWindow(); + if ( m_xComponentWindow.is() == sal_True ) + { + m_xComponentWindow->setVisible( sal_True ); + } + // Destroy old window. + if ( xOld.is() == sal_True ) + { + // All VclComponents are XComponents; so call dispose before discarding + // a Reference< XVclComponent >, because this frame is the owner of the Component. + xOld->setVisible( sal_False ); + xOld->dispose(); + } + } +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +void Frame::impl_setController( const Reference< XController >& xController ) +{ + // Safe old value for disposing AFTER set of new controller! + Reference< XController > xOld = m_xController; + // Take the new one. + m_xController = xController; + // Dispose old instance. + if ( xOld.is() == sal_True ) + { + xOld->dispose(); + } +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +void Frame::impl_sendFrameActionEvent( const FrameAction& aAction ) +{ + // Log informations about order of events to file! + // (only activated in debug version!) + LOG_FRAMEACTIONEVENT( "Frame", m_sName, aAction ) + + // Send FrameAction event to all listener. + // Get container for right listener. + OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( ::getCppuType( ( const Reference< XFrameActionListener >*) NULL ) ); + + if ( pContainer != NULL ) + { + // Build action event. + FrameActionEvent aFrameActionEvent( (OWeakObject*)this, this, aAction ); + + // Get iterator for access to listener. + OInterfaceIteratorHelper aIterator( *pContainer ); + // Send message to all listener. + while ( aIterator.hasMoreElements() == sal_True ) + { + ((XFrameActionListener *)aIterator.next())->frameAction( aFrameActionEvent ); + } + } +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +void Frame::impl_sendDisposeEvent() +{ + // Log informations about order of events to file! + // (only activated in debug version!) + LOG_DISPOSEEVENT( "Frame", m_sName ) + + // Send event to all listener. + // Get container for right listener. + OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( ::getCppuType( ( const Reference< XEventListener >*) NULL ) ); + + if ( pContainer != NULL ) + { + // Build event. + EventObject aEvent( (OWeakObject*)this ); + + // Get iterator for access to listener. + OInterfaceIteratorHelper aIterator( *pContainer ); + // Send message to all listener. + while ( aIterator.hasMoreElements() == sal_True ) + { + ((XEventListener*)aIterator.next())->disposing( aEvent ); + } + } +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +sal_Bool Frame::impl_willFrameTop( const REFERENCE< XFRAMESSUPPLIER >& xParent ) +{ + // Set default return value. + sal_Bool bWillFrameTop = sal_False; + + // This frame is a topframe, if ouer parent is a task, the desktop or no parent exist! + // Cast parent to right interfaces ... + Reference< XTask > xIsTask ( xParent, UNO_QUERY ); + Reference< XDesktop > xIsDesktop ( xParent, UNO_QUERY ); + // ... and control it. + if ( + ( xIsTask.is() == sal_True ) || + ( xIsDesktop.is() == sal_True ) || + ( m_xParent.is() == sal_False ) + ) + { + bWillFrameTop = sal_True; + } + + // Return result of this operation. + return bWillFrameTop; +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +void Frame::impl_resizeComponentWindow() +{ + // Work only if container window is set! + if ( + ( m_xContainerWindow.is() == sal_True ) && + ( m_xComponentWindow.is() == sal_True ) + ) + { + // Get reference to his device. + Reference< XDevice > xDevice( m_xContainerWindow, UNO_QUERY ); + // Convert relativ size to output size. + Rectangle aRectangle = m_xContainerWindow->getPosSize(); + DeviceInfo aInfo = xDevice->getInfo(); + Size aSize ( aRectangle.Width - aInfo.LeftInset - aInfo.RightInset , + aRectangle.Height - aInfo.TopInset - aInfo.BottomInset ); + // Resize ouer component window. + m_xComponentWindow->setPosSize( 0, 0, aSize.Width, aSize.Height, PosSize::SIZE ); + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +Reference< XFrame > Frame::impl_searchLastLoadedComponent() +{ + // Set default return value if search failed. + Reference< XFrame > xReturn; + + // If I am the searched frame ... + if ( m_bILoadLastComponent == sal_True ) + { + // ... return this as result of search and reset help flag. + xReturn = Reference< XFrame >( (OWeakObject*)this, UNO_QUERY ); + m_bILoadLastComponent = sal_False; + } + else + { + // Else; we must search at ouer childs. We make a deep search. + // Lock the container. Nobody should append or remove elements during next time. + // But don't forget to unlock it again! + m_aChildFrameContainer.lock(); + // Break loop, if something was found or all container items was compared. + sal_uInt32 nCount = m_aChildFrameContainer.getCount(); + sal_uInt32 nPosition = 0; + while ( + ( xReturn.is() == sal_False ) && + ( nPosition < nCount ) + ) + { + xReturn = ((Frame*)(m_aChildFrameContainer[nPosition].get()))->impl_searchLastLoadedComponent(); + ++nPosition; + } + // Don't forget to unlock the container! + m_aChildFrameContainer.unlock(); + } + + // Return result of this operation. + return xReturn; +} + +//_________________________________________________________________________________________________________________ +// debug methods +//_________________________________________________________________________________________________________________ + +/*----------------------------------------------------------------------------------------------------------------- + The follow methods checks the parameter for other functions. If a parameter or his value is non valid, + we return "sal_False". (else sal_True) This mechanism is used to throw an ASSERT! + + ATTENTION + + If you miss a test for one of this parameters, contact the autor or add it himself !(?) + But ... look for right testing! See using of this methods! +-----------------------------------------------------------------------------------------------------------------*/ + +#ifdef ENABLE_ASSERTIONS + +//***************************************************************************************************************** +// append() accept valid references and pure frames only! No tasks or desktops. +sal_Bool Frame::impldbg_checkParameter_append( const Reference< XFrame >& xFrame ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + + // Check parameter. + if ( + ( &xFrame == NULL ) || + ( xFrame.is() == sal_False ) || + ( (Reference< XTask >( xFrame, UNO_QUERY )).is() == sal_True ) || + ( (Reference< XDesktop >( xFrame, UNO_QUERY )).is() == sal_True ) + ) + { + bOK = sal_False ; + } + + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +// queryFrames() accept valid searchflags only. If a new one will exist, we know it, if this check failed! +sal_Bool Frame::impldbg_checkParameter_queryFrames( sal_Int32 nSearchFlags ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + + // Check parameter. + if ( + ( nSearchFlags != FrameSearchFlag::AUTO ) && + ( !( nSearchFlags & FrameSearchFlag::PARENT ) ) && + ( !( nSearchFlags & FrameSearchFlag::SELF ) ) && + ( !( nSearchFlags & FrameSearchFlag::CHILDREN ) ) && + ( !( nSearchFlags & FrameSearchFlag::CREATE ) ) && + ( !( nSearchFlags & FrameSearchFlag::SIBLINGS ) ) && + ( !( nSearchFlags & FrameSearchFlag::TASKS ) ) && + ( !( nSearchFlags & FrameSearchFlag::ALL ) ) && + ( !( nSearchFlags & FrameSearchFlag::GLOBAL ) ) + ) + { + bOK = sal_False ; + } + + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +// remove() accept valid references and pure frames only! No tasks or desktops. +sal_Bool Frame::impldbg_checkParameter_remove( const Reference< XFrame >& xFrame ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + + // Check parameter. + if ( + ( &xFrame == NULL ) || + ( xFrame.is() == sal_False ) || + ( (Reference< XTask >( xFrame, UNO_QUERY )).is() == sal_True ) || + ( (Reference< XDesktop >( xFrame, UNO_QUERY )).is() == sal_True ) + ) + { + bOK = sal_False ; + } + + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +// Its allowed to reset the active frame membervariable with a NULL-Reference but not with a NULL-pointer! +// And we accept frames only! No tasks and desktops! +sal_Bool Frame::impldbg_checkParameter_setActiveFrame( const Reference< XFrame >& xFrame ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + + // Check parameter. + if ( &xFrame == NULL ) + { + bOK = sal_False ; + } + else + if ( + ( (Reference< XTask >( xFrame, UNO_QUERY )).is() == sal_True ) || + ( (Reference< XDesktop >( xFrame, UNO_QUERY )).is() == sal_True ) + ) + { + bOK = sal_False ; + } + + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +sal_Bool Frame::impldbg_checkParameter_queryDispatch( const URL& aURL , + const OUString& sTargetFrameName, + sal_Int32 nSearchFlags ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + + // Check parameter. + if ( + ( &aURL == NULL ) || +// ( aURL.Complete.getLength() < 1 ) || + ( &sTargetFrameName == NULL ) || + // sTargetFrameName can be ""! + ( + ( nSearchFlags != FrameSearchFlag::AUTO ) && + ( !( nSearchFlags & FrameSearchFlag::PARENT ) ) && + ( !( nSearchFlags & FrameSearchFlag::SELF ) ) && + ( !( nSearchFlags & FrameSearchFlag::CHILDREN ) ) && + ( !( nSearchFlags & FrameSearchFlag::CREATE ) ) && + ( !( nSearchFlags & FrameSearchFlag::SIBLINGS ) ) && + ( !( nSearchFlags & FrameSearchFlag::TASKS ) ) && + ( !( nSearchFlags & FrameSearchFlag::ALL ) ) && + ( !( nSearchFlags & FrameSearchFlag::GLOBAL ) ) + ) + ) + { + bOK = sal_False ; + } + + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +sal_Bool Frame::impldbg_checkParameter_queryDispatches( const Sequence< DispatchDescriptor >& seqDescriptor ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + + // Check parameter. + if ( + ( &seqDescriptor == NULL ) || + ( seqDescriptor.getLength() < 1 ) + ) + { + bOK = sal_False ; + } + + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +sal_Bool Frame::impldbg_checkParameter_registerDispatchProviderInterceptor( const Reference< XDispatchProviderInterceptor >& xInterceptor ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + + // Check parameter. + if ( + ( &xInterceptor == NULL ) || + ( xInterceptor.is() == sal_False ) + ) + { + bOK = sal_False ; + } + + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +sal_Bool Frame::impldbg_checkParameter_releaseDispatchProviderInterceptor( const Reference< XDispatchProviderInterceptor >& xInterceptor ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + + // Check parameter. + if ( + ( &xInterceptor == NULL ) || + ( xInterceptor.is() == sal_False ) + ) + { + bOK = sal_False ; + } + + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +sal_Bool Frame::impldbg_checkParameter_updateViewData( const Any& aValue ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + + // Check parameter. + if ( + ( &aValue == NULL ) || + ( aValue.hasValue() == sal_False ) + //ASMUSS Wenn der Typ noch bekannt ist, dann auch den abfragen! + ) + { + bOK = sal_False ; + } + + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +sal_Bool Frame::impldbg_checkParameter_createNewEntry( const OUString& sURL , + const Sequence< PropertyValue >& seqArguments, + const OUString& sTitle ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + + // Check parameter. + if ( + ( &sURL == NULL ) || + ( sURL.getLength() < 1 ) || + ( &seqArguments == NULL ) || + ( seqArguments.getLength() < 1 ) || + ( &sTitle == NULL ) || + ( sTitle.getLength() < 1 ) + ) + { + bOK = sal_False ; + } + + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +sal_Bool Frame::impldbg_checkParameter_windowResized( const WindowEvent& aEvent ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + + // Check parameter. + if ( + ( &aEvent == NULL ) + ) + { + bOK = sal_False ; + } + + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +sal_Bool Frame::impldbg_checkParameter_windowActivated( const EventObject& aEvent ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + + // Check parameter. + if ( + ( &aEvent == NULL ) + ) + { + bOK = sal_False ; + } + + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +sal_Bool Frame::impldbg_checkParameter_windowDeactivated( const EventObject& aEvent ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + + // Check parameter. + if ( + ( &aEvent == NULL ) + ) + { + bOK = sal_False ; + } + + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +sal_Bool Frame::impldbg_checkParameter_initialize( const Reference< XWindow >& xWindow ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + + // Check parameter. + if ( + ( &xWindow == NULL ) || + ( xWindow.is() == sal_False ) + ) + { + bOK = sal_False ; + } + + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +sal_Bool Frame::impldbg_checkParameter_setCreator( const Reference< XFramesSupplier >& xCreator ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + + // Check parameter. + if ( + ( &xCreator == NULL ) || + ( xCreator.is() == sal_False ) + ) + { + bOK = sal_False ; + } + + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +// An empty name is not fine but allowed ... ! +sal_Bool Frame::impldbg_checkParameter_setName( const OUString& sName ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + + // Check parameter. + if ( + ( &sName == NULL ) + ) + { + bOK = sal_False ; + } + + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +sal_Bool Frame::impldbg_checkParameter_findFrame( const OUString& sTargetFrameName , + sal_Int32 nSearchFlags ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + + // Check parameter. + if ( + ( &sTargetFrameName == NULL ) || + // sTargetFrameName can be ""! + ( + ( nSearchFlags != FrameSearchFlag::AUTO ) && + ( !( nSearchFlags & FrameSearchFlag::PARENT ) ) && + ( !( nSearchFlags & FrameSearchFlag::SELF ) ) && + ( !( nSearchFlags & FrameSearchFlag::CHILDREN ) ) && + ( !( nSearchFlags & FrameSearchFlag::CREATE ) ) && + ( !( nSearchFlags & FrameSearchFlag::SIBLINGS ) ) && + ( !( nSearchFlags & FrameSearchFlag::TASKS ) ) && + ( !( nSearchFlags & FrameSearchFlag::ALL ) ) && + ( !( nSearchFlags & FrameSearchFlag::GLOBAL ) ) + ) + ) + { + bOK = sal_False ; + } + + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +sal_Bool Frame::impldbg_checkParameter_setComponent( const Reference< XWindow >& xComponentWindow , + const Reference< XController >& xController ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + + // Check parameter. + if ( + ( &xComponentWindow == NULL ) || + ( &xController == NULL ) + ) + { + bOK = sal_False ; + } + + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +sal_Bool Frame::impldbg_checkParameter_addFrameActionListener( const Reference< XFrameActionListener >& xListener ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + + // Check parameter. + if ( + ( &xListener == NULL ) || + ( xListener.is() == sal_False ) + ) + { + bOK = sal_False ; + } + + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +sal_Bool Frame::impldbg_checkParameter_removeFrameActionListener( const Reference< XFrameActionListener >& xListener ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + + // Check parameter. + if ( + ( &xListener == NULL ) || + ( xListener.is() == sal_False ) + ) + { + bOK = sal_False ; + } + + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +sal_Bool Frame::impldbg_checkParameter_addEventListener( const Reference< XEventListener >& xListener ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + + // Check parameter. + if ( + ( &xListener == NULL ) || + ( xListener.is() == sal_False ) + ) + { + bOK = sal_False ; + } + + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +sal_Bool Frame::impldbg_checkParameter_removeEventListener( const Reference< XEventListener >& xListener ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + + // Check parameter. + if ( + ( &xListener == NULL ) || + ( xListener.is() == sal_False ) + ) + { + bOK = sal_False ; + } + + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +sal_Bool Frame::impldbg_checkParameter_disposing( const EventObject& aEvent ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + + // Check parameter. + if ( + ( &aEvent == NULL ) || + ( aEvent.Source.is() == sal_False ) + ) + { + bOK = sal_False ; + } + + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +sal_Bool Frame::impldbg_checkParameter_focusGained( const FocusEvent& aEvent ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + + // Check parameter. + if ( + ( &aEvent == NULL ) + ) + { + bOK = sal_False ; + } + + // Return result of check. + return bOK ; +} + +//***************************************************************************************************************** +sal_Bool Frame::impldbg_checkParameter_focusLost( const FocusEvent& aEvent ) +{ + // Set default return value. + sal_Bool bOK = sal_True; + + // Check parameter. + if ( + ( &aEvent == NULL ) + ) + { + bOK = sal_False ; + } + + // Return result of check. + return bOK ; +} + +#endif // #ifdef ENABLE_ASSERTIONS + +/*----------------------------------------------------------------------------------------------------------------- + Follow method is used to print out the content of current container. + Use this to get information about the tree. +-----------------------------------------------------------------------------------------------------------------*/ + +#ifdef ENABLE_SERVICEDEBUG // Is defined in debug version only. + +//***************************************************************************************************************** +OUString Frame::impldbg_getTreeNames( sal_Int16 nLevel ) +{ + // Create an "empty stream" with enough place for ouer own container informations. + OUStringBuffer sOutPut(1024); + + // Add my own information to stream. + // Format of output : "<Level*TAB>[<level>:<name>:<extra informations>]\n" + // Add "<Level*TAB>" + for ( sal_Int8 nTabCount=1; nTabCount<=nLevel; ++nTabCount ) + { + sOutPut.appendAscii( "\t" ); + } + // Add "[<level>:<name>:" + sOutPut.append( (sal_Unicode)'[' ); + sOutPut.append( (sal_Int32)nLevel ); + sOutPut.append( (sal_Unicode)':' ); + sOutPut.append( (sal_Unicode)'"' ); + sOutPut.append( m_sName ); + sOutPut.append( (sal_Unicode)'"' ); + sOutPut.append( (sal_Unicode)':' ); + // Add "<extra informations>" + switch( m_eActiveState ) + { + case ACTIVE : sOutPut.appendAscii( "ACTIVE"); + break; + case FOCUS : sOutPut.appendAscii( "FOCUS" ); + break; + } + Reference< XFrame > xActiveChild = m_aChildFrameContainer.getActive(); + Reference< XFrame > xTHISFrame ( (OWeakObject*)this, UNO_QUERY ); + + Reference< XFrame > xActiveParentChild; + if ( m_xParent.is() == sal_True ) + { + xActiveParentChild = m_xParent->getActiveFrame(); + } + + // If "active path" from my parent to one of my childs not broken => I'am in the middle of an active path. + if ( xActiveChild.is() == sal_True && xActiveParentChild == xTHISFrame ) + { + sOutPut.appendAscii( ":MIDDLEPATH" ); + } + // If "active path" exist to one of my childs only => I'am on the top of an active path. + if ( xActiveChild.is() == sal_True && xActiveParentChild != xTHISFrame ) + { + sOutPut.appendAscii( ":STARTPATH" ); + } + // If "active path" exist from my parent to me, but not to one of my childs => I'am at the end of an active path. + if ( xActiveChild.is() == sal_False && xActiveParentChild == xTHISFrame ) + { + sOutPut.appendAscii( ":ENDPATH" ); + } + // Else; There is no active path in the near of this node. + + // Add "]\n" + sOutPut.append( (sal_Unicode)']' ); + sOutPut.appendAscii( "\n" ); + + // Step over all elements in current container and collect names. + // We must lock the container, to have exclusiv access to elements! + m_aChildFrameContainer.lock(); + sal_uInt32 nCount = m_aChildFrameContainer.getCount(); + for ( sal_uInt32 nPosition=0; nPosition<nCount; ++nPosition ) + { + // Step during tree deep first - from the left site to the right one. + // Print subtree of this child to stream! + Reference< XFrame > xItem = m_aChildFrameContainer[nPosition]; + Reference< XSPECIALDEBUGINTERFACE > xDebug( xItem, UNO_QUERY ); + sOutPut.append( xDebug->dumpVariable( DUMPVARIABLE_TREEINFO, nLevel+1 ) ); + } + // Don't forget to unlock the container! + m_aChildFrameContainer.unlock(); + + // Now we have anough informations about tree. + // Return it to caller. + return sOutPut.makeStringAndClear(); +} + +#endif // #ifdef ENABLE_SERVICEDEBUG + +} // namespace framework diff --git a/framework/source/services/makefile.mk b/framework/source/services/makefile.mk new file mode 100644 index 000000000000..db8bb1e73fbe --- /dev/null +++ b/framework/source/services/makefile.mk @@ -0,0 +1,88 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:29: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): _______________________________________ +# +# +# +#************************************************************************* +PRJ=..$/.. + +PRJNAME= framework +TARGET= fwk_services +USE_DEFFILE= TRUE +NO_BSYMBOLIC= TRUE +ENABLE_EXCEPTIONS= TRUE +BOOTSTRAP_SERVICE= FALSE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Generate ----------------------------------------------------- + +SLOFILES= \ + $(SLO)$/task.obj \ + $(SLO)$/frame.obj \ + $(SLO)$/frameloaderfactory.obj + +# $(SLO)$/desktop.obj \ + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/framework/test/makefile.mk b/framework/test/makefile.mk new file mode 100644 index 000000000000..49f3381bb7bf --- /dev/null +++ b/framework/test/makefile.mk @@ -0,0 +1,106 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:29: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= framework +TARGET= test +LIBTARGET= NO +ENABLE_EXCEPTIONS= TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Files -------------------------------------------------------- + +SLOFILES= $(SLO)$/test.obj + +# --- Applikation -------------------------------------------------- + +APP1TARGET= $(TARGET) + +APP1OBJS= $(SLO)$/test.obj + +APP1STDLIBS= $(SLB)$/fwk_classes.lib \ + $(SLB)$/fwk_helper.lib \ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(OSLLIB) \ + $(SALLIB) \ + $(VOSLIB) \ + $(TOOLSLIB) \ + $(SVTOOLLIB) \ + $(TKLIB) \ + $(UNOTOOLSLIB) \ + $(SVLIB) + +APP1DEPN= $(SLB)$/fwk_classes.lib + +.IF "$(GUI)"=="WIN" || "$(GUI)"=="OS2" +APP1DEF= $(MISC)$/$(TARGET).def +.ENDIF + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/framework/test/test.cxx b/framework/test/test.cxx new file mode 100644 index 000000000000..6ba09f5b470b --- /dev/null +++ b/framework/test/test.cxx @@ -0,0 +1,938 @@ +/************************************************************************* + * + * $RCSfile: test.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:29: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): _______________________________________ + * + * + ************************************************************************/ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_HELPER_OINSTANCEPROVIDER_HXX_ +#include <helper/oinstanceprovider.hxx> +#endif + +#ifndef __FRAMEWORK_CLASSES_SERVICEMANAGER_HXX_ +#include <classes/servicemanager.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_GENERIC_HXX_ +#include <macros/generic.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_ +#include <macros/debug.hxx> +#endif + +#ifndef __FRAMEWORK_DEFINES_HXX_ +#include <defines.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_FRAME_XDESKTOP_HPP_ +#include <com/sun/star/frame/XDesktop.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_ +#include <com/sun/star/frame/XFrame.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_ +#include <com/sun/star/awt/XWindow.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XFRAMELOADER_HPP_ +#include <com/sun/star/frame/XFrameLoader.hpp> +#endif + +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ +#include <com/sun/star/beans/PropertyValue.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XLOADEVENTLISTENER_HPP_ +#include <com/sun/star/frame/XLoadEventListener.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDER_HPP_ +#include <com/sun/star/frame/XDispatchProvider.hpp> +#endif + +#ifndef _COM_SUN_STAR_UTIL_URL_HPP_ +#include <com/sun/star/util/URL.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HPP_ +#include <com/sun/star/frame/FrameSearchFlag.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XFRAMES_HPP_ +#include <com/sun/star/frame/XFrames.hpp> +#endif + +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_ +#include <com/sun/star/frame/XComponentLoader.hpp> +#endif + +#ifndef _COM_SUN_STAR_FRAME_XTASKSSUPPLIER_HPP_ +#include <com/sun/star/frame/XTasksSupplier.hpp> +#endif + +#ifndef _COM_SUN_STAR_TASK_XSTATUSINDICATORFACTORY_HPP_ +#include <com/sun/star/task/XStatusIndicatorFactory.hpp> +#endif + +#ifndef _COM_SUN_STAR_BEANS_XMULTIPROPERTYSET_HPP_ +#include <com/sun/star/beans/XMultiPropertySet.hpp> +#endif + +#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#endif + +#ifndef _COM_SUN_STAR_MOZILLA_XPLUGININSTANCEPEER_HPP_ +#include <com/sun/star/mozilla/XPluginInstancePeer.hpp> +#endif + +#ifndef _COM_SUN_STAR_BRIDGE_XINSTANCEPROVIDER_HPP_ +#include <com/sun/star/bridge/XInstanceProvider.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_ +#include <unotools/processfactory.hxx> +#endif + +#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_ +#include <com/sun/star/uno/Reference.h> +#endif + +#ifndef _RTL_USTRING_ +#include <rtl/ustring> +#endif + +#ifndef _RTL_USTRBUF_HXX_ +#include <rtl/ustrbuf.hxx> +#endif + +#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ +#include <toolkit/helper/vclunohelper.hxx> +#endif + +#ifndef _SVT_UNOIFACE_HXX +#include <svtools/unoiface.hxx> +#endif + +#ifndef _URLOBJ_HXX +#include <tools/urlobj.hxx> +#endif + +#include <vcl/event.hxx> +#include <vcl/svapp.hxx> +#include <vcl/wrkwin.hxx> +#include <vcl/msgbox.hxx> +#include <stdio.h> + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +#define APPLICATIONNAME "FrameWork - Testapplication" + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +using namespace ::rtl ; +using namespace ::utl ; +using namespace ::framework ; +using namespace ::cppu ; +using namespace ::com::sun::star::uno ; +using namespace ::com::sun::star::lang ; +using namespace ::com::sun::star::frame ; +using namespace ::com::sun::star::awt ; +using namespace ::com::sun::star::beans ; +using namespace ::com::sun::star::util ; +using namespace ::com::sun::star::task ; +using namespace ::com::sun::star::mozilla ; +using namespace ::com::sun::star::bridge ; + +//_________________________________________________________________________________________________________________ +// defines +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-***************************************************************************************************************/ +class TestApplication : public Application +{ + public: + void Main(); + + private: + // Test the whole desktop implementation. + void impl_testDesktop( const Reference< XDesktop >& xDesktop ); + // Build a new tree with desktop on top. + void impl_buildTree( const Reference< XDesktop >& xDesktop ); + // Write names of all frames in tree to logfile. + void impl_logTree( const Reference< XDesktop >& xDesktop ); + void impl_testPlugIn( const Reference< XDesktop >& xDesktop, const Reference< XMultiServiceFactory >& xFactory ); + // Test login dialog + void impl_testLoginDialog(); + +}; // class TestApplication + +//_________________________________________________________________________________________________________________ +// global variables +//_________________________________________________________________________________________________________________ + +TestApplication aTestApplication ; + +//_________________________________________________________________________________________________________________ +// main +//_________________________________________________________________________________________________________________ + +void TestApplication::Main() +{ + // 1) Init global servicemanager and set it. + ServiceManager aManager; + Reference< XMultiServiceFactory > xGlobalServiceManager = aManager.getManager(); + LOG_ASSERT( !(xGlobalServiceManager.is()==sal_False), "TestApplication::Main()\nCan't create global service manager.\n\n" ) + + // We must set this global servicemanager as global static variable. + // Office must have access to this. + setProcessServiceFactory( xGlobalServiceManager ); + // Control this! + LOG_ASSERT( !(getProcessServiceFactory()!=xGlobalServiceManager), "TestApplication::Main()\nGlobal servicemanager not set in UNOTOOLS.\n\n" ) + + // For follow operations, we need the vcl-toolkit! + // But there is nothing to test for us. + InitExtVclToolkit(); + + // 2) Try to create the root of ouer frame hierarchy - the desktop himself. + Reference< XDesktop > xDesktop( xGlobalServiceManager->createInstance( SERVICENAME_DESKTOP ), UNO_QUERY ); + LOG_ASSERT( !(xDesktop.is()==sal_False), "TestApplication::Main()\nServicename of Desktop is unknown.\n\n" ) + + ResMgr* pRessourceManager = CREATEVERSIONRESMGR( lgd ); + Resource::SetResManager( pRessourceManager ); + +// impl_testLoginDialog(); + impl_testDesktop( xDesktop ); +// impl_testPlugIn( xDesktop, xGlobalServiceManager ); + +/* + Reference< XDispatchProvider > xProvider( xDesktop, UNO_QUERY ); + URL aURL; + aURL.Complete = OUString(RTL_CONSTASCII_USTRINGPARAM("file://d|/bla.htm")); + Reference< XDispatch > xDispatcher = xProvider->queryDispatch( aURL, OUString(RTL_CONSTASCII_USTRINGPARAM("_blank")), 0 ); + if( xDispatcher.is()==sal_True ) + { + xDispatcher->dispatch(aURL, Sequence< PropertyValue >() ); + aURL.Complete = OUString(RTL_CONSTASCII_USTRINGPARAM("file://d|/bla.htm")); + xDispatcher->dispatch(aURL, Sequence< PropertyValue >() ); + aURL.Complete = OUString(RTL_CONSTASCII_USTRINGPARAM("file://d|/bla.html")); + xDispatcher->dispatch(aURL, Sequence< PropertyValue >() ); + aURL.Complete = OUString(RTL_CONSTASCII_USTRINGPARAM("file://d|/test.txt")); + xDispatcher->dispatch(aURL, Sequence< PropertyValue >() ); + } +*/ +/* + Reference< XMultiServiceFactory > xFrameLoaderFactory( xGlobalServiceManager->createInstance( SERVICENAME_FRAMELOADERFACTORY ), UNO_QUERY ); + LOG_ASSERT( !(xFrameLoaderFactory.is()==sal_False), "TestApplication::Main()\nServicename of FrameLoaderFactory is unknown.\n\n" ); + Sequence< OUString > seqFilterNames = xFrameLoaderFactory->getAvailableServiceNames(); + if (seqFilterNames.getLength()>0) + { + Sequence< Any > seqArguments(1); + seqArguments[0] <<= seqFilterNames[0]; + + Reference< XPropertySet > xPropertySet( xFrameLoaderFactory->createInstanceWithArguments( OUString(), seqArguments ), UNO_QUERY ); + if ( xPropertySet.is()==sal_True ) + { + Sequence< OUString > seqPattern ; + Sequence< OUString > seqExtension ; + sal_Int32 nFlags ; + sal_Int32 nFormat ; + OUString sMimeType ; + OUString sFilterName ; + OUString sDetectService ; + Reference< XInterface > xLoader ; + OUString sURL ; + PropertyValue aPropertyValue ; + Any aValue ; + + aValue = xPropertySet->getPropertyValue( PROPERTYNAME_PATTERN ); + aValue >>= seqPattern; + aValue = xPropertySet->getPropertyValue( PROPERTYNAME_EXTENSION ); + aValue >>= seqExtension; + aValue = xPropertySet->getPropertyValue( PROPERTYNAME_FLAGS ); + aValue >>= nFlags; + aValue = xPropertySet->getPropertyValue( PROPERTYNAME_FORMAT ); + aValue >>= nFormat; + aValue = xPropertySet->getPropertyValue( PROPERTYNAME_MIMETYPE ); + aValue >>= sMimeType; + aValue = xPropertySet->getPropertyValue( PROPERTYNAME_FILTERNAME ); + aValue >>= sFilterName; + aValue = xPropertySet->getPropertyValue( PROPERTYNAME_DETECTSERVICE ); + aValue >>= sDetectService; + + sURL = OUString(RTL_CONSTASCII_USTRINGPARAM("file://d|bla.htm")) ; + aPropertyValue.Name = PROPERTYNAME_FILTERNAME ; + aPropertyValue.Value <<= sFilterName ; + seqArguments.realloc(1); + seqArguments[0] <<= aPropertyValue ; + xLoader = xFrameLoaderFactory->createInstanceWithArguments( sURL, seqArguments ); + LOG_ASSERT( !(xLoader.is()==sal_False), "TestApplication::Main()\nCreation of loader 1 failed.\n\n" ); + + sURL = OUString(RTL_CONSTASCII_USTRINGPARAM("file://d|bla.htm")) ; + aPropertyValue.Name = PROPERTYNAME_MIMETYPE ; + aPropertyValue.Value <<= sMimeType ; + seqArguments.realloc(1); + seqArguments[0] <<= aPropertyValue ; + xLoader = xFrameLoaderFactory->createInstanceWithArguments( sURL, seqArguments ); + LOG_ASSERT( !(xLoader.is()==sal_False), "TestApplication::Main()\nCreation of loader 2 failed.\n\n" ); + + sURL = OUString(RTL_CONSTASCII_USTRINGPARAM("file://d|bla.htm")) ; + aPropertyValue.Name = PROPERTYNAME_FORMAT ; + aPropertyValue.Value <<= nFormat ; + seqArguments.realloc(1); + seqArguments[0] <<= aPropertyValue ; + xLoader = xFrameLoaderFactory->createInstanceWithArguments( sURL, seqArguments ); + LOG_ASSERT( !(xLoader.is()==sal_False), "TestApplication::Main()\nCreation of loader 3 failed.\n\n" ); + } + } +*/ +// Execute(); +// xFrame->dispose(); +// delete pMainWindow; +} + +//_________________________________________________________________________________________________________________ +// test method +//_________________________________________________________________________________________________________________ +void TestApplication::impl_testLoginDialog() +{ + // Get global servicemanager to create service "LoginDialog". + Reference< XMultiServiceFactory > xFactory = getProcessServiceFactory(); + LOG_ASSERT( !(xFactory.is()==sal_False), "TestApplication::impl_testLoginDialog()\nServicemanager not valid.\n" ) + // Create LoginDialog. + Reference< XDialog > xDialog( xFactory->createInstance( DECLARE_ASCII("com.sun.star.framework.LoginDialog") ), UNO_QUERY ); + LOG_ASSERT( !(xDialog.is()==sal_False), "TestApplication::impl_testLoginDialog()\nCould not create login dialog.\n" ) + // Check set/getTitle() + /* not implemented yet! */ +// OUString sTitle = DECLARE_ASCII("Login Dialog Test"); +// xDialog->setTitle( sTitle ); +// LOG_ASSERT( !(xDialog->getTitle()!=sTitle), "TestApplication::impl_testLoginDialog()\nset/getTitle don't work correct.\n" ) + + UniString sInternalURL = DECLARE_ASCII("private:factory/scalc"); + UniString sExternalURL = OUString(); + + OString sOut = "internal: "; + sOut += OUStringToOString( sInternalURL, RTL_TEXTENCODING_UTF8 ).getStr(); + sOut += "\nexternal: "; + sOut += OUStringToOString( sExternalURL, RTL_TEXTENCODING_UTF8 ).getStr(); + sOut += "\n"; + LOG_ASSERT( sal_False, sOut.getStr() ) + + INetURLObject::translateToExternal( sInternalURL, sExternalURL ); + sOut = "internal: "; + sOut += OUStringToOString( sInternalURL, RTL_TEXTENCODING_UTF8 ).getStr(); + sOut += "\nexternal: "; + sOut += OUStringToOString( sExternalURL, RTL_TEXTENCODING_UTF8 ).getStr(); + sOut += "\n"; + LOG_ASSERT( sal_False, sOut.getStr() ) + + INetURLObject::translateToInternal( sExternalURL, sInternalURL ); + sOut = "internal: "; + sOut += OUStringToOString( sInternalURL, RTL_TEXTENCODING_UTF8 ).getStr(); + sOut += "\nexternal: "; + sOut += OUStringToOString( sExternalURL, RTL_TEXTENCODING_UTF8 ).getStr(); + sOut += "\n"; + LOG_ASSERT( sal_False, sOut.getStr() ) + + // Work with properties of dialog. + Reference< XPropertySet > xPropertySet( xDialog, UNO_QUERY ); + LOG_ASSERT( !(xPropertySet.is()==sal_False), "TestApplication::impl_testLoginDialog()\nCan't cast dialog to XPropertySet interface.\n" ) + Any aUserName ; + Any aPassword ; + Any aServer ; + Any aConnectionType ; + Any aPort ; + aUserName <<= DECLARE_ASCII("Andreas"); + aPassword <<= DECLARE_ASCII("Test"); + aServer <<= DECLARE_ASCII("www.yahoo.de:7777"); + aConnectionType <<= DECLARE_ASCII("Bla"); + sal_Int32 nPort = 8081; + aPort <<= nPort; + try + { + xPropertySet->setPropertyValue( DECLARE_ASCII("UserName" ), aUserName ); + xPropertySet->setPropertyValue( DECLARE_ASCII("Password" ), aPassword ); + xPropertySet->setPropertyValue( DECLARE_ASCII("Server" ), aServer ); + xPropertySet->setPropertyValue( DECLARE_ASCII("ConnectionType" ), aConnectionType ); + xPropertySet->setPropertyValue( DECLARE_ASCII("Compressed" ), aPort ); + } + catch( ::com::sun::star::beans::UnknownPropertyException& ) + { + LOG_ASSERT( sal_False, "UnkownPropertyException detected!\n" ) + } + catch( ::com::sun::star::beans::PropertyVetoException& ) + { + LOG_ASSERT( sal_False, "PropertyVetoException detected!\n" ) + } + catch( ::com::sun::star::lang::IllegalArgumentException& ) + { + LOG_ASSERT( sal_False, "IllegalArgumentException detected!\n" ) + } + catch( ::com::sun::star::lang::WrappedTargetException& ) + { + LOG_ASSERT( sal_False, "WrappedTargetException detected!\n" ) + } + catch( ::com::sun::star::uno::RuntimeException& ) + { + LOG_ASSERT( sal_False, "RuntimeException detected!\n" ) + } + + xDialog->execute(); + + OUString sUserName ; + OUString sPassword ; + OUString sServer ; + OUString sConnectionType ; + xPropertySet->getPropertyValue( DECLARE_ASCII("UserName" ) ) >>= sUserName ; + xPropertySet->getPropertyValue( DECLARE_ASCII("Password" ) ) >>= sPassword ; + xPropertySet->getPropertyValue( DECLARE_ASCII("Server" ) ) >>= sServer ; + xPropertySet->getPropertyValue( DECLARE_ASCII("ConnectionType" ) ) >>= sConnectionType ; + xPropertySet->getPropertyValue( sConnectionType ) >>= nPort ; + + LOG_ASSERT( sal_False, OUStringToOString( sUserName, RTL_TEXTENCODING_UTF8 ).getStr() ) + LOG_ASSERT( sal_False, OUStringToOString( sPassword, RTL_TEXTENCODING_UTF8 ).getStr() ) + LOG_ASSERT( sal_False, OUStringToOString( sServer , RTL_TEXTENCODING_UTF8 ).getStr() ) + LOG_ASSERT( sal_False, OUStringToOString( sConnectionType , RTL_TEXTENCODING_UTF8 ).getStr() ) + LOG_ASSERT( sal_False, OString::valueOf( (sal_Int32)nPort ).getStr() ) +} + +//_________________________________________________________________________________________________________________ +// test method +//_________________________________________________________________________________________________________________ +void TestApplication::impl_testPlugIn( const Reference< XDesktop >& xDesktop, const Reference< XMultiServiceFactory >& xFactory ) +{ + // create instance provider for creation of factories. + Reference< XInstanceProvider > xInstanceProvider( (OWeakObject*)(new OInstanceProvider( xFactory )), UNO_QUERY ); + LOG_ASSERT( !(xInstanceProvider.is()==sal_False), "TestApplication::impl_testPlugIn()\nCan't create new instance provider!\n" ) + + // try to get factory for create a plugin + Reference< XSingleServiceFactory > xPlugInFactory( xInstanceProvider->getInstance( INSTANCENAME_PLUGINFACTORY ), UNO_QUERY ); + LOG_ASSERT( !(xPlugInFactory.is()==sal_False), "TestApplication::impl_testPlugIn()\nCan't get PlugInFactory from instance provider!\n" ) + + // initialize parameter for creation of plugin + Reference< XPluginInstancePeer > xPlugInDLL =Reference< XPluginInstancePeer >(); + Sequence< Any > seqArguments(1); + seqArguments[0] <<= xPlugInDLL; + + // create plugin + Reference< XFrame > xPlugIn( xPlugInFactory->createInstanceWithArguments( seqArguments ), UNO_QUERY ); + LOG_ASSERT( !(xPlugIn.is()==sal_False), "TestApplication::impl_testPlugIn()\nFactory has created no valid plugin!\n" ) + + xPlugIn->setName( OUString(RTL_CONSTASCII_USTRINGPARAM("PlugIn")) ); + Reference< XFramesSupplier > xSupplier( xDesktop, UNO_QUERY ); + xPlugIn->setCreator( xSupplier ); +} + +//_________________________________________________________________________________________________________________ +// test method +//_________________________________________________________________________________________________________________ +void TestApplication::impl_testDesktop( const Reference< XDesktop >& xDesktop ) +{ + //------------------------------------------------------------------------------------------------------------- + // 1) Test cast to all supported interfaces of Desktop. + + Reference< XInterface > xDesktopInterface ( xDesktop, UNO_QUERY ); + Reference< XTypeProvider > xDesktopTypeProvider ( xDesktop, UNO_QUERY ); + Reference< XServiceInfo > xDesktopServiceInfo ( xDesktop, UNO_QUERY ); + Reference< XComponentLoader > xDesktopComponentLoader ( xDesktop, UNO_QUERY ); + Reference< XTasksSupplier > xDesktopTasksSupplier ( xDesktop, UNO_QUERY ); + Reference< XDispatchProvider > xDesktopDispatchProvider ( xDesktop, UNO_QUERY ); + Reference< XFramesSupplier > xDesktopFramesSupplier ( xDesktop, UNO_QUERY ); + Reference< XFrame > xDesktopFrame ( xDesktop, UNO_QUERY ); + Reference< XComponent > xDesktopComponent ( xDesktop, UNO_QUERY ); + Reference< XStatusIndicatorFactory > xDesktopStatusIndicatorFactory ( xDesktop, UNO_QUERY ); + Reference< XPropertySet > xDesktopPropertySet ( xDesktop, UNO_QUERY ); + Reference< XFastPropertySet > xDesktopFastPropertySet ( xDesktop, UNO_QUERY ); + Reference< XMultiPropertySet > xDesktopMultiPropertySet ( xDesktop, UNO_QUERY ); + + LOG_ASSERT( !(xDesktopInterface.is() ==sal_False), "TestApplication::impl_testDesktop()\nXInterface not supported by Desktop.\n\n" ) + LOG_ASSERT( !(xDesktopTypeProvider.is() ==sal_False), "TestApplication::impl_testDesktop()\nXTypeProvider not supported by Desktop.\n\n" ) + LOG_ASSERT( !(xDesktopServiceInfo.is() ==sal_False), "TestApplication::impl_testDesktop()\nXServiceInfo not supported by Desktop.\n\n" ) + LOG_ASSERT( !(xDesktop.is() ==sal_False), "TestApplication::impl_testDesktop()\nXDesktop not supported by Desktop.\n\n" ) + LOG_ASSERT( !(xDesktopComponentLoader.is() ==sal_False), "TestApplication::impl_testDesktop()\nXComponentLoader not supported by Desktop.\n\n" ) + LOG_ASSERT( !(xDesktopTasksSupplier.is() ==sal_False), "TestApplication::impl_testDesktop()\nXTasksSupplier not supported by Desktop.\n\n" ) + LOG_ASSERT( !(xDesktopDispatchProvider.is() ==sal_False), "TestApplication::impl_testDesktop()\nXDispatchProvider not supported by Desktop.\n\n" ) + LOG_ASSERT( !(xDesktopFramesSupplier.is() ==sal_False), "TestApplication::impl_testDesktop()\nXFramesSupplier not supported by Desktop.\n\n" ) + LOG_ASSERT( !(xDesktopFrame.is() ==sal_False), "TestApplication::impl_testDesktop()\nXFrame not supported by Desktop.\n\n" ) + LOG_ASSERT( !(xDesktopComponent.is() ==sal_False), "TestApplication::impl_testDesktop()\nXComponent not supported by Desktop.\n\n" ) + LOG_ASSERT( !(xDesktopStatusIndicatorFactory.is() ==sal_False), "TestApplication::impl_testDesktop()\nXStatusIndicatorFactory not supported by Desktop.\n\n" ) + LOG_ASSERT( !(xDesktopPropertySet.is() ==sal_False), "TestApplication::impl_testDesktop()\nXPropertySet not supported by Desktop.\n\n" ) + LOG_ASSERT( !(xDesktopFastPropertySet.is() ==sal_False), "TestApplication::impl_testDesktop()\nXFastPropertySet not supported by Desktop.\n\n" ) + LOG_ASSERT( !(xDesktopMultiPropertySet.is() ==sal_False), "TestApplication::impl_testDesktop()\nXMultiPropertySet not supported by Desktop.\n\n" ) + + //------------------------------------------------------------------------------------------------------------- + // 2) Test set-/getName(). + + // 2a) Test default value "Desktop". + OUString sName( RTL_CONSTASCII_USTRINGPARAM("Desktop") ); + LOG_ASSERT( !(xDesktopFrame->getName()!=sName), "TestApplication::impl_testDesktop()\nDefault value of desktop name is invalid.\n\n" ) + + // 2b) Set name and try to get the same name. + sName = OUString( RTL_CONSTASCII_USTRINGPARAM("New Desktop") ); + xDesktopFrame->setName( sName ); + LOG_ASSERT( !(xDesktopFrame->getName()!=sName), "TestApplication::impl_testDesktop()\nSetting of name works not correct on desktop.\n\n" ) + + // Reset name do default! + // Its neccessary for follow operations. + sName = OUString( RTL_CONSTASCII_USTRINGPARAM("Desktop") ); + xDesktopFrame->setName( sName ); + + //------------------------------------------------------------------------------------------------------------- + // 3) Test findFrame(). + + // Build new example tree and log initial structure in file. + impl_buildTree ( xDesktop ); + impl_logTree ( xDesktop ); + + OUString sTargetFrameName; + sal_uInt32 nSearchFlags ; + Reference< XFrame > xSearchFrame ; + Reference< XFrame > xTask_4 ; + Reference< XFrame > xFrame_41 ; + Reference< XFrame > xFrame_411 ; + Reference< XFrame > xFrame_112 ; + Reference< XFrame > xFrame_1123 ; + Reference< XFrame > xFrame_11231 ; + Reference< XFrame > xFrame_11221 ; + + // 3a) Search for Desktop + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SELF for \"Desktop\" on Desktop\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + sTargetFrameName = OUString(RTL_CONSTASCII_USTRINGPARAM("Desktop")); + nSearchFlags = FrameSearchFlag::SELF; + xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); + LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3a)-1 invalid\n" ); + + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, " Search with ALL for \"Desktop\" on Desktop\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + nSearchFlags = FrameSearchFlag::ALL; + xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); + LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3a)-2 invalid\n" ); + + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, " Search with CHILDREN for \"Desktop\" on Desktop\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + nSearchFlags = FrameSearchFlag::CHILDREN; + xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); + LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3a)-3 invalid\n" ); + + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SIBLINGS for \"Desktop\" on Desktop\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + nSearchFlags = FrameSearchFlag::SIBLINGS; + xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); + LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3a)-4 invalid\n" ); + + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, " Search with AUTO for \"Desktop\" on Desktop\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + nSearchFlags = FrameSearchFlag::AUTO; + xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); + LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3a)-5 invalid\n" ); + + // 3b) Search for Task_4 + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SELF for \"Task_4\" on Desktop\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + sTargetFrameName = OUString(RTL_CONSTASCII_USTRINGPARAM("Task_4")); + nSearchFlags = FrameSearchFlag::SELF; + xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); + LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3b)-1 invalid\n" ); + + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SIBLINGS for \"Task_4\" on Desktop\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + nSearchFlags = FrameSearchFlag::SIBLINGS; + xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); + LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3b)-2 invalid\n" ); + + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, " Search with CHILDREN for \"Task_4\" on Desktop\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + nSearchFlags = FrameSearchFlag::CHILDREN; + xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); + LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3b)-3 invalid\n" ); + + xTask_4 = xSearchFrame; + + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, " Search with ALL for \"Task_4\" on Desktop\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + nSearchFlags = FrameSearchFlag::ALL; + xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); + LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3b)-4 invalid\n" ); + + // 3c) Search for Frame_41 + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SELF for \"Frame_41\" on Desktop\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + sTargetFrameName = OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_41")); + nSearchFlags = FrameSearchFlag::SELF; + xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); + LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3c)-1 invalid\n" ); + + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SIBLINGS for \"Frame_41\" on Desktop\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + nSearchFlags = FrameSearchFlag::SIBLINGS; + xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); + LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3c)-2 invalid\n" ); + + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, " Search with CHILDREN for \"Frame_41\" on Desktop\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + nSearchFlags = FrameSearchFlag::CHILDREN; + xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); + LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3c)-3 invalid\n" ); + + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, " Search with ALL for \"Frame_41\" on Desktop\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + nSearchFlags = FrameSearchFlag::ALL; + xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); + LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3c)-4 invalid\n" ); + + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SELF for \"Frame_41\" on Task_4\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + nSearchFlags = FrameSearchFlag::SELF; + xSearchFrame = xTask_4->findFrame(sTargetFrameName, nSearchFlags); + LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3c)-5 invalid\n" ); + + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SIBLINGS for \"Frame_41\" on Task_4\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + nSearchFlags = FrameSearchFlag::SIBLINGS; + xSearchFrame = xTask_4->findFrame(sTargetFrameName, nSearchFlags); + LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3c)-6 invalid\n" ); + + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, " Search with CHILDREN for \"Frame_41\" on Task_4\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + nSearchFlags = FrameSearchFlag::CHILDREN; + xSearchFrame = xTask_4->findFrame(sTargetFrameName, nSearchFlags); + LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3c)-7 invalid\n" ); + + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, " Search with ALL for \"Frame_41\" on Task_4\n" ) + WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) + nSearchFlags = FrameSearchFlag::ALL; + xSearchFrame = xTask_4->findFrame(sTargetFrameName, nSearchFlags); + LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3c)-8 invalid\n" ); + + xFrame_41 = xSearchFrame; + + // 3d) Search for Frame_411 + // 3e) Search for Frame_112 + // 3f) Search for Frame_1123 + // 3g) Search for Frame_11231 + // 3h) Search for Frame_11221 +} + +//_________________________________________________________________________________________________________________ +// helper method to build a new binaer-tree with desktop as top-frame +//_________________________________________________________________________________________________________________ +void TestApplication::impl_buildTree( const Reference< XDesktop >& xDesktop ) +{ + // You can append and remove frames only on XFRames interface of desktop. + // But the desktop support this interface not directly! Use getFrames() instantly. + Reference< XFramesSupplier > xDesktopSupplier( xDesktop, UNO_QUERY ); + Reference< XFrames > xFrames = xDesktopSupplier->getFrames(); + LOG_ASSERT( !(xFrames.is()==sal_False), "TestApplication::impl_buildTree()\nCan't get framesaccess on desktop.\n\n" ) + + // Create some tasks and frames. + Reference< XMultiServiceFactory > xServiceManager( getProcessServiceFactory() ); + + Reference< XTask > xTask_1( xServiceManager->createInstance(SERVICENAME_TASK), UNO_QUERY ); + Reference< XTask > xTask_2( xServiceManager->createInstance(SERVICENAME_TASK), UNO_QUERY ); + Reference< XTask > xTask_3( xServiceManager->createInstance(SERVICENAME_TASK), UNO_QUERY ); + Reference< XTask > xTask_4( xServiceManager->createInstance(SERVICENAME_TASK), UNO_QUERY ); + Reference< XTask > xTask_5( xServiceManager->createInstance(SERVICENAME_TASK), UNO_QUERY ); + Reference< XFrame > xFrame_11( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); + Reference< XFrame > xFrame_12( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); + Reference< XFrame > xFrame_21( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); + Reference< XFrame > xFrame_22( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); + Reference< XFrame > xFrame_31( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); + Reference< XFrame > xFrame_32( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); + Reference< XFrame > xFrame_41( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); + Reference< XFrame > xFrame_42( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); + Reference< XFrame > xFrame_51( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); + Reference< XFrame > xFrame_52( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); + Reference< XFrame > xFrame_111( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); + Reference< XFrame > xFrame_112( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); + Reference< XFrame > xFrame_121( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); + Reference< XFrame > xFrame_411( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); + Reference< XFrame > xFrame_1121( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); + Reference< XFrame > xFrame_1122( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); + Reference< XFrame > xFrame_1123( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); + Reference< XFrame > xFrame_4111( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); + Reference< XFrame > xFrame_4112( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); + Reference< XFrame > xFrame_4113( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); + Reference< XFrame > xFrame_11221( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); + Reference< XFrame > xFrame_11231( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); + + // Initialize tasks and frames with names to support easy finding! + Reference< XFrame > xTaskFrame_1( xTask_1, UNO_QUERY ); + Reference< XFrame > xTaskFrame_2( xTask_2, UNO_QUERY ); + Reference< XFrame > xTaskFrame_3( xTask_3, UNO_QUERY ); + Reference< XFrame > xTaskFrame_4( xTask_4, UNO_QUERY ); + Reference< XFrame > xTaskFrame_5( xTask_5, UNO_QUERY ); + + xTaskFrame_1->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Task_1"))); + xTaskFrame_2->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Task_2"))); + xTaskFrame_3->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Task_3"))); + xTaskFrame_4->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Task_4"))); + xTaskFrame_5->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Task_5"))); + xFrame_11->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_11"))); + xFrame_12->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_12"))); + xFrame_21->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_21"))); + xFrame_22->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_22"))); + xFrame_31->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_31"))); + xFrame_32->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_32"))); + xFrame_41->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_41"))); + xFrame_42->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_42"))); + xFrame_51->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_51"))); + xFrame_52->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_52"))); + xFrame_111->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_111"))); + xFrame_112->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_112"))); + xFrame_121->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_121"))); + xFrame_411->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_411"))); + xFrame_1121->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_1121"))); + xFrame_1122->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_1122"))); + xFrame_1123->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_1123"))); + xFrame_4111->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_4111"))); + xFrame_4112->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_4112"))); + xFrame_4113->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_4113"))); + xFrame_11221->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_11221"))); + xFrame_11231->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_11231"))); + + // Build tree. + // Append tasks as childs of desktop. + xFrames->append( xTaskFrame_1 ); + xFrames->append( xTaskFrame_2 ); + xFrames->append( xTaskFrame_3 ); + xFrames->append( xTaskFrame_4 ); + xFrames->append( xTaskFrame_5 ); + + // Append frames as childs of tasks. + Reference< XFramesSupplier > xTaskFramesSupplier_1( xTask_1, UNO_QUERY ); + Reference< XFramesSupplier > xTaskFramesSupplier_2( xTask_2, UNO_QUERY ); + Reference< XFramesSupplier > xTaskFramesSupplier_3( xTask_3, UNO_QUERY ); + Reference< XFramesSupplier > xTaskFramesSupplier_4( xTask_4, UNO_QUERY ); + Reference< XFramesSupplier > xTaskFramesSupplier_5( xTask_5, UNO_QUERY ); + Reference< XFramesSupplier > xFramesSupplier_11( xFrame_11, UNO_QUERY ); + Reference< XFramesSupplier > xFramesSupplier_12( xFrame_12, UNO_QUERY ); + Reference< XFramesSupplier > xFramesSupplier_112( xFrame_112, UNO_QUERY ); + Reference< XFramesSupplier > xFramesSupplier_1122( xFrame_1122, UNO_QUERY ); + Reference< XFramesSupplier > xFramesSupplier_1123( xFrame_1123, UNO_QUERY ); + Reference< XFramesSupplier > xFramesSupplier_41( xFrame_41, UNO_QUERY ); + Reference< XFramesSupplier > xFramesSupplier_411( xFrame_411, UNO_QUERY ); + + xFrames = xTaskFramesSupplier_1->getFrames(); + xFrames->append( xFrame_11 ); + xFrames->append( xFrame_12 ); + xFrames = xTaskFramesSupplier_2->getFrames(); + xFrames->append( xFrame_21 ); + xFrames->append( xFrame_22 ); + xFrames = xTaskFramesSupplier_3->getFrames(); + xFrames->append( xFrame_31 ); + xFrames->append( xFrame_32 ); + xFrames = xTaskFramesSupplier_4->getFrames(); + xFrames->append( xFrame_41 ); + xFrames->append( xFrame_42 ); + xFrames = xTaskFramesSupplier_5->getFrames(); + xFrames->append( xFrame_51 ); + xFrames->append( xFrame_52 ); + xFrames = xFramesSupplier_11->getFrames(); + xFrames->append( xFrame_111 ); + xFrames->append( xFrame_112 ); + xFrames = xFramesSupplier_12->getFrames(); + xFrames->append( xFrame_121 ); + xFrames = xFramesSupplier_112->getFrames(); + xFrames->append( xFrame_1121 ); + xFrames->append( xFrame_1122 ); + xFrames->append( xFrame_1123 ); + xFrames = xFramesSupplier_1122->getFrames(); + xFrames->append( xFrame_11221 ); + xFrames = xFramesSupplier_1123->getFrames(); + xFrames->append( xFrame_11231 ); + xFrames = xFramesSupplier_41->getFrames(); + xFrames->append( xFrame_411 ); + xFrames = xFramesSupplier_411->getFrames(); + xFrames->append( xFrame_4111 ); + xFrames->append( xFrame_4112 ); + xFrames->append( xFrame_4113 ); + + // Create some active paths. + // desktop => task_1 => frame_11 => frame_112 => frame_1122 +// xDesktopSupplier->setActiveFrame( xTaskFrame_1 ); +// xTaskFramesSupplier_1->setActiveFrame( xFrame_11 ); +// xFramesSupplier_11->setActiveFrame( xFrame_112 ); +// xFramesSupplier_112->setActiveFrame( xFrame_1122 ); + // frame_41 => frame_411 => frame_4111 +// xFramesSupplier_41->setActiveFrame( xFrame_411 ); +// xFramesSupplier_411->setActiveFrame( xFrame_4111 ); + // task_3 => frame_31 +// xTaskFramesSupplier_3->setActiveFrame( xFrame_31 ); + // frame_1123 => frame_11231 +// xFramesSupplier_1123->setActiveFrame( xFrame_11231 ); + +// xTask_1->activate(); +// impl_logTree( xDesktop ); +// xFrame_41->activate(); +// impl_logTree( xDesktop ); +// xFrame_52->activate(); +// impl_logTree( xDesktop ); +// WRITE_LOGFILE( LOGFILENAME_TREE, "initiale Hierarchy:" ) + impl_logTree( xDesktop ); + +// xFrame_121->activate(); +// impl_logTree( xDesktop ); +// xFrame_41->activate(); +// impl_logTree( xDesktop ); +// xFrame_52->activate(); +// impl_logTree( xDesktop ); +// WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_411->activate():" ) + xFrame_411->activate(); +// WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_411->activate():" ) + impl_logTree( xDesktop ); +// xFrame_41->deactivate(); +// impl_logTree( xDesktop ); +// xFrame_4113->activate(); +// impl_logTree( xDesktop ); +// xFrame_21->activate(); +// impl_logTree( xDesktop ); +// WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_11231->activate():" ) + xFrame_11231->activate(); +// WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_11231->activate():" ) + impl_logTree( xDesktop ); + +// WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_11221->activate():" ) + xFrame_11221->activate(); +// WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_11221->activate():" ) + impl_logTree( xDesktop ); + +// WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_112->deactivate():" ) +// xFrame_112->getCreator()->setActiveFrame( Reference< XFrame >() ); + xFrame_112->deactivate(); +// WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_112->deactivate():" ) + impl_logTree( xDesktop ); + +// WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_41->activate():" ) + xFrame_41->activate(); +// WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_41->activate():" ) + impl_logTree( xDesktop ); + +// WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xTask_4->activate():" ) + xTask_4->activate(); +// WRITE_LOGFILE( LOGFILENAME_TREE, "nach xTask_4->activate():" ) + impl_logTree( xDesktop ); + +// WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_1123->deactivate():" ) + xFrame_1123->deactivate(); +// WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_1123->deactivate():" ) + impl_logTree( xDesktop ); +} + +//_________________________________________________________________________________________________________________ +// helper method to log current tree state +//_________________________________________________________________________________________________________________ +void TestApplication::impl_logTree( const Reference< XDesktop >& xDesktop ) +{ +#ifdef ENABLE_SERVICEDEBUG + // Use special feature of Desktop-implementation. + // NEVER USE THIS IN RELEASE VERSIONS!!! + Reference< XSPECIALDEBUGINTERFACE > xDebug( xDesktop, UNO_QUERY ); + + // Get a "stream" of all names of frames in tree. + OUString sTreeNamesStream = xDebug->dumpVariable( DUMPVARIABLE_TREEINFO, 0 ); + // And write it to logfile. + OString sOutPut = OUStringToOString( sTreeNamesStream, RTL_TEXTENCODING_UTF8 ); +// WRITE_LOGFILE( LOGFILENAME_TREE, "\nNew tree log:\n\n" ); +// WRITE_LOGFILE( LOGFILENAME_TREE, sOutPut.getStr() ); +// WRITE_LOGFILE( LOGFILENAME_TREE, "\n" ); +#endif +} diff --git a/framework/util/makefile.mk b/framework/util/makefile.mk new file mode 100644 index 000000000000..daf20fc1d69a --- /dev/null +++ b/framework/util/makefile.mk @@ -0,0 +1,146 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:29: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= framework +TARGET= fwk +USE_DEFFILE= TRUE +ENABLE_EXCEPTIONS= TRUE +NO_BSYMBOLIC= TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk +.INCLUDE : version.mk + +.IF "$(COM)"=="ICC" +LINKFLAGS+=/SEGMENTS:1024 /PACKD:32768 +.ENDIF + + +# --- DLL BaehServices ---------------------------------------------------- + +SHL2TARGET= $(FRAMEWORK_TARGET)$(UPD)$(DLLPOSTFIX) +SHL2IMPLIB= i$(TARGET)$(UPD)$(DLLPOSTFIX) + +SHL2OBJS= $(SLO)$/registerbaehservices.obj + +SHL2LIBS= $(SLB)$/fwk_baehservices.lib \ + $(SLB)$/fwk_services.lib \ + $(SLB)$/fwk_services.lib \ + $(SLB)$/fwk_helper.lib \ + $(SLB)$/fwk_classes.lib + +SHL2STDLIBS= $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(VOSLIB) \ + $(SALLIB) \ + $(TOOLSLIB) \ + $(SVTOOLLIB) \ + $(TKLIB) \ + $(SVLIB) \ + $(UNOTOOLSLIB) \ + $(SVLLIB) + + +SHL2DEF= $(MISC)$/$(SHL2TARGET).def + +DEF2NAME= $(SHL2TARGET) + +DEF2EXPORTFILE= exports.dxp + +# --- Applikation -------------------------------------------------------- + +APP1TARGET= framework + +APP1OBJS= $(SLO)$/framework.obj + +APP1LIBS= $(SLB)$/fwk_classes.lib \ + $(SLB)$/fwk_helper.lib \ + $(SLB)$/fwk_services.lib + + + +APP1STDLIBS= \ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(OSLLIB) \ + $(SALLIB) \ + $(VOSLIB) \ + $(TOOLSLIB) \ + $(SVTOOLLIB) \ + $(TKLIB) \ + $(UNOTOOLSLIB) \ + $(SVLIB) + +APP1DEPN= $(SLB)$/fwk_helper.lib \ + $(SLB)$/fwk_classes.lib + +.IF "$(GUI)"=="WIN" || "$(GUI)"=="OS2" +APP1DEF= $(MISC)$/framework.def +.ENDIF + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/framework/util/makefile.pmk b/framework/util/makefile.pmk new file mode 100644 index 000000000000..61541bba1603 --- /dev/null +++ b/framework/util/makefile.pmk @@ -0,0 +1,83 @@ +#************************************************************************* +# +# $RCSfile: makefile.pmk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:29: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): _______________________________________ +# +# +# +#************************************************************************* +PROJECTPCH4DLL= TRUE +PROJECTPCH= frameworkpch +PROJECTPCHSOURCE= $(PRJ)$/util$/frameworkpch +PDBTARGET= framework + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +.IF "$(GUI)" != "MAC" +CFLAGS+=-I..$/..$/idl +.ELSE +CFLAGS+=-I ..$/..$/idl +.ENDIF + +.IF "$(GUI)"=="UNX" +PATH_SEPERATOR=":" +.ELSE +PATH_SEPERATOR=";" +.ENDIF + +JARFILES = uno.jar diff --git a/framework/util/target.pmk b/framework/util/target.pmk new file mode 100644 index 000000000000..9e25dcfcaad8 --- /dev/null +++ b/framework/util/target.pmk @@ -0,0 +1,69 @@ +#************************************************************************* +# +# $RCSfile: target.pmk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:29: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): _______________________________________ +# +# +# +#************************************************************************* +ALLSLO: $(SLOFILES) + +SOSHL: $(SHL1TARGETN) + +WHOLEPRJ: + cd $(PRJ)$/prj + make debug linkinc prjpch compinc + @echo "READY" diff --git a/idl/inc/attrib.hxx b/idl/inc/attrib.hxx new file mode 100644 index 000000000000..f26ca2be8cc8 --- /dev/null +++ b/idl/inc/attrib.hxx @@ -0,0 +1,113 @@ +/************************************************************************* + * + * $RCSfile: attrib.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _ATTRIB_HXX +#define _ATTRIB_HXX + +#ifdef IDL_COMPILER +#include <hash.hxx> +#include <object.hxx> + +/******************** class SvAttribute **********************************/ +class SvAttribute +{ + SvStringHashEntryRef aName; + CreateMetaObjectType pCreateMethod; + SvMetaObjectRef aTmpClass; +public: + SvAttribute( SvStringHashEntry * pAttribName, + CreateMetaObjectType pMethod ) + : aName( pAttribName ), + pCreateMethod( pMethod ) {} + + SvMetaObjectRef CreateClass() + { + if( aTmpClass.Is() ) + { + SvMetaObjectRef aTmp( aTmpClass ); + aTmpClass.Clear(); + return aTmp; + } + return pCreateMethod(); + } + void PutBackClass( SvMetaObject * pClass ) + { /* OptimierungaTmpClass = pClass*/; } +}; + +#define SV_ATTRIBUTE( AttributeName, PostfixClassName ) \ + SvAttribute( SvHash_##AttributeName(), \ + SvMeta##PostfixClassName::Create ) + +/******************** class SvAttributeList ******************************/ +DECLARE_LIST(SvAttributeListImpl,SvAttribute*) +class SvAttributeList : public SvAttributeListImpl +{ +public: + SvAttributeList() : SvAttributeListImpl() {} + + void Append( SvAttribute * pObj ) + { Insert( pObj, LIST_APPEND ); } +}; + + +#endif // IDL_COMPILER +#endif // _ATTRIB_HXX + diff --git a/idl/inc/basobj.hxx b/idl/inc/basobj.hxx new file mode 100644 index 000000000000..b6f04c47be94 --- /dev/null +++ b/idl/inc/basobj.hxx @@ -0,0 +1,338 @@ +/************************************************************************* + * + * $RCSfile: basobj.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _BASOBJ_HXX +#define _BASOBJ_HXX + +#include <tools/ref.hxx> +#include <bastype.hxx> + +#ifndef _PSTM_HXX //autogen +#include <tools/pstm.hxx> +#endif + +class SvTokenStream; +class SvMetaObject; +class SvAttributeList; +class SvIdlDataBase; + +typedef SvMetaObject * (*CreateMetaObjectType)(); +#define IDL_WRITE_COMPILER 0x8000 +#define IDL_WRITE_BROWSER 0x4000 +#define IDL_WRITE_CALLING 0x2000 +#define IDL_WRITE_MASK 0xE000 + +#define C_PREF "C_" + +enum WriteType +{ + WRITE_IDL, WRITE_ODL, WRITE_SLOTMAP, WRITE_C_HEADER, WRITE_C_SOURCE, + WRITE_CXX_HEADER, WRITE_CXX_SOURCE, WRITE_DOCU +}; + +enum +{ + WA_METHOD = 0x1, WA_VARIABLE = 0x2, WA_ARGUMENT = 0x4, + WA_STRUCT = 0x8, WA_READONLY = 0x10 +}; +typedef int WriteAttribute; + +/******************** Meta Factory **************************************/ +#ifdef IDL_COMPILER + +#define PRV_SV_DECL_META_FACTORY( Class ) \ + static SvAttributeList * pAttribList; \ + static SvAttributeList & GetAttributeList(); \ + static SvMetaObject * Create() { return new Class; } \ + static const char * GetClassName() { return #Class; } + +#define PRV_SV_IMPL_META_FACTORY( Class ) \ + SvAttributeList * Class::pAttribList = NULL; + +#else + +#define PRV_SV_DECL_META_FACTORY( Class ) + +#define PRV_SV_IMPL_META_FACTORY( Class ) + +#endif // IDL_COMPILER + +#define SV_DECL_META_FACTORY( Class, CLASS_ID ) \ + SV_DECL_PERSIST( Class, CLASS_ID ) \ + PRV_SV_DECL_META_FACTORY( Class ) \ + SvMetaObject * MakeClone() const; \ + Class * Clone() const { return (Class *)MakeClone(); } + + +#define SV_DECL_META_FACTORY1( Class, Super1, CLASS_ID ) \ + SV_DECL_PERSIST1( Class, Super1, CLASS_ID ) \ + PRV_SV_DECL_META_FACTORY( Class ) \ + SvMetaObject * MakeClone() const; \ + Class * Clone() const { return (Class *)MakeClone(); } + +#define SV_IMPL_META_FACTORY( Class ) \ + PRV_SV_IMPL_META_FACTORY( Class ) \ + SV_IMPL_PERSIST( Class ) \ + SvMetaObject * Class::MakeClone() const { return new Class( *this ); } + + +#define SV_IMPL_META_FACTORY1( Class, Super1 ) \ + PRV_SV_IMPL_META_FACTORY( Class ) \ + SV_IMPL_PERSIST1( Class, Super1 ) \ + SvMetaObject * Class::MakeClone() const { return new Class( *this ); } + + +/******************** class SvMetaObject ********************************/ +class SvMetaObject : public SvPersistBase +{ +public: + SV_DECL_META_FACTORY1( SvMetaObject, SvPersistBase, 14 ) + SvMetaObject(); + +#ifdef IDL_COMPILER + static void WriteTab( SvStream & rOutStm, USHORT nTab ); + static BOOL TestAndSeekSpaceOnly( SvStream &, ULONG nBegPos ); + static void Back2Delemitter( SvStream & ); + static void WriteStars( SvStream & ); + + virtual BOOL ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); + virtual void WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab ); + + virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab, + WriteType, WriteAttribute = 0 ); + + virtual void WriteCxx( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab ); + virtual void WriteHxx( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab ); +#endif +}; +SV_DECL_IMPL_REF(SvMetaObject) +//SV_DECL_IMPL_PERSIST_LIST(SvMetaObject,SvMetaObject *) +SV_DECL_PERSIST_LIST(SvMetaObject,SvMetaObject *) +SV_IMPL_PERSIST_LIST(SvMetaObject,SvMetaObject *) + + +class SvMetaObjectMemberStack +{ + SvMetaObjectMemberList aList; +public: + SvMetaObjectMemberStack() {;} + + void Push( SvMetaObject * pObj ) + { aList.Insert( pObj, LIST_APPEND ); } + SvMetaObject * Pop() { return aList.Remove( aList.Count() -1 ); } + SvMetaObject * Top() const { return aList.GetObject( aList.Count() -1 ); } + void Clear() { aList.Clear(); } + ULONG Count() const { return aList.Count(); } + + SvMetaObject * Get( TypeId nType ) + { + SvMetaObject * pObj = aList.Last(); + while( pObj ) + { + if( pObj->IsA( nType ) ) + return pObj; + pObj = aList.Prev(); + } + return NULL; + } +}; + +/******************** class SvMetaName **********************************/ +class SvMetaName : public SvMetaObject +{ + SvString aName; + SvHelpContext aHelpContext; + SvHelpText aHelpText; + SvString aConfigName; + SvString aDescription; + +protected: +#ifdef IDL_COMPILER + virtual BOOL ReadNameSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); + void DoReadContextSvIdl( SvIdlDataBase &, SvTokenStream & rInStm, + char c = '\0' ); + virtual void ReadContextSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); + virtual void WriteContextSvIdl( SvIdlDataBase & rBase, + SvStream & rOutStm, USHORT nTab ); + virtual void ReadAttributesSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm ); + virtual void WriteAttributesSvIdl( SvIdlDataBase & rBase, + SvStream & rOutStm, USHORT nTab ); + virtual void WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab, + WriteType, WriteAttribute = 0); + virtual void WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab, + WriteType, WriteAttribute = 0); +#endif +public: + SV_DECL_META_FACTORY1( SvMetaName, SvMetaObject, 15 ) + SvMetaName(); + + virtual BOOL SetName( const ByteString & rName, SvIdlDataBase * = NULL ); + void SetDescription( const ByteString& rText ) + { aDescription = rText; } + const SvHelpContext& GetHelpContext() const { return aHelpContext; } + virtual const SvString & GetName() const { return aName; } + virtual const SvString & GetHelpText() const { return aHelpText; } + virtual const SvString & GetConfigName() const{ return aConfigName; } + virtual const SvString& GetDescription() const{ return aDescription; } + +#ifdef IDL_COMPILER + virtual BOOL Test( SvIdlDataBase &, SvTokenStream & rInStm ); + virtual BOOL ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); + virtual void WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab ); + virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab, + WriteType, WriteAttribute = 0); + void WriteDescription( SvIdlDataBase& rBase, SvStream& rOutStm ); +#endif +}; +SV_DECL_IMPL_REF(SvMetaName) +SV_DECL_IMPL_PERSIST_LIST(SvMetaName,SvMetaName *) + + +/******************** class SvMetaReference *****************************/ +SV_DECL_REF(SvMetaReference) +class SvMetaReference : public SvMetaName +{ +protected: + SvMetaReferenceRef aRef; +public: + SV_DECL_META_FACTORY1( SvMetaReference, SvMetaName, 17 ) + SvMetaReference(); + + const SvString & GetName() const + { + return ( !aRef.Is() + || SvMetaName::GetName().Len() ) + ? SvMetaName::GetName() + : aRef->GetName(); + } + + const SvString & GetHelpText() const + { + return ( !aRef.Is() + || SvMetaName::GetHelpText().Len() ) + ? SvMetaName::GetHelpText() + : aRef->GetHelpText(); + } + + const SvString & GetConfigName() const + { + return ( !aRef.Is() + || SvMetaName::GetConfigName().Len() ) + ? SvMetaName::GetConfigName() + : aRef->GetConfigName(); + } + + const SvString & GetDescription() const + { + return ( !aRef.Is() + || SvMetaName::GetDescription().Len() ) + ? SvMetaName::GetDescription() + : aRef->GetDescription(); + } + SvMetaReference * GetRef() const { return aRef; } + void SetRef( SvMetaReference * pRef ) + { aRef = pRef; } +}; +SV_IMPL_REF(SvMetaReference) +SV_DECL_IMPL_PERSIST_LIST(SvMetaReference,SvMetaReference *) + + +/******************** class SvMetaExtern *********************************/ +class SvMetaModule; +class SvMetaExtern : public SvMetaReference +{ + SvMetaModule * pModule; // in welchem Modul enthalten + + SvUUId aUUId; + SvVersion aVersion; + BOOL bReadUUId; + BOOL bReadVersion; +public: + SV_DECL_META_FACTORY1( SvMetaExtern, SvMetaName, 16 ) + SvMetaExtern(); + + SvMetaModule * GetModule() const; + + const SvGlobalName &GetUUId() const; + const SvVersion & GetVersion() const { return aVersion; } +#ifdef IDL_COMPILER + void SetModule( SvIdlDataBase & rBase ); + virtual BOOL ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); + virtual void WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab ); + + virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab, + WriteType, WriteAttribute = 0); +protected: + virtual void ReadAttributesSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); + virtual void WriteAttributesSvIdl( SvIdlDataBase & rBase, + SvStream & rOutStm, USHORT nTab ); + virtual void WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab, + WriteType, WriteAttribute = 0); +#endif +}; +SV_DECL_IMPL_REF(SvMetaExtern) +SV_DECL_IMPL_PERSIST_LIST(SvMetaExtern,SvMetaExtern *) + + +#endif // _BASOBJ_HXX + + diff --git a/idl/inc/bastype.hxx b/idl/inc/bastype.hxx new file mode 100644 index 000000000000..9654d09eff23 --- /dev/null +++ b/idl/inc/bastype.hxx @@ -0,0 +1,399 @@ +/************************************************************************* + * + * $RCSfile: bastype.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _BASTYPE_HXX +#define _BASTYPE_HXX + + +#ifndef _GLOBNAME_HXX //autogen +#include <tools/globname.hxx> +#endif + +#ifndef _GEN_HXX //autogen +#include <tools/gen.hxx> +#endif + +#ifndef _STREAM_HXX //autogen +#include <tools/stream.hxx> +#endif + +#ifndef _UNQID_HXX //autogen +#include <tools/unqid.hxx> +#endif + +#ifndef _STRING_HXX //autogen +#include <tools/string.hxx> +#endif + +class SvStringHashEntry; +class SvIdlDataBase; +class SvTokenStream; + +ByteString MakeDefineName( const ByteString & rName ); +/************class RangeUniqueIdContainer ****************************/ +class RangeUniqueIdContainer : private UniqueIdContainer +{ + UINT32 nMax, nMin; +public: + RangeUniqueIdContainer(); + RangeUniqueIdContainer( const Range & rRange ); + ~RangeUniqueIdContainer(); + + RangeUniqueIdContainer & operator = ( const RangeUniqueIdContainer & ); + + BOOL CreateId( UniqueItemId * ); + BOOL CreateId( UINT32 nIdValue, UniqueItemId * ); + + UINT32 GetMin() const { return nMin; } + UINT32 GetMax() const { return nMax; } +}; + + +/******************** class SvUINT32 **********************************/ +class SvUINT32 +{ + UINT32 nVal; +public: + SvUINT32() { nVal = 0; } + SvUINT32( UINT32 n ) : nVal( n ) {} + SvUINT32 & operator = ( UINT32 n ) { nVal = n; return *this; } + + operator UINT32 &() { return nVal; } + + static UINT32 Read( SvStream & rStm ); + static void Write( SvStream & rStm, UINT32 nVal ); + + friend SvStream& operator << (SvStream & rStm, const SvUINT32 & r ) + { SvUINT32::Write( rStm, r.nVal ); return rStm; } + friend SvStream& operator >> (SvStream & rStm, SvUINT32 & r ) + { r.nVal = SvUINT32::Read( rStm ); return rStm; } + +#ifdef IDL_COMPILER + BOOL ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ); + BOOL WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm ); +#endif +}; + + +/******************** class SvINT16 **********************************/ +class SvINT16 +{ + short nVal; +public: + SvINT16() { nVal = 0; } + SvINT16( short n ) : nVal( n ) {} + SvINT16 & operator = ( short n ) { nVal = n; return *this; } + + operator short &() { return nVal; } + + friend SvStream& operator << (SvStream & rStm, const SvINT16 & r ) + { SvUINT32::Write( rStm, (UINT32)r.nVal ); return rStm; } + friend SvStream& operator >> (SvStream & rStm, SvINT16 & r ) + { r.nVal = (short)SvUINT32::Read( rStm ); return rStm; } + +#ifdef IDL_COMPILER + BOOL ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ); + BOOL WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm ); +#endif +}; + + +/******************** class SvUINT16 **********************************/ +class SvUINT16 +{ + USHORT nVal; +public: + SvUINT16() { nVal = 0; } + SvUINT16( USHORT n ) : nVal( n ) {} + SvUINT16 & operator = ( USHORT n ) { nVal = n; return *this; } + + operator UINT16 &() { return nVal; } + + friend SvStream& operator << (SvStream & rStm, const SvUINT16 & r ) + { SvUINT32::Write( rStm, (UINT32)r.nVal ); return rStm; } + friend SvStream& operator >> (SvStream & rStm, SvUINT16 & r ) + { r.nVal = (USHORT)SvUINT32::Read( rStm ); return rStm; } + +#ifdef IDL_COMPILER + BOOL ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ); + BOOL WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm ); +#endif +}; + + +/******************** class SvINT32 **********************************/ +class SvINT32 +{ + INT32 nVal; +public: + SvINT32() { nVal = 0; } + SvINT32( INT32 n ) : nVal( n ) {} + SvINT32 & operator = ( INT32 n ) { nVal = n; return *this; } + + operator INT32 &() { return nVal; } + + friend SvStream& operator << (SvStream & rStm, const SvINT32 & r ) + { SvUINT32::Write( rStm, (UINT32)r.nVal ); return rStm; } + friend SvStream& operator >> (SvStream & rStm, SvINT32 & r ) + { r.nVal = (INT32)SvUINT32::Read( rStm ); return rStm; } + +#ifdef IDL_COMPILER + BOOL ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ); + BOOL WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm ); +#endif +}; + + +/******************** class Svint **********************************/ +class Svint +{ + int nVal; + BOOL bSet; +public: + Svint() { nVal = bSet = 0; } + Svint( int n ) : nVal( n ), bSet( TRUE ) {} + Svint( int n, BOOL bSetP ) : nVal( n ), bSet( bSetP ) {} + Svint & operator = ( int n ) { nVal = n; bSet = TRUE; return *this; } + + operator int ()const { return nVal; } + BOOL IsSet() const { return bSet; } + + friend SvStream& operator << (SvStream & rStm, const Svint & r ) + { SvUINT32::Write( rStm, (UINT32)r.nVal ); rStm << r.bSet; return rStm; } + friend SvStream& operator >> (SvStream & rStm, Svint & r ) + { r.nVal = (int)SvUINT32::Read( rStm ); rStm >> r.bSet ; return rStm; } + +#ifdef IDL_COMPILER + BOOL ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ); + BOOL WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm ); +#endif +}; + + +/******************** class SvBOOL **********************************/ +class SvBOOL +{ + BOOL nVal:1, + bSet:1; +public: + SvBOOL() { bSet = nVal = FALSE; } + SvBOOL( BOOL n ) : nVal( n ), bSet( TRUE ) {} + SvBOOL( BOOL n, BOOL bSetP ) : nVal( n ), bSet( bSetP ) {} + SvBOOL & operator = ( BOOL n ) { nVal = n; bSet = TRUE; return *this; } + + operator BOOL() const { return nVal; } +#ifdef STC + operator int() const { return nVal; } +#endif + BOOL Is() const { return nVal; } + BOOL IsSet() const { return bSet; } + + friend SvStream& operator << (SvStream &, const SvBOOL &); + friend SvStream& operator >> (SvStream &, SvBOOL &); + +#ifdef IDL_COMPILER + BOOL ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ); + BOOL WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm ); + ByteString GetSvIdlString( SvStringHashEntry * pName ); +#endif +}; + + +/******************** class SvIdentifier **********************************/ +class SvIdentifier : public ByteString +{ +public: + SvIdentifier(){}; + SvIdentifier & operator = ( const ByteString & rStr ) + { ByteString::operator =( rStr ); return *this; } + friend SvStream& operator << (SvStream &, const SvIdentifier &); + friend SvStream& operator >> (SvStream &, SvIdentifier &); + + BOOL IsSet() const { return Len() != 0; } +#ifdef IDL_COMPILER + BOOL ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ); + BOOL WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm, + USHORT nTab ); +#endif +}; + + +/******************** class SvIdentifier **********************************/ +class SvNumberIdentifier : public SvIdentifier +{ + UINT32 nValue; + // darf nicht benutzt werden + BOOL ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ); +public: + SvNumberIdentifier() : nValue( 0 ) {}; + BOOL IsSet() const + { + return SvIdentifier::IsSet() || nValue != 0; + } + UINT32 GetValue() const { return nValue; } + void SetValue( UINT32 nVal ) { nValue = nVal; } + + friend SvStream& operator << (SvStream &, const SvNumberIdentifier &); + friend SvStream& operator >> (SvStream &, SvNumberIdentifier &); +#ifdef IDL_COMPILER + BOOL ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); + BOOL ReadSvIdl( SvIdlDataBase &, SvStringHashEntry * pName, + SvTokenStream & rInStm ); +#endif +}; + + +/******************** class SvString **********************************/ +class SvString : public ByteString +{ +public: + SvString(){}; + SvString & operator = ( const ByteString & rStr ) + { ByteString::operator =( rStr ); return *this; } + BOOL IsSet() const { return Len() != 0; } + friend SvStream& operator << (SvStream &, const SvString &); + friend SvStream& operator >> (SvStream &, SvString &); + +#ifdef IDL_COMPILER + BOOL ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ); + BOOL WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm, + USHORT nTab ); +#endif +}; + + +/******************** class SvHelpText **********************************/ +class SvHelpText : public SvString +{ +public: + SvHelpText() {} +#ifdef IDL_COMPILER + BOOL ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); + BOOL WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab ); +#endif +}; + + +/******************** class SvHelpContext *******************************/ +class SvHelpContext : public SvNumberIdentifier +{ +/* + UniqueItemId aId; + BOOL bSet; +public: + SvHelpContext() : bSet( FALSE ) {} + + BOOL IsSet() const { return bSet; } + UINT32 GetId() const { return aId.GetId(); } + +#ifdef IDL_COMPILER + BOOL ReadSvIdl( RangeUniqueIdContainer & rCont, + SvTokenStream & rInStm ); + BOOL WriteSvIdl( RangeUniqueIdContainer & rCont, SvStream & rOutStm, + USHORT nTab ); +#endif +*/ +}; + +/******************** class SvUUId *************************************/ +class SvUUId : public SvGlobalName +{ +public: + SvUUId() {} +#ifdef IDL_COMPILER + BOOL ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); + BOOL WriteSvIdl( SvStream & rOutStm ); +#endif +}; + + +/******************** class SvVersion **********************************/ +class SvVersion +{ + USHORT nMajorVersion; + USHORT nMinorVersion; +public: + SvVersion() : nMajorVersion( 1 ), nMinorVersion( 0 ) {} + BOOL operator == ( const SvVersion & r ) + { + return (r.nMajorVersion == nMajorVersion) + && (r.nMinorVersion == nMinorVersion); + } + BOOL operator != ( const SvVersion & r ) + { + return !(*this == r); + } + + USHORT GetMajorVersion() const { return nMajorVersion; } + USHORT GetMinorVersion() const { return nMinorVersion; } + + friend SvStream& operator << (SvStream &, const SvVersion &); + friend SvStream& operator >> (SvStream &, SvVersion &); +#ifdef IDL_COMPILER + BOOL ReadSvIdl( SvTokenStream & rInStm ); + BOOL WriteSvIdl( SvStream & rOutStm ); +#endif +}; + + +#endif // _BASTYPE_HXX + diff --git a/idl/inc/char.hxx b/idl/inc/char.hxx new file mode 100644 index 000000000000..d4d0ab0d4c1c --- /dev/null +++ b/idl/inc/char.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * $RCSfile: char.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _CHAR_HXX +#define _CHAR_HXX + +#ifndef _STRING_HXX //autogen +#include <tools/string.hxx> +#endif + +/******************* T y p e s *******************************************/ +class SvChar +{ +public: + static BOOL MakeChar( char * pChar, char ** ppStr ); + static char * GetTable( CharSet nSource, CharSet nDest ); +}; + + +#endif // _CHAR_HXX diff --git a/idl/inc/command.hxx b/idl/inc/command.hxx new file mode 100644 index 000000000000..2c18ae9d296a --- /dev/null +++ b/idl/inc/command.hxx @@ -0,0 +1,117 @@ +/************************************************************************* + * + * $RCSfile: command.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _COMMAND_HXX +#define _COMMAND_HXX + + +#ifndef _LIST_HXX //autogen +#include <tools/list.hxx> +#endif + +#ifndef _STRING_HXX //autogen +#include <tools/string.hxx> +#endif + +#ifndef STRING_LIST +#define STRING_LIST +DECLARE_LIST( StringList, String * ) +#endif + +DECLARE_LIST( ByteStringList, ByteString* ) + +/******************** class SvCommand ************************************/ +class SvCommand +{ +public: + String aDataBaseFile; + StringList aInFileList; + String aListFile; + String aSlotMapFile; + String aSfxItemFile; + String aODLFile; + String aCallingFile; + String aCxxFile; + String aHxxFile; + String aSrcFile; + String aPath; + String aCHeaderFile; + String aCSourceFile; + String aTargetFile; + ByteString aSrsLine; + String aHelpIdFile; + String aCSVFile; + String aExportFile; + String aDocuFile; + UINT32 nFlags; + + SvCommand(); + SvCommand( int argc, char ** argv ); + ~SvCommand(); +}; + +void Init( const SvCommand & rCommand ); +class SvIdlWorkingBase; +BOOL ReadIdl( SvIdlWorkingBase * pDataBase, const SvCommand & rCommand ); +void DeInit(); + +#endif // _COMMAND_HXX + diff --git a/idl/inc/database.hxx b/idl/inc/database.hxx new file mode 100644 index 000000000000..5b181efbd377 --- /dev/null +++ b/idl/inc/database.hxx @@ -0,0 +1,231 @@ +/************************************************************************* + * + * $RCSfile: database.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _DATABASE_HXX +#define _DATABASE_HXX + +#include <module.hxx> +#include <hash.hxx> +#include <lex.hxx> + +#ifndef _PSTM_HXX //autogen +#include <tools/pstm.hxx> +#endif + +/************************************************************************* +*************************************************************************/ + +#ifdef IDL_COMPILER +/******************** class SvIdlError ***********************************/ +class SvIdlError +{ + ByteString aText; +public: + UINT32 nLine, nColumn; + + SvIdlError() : nLine(0), nColumn(0) {} + SvIdlError( UINT32 nL, UINT32 nC ) + : nLine(nL), nColumn(nC) {} + + const ByteString & GetText() const { return aText; } + void SetText( const ByteString & rT ) { aText = rT; } + BOOL IsError() const { return nLine != 0; } + void Clear() { nLine = nColumn = 0; } + SvIdlError & operator = ( const SvIdlError & rRef ) + { aText = rRef.aText; + nLine = rRef.nLine; + nColumn = rRef.nColumn; + return *this; + } +}; +#endif + +/******************** class SvIdlDataBase ********************************/ +class SvIdlDataBase +{ + BOOL bExport; + String aExportFile; + ULONG nUniqueId; + String aDataBaseFile; + SvFileStream * pStm; + BOOL bIsModified; + SvPersistStream aPersStream; + StringList aIdFileList; + SvStringHashTable * pIdTable; + + SvMetaTypeMemberList aTypeList; + SvMetaClassMemberList aClassList; + SvMetaModuleMemberList aModuleList; + SvMetaAttributeMemberList aAttrList; + SvMetaTypeMemberList aTmpTypeList; // nicht Persistent + +protected: +#ifdef IDL_COMPILER + SvMetaAttributeMemberList& GetAttrList() { return aAttrList; } + ByteString aModulePrefix; + SvMetaObjectMemberStack aContextStack; + String aPath; + SvIdlError aError; + void WriteReset() + { + aUsedTypes.Clear(); + aIFaceName.Erase(); + } +#endif +public: + SvIdlDataBase(); + ~SvIdlDataBase(); + static BOOL IsBinaryFormat( SvStream & rInStm ); + + void Load( SvStream & rInStm ); + void Save( SvStream & rInStm, UINT32 nContextFlags ); + + BOOL IsModified() const; + + + SvStringHashTable * GetIdTable() { return pIdTable; } + SvMetaTypeMemberList & GetTypeList(); + SvMetaClassMemberList & GetClassList() { return aClassList; } + SvMetaModuleMemberList & GetModuleList() { return aModuleList; } + SvMetaModule * GetModule( const ByteString & rName ); + + // Liste der benutzten Typen beim Schreiben + SvMetaTypeMemberList aUsedTypes; + ByteString aIFaceName; + SvNumberIdentifier aStructSlotId; + +#ifdef IDL_COMPILER + void StartNewFile( const String& rName ); + void SetExportFile( const String& rName ) + { aExportFile = rName; } + void AppendAttr( SvMetaAttribute *pSlot ); + const ByteString& GetActModulePrefix() const { return aModulePrefix; } + const SvIdlError & GetError() const { return aError; } + void SetError( const SvIdlError & r ) + { aError = r; } + + const String & GetPath() const { return aPath; } + SvMetaObjectMemberStack & GetStack() { return aContextStack; } + + void Write( const ByteString & rText ); + void WriteError( const ByteString & rErrWrn, + const ByteString & rFileName, + const ByteString & rErrorText, + ULONG nRow = 0, ULONG nColumn = 0 ) const; + void WriteError( SvTokenStream & rInStm ); + void SetError( const ByteString & rError, SvToken * pTok ); + void Push( SvMetaObject * pObj ); + BOOL Pop( BOOL bOk, SvTokenStream & rInStm, UINT32 nTokPos ) + { + GetStack().Pop(); + if( bOk ) + aError.Clear(); + else + rInStm.Seek( nTokPos ); + return bOk; + } + BOOL FillTypeList( SvMetaTypeList & rOutList, + SvToken * pNameTok ); + + ULONG GetUniqueId() { return ++nUniqueId; } + BOOL FindId( const ByteString & rIdName, ULONG * pVal ); + BOOL InsertId( const ByteString & rIdName, ULONG nVal ); + BOOL ReadIdFile( const String & rFileName ); + + SvMetaType * FindType( const ByteString & rName ); + static SvMetaType * FindType( const SvMetaType *, SvMetaTypeMemberList & ); + static ByteString * FindName( const ByteString & rName, ByteStringList & ); + + SvMetaType * ReadKnownType( SvTokenStream & rInStm ); + SvMetaAttribute * FindAttr( SvMetaAttributeMemberList *, SvMetaAttribute * ) const; + SvMetaAttribute * ReadKnownAttr( SvTokenStream & rInStm, + SvMetaType * pType = NULL ); + SvMetaAttribute * SearchKnownAttr( const SvNumberIdentifier& ); + SvMetaClass * ReadKnownClass( SvTokenStream & rInStm ); +#endif +}; + +#ifdef IDL_COMPILER +class SvIdlWorkingBase : public SvIdlDataBase +{ +public: + SvIdlWorkingBase(); + + BOOL ReadSvIdl( SvTokenStream &, BOOL bImported, const String & rPath ); + BOOL WriteSvIdl( SvStream & ); + + BOOL WriteSfx( SvStream & ); + BOOL WriteHelpIds( SvStream & ); + BOOL WriteCHeader( SvStream & ); + BOOL WriteCSource( SvStream & ); + BOOL WriteSfxItem( SvStream & ); +// BOOL WriteSbx( SvStream & ); + BOOL WriteOdl( SvStream & ); + BOOL WriteSrc( SvStream & ); + BOOL WriteCxx( SvStream & ); + BOOL WriteHxx( SvStream & ); + BOOL WriteCSV( SvStream& ); + BOOL WriteDocumentation( SvStream& ); +}; +#endif + +#endif // _DATABASE_HXX + diff --git a/idl/inc/globals.hxx b/idl/inc/globals.hxx new file mode 100644 index 000000000000..a91ba05e76d9 --- /dev/null +++ b/idl/inc/globals.hxx @@ -0,0 +1,274 @@ +/************************************************************************* + * + * $RCSfile: globals.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _GLOBALS_HXX +#define _GLOBALS_HXX + +#ifdef IDL_COMPILER +#include <hash.hxx> + +#ifdef ICC +#undef _Export +#endif + +class SvIdlWorkingBase; +class SvClassManager; +struct SvGlobalHashNames +{ + SvStringHashEntryRef MM_Name; + SvStringHashEntryRef MM_module; + SvStringHashEntryRef MM_interface; + SvStringHashEntryRef MM_in; + SvStringHashEntryRef MM_out; + SvStringHashEntryRef MM_inout; + SvStringHashEntryRef MM_String; + SvStringHashEntryRef MM_UCHAR; + SvStringHashEntryRef MM_USHORT; + SvStringHashEntryRef MM_uuid; + SvStringHashEntryRef MM_HelpContext; + SvStringHashEntryRef MM_HelpText; + SvStringHashEntryRef MM_void; + SvStringHashEntryRef MM_shell; + SvStringHashEntryRef MM_Get; + SvStringHashEntryRef MM_Set; + SvStringHashEntryRef MM_SlotId; + SvStringHashEntryRef MM_HasCoreId; + SvStringHashEntryRef MM_Cachable; + SvStringHashEntryRef MM_Volatile; + SvStringHashEntryRef MM_Toggle; + SvStringHashEntryRef MM_AutoUpdate; + SvStringHashEntryRef MM_Synchron; + SvStringHashEntryRef MM_Asynchron; + SvStringHashEntryRef MM_RecordPerSet; + SvStringHashEntryRef MM_RecordPerItem; + SvStringHashEntryRef MM_RecordManual; + SvStringHashEntryRef MM_NoRecord; + SvStringHashEntryRef MM_RecordAbsolute; + SvStringHashEntryRef MM_enum; + SvStringHashEntryRef MM_UINT16; + SvStringHashEntryRef MM_INT16; + SvStringHashEntryRef MM_UINT32; + SvStringHashEntryRef MM_INT32; + SvStringHashEntryRef MM_int; + SvStringHashEntryRef MM_BOOL; + SvStringHashEntryRef MM_char; + SvStringHashEntryRef MM_BYTE; + SvStringHashEntryRef MM_float; + SvStringHashEntryRef MM_double; + SvStringHashEntryRef MM_item; + SvStringHashEntryRef MM_PseudoSlots; + SvStringHashEntryRef MM_map; + SvStringHashEntryRef MM_Default; + SvStringHashEntryRef MM_HelpFile; + SvStringHashEntryRef MM_Version; + SvStringHashEntryRef MM_import; + SvStringHashEntryRef MM_SlotIdFile; + SvStringHashEntryRef MM_SvName; + SvStringHashEntryRef MM_SbxName; + SvStringHashEntryRef MM_ItemName; + SvStringHashEntryRef MM_OdlName; + SvStringHashEntryRef MM_include; + SvStringHashEntryRef MM_ExecMethod; + SvStringHashEntryRef MM_StateMethod; + SvStringHashEntryRef MM_GroupId; + SvStringHashEntryRef MM_HasDialog; + SvStringHashEntryRef MM_TypeLibFile; + SvStringHashEntryRef MM_Export; + SvStringHashEntryRef MM_Automation; + SvStringHashEntryRef MM_PseudoPrefix; + SvStringHashEntryRef MM_define; + SvStringHashEntryRef MM_MenuConfig; + SvStringHashEntryRef MM_ToolBoxConfig; + SvStringHashEntryRef MM_StatusBarConfig; + SvStringHashEntryRef MM_AccelConfig; + SvStringHashEntryRef MM_AllConfig; + SvStringHashEntryRef MM_FastCall; + SvStringHashEntryRef MM_SbxObject; + SvStringHashEntryRef MM_Container; + SvStringHashEntryRef MM_PlugComm; + SvStringHashEntryRef MM_IsCollection; + SvStringHashEntryRef MM_ReadOnlyDoc; + SvStringHashEntryRef MM_ConfigName; + SvStringHashEntryRef MM_union; + SvStringHashEntryRef MM_struct; + SvStringHashEntryRef MM_typedef; + SvStringHashEntryRef MM_Readonly; + SvStringHashEntryRef MM_SlotType; + SvStringHashEntryRef MM_ModulePrefix; + SvStringHashEntryRef MM_DisableFlags; + SvStringHashEntryRef MM_Hidden; + SvStringHashEntryRef MM_Description; + SvStringHashEntryRef MM_UnoName; + + SvGlobalHashNames(); +}; + +class IdlDll +{ +public: + SvStringHashTable * pHashTable; + SvClassManager * pClassMgr; + SvGlobalHashNames * pGlobalNames; + + IdlDll(); + ~IdlDll(); +}; + +IdlDll * GetIdlApp(); +#define IDLAPP GetIdlApp() + +#define SV_GLOBAL_HASH_ACCESS( Name ) \ + if( !IDLAPP->pGlobalNames ) \ + IDLAPP->pGlobalNames = new SvGlobalHashNames(); \ + return IDLAPP->pGlobalNames->MM_##Name; + +#define HASH_INLINE( Name ) \ +inline SvStringHashEntry * SvHash_##Name() { SV_GLOBAL_HASH_ACCESS( Name ) } + +HASH_INLINE(Name) +HASH_INLINE(module) +HASH_INLINE(interface) +HASH_INLINE(in) +HASH_INLINE(out) +HASH_INLINE(inout) +HASH_INLINE(String) +HASH_INLINE(UCHAR) +HASH_INLINE(USHORT) +HASH_INLINE(uuid) +HASH_INLINE(HelpContext) +HASH_INLINE(HelpText) +HASH_INLINE(void) +HASH_INLINE(shell) +HASH_INLINE(Get) +HASH_INLINE(Set) +HASH_INLINE(SlotId) +HASH_INLINE(HasCoreId) +HASH_INLINE(Cachable) +HASH_INLINE(Volatile) +HASH_INLINE(Toggle) +HASH_INLINE(AutoUpdate) +HASH_INLINE(Synchron) +HASH_INLINE(Asynchron) +HASH_INLINE(RecordPerItem) +HASH_INLINE(RecordPerSet) +HASH_INLINE(RecordManual) +HASH_INLINE(NoRecord) +HASH_INLINE(RecordAbsolute) +HASH_INLINE(enum) +HASH_INLINE(UINT16) +HASH_INLINE(INT16) +HASH_INLINE(UINT32) +HASH_INLINE(INT32) +HASH_INLINE(int) +HASH_INLINE(BOOL) +HASH_INLINE(char) +HASH_INLINE(BYTE) +HASH_INLINE(item) +HASH_INLINE(PseudoSlots) +HASH_INLINE(map) +HASH_INLINE(Default) +HASH_INLINE(HelpFile) +HASH_INLINE(Version) +HASH_INLINE(import) +HASH_INLINE(SlotIdFile) +HASH_INLINE(SvName) +HASH_INLINE(SbxName) +HASH_INLINE(ItemName) +HASH_INLINE(OdlName) +HASH_INLINE(include) +HASH_INLINE(ExecMethod) +HASH_INLINE(StateMethod) +HASH_INLINE(GroupId) +HASH_INLINE(float) +HASH_INLINE(double) +HASH_INLINE(HasDialog) +HASH_INLINE(TypeLibFile) +HASH_INLINE(Export) +HASH_INLINE(Automation) +HASH_INLINE(PseudoPrefix) +HASH_INLINE(define) +HASH_INLINE(MenuConfig) +HASH_INLINE(ToolBoxConfig) +HASH_INLINE(StatusBarConfig) +HASH_INLINE(AccelConfig) +HASH_INLINE(AllConfig) +HASH_INLINE(FastCall) +HASH_INLINE(SbxObject) +HASH_INLINE(Container) +HASH_INLINE(PlugComm) +HASH_INLINE(IsCollection) +HASH_INLINE(ReadOnlyDoc) +HASH_INLINE(ConfigName) +HASH_INLINE(union) +HASH_INLINE(struct) +HASH_INLINE(typedef) +HASH_INLINE(Readonly) +HASH_INLINE(SlotType) +HASH_INLINE(ModulePrefix) +HASH_INLINE(DisableFlags) +HASH_INLINE(Hidden) +HASH_INLINE(Description) +HASH_INLINE(UnoName) + + +#endif // IDL_COMPILER +#endif // _GLOBALS_HXX + diff --git a/idl/inc/hash.hxx b/idl/inc/hash.hxx new file mode 100644 index 000000000000..59c2a4d605c2 --- /dev/null +++ b/idl/inc/hash.hxx @@ -0,0 +1,164 @@ +/************************************************************************* + * + * $RCSfile: hash.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _HASH_HXX +#define _HASH_HXX + + + +#ifndef _REF_HXX //autogen +#include <tools/ref.hxx> +#endif + +#ifndef _STRING_HXX //autogen +#include <tools/string.hxx> +#endif + +/****************** H a s h - T a b l e **********************************/ +class SvHashTable +{ + UINT32 nMax; // size of hash-tabel + UINT32 nFill; // elements in hash-tabel + UINT32 lAsk; // Anzahl der Anfragen + UINT32 lTry; // Anzahl der Versuche +protected: + BOOL Test_Insert( const void *, BOOL bInsert, UINT32 * pInsertPos ); + + // compare element with entry + virtual StringCompare Compare( const void * , UINT32 ) const = 0; + // get hash value from subclass + virtual UINT32 HashFunc( const void * ) const = 0; +public: + SvHashTable( UINT32 nMaxEntries ); + ~SvHashTable(); + + UINT32 GetMax() const { return nMax; } + + virtual BOOL IsEntry( UINT32 ) const = 0; +}; + +/************** S t r i n g H a s h T a b l e E n t r y ******************/ +class SvStringHashTable; +class SvStringHashEntry : public SvRefBase +{ +friend SvStringHashTable; + ByteString aName; + UINT32 nHashId; + ULONG nValue; + BOOL bHasId; +public: + SvStringHashEntry() : bHasId( FALSE ) {;} + SvStringHashEntry( const ByteString & rName, UINT32 nIdx ) + : aName( rName ) + , nHashId( nIdx ) + , bHasId( TRUE ) + , nValue( 0 ) {} + ~SvStringHashEntry(); + + const ByteString & GetName() const { return aName; } + BOOL HasId() const { return bHasId; } + UINT32 GetId() const { return nHashId; } + + void SetValue( ULONG n ) { nValue = n; } + ULONG GetValue() const { return nValue; } + + BOOL operator == ( const SvStringHashEntry & rRef ) + { return nHashId == rRef.nHashId; } + BOOL operator != ( const SvStringHashEntry & rRef ) + { return ! operator == ( rRef ); } + SvStringHashEntry & operator = ( const SvStringHashEntry & rRef ) + { SvRefBase::operator=( rRef ); + aName = rRef.aName; + nHashId = rRef.nHashId; + nValue = rRef.nValue; + bHasId = rRef.bHasId; + return *this; + } +}; + +SV_DECL_IMPL_REF(SvStringHashEntry) + +/****************** S t r i n g H a s h T a b l e ************************/ +DECLARE_LIST(SvStringHashList,SvStringHashEntry *) + +class SvStringHashTable : public SvHashTable +{ + SvStringHashEntry * pEntries; +protected: + virtual UINT32 HashFunc( const void * pElement ) const; + virtual StringCompare Compare( const void * pElement, UINT32 nIndex ) const; +public: + SvStringHashTable( UINT32 nMaxEntries ); // max size of hash-tabel + ~SvStringHashTable(); + + ByteString GetNearString( const ByteString & rName ) const; + virtual BOOL IsEntry( UINT32 nIndex ) const; + + BOOL Insert( const ByteString & rStr, UINT32 * pHash ); // insert string + BOOL Test( const ByteString & rStr, UINT32 * pHash ) const; // test of insert string + SvStringHashEntry * Get ( UINT32 nIndex ) const; // return pointer to string + SvStringHashEntry & operator []( UINT32 nPos ) const + { return pEntries[ nPos ]; } + + void FillHashList( SvStringHashList * rList ) const; +}; + +#endif // _RSCHASH_HXX diff --git a/idl/inc/lex.hxx b/idl/inc/lex.hxx new file mode 100644 index 000000000000..d14ebc2558d1 --- /dev/null +++ b/idl/inc/lex.hxx @@ -0,0 +1,315 @@ +/************************************************************************* + * + * $RCSfile: lex.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _LEX_HXX +#define _LEX_HXX + +#include <hash.hxx> + +#ifndef _GEN_HXX //autogen +#include <tools/gen.hxx> +#endif + +#ifndef _STREAM_HXX //autogen +#include <tools/stream.hxx> +#endif + +/******************** enum ***********************************************/ +enum SVTOKEN_ENUM { SVTOKEN_EMPTY, SVTOKEN_COMMENT, + SVTOKEN_INTEGER, SVTOKEN_STRING, + SVTOKEN_BOOL, SVTOKEN_IDENTIFIER, + SVTOKEN_CHAR, SVTOKEN_RTTIBASE, + SVTOKEN_EOF, SVTOKEN_HASHID }; + +/******************** class SvToken **************************************/ +class BigInt; +class SvToken +{ +friend class SvTokenStream; + ULONG nLine, nColumn; + SVTOKEN_ENUM nType; + ByteString aString; + union + { + ULONG nLong; + BOOL bBool; + char cChar; +// SvRttiBase * pComplexObj; + SvStringHashEntry * pHash; + }; +public: + SvToken(); + SvToken( const SvToken & rObj ); + SvToken( ULONG n ); + SvToken( SVTOKEN_ENUM nTypeP, BOOL b ); + SvToken( char c ); + SvToken( SVTOKEN_ENUM nTypeP, const ByteString & rStr ); +// SvToken( SvRttiBase * pComplexObj ); + SvToken( SVTOKEN_ENUM nTypeP ); + + SvToken & operator = ( const SvToken & rObj ); + + ByteString GetTokenAsString() const; + ByteString Print() const; + SVTOKEN_ENUM GetType() const { return nType; } + + void SetLine( ULONG nLineP ) { nLine = nLineP; } + ULONG GetLine() const { return nLine; } + + void SetColumn( ULONG nColumnP ) { nColumn = nColumnP; } + ULONG GetColumn() const { return nColumn; } + + BOOL IsEmpty() const { return nType == SVTOKEN_EMPTY; } + BOOL IsComment() const { return nType == SVTOKEN_COMMENT; } + BOOL IsInteger() const { return nType == SVTOKEN_INTEGER; } + BOOL IsString() const { return nType == SVTOKEN_STRING; } + BOOL IsBool() const { return nType == SVTOKEN_BOOL; } + BOOL IsIdentifierHash() const + { return nType == SVTOKEN_HASHID; } + BOOL IsIdentifier() const + { + return nType == SVTOKEN_IDENTIFIER + || nType == SVTOKEN_HASHID; + } + BOOL IsChar() const { return nType == SVTOKEN_CHAR; } + BOOL IsRttiBase() const { return nType == SVTOKEN_RTTIBASE; } + BOOL IsEof() const { return nType == SVTOKEN_EOF; } + + const ByteString & GetString() const + { + return IsIdentifierHash() + ? pHash->GetName() + : aString; + } + ULONG GetNumber() const { return nLong; } + BOOL GetBool() const { return bBool; } + char GetChar() const { return cChar; } +// SvRttiBase *GetObject() const { return pComplexObj; } + + void SetHash( SvStringHashEntry * pHashP ) + { pHash = pHashP; nType = SVTOKEN_HASHID; } + BOOL HasHash() const + { return nType == SVTOKEN_HASHID; } + SvStringHashEntry * GetHash() const { return pHash; } + BOOL Is( SvStringHashEntry * pEntry ) const + { return IsIdentifierHash() && pHash == pEntry; } +}; + +inline SvToken::SvToken() + : nType( SVTOKEN_EMPTY ) {} + +inline SvToken::SvToken( ULONG n ) + : nType( SVTOKEN_INTEGER ), nLong( n ) {} + +inline SvToken::SvToken( SVTOKEN_ENUM nTypeP, BOOL b ) + : nType( nTypeP ), bBool( b ) {} + +inline SvToken::SvToken( char c ) + : nType( SVTOKEN_CHAR ), cChar( c ) {} + +inline SvToken::SvToken( SVTOKEN_ENUM nTypeP, const ByteString & rStr ) + : nType( nTypeP ), aString( rStr ) {} + +/* +inline SvToken::SvToken( SvRttiBase * pObj ) + : nType( SVTOKEN_RTTIBASE ), pComplexObj( pObj ) + { pObj->AddRef(); } +*/ + +inline SvToken::SvToken( SVTOKEN_ENUM nTypeP ) +: nType( nTypeP ) {} + +DECLARE_LIST( SvTokenList, SvToken * ) + +/******************** class SvTokenStream ********************************/ +class SvTokenStream +{ + ULONG nLine, nColumn; + int nBufPos; + int c; // naechstes Zeichen + CharSet nCharSet; + char * pCharTab; // Zeiger auf die Konverierungstabelle + USHORT nTabSize; // Tabulator Laenge + ByteString aStrTrue; + ByteString aStrFalse; + ULONG nMaxPos; + + SvFileStream * pInStream; + SvStream & rInStream; + String aFileName; + SvTokenList aTokList; + SvToken * pCurToken; + + void InitCtor(); + + ByteString aBufStr; + int GetNextChar(); + int GetFastNextChar() + { + return aBufStr.GetChar((USHORT)nBufPos++); + } + + void FillTokenList(); + ULONG GetNumber(); + BOOL MakeToken( SvToken & ); + BOOL IsEof() const { return rInStream.IsEof(); } + void SetMax() + { + ULONG n = Tell(); + if( n > nMaxPos ) + nMaxPos = n; + } + void CalcColumn() + { + // wenn Zeilenende berechnung sparen + if( 0 != c ) + { + USHORT n = 0; + nColumn = 0; + while( n < nBufPos ) + nColumn += aBufStr.GetChar(n++) == '\t' ? nTabSize : 1; + } + } +public: + SvTokenStream( const String & rFileName ); + SvTokenStream( SvStream & rInStream, const String & rFileName ); + ~SvTokenStream(); + + static BOOL GetHexValue( const ByteString & rStr, BigInt * pValue ); + const String & GetFileName() const { return aFileName; } + SvStream & GetStream() { return rInStream; } + + void SetCharSet( CharSet nSet ); + CharSet GetCharSet() const { return nCharSet; } + + void SetTabSize( USHORT nTabSizeP ) + { nTabSize = nTabSizeP; } + USHORT GetTabSize() const { return nTabSize; } + + SvToken * GetToken_PrevAll() + { + SvToken * pRetToken = pCurToken; + if( NULL == (pCurToken = aTokList.Prev()) ) + // Current Zeiger nie Null + pCurToken = pRetToken; + + return pRetToken; + } + SvToken * GetToken_NextAll() + { + SvToken * pRetToken = pCurToken; + if( NULL == (pCurToken = aTokList.Next()) ) + // Current Zeiger nie Null + pCurToken = pRetToken; + SetMax(); + return pRetToken; + } + SvToken * GetToken_Next() + { + // Kommentare werden initial entfernt + return GetToken_NextAll(); + } + SvToken * GetToken() const { return pCurToken; } + BOOL Skip( char cStart, char cEnd, UINT32 * pBegin ); + BOOL Read( char cChar ) + { + if( pCurToken->IsChar() + && cChar == pCurToken->GetChar() ) + { + GetToken_Next(); + return TRUE; + } + else + return FALSE; + } + void ReadDelemiter() + { + if( pCurToken->IsChar() + && (';' == pCurToken->GetChar() + || ',' == pCurToken->GetChar()) ) + { + GetToken_Next(); + } + } + + UINT32 Tell() const + { return aTokList.GetCurPos(); } + void Seek( UINT32 nPos ) + { + pCurToken = aTokList.Seek( nPos ); + SetMax(); + } + void SeekRel( INT32 nRelPos ) + { + pCurToken = aTokList.Seek( Tell() + nRelPos ); + SetMax(); + } + void SeekEnd() + { + pCurToken = aTokList.Seek( nMaxPos ); + } + void Replace( const Range & rRange, SvToken * pToken ); +}; + + + +#endif // _LEX_HXX + diff --git a/idl/inc/module.hxx b/idl/inc/module.hxx new file mode 100644 index 000000000000..64d0d0463c5a --- /dev/null +++ b/idl/inc/module.hxx @@ -0,0 +1,151 @@ +/************************************************************************* + * + * $RCSfile: module.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _MODULE_HXX +#define _MODULE_HXX + +#include <slot.hxx> +#include <object.hxx> + +struct SvNamePos +{ + SvGlobalName aUUId; + UINT32 nStmPos; + SvNamePos( const SvGlobalName & rName, UINT32 nPos ) + : aUUId( rName ) + , nStmPos( nPos ) {} +}; +DECLARE_LIST( SvNamePosList, SvNamePos *) + +/******************** class SvMetaModule *********************************/ +class SvMetaModule : public SvMetaExtern +{ + SvMetaClassMemberList aClassList; + SvMetaTypeMemberList aTypeList; + SvMetaAttributeMemberList aAttrList; +// Browser + String aIdlFileName; + SvString aHelpFileName; + SvString aSlotIdFile; + SvString aTypeLibFile; + SvString aModulePrefix; + +#ifdef IDL_COMPILER + BOOL bImported : 1, + bIsModified : 1; + SvGlobalName aBeginName; + SvGlobalName aEndName; + SvGlobalName aNextName; +protected: + virtual void ReadAttributesSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); + virtual void WriteAttributesSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab ); + virtual void ReadContextSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); + virtual void WriteContextSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab ); +#endif +public: + SV_DECL_META_FACTORY1( SvMetaModule, SvMetaExtern, 13 ) + SvMetaModule(); + + const String & GetIdlFileName() const { return aIdlFileName; } + const ByteString & GetModulePrefix() const { return aModulePrefix; } + + virtual BOOL SetName( const ByteString & rName, SvIdlDataBase * = NULL ); + + const ByteString & GetHelpFileName() const { return aHelpFileName; } + const ByteString & GetTypeLibFileName() const { return aTypeLibFile; } + + const SvMetaAttributeMemberList & GetAttrList() const { return aAttrList; } + const SvMetaTypeMemberList & GetTypeList() const { return aTypeList; } + const SvMetaClassMemberList & GetClassList() const { return aClassList; } + +#ifdef IDL_COMPILER + SvMetaModule( const String & rIdlFileName, + BOOL bImported ); + + BOOL FillNextName( SvGlobalName * ); + BOOL IsImported() const { return bImported; } + BOOL IsModified() const { return bIsModified; } + + virtual BOOL ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); + virtual void WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab ); + + virtual void WriteAttributes( SvIdlDataBase & rBase, + SvStream & rOutStm, USHORT nTab, + WriteType, WriteAttribute = 0 ); +// virtual void WriteSbx( SvIdlDataBase & rBase, SvStream & rOutStm, SvNamePosList & rList ); + virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab, + WriteType, WriteAttribute = 0 ); + virtual void WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ); + virtual void WriteHelpIds( SvIdlDataBase & rBase, SvStream & rOutStm, + Table* pTable ); + virtual void WriteSrc( SvIdlDataBase & rBase, SvStream & rOutStm, + Table *pIdTable ); + + virtual void WriteCxx( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab ); + virtual void WriteHxx( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab ); +#endif +}; +SV_DECL_IMPL_REF(SvMetaModule) +SV_DECL_IMPL_PERSIST_LIST(SvMetaModule,SvMetaModule *) + + +#endif // _MODULE_HXX + diff --git a/idl/inc/object.hxx b/idl/inc/object.hxx new file mode 100644 index 000000000000..e2624986de2f --- /dev/null +++ b/idl/inc/object.hxx @@ -0,0 +1,204 @@ +/************************************************************************* + * + * $RCSfile: object.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _OBJECT_HXX +#define _OBJECT_HXX + +#define _SVSTDARR_ULONGS +//#include <svtools/svstdarr.hxx> +#include <types.hxx> +#include <slot.hxx> + +struct SvSlotElement +{ + SvMetaSlotRef xSlot; + ByteString aPrefix; + SvSlotElement( SvMetaSlot * pS, const ByteString & rPrefix ) + : xSlot( pS ) + , aPrefix( rPrefix ) + {} +}; +DECLARE_LIST( SvSlotElementList, SvSlotElement* ) +class SvMetaClass; +DECLARE_LIST( SvMetaClassList, SvMetaClass* ) + +class SvULongs : public List +{ +public: + void Insert( ULONG& rId, ULONG nPos ) { ULONG nId(rId ); List::Insert( (void*) nId, nPos ); } + void Remove( ULONG& rId ){ ULONG nId(rId ); List::Remove( (void*) nId ); } + ULONG GetObject( ULONG nPos ){ return (ULONG) List::GetObject( nPos ); } +}; + +/******************** class SvClassElement *******************************/ +SV_DECL_REF(SvMetaClass) +class SvClassElement : public SvPersistBase +{ + SvBOOL aAutomation; + ByteString aPrefix; + SvMetaClassRef xClass; +public: + SV_DECL_PERSIST1( SvClassElement, SvPersistBase, 1 ) + SvClassElement(); + + void SetPrefix( const ByteString & rPrefix ) + { aPrefix = rPrefix; } + const ByteString & GetPrefix() const + { return aPrefix; } + + void SetAutomation( BOOL rAutomation ) + { aAutomation = rAutomation; } + BOOL GetAutomation() const + { return aAutomation; } + + void SetClass( SvMetaClass * pClass ) + { xClass = pClass; } + SvMetaClass * GetClass() const + { return xClass; } +}; + +SV_DECL_IMPL_REF(SvClassElement) +SV_DECL_IMPL_PERSIST_LIST(SvClassElement,SvClassElement *) + +/******************** class SvMetaClass *********************************/ +class SvMetaModule; +SV_DECL_PERSIST_LIST(SvMetaClass,SvMetaClass *) +class SvMetaClass : public SvMetaType +{ + SvMetaAttributeMemberList aAttrList; + SvClassElementMemberList aClassList; + SvMetaClassRef aSuperClass; + SvBOOL aAutomation; + SvMetaClassRef xAutomationInterface; + +// void FillSbxMemberObject( SvIdlDataBase & rBase, +// SbxObject *, StringList &, +// BOOL bVariable ); + BOOL TestAttribute( SvIdlDataBase & rBase, SvTokenStream & rInStm, + SvMetaAttribute & rAttr ) const; +#ifdef IDL_COMPILER + void WriteSlotStubs( const ByteString & rShellName, + SvSlotElementList & rSlotList, + ByteStringList & rList, + SvStream & rOutStm ); + USHORT WriteSlotParamArray( SvIdlDataBase & rBase, + SvSlotElementList & rSlotList, + SvStream & rOutStm ); + USHORT WriteSlots( const ByteString & rShellName, USHORT nCount, + SvSlotElementList & rSlotList, + SvIdlDataBase & rBase, + SvStream & rOutStm ); + + void InsertSlots( SvSlotElementList& rList, SvULongs& rSuperList, + SvMetaClassList & rClassList, + const ByteString & rPrefix, SvIdlDataBase& rBase ); + +protected: + virtual void ReadAttributesSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm ); + virtual void WriteAttributesSvIdl( SvIdlDataBase & rBase, + SvStream & rOutStm, USHORT nTab ); + virtual void ReadContextSvIdl( SvIdlDataBase &, + SvTokenStream & rInStm ); + virtual void WriteContextSvIdl( SvIdlDataBase & rBase, + SvStream & rOutStm, USHORT nTab ); + void WriteOdlMembers( ByteStringList & rSuperList, + BOOL bVariable, BOOL bWriteTab, + SvIdlDataBase & rBase, + SvStream & rOutStm, USHORT nTab ); +#endif +public: + SV_DECL_META_FACTORY1( SvMetaClass, SvMetaType, 6 ) + SvMetaClass(); + + BOOL GetAutomation() const + { return aAutomation; } + SvMetaClass * GetSuperClass() const + { return aSuperClass; } + + void FillClasses( SvMetaClassList & rList ); +// virtual void FillSbxObject( SvIdlDataBase & rBase, SbxObject * ); + + const SvClassElementMemberList& + GetClassList() const + { return aClassList; } + +#ifdef IDL_COMPILER + virtual BOOL ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); + virtual void WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab ); + virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab, + WriteType, WriteAttribute = 0 ); + virtual void WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ); + virtual void WriteHelpIds( SvIdlDataBase & rBase, SvStream & rOutStm, + Table* pTable ); + virtual void WriteSrc( SvIdlDataBase & rBase, SvStream & rOutStm, + Table * pTable ); + virtual void WriteCxx( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab ); + virtual void WriteHxx( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab ); +#endif +}; +SV_IMPL_REF(SvMetaClass) +SV_IMPL_PERSIST_LIST(SvMetaClass,SvMetaClass *) + + +#endif // _OBJECT_HXX + diff --git a/idl/inc/slot.hxx b/idl/inc/slot.hxx new file mode 100644 index 000000000000..8b218fd1a658 --- /dev/null +++ b/idl/inc/slot.hxx @@ -0,0 +1,308 @@ +/************************************************************************* + * + * $RCSfile: slot.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _SLOT_HXX +#define _SLOT_HXX + +#include <types.hxx> +#include <command.hxx> + +/******************** class SvMetaSlot **********************************/ +//class SbxObject; +class SvMetaSlotMemberList; +class SvMetaSlot : public SvMetaAttribute +{ + SvMetaTypeRef aSlotType; + SvMetaAttributeRef aMethod; + SvIdentifier aGroupId; + SvBOOL aHasCoreId; + SvIdentifier aConfigId; + SvIdentifier aExecMethod; + SvIdentifier aStateMethod; + SvIdentifier aDefault; + SvBOOL aPseudoSlots; + SvBOOL aGet; + SvBOOL aSet; + + SvBOOL aCachable; // exclusiv + SvBOOL aVolatile; + SvBOOL aToggle; + SvBOOL aAutoUpdate; + + SvBOOL aSynchron; // exclusiv + SvBOOL aAsynchron; + + SvBOOL aRecordPerItem;// exclusiv + SvBOOL aRecordPerSet; + SvBOOL aRecordManual; + SvBOOL aNoRecord; + SvBOOL aRecordAbsolute; + + SvBOOL aHasDialog; + SvBOOL aMenuConfig; + SvBOOL aToolBoxConfig; + SvBOOL aStatusBarConfig; + SvBOOL aAccelConfig; + SvBOOL aFastCall; + SvBOOL aContainer; + SvBOOL aPlugComm; + SvIdentifier aPseudoPrefix; + SvString aDisableFlags; + SvMetaSlot* pLinkedSlot; + SvMetaSlot* pNextSlot; + ULONG nListPos; + SvMetaEnumValue* pEnumValue; + SvString aUnoName; + +#ifdef IDL_COMPILER + void WriteSlot( const ByteString & rShellName, + USHORT nCount, const ByteString & rSlotId, + const ByteString & rValEnum, + SvSlotElementList &rList, + const ByteString & rPrefix, + SvIdlDataBase & rBase, SvStream & rOutStm ); + virtual void Write( SvIdlDataBase & rBase, + SvStream & rOutStm, USHORT nTab, + WriteType, WriteAttribute = 0 ); + + void SetEnumValue(SvMetaEnumValue *p) + { pEnumValue = p; } +#endif +protected: + void SetCachable( BOOL bSet ) + { + aCachable = bSet; + if( bSet ) + aVolatile = FALSE; + } + void SetVolatile( BOOL bSet ) + { + aVolatile = bSet; + if( bSet ) + aCachable = FALSE; + } + void SetToggle( BOOL bSet ) + { + aToggle = bSet; + } + void SetAutoUpdate( BOOL bSet ) + { + aAutoUpdate = bSet; + } + + void SetSynchron( BOOL bSet ) + { + aSynchron = bSet; + if( bSet ) + aAsynchron = FALSE; + } + void SetAsynchron( BOOL bSet ) + { + aAsynchron = bSet; + if( bSet ) + aSynchron = FALSE; + } + + void SetRecordPerItem( BOOL bSet ) + { + aRecordPerItem = bSet; + if( bSet ) + aRecordPerSet = aRecordManual = aNoRecord = FALSE; + } + void SetRecordPerSet( BOOL bSet ) + { + aRecordPerSet = bSet; + if( bSet ) + aRecordPerItem = aRecordManual = aNoRecord = FALSE; + } + void SetRecordManual( BOOL bSet ) + { + aRecordManual = bSet; + if( bSet ) + aRecordPerItem = aRecordPerSet = aNoRecord = FALSE; + } + void SetNoRecord( BOOL bSet ) + { + aNoRecord = bSet; + if( bSet ) + aRecordPerItem = aRecordPerSet = aRecordManual = FALSE; + } + void SetRecordAbsolute( BOOL bSet ) + { aRecordAbsolute = bSet; } + void SetHasDialog( BOOL bSet ) + { aHasDialog = bSet; } + void SetMenuConfig( BOOL bSet ) + { aMenuConfig = bSet; } + void SetToolBoxConfig( BOOL bSet ) + { aToolBoxConfig = bSet; } + void SetStatusBarConfig( BOOL bSet ) + { aStatusBarConfig = bSet; } + void SetAccelConfig( BOOL bSet ) + { aAccelConfig = bSet; } + void SetAllConfig( BOOL bSet ) + { + aMenuConfig = bSet; + aToolBoxConfig = bSet; + aStatusBarConfig = bSet; + aAccelConfig = bSet; + } + void SetFastCall( BOOL bSet ) + { aFastCall = bSet; } + void SetContainer( BOOL bSet ) + { aContainer = bSet; } + void SetPlugComm( BOOL bSet ) + { aPlugComm = bSet; } + +public: + SV_DECL_META_FACTORY1( SvMetaSlot, SvMetaReference, 11 ) + SvMetaSlot(); + SvMetaSlot( SvMetaType * pType ); + + virtual BOOL IsVariable() const; + virtual BOOL IsMethod() const; + virtual ByteString GetMangleName( BOOL bVariable ) const; + + SvMetaAttribute * GetMethod() const; + SvMetaType * GetSlotType() const; + BOOL GetHasCoreId() const; + const ByteString & GetGroupId() const; + const ByteString & GetConfigId() const; + const ByteString & GetExecMethod() const; + const ByteString & GetStateMethod() const; + const ByteString & GetDefault() const; + const ByteString & GetDisableFlags() const; + BOOL GetPseudoSlots() const; + /* + BOOL GetGet() const; + BOOL GetSet() const; + */ + BOOL GetCachable() const; + BOOL GetVolatile() const; + BOOL GetToggle() const; + BOOL GetAutoUpdate() const; + + BOOL GetSynchron() const; + BOOL GetAsynchron() const; + + BOOL GetRecordPerItem() const; + BOOL GetRecordPerSet() const; + BOOL GetRecordManual() const; + BOOL GetNoRecord() const; + BOOL GetRecordAbsolute() const; + + BOOL GetHasDialog() const; + const ByteString & GetPseudoPrefix() const; + const ByteString & GetUnoName() const; + BOOL GetMenuConfig() const; + BOOL GetToolBoxConfig() const; + BOOL GetStatusBarConfig() const; + BOOL GetAccelConfig() const; + BOOL GetFastCall() const; + BOOL GetContainer() const; + BOOL GetPlugComm() const; + SvMetaSlot* GetLinkedSlot() const + { return pLinkedSlot; } + SvMetaSlot* GetNextSlot() const + { return pNextSlot; } + ULONG GetListPos() const + { return nListPos; } + void SetListPos(ULONG n) + { nListPos = n; } + void ResetSlotPointer() + { pNextSlot = pLinkedSlot = 0; } + +// void FillSbxObject( SvIdlDataBase & rBase, SbxObject *, BOOL bProp ); +#ifdef IDL_COMPILER + SvMetaEnumValue* GetEnumValue() const + { return pEnumValue; } + virtual BOOL Test( SvIdlDataBase &, SvTokenStream & rInStm ); + virtual void ReadAttributesSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm ); + virtual void WriteAttributesSvIdl( SvIdlDataBase & rBase, + SvStream & rOutStm, USHORT nTab ); + virtual BOOL ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); + virtual void WriteSvIdl( SvIdlDataBase & rBase, + SvStream & rOutStm, USHORT nTab ); + virtual void Insert( SvSlotElementList&, const ByteString & rPrefix, + SvIdlDataBase& ); + void WriteSlotStubs( const ByteString & rShellName, + ByteStringList & rList, + SvStream & rOutStm ); + USHORT WriteSlotMap( const ByteString & rShellName, + USHORT nCount, + SvSlotElementList&, + const ByteString &, + SvIdlDataBase & rBase, + SvStream & rOutStm ); + USHORT WriteSlotParamArray( SvIdlDataBase & rBase, + SvStream & rOutStm ); + virtual void WriteHelpId( SvIdlDataBase & rBase, SvStream & rOutStm, + Table * pIdTable ); + virtual void WriteSrc( SvIdlDataBase & rBase, SvStream & rOutStm, + Table * pIdTable ); + virtual void WriteCSV( SvIdlDataBase&, SvStream& ); + void CompareSlotAttributes( SvMetaSlot *pOther ); +#endif +}; +SV_DECL_IMPL_REF(SvMetaSlot) +SV_DECL_IMPL_PERSIST_LIST(SvMetaSlot,SvMetaSlot *) + +#endif // _SLOT_HXX diff --git a/idl/inc/types.hxx b/idl/inc/types.hxx new file mode 100644 index 000000000000..62980f698b52 --- /dev/null +++ b/idl/inc/types.hxx @@ -0,0 +1,379 @@ +/************************************************************************* + * + * $RCSfile: types.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _TYPES_HXX +#define _TYPES_HXX + +#include <tools/ref.hxx> +#include <basobj.hxx> + +class SvSlotElementList; +struct SvSlotElement; + +/******************** class SvMetaAttribute *****************************/ +SV_DECL_REF(SvMetaType) +SV_DECL_REF(SvMetaAttribute) +SV_DECL_PERSIST_LIST(SvMetaAttribute,SvMetaAttribute *) +class SvMetaAttribute : public SvMetaReference +{ + SvMetaTypeRef aType; + SvNumberIdentifier aSlotId; + SvBOOL aAutomation; + SvBOOL aExport; + SvBOOL aReadonly; + SvBOOL aIsCollection; + SvBOOL aReadOnlyDoc; + SvBOOL aHidden; + BOOL bNewAttr; + +protected: +#ifdef IDL_COMPILER + virtual void WriteCSource( SvIdlDataBase & rBase, + SvStream & rOutStm, BOOL bSet ); + ULONG MakeSlotValue( SvIdlDataBase & rBase, BOOL bVariable ) const; + virtual void WriteAttributes( SvIdlDataBase & rBase, + SvStream & rOutStm, USHORT nTab, + WriteType, WriteAttribute = 0 ); + virtual void ReadAttributesSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm ); + virtual void WriteAttributesSvIdl( SvIdlDataBase & rBase, + SvStream & rOutStm, USHORT nTab ); +#endif +public: + SV_DECL_META_FACTORY1( SvMetaAttribute, SvMetaReference, 2 ) + SvMetaAttribute(); + SvMetaAttribute( SvMetaType * ); + + void SetNewAttribute( BOOL bNew ) + { bNewAttr = bNew; } + BOOL IsNewAttribute() const + { return bNewAttr; } + BOOL GetReadonly() const; + + void SetSlotId( const SvNumberIdentifier & rId ) + { aSlotId = rId; } + const SvNumberIdentifier & GetSlotId() const; + + void SetExport( BOOL bSet ) + { aExport = bSet; } + BOOL GetExport() const; + + void SetHidden( BOOL bSet ) + { aHidden = bSet; } + BOOL GetHidden() const; + + void SetAutomation( BOOL bSet ) + { aAutomation = bSet; } + BOOL GetAutomation() const; + + void SetIsCollection( BOOL bSet ) + { aIsCollection = bSet; } + BOOL GetIsCollection() const; + void SetReadOnlyDoc( BOOL bSet ) + { aReadOnlyDoc = bSet; } + BOOL GetReadOnlyDoc() const; + + void SetType( SvMetaType * pT ) { aType = pT; } + SvMetaType * GetType() const; + + virtual BOOL IsMethod() const; + virtual BOOL IsVariable() const; + virtual ByteString GetMangleName( BOOL bVariable ) const; + +// void FillSbxObject( SbxInfo * pInfo, USHORT nSbxFlags = 0 ); +// virtual void FillSbxObject( SvIdlDataBase & rBase, SbxObject * pObj, BOOL bVariable ); + +#ifdef IDL_COMPILER + virtual BOOL Test( SvIdlDataBase &, SvTokenStream & rInStm ); + virtual BOOL ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); + virtual void WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab ); + virtual void WriteParam( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab, + WriteType ); + void WriteRecursiv_Impl( SvIdlDataBase & rBase, + SvStream & rOutStm, USHORT nTab, + WriteType, WriteAttribute ); + virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab, + WriteType, WriteAttribute = 0 ); + ULONG MakeSfx( ByteString * pAtrrArray ); + virtual void Insert( SvSlotElementList&, const ByteString & rPrefix, + SvIdlDataBase& ); + virtual void WriteHelpId( SvIdlDataBase & rBase, SvStream & rOutStm, + Table * pIdTable ); + virtual void WriteSrc( SvIdlDataBase & rBase, SvStream & rOutStm, + Table * pIdTable ); + virtual void WriteCSV( SvIdlDataBase&, SvStream& ); + void FillIDTable(Table *pIDTable); + ByteString Compare( SvMetaAttribute *pAttr ); +#endif +}; +SV_IMPL_REF(SvMetaAttribute) +SV_IMPL_PERSIST_LIST(SvMetaAttribute,SvMetaAttribute *) + + +/******************** class SvType *********************************/ +enum { CALL_VALUE, CALL_POINTER, CALL_REFERENCE }; +enum { TYPE_METHOD, TYPE_STRUCT, TYPE_BASE, TYPE_ENUM, TYPE_UNION, + TYPE_CLASS, TYPE_POINTER }; +class SvMetaType : public SvMetaExtern +{ + SvBOOL aIn; // Eingangsparameter + SvBOOL aOut; // Returnparameter + Svint aCall0, aCall1; + Svint aSbxDataType; + SvIdentifier aSvName; + SvIdentifier aSbxName; + SvIdentifier aOdlName; + SvIdentifier aCName; + SvIdentifier aBasicPostfix; + SvIdentifier aBasicName; + SvMetaAttributeMemberList * pAttrList; + int nType; + BOOL bIsItem; + BOOL bIsShell; + char cParserChar; + +#ifdef IDL_COMPILER + void WriteSfx( const ByteString & rItemName, SvIdlDataBase & rBase, + SvStream & rOutStm ); +protected: + BOOL ReadNamesSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm ); + virtual void ReadAttributesSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); + virtual void WriteAttributesSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab ); + virtual void ReadContextSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); + virtual void WriteContextSvIdl( SvIdlDataBase &, SvStream & rOutStm, + USHORT nTab ); + + virtual void WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab, + WriteType, WriteAttribute = 0 ); + virtual void WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab, + WriteType, WriteAttribute = 0 ); + BOOL ReadHeaderSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); + void WriteHeaderSvIdl( SvIdlDataBase &, SvStream & rOutStm, + USHORT nTab ); +#endif +public: + SV_DECL_META_FACTORY1( SvMetaType, SvMetaExtern, 18 ) + SvMetaType(); + SvMetaType( const ByteString & rTypeName, char cParserChar, + const ByteString & rCName ); + SvMetaType( const ByteString & rTypeName, const ByteString & rSbxName, + const ByteString & rOdlName, char cParserChar, + const ByteString & rCName, const ByteString & rBasicName, + const ByteString & rBasicPostfix/*, SbxDataType nT = SbxEMPTY */); + + SvMetaAttributeMemberList & GetAttrList() const; + ULONG GetAttrCount() const + { + return pAttrList ? pAttrList->Count() : 0L; + } + void AppendAttr( SvMetaAttribute * pAttr ) + { + GetAttrList().Append( pAttr ); + } + + void SetType( int nT ); + int GetType() const { return nType; } + SvMetaType * GetBaseType() const; + SvMetaType * GetReturnType() const; + BOOL IsItem() const { return bIsItem; } + BOOL IsShell() const { return bIsShell; } + +// void SetSbxDataType( SbxDataType nT ) +// { aSbxDataType = (int)nT; } +// SbxDataType GetSbxDataType() const; + + void SetIn( BOOL b ) { aIn = b; } + BOOL GetIn() const; + + void SetOut( BOOL b ) { aOut = b; } + BOOL GetOut() const; + + void SetCall0( int e ); + int GetCall0() const; + + void SetCall1( int e); + int GetCall1() const; + + void SetBasicName(const ByteString& rName) + { aBasicName = rName; } + + const ByteString & GetBasicName() const; + ByteString GetBasicPostfix() const; + const ByteString & GetSvName() const; + const ByteString & GetSbxName() const; + const ByteString & GetOdlName() const; + const ByteString & GetCName() const; + char GetParserChar() const { return cParserChar; } + + virtual BOOL SetName( const ByteString & rName, SvIdlDataBase * = NULL ); + +// void FillSbxObject( SbxVariable * pObj, BOOL bVariable ); + +#ifdef IDL_COMPILER + virtual BOOL ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); + virtual void WriteSvIdl( SvIdlDataBase & rBase, + SvStream & rOutStm, USHORT nTab ); + virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab, + WriteType, WriteAttribute = 0 ); + ByteString GetCString() const; + void WriteSvIdlType( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab ); + void WriteOdlType( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab ); + void AppendParserString (ByteString &rString); + + ULONG MakeSfx( ByteString * pAtrrArray ); + virtual void WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ); + //BOOL ReadTypePrefix( SvIdlDataBase &, SvTokenStream & rInStm ); + BOOL ReadMethodArgs( SvIdlDataBase & rBase, + SvTokenStream & rInStm ); + void WriteTypePrefix( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab, WriteType ); + void WriteMethodArgs( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab, WriteType ); + void WriteTheType( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab, WriteType ); + ByteString GetParserString() const; + void WriteParamNames( SvIdlDataBase & rBase, SvStream & rOutStm, + const ByteString & rChief ); +#endif +}; +SV_IMPL_REF(SvMetaType) +DECLARE_LIST(SvMetaTypeList,SvMetaType *) +SV_DECL_IMPL_PERSIST_LIST(SvMetaType,SvMetaType *) + + +/******************** class SvTypeString *********************************/ +class SvMetaTypeString : public SvMetaType +{ +public: + SV_DECL_META_FACTORY1( SvMetaTypeString, SvMetaType, 19 ) + SvMetaTypeString(); +}; +SV_DECL_IMPL_REF(SvMetaTypeString) +SV_DECL_IMPL_PERSIST_LIST(SvMetaTypeString,SvMetaTypeString *) + + +/******************** class SvMetaEnumValue **********************************/ +class SvMetaEnumValue : public SvMetaName +{ + ByteString aEnumValue; +public: + SV_DECL_META_FACTORY1( SvMetaEnumValue, SvMetaName, 20 ) + SvMetaEnumValue(); + +#ifdef IDL_COMPILER + virtual BOOL ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); + virtual void WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab ); + virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab, + WriteType, WriteAttribute = 0 ); +#endif +}; +SV_DECL_IMPL_REF(SvMetaEnumValue) +SV_DECL_IMPL_PERSIST_LIST(SvMetaEnumValue,SvMetaEnumValue *) + + +/******************** class SvTypeEnum *********************************/ +class SvMetaTypeEnum : public SvMetaType +{ + SvMetaEnumValueMemberList aEnumValueList; + ByteString aPrefix; +protected: +#ifdef IDL_COMPILER + virtual void ReadContextSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); + virtual void WriteContextSvIdl( SvIdlDataBase &, SvStream & rOutStm, + USHORT nTab ); + virtual void WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab, + WriteType, WriteAttribute = 0 ); +#endif +public: + SV_DECL_META_FACTORY1( SvMetaTypeEnum, SvMetaType, 21 ) + SvMetaTypeEnum(); + + USHORT GetMaxValue() const; + ULONG Count() const { return aEnumValueList.Count(); } + const ByteString & GetPrefix() const { return aPrefix; } + SvMetaEnumValue * GetObject( ULONG n ) const + { return aEnumValueList.GetObject( n ); } + +#ifdef IDL_COMPILER + virtual BOOL ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); + virtual void WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, USHORT nTab ); + + virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab, + WriteType, WriteAttribute = 0 ); +#endif +}; +SV_DECL_IMPL_REF(SvMetaTypeEnum) +SV_DECL_IMPL_PERSIST_LIST(SvMetaTypeEnum,SvMetaTypeEnum *) + + +/******************** class SvTypeVoid ***********************************/ +class SvMetaTypevoid : public SvMetaType +{ +public: + SV_DECL_META_FACTORY1( SvMetaTypevoid, SvMetaName, 22 ) + SvMetaTypevoid(); +}; +SV_DECL_IMPL_REF(SvMetaTypevoid) +SV_DECL_IMPL_PERSIST_LIST(SvMetaTypevoid,SvMetaTypevoid *) + + +#endif // _TYPES_HXX + diff --git a/idl/prj/d.lst b/idl/prj/d.lst new file mode 100644 index 000000000000..bd88bc495f72 --- /dev/null +++ b/idl/prj/d.lst @@ -0,0 +1,2 @@ +..\%__SRC%\bin\svidl.exe %_DEST%\bin%_EXT%\svidl.exe +..\%__SRC%\bin\svidl %_DEST%\bin%_EXT%\svidl diff --git a/idl/source/cmptools/char.cxx b/idl/source/cmptools/char.cxx new file mode 100644 index 000000000000..4b0ca177a508 --- /dev/null +++ b/idl/source/cmptools/char.cxx @@ -0,0 +1,247 @@ +/************************************************************************* + * + * $RCSfile: char.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________ + * + * + ************************************************************************/ + +/****************** I N C L U D E S **************************************/ +#include <ctype.h> +#include <string.h> + +#ifndef _TABLE_HXX //autogen +#include <tools/table.hxx> +#endif + +#include <char.hxx> +#pragma hdrstop + +/****************** D A T E N ********************************************/ +static unsigned char EqualTab[ 256 ] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, +100, 101, 102, 103, 104, 105, 106, 107, 108, 109, +110, 111, 112, 113, 114, 115, 116, 117, 118, 119, +120, 121, 122, 123, 124, 125, 126, 127, 128, 129, +130, 131, 132, 133, 134, 135, 136, 137, 138, 139, +140, 141, 142, 143, 144, 145, 146, 147, 148, 149, +150, 151, 152, 153, 154, 155, 156, 157, 158, 159, +160, 161, 162, 163, 164, 165, 166, 167, 168, 169, +170, 171, 172, 173, 174, 175, 176, 177, 178, 179, +180, 181, 182, 183, 184, 185, 186, 187, 188, 189, +190, 191, 192, 193, 194, 195, 196, 197, 198, 199, +200, 201, 202, 203, 204, 205, 206, 207, 208, 209, +210, 211, 212, 213, 214, 215, 216, 217, 218, 219, +220, 221, 222, 223, 224, 225, 226, 227, 228, 229, +230, 231, 232, 233, 234, 235, 236, 237, 238, 239, +240, 241, 242, 243, 244, 245, 246, 247, 248, 249, +250, 251, 252, 253, 254, 255 }; + + +/************************************************************************* +|* +|* RscChar::GetTable() +|* +|* Beschreibung +|* Ersterstellung MM 08.08.91 +|* Letzte Aenderung MM 08.08.91 +|* +*************************************************************************/ +Table * pCharTable = NULL; +unsigned char * pChange = EqualTab; +char * SvChar::GetTable( CharSet nSource , CharSet nDest ) +{ + if( nSource == nDest ) + return (char *)EqualTab; + + if( !pCharTable ) + pCharTable = new Table(); + + BYTE * pSet; + pSet = (BYTE *)pCharTable->Get( (ULONG)nSource << 16 + (ULONG)nDest ); + + if( !pSet ) + { + pSet = new BYTE[ 256 ]; + memcpy( pSet, EqualTab, sizeof( EqualTab ) ); + for( USHORT i = 128; i < 256; i++ ) + { + char c = ByteString::Convert( pSet[i], nSource, nDest ); + if( c ) + pSet[ i ] = (BYTE)c; + } + pCharTable->Insert( (ULONG)nSource << 16 + (ULONG)nDest, pSet ); + } + + return (char *)pSet; +}; + + +/************************************************************************* +|* +|* RscChar::MakeChar() +|* +|* Beschreibung Der ByteString wird nach C-Konvention umgesetzt +|* Ersterstellung MM 20.03.91 +|* Letzte Aenderung MM 20.03.91 +|* +*************************************************************************/ +BOOL SvChar::MakeChar( char * pChar, char ** ppStr ) +{ + char c; + BOOL bDoInc = TRUE; // Noch einmal erhoehen + + if( **ppStr == '\\' ) + { + ++*ppStr; + switch( **ppStr ) + { + case 'a': + c = '\a'; + break; + case 'b': + c = '\b'; + break; + case 'f': + c = '\f'; + break; + case 'n': + c = '\n'; + break; + case 'r': + c = '\r'; + break; + case 't': + c = '\t'; + break; + case 'v': + c = '\v'; + break; + case '\\': + c = '\\'; + break; + case '?': + c = '\?'; + break; + case '\'': + c = '\''; + break; + case '\"': + c = '\"'; + break; + default: + { + if( '0' <= **ppStr && '7' >= **ppStr ) + { + bDoInc = FALSE; + + USHORT nChar = 0; + USHORT i = 0; + while( '0' <= **ppStr && '7' >= **ppStr && i != 3 ) + { + nChar = nChar * 8 + (BYTE)**ppStr - (BYTE)'0'; + ++*ppStr; + i++; + } + if( nChar > 255 ) + // Wert zu gross, oder kein 3 Ziffern + return( FALSE ); + c = (char)nChar; + } + else if( 'x' == **ppStr ) + { + bDoInc = FALSE; + + USHORT nChar = 0; + USHORT i = 0; + ++*ppStr; + while( isxdigit( **ppStr ) && i != 2 ) + { + if( isdigit( **ppStr ) ) + nChar = nChar * 16 + (BYTE)**ppStr - (BYTE)'0'; + else if( isupper( **ppStr ) ) + nChar = nChar * 16 + (BYTE)**ppStr - (BYTE)'A' +10; + else + nChar = nChar * 16 + (BYTE)**ppStr - (BYTE)'a' +10; + ++*ppStr; + i++; + } + c = (char)nChar; + } + else + c = **ppStr; + //c = pChange [ (unsigned char)**ppStr ]; + }; + } + } + else + c = **ppStr; + //c = pChange [ (unsigned char)**ppStr ]; + + if( **ppStr && bDoInc ) ++*ppStr; + *pChar = c; + return( TRUE ); +}; + diff --git a/idl/source/cmptools/hash.cxx b/idl/source/cmptools/hash.cxx new file mode 100644 index 000000000000..2f14e1b01d99 --- /dev/null +++ b/idl/source/cmptools/hash.cxx @@ -0,0 +1,367 @@ +/************************************************************************* + * + * $RCSfile: hash.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________ + * + * + ************************************************************************/ + +/****************** I N C L U D E S **************************************/ +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> +#include <ctype.h> + +// Programmabhngige Includes. +#include <hash.hxx> + +#ifndef _TOOLS_DEBUG_HXX //autogen +#include <tools/debug.hxx> +#endif + +#pragma hdrstop + +/****************** C O D E **********************************************/ +/************************************************************************* +|* +|* SvStringHashEntry::~SvStringHashEntry() +|* +|* Beschreibung +|* +*************************************************************************/ +SvStringHashEntry::~SvStringHashEntry() { }; + +/************************************************************************* +|* +|* SvHashTable::SvHashTable() +|* +|* Beschreibung +|* +*************************************************************************/ +SvHashTable::SvHashTable( ULONG nMaxEntries ) +{ + nMax = nMaxEntries; // set max entries + nFill = 0; // no entries + lTry = 0; + lAsk = 0; +} + +/************************************************************************* +|* +|* SvHashTable::~SvHashTable() +|* +|* Beschreibung +|* +*************************************************************************/ +SvHashTable::~SvHashTable() +{ +#ifdef DOS_NIE + printf( "Maximum: %ld, Fllung: %ld\n", (ULONG)nMax, (ULONG)nFill ); + printf( "Anfragen: %ld, Versuche: %ld", (ULONG)lAsk, (ULONG)lTry ); + if( lTry != 0 ) + printf( ", V/E = %ld\n", lTry / lAsk ); +#endif +} + +/************************************************************************* +|* +|* SvHashTable::Test_Insert() +|* +|* Beschreibung +|* +*************************************************************************/ +BOOL SvHashTable::Test_Insert( const void * pElement, BOOL bInsert, + UINT32 * pInsertPos ) +{ + UINT32 nHash; + UINT32 nIndex; + UINT32 nLoop; + + lAsk++; + lTry++; + + nHash = HashFunc( pElement ); + nIndex = nHash % nMax; + +// const char* s = ((ByteString*) pElement)->GetStr(); +// fprintf(stderr,"### Hash: %lu , Name: %s\n",nIndex,s ); + + nLoop = 0; // divide to range + while( (nMax != nLoop) && IsEntry( nIndex ) ) + { // is place occupied + if( COMPARE_EQUAL == Compare( pElement, nIndex ) ) + { + if( pInsertPos ) + *pInsertPos = nIndex; // place of Element + return TRUE; + } + nLoop++; + lTry++; + nIndex = (USHORT)(nIndex + nHash + 7) % nMax; + } + + if( bInsert ) + { + DBG_ASSERT( nMax != nLoop, "Hash table full" ) + if( nMax != nLoop ) + { + nFill++; + *pInsertPos = nIndex; // return free place + return TRUE; + } + } + return( FALSE ); +} + +/************************************************************************/ +/************************************************************************* +|* +|* SvStringHashTable::SvStringHashTable() +|* +|* Beschreibung +|* +*************************************************************************/ +SvStringHashTable::SvStringHashTable( UINT32 nMaxEntries ) + : SvHashTable( nMaxEntries ) +{ +#ifdef WIN + DBG_ASSERT( (UINT32)nMaxEntries * sizeof( SvStringHashEntry ) <= 0xFF00, + "Hash table size cannot exeed 64k byte" ) +#endif + pEntries = new SvStringHashEntry[ nMaxEntries ]; + + // RefCount auf eins setzen + SvStringHashEntry * pPos, *pEnd; + pPos = pEntries; + pEnd = pEntries + nMaxEntries; + while( pPos != pEnd ) + { + pPos->AddRef(); + pPos++; + } +} + +/************************************************************************* +|* +|* ~SvStringHashTable::SvStringHashTable() +|* +|* Beschreibung +|* +*************************************************************************/ +SvStringHashTable::~SvStringHashTable() +{ + // RefCount auf eins setzen + SvStringHashEntry * pPos, *pEnd; + pPos = pEntries; + pEnd = pEntries + GetMax(); +#ifdef DBG_UTIL + while( pPos != pEnd ) + { + DBG_ASSERT( pPos->GetRefCount() == 1, "Reference count != 1" ) + pPos++; + } +#endif + +#ifdef MPW + // der MPW-Compiler ruft sonst keine Dtoren! + for ( USHORT n = 0; n < GetMax(); ++n ) + (pEntries+n)->SvStringHashEntry::~SvStringHashEntry(); + delete (void*) pEntries; +#else + delete [] pEntries; +#endif +} + +/************************************************************************* +|* +|* SvStringHashTable::HashFunc() +|* +|* Beschreibung +|* +*************************************************************************/ +UINT32 SvStringHashTable::HashFunc( const void * pElement ) const +{ + UINT32 nHash = 0; // hash value + const char * pStr = ((const ByteString * )pElement)->GetBuffer(); + + int nShift = 0; + while( *pStr ) + { + if( isupper( *pStr ) ) + nHash ^= UINT32(*pStr - 'A' + 26) << nShift; + else + nHash ^= UINT32(*pStr - 'a') << nShift; + if( nShift == 28 ) + nShift = 0; + else + nShift += 4; + pStr++; + } + return( nHash ); +} + +/************************************************************************* +|* +|* SvStringHashTable::GetNearString() +|* +|* Beschreibung +|* +*************************************************************************/ +ByteString SvStringHashTable::GetNearString( const ByteString & rName ) const +{ + for( UINT32 i = 0; i < GetMax(); i++ ) + { + SvStringHashEntry * pE = Get( i ); + if( pE ) + { + if( pE->GetName().EqualsIgnoreCaseAscii( rName ) && !pE->GetName().Equals( rName ) ) + return pE->GetName(); + } + } + return ByteString(); +} + +/************************************************************************* +|* +|* SvStringHashTable::IsEntry() +|* +|* Beschreibung +|* +*************************************************************************/ +BOOL SvStringHashTable::IsEntry( UINT32 nIndex ) const +{ + if( nIndex >= GetMax() ) + return FALSE; + return pEntries[ nIndex ].HasId(); +} + +/************************************************************************* +|* +|* SvStringHashTable::Insert() +|* +|* Beschreibung +|* +*************************************************************************/ +BOOL SvStringHashTable::Insert( const ByteString & rName, UINT32 * pIndex ) +{ + UINT32 nIndex; + + if( !pIndex ) pIndex = &nIndex; + + if( !SvHashTable::Test_Insert( &rName, TRUE, pIndex ) ) + return FALSE; + + if( !IsEntry( *pIndex ) ) + pEntries[ *pIndex ] = SvStringHashEntry( rName, *pIndex ); + return TRUE; +} + +/************************************************************************* +|* +|* SvStringHashTable::Test() +|* +|* Beschreibung +|* +*************************************************************************/ +BOOL SvStringHashTable::Test( const ByteString & rName, UINT32 * pPos ) const +{ + return ((SvStringHashTable *)this)->SvHashTable:: + Test_Insert( &rName, FALSE, pPos ); +} + +/************************************************************************* +|* +|* SvStringHashTable::Get() +|* +|* Beschreibung +|* +*************************************************************************/ +SvStringHashEntry * SvStringHashTable::Get( UINT32 nIndex ) const +{ + if( IsEntry( nIndex ) ) + return pEntries + nIndex; + return( NULL ); +} + +/************************************************************************* +|* +|* SvStringHashTable::Get() +|* +|* Beschreibung +|* +*************************************************************************/ +StringCompare SvStringHashTable::Compare( const void * pElement, + UINT32 nIndex ) const +{ + return ((const ByteString *)pElement)->CompareTo( pEntries[ nIndex ].GetName() ); +} + +/************************************************************************* +|* +|* SvStringHashTable::FillHashList() +|* +|* Beschreibung +|* +*************************************************************************/ +void SvStringHashTable::FillHashList( SvStringHashList * pList ) const +{ + for( UINT32 n = 0; n < GetMax(); n++ ) + { + if( IsEntry( n ) ) + pList->Insert( Get( n ), LIST_APPEND ); + } + // Hash Reihenfolge, jetzt sortieren +} diff --git a/idl/source/cmptools/lex.cxx b/idl/source/cmptools/lex.cxx new file mode 100644 index 000000000000..3162eafbb3c5 --- /dev/null +++ b/idl/source/cmptools/lex.cxx @@ -0,0 +1,677 @@ +/************************************************************************* + * + * $RCSfile: lex.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________ + * + * + ************************************************************************/ + + +#include <ctype.h> +#include <stdio.h> + +#include <char.hxx> +#include <hash.hxx> +#include <lex.hxx> +#include <globals.hxx> + +#ifndef _BIGINT_HXX //autogen +#include <tools/bigint.hxx> +#endif + +#pragma hdrstop + +/****************** SvToken **********************************************/ +/************************************************************************* +|* +|* SvToken::Print() +|* +|* Beschreibung +|* +*************************************************************************/ +ByteString SvToken::GetTokenAsString() const +{ + ByteString aStr; + switch( nType ) + { + case SVTOKEN_EMPTY: + break; + case SVTOKEN_COMMENT: + aStr = aString; + break; + case SVTOKEN_INTEGER: + aStr = nLong; + break; + case SVTOKEN_STRING: + aStr = aString; + break; + case SVTOKEN_BOOL: + aStr = bBool ? "TRUE" : "FALSE"; + break; + case SVTOKEN_IDENTIFIER: + aStr = aString; + break; + case SVTOKEN_CHAR: + aStr = cChar; + break; + case SVTOKEN_RTTIBASE: + aStr = "RTTIBASE";//(ULONG)pComplexObj; + break; + case SVTOKEN_EOF: + break; + } + + return aStr; +} + +/************************************************************************* +|* +|* SvToken::Print() +|* +|* Beschreibung +|* +*************************************************************************/ +ByteString SvToken::Print() const +{ + ByteString aStr; + aStr += "Line = "; + aStr += nLine; + aStr += ", Column = "; + aStr += nColumn; + aStr += ", "; + switch( nType ) + { + case SVTOKEN_EMPTY: + aStr += "Empty"; + break; + case SVTOKEN_COMMENT: + aStr += "Comment = "; + break; + case SVTOKEN_INTEGER: + aStr += "Integer = "; + break; + case SVTOKEN_STRING: + aStr += "ByteString = "; + break; + case SVTOKEN_BOOL: + aStr += "Bool = "; + break; + case SVTOKEN_IDENTIFIER: + aStr += "Identifier = "; + break; + case SVTOKEN_CHAR: + aStr += "char = "; + break; + case SVTOKEN_RTTIBASE: + aStr += "SvRttiBase = "; + break; + case SVTOKEN_EOF: + aStr += "end of file"; + break; + } + aStr += GetTokenAsString(); + + return aStr; +} + +/************************************************************************* +|* +|* SvToken::SvToken() +|* +|* Beschreibung +|* +*************************************************************************/ +SvToken::SvToken( const SvToken & rObj ) +{ + nLine = rObj.nLine; + nColumn = rObj.nColumn; + nType = rObj.nType; + aString = rObj.aString; +/* + if( SVTOKEN_RTTIBASE = nType ) + { + pComplexObj = rObj.pComplexObj; + pComplexObj->AddRef(); + } + else +*/ + nLong = rObj.nLong; +} + +/************************************************************************* +|* +|* SvToken::operator = () +|* +|* Beschreibung +|* +*************************************************************************/ +SvToken & SvToken::operator = ( const SvToken & rObj ) +{ + if( this != &rObj ) + { +/* + if( SVTOKEN_RTTIBASE = nType ) + pComplexObj->ReleaseRef(); +*/ + nLine = rObj.nLine; + nColumn = rObj.nColumn; + nType = rObj.nType; + aString = rObj.aString; +/* + if( SVTOKEN_RTTIBASE = nType ) + { + pComplexObj = rObj.pComplexObj; + pComplexObj->AddRef(); + } + else +*/ + nLong = rObj.nLong; + } + return *this; +} + +/****************** SvTokenStream ****************************************/ +/************************************************************************* +|* SvTokenStream::InitCtor() +|* +|* Beschreibung +*************************************************************************/ +void SvTokenStream::InitCtor() +{ +#ifdef DOS + SetCharSet( CHARSET_ANSI ); +#else + SetCharSet( gsl_getSystemTextEncoding() ); +#endif + aStrTrue = "TRUE"; + aStrFalse = "FALSE"; + nLine = nColumn = 0; + nBufPos = 0; + nTabSize = 4; + pCurToken = NULL; + nMaxPos = 0; + c = GetNextChar(); + FillTokenList(); +} + +/************************************************************************* +|* SvTokenStream::SvTokenStream() +|* +|* Beschreibung +*************************************************************************/ +SvTokenStream::SvTokenStream( const String & rFileName ) + : aFileName( rFileName ) + , pInStream( new SvFileStream( rFileName, STREAM_STD_READ | STREAM_NOCREATE ) ) + , rInStream( *pInStream ) + , aTokList( 0x8000, 0x8000 ) +{ + InitCtor(); +} + +/************************************************************************* +|* SvTokenStream::SvTokenStream() +|* +|* Beschreibung +*************************************************************************/ +SvTokenStream::SvTokenStream( SvStream & rStream, const String & rFileName ) + : aFileName( rFileName ) + , pInStream( NULL ) + , rInStream( rStream ) + , aTokList( 0x8000, 0x8000 ) +{ + InitCtor(); +} + +/************************************************************************* +|* SvTokenStream::~SvTokenStream() +|* +|* Beschreibung +*************************************************************************/ +SvTokenStream::~SvTokenStream() +{ + delete pInStream; + SvToken * pTok = aTokList.Last(); + while( pTok ) + { + delete pTok; + pTok = aTokList.Prev(); + } +} + +/************************************************************************* +|* SvTokenStream::GetHexValue() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvTokenStream::GetHexValue( const ByteString & rStr, BigInt * pValue ) +{ + short nLog = 16; + + *pValue = 0; + char * pStr = (char *)rStr.GetBuffer(); + while( isxdigit( *pStr ) ) + { + if( isdigit( *pStr ) ) + *pValue = *pValue * BigInt( nLog ) + BigInt(*pStr - '0'); + else + *pValue = *pValue * BigInt( nLog ) + BigInt(toupper( *pStr ) - 'A' + 10 ); + pStr++; + } + return '\0' == *pStr; +} + + +/************************************************************************* +|* SvTokenStream::FillTokenList() +|* +|* Beschreibung +*************************************************************************/ +void SvTokenStream::FillTokenList() +{ + SvToken * pToken = new SvToken(); + aTokList.Insert( pToken, LIST_APPEND ); + do + { + if( !MakeToken( *pToken ) ) + { + SvToken * p = aTokList.Prev(); + *pToken = SvToken(); + if( p ) + { + pToken->SetLine( p->GetLine() ); + pToken->SetColumn( p->GetColumn() ); + } + break; + } + else if( pToken->IsComment() ) + *pToken = SvToken(); + else if( pToken->IsEof() ) + break; + else + { + pToken = new SvToken(); + aTokList.Insert( pToken, LIST_APPEND ); + } + } + while( !pToken->IsEof() ); + pCurToken = aTokList.First(); +} + +/************************************************************************* +|* SvTokenStream::Skip() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvTokenStream::Skip( char cStart, char cEnd, UINT32 * pBegin ) +{ + SvToken * pTok = GetToken_Next(); + while( !pTok->IsEof() + && (!pTok->IsChar() || cStart != pTok->GetChar()) ) + pTok = GetToken_Next(); + + if( pBegin ) + *pBegin = Tell() -1; + UINT32 nContextCount = 1; + + while( !pTok->IsEof() && nContextCount != 0 ) + { + pTok = GetToken_Next(); + if( pTok->IsChar() ) + { + if( cEnd == pTok->GetChar() ) + nContextCount--; + if( cStart == pTok->GetChar() ) + nContextCount++; + } + } + pTok = GetToken(); + if( cEnd == '}' && pTok->IsChar() && pTok->GetChar() == ';' ) + // siehe aerger rsc, }; ausgemerzt + pTok = GetToken_Next(); + return nContextCount == 0; +} + +/************************************************************************* +|* SvTokenStream::Replace() +|* +|* Beschreibung +|* Invariante Range immer gueltig +*************************************************************************/ +void SvTokenStream::Replace( const Range & rRange, SvToken * pNewTok ) +{ + // Robuster SeekCursor + ULONG nSeekPos = aTokList.GetCurPos(); + if( nSeekPos >= (ULONG)rRange.Min() ) + if( nSeekPos <= (ULONG)rRange.Max() ) + nSeekPos = rRange.Min(); + else + nSeekPos -= rRange.Len(); + + long nLen = rRange.Len(); + aTokList.Seek( (ULONG)rRange.Min() ); + while( nLen-- ) + delete aTokList.Remove(); + + Seek( nSeekPos ); +} + +/************************************************************************* +|* SvTokenStrem::SetCharSet() +|* +|* Beschreibung +*************************************************************************/ +void SvTokenStream::SetCharSet( CharSet nSet ) +{ + nCharSet = nSet; + +#ifdef DOS + pCharTab = SvChar::GetTable( nSet, CHARSET_ANSI ); +#else + pCharTab = SvChar::GetTable( nSet, gsl_getSystemTextEncoding() ); +#endif +} + +/************************************************************************* +|* SvTokeStream::GetNextChar() +|* +|* Beschreibung +*************************************************************************/ +int SvTokenStream::GetNextChar() +{ + int nChar; + if( (int)aBufStr.Len() < nBufPos ) + { + if( rInStream.ReadLine( aBufStr ) ) + { + nLine++; + nColumn = 0; + nBufPos = 0; + } + else + { + aBufStr.Erase(); + nColumn = 0; + nBufPos = 0; + return '\0'; + } + } + nChar = aBufStr.GetChar( (USHORT)nBufPos++ ); + nColumn += nChar == '\t' ? nTabSize : 1; + return nChar; +} + +/************************************************************************* +|* SvTokenStrem::GetNumber() +|* +|* Beschreibung +*************************************************************************/ +ULONG SvTokenStream::GetNumber() +{ + ULONG l = 0; + short nLog = 10; + + if( '0' == c ) + { + c = GetFastNextChar(); + if( 'x' == c ) + { + nLog = 16; + c = GetFastNextChar(); + } + }; + + if( nLog == 16 ) + { + while( isxdigit( c ) ) + { + if( isdigit( c ) ) + l = l * nLog + (c - '0'); + else + l = l * nLog + (toupper( c ) - 'A' + 10 ); + c = GetFastNextChar(); + } + } + else + { + while( isdigit( c ) || 'x' == c ) + { + l = l * nLog + (c - '0'); + c = GetFastNextChar(); + } + } + + return( l ); +} + +/************************************************************************* +|* SvTokenStream::MakeToken() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvTokenStream::MakeToken( SvToken & rToken ) +{ + int c1; + USHORT i; + + do + { + if( 0 == c ) + c = GetNextChar(); + // Leerzeichen ueberlesen + while( isspace( c ) || 26 == c ) + { + c = GetFastNextChar(); + nColumn += c == '\t' ? nTabSize : 1; + } + } + while( 0 == c && !IsEof() && ( SVSTREAM_OK == rInStream.GetError() ) ); + + ULONG nLastLine = nLine; + ULONG nLastColumn = nColumn; + // Kommentar + if( '/' == c ) + { + // Zeit Optimierung, keine Kommentare + //ByteString aComment( (char)c ); + c1 = c; + c = GetFastNextChar(); + if( '/' == c ) + { + while( '\0' != c ) + { + //aComment += (char)c; + c = GetFastNextChar(); + } + c = GetNextChar(); + rToken.nType = SVTOKEN_COMMENT; + //rToken.aString = aComment; + } + else if( '*' == c ) + { + //aComment += (char)c; + c = GetFastNextChar(); + do + { + //aComment += (char)c; + while( '*' != c ) + { + if( '\0' == c ) + { + c = GetNextChar(); + if( IsEof() ) + return FALSE; + } + else + c = GetFastNextChar(); + //aComment += (char)c; + } + c = GetFastNextChar(); + } + while( '/' != c && !IsEof() && ( SVSTREAM_OK == rInStream.GetError() ) ); + if( IsEof() || ( SVSTREAM_OK != rInStream.GetError() ) ) + return FALSE; + //aComment += (char)c; + c = GetNextChar(); + rToken.nType = SVTOKEN_COMMENT; + //rToken.aString = aComment; + CalcColumn(); + } + else + { + rToken.nType = SVTOKEN_CHAR; + rToken.cChar = (char)c1; + } + } + else if( c == '"' ) + { + ByteString aStr; + i = 0; + BOOL bDone = FALSE; + while( !bDone && !IsEof() && c ) + { + c = GetFastNextChar(); + if( '\0' == c ) + { + // Strings auch "uber das Zeilenende hinauslesen + aStr += '\n'; + c = GetNextChar(); + if( IsEof() ) + return FALSE; + } + if( c == '"' ) + { + c = GetFastNextChar(); + if( c == '"' ) + { + aStr += '"'; + aStr += '"'; + } + else + bDone = TRUE; + } + else if( c == '\\' ) + { + aStr += '\\'; + c = GetFastNextChar(); + if( c ) + aStr += (char)c; + } + else + aStr += (char)c; + } + if( IsEof() || ( SVSTREAM_OK != rInStream.GetError() ) ) + return FALSE; + char * pStr = (char *)aStr.GetBuffer(); + while( *pStr ) + { + *pStr = pCharTab[ (unsigned char)*pStr ]; + pStr++; + }; + rToken.nType = SVTOKEN_STRING; + rToken.aString = aStr; + } + else if( isdigit( c ) ) + { + rToken.nType = SVTOKEN_INTEGER; + rToken.nLong = GetNumber(); + + } + else if( isalpha (c) || (c == '_') ) + { + ByteString aStr; + + while( isalnum( c ) || c == '_' ) + { + aStr += (char)c; + c = GetFastNextChar(); + } + if( aStr.EqualsIgnoreCaseAscii( aStrTrue ) ) + { + rToken.nType = SVTOKEN_BOOL; + rToken.bBool = TRUE; + } + else if( aStr.EqualsIgnoreCaseAscii( aStrFalse ) ) + { + rToken.nType = SVTOKEN_BOOL; + rToken.bBool = FALSE; + } + else + { + UINT32 nHashId; + if( IDLAPP->pHashTable->Test( aStr, &nHashId ) ) + rToken.SetHash( IDLAPP->pHashTable->Get( nHashId ) ); + else + { + rToken.nType = SVTOKEN_IDENTIFIER; + rToken.aString = aStr; + } + } + } + else if( IsEof() ) + { + rToken.nType = SVTOKEN_EOF; + } + else + { + rToken.nType = SVTOKEN_CHAR; + rToken.cChar = (char)c; + c = GetFastNextChar(); + } + rToken.SetLine( nLastLine ); + rToken.SetColumn( nLastColumn ); + return rInStream.GetError() == SVSTREAM_OK; +} + diff --git a/idl/source/cmptools/makefile.mk b/idl/source/cmptools/makefile.mk new file mode 100644 index 000000000000..9a718c175dae --- /dev/null +++ b/idl/source/cmptools/makefile.mk @@ -0,0 +1,99 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:30: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=..$/.. + +PRJPCH= + +PROJECTPCH4DLL=TRUE +PROJECTPCH=idlpch +PROJECTPCHSOURCE=$(PRJ)$/util$/idlpch + +PRJNAME=SVIDL +TARGET=cmptools + +# --- Settings ----------------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +.IF "$(COM)"=="WTC" +CFLAGS+=-od +.ENDIF + +CDEFS+=-DIDL_COMPILER +# --- Files -------------------------------------------------------------- + +CXXFILES= char.cxx \ + lex.cxx \ + hash.cxx \ + $(PROJECTPCHSOURCE).cxx + +OBJFILES= $(OBJ)$/lex.obj \ + $(OBJ)$/char.obj \ + $(OBJ)$/hash.obj + +# --- Targets ------------------------------------------------------------ + +.INCLUDE : target.mk + diff --git a/idl/source/objects/basobj.cxx b/idl/source/objects/basobj.cxx new file mode 100644 index 000000000000..1cfa683cb170 --- /dev/null +++ b/idl/source/objects/basobj.cxx @@ -0,0 +1,863 @@ +/************************************************************************* + * + * $RCSfile: basobj.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________ + * + * + ************************************************************************/ + +#include <ctype.h> +#include <stdio.h> + +#include <tools/debug.hxx> + +#include <attrib.hxx> +#include <basobj.hxx> +#include <module.hxx> +#include <globals.hxx> +#include <database.hxx> +#pragma hdrstop + +/****************** SvMetaObject *****************************************/ +SV_IMPL_META_FACTORY1( SvMetaObject, SvRttiBase ) +#ifdef IDL_COMPILER +SvAttributeList & SvMetaObject::GetAttributeList() +{ + if( !pAttribList ) + { + pAttribList = new SvAttributeList(); + } + return *pAttribList; +} +#endif +/************************************************************************* +|* SvMetaObject::SvMetaObject() +|* +|* Beschreibung +*************************************************************************/ +SvMetaObject::SvMetaObject() +{ +} + +void SvMetaObject::Load( SvPersistStream & ) +{ +} + +void SvMetaObject::Save( SvPersistStream & ) +{ +} + +/************************************************************************* +|* SvMetaObject::WriteTab() +|* +|* Beschreibung +*************************************************************************/ +#ifdef IDL_COMPILER +void SvMetaObject::WriteTab( SvStream & rOutStm, USHORT nTab ) +{ + while( nTab-- ) + rOutStm << " "; +// rOutStm << '\t'; +} + +/************************************************************************* +|* SvMetaObject::WriteStart() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaObject::WriteStars( SvStream & rOutStm ) +{ + rOutStm << '/'; + for( int i = 6; i > 0; i-- ) + rOutStm << "**********"; + rOutStm << '/' << endl; +} + +/************************************************************************* +|* SvMetaObject::TestAndSeekSpaceOnly() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaObject::TestAndSeekSpaceOnly( SvStream & rOutStm, ULONG nBegPos ) +{ + // keine leeren Klammern schreiben + ULONG nPos = rOutStm.Tell(); + rOutStm.Seek( nBegPos ); + BOOL bOnlySpace = TRUE; + while( bOnlySpace && rOutStm.Tell() < nPos ) + { + char c; + rOutStm >> c; + if( !isspace( c ) ) + bOnlySpace = FALSE; + } + if( bOnlySpace ) + // nichts geschrieben + rOutStm.Seek( nBegPos ); + else + rOutStm.Seek( nPos ); + return bOnlySpace; +} + +/************************************************************************* +|* SvMetaObject::Back2Delemitter() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaObject::Back2Delemitter( SvStream & rOutStm ) +{ + // keine leeren Klammern schreiben + ULONG nPos = rOutStm.Tell(); + rOutStm.SeekRel( -1 ); + char c = 0; + rOutStm >> c; + + while( isspace( c ) && rOutStm.Tell() != 1 ) + { + rOutStm.SeekRel( -2 ); + rOutStm >> c; + } + + if( c == ';' || c == ',' ) + rOutStm.SeekRel( -1 ); + else + rOutStm.Seek( nPos ); +} + +/************************************************************************* +|* SvMetaObject::ReadSvIdl() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaObject::ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) +{ + return FALSE; +} + +/************************************************************************* +|* SvMetaObject::WriteSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaObject::WriteSvIdl( SvIdlDataBase &, SvStream &, USHORT /*nTab */ ) +{ +} + +/************************************************************************* +|* SvMetaObject::Write() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaObject::Write( SvIdlDataBase &, SvStream &, USHORT /*nTab */, + WriteType, WriteAttribute ) +{ +} + +/************************************************************************* +|* SvMetaObject::WriteCxx() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaObject::WriteCxx( SvIdlDataBase &, SvStream &, USHORT /*nTab */ ) +{ +} + +/************************************************************************* +|* SvMetaObject::WriteHxx() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaObject::WriteHxx( SvIdlDataBase &, SvStream &, USHORT /*nTab */ ) +{ +} + +#endif + +/****************** SvMetaName *****************************************/ +SV_IMPL_META_FACTORY1( SvMetaName, SvMetaObject ); +#ifdef IDL_COMPILER +SvAttributeList & SvMetaName::GetAttributeList() +{ + if( !pAttribList ) + { + pAttribList = new SvAttributeList(); + pAttribList->Append( new SV_ATTRIBUTE( Name, Name ) ); + } + return *pAttribList; +} +#endif +/************************************************************************* +|* SvMetaName::SvMetaName() +|* +|* Beschreibung +*************************************************************************/ +SvMetaName::SvMetaName() +{ +} + +void SvMetaName::Load( SvPersistStream & rStm ) +{ + SvMetaObject::Load( rStm ); + BYTE nMask; + rStm >> nMask; + + if( nMask >= 0x20 ) + { + rStm.SetError( SVSTREAM_FILEFORMAT_ERROR ); + DBG_ERROR( "wrong format" ) + return; + } + if( nMask & 0x01 ) rStm >> aName; + if( nMask & 0x02 ) rStm >> aHelpContext; + if( nMask & 0x04 ) rStm >> aHelpText; + if( nMask & 0x08 ) rStm >> aConfigName; + if( nMask & 0x10 ) rStm >> aDescription; +} + +void SvMetaName::Save( SvPersistStream & rStm ) +{ + SvMetaObject::Save( rStm ); + BYTE nMask = 0; + if( aName.IsSet() ) nMask |= 0x01; + if( aHelpContext.IsSet() ) nMask |= 0x02; + if( aHelpText.IsSet() ) nMask |= 0x04; + if( aConfigName.IsSet() ) nMask |= 0x08; + if( aDescription.IsSet() ) nMask |= 0x10; + + rStm << nMask; + if( nMask & 0x01 ) rStm << aName; + if( nMask & 0x02 ) rStm << aHelpContext; + if( nMask & 0x04 ) rStm << aHelpText; + if( nMask & 0x08 ) rStm << aConfigName; + if( nMask & 0x10 ) rStm << aDescription; +} + +/************************************************************************* +|* +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaName::SetName( const ByteString & rName, SvIdlDataBase * ) +{ + aName = rName; + return TRUE; +} + +#ifdef IDL_COMPILER +/************************************************************************* +|* SvMetaName::ReadNameSvIdl() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaName::ReadNameSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm ) +{ + UINT32 nTokPos = rInStm.Tell(); + SvToken * pTok = rInStm.GetToken_Next(); + + // Modulnamen lesen + if( pTok->IsIdentifier() ) + if( SetName( pTok->GetString(), &rBase ) ) + return TRUE; + + rInStm.Seek( nTokPos ); + return FALSE; +} + +/************************************************************************* +|* SvMetaName::ReadSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaName::ReadAttributesSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm ) +{ + UINT32 nTokPos = rInStm.Tell(); + if( aName.ReadSvIdl( SvHash_Name(), rInStm ) ) + { + if( !SetName( aName, &rBase ) ) + rInStm.Seek( nTokPos ); + } + aHelpContext.ReadSvIdl( rBase, SvHash_HelpContext(), rInStm ); + aHelpText.ReadSvIdl( rBase, rInStm ); + aConfigName.ReadSvIdl( SvHash_ConfigName(), rInStm ); + aDescription.ReadSvIdl( SvHash_Description(), rInStm ); +/* + aHelpContext.ReadSvIdl( GetModule()->GetInfo()->GetHelpContextContainer(), + rInStm ); +*/ +} + +/************************************************************************* +|* SvMetaName::DoReadContextSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaName::DoReadContextSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm, char cDel ) +{ + UINT32 nBeginPos = 0; // kann mit Tell nicht vorkommen + while( nBeginPos != rInStm.Tell() ) + { + nBeginPos = rInStm.Tell(); + ReadContextSvIdl( rBase, rInStm ); + if( cDel == '\0' ) + rInStm.ReadDelemiter(); + else + rInStm.Read( cDel ); + } +} + +/************************************************************************* +|* SvMetaName::ReadSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaName::ReadContextSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm ) +{ +} + +/************************************************************************* +|* SvMetaName::Test() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaName::Test( SvIdlDataBase &, SvTokenStream & ) +{ + return TRUE; +} + +/************************************************************************* +|* SvMetaName::WriteContextSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaName::WriteContextSvIdl( SvIdlDataBase & rBase, + SvStream & rOutStm, + USHORT nTab ) +{ +} + +/************************************************************************* +|* SvMetaName::WriteDescription() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaName::WriteDescription( SvIdlDataBase & rBase, + SvStream & rOutStm ) +{ + rOutStm << "<DESCRIPTION>" << endl; + + ByteString aDescription( GetDescription() ); + USHORT nPos = aDescription.Search( '\n' ); + while ( nPos != STRING_NOTFOUND ) + { + rOutStm << aDescription.Copy( 0, nPos ).GetBuffer() << endl; + aDescription.Erase(0,nPos+1); + nPos = aDescription.Search( '\n' ); + } + + rOutStm << aDescription.GetBuffer() << endl + << "</DESCRIPTION>" << endl; +} + +/************************************************************************* +|* SvMetaName::WriteAttributesIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaName::WriteAttributesSvIdl( SvIdlDataBase & rBase, + SvStream & rOutStm, + USHORT nTab ) +{ + if( aHelpContext.IsSet() || aHelpText.IsSet() || aConfigName.IsSet() ) + { + WriteTab( rOutStm, nTab ); + rOutStm << "// class SvMetaName" << endl; + } + if( aHelpContext.IsSet() ) + { + WriteTab( rOutStm, nTab ); + aHelpContext.WriteSvIdl( SvHash_HelpContext(), rOutStm, nTab ); + rOutStm << ';' << endl; + } + if( aHelpText.IsSet() ) + { + WriteTab( rOutStm, nTab ); + aHelpText.WriteSvIdl( rBase, rOutStm, nTab ); + rOutStm << ';' << endl; + } + if( aConfigName.IsSet() ) + { + WriteTab( rOutStm, nTab ); + aConfigName.WriteSvIdl( SvHash_ConfigName(), rOutStm, nTab ); + rOutStm << ';' << endl; + } +} + +/************************************************************************* +|* SvMetaName::ReadSvIdl() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaName::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm ) +{ + UINT32 nTokPos = rInStm.Tell(); + BOOL bOk = TRUE; + if( rInStm.Read( '[' ) ) + { + UINT32 nBeginPos = 0; // kann mit Tell nicht vorkommen + while( nBeginPos != rInStm.Tell() ) + { + nBeginPos = rInStm.Tell(); + ReadAttributesSvIdl( rBase, rInStm ); + rInStm.ReadDelemiter(); + } + bOk = rInStm.Read( ']' ); + } + + if( bOk ) + { + if( rInStm.Read( '{' ) ) + { + DoReadContextSvIdl( rBase, rInStm ); + bOk = rInStm.Read( '}' ); + } + } + + if( !bOk ) + rInStm.Seek( nTokPos ); + return bOk; +} + +/************************************************************************* +|* SvMetaName::WriteSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaName::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab ) +{ + ULONG nBeginPos = rOutStm.Tell(); + WriteTab( rOutStm, nTab ); + rOutStm << '[' << endl; + ULONG nOldPos = rOutStm.Tell(); + WriteAttributesSvIdl( rBase, rOutStm, nTab +1 ); + + // keine leeren Klammern schreiben + if( TestAndSeekSpaceOnly( rOutStm, nOldPos ) ) + // nichts geschrieben + rOutStm.Seek( nBeginPos ); + else + { + WriteTab( rOutStm, nTab ); + rOutStm << ']'; + nBeginPos = rOutStm.Tell(); + rOutStm << endl; + } + + WriteTab( rOutStm, nTab ); + rOutStm << '{' << endl; + nOldPos = rOutStm.Tell(); + WriteContextSvIdl( rBase, rOutStm, nTab +1 ); + + // keine leeren Klammern schreiben + if( TestAndSeekSpaceOnly( rOutStm, nOldPos ) ) + // nichts geschrieben + rOutStm.Seek( nBeginPos ); + else + { + WriteTab( rOutStm, nTab ); + rOutStm << '}'; + } +} + +/************************************************************************* +|* SvMetaName::Write() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaName::Write( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab, + WriteType nT, WriteAttribute nA ) +{ + ULONG nBeginPos = rOutStm.Tell(); + WriteTab( rOutStm, nTab ); + rOutStm << '[' << endl; + ULONG nOldPos = rOutStm.Tell(); + WriteAttributes( rBase, rOutStm, nTab +1, nT, nA ); + + // keine leeren Klammern schreiben + ULONG nPos = rOutStm.Tell(); + rOutStm.Seek( nOldPos ); + BOOL bOnlySpace = TRUE; + while( bOnlySpace && rOutStm.Tell() < nPos ) + { + char c; + rOutStm >> c; + if( !isspace( c ) ) + bOnlySpace = FALSE; + } + if( bOnlySpace ) + // nichts geschrieben + rOutStm.Seek( nBeginPos ); + else + { + rOutStm.Seek( nPos ); + WriteTab( rOutStm, nTab ); + rOutStm << ']' << endl; + } +} + +/************************************************************************* +|* SvMetaName::WriteAttributes() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaName::WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab, + WriteType nT, WriteAttribute nA ) +{ + if( GetHelpText().IsSet() || GetHelpContext().IsSet() ) + { + WriteTab( rOutStm, nTab ); + rOutStm << "// class SvMetaName" << endl; + } + if( GetHelpText().IsSet() ) + { + WriteTab( rOutStm, nTab ); + rOutStm << "helpstring(\"" << GetHelpText().GetBuffer() << "\")," << endl; + } + if( GetHelpContext().IsSet() ) + { + WriteTab( rOutStm, nTab ); + rOutStm << "helpcontext(" + << ByteString( GetHelpContext().GetValue() ).GetBuffer() + << ")," << endl; + } +} + +/************************************************************************* +|* SvMetaName::WriteContext() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaName::WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab, + WriteType nT, WriteAttribute nA ) +{ +} +#endif // IDL_COMPILER + +/****************** SvMetaReference *****************************************/ +SV_IMPL_META_FACTORY1( SvMetaReference, SvMetaName ); +#ifdef IDL_COMPILER +SvAttributeList & SvMetaReference::GetAttributeList() +{ + if( !pAttribList ) + { + pAttribList = new SvAttributeList(); + } + return *pAttribList; +} +#endif + +/************************************************************************* +|* SvMetaReference::SvMetaReference() +|* +|* Beschreibung +*************************************************************************/ +SvMetaReference::SvMetaReference() +{ +} + +void SvMetaReference::Load( SvPersistStream & rStm ) +{ + SvMetaName::Load( rStm ); + + BYTE nMask; + rStm >> nMask; + if( nMask >= 0x2 ) + { + rStm.SetError( SVSTREAM_FILEFORMAT_ERROR ); + DBG_ERROR( "wrong format" ) + return; + } + if( nMask & 0x01 ) + { + SvMetaReference * pRef; + rStm >> pRef; + aRef = pRef; + } +} + +void SvMetaReference::Save( SvPersistStream & rStm ) +{ + SvMetaName::Save( rStm ); + + // Maske erstellen + BYTE nMask = 0; + if( aRef.Is() ) + nMask |= 0x01; + + // Daten schreiben + rStm << nMask; + if( nMask & 0x01 ) rStm << aRef; +} + +/**************************************************************************/ +/****************** SvMetaExtern ******************************************/ +SV_IMPL_META_FACTORY1( SvMetaExtern, SvMetaReference ); +#ifdef IDL_COMPILER +SvAttributeList & SvMetaExtern::GetAttributeList() +{ + if( !pAttribList ) + { + pAttribList = new SvAttributeList(); + } + return *pAttribList; +} +#endif + +/************************************************************************* +|* SvMetaExtern::SvMetaExtern() +|* +|* Beschreibung +*************************************************************************/ +SvMetaExtern::SvMetaExtern() + : pModule( NULL ) + , bReadUUId( FALSE ) + , bReadVersion( FALSE ) +{ +} + +void SvMetaExtern::Load( SvPersistStream & rStm ) +{ + SvMetaReference::Load( rStm ); + + BYTE nMask; + rStm >> nMask; + if( nMask >= 0x20 ) + { + rStm.SetError( SVSTREAM_FILEFORMAT_ERROR ); + DBG_ERROR( "wrong format" ) + return; + } + if( nMask & 0x01 ) rStm >> pModule; + if( nMask & 0x02 ) rStm >> aUUId; + if( nMask & 0x04 ) rStm >> aVersion; + if( nMask & 0x08 ) bReadUUId = TRUE; + if( nMask & 0x10 ) bReadVersion = TRUE; +} + +void SvMetaExtern::Save( SvPersistStream & rStm ) +{ + SvMetaReference::Save( rStm ); + + // Maske erstellen + BYTE nMask = 0; + if( pModule ) nMask |= 0x01; + if( aUUId != SvGlobalName() ) nMask |= 0x02; + if( aVersion != SvVersion() ) nMask |= 0x04; + if( bReadUUId ) nMask |= 0x08; + if( bReadVersion ) nMask |= 0x10; + + // Daten schreiben + rStm << nMask; + if( nMask & 0x01 ) rStm << pModule; + if( nMask & 0x02 ) rStm << aUUId; + if( nMask & 0x04 ) rStm << aVersion; +} + +/************************************************************************* +|* SvMetaExtern::GetModule() +|* +|* Beschreibung +*************************************************************************/ +SvMetaModule * SvMetaExtern::GetModule() const +{ + DBG_ASSERT( pModule != NULL, "module not set" ) + return pModule; +} + +/************************************************************************* +|* SvMetaExtern::GetUUId() +|* +|* Beschreibung +*************************************************************************/ +const SvGlobalName & SvMetaExtern::GetUUId() const +{ +#ifdef IDL_COMPILER + if( aUUId == SvGlobalName() ) + GetModule()->FillNextName( &((SvMetaExtern *)this)->aUUId ); +#endif + return aUUId; +} + +#ifdef IDL_COMPILER +/************************************************************************* +|* SvMetaExtern::SetModule() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaExtern::SetModule( SvIdlDataBase & rBase ) +{ + pModule = (SvMetaModule *)rBase.GetStack().Get( TYPE( SvMetaModule ) ); +} + +/************************************************************************* +|* SvMetaExtern::ReadAttributesSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaExtern::ReadAttributesSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm ) +{ + SvMetaReference::ReadAttributesSvIdl( rBase, rInStm ); + if( aUUId.ReadSvIdl( rBase, rInStm ) ) + bReadUUId = TRUE; + if( aVersion.ReadSvIdl( rInStm ) ) + bReadVersion = TRUE; +} + +/************************************************************************* +|* SvMetaExtern::WriteAttributesSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaExtern::WriteAttributesSvIdl( SvIdlDataBase & rBase, + SvStream & rOutStm, USHORT nTab ) +{ + SvMetaReference::WriteAttributesSvIdl( rBase, rOutStm, nTab ); + if( bReadUUId || bReadVersion ) + { + WriteTab( rOutStm, nTab ); + rOutStm << "// class SvMetaExtern" << endl; + + if( bReadUUId ) + { + WriteTab( rOutStm, nTab ); + aUUId.WriteSvIdl( rOutStm ); + rOutStm << ';' << endl; + } + if( bReadVersion ) + { + WriteTab( rOutStm, nTab ); + aVersion.WriteSvIdl( rOutStm ); + rOutStm << ';' << endl; + } + } +} + +/************************************************************************* +|* SvMetaExtern::ReadSvIdl() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaExtern::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm ) +{ + SetModule( rBase ); + GetUUId(); // Id wird angelegt + return SvMetaReference::ReadSvIdl( rBase, rInStm ); +} + +/************************************************************************* +|* SvMetaExtern::WriteSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaExtern::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab ) +{ + SvMetaReference::WriteSvIdl( rBase, rOutStm, nTab ); +} + +/************************************************************************* +|* SvMetaExtern::Write() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaExtern::Write( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab, + WriteType nT, WriteAttribute nA ) +{ + SvMetaReference::Write( rBase, rOutStm, nTab, nT, nA ); +} + +/************************************************************************* +|* SvMetaExtern::WriteAttributes() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaExtern::WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab, + WriteType nT, WriteAttribute nA ) +{ + SvMetaReference::WriteAttributes( rBase, rOutStm, nTab, nT, nA ); + + WriteTab( rOutStm, nTab ); + rOutStm << "// class SvMetaExtern" << endl; + WriteTab( rOutStm, nTab ); + rOutStm << "uuid(" << ByteString( GetUUId().GetHexName(), RTL_TEXTENCODING_UTF8 ).GetBuffer() << ")," << endl; + WriteTab( rOutStm, nTab ); + rOutStm << "version(" << ByteString::CreateFromInt32( aVersion.GetMajorVersion() ).GetBuffer() << '.' + << ByteString::CreateFromInt32( aVersion.GetMinorVersion() ).GetBuffer() << ")," << endl; +} + +#endif // IDL_COMPILER + + diff --git a/idl/source/objects/bastype.cxx b/idl/source/objects/bastype.cxx new file mode 100644 index 000000000000..9bdc05520cc3 --- /dev/null +++ b/idl/source/objects/bastype.cxx @@ -0,0 +1,1045 @@ +/************************************************************************* + * + * $RCSfile: bastype.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________ + * + * + ************************************************************************/ + +#include <tools/debug.hxx> + +#include <limits.h> +#include <ctype.h> +#include <bastype.hxx> +#include <lex.hxx> +#include <globals.hxx> +#include <hash.hxx> +#include <database.hxx> +#pragma hdrstop + +/************************************************************************/ +ByteString MakeDefineName( const ByteString & rName ) +{ + ByteString aDefName; + if( rName.Len() ) + { + char * pStr = (char *)rName.GetBuffer(); + aDefName = *pStr; + while( *++pStr ) + { + if( isupper( *pStr ) ) + aDefName += '_'; + aDefName += (char)toupper( *pStr ); + } + } + return aDefName; +} + +#ifdef IDL_COMPILER +/************************************************************************/ +static BOOL ReadRangeSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm, + long nMin, ULONG nMax, long * pValue ) +{ + UINT32 nTokPos = rInStm.Tell(); + SvToken * pTok = rInStm.GetToken_Next(); + + if( pTok->Is( pName ) ) + { + BOOL bOk = TRUE; + BOOL bBraket = rInStm.Read( '(' ); + if( bBraket || rInStm.Read( '=' ) ) + { + short nSign = 1; + pTok = rInStm.GetToken_Next(); + if( pTok->IsChar() && pTok->GetChar() == '-' ) + { + nSign = -1; + pTok = rInStm.GetToken_Next(); + } + else if( pTok->IsChar() && pTok->GetChar() == '+' ) + pTok = rInStm.GetToken_Next(); + + if( pTok->IsInteger() ) + { + ULONG n = pTok->GetNumber(); + if( nSign == -1 || n <= nMax ) + { // nich tueber dem Maximum + if( (nSign == -1 && n < 0x8000000 + && -(long)n >= nMin) + || (nSign == 1 && n >= 0x8000000 || (long)n > nMin) ) + { + *pValue = (long)n; + } + else + bOk = FALSE; + } + if( bOk && bBraket ) + bOk = rInStm.Read( ')' ); + } + else + bOk = pTok->IsChar() && pTok->GetChar() == ')'; + } + if( bOk ) + return TRUE; + } + rInStm.Seek( nTokPos ); + return FALSE; +} +#endif + +/************************************************************************/ +/************************************************************************* +|* +|* RangeUniqueIdContainer::RangeUniqueIdContainer() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +RangeUniqueIdContainer::RangeUniqueIdContainer( const Range & rRange ) + : UniqueIdContainer( rRange.Min() ), + nMax( rRange.Max() ), nMin( rRange.Min() ) +{ +} + +/************************************************************************* +|* +|* RangeUniqueIdContainer::RangeUniqueIdContainer() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +RangeUniqueIdContainer::RangeUniqueIdContainer() + : UniqueIdContainer( 0 ), + nMax( 0 ), nMin( 0 ) +{ +} + +RangeUniqueIdContainer::~RangeUniqueIdContainer() +{ +} + +/************************************************************************* +|* +|* RangeUniqueIdContainer:: opearator =() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +RangeUniqueIdContainer & RangeUniqueIdContainer::operator = + ( const RangeUniqueIdContainer & rObj ) +{ + UniqueIdContainer::operator = ( rObj ); + nMin = rObj.nMin; + nMax = rObj.nMax; + return *this; +} + +/************************************************************************* +|* +|* RangeUniqueIdContainer::CreateId() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +BOOL RangeUniqueIdContainer::CreateId( UniqueItemId * pId ) +{ + { + // wegen Scope von aId + UniqueItemId aId = UniqueIdContainer::CreateId(); + if( aId.GetId() <= nMax ) + { + *pId = aId; + return TRUE; + } + } + Clear( FALSE ); // nicht gebrauchte freigeben + // noch einmal versuchen + { + // wegen Scope von aId + UniqueItemId aId = UniqueIdContainer::CreateId(); + if( aId.GetId() <= nMax ) + { + *pId = aId; + return TRUE; + } + } + return FALSE; +} + +/************************************************************************* +|* +|* RangeUniqueIdContainer::CreateId() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +BOOL RangeUniqueIdContainer::CreateId( UINT32 nIdValue, UniqueItemId * pId ) +{ + if( nIdValue >= nMin && nIdValue <= nMax ) + { + if( IsIndexValid( nIdValue ) ) + return FALSE; + *pId = CreateIdProt( nIdValue ); + return TRUE; + } + *pId = UniqueIdContainer::CreateFreeId( nIdValue ); + return TRUE; +} + +/************************************************************************* +|* +|* SvUINT32::Read() +|* SvUINT32::Write() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +UINT32 SvUINT32::Read( SvStream & rStm ) +{ + return SvPersistStream::ReadCompressed( rStm ); +} + +void SvUINT32::Write( SvStream & rStm, UINT32 nVal ) +{ + SvPersistStream::WriteCompressed( rStm, nVal ); +} + +/************************************************************************* +|* +|* SvStream& operator << ( SvBOOL ) +|* SvStream& operator >> ( SvBOOL ) +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +SvStream& operator << (SvStream & rStm, const SvBOOL & rb ) +{ + BYTE n = rb.nVal; + if( rb.bSet ) + n |= 0x02; + rStm << n; + return rStm; +} +SvStream& operator >> (SvStream & rStm, SvBOOL & rb ) +{ + BYTE n; + rStm >> n; + rb.nVal = (n & 0x01) ? TRUE : FALSE; + rb.bSet = (n & 0x02) ? TRUE : FALSE; + if( n & ~0x03 ) + { + rStm.SetError( SVSTREAM_FILEFORMAT_ERROR ); + DBG_ERROR( "format error" ) + } + return rStm; +} + +/************************************************************************* +|* +|* SvStream& operator << ( SvVersion ) +|* SvStream& operator >> ( SvVersion ) +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +SvStream& operator << (SvStream & rStm, const SvVersion & r ) +{ + if( (r.GetMajorVersion() || r.GetMinorVersion()) + && r.GetMajorVersion() <= 0x0F && r.GetMinorVersion() <= 0x0F ) + { // Versionsnummer in 1 Byte komprimieren + // Format 4 Bit fuer Major, dann 4 Bit fuer Minor. + // 0.0 wird nicht komprimiert + + BYTE n = r.GetMajorVersion() << 4; + n |= r.GetMinorVersion(); + rStm << n; + } + else + { + rStm << (BYTE)0; + rStm << r.GetMajorVersion(); + rStm << r.GetMinorVersion(); + } + return rStm; +} + +SvStream& operator >> (SvStream & rStm, SvVersion & r ) +{ + BYTE n; + rStm >> n; + if( n == 0 ) + { // nicht komprimiert + rStm >> r.nMajorVersion; + rStm >> r.nMinorVersion; + } + else + { // komprimiert + r.nMajorVersion = (n >> 4) & 0x0F; + r.nMinorVersion = n & 0x0F; + } + return rStm; +} + + +#ifdef IDL_COMPILER +/************************************************************************/ +/************************************************************************* +|* +|* SvINT16::ReadSvIdl() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +BOOL SvINT16::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ) +{ + long n; + + if( ReadRangeSvIdl( pName, rInStm, -(long)0x8000, 0x7FFF, &n ) ) + { + nVal = (short)n; + return TRUE; + } + return FALSE; +} + +/************************************************************************* +|* +|* SvINT16::WriteSvIdl() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +BOOL SvINT16::WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm ) +{ + rOutStm << pName->GetName().GetBuffer() << "(\"" + << ByteString::CreateFromInt32( nVal ).GetBuffer() << "\")"; + return TRUE; +} + + +/************************************************************************* +|* +|* SvUINT16::ReadSvIdl() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +BOOL SvUINT16::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ) +{ + long n; + + if( ReadRangeSvIdl( pName, rInStm, 0, 0xFFFF, &n ) ) + { + nVal = (UINT16)n; + return TRUE; + } + return FALSE; +} + +/************************************************************************* +|* +|* SvUINT16::WriteSvIdl() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +BOOL SvUINT16::WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm ) +{ + rOutStm << pName->GetName().GetBuffer() << "(\"" + << ByteString::CreateFromInt32( nVal ).GetBuffer() << "\")"; + return TRUE; +} + + +/************************************************************************* +|* +|* SvINT32::ReadSvIdl() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +BOOL SvINT32::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ) +{ + long n; + + if( ReadRangeSvIdl( pName, rInStm, (-2147483647L-1L), 0x7FFFFFFF, &n ) ) + { + nVal = (INT32)n; + return TRUE; + } + return FALSE; +} + +/************************************************************************* +|* +|* SvINT32::WriteSvIdl() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +BOOL SvINT32::WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm ) +{ + rOutStm << pName->GetName().GetBuffer() << "(\"" + << ByteString::CreateFromInt32( nVal ).GetBuffer() << "\")"; + return TRUE; +} + + +/************************************************************************* +|* +|* SvUINT32::ReadSvIdl() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +BOOL SvUINT32::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ) +{ + long n; + + if( ReadRangeSvIdl( pName, rInStm, 0, 0xFFFFFFFF, &n ) ) + { + nVal = (UINT32)n; + return TRUE; + } + return FALSE; +} + +/************************************************************************* +|* +|* SvUINT32::WriteSvIdl() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +BOOL SvUINT32::WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm ) +{ + rOutStm << pName->GetName().GetBuffer() << "(\"" + << ByteString::CreateFromInt32( nVal ).GetBuffer() << "\")"; + return TRUE; +} + + +/************************************************************************/ +/************************************************************************* +|* +|* Svint::ReadSvIdl() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +BOOL Svint::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ) +{ + long n; + + if( ReadRangeSvIdl( pName, rInStm, INT_MIN, INT_MAX, &n ) ) + { + nVal = (int)n; + return TRUE; + } + return FALSE; +} + +/************************************************************************* +|* +|* Svint::WriteSvIdl() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +BOOL Svint::WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm ) +{ + rOutStm << pName->GetName().GetBuffer() << "(\"" + << ByteString::CreateFromInt32( nVal ).GetBuffer() << "\")"; + return TRUE; +} + + +/************************************************************************* +|* +|* SvBOOL::ReadSvIdl() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +BOOL SvBOOL::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ) +{ + UINT32 nTokPos = rInStm.Tell(); + SvToken * pTok = rInStm.GetToken_Next(); + + if( pTok->Is( pName ) ) + { + BOOL bOk = TRUE; + BOOL bBraket = rInStm.Read( '(' ); + if( bBraket || rInStm.Read( '=' ) ) + { + pTok = rInStm.GetToken(); + if( pTok->IsBool() ) + { + *this = pTok->GetBool(); + + rInStm.GetToken_Next(); + } + if( bOk && bBraket ) + bOk = rInStm.Read( ')' ); + } + else + *this = TRUE; //Defaultaktion ist auf TRUE setzen + if( bOk ) + return TRUE; + } + rInStm.Seek( nTokPos ); + return FALSE; +} + +/************************************************************************* +|* +|* SvBOOL::WriteSvIdl() +|* +|* Beschreibung +|* +*************************************************************************/ +BOOL SvBOOL::WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm ) +{ + if( nVal ) + rOutStm << pName->GetName().GetBuffer(); + else + rOutStm << pName->GetName().GetBuffer() << "(FALSE)"; + return TRUE; +} + +/************************************************************************* +|* +|* SvBOOL::WriteSvIdl() +|* +|* Beschreibung +|* +*************************************************************************/ +ByteString SvBOOL::GetSvIdlString( SvStringHashEntry * pName ) +{ + if( nVal ) + return pName->GetName(); + else + { + ByteString aTmp( pName->GetName() ); + aTmp += "(FALSE)"; + return aTmp; + } +} + + +/************************************************************************/ +/************************************************************************* +|* +|* SvIdentifier::ReadSvIdl() +|* +|* Beschreibung +|* +*************************************************************************/ +BOOL SvIdentifier::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ) +{ + UINT32 nTokPos = rInStm.Tell(); + SvToken * pTok = rInStm.GetToken_Next(); + + if( pTok->Is( pName ) ) + { + BOOL bOk = TRUE; + BOOL bBraket = rInStm.Read( '(' ); + if( bBraket || rInStm.Read( '=' ) ) + { + pTok = rInStm.GetToken(); + if( pTok->IsIdentifier() ) + { + *(ByteString *)this = pTok->GetString(); + rInStm.GetToken_Next(); + } + if( bOk && bBraket ) + bOk = rInStm.Read( ')' ); + } + if( bOk ) + return TRUE; + } + rInStm.Seek( nTokPos ); + return FALSE; +} + +/************************************************************************* +|* +|* SvIdentifier::WriteSvIdl() +|* +|* Beschreibung +|* +*************************************************************************/ +BOOL SvIdentifier::WriteSvIdl( SvStringHashEntry * pName, + SvStream & rOutStm, + USHORT /*nTab */ ) +{ + rOutStm << pName->GetName().GetBuffer() << '('; + rOutStm << GetBuffer() << ')'; + return TRUE; +} + +SvStream& operator << (SvStream & rStm, const SvIdentifier & r ) +{ + rStm.WriteByteString( r ); + return rStm; +} + +SvStream& operator >> (SvStream & rStm, SvIdentifier & r ) +{ + rStm.ReadByteString( r ); + return rStm; +} + + +/************************************************************************/ +/************************************************************************* +|* +|* SvNumberIdentifier::ReadSvIdl() +|* +|* Beschreibung +|* +*************************************************************************/ +BOOL SvNumberIdentifier::ReadSvIdl( SvIdlDataBase & rBase, + SvStringHashEntry * pName, + SvTokenStream & rInStm ) +{ + if( SvIdentifier::ReadSvIdl( pName, rInStm ) ) + { + ULONG n; + if( rBase.FindId( *this, &n ) ) + { + nValue = n; + return TRUE; + } + else + { + ByteString aStr ("no value for identifier <"); + aStr += *this; + aStr += "> "; + rBase.SetError( aStr, rInStm.GetToken() ); + rBase.WriteError( rInStm ); + } + } + return FALSE; +} + +/************************************************************************* +|* +|* SvNumberIdentifier::ReadSvIdl() +|* +|* Beschreibung +|* +*************************************************************************/ +BOOL SvNumberIdentifier::ReadSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm ) +{ + UINT32 nTokPos = rInStm.Tell(); + SvToken * pTok = rInStm.GetToken_Next(); + + if( pTok->IsIdentifier() ) + { + ULONG n; + if( rBase.FindId( pTok->GetString(), &n ) ) + { + *(ByteString *)this = pTok->GetString(); + nValue = n; + return TRUE; + } + else + { + ByteString aStr ("no value for identifier <"); + aStr += *this; + aStr += "> "; + rBase.SetError( aStr, rInStm.GetToken() ); + rBase.WriteError( rInStm ); + } + } + rInStm.Seek( nTokPos ); + return FALSE; +} + +/************************************************************************* +|* +|* SvStream& operator << ( SvNumberIdentifier ) +|* SvStream& operator >> ( SvNumberIdentifier ) +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +SvStream& operator << (SvStream & rStm, const SvNumberIdentifier & r ) +{ + rStm << (SvIdentifier &)r; + SvPersistStream::WriteCompressed( rStm, r.nValue ); + return rStm; +} + +SvStream& operator >> (SvStream & rStm, SvNumberIdentifier & r ) +{ + rStm >> (SvIdentifier &)r; + r.nValue = SvPersistStream::ReadCompressed( rStm ); + return rStm; +} + + +/************************************************************************/ +/************************************************************************* +|* +|* SvString::ReadSvIdl() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +BOOL SvString::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ) +{ + UINT32 nTokPos = rInStm.Tell(); + SvToken * pTok = rInStm.GetToken_Next(); + + if( pTok->Is( pName ) ) + { + BOOL bOk = TRUE; + BOOL bBraket = rInStm.Read( '(' ); + if( bBraket || rInStm.Read( '=' ) ) + { + pTok = rInStm.GetToken(); + if( pTok->IsString() ) + { + *(ByteString *)this = pTok->GetString(); + rInStm.GetToken_Next(); + } + if( bOk && bBraket ) + bOk = rInStm.Read( ')' ); + } + if( bOk ) + return TRUE; + } + rInStm.Seek( nTokPos ); + return FALSE; +} + +/************************************************************************* +|* +|* SvString::WriteSvIdl() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +BOOL SvString::WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm, + USHORT /*nTab */ ) +{ + rOutStm << pName->GetName().GetBuffer() << "(\""; + rOutStm << GetBuffer() << "\")"; + return TRUE; +} + +SvStream& operator << (SvStream & rStm, const SvString & r ) +{ + rStm.WriteByteString( r ); + return rStm; +} + +SvStream& operator >> (SvStream & rStm, SvString & r ) +{ + rStm.ReadByteString( r ); + return rStm; +} + + +/************************************************************************* +|* +|* SvHelpText::ReadSvIdl() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +BOOL SvHelpText::ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) +{ + return SvString::ReadSvIdl( SvHash_HelpText(), rInStm ); +} + +/************************************************************************* +|* +|* SvHelpText::WriteSvIdl() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +BOOL SvHelpText::WriteSvIdl( SvIdlDataBase &, SvStream & rOutStm, USHORT nTab ) +{ + return SvString::WriteSvIdl( SvHash_HelpText(), rOutStm, nTab ); +} + +#ifdef sdvnmsd +/************************************************************************* +|* +|* SvHelpContext::ReadSvIdl() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +BOOL SvHelpContext::ReadSvIdl( RangeUniqueIdContainer & rCont, + SvTokenStream & rInStm ) +{ + UINT32 nTokPos = rInStm.Tell(); + long n = 0; + + if( ReadRangeSvIdl( SvHash_HelpContext(), rInStm, 0, 0xFFFFFFFF, &n ) ) + { + if( n == 0 ) + { + //if( rCont.CreateId( &aId ) ) + // erst beim Schreiben anlegen + bSet = TRUE; + return TRUE; + } + else + { + if( (UINT32)n <= rCont.GetMax() && (UINT32)n >= rCont.GetMin() ) + { + aId = UniqueIdContainer::CreateFreeId( (UINT32)n ); + bSet = TRUE; + return TRUE; + } + else if( rCont.CreateId( (UINT32)n, &aId ) ) + { + bSet = TRUE; + return TRUE; + } + } + } + + rInStm.Seek( nTokPos ); + return FALSE; +} + +/************************************************************************* +|* +|* SvHelpContext::WriteSvIdl() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +BOOL SvHelpContext::WriteSvIdl( RangeUniqueIdContainer & rCont, + SvStream & rOutStm, USHORT ) +{ + if( IsSet() && GetId() == 0 ) + if( !rCont.CreateId( &aId ) ) + return FALSE; + rOutStm << (const char *)SvHash_HelpContext()->GetName() << '(' + << (const char *)ByteString( GetId() ) << ')'; + return TRUE; +} +#endif + +/************************************************************************/ +/************************************************************************* +|* +|* SvUUId::ReadSvIdl() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +BOOL SvUUId::ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) +{ + UINT32 nTokPos = rInStm.Tell(); + SvToken * pTok = rInStm.GetToken_Next(); + + if( pTok->Is( SvHash_uuid() ) ) + { + BOOL bOk = TRUE; + BOOL bBraket = rInStm.Read( '(' ); + if( bBraket || rInStm.Read( '=' ) ) + { + pTok = rInStm.GetToken(); + if( pTok->IsString() ) + { + pTok = rInStm.GetToken_Next(); + bOk = MakeId( String::CreateFromAscii( pTok->GetString().GetBuffer() ) ); + } + if( bOk && bBraket ) + bOk = rInStm.Read( ')' ); + } + if( bOk ) + return TRUE; + } + rInStm.Seek( nTokPos ); + return FALSE; +} + +/************************************************************************* +|* +|* SvMetaObject::WriteSvIdl() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +BOOL SvUUId::WriteSvIdl( SvStream & rOutStm ) +{ + // Global Id schreiben + rOutStm << SvHash_uuid()->GetName().GetBuffer() << "(\""; + rOutStm << ByteString( GetHexName(), RTL_TEXTENCODING_UTF8 ).GetBuffer() << "\")"; + return TRUE; +} + + +/************************************************************************/ +/************************************************************************* +|* +|* SvVersion::ReadSvIdl() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +BOOL SvVersion::ReadSvIdl( SvTokenStream & rInStm ) +{ + long n; + + UINT32 nTokPos = rInStm.Tell(); + if( ReadRangeSvIdl( SvHash_Version(), rInStm, 0 , 0xFFFF, &n ) ) + { + nMajorVersion = (USHORT)n; + if( rInStm.Read( '.' ) ) + { + SvToken * pTok = rInStm.GetToken_Next(); + if( pTok->IsInteger() && pTok->GetNumber() <= 0xFFFF ) + { + nMinorVersion = (USHORT)pTok->GetNumber(); + return TRUE; + } + } + else + return TRUE; + } + rInStm.Seek( nTokPos ); + return FALSE; +} + +/************************************************************************* +|* +|* SvVersion::WriteSvIdl() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +BOOL SvVersion::WriteSvIdl( SvStream & rOutStm ) +{ + rOutStm << SvHash_Version()->GetName().GetBuffer() << '(' + << ByteString::CreateFromInt32( nMajorVersion ).GetBuffer() << '.' + << ByteString::CreateFromInt32( nMinorVersion ).GetBuffer() << ')'; + return TRUE; +} +#endif //IDL_COMPILER + + diff --git a/idl/source/objects/makefile.mk b/idl/source/objects/makefile.mk new file mode 100644 index 000000000000..8c57d435177b --- /dev/null +++ b/idl/source/objects/makefile.mk @@ -0,0 +1,103 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:30: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=..$/.. + +PROJECTPCH4DLL=TRUE +PROJECTPCH=idlpch +PROJECTPCHSOURCE=$(PRJ)$/util$/idlpch + +PRJNAME=SVIDL +TARGET=objects + +# --- Settings ----------------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +.IF "$(COM)"=="WTC" +CFLAGS+=-od +.ENDIF + +CDEFS+=-DIDL_COMPILER +# --- Files -------------------------------------------------------------- + +CXXFILES= bastype.cxx \ + basobj.cxx \ + types.cxx \ + object.cxx \ + slot.cxx \ + module.cxx \ + $(PROJECTPCHSOURCE).cxx + +OBJFILES= $(OBJ)$/bastype.obj \ + $(OBJ)$/basobj.obj \ + $(OBJ)$/types.obj \ + $(OBJ)$/object.obj \ + $(OBJ)$/slot.obj \ + $(OBJ)$/module.obj + +# --- Targets ------------------------------------------------------------ + +.INCLUDE : target.mk + diff --git a/idl/source/objects/module.cxx b/idl/source/objects/module.cxx new file mode 100644 index 000000000000..d795f5cacb72 --- /dev/null +++ b/idl/source/objects/module.cxx @@ -0,0 +1,732 @@ +/************************************************************************* + * + * $RCSfile: module.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________ + * + * + ************************************************************************/ + +#include <ctype.h> +#include <stdio.h> + +#include <attrib.hxx> +#include <module.hxx> +#include <globals.hxx> +#include <database.hxx> + +#ifndef _FSYS_HXX //autogen +#include <tools/fsys.hxx> +#endif +#include <tools/debug.hxx> + +#pragma hdrstop + + +/****************** SvMetaModule ******************************************/ +SV_IMPL_META_FACTORY1( SvMetaModule, SvMetaExtern ); +#ifdef IDL_COMPILER +SvAttributeList & SvMetaModule::GetAttributeList() +{ + if( !pAttribList ) + { + pAttribList = new SvAttributeList(); + } + return *pAttribList; +} +#endif + +/************************************************************************* +|* +|* SvMetaModule::SvMetaModule() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +SvMetaModule::SvMetaModule() +#ifdef IDL_COMPILER + : bImported( FALSE ) + , bIsModified( FALSE ) +#endif +{ +} + +#ifdef IDL_COMPILER +SvMetaModule::SvMetaModule( const String & rIdlFileName, BOOL bImp ) + : aIdlFileName( rIdlFileName ) + , bImported( bImp ), bIsModified( FALSE ) +{ +} +#endif + +/************************************************************************* +|* +|* SvMetaModule::Load() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +#define MODULE_VER 0x0001 +void SvMetaModule::Load( SvPersistStream & rStm ) +{ + bImported = TRUE; // immer importiert + SvMetaExtern::Load( rStm ); + + USHORT nVer; + + rStm >> nVer; // Version + DBG_ASSERT( (nVer & ~IDL_WRITE_MASK) == MODULE_VER, "false version" ) + + rStm >> aClassList; + rStm >> aTypeList; + rStm >> aAttrList; + // Browser + rStm.ReadByteString( aIdlFileName ); + rStm.ReadByteString( aHelpFileName ); + rStm.ReadByteString( aSlotIdFile ); + rStm.ReadByteString( aModulePrefix ); + + // Compiler Daten lesen + USHORT nCmpLen; + rStm >> nCmpLen; +#ifdef IDL_COMPILER + DBG_ASSERT( (nVer & IDL_WRITE_MASK) == IDL_WRITE_COMPILER, + "no idl compiler format" ) + rStm >> aBeginName; + rStm >> aEndName; + rStm >> aNextName; +#else + rStm->SeekRel( nCmpLen ); +#endif +} + +/************************************************************************* +|* +|* SvMetaModule::Save() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +void SvMetaModule::Save( SvPersistStream & rStm ) +{ + SvMetaExtern::Save( rStm ); + + rStm << (USHORT)(MODULE_VER | IDL_WRITE_COMPILER); // Version + + rStm << aClassList; + rStm << aTypeList; + rStm << aAttrList; + // Browser + rStm.WriteByteString( aIdlFileName ); + rStm.WriteByteString( aHelpFileName ); + rStm.WriteByteString( aSlotIdFile ); + rStm.WriteByteString( aModulePrefix ); + + // Compiler Daten schreiben + USHORT nCmpLen = 0; + ULONG nLenPos = rStm.Tell(); + rStm << nCmpLen; +#ifdef IDL_COMPILER + rStm << aBeginName; + rStm << aEndName; + rStm << aNextName; + // Laenge der Compiler Daten schreiben + ULONG nPos = rStm.Tell(); + rStm.Seek( nLenPos ); + rStm << (USHORT)( nPos - nLenPos - sizeof( USHORT ) ); + rStm.Seek( nPos ); +#endif +} + +/************************************************************************* +|* +|* SvMetaModule::SetName() +|* +|* Beschreibung +|* Ersterstellung MM 12.12.94 +|* Letzte Aenderung MM 12.12.94 +|* +*************************************************************************/ +BOOL SvMetaModule::SetName( const ByteString & rName, SvIdlDataBase * pBase ) +{ + if( pBase ) + { + if( pBase->GetModule( rName ) ) + return FALSE; + } + return SvMetaExtern::SetName( rName ); +} + +#ifdef IDL_COMPILER +/************************************************************************* +|* SvMetaModule::GetNextName() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaModule::FillNextName( SvGlobalName * pName ) +{ + *pName = aNextName; + + if( aNextName < aEndName ) + { + ++aNextName; + bIsModified = TRUE; + return TRUE; + } + return FALSE; +} + +/************************************************************************* +|* SvMetaModule::ReadSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaModule::ReadAttributesSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm ) +{ + SvMetaExtern::ReadAttributesSvIdl( rBase, rInStm ); + + aHelpFileName.ReadSvIdl( SvHash_HelpFile(), rInStm ); + if( aSlotIdFile.ReadSvIdl( SvHash_SlotIdFile(), rInStm ) ) + { + UINT32 nTokPos = rInStm.Tell(); + if( !rBase.ReadIdFile( String::CreateFromAscii( aSlotIdFile.GetBuffer() ) ) ) + { + ByteString aStr = "cannot read file: "; + aStr += aSlotIdFile; + rBase.SetError( aStr, rInStm.GetToken() ); + rBase.WriteError( rInStm ); + + rInStm.Seek( nTokPos ); + } + } + aTypeLibFile.ReadSvIdl( SvHash_TypeLibFile(), rInStm ); + aModulePrefix.ReadSvIdl( SvHash_ModulePrefix(), rInStm ); +} + +/************************************************************************* +|* SvMetaModule::WriteAttributesSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaModule::WriteAttributesSvIdl( SvIdlDataBase & rBase, + SvStream & rOutStm, + USHORT nTab ) +{ + SvMetaExtern::WriteAttributesSvIdl( rBase, rOutStm, nTab ); + if( aTypeLibFile.Len() || aSlotIdFile.Len() || aTypeLibFile.Len() ) + { + if( aHelpFileName.Len() ) + { + WriteTab( rOutStm, nTab ); + aHelpFileName.WriteSvIdl( SvHash_HelpFile(), rOutStm, nTab +1 ); + rOutStm << ';' << endl; + } + if( aSlotIdFile.Len() ) + { + WriteTab( rOutStm, nTab ); + aSlotIdFile.WriteSvIdl( SvHash_SlotIdFile(), rOutStm, nTab +1 ); + rOutStm << ';' << endl; + } + if( aTypeLibFile.Len() ) + { + WriteTab( rOutStm, nTab ); + aTypeLibFile.WriteSvIdl( SvHash_TypeLibFile(), rOutStm, nTab +1 ); + rOutStm << ';' << endl; + } + } +} + +/************************************************************************* +|* SvMetaModule::ReadContextSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaModule::ReadContextSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm ) +{ + UINT32 nTokPos = rInStm.Tell(); + if( rInStm.GetToken()->Is( SvHash_interface() ) + || rInStm.GetToken()->Is( SvHash_shell() ) ) + { + SvMetaClassRef aClass = new SvMetaClass(); + if( aClass->ReadSvIdl( rBase, rInStm ) ) + { + aClassList.Append( aClass ); + // Global bekanntgeben + rBase.GetClassList().Append( aClass ); + } + } + else if( rInStm.GetToken()->Is( SvHash_enum() ) ) + { + SvMetaTypeEnumRef aEnum = new SvMetaTypeEnum(); + + if( aEnum->ReadSvIdl( rBase, rInStm ) ) + { + // Im Modul deklariert + aTypeList.Append( aEnum ); + // Global bekanntgeben + rBase.GetTypeList().Append( aEnum ); + } + } + else if( rInStm.GetToken()->Is( SvHash_item() ) + || rInStm.GetToken()->Is( SvHash_struct() ) + || rInStm.GetToken()->Is( SvHash_typedef() ) ) + { + SvMetaTypeRef xItem = new SvMetaType(); + + if( xItem->ReadSvIdl( rBase, rInStm ) ) + { + // Im Modul deklariert + aTypeList.Append( xItem ); + // Global bekanntgeben + rBase.GetTypeList().Append( xItem ); + } + } + else if( rInStm.GetToken()->Is( SvHash_include() ) ) + { + BOOL bOk = FALSE; + rInStm.GetToken_Next(); + SvToken * pTok = rInStm.GetToken_Next(); + if( pTok->IsString() ) + { + DirEntry aFullName( String::CreateFromAscii( pTok->GetString().GetBuffer() ) ); + rBase.StartNewFile( aFullName.GetFull() ); + if( aFullName.Find( rBase.GetPath() ) ) + { + SvTokenStream aTokStm( aFullName.GetFull() ); + if( SVSTREAM_OK == aTokStm.GetStream().GetError() ) + { + // Fehler aus alter Datei retten + SvIdlError aOldErr = rBase.GetError(); + // Fehler zuruecksetzen + rBase.SetError( SvIdlError() ); + + UINT32 nBeginPos = 0xFFFFFFFF; // kann mit Tell nicht vorkommen + while( nBeginPos != aTokStm.Tell() ) + { + nBeginPos = aTokStm.Tell(); + ReadContextSvIdl( rBase, aTokStm ); + aTokStm.ReadDelemiter(); + } + bOk = aTokStm.GetToken()->IsEof(); + if( !bOk ) + { + rBase.WriteError( aTokStm ); + } + // Fehler aus alter Datei wieder herstellen + rBase.SetError( aOldErr ); + } + else + { + ByteString aStr = "cannot open file: "; + aStr += ByteString( aFullName.GetFull(), RTL_TEXTENCODING_UTF8 ); + rBase.SetError( aStr, pTok ); + } + } + else + { + ByteString aStr = "cannot find file: "; + aStr += ByteString( aFullName.GetFull(), RTL_TEXTENCODING_UTF8 ); + rBase.SetError( aStr, pTok ); + } + } + if( !bOk ) + rInStm.Seek( nTokPos ); + } + else + { + SvMetaSlotRef xSlot = new SvMetaSlot(); + + if( xSlot->ReadSvIdl( rBase, rInStm ) ) + { + if( xSlot->Test( rBase, rInStm ) ) + { + // Im Modul deklariert + aAttrList.Append( xSlot ); + // Global bekanntgeben + rBase.AppendAttr( xSlot ); + } + } + } +} + +/************************************************************************* +|* SvMetaModule::WriteContextSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaModule::WriteContextSvIdl( SvIdlDataBase & rBase, + SvStream & rOutStm, + USHORT nTab ) +{ + SvMetaExtern::WriteContextSvIdl( rBase, rOutStm, nTab ); + ULONG n; + for( n = 0; n < aTypeList.Count(); n++ ) + { + WriteTab( rOutStm, nTab ); + aTypeList.GetObject( n )->WriteSvIdl( rBase, rOutStm, nTab ); + } + rOutStm << endl; + for( n = 0; n < aAttrList.Count(); n++ ) + { + WriteTab( rOutStm, nTab ); + aAttrList.GetObject( n )->WriteSvIdl( rBase, rOutStm, nTab ); + } + rOutStm << endl; + for( n = 0; n < aClassList.Count(); n++ ) + { + WriteTab( rOutStm, nTab ); + aClassList.GetObject( n )->WriteSvIdl( rBase, rOutStm, nTab ); + } +} + +/************************************************************************* +|* +|* SvMetaModule::ReadSvIdl() +|* +|* Beschreibung +|* +*************************************************************************/ +BOOL SvMetaModule::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm ) +{ + bIsModified = TRUE; // bisher immer wenn Compiler laueft + + UINT32 nTokPos = rInStm.Tell(); + SvToken * pTok = rInStm.GetToken_Next(); + BOOL bOk = FALSE; + bOk = pTok->Is( SvHash_module() ); + if( bOk ) + { + pTok = rInStm.GetToken_Next(); + if( pTok->IsString() ) + bOk = aBeginName.MakeId( String::CreateFromAscii( pTok->GetString().GetBuffer() ) ); + } + rInStm.ReadDelemiter(); + if( bOk ) + { + pTok = rInStm.GetToken_Next(); + if( pTok->IsString() ) + bOk = aEndName.MakeId( String::CreateFromAscii( pTok->GetString().GetBuffer() ) ); + } + rInStm.ReadDelemiter(); + if( bOk ) + { + aNextName = aBeginName; + + rBase.Push( this ); // auf den Context Stack + + if( ReadNameSvIdl( rBase, rInStm ) ) + { + // Zeiger auf sich selbst setzen + SetModule( rBase ); + bOk = SvMetaName::ReadSvIdl( rBase, rInStm ); + } + rBase.GetStack().Pop(); // und runter + } + if( !bOk ) + rInStm.Seek( nTokPos ); + return bOk; +} + +/************************************************************************* +|* +|* SvMetaModule::WriteSvIdl() +|* +|* Beschreibung +|* +*************************************************************************/ +void SvMetaModule::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab ) +{ + rOutStm << SvHash_module()->GetName().GetBuffer() << endl + << '\"'; + rOutStm.WriteByteString( aBeginName.GetHexName() ); + rOutStm << '\"' << endl << '\"'; + rOutStm.WriteByteString( aEndName.GetHexName() ); + rOutStm << '\"' << endl; + SvMetaExtern::WriteSvIdl( rBase, rOutStm, nTab ); +} + +/************************************************************************* +|* SvMetaModule::WriteSfx() +*************************************************************************/ +void SvMetaModule::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ) +{ + for( ULONG n = 0; n < aClassList.Count(); n++ ) + { + SvMetaClass * pClass = aClassList.GetObject( n ); + pClass->WriteSfx( rBase, rOutStm ); + } +} + +void SvMetaModule::WriteHelpIds( SvIdlDataBase & rBase, SvStream & rOutStm, + Table* pTable ) +{ + for( ULONG n = 0; n < aClassList.Count(); n++ ) + { + SvMetaClass * pClass = aClassList.GetObject( n ); + pClass->WriteHelpIds( rBase, rOutStm, pTable ); + } +} + +/************************************************************************* +|* SvMetaModule::WriteAttributes() +*************************************************************************/ +void SvMetaModule::WriteAttributes( SvIdlDataBase & rBase, + SvStream & rOutStm, + USHORT nTab, + WriteType nT, WriteAttribute nA ) +{ + SvMetaExtern::WriteAttributes( rBase, rOutStm, nTab, nT, nA ); + if( aHelpFileName.Len() ) + { + WriteTab( rOutStm, nTab ); + rOutStm << "// class SvMetaModule" << endl; + WriteTab( rOutStm, nTab ); + rOutStm << "helpfile(\"" << aHelpFileName.GetBuffer() << "\");" << endl; + } +} + +/************************************************************************* +|* SvMetaModule::WriteSbx() +*************************************************************************/ +/* +void SvMetaModule::WriteSbx( SvIdlDataBase & rBase, SvStream & rOutStm, + SvNamePosList & rList ) +{ + for( ULONG n = 0; n < aClassList.Count(); n++ ) + { + SvMetaClass * pClass = aClassList.GetObject( n ); + if( !pClass->IsShell() && pClass->GetAutomation() ) + { + rList.Insert( new SvNamePos( pClass->GetUUId(), rOutStm.Tell() ), + LIST_APPEND ); + SbxObjectRef xSbxObj = new SbxObject( pClass->GetName() ); + pClass->FillSbxObject( rBase, xSbxObj ); + xSbxObj->Store( rOutStm ); + } + } +} + */ + +/************************************************************************* +|* SvMetaModule::Write() +*************************************************************************/ +void SvMetaModule::Write( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab, + WriteType nT, WriteAttribute nA ) +{ + switch ( nT ) + { + case WRITE_ODL: + { + if( aSlotIdFile.Len() ) + { + WriteTab( rOutStm, nTab ); + rOutStm << "#include \"" << aSlotIdFile.GetBuffer() << '"' << endl << endl; + } + SvMetaExtern::Write( rBase, rOutStm, nTab, nT, nA ); + rOutStm << endl; + WriteTab( rOutStm, nTab ); + rOutStm << "library " << GetName().GetBuffer() << endl; + WriteTab( rOutStm, nTab ); + rOutStm << '{' << endl; + WriteTab( rOutStm, nTab ); + rOutStm << "importlib(\"STDOLE.TLB\");" << endl; + + /* + for( ULONG n = 0; n < aTypeList.Count(); n++ ) + { + SvMetaType * pType = aTypeList.GetObject( n ); + if( !pType ->Write( rBase, rOutStm, nTab +1, nT, nA ) ) + return FALSE; + } + */ + /* + for( ULONG n = 0; n < rBase.GetModuleList().Count(); n++ ) + { + SvMetaModule * pModule = rBase.GetModuleList().GetObject( n ); + const SvMetaTypeMemberList &rTypeList = pModule->GetTypeList(); + for( ULONG n = 0; n < rTypeList.Count(); n++ ) + { + SvMetaType * pType = rTypeList.GetObject( n ); + pType->Write( rBase, rOutStm, nTab +1, nT, nA ); + } + } + */ + + for( ULONG n = 0; n < aClassList.Count(); n++ ) + { + SvMetaClass * pClass = aClassList.GetObject( n ); + if( !pClass->IsShell() && pClass->GetAutomation() ) + { + WriteTab( rOutStm, nTab ); + WriteStars( rOutStm ); + pClass->Write( rBase, rOutStm, nTab +1, nT, nA ); + if( n +1 < aClassList.Count() ) + rOutStm << endl; + } + } + + rOutStm << '}' << endl; + } + break; + case WRITE_DOCU: + { + rOutStm << "SvIDL interface documentation" << endl << endl; + rOutStm << "<MODULE>" << endl << GetName().GetBuffer() << endl; + WriteDescription( rBase, rOutStm ); + rOutStm << "</MODULE>" << endl << endl; + + rOutStm << "<CLASSES>" << endl; + for( ULONG n = 0; n < aClassList.Count(); n++ ) + { + SvMetaClass * pClass = aClassList.GetObject( n ); + if( !pClass->IsShell() ) + { + rOutStm << pClass->GetName().GetBuffer(); + SvMetaClass* pSC = pClass->GetSuperClass(); + if( pSC ) + rOutStm << " : " << pSC->GetName().GetBuffer(); + + // Importierte Klassen + const SvClassElementMemberList& rClassList = pClass->GetClassList(); + if ( rClassList.Count() ) + { + rOutStm << " ( "; + + for( ULONG m=0; m<rClassList.Count(); m++ ) + { + SvClassElement *pEle = rClassList.GetObject(m); + SvMetaClass *pCl = pEle->GetClass(); + rOutStm << pCl->GetName().GetBuffer(); + if ( m+1 == rClassList.Count() ) + rOutStm << " )"; + else + rOutStm << " , "; + } + } + + rOutStm << endl; + } + } + rOutStm << "</CLASSES>" << endl << endl; + // kein Break! + } + + case WRITE_C_SOURCE: + case WRITE_C_HEADER: + { + for( ULONG n = 0; n < aClassList.Count(); n++ ) + { + SvMetaClass * pClass = aClassList.GetObject( n ); + if( !pClass->IsShell() /* && pClass->GetAutomation() */ ) + pClass->Write( rBase, rOutStm, nTab, nT, nA ); + } + } + break; + } +} + +/************************************************************************* +|* SvMetaModule::WriteSrc() +*************************************************************************/ +void SvMetaModule::WriteSrc( SvIdlDataBase & rBase, SvStream & rOutStm, + Table * pTable ) +{ +// rOutStm << "#pragma CHARSET IBMPC" << endl; + if( aSlotIdFile.Len() ) + rOutStm << "//#include <" << aSlotIdFile.GetBuffer() << '>' << endl; + for( ULONG n = 0; n < aClassList.Count(); n++ ) + { + aClassList.GetObject( n )->WriteSrc( rBase, rOutStm, pTable ); + } +} + +/************************************************************************* +|* SvMetaModule::WriteHxx() +*************************************************************************/ +void SvMetaModule::WriteHxx( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab ) +{ + for( ULONG n = 0; n < aClassList.Count(); n++ ) + { + SvMetaClass * pClass = aClassList.GetObject( n ); + pClass->WriteHxx( rBase, rOutStm, nTab ); + } +} + +/************************************************************************* +|* SvMetaModule::WriteCxx() +*************************************************************************/ +void SvMetaModule::WriteCxx( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab ) +{ + for( ULONG n = 0; n < aClassList.Count(); n++ ) + { + SvMetaClass * pClass = aClassList.GetObject( n ); + pClass->WriteCxx( rBase, rOutStm, nTab ); + } +} + +#endif // IDL_COMPILER + diff --git a/idl/source/objects/object.cxx b/idl/source/objects/object.cxx new file mode 100644 index 000000000000..6e885d525542 --- /dev/null +++ b/idl/source/objects/object.cxx @@ -0,0 +1,1091 @@ +/************************************************************************* + * + * $RCSfile: object.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________ + * + * + ************************************************************************/ + +#include <ctype.h> +#include <stdio.h> + +#include <tools/debug.hxx> + +#include <attrib.hxx> +#include <object.hxx> +#include <globals.hxx> +#include <database.hxx> +#pragma hdrstop + + +/******************** class SvClassElement *******************************/ +SV_IMPL_PERSIST1( SvClassElement, SvPersistBase ); + +/************************************************************************* +|* SvClassElement::SvClassElement() +|* +|* Beschreibung +*************************************************************************/ +SvClassElement::SvClassElement() +{ +}; + +/************************************************************************* +|* SvClassElement::Load() +|* +|* Beschreibung +*************************************************************************/ +void SvClassElement::Load( SvPersistStream & rStm ) +{ + BYTE nMask; + rStm >> nMask; + if( nMask >= 0x08 ) + { + rStm.SetError( SVSTREAM_FILEFORMAT_ERROR ); + DBG_ERROR( "wrong format" ) + return; + } + if( nMask & 0x01 ) rStm >> aAutomation; + if( nMask & 0x02 ) rStm.ReadByteString( aPrefix ); + if( nMask & 0x04 ) + { + SvMetaClass * p; + rStm >> p; + xClass = p; + } +} + +/************************************************************************* +|* SvClassElement::Save() +|* +|* Beschreibung +*************************************************************************/ +void SvClassElement::Save( SvPersistStream & rStm ) +{ + // Maske erstellen + BYTE nMask = 0; + if( aAutomation.IsSet() ) nMask |= 0x1; + if( aPrefix.Len() ) nMask |= 0x2; + if( xClass.Is() ) nMask |= 0x4; + + // Daten schreiben + rStm << nMask; + if( nMask & 0x01 ) rStm << aAutomation; + if( nMask & 0x02 ) rStm.WriteByteString( aPrefix ); + if( nMask & 0x04 ) rStm << xClass; +} + +/****************** SvMetaClass ******************************************/ +SV_IMPL_META_FACTORY1( SvMetaClass, SvMetaType ); +#ifdef IDL_COMPILER +SvAttributeList & SvMetaClass::GetAttributeList() +{ + if( !pAttribList ) + { + pAttribList = new SvAttributeList(); + } + return *pAttribList; +} +#endif +/************************************************************************* +|* SvMetaClass::SvMetaClass() +|* +|* Beschreibung +*************************************************************************/ +SvMetaClass::SvMetaClass() + : aAutomation( TRUE, FALSE ) +{ +} + +/************************************************************************* +|* SvMetaClass::Load() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaClass::Load( SvPersistStream & rStm ) +{ + SvMetaType::Load( rStm ); + + BYTE nMask; + rStm >> nMask; + if( nMask >= 0x20 ) + { + rStm.SetError( SVSTREAM_FILEFORMAT_ERROR ); + DBG_ERROR( "wrong format" ) + return; + } + if( nMask & 0x01 ) rStm >> aAttrList; + if( nMask & 0x02 ) + { + SvMetaClass * pSuper; + rStm >> pSuper; + aSuperClass = pSuper; + } + if( nMask & 0x04 ) rStm >> aClassList; + if( nMask & 0x8 ) + { + SvMetaClass * p; + rStm >> p; + xAutomationInterface = p; + } + if( nMask & 0x10 ) rStm >> aAutomation; +} + +/************************************************************************* +|* SvMetaClass::Save() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaClass::Save( SvPersistStream & rStm ) +{ + SvMetaType::Save( rStm ); + + // Maske erstellen + BYTE nMask = 0; + if( aAttrList.Count() ) nMask |= 0x1; + if( aSuperClass.Is() ) nMask |= 0x2; + if( aClassList.Count() ) nMask |= 0x4; + if( xAutomationInterface.Is() ) nMask |= 0x8; + if( aAutomation.IsSet() ) nMask |= 0x10; + + // Daten schreiben + rStm << nMask; + if( nMask & 0x01 ) rStm << aAttrList; + if( nMask & 0x02 ) rStm << aSuperClass; + if( nMask & 0x04 ) rStm << aClassList; + if( nMask & 0x08 ) rStm << xAutomationInterface; + if( nMask & 0x10 ) rStm << aAutomation; +} + +/************************************************************************* +|* SvMetaClass::FillSbxObject() +|* +|* Beschreibung +*************************************************************************/ +/* +void SvMetaClass::FillSbxMemberObject( SvIdlDataBase & rBase, + SbxObject * pObj, + StringList & rSuperList, + BOOL bVariable ) +{ + // alle Attribute der Klasse schreiben + ULONG n ; + for( n = 0; n < aAttrList.Count(); n++ ) + { + SvMetaAttribute * pAttr = aAttrList.GetObject( n ); + + ByteString aMangleName = pAttr->GetMangleName( bVariable ); + ByteString * pS = SvIdlDataBase::FindName( aMangleName, rSuperList ); + + if( !pS && pAttr->GetExport() ) + { + // nicht doppelt + if( bVariable && pAttr->IsVariable() ) + { + rSuperList.Insert( new ByteString( aMangleName ), LIST_APPEND ); + pAttr->FillSbxObject( rBase, pObj, bVariable ); + } + else if( !bVariable && pAttr->IsMethod() ) + { + rSuperList.Insert( new ByteString( aMangleName ), LIST_APPEND ); + pAttr->FillSbxObject( rBase, pObj, bVariable ); + } + } + } + // alle Attribute der importierten Klassen schreiben + for( n = 0; n < aClassList.Count(); n++ ) + { + SvClassElement * pEle = aClassList.GetObject( n ); + SvMetaClass * pClass = pEle->GetClass(); + pClass->FillSbxMemberObject( rBase, pObj, rSuperList, bVariable ); + } + // alle Attribute der Superklassen schreiben + if( aSuperClass.Is() ) + aSuperClass->FillSbxMemberObject( rBase, pObj, rSuperList, bVariable ); +} +*/ +/************************************************************************* +|* SvMetaClass::FillSbxObject() +|* +|* Beschreibung +*************************************************************************/ +/* +void SvMetaClass::FillSbxObject( SvIdlDataBase & rBase, SbxObject * pObj ) +{ + StringList aSuperList; + FillSbxMemberObject( rBase, pObj, aSuperList, TRUE ); + FillSbxMemberObject( rBase, pObj, aSuperList, FALSE ); + + ByteString * pStr = aSuperList.First(); + while( pStr ) + { + delete pStr; + pStr = aSuperList.Next(); + } +} + */ +#ifdef IDL_COMPILER +/************************************************************************* +|* SvMetaClass::ReadAttributesSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaClass::ReadAttributesSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm ) +{ + SvMetaType::ReadAttributesSvIdl( rBase, rInStm ); + aAutomation.ReadSvIdl( SvHash_Automation(), rInStm ); +} + +/************************************************************************* +|* SvMetaClass::WriteAttributesSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaClass::WriteAttributesSvIdl( SvIdlDataBase & rBase, + SvStream & rOutStm, USHORT nTab ) +{ + SvMetaType::WriteAttributesSvIdl( rBase, rOutStm, nTab ); + + if( !aAutomation ) + { + WriteTab( rOutStm, nTab ); + rOutStm << "//class SvMetaClass" << endl; + if( !aAutomation ) + { + WriteTab( rOutStm, nTab ); + aAutomation.WriteSvIdl( SvHash_Automation(), rOutStm ); + rOutStm << ';' << endl; + } + } +} + +/************************************************************************* +|* SvMetaClass::ReadContextSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaClass::ReadContextSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm ) +{ + UINT32 nTokPos = rInStm.Tell(); + SvToken * pTok = rInStm.GetToken_Next(); + + if( pTok->Is( SvHash_import() ) ) + { + SvMetaClass * pClass = rBase.ReadKnownClass( rInStm ); + if( pClass ) + { + SvClassElementRef xEle = new SvClassElement(); + xEle->SetClass( pClass ); + aClassList.Append( xEle ); + + if( rInStm.Read( '[' ) ) + { + pTok = rInStm.GetToken_Next(); + if( pTok->Is( SvHash_Automation() ) ) + { + if( rInStm.Read( ']' ) ) + { + if( xAutomationInterface.Is() ) + { + // Fehler setzen + rBase.SetError( "Automation allready set", + rInStm.GetToken() ); + rBase.WriteError( rInStm ); + } + xAutomationInterface = pClass; + xEle->SetAutomation( TRUE ); + } + else + { + // Fehler setzen + rBase.SetError( "missing ]", rInStm.GetToken() ); + rBase.WriteError( rInStm ); + } + } + else + { + // Fehler setzen + rBase.SetError( "only attribute Automation allowed", + rInStm.GetToken() ); + rBase.WriteError( rInStm ); + } + } + pTok = rInStm.GetToken(); + if( pTok->IsString() ) + { + xEle->SetPrefix( pTok->GetString() ); + rInStm.GetToken_Next(); + } + return; + } + else + { + // Fehler setzen + rBase.SetError( "unknown imported interface", rInStm.GetToken() ); + rBase.WriteError( rInStm ); + } + } + else + { + rInStm.Seek( nTokPos ); + SvMetaType * pType = rBase.ReadKnownType( rInStm ); + + BOOL bOk = FALSE; + SvMetaAttributeRef xAttr; + if( !pType || pType->IsItem() ) + { + xAttr = new SvMetaSlot( pType ); + if( xAttr->ReadSvIdl( rBase, rInStm ) ) + bOk = xAttr->Test( rBase, rInStm ); + } + else + { + xAttr = new SvMetaAttribute( pType ); + if( xAttr->ReadSvIdl( rBase, rInStm ) ) + bOk = xAttr->Test( rBase, rInStm ); + } + + if( bOk ) + bOk = TestAttribute( rBase, rInStm, *xAttr ); + if( bOk ) + { + if( !xAttr->GetSlotId().IsSet() ) + { + SvNumberIdentifier aI; + aI.SetValue( rBase.GetUniqueId() ); + xAttr->SetSlotId( aI ); + } + aAttrList.Append( xAttr ); + return; + } + } + rInStm.Seek( nTokPos ); +} + +/************************************************************************* +|* SvMetaClass::WriteContextSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaClass::WriteContextSvIdl +( + SvIdlDataBase & rBase, + SvStream & rOutStm, + USHORT nTab +) +{ + //SvMetaType::WriteContextSvIdl( rBase, rOutStm, nTab ); + ULONG n; + for( n = 0; n < aAttrList.Count(); n++ ) + { + WriteTab( rOutStm, nTab ); + aAttrList.GetObject( n )->WriteSvIdl( rBase, rOutStm, nTab ); + rOutStm << ';' << endl; + } + for( n = 0; n < aClassList.Count(); n++ ) + { + SvClassElement * pEle = aClassList.GetObject( n ); + SvMetaClass * pCl = pEle->GetClass(); + WriteTab( rOutStm, nTab ); + rOutStm << SvHash_import()->GetName().GetBuffer() << ' ' + << pEle->GetPrefix().GetBuffer(); + if( pEle->GetAutomation() ) + rOutStm << " [ " << SvHash_Automation()->GetName().GetBuffer() + << " ]"; + if( pEle->GetPrefix().Len() ) + rOutStm << ' ' << pEle->GetPrefix().GetBuffer(); + rOutStm << ';' << endl; + } +} + +/************************************************************************* +|* SvMetaClass::ReadSvIdl() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaClass::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm ) +{ + ULONG nTokPos = rInStm.Tell(); + if( SvMetaType::ReadHeaderSvIdl( rBase, rInStm ) && GetType() == TYPE_CLASS ) + { + BOOL bOk = TRUE; + if( rInStm.Read( ':' ) ) + { + aSuperClass = rBase.ReadKnownClass( rInStm ); + bOk = aSuperClass.Is(); + if( !bOk ) + { + // Fehler setzen + rBase.SetError( "unknown super class", + rInStm.GetToken() ); + rBase.WriteError( rInStm ); + } + } + if( bOk ) + { + rBase.Write( '.' ); + bOk = SvMetaName::ReadSvIdl( rBase, rInStm ); + } + if( bOk ) + return bOk; + } + rInStm.Seek( nTokPos ); + return FALSE; +} + +/************************************************************************* +|* SvMetaClass::TestAttribute() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaClass::TestAttribute( SvIdlDataBase & rBase, SvTokenStream & rInStm, + SvMetaAttribute & rAttr ) const +{ + if ( !rAttr.GetRef() && rAttr.IsA( TYPE( SvMetaSlot ) ) ) + { + DBG_ERROR( "Neuer Slot : " ); + DBG_ERROR( rAttr.GetSlotId().GetBuffer() ); + } + + for( ULONG n = 0; n < aAttrList.Count(); n++ ) + { + SvMetaAttribute * pS = aAttrList.GetObject( n ); + if( pS->GetName() == rAttr.GetName() ) + { + // Werte muessen uebereinstimmen + if( pS->GetSlotId().GetValue() != rAttr.GetSlotId().GetValue() ) + { + DBG_ERROR( "Gleicher Name in MetaClass : " ); + DBG_ERROR( pS->GetName().GetBuffer() ); + DBG_ERROR( pS->GetSlotId().GetBuffer() ); + DBG_ERROR( rAttr.GetSlotId().GetBuffer() ); + + ByteString aStr( "Attribute's " ); + aStr += pS->GetName(); + aStr += " with different id's"; + rBase.SetError( aStr, rInStm.GetToken() ); + rBase.WriteError( rInStm ); + return FALSE; + } + } + else + { + UINT32 nId1 = pS->GetSlotId().GetValue(); + UINT32 nId2 = rAttr.GetSlotId().GetValue(); + if( nId1 == nId2 && nId1 != 0 /*&& nId2 != 0 ist ueberfluessig*/ ) + { + DBG_ERROR( "Gleiche Id in MetaClass : " ); + DBG_ERROR( ByteString::CreateFromInt32( pS->GetSlotId().GetValue() ).GetBuffer() ); + DBG_ERROR( pS->GetSlotId().GetBuffer() ); + DBG_ERROR( rAttr.GetSlotId().GetBuffer() ); + + ByteString aStr( "Attribute " ); + aStr += pS->GetName(); + aStr += " and Attribute "; + aStr += rAttr.GetName(); + aStr += " with equal id's"; + rBase.SetError( aStr, rInStm.GetToken() ); + rBase.WriteError( rInStm ); + return FALSE; + } + } + } + SvMetaClass * pSC = aSuperClass; + if( pSC ) + return pSC->TestAttribute( rBase, rInStm, rAttr ); + return TRUE; +} + +/************************************************************************* +|* SvMetaClass::WriteSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaClass::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab ) +{ + WriteHeaderSvIdl( rBase, rOutStm, nTab ); + if( aSuperClass.Is() ) + rOutStm << " : " << aSuperClass->GetName().GetBuffer(); + rOutStm << endl; + SvMetaName::WriteSvIdl( rBase, rOutStm, nTab ); + rOutStm << endl; +} + +/************************************************************************* +|* SvMetaClass::WriteOdlMember() +|* +|* Beschreibung +*************************************************************************/ +/* +void SvMetaClass::WriteOdlMembers( ByteStringList & rSuperList, + BOOL bVariable, BOOL bWriteTab, + SvIdlDataBase & rBase, + SvStream & rOutStm, USHORT nTab ) +{ + // alle Attribute schreiben + ULONG n; + for( n = 0; n < aAttrList.Count(); n++ ) + { + SvMetaAttribute * pAttr = aAttrList.GetObject( n ); + + ByteString aMangleName = pAttr->GetMangleName( bVariable ); + ByteString * pS = rBase.FindName( aMangleName, rSuperList ); + + if( !pS && pAttr->GetExport() ) + { + // nicht doppelt + if( bVariable && pAttr->IsVariable() ) + { + rSuperList.Insert( new ByteString( aMangleName ), LIST_APPEND ); + pAttr->Write( rBase, rOutStm, nTab +1, WRITE_ODL, + WA_VARIABLE ); + rOutStm << ';' << endl; + } + else if( !bVariable && pAttr->IsMethod() ) + { + rSuperList.Insert( new ByteString( aMangleName ), LIST_APPEND ); + pAttr->Write( rBase, rOutStm, nTab +1, WRITE_ODL, + WA_METHOD ); + rOutStm << ';' << endl; + } + } + else + continue; + } + // alle Attribute der importierten Klassen schreiben + for( n = 0; n < aClassList.Count(); n++ ) + { + SvClassElement * pEle = aClassList.GetObject( n ); + SvMetaClass * pCl = pEle->GetClass(); + pCl->WriteOdlMembers( rSuperList, bVariable, bWriteTab, + rBase, rOutStm, nTab ); + } + // alle Attribute der Superklassen schreiben + SvMetaClass * pSC = aSuperClass; + if( pSC ) + pSC->WriteOdlMembers( rSuperList, bVariable, bWriteTab, + rBase, rOutStm, nTab ); +} + */ + +/************************************************************************* +|* SvMetaClass::Write() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaClass::Write( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab, + WriteType nT, WriteAttribute nA ) +{ + rBase.aIFaceName = GetName(); + switch( nT ) + { + case WRITE_ODL: + { + DBG_ERROR( "Not supported anymore!" ) +/* + // Schreibt die Attribute + SvMetaName::Write( rBase, rOutStm, nTab, nT, nA ); + + WriteTab( rOutStm, nTab ); + rOutStm << "dispinterface " << GetName().GetBuffer() << endl; + WriteTab( rOutStm, nTab ); + rOutStm << '{' << endl; + + WriteTab( rOutStm, nTab ); + rOutStm << "properties:"; + rOutStm << endl; + + StringList aSuperList; + WriteOdlMembers( aSuperList, TRUE, TRUE, rBase, rOutStm, nTab ); + + WriteTab( rOutStm, nTab ); + rOutStm << "methods:"; + rOutStm << endl; + + WriteOdlMembers( aSuperList, FALSE, TRUE, rBase, rOutStm, nTab ); + + ByteString * pStr = aSuperList.First(); + while( pStr ) + { + delete pStr; + pStr = aSuperList.Next(); + } + + WriteTab( rOutStm, 1 ); + rOutStm << '}' << endl; + */ + break; + } + case WRITE_C_SOURCE: + case WRITE_C_HEADER: + { + DBG_ERROR( "Not supported anymore!" ) +/* + StringList aSuperList; + if( nT == WRITE_C_SOURCE ) + { + rOutStm << "#pragma code_seg (\"" << GetName().GetBuffer() + << "\",\"CODE\")" << endl; + } + WriteCFunctions( aSuperList, rBase, rOutStm, nTab, nT ); + */ + break; + } + case WRITE_DOCU: + { + rOutStm << "<INTERFACE>" << endl + << GetName().GetBuffer(); + if ( GetAutomation() ) + rOutStm << " ( Automation ) "; + rOutStm << endl; + WriteDescription( rBase, rOutStm ); + rOutStm << "</INTERFACE>" << endl << endl; + + // alle Attribute schreiben + ULONG n; + for( n = 0; n < aAttrList.Count(); n++ ) + { + SvMetaAttribute * pAttr = aAttrList.GetObject( n ); + if( !pAttr->GetHidden() ) + { + if( pAttr->IsMethod() ) + pAttr->Write( rBase, rOutStm, nTab, nT, WA_METHOD ); + + if( pAttr->IsVariable() ) + pAttr->Write( rBase, rOutStm, nTab, nT, WA_VARIABLE ); + } + } + + break; + } + } +} + +/************************************************************************* +|* SvMetaClass::WriteSlotParamArray() +|* +|* Beschreibung +*************************************************************************/ +USHORT SvMetaClass::WriteSlotParamArray( SvIdlDataBase & rBase, + SvSlotElementList & rSlotList, + SvStream & rOutStm ) +{ + USHORT nCount = 0; + for( ULONG n = 0; n < rSlotList.Count(); n++ ) + { + SvSlotElement *pEle = rSlotList.GetObject( n ); + SvMetaSlot *pAttr = pEle->xSlot; + nCount += pAttr->WriteSlotParamArray( rBase, rOutStm ); + } + + return nCount; +} + +/************************************************************************* +|* SvMetaClass::WriteSlots() +|* +|* Beschreibung +*************************************************************************/ +USHORT SvMetaClass::WriteSlots( const ByteString & rShellName, + USHORT nCount, SvSlotElementList & rSlotList, + SvIdlDataBase & rBase, + SvStream & rOutStm ) +{ + USHORT nSCount = 0; + for( ULONG n = 0; n < rSlotList.Count(); n++ ) + { + rSlotList.Seek(n); + SvSlotElement * pEle = rSlotList.GetCurObject(); + SvMetaSlot * pAttr = pEle->xSlot; + nSCount += pAttr->WriteSlotMap( rShellName, nCount + nSCount, + rSlotList, pEle->aPrefix, rBase, + rOutStm ); + } + + return nSCount; +} + +/************************************************************************* +|* SvMetaClass::InsertSlots() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaClass::InsertSlots( SvSlotElementList& rList, SvULongs& rSuperList, + SvMetaClassList &rClassList, + const ByteString & rPrefix, SvIdlDataBase& rBase) +{ + // Wurde diese Klasse schon geschrieben ? + if ( rClassList.GetPos(this) != LIST_ENTRY_NOTFOUND ) + return; + + rClassList.Insert(this, LIST_APPEND); + + // alle direkten Attribute schreiben + ULONG n; + for( n = 0; n < aAttrList.Count(); n++ ) + { + SvMetaAttribute * pAttr = aAttrList.GetObject( n ); + + ULONG nId = pAttr->GetSlotId().GetValue(); + USHORT nPos; + for ( nPos=0; nPos < rSuperList.Count(); nPos++ ) + { + if ( rSuperList.GetObject(nPos) == nId ) + break; + } + + if( nPos == rSuperList.Count() ) + { + // nur schreiben, wenn nicht schon bei SubClass oder + // importiertem Interface geschrieben + rSuperList.Insert( nId, nPos ); + pAttr->Insert(rList, rPrefix, rBase); + } + } + + // Alle schon von SuperShells importierten Interfaces sollen nicht + // mehr geschrieben werden + // Es ist also verboten, da\s Shell und SuperShell die gleiche Klasse + // direkt importieren ! + if( IsShell() && aSuperClass.Is() ) + aSuperClass->FillClasses( rClassList ); + + // alle Attribute der importierten Klassen schreiben, sofern diese nicht + // schon von der Superklasse importiert wurden + for( n = 0; n < aClassList.Count(); n++ ) + { + SvClassElement * pEle = aClassList.GetObject( n ); + SvMetaClass * pCl = pEle->GetClass(); + ByteString rPre = rPrefix; + if( rPre.Len() && pEle->GetPrefix().Len() ) + rPre += '.'; + rPre += pEle->GetPrefix(); + + // Zun"achst die direkt importierten Interfaces schreiben + pCl->InsertSlots( rList, rSuperList, rClassList, rPre, rBase ); + } + + // Superklassen nur schreiben, wenn keine Shell und nicht in der Liste + if( !IsShell() && aSuperClass.Is() ) + { + aSuperClass->InsertSlots( rList, rSuperList, rClassList, rPrefix, rBase ); + } +} + +/************************************************************************* +|* SvMetaClass::FillClasses() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaClass::FillClasses( SvMetaClassList & rList ) +{ + // Bin ich noch nicht drin ? + if ( rList.GetPos(this) == LIST_ENTRY_NOTFOUND ) + { + rList.Insert(this, LIST_APPEND); + + // Meine Imports + for( ULONG n = 0; n < aClassList.Count(); n++ ) + { + SvClassElement * pEle = aClassList.GetObject( n ); + SvMetaClass * pCl = pEle->GetClass(); + pCl->FillClasses( rList ); + } + + // Meine Superklasse + if( aSuperClass.Is() ) + aSuperClass->FillClasses( rList ); + } +} + + +/************************************************************************* +|* SvMetaClass::WriteSlotStubs() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaClass::WriteSlotStubs( const ByteString & rShellName, + SvSlotElementList & rSlotList, + ByteStringList & rList, + SvStream & rOutStm ) +{ + // alle Attribute schreiben + for( ULONG n = 0; n < rSlotList.Count(); n++ ) + { + SvSlotElement *pEle = rSlotList.GetObject( n ); + SvMetaSlot *pAttr = pEle->xSlot; + pAttr->WriteSlotStubs( rShellName, rList, rOutStm ); + } +} + +/************************************************************************* +|* SvMetaClass::WriteSfx() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ) +{ + WriteStars( rOutStm ); + // Klasse definieren + rOutStm << "#ifdef " << GetName().GetBuffer() << endl; + rOutStm << "#undef ShellClass" << endl; + rOutStm << "#undef " << GetName().GetBuffer() << endl; + rOutStm << "#define ShellClass " << GetName().GetBuffer() << endl; + +// rOutStm << "SFX_TYPELIB(" << GetName().GetBuffer() << ',' << endl +// << "\t/* library type */" +// << '"' << ByteString( GetModule()->GetUUId().GetHexName(), RTL_TEXTENCODING_UTF8 ).GetBuffer() << "\"," << endl +// << "\t\"" << GetModule()->GetTypeLibFileName().GetBuffer() << "\"," +// << ByteString::CreateFromInt32( GetModule()->GetVersion().GetMajorVersion() ).GetBuffer() << ',' +// << ByteString::CreateFromInt32( GetModule()->GetVersion().GetMinorVersion() ).GetBuffer() << ',' << endl +// << "\t/* shell type */" +// << '"'; +// if( xAutomationInterface.Is() ) +// rOutStm << ByteString( xAutomationInterface->GetUUId().GetHexName(), RTL_TEXTENCODING_UTF8 ).GetBuffer(); +// else +// rOutStm << ByteString( GetUUId().GetHexName(), RTL_TEXTENCODING_UTF8 ).GetBuffer(); +// rOutStm << "\");" << endl << endl; + + // Fuer Interfaces werden kein Slotmaps geschrieben + if( !IsShell() ) + { + rOutStm << "#endif" << endl << endl; + return; + } + // Parameter Array schreiben + //rOutStm << "SfxArgList " << GetName().GetBuffer() << "ArgMap[] = {" << endl; + rOutStm << "SFX_ARGUMENTMAP(" << GetName().GetBuffer() << ')' << endl + << '{' << endl; + + SvULongs aSuperList; + SvMetaClassList aClassList; + SvSlotElementList aSlotList; + InsertSlots(aSlotList, aSuperList, aClassList, ByteString(), rBase); + ULONG n; + for ( n=0; n<aSlotList.Count(); n++ ) + { + SvSlotElement *pEle = aSlotList.GetObject( n ); + SvMetaSlot *pSlot = pEle->xSlot; + pSlot->SetListPos(n); + } + + ULONG nSlotCount = aSlotList.Count(); + + // alle Attribute schreiben + USHORT nArgCount = WriteSlotParamArray( rBase, aSlotList, rOutStm ); + if( nArgCount ) + Back2Delemitter( rOutStm ); + else + { + // mindestens einen dummy + WriteTab( rOutStm, 1 ); + rOutStm << "SFX_ARGUMENT( 0, 0, SfxVoidItem )" << endl; + } + rOutStm << endl << "};" << endl << endl; + + ByteStringList aStringList; + WriteSlotStubs( GetName(), aSlotList, aStringList, rOutStm ); + ByteString * pStr = aStringList.First(); + while( pStr ) + { + delete pStr; + pStr = aStringList.Next(); + } + + rOutStm << endl; + + // Slotmap schreiben + rOutStm << "SFX_SLOTMAP_ARG(" << GetName().GetBuffer() << ')' << endl + << '{' << endl; + + // alle Attribute schreiben + WriteSlots( GetName(), 0, aSlotList, rBase, rOutStm ); + if( nSlotCount ) + Back2Delemitter( rOutStm ); + else + { + // mindestens einen dummy + WriteTab( rOutStm, 1 ); + rOutStm << "SFX_SLOT_ARG(" << GetName().GetBuffer() + << ", 0, 0, " + << "SFX_STUB_PTR_EXEC_NONE," + << "SFX_STUB_PTR_STATE_NONE," + << "0, SfxVoidItem, 0, 0, \"\", 0 )" << endl; + } + rOutStm << endl << "};" << endl << "#endif" << endl << endl; + + for( n=0; n<aSlotList.Count(); n++ ) + { + aSlotList.Seek(n); + SvSlotElement* pEle = aSlotList.GetCurObject(); + SvMetaSlot* pAttr = pEle->xSlot; + pAttr->ResetSlotPointer(); + } + + for ( n=0; n<aSlotList.Count(); n++ ) + delete aSlotList.GetObject(n); +} + +void SvMetaClass::WriteHelpIds( SvIdlDataBase & rBase, SvStream & rOutStm, + Table* pTable ) +{ + for( ULONG n=0; n<aAttrList.Count(); n++ ) + { + SvMetaAttribute * pAttr = aAttrList.GetObject( n ); + pAttr->WriteHelpId( rBase, rOutStm, pTable ); + } +} + +/************************************************************************* +|* SvMetaShell::WriteSrc() +*************************************************************************/ +void SvMetaClass::WriteSrc( SvIdlDataBase & rBase, SvStream & rOutStm, + Table * pTable ) +{ + for( ULONG n=0; n<aAttrList.Count(); n++ ) + { + SvMetaAttribute * pAttr = aAttrList.GetObject( n ); + pAttr->WriteSrc( rBase, rOutStm, pTable ); + } +} + +/************************************************************************* +|* SvMetaClass::WriteHxx() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaClass::WriteHxx( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab ) +{ + ByteString aSuperName( "SvDispatch" ); + if( GetSuperClass() ) + aSuperName = GetSuperClass()->GetName(); + const char * pSup = aSuperName.GetBuffer(); + + rOutStm + << "class " << GetSvName().GetBuffer() + << ": public " << pSup << endl + << '{' << endl + << "protected:" << endl + << "\tvirtual SvGlobalName GetTypeName() const;" << endl + << "\tvirtual BOOL FillTypeLibInfo( SvGlobalName *, USHORT * pMajor," << endl + << "\t USHORT * pMinor ) const;" << endl + << "\tvirtual BOOL FillTypeLibInfo( ByteString * pName, USHORT * pMajor," << endl; + rOutStm + << "\t USHORT * pMinor ) const;" << endl + << "\tvirtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) = 0;" << endl + << "public:" << endl + << "\t static SvGlobalName ClassName()" << endl + << "\t { return SvGlobalName( " << ByteString( GetUUId().GetctorName(), RTL_TEXTENCODING_UTF8 ).GetBuffer() << " ); }" << endl + << "};" << endl; +} + +/************************************************************************* +|* SvMetaClass::WriteCxx() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaClass::WriteCxx( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab ) +{ + ByteString aSuperName( "SvDispatch" ); + if( GetSuperClass() ) + aSuperName = GetSuperClass()->GetName(); + const char * pSup = aSuperName.GetBuffer(); + + ByteString aName = GetSvName(); + // GetTypeName + rOutStm << "SvGlobalName " << aName.GetBuffer() << "::GetTypeName() const" << endl + << '{' << endl + << "\treturn ClassName();" << endl + << '}' << endl; + + SvMetaModule * pMod = GetModule(); + // FillTypeLibInfo + rOutStm << "BOOL " << aName.GetBuffer() << "::FillTypeLibInfo( SvGlobalName * pGN," << endl + << "\t USHORT * pMajor," << endl + << "\t USHORT * pMinor ) const" << endl + << '{' << endl + << "\tSvGlobalName aN( " << ByteString( pMod->GetUUId().GetctorName(), RTL_TEXTENCODING_UTF8 ).GetBuffer() << " );" << endl; + rOutStm << "\t*pGN = aN;" << endl + << "\t*pMajor = " << ByteString::CreateFromInt32(pMod->GetVersion().GetMajorVersion()).GetBuffer() << ';' << endl + << "\t*pMinor = " << ByteString::CreateFromInt32(pMod->GetVersion().GetMinorVersion()).GetBuffer() << ';' << endl + << "\treturn TRUE;" << endl + << '}' << endl; + + // FillTypeLibInfo + rOutStm << "BOOL " << aName.GetBuffer() << "::FillTypeLibInfo( ByteString * pName," + << "\t USHORT * pMajor," << endl + << "\t USHORT * pMinor ) const" << endl; + rOutStm << '{' << endl + << "\t*pName = \"" << pMod->GetTypeLibFileName().GetBuffer() << "\";" << endl + << "\t*pMajor = " << ByteString::CreateFromInt32(pMod->GetVersion().GetMajorVersion()).GetBuffer() << ';' << endl + << "\t*pMinor = " << ByteString::CreateFromInt32(pMod->GetVersion().GetMinorVersion()).GetBuffer() << ';' << endl + << "\treturn TRUE;" << endl + << '}' << endl; + + rOutStm << "void " << aName.GetBuffer() << "::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )" << endl + << '{' << endl + << "\t" << pSup << "::Notify( rBC, rHint );" << endl + << '}' << endl; +} + +#endif // IDL_COMPILER + diff --git a/idl/source/objects/slot.cxx b/idl/source/objects/slot.cxx new file mode 100644 index 000000000000..3f6fc3a2015f --- /dev/null +++ b/idl/source/objects/slot.cxx @@ -0,0 +1,2011 @@ +/************************************************************************* + * + * $RCSfile: slot.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________ + * + * + ************************************************************************/ + +#include <ctype.h> +#include <stdio.h> +#include <tools/debug.hxx> +#include <attrib.hxx> +#include <slot.hxx> +#include <globals.hxx> +#include <database.hxx> +#pragma hdrstop + + +/****************** SvMetaSlot *****************************************/ +SV_IMPL_META_FACTORY1( SvMetaSlot, SvMetaAttribute ); +#ifdef IDL_COMPILER +SvAttributeList & SvMetaSlot::GetAttributeList() +{ + if( !pAttribList ) + { + pAttribList = new SvAttributeList(); + } + return *pAttribList; +} +#endif + +/************************************************************************* +|* SvMetaSlot::SvMetaSlot() +|* +|* Beschreibung Zweites FALSE bei den SvBOOL-Objekten bedeutet, +|* IsSet() liefert FALSE (Defaultinitialisierung). +*************************************************************************/ +SvMetaSlot::SvMetaSlot() + : aCachable( TRUE, FALSE ) + , aSynchron( TRUE, FALSE ) + , aRecordPerSet( TRUE, FALSE ) + , aRecordAbsolute( FALSE, FALSE ) + , pLinkedSlot(0) + , pNextSlot(0) + , pEnumValue(0) +{ +} + +SvMetaSlot::SvMetaSlot( SvMetaType * pType ) + : SvMetaAttribute( pType ) + , aCachable( TRUE, FALSE ) + , aSynchron( TRUE, FALSE ) + , aRecordPerSet( TRUE, FALSE ) + , aRecordAbsolute( FALSE, FALSE ) + , pLinkedSlot(0) + , pNextSlot(0) + , pEnumValue(0) +{ +} + +/* +#define TEST_READ \ +{ \ + UINT32 nPos; \ + rStm >> nPos; \ + DBG_ASSERT( nPos +4 == rStm.Tell(), "stream pos error" ); \ +} + +#define TEST_WRITE \ + rStm << (UINT32)rStm.Tell(); +*/ +#define TEST_READ +#define TEST_WRITE + +void SvMetaSlot::Load( SvPersistStream & rStm ) +{ + SvMetaAttribute::Load( rStm ); + + USHORT nMask; + rStm >> nMask; + + TEST_READ + if( nMask & 0x0001 ) + { + SvMetaAttribute * pMeth; + rStm >> pMeth; + aMethod = pMeth; + } + + TEST_READ + if( nMask & 0x0002 ) rStm >> aGroupId; + TEST_READ + if( nMask & 0x0004 ) rStm >> aHasCoreId; + TEST_READ + if( nMask & 0x0008 ) rStm >> aConfigId; + TEST_READ + if( nMask & 0x0010 ) rStm >> aExecMethod; + TEST_READ + if( nMask & 0x0020 ) rStm >> aStateMethod; + TEST_READ + if( nMask & 0x0040 ) rStm >> aDefault; + TEST_READ + if( nMask & 0x0080 ) rStm >> aPseudoSlots; + TEST_READ + if( nMask & 0x0100 ) rStm >> aGet; + TEST_READ + if( nMask & 0x0200 ) rStm >> aSet; + TEST_READ + if( nMask & 0x0400 ) rStm >> aCachable; + TEST_READ + if( nMask & 0x0800 ) rStm >> aVolatile; + TEST_READ + if( nMask & 0x1000 ) rStm >> aToggle; + TEST_READ + if( nMask & 0x2000 ) rStm >> aAutoUpdate; + TEST_READ + if( nMask & 0x4000 ) rStm >> aSynchron; + TEST_READ + if( nMask & 0x8000 ) rStm >> aAsynchron; + + nMask = 0; + rStm >> nMask; + + TEST_READ + if( nMask & 0x0001 ) rStm >> aRecordPerItem; + TEST_READ + if( nMask & 0x0002 ) rStm >> aRecordManual; + TEST_READ + if( nMask & 0x0004 ) rStm >> aNoRecord; + TEST_READ + if( nMask & 0x0008 ) rStm >> aHasDialog; + TEST_READ + if( nMask & 0x0010 ) rStm >> aDisableFlags; + TEST_READ + if( nMask & 0x0020 ) rStm >> aPseudoPrefix; + TEST_READ + if( nMask & 0x0040 ) rStm >> aRecordPerSet; + TEST_READ + if( nMask & 0x0080 ) rStm >> aMenuConfig; + TEST_READ + if( nMask & 0x0100 ) rStm >> aToolBoxConfig; + TEST_READ + if( nMask & 0x0200 ) rStm >> aStatusBarConfig; + TEST_READ + if( nMask & 0x0400 ) rStm >> aAccelConfig; + TEST_READ + if( nMask & 0x0800 ) rStm >> aFastCall; + TEST_READ + if( nMask & 0x1000 ) rStm >> aContainer; + TEST_READ + + if( nMask & 0x2000 ) + { + SvMetaType * pT; + rStm >> pT; + aSlotType = pT; + } + + TEST_READ + if( nMask & 0x4000 ) rStm >> aRecordAbsolute; + TEST_READ + if( nMask & 0x8000 ) rStm >> aPlugComm; + + nMask = 0; + rStm >> nMask; + + TEST_READ + if( nMask & 0x0001 ) rStm >> aUnoName; +} + +void SvMetaSlot::Save( SvPersistStream & rStm ) +{ + SvMetaAttribute::Save( rStm ); + + // Maske erstellen + USHORT nMask = 0; + if( aMethod.Is() ) nMask |= 0x0001; + if( aGroupId.Len() ) nMask |= 0x0002; + if( aHasCoreId.IsSet() ) nMask |= 0x0004; + if( aConfigId.Len() ) nMask |= 0x0008; + if( aExecMethod.Len() ) nMask |= 0x0010; + if( aStateMethod.Len() ) nMask |= 0x0020; + if( aDefault.Len() ) nMask |= 0x0040; + if( aPseudoSlots.IsSet() ) nMask |= 0x0080; + if( aGet.IsSet() ) nMask |= 0x0100; + if( aSet.IsSet() ) nMask |= 0x0200; + if( aCachable.IsSet() ) nMask |= 0x0400; + if( aVolatile.IsSet() ) nMask |= 0x0800; + if( aToggle.IsSet() ) nMask |= 0x1000; + if( aAutoUpdate.IsSet() ) nMask |= 0x2000; + if( aSynchron.IsSet() ) nMask |= 0x4000; + if( aAsynchron.IsSet() ) nMask |= 0x8000; + + // Daten schreiben + rStm << nMask; + TEST_WRITE + if( nMask & 0x0001 ) rStm << aMethod; + TEST_WRITE + if( nMask & 0x0002 ) rStm << aGroupId; + TEST_WRITE + if( nMask & 0x0004 ) rStm << aHasCoreId; + TEST_WRITE + if( nMask & 0x0008 ) rStm << aConfigId; + TEST_WRITE + if( nMask & 0x0010 ) rStm << aExecMethod; + TEST_WRITE + if( nMask & 0x0020 ) rStm << aStateMethod; + TEST_WRITE + if( nMask & 0x0040 ) rStm << aDefault; + TEST_WRITE + if( nMask & 0x0080 ) rStm << aPseudoSlots; + TEST_WRITE + if( nMask & 0x0100 ) rStm << aGet; + TEST_WRITE + if( nMask & 0x0200 ) rStm << aSet; + TEST_WRITE + if( nMask & 0x0400 ) rStm << aCachable; + TEST_WRITE + if( nMask & 0x0800 ) rStm << aVolatile; + TEST_WRITE + if( nMask & 0x1000 ) rStm << aToggle; + TEST_WRITE + if( nMask & 0x2000 ) rStm << aAutoUpdate; + TEST_WRITE + if( nMask & 0x4000 ) rStm << aSynchron; + TEST_WRITE + if( nMask & 0x8000 ) rStm << aAsynchron; + + // naechste Fuhre schreiben + // Maske erstellen + nMask = 0; + if( aRecordPerItem.IsSet() ) nMask |= 0x0001; + if( aRecordManual.IsSet() ) nMask |= 0x0002; + if( aNoRecord.IsSet() ) nMask |= 0x0004; + if( aHasDialog.IsSet() ) nMask |= 0x0008; + if ( aDisableFlags.IsSet() ) nMask |= 0x0010; + if( aPseudoPrefix.Len() ) nMask |= 0x0020; + if( aRecordPerSet.IsSet() ) nMask |= 0x0040; + if( aMenuConfig.IsSet() ) nMask |= 0x0080; + if( aToolBoxConfig.IsSet() ) nMask |= 0x0100; + if( aStatusBarConfig.IsSet() )nMask |= 0x0200; + if( aAccelConfig.IsSet() ) nMask |= 0x0400; + if( aFastCall.IsSet() ) nMask |= 0x0800; + if( aContainer.IsSet() ) nMask |= 0x1000; + if( aSlotType.Is() ) nMask |= 0x2000; + if( aRecordAbsolute.IsSet() ) nMask |= 0x4000; + if( aPlugComm.IsSet() ) nMask |= 0x8000; + + // Daten schreiben + rStm << nMask; + TEST_WRITE + if( nMask & 0x0001 ) rStm << aRecordPerItem; + TEST_WRITE + if( nMask & 0x0002 ) rStm << aRecordManual; + TEST_WRITE + if( nMask & 0x0004 ) rStm << aNoRecord; + TEST_WRITE + if( nMask & 0x0008 ) rStm << aHasDialog; + TEST_WRITE + if( nMask & 0x0010 ) rStm << aDisableFlags; + TEST_WRITE + if( nMask & 0x0020 ) rStm << aPseudoPrefix; + TEST_WRITE + if( nMask & 0x0040 ) rStm << aRecordPerSet; + TEST_WRITE + if( nMask & 0x0080 ) rStm << aMenuConfig; + TEST_WRITE + if( nMask & 0x0100 ) rStm << aToolBoxConfig; + TEST_WRITE + if( nMask & 0x0200 ) rStm << aStatusBarConfig; + TEST_WRITE + if( nMask & 0x0400 ) rStm << aAccelConfig; + TEST_WRITE + if( nMask & 0x0800 ) rStm << aFastCall; + TEST_WRITE + if( nMask & 0x1000 ) rStm << aContainer; + TEST_WRITE + if( nMask & 0x2000 ) rStm << aSlotType; + TEST_WRITE + if( nMask & 0x4000 ) rStm << aRecordAbsolute; + TEST_WRITE + if( nMask & 0x8000 ) rStm << aPlugComm; + + nMask = 0; + if( aUnoName.IsSet() ) nMask |= 0x0001; + + rStm << nMask; + TEST_WRITE + if( nMask & 0x0001 ) rStm << aUnoName; +} + +/************************************************************************* +|* SvMetaSlot::IsVariable() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaSlot::IsVariable() const +{ + return SvMetaAttribute::IsVariable(); +} + +/************************************************************************* +|* SvMetaSlot::IsMethod() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaSlot::IsMethod() const +{ + BOOL b = SvMetaAttribute::IsMethod(); + b |= NULL != GetMethod(); + return b; +} + +/************************************************************************* +|* SvMetaSlot::HasMethods() +|* +|* Beschreibung +*************************************************************************/ +ByteString SvMetaSlot::GetMangleName( BOOL bVariable ) const +{ + if( !bVariable ) + { + SvMetaAttribute * pMeth = GetMethod(); + if( pMeth ) + return pMeth->GetName(); + } + return GetName(); +} + +/************************************************************************* +|* Referenz +|* +|* Beschreibung Zweites FALSE bei den SvBOOL-Objekten bedeutet, +|* IsSet() liefert FALSE (Defaultinitialisierung). +*************************************************************************/ +/** Referenz Aufloesung **/ +SvMetaType * SvMetaSlot::GetSlotType() const +{ + if( aSlotType.Is() || !GetRef() ) return aSlotType; + return ((SvMetaSlot *)GetRef())->GetSlotType(); +} +SvMetaAttribute * SvMetaSlot::GetMethod() const +{ + if( aMethod.Is() || !GetRef() ) return aMethod; + return ((SvMetaSlot *)GetRef())->GetMethod(); +} +BOOL SvMetaSlot::GetHasCoreId() const +{ + if( aHasCoreId.IsSet() || !GetRef() ) return aHasCoreId; + return ((SvMetaSlot *)GetRef())->GetHasCoreId(); +} +const ByteString & SvMetaSlot::GetGroupId() const +{ + if( aGroupId.Len() || !GetRef() ) return aGroupId; + return ((SvMetaSlot *)GetRef())->GetGroupId(); +} +const ByteString & SvMetaSlot::GetDisableFlags() const +{ + if( aDisableFlags.Len() || !GetRef() ) return aDisableFlags; + return ((SvMetaSlot *)GetRef())->GetDisableFlags(); +} +const ByteString & SvMetaSlot::GetConfigId() const +{ + if( aConfigId.Len() || !GetRef() ) return aConfigId; + return ((SvMetaSlot *)GetRef())->GetConfigId(); +} +const ByteString & SvMetaSlot::GetExecMethod() const +{ + if( aExecMethod.Len() || !GetRef() ) return aExecMethod; + return ((SvMetaSlot *)GetRef())->GetExecMethod(); +} +const ByteString & SvMetaSlot::GetStateMethod() const +{ + if( aStateMethod.Len() || !GetRef() ) return aStateMethod; + return ((SvMetaSlot *)GetRef())->GetStateMethod(); +} +const ByteString & SvMetaSlot::GetDefault() const +{ + if( aDefault.Len() || !GetRef() ) return aDefault; + return ((SvMetaSlot *)GetRef())->GetDefault(); +} +BOOL SvMetaSlot::GetPseudoSlots() const +{ + if( aPseudoSlots.IsSet() || !GetRef() ) return aPseudoSlots; + return ((SvMetaSlot *)GetRef())->GetPseudoSlots(); +} +/* +BOOL SvMetaSlot::GetGet() const +{ + if( aGet.IsSet() || !GetRef() ) return aGet; + return ((SvMetaSlot *)GetRef())->GetGet(); +} +BOOL SvMetaSlot::GetSet() const +{ + if( aSet.IsSet() || !GetRef() ) return aSet; + return ((SvMetaSlot *)GetRef())->GetSet(); +} +*/ +BOOL SvMetaSlot::GetCachable() const +{ + // Cachable und Volatile sind exclusiv + if( !GetRef() || aCachable.IsSet() || aVolatile.IsSet() ) + return aCachable; + return ((SvMetaSlot *)GetRef())->GetCachable(); +} +BOOL SvMetaSlot::GetVolatile() const +{ + // Cachable und Volatile sind exclusiv + if( !GetRef() || aVolatile.IsSet() || aCachable.IsSet() ) + return aVolatile; + return ((SvMetaSlot *)GetRef())->GetVolatile(); +} +BOOL SvMetaSlot::GetToggle() const +{ + if( aToggle.IsSet() || !GetRef() ) return aToggle; + return ((SvMetaSlot *)GetRef())->GetToggle(); +} +BOOL SvMetaSlot::GetAutoUpdate() const +{ + if( aAutoUpdate.IsSet() || !GetRef() ) return aAutoUpdate; + return ((SvMetaSlot *)GetRef())->GetAutoUpdate(); +} +BOOL SvMetaSlot::GetSynchron() const +{ + // Synchron und Asynchron sind exclusiv + if( !GetRef() || aSynchron.IsSet() || aAsynchron.IsSet() ) + return aSynchron; + return ((SvMetaSlot *)GetRef())->GetSynchron(); +} +BOOL SvMetaSlot::GetAsynchron() const +{ + // Synchron und Asynchron sind exclusiv + if( !GetRef() || aAsynchron.IsSet() || aSynchron.IsSet() ) + return aAsynchron; + return ((SvMetaSlot *)GetRef())->GetAsynchron(); +} +BOOL SvMetaSlot::GetRecordPerItem() const +{ + // Record- PerItem, No, PerSet und Manual sind exclusiv + if( !GetRef() || aRecordPerItem.IsSet() || aNoRecord.IsSet() + || aRecordPerSet.IsSet() || aRecordManual.IsSet() ) + return aRecordPerItem; + return ((SvMetaSlot *)GetRef())->GetRecordPerItem(); +} +BOOL SvMetaSlot::GetRecordPerSet() const +{ + // Record- PerItem, No, PerSet und Manual sind exclusiv + if( !GetRef() || aRecordPerItem.IsSet() || aNoRecord.IsSet() + || aRecordPerSet.IsSet() || aRecordManual.IsSet() ) + return aRecordPerSet; + return ((SvMetaSlot *)GetRef())->GetRecordPerSet(); +} +BOOL SvMetaSlot::GetRecordManual() const +{ + // Record- PerItem, No, PerSet und Manual sind exclusiv + if( !GetRef() || aRecordPerItem.IsSet() || aNoRecord.IsSet() + || aRecordPerSet.IsSet() || aRecordManual.IsSet() ) + return aRecordManual; + return ((SvMetaSlot *)GetRef())->GetRecordManual(); +} +BOOL SvMetaSlot::GetNoRecord() const +{ + // Record- PerItem, No, PerSet und Manual sind exclusiv + if( !GetRef() || aRecordPerItem.IsSet() || aNoRecord.IsSet() + || aRecordPerSet.IsSet() || aRecordManual.IsSet() ) + return aNoRecord; + return ((SvMetaSlot *)GetRef())->GetNoRecord(); +} +BOOL SvMetaSlot::GetRecordAbsolute() const +{ + if( !GetRef() || aRecordAbsolute.IsSet() ) + return aRecordAbsolute; + return ((SvMetaSlot *)GetRef())->GetRecordAbsolute(); +} +BOOL SvMetaSlot::GetHasDialog() const +{ + if( aHasDialog.IsSet() || !GetRef() ) return aHasDialog; + return ((SvMetaSlot *)GetRef())->GetHasDialog(); +} +const ByteString & SvMetaSlot::GetPseudoPrefix() const +{ + if( aPseudoPrefix.Len() || !GetRef() ) return aPseudoPrefix; + return ((SvMetaSlot *)GetRef())->GetPseudoPrefix(); +} +BOOL SvMetaSlot::GetMenuConfig() const +{ + if( aMenuConfig.IsSet() || !GetRef() ) return aMenuConfig; + return ((SvMetaSlot *)GetRef())->GetMenuConfig(); +} +BOOL SvMetaSlot::GetToolBoxConfig() const +{ + if( aToolBoxConfig.IsSet() || !GetRef() ) return aToolBoxConfig; + return ((SvMetaSlot *)GetRef())->GetToolBoxConfig(); +} +BOOL SvMetaSlot::GetStatusBarConfig() const +{ + if( aStatusBarConfig.IsSet() || !GetRef() ) return aStatusBarConfig; + return ((SvMetaSlot *)GetRef())->GetStatusBarConfig(); +} +BOOL SvMetaSlot::GetAccelConfig() const +{ + if( aAccelConfig.IsSet() || !GetRef() ) return aAccelConfig; + return ((SvMetaSlot *)GetRef())->GetAccelConfig(); +} +BOOL SvMetaSlot::GetFastCall() const +{ + if( aFastCall.IsSet() || !GetRef() ) return aFastCall; + return ((SvMetaSlot *)GetRef())->GetFastCall(); +} +BOOL SvMetaSlot::GetContainer() const +{ + if( aContainer.IsSet() || !GetRef() ) return aContainer; + return ((SvMetaSlot *)GetRef())->GetContainer(); +} + +BOOL SvMetaSlot::GetPlugComm() const +{ + if( aPlugComm.IsSet() || !GetRef() ) return aPlugComm; + return ((SvMetaSlot *)GetRef())->GetPlugComm(); +} + +const ByteString& SvMetaSlot::GetUnoName() const +{ + if( aUnoName.IsSet() || !GetRef() ) return aUnoName; + return ((SvMetaSlot *)GetRef())->GetUnoName(); +} + +/************************************************************************* +|* SvMetaSlot::FillSbxObject() +|* +|* Beschreibung +*************************************************************************/ +/* +void SvMetaSlot::FillSbxObject( SvIdlDataBase & rBase, SbxObject * pObj, + BOOL bVariable ) +{ + // keine Attribut fuer Automation + if( !GetAutomation() || !GetExport() ) + return; + + if( !bVariable ) + { + SvMetaAttributeRef xM = GetMethod(); + if( xM.Is() ) + { + SvMetaType * pType = xM->GetType(); + SvMetaType * pRetBaseType = pType->GetReturnType()->GetBaseType(); + ByteString aName = xM->GetName(); + + SbxMethodRef xMeth = new SbxMethod( aName, + pRetBaseType->GetSbxDataType() ); + pType->FillSbxObject( xMeth, bVariable ); + xMeth->SetUserData( MakeSlotValue(rBase, FALSE) ); + + pObj->Insert( &xMeth ); + return; + } + } + + SvMetaAttribute::FillSbxObject( rBase, pObj, bVariable ); +} + */ + +#ifdef IDL_COMPILER +/************************************************************************* +|* SvMetaSlot::ReadAttributesSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaSlot::ReadAttributesSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm ) +{ + SvMetaAttribute::ReadAttributesSvIdl( rBase, rInStm ); + + BOOL bOk = FALSE; + bOk |= aDefault.ReadSvIdl( SvHash_Default(), rInStm ); + bOk |= aPseudoSlots.ReadSvIdl( SvHash_PseudoSlots(), rInStm ); + bOk |= aHasCoreId.ReadSvIdl( SvHash_HasCoreId(), rInStm ); + bOk |= aGroupId.ReadSvIdl( SvHash_GroupId(), rInStm ); + bOk |= aExecMethod.ReadSvIdl( SvHash_ExecMethod(), rInStm ); + bOk |= aStateMethod.ReadSvIdl( SvHash_StateMethod(), rInStm ); + bOk |= aDisableFlags.ReadSvIdl( SvHash_DisableFlags(), rInStm ); + if( aGet.ReadSvIdl( SvHash_Get(), rInStm ) ) + { + rBase.WriteError( "warning", ByteString( rInStm.GetFileName(), RTL_TEXTENCODING_UTF8 ), + "<Get> old style, use Readonly", + rInStm.GetToken()->GetLine(), + rInStm.GetToken()->GetColumn() ); + } + if( aSet.ReadSvIdl( SvHash_Set(), rInStm ) ) + { + rBase.WriteError( "warning", ByteString( rInStm.GetFileName(), RTL_TEXTENCODING_UTF8 ), + "<Set> old style, use method declaration", + rInStm.GetToken()->GetLine(), + rInStm.GetToken()->GetColumn() ); + } + + if( aCachable.ReadSvIdl( SvHash_Cachable(), rInStm ) ) + SetCachable( aCachable ), bOk = TRUE; + if( aVolatile.ReadSvIdl( SvHash_Volatile(), rInStm ) ) + SetVolatile( aVolatile ), bOk = TRUE; + if( aToggle.ReadSvIdl( SvHash_Toggle(), rInStm ) ) + SetToggle( aToggle ), bOk = TRUE; + if( aAutoUpdate.ReadSvIdl( SvHash_AutoUpdate(), rInStm ) ) + SetAutoUpdate( aAutoUpdate ), bOk = TRUE; + + if( aSynchron.ReadSvIdl( SvHash_Synchron(), rInStm ) ) + SetSynchron( aSynchron ), bOk = TRUE; + if( aAsynchron.ReadSvIdl( SvHash_Asynchron(), rInStm ) ) + SetAsynchron( aAsynchron ), bOk = TRUE; + + if( aRecordAbsolute.ReadSvIdl( SvHash_RecordAbsolute(), rInStm ) ) + SetRecordAbsolute( aRecordAbsolute), bOk = TRUE; + if( aRecordPerItem.ReadSvIdl( SvHash_RecordPerItem(), rInStm ) ) + SetRecordPerItem( aRecordPerItem ), bOk = TRUE; + if( aRecordPerSet.ReadSvIdl( SvHash_RecordPerSet(), rInStm ) ) + SetRecordPerSet( aRecordPerSet ), bOk = TRUE; + if( aRecordManual.ReadSvIdl( SvHash_RecordManual(), rInStm ) ) + SetRecordManual( aRecordManual ), bOk = TRUE; + if( aNoRecord.ReadSvIdl( SvHash_NoRecord(), rInStm ) ) + SetNoRecord( aNoRecord ), bOk = TRUE; + + bOk |= aHasDialog.ReadSvIdl( SvHash_HasDialog(), rInStm ); + bOk |= aPseudoPrefix.ReadSvIdl( SvHash_PseudoPrefix(), rInStm ); + bOk |= aMenuConfig.ReadSvIdl( SvHash_MenuConfig(), rInStm ); + bOk |= aToolBoxConfig.ReadSvIdl( SvHash_ToolBoxConfig(), rInStm ); + bOk |= aStatusBarConfig.ReadSvIdl( SvHash_StatusBarConfig(), rInStm ); + bOk |= aAccelConfig.ReadSvIdl( SvHash_AccelConfig(), rInStm ); + + SvBOOL aAllConfig; + if( aAllConfig.ReadSvIdl( SvHash_AllConfig(), rInStm ) ) + SetAllConfig( aAllConfig ), bOk = TRUE; + bOk |= aFastCall.ReadSvIdl( SvHash_FastCall(), rInStm ); + bOk |= aContainer.ReadSvIdl( SvHash_Container(), rInStm ); + bOk |= aPlugComm.ReadSvIdl( SvHash_PlugComm(), rInStm ); + bOk |= aUnoName.ReadSvIdl( SvHash_UnoName(), rInStm ); + + if( !bOk ) + { + if( !aSlotType.Is() ) + { + UINT32 nTokPos = rInStm.Tell(); + SvToken * pTok = rInStm.GetToken_Next(); + if( pTok->Is( SvHash_SlotType() ) ) + { + BOOL bBraket = rInStm.Read( '(' ); + if( bBraket || rInStm.Read( '=' ) ) + { + aSlotType = rBase.ReadKnownType( rInStm ); + if( aSlotType.Is() ) + { + if( aSlotType->IsItem() ) + { + if( bBraket ) + { + if( rInStm.Read( ')' ) ) + return; + } + else + return; + } + rBase.SetError( "the SlotType is not a item", rInStm.GetToken() ); + rBase.WriteError( rInStm ); + } + rBase.SetError( "SlotType with unknown item type", rInStm.GetToken() ); + rBase.WriteError( rInStm ); + } + } + rInStm.Seek( nTokPos ); + + } + if( !aMethod.Is() ) + { + SvToken * pTok = rInStm.GetToken(); + if( pTok->IsIdentifier() ) + { + aMethod = new SvMetaSlot(); + UINT32 nTokPos = rInStm.Tell(); + if( aMethod->ReadSvIdl( rBase, rInStm ) ) + { + if( aMethod->IsMethod() ) + { + aMethod->SetSlotId( GetSlotId() ); + if( aMethod->Test( rBase, rInStm ) ) + return; + } + rInStm.Seek( nTokPos ); + } + aMethod.Clear(); + } + } + } +} + +/************************************************************************* +|* SvMetaSlot::WriteAttributesSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaSlot::WriteAttributesSvIdl( SvIdlDataBase & rBase, + SvStream & rOutStm, + USHORT nTab ) +{ + SvMetaAttribute::WriteAttributesSvIdl( rBase, rOutStm, nTab ); + + if( aSlotType.Is() ) + { + WriteTab( rOutStm, nTab ); + rOutStm << SvHash_SlotType()->GetName().GetBuffer() << '('; + aSlotType->WriteTheType( rBase, rOutStm, nTab, WRITE_IDL ); + rOutStm << ");" << endl; + } + if( aMethod.Is() ) + { + WriteTab( rOutStm, nTab ); + aMethod->WriteSvIdl( rBase, rOutStm, nTab ); + rOutStm << ';' << endl; + } + if( aHasCoreId ) + { + aHasCoreId.WriteSvIdl( SvHash_HasCoreId(), rOutStm ); + rOutStm << ';' << endl; + } + if( aGroupId.Len() ) + { + WriteTab( rOutStm, nTab ); + aGroupId.WriteSvIdl( SvHash_GroupId(), rOutStm, nTab +1); + rOutStm << ';' << endl; + } + if( aExecMethod.Len() ) + { + WriteTab( rOutStm, nTab ); + aExecMethod.WriteSvIdl( SvHash_ExecMethod(), rOutStm, nTab +1); + rOutStm << ';' << endl; + } + if( aStateMethod.Len() ) + { + WriteTab( rOutStm, nTab ); + aStateMethod.WriteSvIdl( SvHash_StateMethod(), rOutStm, nTab +1); + rOutStm << ';' << endl; + } + + if( aDisableFlags.Len() ) + { + WriteTab( rOutStm, nTab ); + aDisableFlags.WriteSvIdl( SvHash_DisableFlags(), rOutStm, nTab +1); + rOutStm << ';' << endl; + } + + if( aSet || aGet || aPseudoSlots ) + { + WriteTab( rOutStm, nTab ); + char * p = ""; + if( aPseudoSlots ) + { + aPseudoSlots.WriteSvIdl( SvHash_PseudoSlots(), rOutStm ); + p = ", "; + } + if( aGet ) + { + rOutStm << p; + aGet.WriteSvIdl( SvHash_Get(), rOutStm ); + p = ", "; + } + if( aSet ) + { + rOutStm << p; + aSet.WriteSvIdl( SvHash_Set(), rOutStm ); + } + rOutStm << ';' << endl; + } + + ByteString aDel( ", " ); + ByteString aOut; + if( aVolatile ) + aOut += aVolatile.GetSvIdlString( SvHash_Volatile() ); + else if( !aCachable ) + // wegen Default == TRUE, nur wenn kein anderer gesetzt + aOut += aCachable.GetSvIdlString( SvHash_Cachable() ); + else + aDel.Erase(); + + if( aToggle ) + { + ( aOut += aDel ) += aToggle.GetSvIdlString( SvHash_Toggle() ); + aDel = ", "; + } + if( aAutoUpdate ) + { + (aOut += aDel ) += aAutoUpdate.GetSvIdlString( SvHash_AutoUpdate() ); + aDel = ", "; + } + + ByteString aDel1( ", " ); + if( aAsynchron ) + ( aOut += aDel ) += aAsynchron.GetSvIdlString( SvHash_Asynchron() ); + else if( !aSynchron ) + // wegen Default == TRUE, nur wenn kein anderer gesetzt + ( aOut += aDel ) += aSynchron.GetSvIdlString( SvHash_Synchron() ); + else + aDel1 = aDel; + + aDel = ", "; + if( aRecordManual ) + ( aOut += aDel1 ) += aRecordManual.GetSvIdlString( SvHash_RecordManual() ); + else if( aNoRecord ) + ( aOut += aDel1 ) += aNoRecord.GetSvIdlString( SvHash_NoRecord() ); + else if( !aRecordPerSet ) + // wegen Default == TRUE, nur wenn kein anderer gesetzt + ( aOut += aDel1 ) += aRecordPerSet.GetSvIdlString( SvHash_RecordPerSet() ); + else if( aRecordPerItem ) + ( aOut += aDel1 ) += aRecordPerItem.GetSvIdlString( SvHash_RecordPerItem() ); + else + aDel = aDel1; + + if( aRecordAbsolute ) + { + ( aOut += aDel ) += aRecordAbsolute.GetSvIdlString( SvHash_RecordAbsolute() ); + aDel = ", "; + } + if( aHasDialog ) + { + ( aOut += aDel ) += aHasDialog.GetSvIdlString( SvHash_HasDialog() ); + aDel = ", "; + } + if( aMenuConfig ) + { + ( aOut += aDel ) += aMenuConfig.GetSvIdlString( SvHash_MenuConfig() ); + aDel = ", "; + } + if( aToolBoxConfig ) + { + ( aOut += aDel ) += aToolBoxConfig.GetSvIdlString( SvHash_ToolBoxConfig() ); + aDel = ", "; + } + if( aStatusBarConfig ) + { + ( aOut += aDel ) += aStatusBarConfig.GetSvIdlString( SvHash_StatusBarConfig() ); + aDel = ", "; + } + if( aAccelConfig ) + { + ( aOut += aDel ) += aAccelConfig.GetSvIdlString( SvHash_AccelConfig() ); + aDel = ", "; + } + if( aFastCall ) + { + ( aOut += aDel ) += aFastCall.GetSvIdlString( SvHash_FastCall() ); + aDel = ", "; + } + if( aContainer ) + { + ( aOut += aDel ) += aContainer.GetSvIdlString( SvHash_Container() ); + aDel = ", "; + } + if( aPlugComm ) + { + ( aOut += aDel ) += aPlugComm.GetSvIdlString( SvHash_PlugComm() ); + aDel = ", "; + } + + if( aOut.Len() ) + { + WriteTab( rOutStm, nTab ); + rOutStm << aOut.GetBuffer() << endl; + } +} + + +/************************************************************************* +|* SvMetaSlot::Test() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaSlot::Test( SvIdlDataBase & rBase, SvTokenStream & rInStm ) +{ + BOOL bOk = SvMetaAttribute::Test( rBase, rInStm ); + if( bOk ) + { + SvMetaType * pType = GetType(); + if( pType->GetType() == TYPE_METHOD ) + pType = pType->GetReturnType(); + SvMetaType * pBaseType = pType->GetBaseType(); + if( !pType->IsItem() ) + { + rBase.SetError( "this attribute is not a slot", rInStm.GetToken() ); + rBase.WriteError( rInStm ); + bOk = FALSE; + } + } + +/* + if ( bOk ) + { + SvMetaSlot* pRef = (SvMetaSlot*) GetRef(); + if ( pRef ) + CompareSlotAttributes( pRef ); + } +*/ + return bOk; +} + +/************************************************************************* +|* SvMetaSlot::ReadSvIdl() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaSlot::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm ) +{ + UINT32 nTokPos = rInStm.Tell(); + BOOL bOk = TRUE; + + SvMetaAttribute * pAttr = rBase.ReadKnownAttr( rInStm, GetType() ); + if( pAttr ) + { + // F"ur Testzwecke: Referenz bei Kurz-Syntax + SvMetaSlot * pKnownSlot = PTR_CAST( SvMetaSlot, pAttr ); + if( pKnownSlot ) + { + SetRef( pKnownSlot ); + SetName( pKnownSlot->GetName(), &rBase ); + bOk = SvMetaName::ReadSvIdl( rBase, rInStm ); + } + else + { + ByteString aStr( "attribute " ); + aStr += pAttr->GetName(); + aStr += " is method or variable but not a slot"; + rBase.SetError( aStr, rInStm.GetToken() ); + rBase.WriteError( rInStm ); + bOk = FALSE; + } + } + else + { + bOk = SvMetaAttribute::ReadSvIdl( rBase, rInStm ); + + SvMetaAttribute *pAttr = rBase.SearchKnownAttr( GetSlotId() ); + if( pAttr ) + { + // F"ur Testzwecke: Referenz bei kompletter Definition + SvMetaSlot * pKnownSlot = PTR_CAST( SvMetaSlot, pAttr ); + if( pKnownSlot ) + { + SetRef( pKnownSlot ); + + // Namen d"urfen abweichen, da mit angegeben +// SetName( pKnownSlot->GetName(), &rBase ); + } + else + { + ByteString aStr( "attribute " ); + aStr += pAttr->GetName(); + aStr += " is method or variable but not a slot"; + rBase.SetError( aStr, rInStm.GetToken() ); + rBase.WriteError( rInStm ); + bOk = FALSE; + } + } + } + + if( !bOk ) + rInStm.Seek( nTokPos ); + + return bOk; +} + +/************************************************************************* +|* SvMetaSlot::WriteSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaSlot::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab ) +{ + SvMetaAttribute::WriteSvIdl( rBase, rOutStm, nTab ); +} + +/************************************************************************* +|* SvMetaSlot::Write() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaSlot::Write( SvIdlDataBase & rBase, + SvStream & rOutStm, USHORT nTab, + WriteType nT, WriteAttribute nA ) +{ + if ( nT == WRITE_DOCU ) + { + if ( GetHidden() ) + return; + } + else + { + // keine Attribut fuer Automation + if( !GetAutomation() || !GetExport() ) + return; + } + + if( !(nA & WA_VARIABLE) ) + { + SvMetaAttributeRef xM = GetMethod(); + if( xM.Is() ) + { + xM->SetSlotId( GetSlotId() ); + xM->SetDescription( GetDescription() ); + xM->Write( rBase, rOutStm, nTab, nT, nA ); + return; + } + } + + SvMetaAttribute::Write( rBase, rOutStm, nTab, nT, nA ); +} + + +void SvMetaSlot::Insert( SvSlotElementList& rList, const ByteString & rPrefix, + SvIdlDataBase& rBase) +{ + // Einf"ugeposition durch bin"are Suche in der SlotListe ermitteln + USHORT nId = (USHORT) GetSlotId().GetValue(); + USHORT nListCount = (USHORT) rList.Count(); + USHORT nPos; + if ( !nListCount ) + nPos = 0; + else if ( nListCount == 1 ) + nPos = rList.GetObject(0)->xSlot->GetSlotId().GetValue() >= nId ? 0 : 1; + else + { + USHORT nMid, nLow = 0; + USHORT nHigh = nListCount - 1; + BOOL bFound = FALSE; + while ( !bFound && nLow <= nHigh ) + { + nMid = (nLow + nHigh) >> 1; + DBG_ASSERT( nMid < nListCount, "bsearch ist buggy" ); + int nDiff = (int) nId - (int) rList.GetObject(nMid)->xSlot->GetSlotId().GetValue(); + if ( nDiff < 0) + { + if ( nMid == 0 ) + break; + nHigh = nMid - 1; + } + else if ( nDiff > 0 ) + { + nLow = nMid + 1; + if ( nLow == 0 ) + break; + } + else + bFound = TRUE; + } + + DBG_ASSERT(!bFound, "SlotId ist doppelt !"); + nPos = bFound ? nMid : nLow; + } + + DBG_ASSERT( nPos <= nListCount, + "nPos zu gro" ); + DBG_ASSERT( nPos == nListCount || nId <= + (USHORT) rList.GetObject(nPos)->xSlot->GetSlotId().GetValue(), + "Nachfolger hat kleinere SlotId" ); + DBG_ASSERT( nPos == 0 || nId > + (USHORT) rList.GetObject(nPos-1)->xSlot->GetSlotId().GetValue(), + "Vorgnger hat grere SlotId" ); + DBG_ASSERT( nPos+1 >= nListCount || nId < + (USHORT) rList.GetObject(nPos+1)->xSlot->GetSlotId().GetValue(), + "Nachfolger hat kleinere SlotId" ); + + rList.Insert( new SvSlotElement( this, rPrefix ), nPos ); + + // EnumSlots plattklopfen + SvMetaTypeEnum * pEnum = NULL; + SvMetaType * pBType = GetType()->GetBaseType(); + pEnum = PTR_CAST( SvMetaTypeEnum, pBType ); + if( GetPseudoSlots() && pEnum && pEnum->Count() ) + { + // Den MasterSlot clonen + SvMetaSlotRef xEnumSlot = Clone(); + SvMetaSlot *pFirstEnumSlot = xEnumSlot; + for( ULONG n = 0; n < pEnum->Count(); n++ ) + { + // Die Slaves sind kein Master ! + xEnumSlot->aPseudoSlots = FALSE; + + // Die SlotId erzeugen + SvMetaEnumValue *pEnumValue = pEnum->GetObject(n); + xEnumSlot->SetEnumValue(pEnumValue); + ByteString aValName = pEnumValue->GetName(); + ByteString aSId( GetSlotId() ); + if( GetPseudoPrefix().Len() ) + aSId = GetPseudoPrefix(); + aSId += '_'; + USHORT nLen = pEnum->GetPrefix().Len(); + aSId += aValName.Copy( pEnum->GetPrefix().Len() ); + + ULONG nValue; + if ( rBase.FindId(aSId , &nValue) ) + { + SvNumberIdentifier aId; + *((SvIdentifier*)&aId) = aSId; + aId.SetValue(nValue); + xEnumSlot->SetSlotId(aId); + } + + if ( xEnumSlot->GetSlotId().GetValue() < + pFirstEnumSlot->GetSlotId().GetValue() ) + { + pFirstEnumSlot = xEnumSlot; + } + + // Den erzeugten Slave ebenfalls einf"ugen + xEnumSlot->Insert( rList, rPrefix, rBase); + + // Die EnumSlots mit dem Master verketten + xEnumSlot->pLinkedSlot = this; + + // N"achster EnumSlot + if ( n != pEnum->Count() - 1 ) + xEnumSlot = Clone(); + } + + // Master zeigt auf den ersten Slave + pLinkedSlot = pFirstEnumSlot; + + // Slaves untereinander verketten + rList.Seek(0UL); + xEnumSlot = pFirstEnumSlot; + SvSlotElement *pEle; + do + { + pEle = rList.Next(); + if ( pEle && pEle->xSlot->pLinkedSlot == this ) + { + xEnumSlot->pNextSlot = pEle->xSlot; + xEnumSlot = pEle->xSlot; + } + } + while ( pEle ); + xEnumSlot->pNextSlot = pFirstEnumSlot; + } +} + + +/************************************************************************* +|* SvMetaSlot::WriteSlotMap() +|* +|* Beschreibung +*************************************************************************/ +static ByteString MakeSlotName( SvStringHashEntry * pEntry ) +{ + ByteString aName( "SFX_SLOT_" ); + aName += pEntry->GetName(); + return aName.ToUpperAscii(); +}; + +void SvMetaSlot::WriteSlotStubs( const ByteString & rShellName, + ByteStringList & rList, + SvStream & rOutStm ) +{ +/* + ByteString aName = GetName(); + SvMetaAttribute * pAttr = rAttrList.First(); + while( pAttr ) + { + if( pAttr->GetName() == aName ) + break; + pAttr = rAttrList.Next(); + } + if( pAttr ) + return; +*/ + if ( !GetExport() && !GetHidden() ) + return; + + ByteString aMethodName( GetExecMethod() ); + if ( aMethodName.Len() && aMethodName != "NoExec" ) + { + BOOL bIn = FALSE; + for( USHORT n = 0; n < rList.Count(); n++ ) + { + if( *(rList.GetObject(n)) == aMethodName ) + { + bIn=TRUE; + break; + } + } + + if ( !bIn ) + { + rList.Insert( new ByteString(aMethodName), LIST_APPEND ); + rOutStm << "SFX_EXEC_STUB(" + << rShellName.GetBuffer() + << ',' + << aMethodName.GetBuffer() + << ')' << endl; + } + } + + aMethodName = GetStateMethod(); + if ( aMethodName.Len() && aMethodName != "NoState" ) + { + BOOL bIn = FALSE; + for ( USHORT n=0; n < rList.Count(); n++ ) + { + if ( *(rList.GetObject(n)) == aMethodName ) + { + bIn=TRUE; + break; + } + } + + if ( !bIn ) + { + rList.Insert( new ByteString(aMethodName), LIST_APPEND ); + rOutStm << "SFX_STATE_STUB(" + << rShellName.GetBuffer() + << ',' + << aMethodName.GetBuffer() + << ')' << endl; + } + } +} + +void SvMetaSlot::WriteSlot( const ByteString & rShellName, USHORT nCount, + const ByteString & rSlotId, + const ByteString & rValueName, + SvSlotElementList& rSlotList, + const ByteString & rPrefix, + SvIdlDataBase & rBase, SvStream & rOutStm ) +{ + if ( !GetExport() && !GetHidden() ) + return; + +// BOOL bIsEnumSlot = 0 != rValueName.Len(); + BOOL bIsEnumSlot = 0 != pEnumValue; + + rOutStm << "// Slot Nr. " << ByteString::CreateFromInt32(nListPos).GetBuffer() << " : "; + ByteString aSlotIdValue( ByteString::CreateFromInt32( GetSlotId().GetValue() ) ); + rOutStm << aSlotIdValue.GetBuffer() << endl; + WriteTab( rOutStm, 1 ); + if( bIsEnumSlot ) + rOutStm << "SFX_NEW_SLOT_ENUM( "; + else + rOutStm << "SFX_NEW_SLOT_ARG( " << rShellName.GetBuffer() << ',' ; + + rOutStm << rSlotId.GetBuffer() << ','; + const SvHelpContext& rHlpCtx = GetHelpContext(); + if( rHlpCtx.IsSet() ) + rOutStm << rHlpCtx.GetBuffer() << ','; + else + rOutStm << rSlotId.GetBuffer() << ','; + + // GroupId + if( GetGroupId().Len() ) + rOutStm << GetGroupId().GetBuffer(); + else + rOutStm << '0'; + rOutStm << ',' << endl; + WriteTab( rOutStm, 4 ); + + if( bIsEnumSlot ) + { + rOutStm << "&a" << rShellName.GetBuffer() << "Slots_Impl[" + << ByteString::CreateFromInt32(pLinkedSlot->GetListPos()).GetBuffer() + << "] /*Offset Master*/, " << endl; + WriteTab( rOutStm, 4 ); + rOutStm << "&a" << rShellName.GetBuffer() << "Slots_Impl[" + << ByteString::CreateFromInt32(pNextSlot->GetListPos()).GetBuffer() + << "] /*Offset Next*/, " << endl; + + WriteTab( rOutStm, 4 ); + + // SlotId + if( GetSlotId().Len() ) + rOutStm << pLinkedSlot->GetSlotId().GetBuffer(); + else + rOutStm << '0'; + rOutStm << ','; + rOutStm << pEnumValue->GetName().GetBuffer(); + } + else + { + // Den n"achsten Slot suchen, der die gleiche StateMethod hat wie ich + // Die SlotList ist auf den aktuellen Slot geseekt + SvSlotElement * pEle = rSlotList.Next(); + pNextSlot = pEle ? &pEle->xSlot : NULL; + while ( pNextSlot ) + { + if ( !pNextSlot->pNextSlot && + pNextSlot->GetStateMethod() == GetStateMethod() ) + break; + pEle = rSlotList.Next(); + pNextSlot = pEle ? &pEle->xSlot : NULL; + } + + if ( !pNextSlot ) + { + // Es gibt nach mir keinen Slot mehr, der die gleiche ExecMethode + // hat. Also suche ich den ersten Slot, der diese hatte (das + // k"onnte auch ich selbst sein) + pEle = rSlotList.First(); + pNextSlot = pEle ? &pEle->xSlot : NULL; + while ( pNextSlot != this ) + { + if ( !pNextSlot->pEnumValue && + pNextSlot->GetStateMethod() == GetStateMethod() ) + break; + pEle = rSlotList.Next(); + pNextSlot = pEle ? &pEle->xSlot : NULL; + } + } + + if ( !pLinkedSlot ) + { + rOutStm << "0 ,"; + } + else + { + rOutStm << "&a" << rShellName.GetBuffer() << "Slots_Impl[" + << ByteString::CreateFromInt32(pLinkedSlot->GetListPos()).GetBuffer() + << "] /*Offset Linked*/, " << endl; + WriteTab( rOutStm, 4 ); + } + + rOutStm << "&a" << rShellName.GetBuffer() << "Slots_Impl[" + << ByteString::CreateFromInt32(pNextSlot->GetListPos()).GetBuffer() + << "] /*Offset Next*/, " << endl; + + WriteTab( rOutStm, 4 ); + + // ExecMethod schreiben, wenn nicht angegeben, standard Namen + if( GetExecMethod().Len() && GetExecMethod() != "NoExec") + rOutStm << "SFX_STUB_PTR(" << rShellName.GetBuffer() << ',' + << GetExecMethod().GetBuffer() << ')'; + else + rOutStm << "SFX_STUB_PTR_EXEC_NONE"; + rOutStm << ','; + + // StateMethod schreiben, wenn nicht angegeben, standard Namen + if( GetStateMethod().Len() && GetStateMethod() != "NoState") + rOutStm << "SFX_STUB_PTR(" << rShellName.GetBuffer() << ',' + << GetStateMethod().GetBuffer() << ')'; + else + rOutStm << "SFX_STUB_PTR_STATE_NONE"; + } + rOutStm << ',' << endl; + WriteTab( rOutStm, 4 ); + + // Flags schreiben + if( GetHasCoreId() ) + rOutStm << MakeSlotName( SvHash_HasCoreId() ).GetBuffer() << '|'; + if( GetCachable() ) + rOutStm << MakeSlotName( SvHash_Cachable() ).GetBuffer() << '|'; + if( GetVolatile() ) + rOutStm << MakeSlotName( SvHash_Volatile() ).GetBuffer() << '|'; + if( GetToggle() ) + rOutStm << MakeSlotName( SvHash_Toggle() ).GetBuffer() << '|'; + if( GetAutoUpdate() ) + rOutStm << MakeSlotName( SvHash_AutoUpdate() ).GetBuffer() << '|'; + if( GetSynchron() ) + rOutStm << MakeSlotName( SvHash_Synchron() ).GetBuffer() << '|'; + if( GetAsynchron() ) + rOutStm << MakeSlotName( SvHash_Asynchron() ).GetBuffer() << '|'; + if( GetRecordPerItem() ) + rOutStm << MakeSlotName( SvHash_RecordPerItem() ).GetBuffer() << '|'; + if( GetRecordPerSet() ) + rOutStm << MakeSlotName( SvHash_RecordPerSet() ).GetBuffer() << '|'; + if( GetRecordManual() ) + rOutStm << MakeSlotName( SvHash_RecordManual() ).GetBuffer() << '|'; + if( GetNoRecord() ) + rOutStm << MakeSlotName( SvHash_NoRecord() ).GetBuffer() << '|'; + if( GetRecordAbsolute() ) + rOutStm << MakeSlotName( SvHash_RecordAbsolute() ).GetBuffer() << '|'; + if( GetHasDialog() ) + rOutStm << MakeSlotName( SvHash_HasDialog() ).GetBuffer() << '|'; + if( GetMenuConfig() ) + rOutStm << MakeSlotName( SvHash_MenuConfig() ).GetBuffer() << '|'; + if( GetToolBoxConfig() ) + rOutStm << MakeSlotName( SvHash_ToolBoxConfig() ).GetBuffer() << '|'; + if( GetStatusBarConfig() ) + rOutStm << MakeSlotName( SvHash_StatusBarConfig() ).GetBuffer() << '|'; + if( GetAccelConfig() ) + rOutStm << MakeSlotName( SvHash_AccelConfig() ).GetBuffer() << '|'; + if( GetFastCall() ) + rOutStm << MakeSlotName( SvHash_FastCall() ).GetBuffer() << '|'; + if( GetContainer() ) + rOutStm << MakeSlotName( SvHash_Container() ).GetBuffer() << '|'; + if ( GetReadOnlyDoc() ) + rOutStm << MakeSlotName( SvHash_ReadOnlyDoc() ).GetBuffer() << '|'; + if( GetPlugComm() ) + rOutStm << MakeSlotName( SvHash_PlugComm() ).GetBuffer() << '|'; + + rOutStm << '0'; + + rOutStm << ',' << endl; + WriteTab( rOutStm, 4 ); + if ( !GetDisableFlags().Len() ) + rOutStm << "0"; + else + rOutStm << GetDisableFlags().GetBuffer(); + + // Attribut Typ schreiben + if( !bIsEnumSlot ) + { + rOutStm << ',' << endl; + WriteTab( rOutStm, 4 ); + + SvMetaType * pT = GetSlotType(); + if( !pT ) + { + if( !IsVariable() ) + pT = rBase.FindType( "SfxVoidItem" ); + else + pT = GetType(); + } + if( pT ) + { + rOutStm << pT->GetName().GetBuffer(); + if( !rBase.FindType( pT, rBase.aUsedTypes ) ) + rBase.aUsedTypes.Append( pT ); + } + else + rOutStm << "SfxVoidItem not defined"; + } + else + { + SvMetaType *pT = rBase.FindType( "SfxBoolItem" ); + if ( pT && !rBase.FindType( pT, rBase.aUsedTypes ) ) + rBase.aUsedTypes.Append( pT ); + } + + if( !bIsEnumSlot ) + { + rOutStm << ',' << endl; + WriteTab( rOutStm, 4 ); + rOutStm << ByteString::CreateFromInt32( nCount ).GetBuffer() << "/*Offset*/, "; + + if( IsMethod() ) + { + SvMetaAttribute * pMethod = GetMethod(); + SvMetaType * pType; + if( pMethod ) + pType = pMethod->GetType(); + else + pType = GetType(); + ULONG nSCount = pType->GetAttrCount(); + rOutStm << ByteString::CreateFromInt32( nSCount ).GetBuffer() << "/*Count*/"; + } + else + rOutStm << '0'; + + // Name f"urs Recording + if ( GetExport() ) + { + rOutStm << ",\""; + if( rPrefix.Len() ) + rOutStm << rPrefix.GetBuffer(); + rOutStm << '.'; + if ( !IsVariable() || !GetType() || + GetType()->GetBaseType()->GetType() != TYPE_STRUCT ) + rOutStm << GetMangleName( FALSE ).GetBuffer(); + rOutStm << "\","; + } + else + rOutStm << ", 0, "; + + // Method/Property Flags + if( IsMethod() ) + rOutStm << "SFX_SLOT_METHOD|"; + if( IsVariable() ) + { + rOutStm << "SFX_SLOT_PROPGET|"; + if( !GetReadonly() ) + rOutStm << "SFX_SLOT_PROPSET|"; + } + + rOutStm << '0'; + } + + if ( GetUnoName().Len() ) + { + rOutStm << ",\""; + rOutStm << GetUnoName().GetBuffer(); + rOutStm << "\""; + } + else + rOutStm << ", 0"; + + rOutStm << " )," << endl; +} + +USHORT SvMetaSlot::WriteSlotParamArray( SvIdlDataBase & rBase, SvStream & rOutStm ) +{ + if ( !GetExport() && !GetHidden() ) + return 0; + + SvMetaAttribute * pMethod = GetMethod(); + if( IsMethod() ) + { + SvMetaType * pType; + if( pMethod ) + pType = pMethod->GetType(); + else + pType = GetType(); + + if( !rBase.FindType( pType, rBase.aUsedTypes ) ) + rBase.aUsedTypes.Append( pType ); + + const SvMetaAttributeMemberList & rList = + pType->GetAttrList(); + for( ULONG n = 0; n < rList.Count(); n++ ) + { + SvMetaAttribute * pPar = rList.GetObject( n ); + SvMetaType * pPType = pPar->GetType(); + WriteTab( rOutStm, 1 ); + rOutStm << "SFX_ARGUMENT(" + << pPar->GetSlotId().GetBuffer() << ',' // SlodId + // Parameter Name + << "\"" << pPar->GetName().GetBuffer() << "\"," + // Item Name + << pPType->GetName().GetBuffer() << ")," << endl; + if( !rBase.FindType( pPType, rBase.aUsedTypes ) ) + rBase.aUsedTypes.Append( pPType ); + } + return (USHORT)rList.Count(); + } + return 0; +} + +USHORT SvMetaSlot::WriteSlotMap( const ByteString & rShellName, USHORT nCount, + SvSlotElementList& rSlotList, + const ByteString & rPrefix, + SvIdlDataBase & rBase, + SvStream & rOutStm ) +{ + // SlotId, wenn nicht angegeben, aus Namen generieren + ByteString aSlotId = GetSlotId(); + + USHORT nSCount = 0; + if( IsMethod() ) + { + SvMetaType * pType; + SvMetaAttribute * pMethod = GetMethod(); + if( pMethod ) + pType = pMethod->GetType(); + else + pType = GetType(); + + nSCount = (USHORT)pType->GetAttrCount(); + } + + WriteSlot( rShellName, nCount, aSlotId, ByteString(), + rSlotList, rPrefix, rBase, rOutStm ); +/* + SvMetaTypeEnum * pEnum = NULL; + SvMetaType * pBType = GetType()->GetBaseType(); + pEnum = PTR_CAST( SvMetaTypeEnum, pBType ); + if( aPseudoSlots && pEnum ) + { + rBase.nMasterPos = rBase.nSlotPos-1; + rBase.nEnumPos = rBase.nMasterPos + pEnum->Count() + 1; + + for( ULONG n = 0; n < pEnum->Count(); n++ ) + { + ByteString aValName = pEnum->GetObject( n )->GetName(); + ByteString aSId( aSlotId ); + if( GetPseudoPrefix().Len() ) + aSId = GetPseudoPrefix(); + aSId += '_'; + USHORT nLen = pEnum->GetPrefix().Len(); + aSId += aValName.Copy( pEnum->GetPrefix().Len() ); + WriteSlot( rShellName, nCount + nSCount, aSId, aValName, rSlotList, rBase, rOutStm ); + } + } +*/ + return nSCount; +} + +/************************************************************************* +|* SvMetaSlot::WriteSrc() +*************************************************************************/ +void SvMetaSlot::WriteSrc( SvIdlDataBase & rBase, SvStream & rOutStm, + Table * pTable ) +{ + if (!GetToolBoxConfig() && !GetAccelConfig() && !GetMenuConfig() && !GetStatusBarConfig() ) + return; + + ULONG nSId = GetSlotId().GetValue(); + if( !pTable->IsKeyValid( nSId ) ) + { + pTable->Insert( nSId, this ); + rOutStm << "SfxSlotInfo " << ByteString::CreateFromInt32( nSId ).GetBuffer() + << endl << '{' << endl; + + WriteTab( rOutStm, 1 ); + ByteString aStr = GetConfigName(); + if( !aStr.Len() ) + aStr = GetName(); + + rOutStm << "SlotName = \"" << aStr.GetBuffer() << "\";" << endl; + + aStr = GetHelpText(); + if( aStr.Len() ) + { + WriteTab( rOutStm, 1 ); + rOutStm << "HelpText = \"" << aStr.GetBuffer() << "\";" << endl; + } + + rOutStm << "};" << endl; + } + + SvMetaTypeEnum * pEnum = PTR_CAST( SvMetaTypeEnum, GetType() ); + if( GetPseudoSlots() && pEnum ) + { + for( ULONG n = 0; n < pEnum->Count(); n++ ) + { + ByteString aValName = pEnum->GetObject( n )->GetName(); + ByteString aSId( GetSlotId() ); + if( GetPseudoPrefix().Len() ) + aSId = GetPseudoPrefix(); + aSId += '_'; + USHORT nLen = pEnum->GetPrefix().Len(); + aSId += aValName.Copy( pEnum->GetPrefix().Len() ); + + ULONG nSId; + BOOL bIdOk = FALSE; + if( rBase.FindId( aSId, &nSId ) ) + { + aSId = ByteString::CreateFromInt32( nSId ); + bIdOk = TRUE; + } + + // wenn Id nicht gefunden, immer schreiben + if( !bIdOk || !pTable->IsKeyValid( nSId ) ) + { + pTable->Insert( nSId, this ); + rOutStm << "SfxSlotInfo " << aSId.GetBuffer() + << endl << '{' << endl; + + WriteTab( rOutStm, 1 ); + rOutStm << "SlotName = \"" << aValName.GetBuffer() << "\";" << endl; + + ByteString aStr = GetHelpText(); + if( aStr.Len() ) + { + WriteTab( rOutStm, 1 ); + rOutStm << "HelpText = \"" << aStr.GetBuffer() << "\";" << endl; + } + rOutStm << "};" << endl; + } + } + } +} + +void SvMetaSlot::WriteHelpId( SvIdlDataBase & rBase, SvStream & rOutStm, + Table * pTable ) +{ + ULONG nSId = GetSlotId().GetValue(); + if( !pTable->IsKeyValid( nSId ) ) + { + pTable->Insert( nSId, this ); + rOutStm << "#define " << GetSlotId().GetBuffer() << '\t' << ByteString::CreateFromInt32( nSId ).GetBuffer() << endl; + } + + SvMetaTypeEnum * pEnum = PTR_CAST( SvMetaTypeEnum, GetType() ); + if( GetPseudoSlots() && pEnum ) + { + for( ULONG n = 0; n < pEnum->Count(); n++ ) + { + ByteString aValName = pEnum->GetObject( n )->GetName(); + ByteString aSId( GetSlotId() ); + if( GetPseudoPrefix().Len() ) + aSId = GetPseudoPrefix(); + aSId += '_'; + USHORT nLen = pEnum->GetPrefix().Len(); + aSId += aValName.Copy( pEnum->GetPrefix().Len() ); + + ULONG nSId; + BOOL bIdOk = FALSE; + if( rBase.FindId( aSId, &nSId ) ) + { + aSId = ByteString::CreateFromInt32( nSId ); + bIdOk = TRUE; + } + + // wenn Id nicht gefunden, immer schreiben + if( !bIdOk || !pTable->IsKeyValid( nSId ) ) + { + pTable->Insert( nSId, this ); + + rOutStm << "#define " << aSId.GetBuffer() << '\t' + << ByteString::CreateFromInt32( nSId ).GetBuffer() << endl; + } + } + } +} + + +void SvMetaSlot::CompareSlotAttributes( SvMetaSlot* pSlot ) +{ + ByteString aStr = Compare( pSlot ); + + if ( GetMenuConfig() || GetToolBoxConfig() || GetAccelConfig() || GetStatusBarConfig() ) + { + if ( GetHelpText().Len() ) + { + ByteString aRefText( pSlot->GetHelpText() ); + ByteString aText( GetHelpText() ); + if ( !aText.Equals( aRefText ) ) + { + aStr += " HelpText\n"; + aStr += aText; + aStr += '\n'; + aStr += aRefText; + aStr += '\n'; + } + } + + if ( GetConfigName().Len() ) + { + ByteString aRefText( pSlot->GetConfigName() ); + ByteString aText( GetConfigName() ); + if ( !aText.Equals( aRefText ) ) + { + aStr += " ConfigName\n"; + aStr += aText; + aStr += '\n'; + aStr += aRefText; + aStr += '\n'; + } + } + } + + if ( GetExport() && !GetName().Equals( pSlot->GetName() ) ) + { + aStr += " Name\n"; + aStr += GetName(); + aStr += '\n'; + aStr += pSlot->GetName(); + aStr += '\n'; + } + + if ( (SvMetaType *)GetSlotType() != (SvMetaType *)pSlot->GetSlotType() ) + aStr += " SlotType\n"; + + if ( GetMethod() && !pSlot->GetMethod() || + !GetMethod() && pSlot->GetMethod() ) + aStr += " Method\n"; + + if ( GetMethod() && pSlot->GetMethod() ) + GetMethod()->Compare( pSlot->GetMethod() ); + + if ( !GetGroupId().Equals( pSlot->GetGroupId() ) ) + aStr += " GroupId\n"; + + if ( GetHasCoreId() != (BOOL) pSlot->GetHasCoreId() ) + aStr += " HasCoreId\n"; + + if ( !GetConfigId().Equals( pSlot->GetConfigId() ) ) + aStr += " ConfigId\n"; + + if ( !GetDefault().Equals( pSlot->GetDefault() ) ) + aStr += " Default\n"; + + if ( GetPseudoSlots() != pSlot->GetPseudoSlots() ) + aStr += " PseudoSlots\n"; + + if ( GetCachable() != pSlot->GetCachable() ) + aStr += " Cachable\n"; + + if ( GetVolatile() != pSlot->GetVolatile() ) + aStr += " Volatile"; + + if ( GetToggle() != pSlot->GetToggle() ) + aStr += " Toggle\n"; + + if ( GetAutoUpdate() != pSlot->GetAutoUpdate() ) + aStr += " AutoUpdate\n"; + + if ( GetSynchron() != pSlot->GetSynchron() ) + aStr += " Synchron\n"; + + if ( GetAsynchron() != pSlot->GetAsynchron() ) + aStr += " Asynchron\n"; + + if ( GetRecordPerItem() != pSlot->GetRecordPerItem() ) + aStr += " RecordPerItem\n"; + + if ( GetRecordPerSet() != pSlot->GetRecordPerSet() ) + aStr += " RecordPerSet\n"; + + if ( GetRecordManual() != pSlot->GetRecordManual() ) + aStr += " RecordManual\n"; + + if ( GetNoRecord() != pSlot->GetNoRecord() ) + aStr += " NoRecord\n"; + + if ( GetRecordAbsolute() != pSlot->GetRecordAbsolute() ) + aStr += " RecordAbsolute\n"; + + if ( GetHasDialog() != pSlot->GetHasDialog() ) + aStr += " HasDialog\n"; + + if ( GetMenuConfig() != pSlot->GetMenuConfig() ) + aStr += " MenuConfig\n"; + + if ( GetToolBoxConfig() != pSlot->GetToolBoxConfig() ) + aStr += " ToolBoxConfig\n"; + + if ( GetStatusBarConfig() != pSlot->GetStatusBarConfig() ) + aStr += " StatusBarConfig\n"; + + if ( GetAccelConfig() != pSlot->GetAccelConfig() ) + aStr += " AccelConfig\n"; + + if ( pSlot->GetFastCall() && !GetFastCall() ) + aStr += " FastCall\n"; + + if ( GetContainer() != pSlot->GetContainer() ) + aStr += " Container\n"; + + if ( GetPlugComm() != pSlot->GetPlugComm() ) + aStr += " PlugComm\n"; + + if ( !GetPseudoPrefix().Equals( pSlot->GetPseudoPrefix() ) ) + aStr += " PseudoPrefix\n"; + + if ( IsVariable() != pSlot->IsVariable() ) + aStr += " Variable\n"; + + if ( aStr.Len() ) + { + DBG_ERROR( GetSlotId().GetBuffer() ); + DBG_ERROR( aStr.GetBuffer() ); + } +} + +void WriteBool( BOOL bSet, SvStream& rStream ) +{ + if ( bSet ) + rStream << "TRUE" << ','; + else + rStream << "FALSE" << ','; +} + +void SvMetaSlot::WriteCSV( SvIdlDataBase& rBase, SvStream& rStrm ) +{ + rStrm << "PROJECT" << ",,"; + if ( GetSlotType() ) + rStrm << GetSlotType()->GetName().GetBuffer() << ','; + else + rStrm << ','; + + rStrm << GetType()->GetSvName().GetBuffer() << ','; + rStrm << GetName().GetBuffer() << ','; + rStrm << GetUnoName().GetBuffer() << ','; + rStrm << GetSlotId().GetBuffer() << ','; + USHORT nId = (USHORT) GetSlotId().GetValue(); + rStrm << ByteString::CreateFromInt32( GetSlotId().GetValue() ).GetBuffer() << ','; + rStrm << "\"" << GetConfigName().GetBuffer() << "\"" << ','; + rStrm << "\"" << GetHelpText().GetBuffer() << "\"" << ','; + + rStrm << ",,,"; + + WriteBool( GetAccelConfig(), rStrm ); + WriteBool( GetAutomation(), rStrm ); + WriteBool( GetAutoUpdate(), rStrm ); + + if ( GetCachable() ) + rStrm << "Cachable" << ','; + else + rStrm << "Volatile" << ','; + + WriteBool( GetContainer(), rStrm ); + WriteBool( GetExport(), rStrm ); + WriteBool( GetFastCall(), rStrm ); + WriteBool( GetHidden(), rStrm ); + + rStrm << GetGroupId().GetBuffer() << ','; + + rStrm << ','; + rStrm << GetDisableFlags().GetBuffer() << ','; + + WriteBool( GetHasCoreId(), rStrm ); + WriteBool( GetHasDialog(), rStrm ); + WriteBool( GetIsCollection(), rStrm ); + WriteBool( GetMenuConfig(), rStrm ); + WriteBool( GetPlugComm(), rStrm ); + WriteBool( GetReadonly(), rStrm ); + WriteBool( GetReadOnlyDoc(), rStrm ); + + if( GetRecordPerSet() ) + rStrm << "RecordPerSet" << ','; + else + rStrm << "RecordPerItem" << ','; + + WriteBool( GetRecordAbsolute(), rStrm ); + + rStrm << ','; + + WriteBool( GetStatusBarConfig(), rStrm ); + + if( GetSynchron() ) + rStrm << "Synchron" << ','; + else + rStrm << "Asynchron" << ','; + + WriteBool( GetToggle(), rStrm ); + WriteBool( GetToolBoxConfig(), rStrm ); + + if ( GetPseudoPrefix().Len() ) + rStrm << GetPseudoPrefix().GetBuffer() << ','; + else + rStrm << ','; + + rStrm << ','; + + if ( GetType()->GetType() != TYPE_METHOD && GetMethod() ) + { + rStrm << GetMethod()->GetType()->GetReturnType()->GetName().GetBuffer() << ','; + rStrm << GetMethod()->GetName().GetBuffer() << ','; + } + else + { + rStrm << ",,"; + } + + rStrm << "TRUE,"; + + if ( GetType()->GetType() == TYPE_METHOD || GetMethod() ) + { + SvMetaAttributeMemberList *pList = &GetType()->GetAttrList(); + if ( GetMethod() ) + pList = &GetMethod()->GetType()->GetAttrList(); + + if( pList && pList->Count() ) + { + rStrm << "\"("; + SvMetaAttribute* pAttr = pList->First(); + while( pAttr ) + { + pAttr->WriteCSV( rBase, rStrm ); + pAttr = pList->Next(); + if( pAttr ) + rStrm << ','; + } + rStrm << ")\""; + } + else + rStrm << "()"; + } + + rStrm << endl; +} + +#endif // IDL_COMPILER + + diff --git a/idl/source/objects/types.cxx b/idl/source/objects/types.cxx new file mode 100644 index 000000000000..82ea116b4d39 --- /dev/null +++ b/idl/source/objects/types.cxx @@ -0,0 +1,2840 @@ +/************************************************************************* + * + * $RCSfile: types.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________ + * + * + ************************************************************************/ + +#include <ctype.h> +#include <stdio.h> + +#include <tools/debug.hxx> + +#include <attrib.hxx> +#include <types.hxx> +#include <globals.hxx> +#include <database.hxx> +#pragma hdrstop + +/****************** SvMetaAttribute *************************************/ +/************************************************************************/ +SV_IMPL_META_FACTORY1( SvMetaAttribute, SvMetaReference ); +#ifdef IDL_COMPILER +SvAttributeList & SvMetaAttribute::GetAttributeList() +{ + if( !pAttribList ) + { + pAttribList = new SvAttributeList(); + } + return *pAttribList; +} +#endif +/************************************************************************* +|* SvMetaAttribute::SvMetaAttribute() +|* +|* Beschreibung +*************************************************************************/ +SvMetaAttribute::SvMetaAttribute() + : aExport( TRUE, FALSE ) + , aHidden( FALSE, FALSE ) + , aIsCollection ( FALSE, FALSE ) + , aReadOnlyDoc ( TRUE, FALSE ) + , aAutomation( TRUE, FALSE ) + , bNewAttr( FALSE ) +{ +} + +SvMetaAttribute::SvMetaAttribute( SvMetaType * pType ) + : aExport( TRUE, FALSE ) + , aHidden( FALSE, FALSE ) + , aAutomation( TRUE, FALSE ) + , aIsCollection ( FALSE, FALSE) + , aReadOnlyDoc ( TRUE, FALSE) + , aType( pType ) + , bNewAttr( FALSE ) +{ +} + +/************************************************************************* +|* SvMetaAttribute::Load() +|* SvMetaAttribute::Save() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaAttribute::Load( SvPersistStream & rStm ) +{ + SvMetaReference::Load( rStm ); + + BYTE nMask; + rStm >> nMask; + if( nMask >= 0x100 ) + { + rStm.SetError( SVSTREAM_FILEFORMAT_ERROR ); + DBG_ERROR( "wrong format" ) + return; + } + if( nMask & 0x01 ) + { + SvMetaType * pType; + rStm >> pType; + aType = pType; + } + if( nMask & 0x02 ) rStm >> aSlotId; + if( nMask & 0x04 ) rStm >> aExport; + if( nMask & 0x08 ) rStm >> aReadonly; + if( nMask & 0x10 ) rStm >> aAutomation; + if( nMask & 0x20 ) rStm >> aIsCollection; + if( nMask & 0x40 ) rStm >> aReadOnlyDoc; + if( nMask & 0x80 ) rStm >> aHidden; +} + +void SvMetaAttribute::Save( SvPersistStream & rStm ) +{ + SvMetaReference::Save( rStm ); + + // Maske erstellen + BYTE nMask = 0; + if( aType.Is() ) nMask |= 0x1; + if( aSlotId.IsSet() ) nMask |= 0x2; + if( aExport.IsSet() ) nMask |= 0x4; + if( aReadonly.IsSet() ) nMask |= 0x8; + if( aAutomation.IsSet() ) nMask |= 0x10; + if( aIsCollection.IsSet() ) nMask |= 0x20; + if( aReadOnlyDoc.IsSet() ) nMask |= 0x40; + if( aHidden.IsSet() ) nMask |= 0x80; + + // Daten schreiben + rStm << nMask; + if( nMask & 0x1 ) rStm << aType; + if( nMask & 0x2 ) rStm << aSlotId; + if( nMask & 0x4 ) rStm << aExport; + if( nMask & 0x8 ) rStm << aReadonly; + if( nMask & 0x10 ) rStm << aAutomation; + if( nMask & 0x20 ) rStm << aIsCollection; + if( nMask & 0x40 ) rStm << aReadOnlyDoc; + if( nMask & 0x80 ) rStm << aHidden; +} + +/************************************************************************* +|* SvMetaAttribute::GetType() +|* +|* Beschreibung +*************************************************************************/ +SvMetaType * SvMetaAttribute::GetType() const +{ + if( aType.Is() || !GetRef() ) return aType; + return ((SvMetaAttribute *)GetRef())->GetType(); +} + +/************************************************************************* +|* SvMetaAttribute::GetSlotId() +|* +|* Beschreibung +*************************************************************************/ +const SvNumberIdentifier & SvMetaAttribute::GetSlotId() const +{ + if( aSlotId.IsSet() || !GetRef() ) return aSlotId; + return ((SvMetaAttribute *)GetRef())->GetSlotId(); +} + +/************************************************************************* +|* SvMetaAttribute::GetReadonly() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaAttribute::GetReadonly() const +{ + if( aReadonly.IsSet() || !GetRef() ) return aReadonly; + return ((SvMetaAttribute *)GetRef())->GetReadonly(); +} + +/************************************************************************* +|* SvMetaAttribute::GetExport() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaAttribute::GetExport() const +{ + if( aExport.IsSet() || !GetRef() ) return aExport; + return ((SvMetaAttribute *)GetRef())->GetExport(); +} + +/************************************************************************* +|* SvMetaAttribute::GetHidden() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaAttribute::GetHidden() const +{ + // Wenn Export gesetzt wurde, aber Hidden nicht, gilt der Default + // aHidden = !aExport + if ( aExport.IsSet() && !aHidden.IsSet() ) + return !aExport; + else if( aHidden.IsSet() || !GetRef() ) + return aHidden; + else + return ((SvMetaAttribute *)GetRef())->GetHidden(); +} + +/************************************************************************* +|* SvMetaAttribute::GetAutomation() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaAttribute::GetAutomation() const +{ + if( aAutomation.IsSet() || !GetRef() ) return aAutomation; + return ((SvMetaAttribute *)GetRef())->GetAutomation(); +} + +BOOL SvMetaAttribute::GetIsCollection() const +{ + BOOL bRet; + if( aIsCollection.IsSet() || !GetRef() ) + { + if ( aIsCollection.IsSet() ) + { + bRet = aIsCollection; + return bRet; + } + + return aIsCollection; + } + + return ((SvMetaSlot *)GetRef())->GetIsCollection(); +} + +BOOL SvMetaAttribute::GetReadOnlyDoc() const +{ + if( aReadOnlyDoc.IsSet() || !GetRef() ) return aReadOnlyDoc; + return ((SvMetaSlot *)GetRef())->GetReadOnlyDoc(); +} + +/************************************************************************* +|* SvMetaAttribute::IsMethod() +|* SvMetaAttribute::IsVariable() +|* SvMetaAttribute::GetMangleName() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaAttribute::IsMethod() const +{ + SvMetaType * pType = GetType(); + DBG_ASSERT( pType, "no type for attribute" ) + return pType->GetType() == TYPE_METHOD; +} + +BOOL SvMetaAttribute::IsVariable() const +{ + SvMetaType * pType = GetType(); + return pType->GetType() != TYPE_METHOD; +} + +ByteString SvMetaAttribute::GetMangleName( BOOL bVariable ) const +{ + return GetName(); +} + +/************************************************************************* +|* SvMetaAttribute::FillSbxObject() +|* +|* Beschreibung +*************************************************************************/ +/* +void SvMetaAttribute::FillSbxObject( SbxInfo * pInfo, USHORT nSbxFlags ) +{ + SvMetaType * pType = GetType(); + DBG_ASSERT( pType, "no type for attribute" ) + if( !nSbxFlags ) + { // Flags koennen vom Aufrufer ueberschrieben werden + if( pType->GetOut() ) + { + nSbxFlags |= SBX_WRITE; + if( pType->GetIn() ) + nSbxFlags |= SBX_READ; + } + else + nSbxFlags |= SBX_READ; + } + SvMetaType * pBaseType = pType->GetBaseType(); + DBG_ASSERT( pBaseType, "no base type for attribute" ) + if( pBaseType->GetType() == TYPE_STRUCT ) + { + const SvMetaAttributeMemberList & rList = pBaseType->GetAttrList(); + ULONG nCount = rList.Count(); + for( ULONG i = 0; i < nCount; i++ ) + rList.GetObject( i )->FillSbxObject( pInfo, nSbxFlags ); + } + else + //MI: pInfo->AddParam( GetName(), pBaseType->GetSbxDataType(), nSbxFlags ); + pInfo->AddParam( GetName(), SbxVARIANT, nSbxFlags ); +} +*/ + +/************************************************************************* +|* SvMetaAttribute::FillSbxObject() +|* +|* Beschreibung +*************************************************************************/ +/* +void SvMetaAttribute::FillSbxObject( SvIdlDataBase & rBase, + SbxObject * pObj, BOOL bVariable ) +{ + // keine Attribut fuer Automation + if( !GetAutomation() || !GetExport() ) + return; + + if( bVariable && IsVariable() ) + { + SvMetaType * pType = GetType(); + DBG_ASSERT( pType, "no type for attribute" ) + SvMetaType * pBaseType = pType->GetBaseType(); + DBG_ASSERT( pBaseType, "no base type for attribute" ) + + if( pBaseType->GetType() == TYPE_STRUCT ) + { + SvNumberIdentifier aSlotId = rBase.aStructSlotId; + if ( GetSlotId().Len() ) + rBase.aStructSlotId = GetSlotId(); + const SvMetaAttributeMemberList & rList = pBaseType->GetAttrList(); + ULONG nCount = rList.Count(); + for( ULONG i = 0; i < nCount; i++ ) + rList.GetObject( i )->FillSbxObject( rBase, pObj, bVariable ); + rBase.aStructSlotId = aSlotId; + } + else + { + SbxPropertyRef xProp = new SbxProperty( GetName(), SbxVARIANT ); + //MI: pBaseType->GetSbxDataType() ); + if ( GetReadonly() || IsMethod() ) + xProp->ResetFlag( SBX_WRITE ); + xProp->SetUserData( MakeSlotValue( rBase, TRUE ) ); + pType->FillSbxObject( xProp, bVariable ); + + pObj->Insert( &xProp ); + } + } + else if( !bVariable && IsMethod() ) + { + SvMetaType * pType = GetType(); + SvMetaType * pRetBaseType = GetType()->GetReturnType()->GetBaseType(); + SbxMethodRef xMeth = new SbxMethod( GetName(), + pRetBaseType->GetSbxDataType() ); + xMeth->ResetFlag( SBX_WRITE ); + xMeth->SetUserData( MakeSlotValue( rBase, FALSE ) ); + pType->FillSbxObject( xMeth, bVariable ); + + pObj->Insert( &xMeth ); + } +} +*/ +#ifdef IDL_COMPILER +/************************************************************************* +|* SvMetaAttribute::Test() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaAttribute::Test( SvIdlDataBase & rBase, + SvTokenStream & rInStm ) +{ + BOOL bOk = TRUE; + if( GetType()->IsItem() && !GetSlotId().IsSet() ) + { + rBase.SetError( "slot without id declared", rInStm.GetToken() ); + rBase.WriteError( rInStm ); + bOk = FALSE; + } + /* + if( !GetType()->IsItem() && GetSlotId().IsSet() ) + { + rBase.SetError( "slot without item declared", rInStm.GetToken() ); + rBase.WriteError( rInStm ); + bOk = FALSE; + } + */ + return bOk; +} + +/************************************************************************* +|* SvMetaAttribute::ReadSvIdl() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaAttribute::ReadSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm ) +{ + UINT32 nTokPos = rInStm.Tell(); + SvToken * pTok = rInStm.GetToken(); + if( !GetType() ) + // Es wurde kein Typ im ctor mitgegeben + aType = rBase.ReadKnownType( rInStm ); + BOOL bOk = FALSE; + if( GetType() ) + { + ReadNameSvIdl( rBase, rInStm ); + aSlotId.ReadSvIdl( rBase, rInStm ); + + bOk = TRUE; + SvToken * pTok = rInStm.GetToken(); + if( bOk && pTok->IsChar() && pTok->GetChar() == '(' ) + { + SvMetaTypeRef xT = new SvMetaType(); + xT->SetRef( GetType() ); + aType = xT; + bOk = aType->ReadMethodArgs( rBase, rInStm ); + } + if( bOk ) + bOk = SvMetaName::ReadSvIdl( rBase, rInStm ); + } + else + rBase.SetError( "unknown type", rInStm.GetToken() ); + + if( !bOk ) + rInStm.Seek( nTokPos ); + return bOk; +} + +/************************************************************************* +|* SvMetaAttribute::WriteSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaAttribute::WriteSvIdl +( + SvIdlDataBase & rBase, + SvStream & rOutStm, + USHORT nTab +) +{ + SvMetaType * pType = GetType(); + pType->WriteTypePrefix( rBase, rOutStm, nTab, WRITE_IDL ); + rOutStm << ' ' << GetName().GetBuffer(); + if( aSlotId.IsSet() ) + rOutStm << ' ' << aSlotId.GetBuffer(); + if( pType->GetType() == TYPE_METHOD ) + pType->WriteMethodArgs( rBase, rOutStm, nTab, WRITE_IDL ); + ULONG nPos = rOutStm.Tell(); + rOutStm << endl; + SvMetaName::WriteSvIdl( rBase, rOutStm, nTab ); + TestAndSeekSpaceOnly( rOutStm, nPos ); +} + +/************************************************************************* +|* SvMetaAttribute::ReadAttributesSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaAttribute::ReadAttributesSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm ) +{ + SvMetaReference::ReadAttributesSvIdl( rBase, rInStm ); + aSlotId.ReadSvIdl( rBase, SvHash_SlotId(), rInStm ); + aExport.ReadSvIdl( SvHash_Export(), rInStm ); + aHidden.ReadSvIdl( SvHash_Hidden(), rInStm ); + aAutomation.ReadSvIdl( SvHash_Automation(), rInStm ); + aIsCollection.ReadSvIdl( SvHash_IsCollection(), rInStm ); + aReadOnlyDoc.ReadSvIdl( SvHash_ReadOnlyDoc(), rInStm ); + if( aReadonly.ReadSvIdl( SvHash_Readonly(), rInStm ) ) + { + if( GetType()->GetType() == TYPE_METHOD ) + { + // Fehler setzen + rBase.SetError( "Readonly in function attribute", rInStm.GetToken() ); + rBase.WriteError( rInStm ); + } + } +} + +/************************************************************************* +|* SvMetaAttribute::WriteAttributesSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaAttribute::WriteAttributesSvIdl +( + SvIdlDataBase & rBase, + SvStream & rOutStm, + USHORT nTab +) +{ + SvMetaReference::WriteAttributesSvIdl( rBase, rOutStm, nTab ); + + //aSlotId.WriteSvIdl( SvHash_SlotId(), rOutStm, nTab ); + if( !aExport || !aAutomation || aReadonly ) + { + WriteTab( rOutStm, nTab ); + rOutStm << "//class SvMetaAttribute" << endl; + if( !aExport ) + { + WriteTab( rOutStm, nTab ); + aExport.WriteSvIdl( SvHash_Export(), rOutStm ); + rOutStm << ';' << endl; + } + if ( aHidden != aExport ) + { + WriteTab( rOutStm, nTab ); + aExport.WriteSvIdl( SvHash_Hidden(), rOutStm ); + rOutStm << ';' << endl; + } + if( aReadonly ) + { + WriteTab( rOutStm, nTab ); + aReadonly.WriteSvIdl( SvHash_Readonly(), rOutStm ); + rOutStm << ';' << endl; + } + if( !aAutomation ) + { + WriteTab( rOutStm, nTab ); + aAutomation.WriteSvIdl( SvHash_Automation(), rOutStm ); + rOutStm << ';' << endl; + } + if( aIsCollection ) + { + WriteTab( rOutStm, nTab ); + aIsCollection.WriteSvIdl( SvHash_IsCollection(), rOutStm ); + rOutStm << ';' << endl; + } + if( !aReadOnlyDoc ) + { + WriteTab( rOutStm, nTab ); + aReadOnlyDoc.WriteSvIdl( SvHash_ReadOnlyDoc(), rOutStm ); + rOutStm << ';' << endl; + } + } +} + +/************************************************************************* +|* SvMetaAttribute::WriteParam() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaAttribute::WriteParam( SvIdlDataBase & rBase, + SvStream & rOutStm, + USHORT nTab, + WriteType nT ) +{ + SvMetaType * pType = GetType(); + DBG_ASSERT( pType, "no type for attribute" ) + SvMetaType * pBaseType = pType->GetBaseType(); + DBG_ASSERT( pBaseType, "no base type for attribute" ) + + if( nT == WRITE_ODL || nT == WRITE_DOCU + || nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE ) + { + if( pBaseType->GetType() == TYPE_STRUCT ) + { + const SvMetaAttributeMemberList & rList = pBaseType->GetAttrList(); + ULONG nCount = rList.Count(); + for( ULONG i = 0; i < nCount; i++ ) + { + rList.GetObject( i )->WriteParam( rBase, rOutStm, nTab, nT ); + if( i+1<nCount ) + { +// if ( nT == WRITE_DOCU ) + rOutStm << ','; +// else +// rOutStm << ',' << endl; + } + } + } + else + { + if ( nT != WRITE_DOCU ) + { + WriteTab( rOutStm, nTab ); + pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT ); + } + + if( GetName().Len() ) + { + rOutStm << ' '; + rOutStm << GetName().GetBuffer(); + } + + if ( nT == WRITE_DOCU ) + { + if( pBaseType->GetType() == TYPE_METHOD || + pBaseType->GetType() == TYPE_STRUCT || + pBaseType->GetType() == TYPE_ENUM ) + { + DBG_ERROR( "Falscher Parametertyp!" ); + } + else + rOutStm << pBaseType->GetBasicPostfix().GetBuffer(); + } + } + } +/* + else if( nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE ) + { + pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT ); + rOutStm << ' '; + rOutStm << GetName().GetBuffer(); + } +*/ +} + +/************************************************************************* +|* SvMetaSlot::WriteSlotId() +|* +|* Beschreibung +*************************************************************************/ +ULONG SvMetaAttribute::MakeSlotValue( SvIdlDataBase & rBase, BOOL bVar ) const +{ + const SvNumberIdentifier & rId = GetSlotId(); + ULONG n = rId.GetValue(); + if( rBase.aStructSlotId.Len() ) + { + n = n << 20; + n += rBase.aStructSlotId.GetValue(); + } + if( PTR_CAST( SvMetaSlot, this ) ) + n |= 0x20000; + if( !bVar ) + n += 0x10000; + else if ( GetIsCollection() ) + n += 0x40000; + return n; +} + +/************************************************************************* +|* SvMetaSlot::WriteAttributes() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaAttribute::WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab, + WriteType nT, WriteAttribute nA ) +{ + if( nT == WRITE_ODL ) + { + const SvNumberIdentifier & rId = GetSlotId(); + BOOL bReadonly = GetReadonly() || ( nA & WA_READONLY ); + if( (rId.IsSet() && !(nA & WA_STRUCT)) || bReadonly ) + { + BOOL bVar = IsVariable(); + if( nA & WA_VARIABLE ) + bVar = TRUE; + else if( nA & WA_METHOD ) + bVar = FALSE; + + WriteTab( rOutStm, nTab ); + rOutStm << "//class SvMetaAttribute" << endl; + if( rId.IsSet() && !(nA & WA_STRUCT) ) + { + WriteTab( rOutStm, nTab ); + rOutStm << "id(" + << ByteString::CreateFromInt32(MakeSlotValue( rBase, bVar )).GetBuffer() + << ")," << endl; + } + if( bVar && (bReadonly || IsMethod()) ) + { + WriteTab( rOutStm, nTab ); + rOutStm << "readonly," << endl; + } + } + } +} + +/************************************************************************* +|* SvMetaAttribute::WriteCSource() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaAttribute::WriteCSource( SvIdlDataBase & rBase, SvStream & rOutStm, + BOOL bSet ) +{ + rOutStm << endl; + SvMetaType * pType = GetType(); + SvMetaType * pBaseType = pType->GetBaseType(); + + // Bei Set ist der Return immer void + BOOL bVoid = bSet; + if( pBaseType->GetType() == TYPE_METHOD ) + bVoid = pBaseType->GetReturnType()->GetBaseType()->GetName() == "void"; + + // Methoden/Funktions-Body ausgeben + rOutStm << '{' << endl; + WriteTab( rOutStm, 1 ); +// rOutStm << "if( SvIPCIsConnected() )" << endl; +// WriteTab( rOutStm, 1 ); +// rOutStm << '{' << endl; +// WriteTab( rOutStm, 2 ); + + if( !bVoid ) + { + if ( pBaseType->GetCName() == "double" ) + { + rOutStm << "return *(double*)"; + } + else + { + rOutStm << "return ("; + pType->WriteTypePrefix( rBase, rOutStm, 2, WRITE_C_SOURCE ); + rOutStm << ") "; + } + } + rOutStm << "pODKCallFunction( " + << ByteString::CreateFromInt32(MakeSlotValue( rBase, IsVariable() )).GetBuffer(); + rOutStm << ',' << endl; + WriteTab( rOutStm, 3 ); + rOutStm << " h" << rBase.aIFaceName.GetBuffer() << " , "; + + ByteString aParserStr; + if( pBaseType->GetType() == TYPE_METHOD || bSet ) + aParserStr = pBaseType->GetParserString(); + if( aParserStr.Len() ) + { + rOutStm << '\"'; + rOutStm << aParserStr.GetBuffer(); + rOutStm << "\", "; + } + else + rOutStm << "NULL, "; + + if( pBaseType->GetType() == TYPE_METHOD && !bVoid ) + { + rOutStm << "'"; + rOutStm << pBaseType->GetReturnType()->GetBaseType()->GetParserChar(); + rOutStm << "'"; + } + else if ( !bSet ) + { + rOutStm << "'"; + rOutStm << pBaseType->GetParserChar(); + rOutStm << "'"; + } + else + rOutStm << '0'; + + if( aParserStr.Len() ) + { + rOutStm << ", "; + if( IsMethod() ) + // void SetPosSize( C_Object *, C_Rectangle * pRect ); + pBaseType->WriteParamNames( rBase, rOutStm, ByteString() ); + else if( bSet ) + pBaseType->WriteParamNames( rBase, rOutStm, GetName() ); + } + + rOutStm << " );" << endl; +// WriteTab( rOutStm, 1 ); +// rOutStm << '}' << endl; +// if( !bVoid ) +// { +// WriteTab( rOutStm, 1 ); +// rOutStm << "return 0;" << endl; +// } + rOutStm << '}' << endl; +} + +/************************************************************************* +|* SvMetaAttribute::WriteRecursiv_Impl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaAttribute::WriteRecursiv_Impl( SvIdlDataBase & rBase, + SvStream & rOutStm, USHORT nTab, + WriteType nT, WriteAttribute nA ) +{ + const SvMetaAttributeMemberList & rList = GetType()->GetBaseType()->GetAttrList(); + ULONG nCount = rList.Count(); + + SvNumberIdentifier aSlotId = rBase.aStructSlotId; + if ( GetSlotId().Len() ) + rBase.aStructSlotId = GetSlotId(); + + // Offizielle Hack-Schnittstelle von MM: spezielle Schalter werden "uber + // die WriteAttribute "ubergeben + if ( GetReadonly() ) + nA |= WA_READONLY; + + for( ULONG i = 0; i < nCount; i++ ) + { + SvMetaAttribute *pAttr = rList.GetObject( i ); + if ( nT == WRITE_DOCU ) + pAttr->SetDescription( GetDescription() ); + pAttr->Write( rBase, rOutStm, nTab, nT, nA ); + if( nT == WRITE_ODL && i +1 < nCount ) + rOutStm << ';' << endl; + } + + rBase.aStructSlotId = aSlotId; +} + +/************************************************************************* +|* SvMetaAttribute::Write() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaAttribute::Write( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab, + WriteType nT, WriteAttribute nA ) +{ + // keine Attribut fuer Automation + if( nT == WRITE_DOCU ) + { + if ( GetHidden() ) + return; + } + else if ( !GetAutomation() || !GetExport() ) + return; + + BOOL bVariable; + if( nA & WA_VARIABLE ) + bVariable = TRUE; + else if( nA & WA_METHOD ) + bVariable = FALSE; + else + bVariable = IsVariable(); + + SvMetaType * pType = GetType(); + DBG_ASSERT( pType, "no type for attribute" ) + SvMetaType * pBaseType = pType->GetBaseType(); + DBG_ASSERT( pBaseType, "no base type for attribute" ) + int nBType = pBaseType->GetType(); + + if( nT == WRITE_ODL ) + { + if( (bVariable && IsVariable()) || (!bVariable && IsMethod()) ) + { + if( nBType == TYPE_STRUCT ) + WriteRecursiv_Impl( rBase, rOutStm, nTab, nT, nA ); + else + { + SvMetaReference::Write( rBase, rOutStm, nTab, nT, nA ); + WriteTab( rOutStm, nTab ); + pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT ); + + if( GetName().Len() ) + { + rOutStm << ' '; + rOutStm << GetName().GetBuffer(); + } + if( pType->GetType() == TYPE_METHOD ) + pType->WriteMethodArgs( rBase, rOutStm, nTab, nT ); + } + } + } + else if( nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE ) + { + if( !bVariable && IsMethod() ) + { + ByteString aName; // (rBase.GetActModulePrefix()); + aName += rBase.aIFaceName; + aName += GetName(); + const char * pName = aName.GetBuffer(); + // Beispiel + // void SetPosSize( C_Object *, C_Rectangle * ); + WriteTab( rOutStm, nTab ); + pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT ); +// rOutStm << " SYSCALL"; + rOutStm << ' ' << pName; + pType->WriteMethodArgs( rBase, rOutStm, nTab, nT ); + if( nT == WRITE_C_HEADER ) + rOutStm << ';' << endl << endl; + else + WriteCSource( rBase, rOutStm, FALSE ); + } + else if ( bVariable && IsVariable() ) + { + if( nBType == TYPE_STRUCT ) + { + // Zur Hilfe den Namen des Properties als Kommentar ausgeben + rOutStm << "/* " << GetName().GetBuffer() << " */" << endl; + + WriteRecursiv_Impl( rBase, rOutStm, nTab, nT, nA ); + } + else + { + // Beispiel + // void SetValue( C_Object *, USHORT n ); + ByteString aName = GetName(); + + BOOL bReadonly = GetReadonly() || ( nA & WA_READONLY ); + if ( !bReadonly && !IsMethod() ) + { + // Zuweisung + WriteTab( rOutStm, nTab ); + rOutStm << "void "; +// rOutStm << "SYSCALL "; +// if ( rBase.GetActModulePrefix().Len() ) +// rOutStm << rBase.GetActModulePrefix().GetBuffer(); + rOutStm << rBase.aIFaceName.GetBuffer() + << "Set" << aName.GetBuffer() << "( " << C_PREF + << "Object h" << rBase.aIFaceName.GetBuffer() << ", " << endl; + WriteTab( rOutStm, nTab+1 ); + pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT ); + rOutStm << ' ' << aName.GetBuffer() << " )"; + if( nT == WRITE_C_HEADER ) + rOutStm << ';' << endl << endl; + else + WriteCSource( rBase, rOutStm, TRUE ); + } + + // Zugriff + WriteTab( rOutStm, nTab ); + pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT ); + rOutStm << ' '; +// rOutStm << "SYSCALL "; +// if ( rBase.GetActModulePrefix().Len() ) +// rOutStm << rBase.GetActModulePrefix().GetBuffer(); + rOutStm << rBase.aIFaceName.GetBuffer() + << "Get" << aName.GetBuffer() << "( " << C_PREF + << "Object h" << rBase.aIFaceName.GetBuffer() << " )"; + if( nT == WRITE_C_HEADER ) + rOutStm << ';' << endl << endl; + else + WriteCSource( rBase, rOutStm, FALSE ); + } + } + } + else if ( nT == WRITE_DOCU ) + { + if( !bVariable && IsMethod() ) + { + rOutStm << "<METHOD>" << endl + << GetSlotId().GetBuffer() << endl + << GetName().GetBuffer() << endl + << endl; // readonly + + // Returntype + SvMetaType* pType = GetType(); + SvMetaType* pBaseType = pType->GetBaseType(); + rOutStm << pBaseType->GetReturnType()->GetBaseType()->GetBasicName().GetBuffer() << endl; + + DBG_ASSERT( pBaseType->GetReturnType()->GetBaseType()->GetBasicName().Len(), + "Leerer BasicName" ); + + // Syntax + rOutStm << GetName().GetBuffer(); + pType->WriteMethodArgs( rBase, rOutStm, nTab, nT ); + + // C-Returntype + pBaseType->WriteTypePrefix( rBase, rOutStm, 0, WRITE_C_HEADER ); + rOutStm << endl; + + // Bei Methoden auch C-Syntax + rOutStm << "<C-SYNTAX>" << endl; + Write( rBase, rOutStm, 0, WRITE_C_HEADER, nA ); + rOutStm << "</C-SYNTAX>" << endl; + + // Description + WriteDescription( rBase, rOutStm ); + rOutStm << "</METHOD>" << endl << endl; + } + else if( bVariable && IsVariable() ) + { + if( nBType == TYPE_STRUCT ) + { + WriteRecursiv_Impl( rBase, rOutStm, nTab, nT, nA ); + } + else + { + rOutStm << "<PROPERTY>" << endl + << GetSlotId().GetBuffer() << endl + << GetName().GetBuffer() << endl; + if ( GetReadonly() ) + rOutStm << "(nur lesen)" << endl; + else + rOutStm << endl; + + // Bei properties Type anstelle des return value + rOutStm << pBaseType->GetBasicName().GetBuffer() << endl; + + DBG_ASSERT( pBaseType->GetBasicName().Len(), + "Leerer BasicName" ); + + // Bei properties keine Syntax + rOutStm << endl; + + // C-Returntype + pBaseType->WriteTypePrefix( rBase, rOutStm, 0, WRITE_C_HEADER ); + rOutStm << endl; + + // Description + WriteDescription( rBase, rOutStm ); + rOutStm << "</PROPERTY>" << endl << endl; + } + } + } +} + +/************************************************************************* +|* SvMetaAttribute::MakeSfx() +|* +|* Beschreibung +*************************************************************************/ +ULONG SvMetaAttribute::MakeSfx( ByteString * pAttrArray ) +{ + SvMetaType * pType = GetType(); + DBG_ASSERT( pType, "no type for attribute" ) + SvMetaType * pBaseType = pType->GetBaseType(); + DBG_ASSERT( pBaseType, "no base type for attribute" ) + if( pBaseType->GetType() == TYPE_STRUCT ) + return pBaseType->MakeSfx( pAttrArray ); + else + { + *pAttrArray += '{'; + *pAttrArray += GetSlotId(); + *pAttrArray += ",\""; + *pAttrArray += GetName(); + *pAttrArray += "\"}"; + return 1; + } +} + +void SvMetaAttribute::Insert (SvSlotElementList&, const ByteString &, SvIdlDataBase&) +{ +} + +/************************************************************************* +|* SvMetaAttribute::WriteSrc() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaAttribute::WriteSrc( SvIdlDataBase & rBase, SvStream & rOutStm, + Table * pIdTable ) +{ +} + +void SvMetaAttribute::WriteHelpId( SvIdlDataBase & rBase, SvStream & rOutStm, + Table * pIdTable ) +{ +} + +#endif // IDL_COMPILER + +/****************** SvMetaType *************************************/ +/************************************************************************/ +SV_IMPL_META_FACTORY1( SvMetaType, SvMetaExtern ); +#ifdef IDL_COMPILER +SvAttributeList & SvMetaType::GetAttributeList() +{ + if( !pAttribList ) + { + pAttribList = new SvAttributeList(); + } + return *pAttribList; +} +#endif +/************************************************************************* +|* SvMetaType::SvMetaType() +|* +|* Beschreibung +*************************************************************************/ +#define CTOR \ + : aCall0( CALL_VALUE, FALSE ) \ + , aCall1( CALL_VALUE, FALSE ) \ + , aSbxDataType( 0, FALSE ) \ + , pAttrList( NULL ) \ + , nType( TYPE_BASE ) \ + , bIsShell( FALSE ) \ + , bIsItem( FALSE ) \ + , cParserChar( 'h' ) + +SvMetaType::SvMetaType() + CTOR +{ +} + +SvMetaType::SvMetaType( const ByteString & rName, char cPC, + const ByteString & rCName ) + CTOR +{ + SetName( rName ); + cParserChar = cPC; + aCName = rCName; +} + +SvMetaType::SvMetaType( const ByteString & rName, + const ByteString & rSbxName, + const ByteString & rOdlName, + char cPc, + const ByteString & rCName, + const ByteString & rBasicName, + const ByteString & rBasicPostfix ) + CTOR +{ +// aSbxDataType = (int)nT; + SetName( rName ); + aSbxName = rSbxName; + aOdlName = rOdlName; + cParserChar = cPc; + aCName = rCName; + aBasicName = rBasicName; + aBasicPostfix = rBasicPostfix; +} + +void SvMetaType::Load( SvPersistStream & rStm ) +{ + SvMetaExtern::Load( rStm ); + + USHORT nMask; + rStm >> nMask; + if( nMask & 0x0001 ) rStm >> aIn; + if( nMask & 0x0002 ) rStm >> aOut; + if( nMask & 0x0004 ) rStm >> aCall0; + if( nMask & 0x0008 ) rStm >> aCall1; + if( nMask & 0x0010 ) rStm >> aSbxDataType; + if( nMask & 0x0020 ) rStm >> aSvName; + if( nMask & 0x0040 ) rStm >> aSbxName; + if( nMask & 0x0080 ) rStm >> aOdlName; + if( nMask & 0x0100 ) rStm >> GetAttrList(); + if( nMask & 0x0200 ) bIsItem = TRUE; + if( nMask & 0x0400 ) bIsShell = TRUE; + if( nMask & 0x0800 ) + { + USHORT nT; + rStm >> nT; + nType = nT; + } + if( nMask & 0x1000 ) rStm >> cParserChar; + if( nMask & 0x2000 ) rStm >> aCName; + if( nMask & 0x4000 ) rStm >> aBasicName; + if( nMask & 0x8000 ) rStm >> aBasicPostfix; +} + +void SvMetaType::Save( SvPersistStream & rStm ) +{ + SvMetaExtern::Save( rStm ); + + // Maske erstellen + USHORT nMask = 0; + if( aIn.IsSet() ) nMask |= 0x0001; + if( aOut.IsSet() ) nMask |= 0x0002; + if( aCall0.IsSet() ) nMask |= 0x0004; + if( aCall1.IsSet() ) nMask |= 0x0008; + if( aSbxDataType.IsSet() ) nMask |= 0x0010; + if( aSvName.IsSet() ) nMask |= 0x0020; + if( aSbxName.IsSet() ) nMask |= 0x0040; + if( aOdlName.IsSet() ) nMask |= 0x0080; + if( GetAttrCount() ) nMask |= 0x0100; + if( bIsItem ) nMask |= 0x0200; + if( bIsShell ) nMask |= 0x0400; + if( nType != TYPE_BASE ) nMask |= 0x0800; + if( cParserChar != 'h' ) nMask |= 0x1000; + if( aCName.IsSet() ) nMask |= 0x2000; + if( aBasicName.IsSet() ) nMask |= 0x4000; + if( aBasicPostfix.IsSet() ) nMask |= 0x8000; + + // Daten schreiben + rStm << nMask; + if( nMask & 0x0001 ) rStm << aIn; + if( nMask & 0x0002 ) rStm << aOut; + if( nMask & 0x0004 ) rStm << aCall0; + if( nMask & 0x0008 ) rStm << aCall1; + if( nMask & 0x0010 ) rStm << aSbxDataType; + if( nMask & 0x0020 ) rStm << aSvName; + if( nMask & 0x0040 ) rStm << aSbxName; + if( nMask & 0x0080 ) rStm << aOdlName; + if( nMask & 0x0100 ) rStm << *pAttrList; + if( nMask & 0x0800 ) rStm << (USHORT)nType; + if( nMask & 0x1000 ) rStm << cParserChar; + if( nMask & 0x2000 ) rStm << aCName; + if( nMask & 0x4000 ) rStm << aBasicName; + if( nMask & 0x8000 ) rStm << aBasicPostfix; +} + +/************************************************************************* +|* SvMetaType::GetAttrList() +|* +|* Beschreibung +*************************************************************************/ +SvMetaAttributeMemberList & SvMetaType::GetAttrList() const +{ + if( !pAttrList ) + ((SvMetaType *)this)->pAttrList = new SvMetaAttributeMemberList(); + return *pAttrList; +} + +/************************************************************************* +|* SvMetaType::SetType() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaType::SetType( int nT ) +{ + nType = nT; + if( nType == TYPE_ENUM ) + { + aOdlName = "short"; +// aSbxDataType = SbxINTEGER; + } + else if( nType == TYPE_CLASS ) + { + aCName = C_PREF; + aCName += "Object *"; + } +} + +/************************************************************************* +|* SvMetaType::GetBaseType() +|* +|* Beschreibung +*************************************************************************/ +SvMetaType * SvMetaType::GetBaseType() const +{ + if( GetRef() && GetType() == TYPE_BASE ) + return ((SvMetaType *)GetRef())->GetBaseType(); + return (SvMetaType *)this; +} + +/************************************************************************* +|* SvMetaType::GetReturnType() +|* +|* Beschreibung +*************************************************************************/ +SvMetaType * SvMetaType::GetReturnType() const +{ + DBG_ASSERT( GetType() == TYPE_METHOD, "no method" ) + DBG_ASSERT( GetRef(), "no return type" ) + return (SvMetaType *)GetRef(); +} + +/************************************************************************* +|* SvMetaType::GetSbxDataType() +|* +|* Beschreibung +*************************************************************************/ +/* +SbxDataType SvMetaType::GetSbxDataType() const +{ + if( aSbxDataType.IsSet() || !GetRef() ) + return (SbxDataType)(int)aSbxDataType; + else + return ((SvMetaType *)GetRef())->GetSbxDataType(); +} +*/ +/************************************************************************* +|* SvMetaType::GetBasicName() +|* +|* Beschreibung +*************************************************************************/ +const ByteString& SvMetaType::GetBasicName() const +{ + if( aBasicName.IsSet() || !GetRef() ) + return aBasicName; + else + return ((SvMetaType*)GetRef())->GetBasicName(); +} + +/************************************************************************* +|* SvMetaType::GetBasicPostfix() +|* +|* Beschreibung +*************************************************************************/ +ByteString SvMetaType::GetBasicPostfix() const +{ + + ByteString aRet; + + // MBN und Co wollen immer "As xxx" +/* + if( aBasicPostfix.IsSet() || !GetRef() ) + aRet = aBasicPostfix; + else + aRet = ((SvMetaType*)GetRef())->GetBasicPostfix(); + + if ( !aRet.Len() && GetBasicName().Len() ) +*/ + { + + aRet = " As "; + aRet += GetBasicName(); + } + + return aRet; +} + +/************************************************************************* +|* SvMetaType::GetIn() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaType::GetIn() const +{ + if( aIn.IsSet() || !GetRef() ) + return aIn; + else + return ((SvMetaType *)GetRef())->GetIn(); +} + +/************************************************************************* +|* SvMetaType::GetOut() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaType::GetOut() const +{ + if( aOut.IsSet() || !GetRef() ) + return aOut; + else + return ((SvMetaType *)GetRef())->GetOut(); +} + +/************************************************************************* +|* SvMetaType::SetCall0() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaType::SetCall0( int e ) +{ + aCall0 = (int)e; + if( aCall0 == CALL_VALUE && aCall1 == CALL_VALUE ) + { + if( GetType() == TYPE_POINTER ) + SetType( TYPE_BASE ); + } + else + { + DBG_ASSERT( nType == TYPE_POINTER || nType == TYPE_BASE, + "set no base type to pointer" ) + SetType( TYPE_POINTER ); + } +} + +/************************************************************************* +|* SvMetaType::GetCall0() +|* +|* Beschreibung +*************************************************************************/ +int SvMetaType::GetCall0() const +{ + if( aCall0.IsSet() || !GetRef() ) + return aCall0; + else + return ((SvMetaType *)GetRef())->GetCall0(); +} + +/************************************************************************* +|* SvMetaType::SetCall1() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaType::SetCall1( int e ) +{ + aCall1 = (int)e; + if( aCall0 == CALL_VALUE && aCall1 == CALL_VALUE ) + { + if( GetType() == TYPE_POINTER ) + SetType( TYPE_BASE ); + } + else + { + DBG_ASSERT( nType == TYPE_POINTER || nType == TYPE_BASE, + "set no base type to pointer" ) + SetType( TYPE_POINTER ); + } +} + +/************************************************************************* +|* SvMetaType::GetCall1() +|* +|* Beschreibung +*************************************************************************/ +int SvMetaType::GetCall1() const +{ + if( aCall1.IsSet() || !GetRef() ) + return aCall1; + else + return ((SvMetaType *)GetRef())->GetCall1(); +} + +/************************************************************************* +|* SvMetaType::GetSvName() +|* +|* Beschreibung +*************************************************************************/ +const ByteString & SvMetaType::GetSvName() const +{ + if( aSvName.IsSet() || !GetRef() ) + return aSvName; + else + return ((SvMetaType *)GetRef())->GetSvName(); +} + +/************************************************************************* +|* SvMetaType::GetSbxName() +|* +|* Beschreibung +*************************************************************************/ +const ByteString & SvMetaType::GetSbxName() const +{ + if( aSbxName.IsSet() || !GetRef() ) + return aSbxName; + else + return ((SvMetaType *)GetRef())->GetSbxName(); +} + +/************************************************************************* +|* SvMetaType::GetOdlName() +|* +|* Beschreibung +*************************************************************************/ +const ByteString & SvMetaType::GetOdlName() const +{ + if( aOdlName.IsSet() || !GetRef() ) + return aOdlName; + else + return ((SvMetaType *)GetRef())->GetOdlName(); +} + +/************************************************************************* +|* SvMetaType::GetCName() +|* +|* Beschreibung +*************************************************************************/ +const ByteString & SvMetaType::GetCName() const +{ + if( aCName.IsSet() || !GetRef() ) + return aCName; + else + return ((SvMetaType *)GetRef())->GetCName(); +} + +/************************************************************************* +|* SvMetaType::SetName() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaType::SetName( const ByteString & rName, SvIdlDataBase * pBase ) +{ + aSvName = rName; + aSbxName = rName; + aCName = rName; + if( GetType() != TYPE_ENUM ) + aOdlName = rName; + return SvMetaReference::SetName( rName, pBase ); +} + +/************************************************************************* +|* SvMetaType::FillSbxObject() +|* +|* Beschreibung +*************************************************************************/ +/* +void SvMetaType::FillSbxObject( SbxVariable * pObj, BOOL bVariable ) +{ + if( PTR_CAST( SbxMethod, pObj ) ) + { + if( GetType() == TYPE_METHOD ) + { + ULONG nCount = GetAttrCount(); + if( nCount ) + { + SbxInfoRef xInfo = pObj->GetInfo(); + if( !xInfo.Is() ) + { + xInfo = new SbxInfo(); + pObj->SetInfo( xInfo ); + } + for( ULONG n = nCount; n > 0; n-- ) + pAttrList->GetObject( n -1 )->FillSbxObject( xInfo ); + } + } + } +} +*/ +#ifdef IDL_COMPILER +/************************************************************************* +|* SvMetaType::GetString() +|* +|* Beschreibung +*************************************************************************/ +ByteString SvMetaType::GetCString() const +{ + ByteString aOut( GetSvName() ); + if( aCall0 == (int)CALL_POINTER ) + aOut += " *"; + else if( aCall0 == (int)CALL_REFERENCE ) + aOut += " &"; + if( aCall1 == (int)CALL_POINTER ) + aOut += '*'; + else if( aCall1 == (int)CALL_REFERENCE ) + aOut += '&'; + return aOut; +} + +/************************************************************************* +|* SvMetaType::ReadHeaderSvIdl() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaType::ReadHeaderSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm ) +{ + BOOL bOk = FALSE; + UINT32 nTokPos = rInStm.Tell(); + SvToken * pTok = rInStm.GetToken_Next(); + + if( pTok->Is( SvHash_interface() ) + || pTok->Is( SvHash_shell() ) ) + { + if( pTok->Is( SvHash_shell() ) ) + bIsShell = TRUE; + SetType( TYPE_CLASS ); + bOk = ReadNamesSvIdl( rBase, rInStm ); + + } + else if( pTok->Is( SvHash_struct() ) ) + { + SetType( TYPE_STRUCT ); + bOk = ReadNamesSvIdl( rBase, rInStm ); + } + else if( pTok->Is( SvHash_union() ) ) + { + SetType( TYPE_UNION ); + if( ReadNameSvIdl( rBase, rInStm ) ) + return TRUE; + } + else if( pTok->Is( SvHash_enum() ) ) + { + SetType( TYPE_ENUM ); + bOk = ReadNameSvIdl( rBase, rInStm ); + } + else if( pTok->Is( SvHash_typedef() ) + || pTok->Is( SvHash_item() ) ) + { + if( pTok->Is( SvHash_item() ) ) + bIsItem = TRUE; + + SvMetaType * pType = rBase.ReadKnownType( rInStm ); + if( pType ) + { + SetRef( pType ); + if( ReadNameSvIdl( rBase, rInStm ) ) + { + /* // um aufwaertskompatibel zu bleiben + aOdlName = pType->GetOdlName(); + */ + if( rInStm.Read( '(' ) ) + { + //DoReadContextSvIdl( rBase, rInStm, ',' ); + DoReadContextSvIdl( rBase, rInStm ); + if( rInStm.Read( ')' ) ) + { + SetType( TYPE_METHOD ); + bOk = TRUE; + } + } + else + { + bOk = TRUE; + } + } + } + else + { + ByteString aStr = "wrong typedef: "; + rBase.SetError( aStr, rInStm.GetToken() ); + rBase.WriteError( rInStm ); + } + } + if( bOk ) + SetModule( rBase ); + else + rInStm.Seek( nTokPos ); + return bOk; +} + +/************************************************************************* +|* SvMetaType::ReadSvIdl() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaType::ReadSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm ) +{ + if( ReadHeaderSvIdl( rBase, rInStm ) ) + { + rBase.Write( '.' ); + return SvMetaExtern::ReadSvIdl( rBase, rInStm ); + } + return FALSE; +} + +/************************************************************************* +|* SvMetaType::WriteSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaType::WriteSvIdl +( + SvIdlDataBase & rBase, + SvStream & rOutStm, + USHORT nTab +) +{ + WriteHeaderSvIdl( rBase, rOutStm, nTab ); + if( GetType() == TYPE_METHOD ) + WriteMethodArgs( rBase, rOutStm, nTab, WRITE_IDL ); + + ULONG nOldPos = rOutStm.Tell(); + rOutStm << endl; + SvMetaExtern::WriteSvIdl( rBase, rOutStm, nTab ); + if( TestAndSeekSpaceOnly( rOutStm, nOldPos ) ) + // nichts geschrieben + rOutStm.Seek( nOldPos ); + rOutStm << ';' << endl; +} + +/************************************************************************* +|* SvMetaType::WriteContext() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaType::WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab, + WriteType nT, WriteAttribute nA ) +{ + if( GetAttrCount() ) + { + SvMetaAttribute * pAttr = pAttrList->First(); + while( pAttr ) + { + pAttr->Write( rBase, rOutStm, nTab, nT, nA ); + if( GetType() == TYPE_METHOD ) + rOutStm << ',' << endl; + else + rOutStm << ';' << endl; + pAttr = pAttrList->Next(); + } + } +} + +/************************************************************************* +|* SvMetaType::Write() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaType::Write( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab, + WriteType nT, WriteAttribute nA ) +{ + if( nT == WRITE_C_HEADER && nType != TYPE_ENUM ) + // nur enum schreiben + return; + + ByteString aName = GetName(); + if( nT == WRITE_ODL || nT == WRITE_C_HEADER || nT == WRITE_CXX_HEADER ) + { + switch( nType ) + { + case TYPE_CLASS: + { + } + break; + case TYPE_STRUCT: + case TYPE_UNION: + case TYPE_ENUM: + { + WriteStars( rOutStm ); + if( nType == TYPE_STRUCT || nType == TYPE_UNION ) + nA = WA_STRUCT; + + if( nT == WRITE_ODL || nT == WRITE_C_HEADER) + { + if ( nT == WRITE_C_HEADER ) + { + ByteString aStr = aName; + aStr.ToUpperAscii(); + rOutStm << "#ifndef " << C_PREF << aStr.GetBuffer() << "_DEF " << endl; + rOutStm << "#define " << C_PREF << aStr.GetBuffer() << "_DEF " << endl; + } + + WriteTab( rOutStm, nTab ); + rOutStm << "typedef" << endl; + if ( nT == WRITE_ODL ) + SvMetaName::Write( rBase, rOutStm, nTab, nT, nA ); + } + WriteTab( rOutStm, nTab ); + if( nType == TYPE_STRUCT ) + rOutStm << "struct"; + else if( nType == TYPE_UNION ) + rOutStm << "union"; + else + rOutStm << "enum"; + if( nT != WRITE_ODL && nT != WRITE_C_HEADER) + rOutStm << ' ' << aName.GetBuffer(); + + rOutStm << endl; + WriteTab( rOutStm, nTab ); + rOutStm << '{' << endl; + WriteContext( rBase, rOutStm, nTab +1, nT, nA ); + WriteTab( rOutStm, nTab ); + rOutStm << '}'; + if( nT == WRITE_ODL || nT == WRITE_C_HEADER ) + { + rOutStm << ' ' << C_PREF << aName.GetBuffer(); + } + rOutStm << ';' << endl; + + if ( nT == WRITE_C_HEADER ) + rOutStm << "#endif"; + +/*keine Funktionen fuer New und Delete + if( nT == WRITE_C_HEADER && nType != TYPE_ENUM ) + { + rOutStm << aName.GetBuffer() << " * New_" + << aName.GetBuffer() << "();" << endl; + rOutStm << "void Delete_" + << aName.GetBuffer() << "( " + << aName.GetBuffer() <<" * );" << endl; + } +*/ + rOutStm << endl; + } + break; + case TYPE_POINTER: + case TYPE_BASE: + { + } + break; + case TYPE_METHOD: + { + } + break; + } + } + +/*keine Funktionen fuer New und Delete + if( nT == WRITE_C_SOURCE ) + { + switch( nType ) + { + case TYPE_STRUCT: + case TYPE_UNION: + { + rOutStm << aName.GetBuffer() << " * New_" + << aName.GetBuffer() << "() { return new " + << aName.GetBuffer() << "; }" << endl; + rOutStm << "void Delete_" + << aName.GetBuffer() << "( " + << aName.GetBuffer() <<" * ) { delete " + << aName.GetBuffer() << "; }" << endl; + } + break; + } + } +*/ +} + +/************************************************************************* +|* SvMetaType::ReadNamesSvIdl() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaType::ReadNamesSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm ) +{ + BOOL bOk = ReadNameSvIdl( rBase, rInStm ); +/* + if( bOk ) + { + UINT32 nTokPos = rInStm.Tell(); + SvToken * pTok = rInStm.GetToken_Next(); + + if( pTok->IsIdentifier() ) + { + aSbxName = pTok->GetString(); + + nTokPos = rInStm.Tell(); + pTok = rInStm.GetToken_Next(); + if( pTok->IsIdentifier() ) + { + aItemName = pTok->GetString(); + nTokPos = rInStm.Tell(); + } + } + rInStm.Seek( nTokPos ); + } +*/ + return bOk; +} + +/************************************************************************* +|* SvMetaType::WriteHeaderSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaType::WriteHeaderSvIdl( SvIdlDataBase & rBase, + SvStream & rOutStm, + USHORT nTab ) +{ + switch( nType ) + { + case TYPE_CLASS: + { + if( IsShell() ) + rOutStm << SvHash_shell()->GetName().GetBuffer(); + else + rOutStm << SvHash_interface()->GetName().GetBuffer(); + rOutStm << ' ' << GetName().GetBuffer(); + } + break; + case TYPE_STRUCT: + { + rOutStm << SvHash_struct()->GetName().GetBuffer() + << ' ' << GetName().GetBuffer(); + } + break; + case TYPE_UNION: + { + rOutStm << SvHash_union()->GetName().GetBuffer() + << ' ' << GetName().GetBuffer(); + } + break; + case TYPE_ENUM: + { + rOutStm << SvHash_enum()->GetName().GetBuffer() + << ' ' << GetName().GetBuffer(); + } + break; + case TYPE_POINTER: + case TYPE_BASE: + { + if( IsItem() ) + rOutStm << SvHash_item()->GetName().GetBuffer() << ' '; + else + rOutStm << SvHash_typedef()->GetName().GetBuffer() << ' '; + if( GetRef() ) + { + ((SvMetaType *)GetRef())->WriteTheType( rBase, rOutStm, nTab, WRITE_IDL ); + rOutStm << ' '; + } + rOutStm << GetName().GetBuffer(); + } + break; + case TYPE_METHOD: + { + rOutStm << SvHash_typedef()->GetName().GetBuffer() << ' '; + ((SvMetaType *)GetRef())->WriteTheType( rBase, rOutStm, nTab, WRITE_IDL ); + rOutStm << ' ' << GetName().GetBuffer() << "( "; + WriteContextSvIdl( rBase, rOutStm, nTab ); + rOutStm << " )"; + } + break; + } +} + +/************************************************************************* +|* SvMetaType::ReadAttributesSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaType::ReadAttributesSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm ) +{ + SvMetaExtern::ReadAttributesSvIdl( rBase, rInStm ); + aSvName.ReadSvIdl( SvHash_SvName(), rInStm ); + aSbxName.ReadSvIdl( SvHash_SbxName(), rInStm ); + aOdlName.ReadSvIdl( SvHash_OdlName(), rInStm ); +} + +/************************************************************************* +|* SvMetaType::WriteAttributesSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaType::WriteAttributesSvIdl( SvIdlDataBase & rBase, + SvStream & rOutStm, + USHORT nTab ) +{ + SvMetaExtern::WriteAttributesSvIdl( rBase, rOutStm, nTab ); + ByteString aName = GetName(); + if( aSvName != aName || aSbxName != aName || aOdlName != aName ) + { + WriteTab( rOutStm, nTab ); + rOutStm << "class SvMetaType" << endl; + if( aSvName != aName ) + { + WriteTab( rOutStm, nTab ); + aSvName.WriteSvIdl( SvHash_SvName(), rOutStm, nTab ); + rOutStm << endl; + } + if( aSbxName != aName ) + { + WriteTab( rOutStm, nTab ); + aSbxName.WriteSvIdl( SvHash_SbxName(), rOutStm, nTab ); + rOutStm << endl; + } + if( aOdlName != aName ) + { + WriteTab( rOutStm, nTab ); + aOdlName.WriteSvIdl( SvHash_OdlName(), rOutStm, nTab ); + rOutStm << endl; + } + } +} + +/************************************************************************* +|* SvMetaType::ReadContextSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaType::ReadContextSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm ) +{ + SvMetaAttributeRef xAttr = new SvMetaAttribute(); + if( xAttr->ReadSvIdl( rBase, rInStm ) ) + { + if( xAttr->Test( rBase, rInStm ) ) + GetAttrList().Append( xAttr ); + } +} + +/************************************************************************* +|* SvMetaType::WriteContextSvIdl() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaType::WriteContextSvIdl +( + SvIdlDataBase & rBase, + SvStream & rOutStm, + USHORT nTab +) +{ + if( GetAttrCount() ) + { + SvMetaAttribute * pAttr = pAttrList->First(); + while( pAttr ) + { + WriteTab( rOutStm, nTab ); + pAttr->WriteSvIdl( rBase, rOutStm, nTab ); + if( GetType() == TYPE_METHOD ) + rOutStm << ',' << endl; + else + rOutStm << ';' << endl; + pAttr = pAttrList->Next(); + } + } +} + +/************************************************************************* +|* SvMetaType::WriteAttributes() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaType::WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab, + WriteType nT, WriteAttribute nA ) +{ + SvMetaExtern::WriteAttributes( rBase, rOutStm, nTab, nT, nA ); +} + +/************************************************************************* +|* SvMetaType::MakeSfx() +|* +|* Beschreibung +*************************************************************************/ +ULONG SvMetaType::MakeSfx( ByteString * pAttrArray ) +{ + ULONG nC = 0; + + if( GetBaseType()->GetType() == TYPE_STRUCT ) + { + ULONG nAttrCount = GetAttrCount(); + // Die einzelnen Attribute schreiben + for( ULONG n = 0; n < nAttrCount; n++ ) + { + nC += pAttrList->GetObject( n )->MakeSfx( pAttrArray ); + if( n +1 < nAttrCount ) + *pAttrArray += ", "; + } + } + return nC; +} + +/************************************************************************* +|* SvMetaType::WriteSfx() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaType::WriteSfx( const ByteString & rItemName, SvIdlDataBase & rBase, + SvStream & rOutStm ) +{ + WriteStars( rOutStm ); + ByteString aVarName = " a"; + aVarName += rItemName; + aVarName += "_Impl"; + + ByteString aTypeName = "SfxType"; + ByteString aAttrArray; + ULONG nAttrCount = MakeSfx( &aAttrArray ); + //ULONG nAttrCount = GetAttrCount(); + ByteString aAttrCount( ByteString::CreateFromInt32( nAttrCount ) ); + aTypeName += aAttrCount; + + rOutStm << "extern " << aTypeName.GetBuffer() + << aVarName.GetBuffer() << ';' << endl; + + // Den Implementationsteil schreiben + rOutStm << "#ifdef SFX_TYPEMAP" << endl + << aTypeName.GetBuffer() << aVarName.GetBuffer() + << " = " << endl; + rOutStm << '{' << endl + << "\tTYPE(" << rItemName.GetBuffer() << "), " + << aAttrCount.GetBuffer(); + if( nAttrCount ) + { + rOutStm << ", { "; + // Die einzelnen Attribute schreiben + rOutStm << aAttrArray.GetBuffer(); + rOutStm << " }"; + } + rOutStm << endl << "};" << endl + << "#endif" << endl << endl; +} + +/************************************************************************* +|* SvMetaType::WriteSfx() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaType::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ) +{ + if( IsItem() ) + { + if( GetBaseType()->GetType() == TYPE_STRUCT ) + GetBaseType()->WriteSfx( GetName(), rBase, rOutStm ); + else + WriteSfx( GetName(), rBase, rOutStm ); + } +} + +/************************************************************************* +|* SvMetaType::ReadMethodArgs() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvMetaType::ReadMethodArgs( SvIdlDataBase & rBase, + SvTokenStream & rInStm ) +{ + UINT32 nTokPos = rInStm.Tell(); + if( rInStm.Read( '(' ) ) + { + //DoReadContextSvIdl( rBase, rInStm, ',' ); + DoReadContextSvIdl( rBase, rInStm ); + if( rInStm.Read( ')' ) ) + { + SetType( TYPE_METHOD ); + return TRUE; + } + } + rInStm.Seek( nTokPos ); + return FALSE; +} + +/************************************************************************* +|* SvMetaType::WriteMethodArgs() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaType::WriteMethodArgs +( + SvIdlDataBase & rBase, + SvStream & rOutStm, + USHORT nTab, WriteType nT +) +{ + if( nT == WRITE_IDL ) + { + if( GetAttrCount() ) + { + rOutStm << endl; + WriteTab( rOutStm, nTab ); + rOutStm << '(' << endl; + + SvMetaAttribute * pAttr = pAttrList->First(); + while( pAttr ) + { + WriteTab( rOutStm, nTab +1 ); + pAttr->WriteSvIdl( rBase, rOutStm, nTab +1 ); + pAttr = pAttrList->Next(); + if( pAttr ) + rOutStm << ',' << endl; + } + rOutStm << endl; + WriteTab( rOutStm, nTab ); + rOutStm << ')'; + } + else + rOutStm << "()"; + } + else if ( nT == WRITE_DOCU ) + { + + rOutStm << '('; + if( GetAttrCount() ) + { + SvMetaAttribute * pAttr = pAttrList->First(); + while( pAttr ) + { + pAttr->WriteParam( rBase, rOutStm, nTab+1, nT ); + pAttr = pAttrList->Next(); + if( pAttr ) + rOutStm << ','; + else + rOutStm << ' '; + } + } + rOutStm << ')' << endl; + } + else + { + rOutStm << '('; + if( nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE ) + { + rOutStm << ' ' << C_PREF << "Object h" << rBase.aIFaceName.GetBuffer(); + if( GetAttrCount() ) + rOutStm << ','; + else + rOutStm << ' '; + } + + if( GetAttrCount() ) + { + rOutStm << endl; + SvMetaAttribute * pAttr = pAttrList->First(); + while( pAttr ) + { + switch( nT ) + { + case WRITE_C_HEADER: + case WRITE_C_SOURCE: + case WRITE_ODL: + { + pAttr->WriteParam( rBase, rOutStm, nTab +1, nT ); + } + break; + + default: + { + DBG_ASSERT( FALSE, "WriteType not implemented" ) + } + } + pAttr = pAttrList->Next(); + if( pAttr ) + rOutStm << ',' << endl; + } + if( nT != WRITE_C_HEADER && nT != WRITE_C_SOURCE ) + { + rOutStm << endl; + WriteTab( rOutStm, nTab +1 ); + } + rOutStm << ' '; + } + rOutStm << ')'; + } +} + +/************************************************************************* +|* SvMetaType::WriteTypePrefix() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaType::WriteTypePrefix( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab, WriteType nT ) +{ + switch( nT ) + { + case WRITE_IDL: + { + if( GetIn() && GetOut() ) + rOutStm << SvHash_inout()->GetName().GetBuffer() << ' '; + else if( GetIn() ) + rOutStm << SvHash_in()->GetName().GetBuffer() << ' '; + else if( GetOut() ) + rOutStm << SvHash_out()->GetName().GetBuffer() << ' '; + rOutStm << GetCString().GetBuffer(); + } + break; + + case WRITE_ODL: + { + BOOL bIn = GetIn(); + BOOL bOut = GetOut(); + if( bIn || bOut ) + { + if( bIn && bOut ) + rOutStm << "[in,out] "; + else if( bIn ) + rOutStm << "[in] "; + else if( bOut ) + rOutStm << "[out] "; + } + + ByteString aOut; + if( GetType() == TYPE_METHOD ) + aOut = GetReturnType()->GetBaseType()->GetOdlName(); + else + { + SvMetaType * pBType = GetBaseType(); + aOut = pBType->GetOdlName(); + } + if( aCall0 == (int)CALL_POINTER + || aCall0 == (int)CALL_REFERENCE ) + rOutStm << " *"; + if( aCall1 == (int)CALL_POINTER + || aCall1 == (int)CALL_REFERENCE ) + rOutStm << " *"; + rOutStm << aOut.GetBuffer(); + } + break; + + case WRITE_C_HEADER: + case WRITE_C_SOURCE: + case WRITE_CXX_HEADER: + case WRITE_CXX_SOURCE: + { + + SvMetaType * pBaseType = GetBaseType(); + DBG_ASSERT( pBaseType, "no base type for attribute" ) + + if( pBaseType->GetType() == TYPE_METHOD ) + pBaseType->GetReturnType()->WriteTypePrefix( + rBase, rOutStm, nTab, nT ); + else if( nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE ) + { + if( TYPE_STRUCT == pBaseType->GetType() ) + rOutStm << C_PREF << pBaseType->GetName().GetBuffer() + << " *"; + else + { + if ( pBaseType->GetType() == TYPE_ENUM ) + rOutStm << C_PREF; + rOutStm << pBaseType->GetCName().GetBuffer(); + } + } + else + { + if( TYPE_STRUCT == pBaseType->GetType() ) + rOutStm << pBaseType->GetName().GetBuffer() << " *"; + else + rOutStm << pBaseType->GetName().GetBuffer(); + } + } + break; + + case WRITE_DOCU: + { + + SvMetaType * pBaseType = GetBaseType(); + DBG_ASSERT( pBaseType, "no base type for attribute" ) + + if( pBaseType->GetType() == TYPE_METHOD ) + { + pBaseType->GetReturnType()->WriteTypePrefix( + rBase, rOutStm, nTab, nT ); + } + else + { + if( TYPE_STRUCT == pBaseType->GetType() ) + rOutStm << "VARIANT" << pBaseType->GetName().GetBuffer(); + else if ( pBaseType->GetType() == TYPE_ENUM ) + rOutStm << "integer"; + else + rOutStm << pBaseType->GetOdlName().GetBuffer(); + } + } + + default: + { + DBG_ASSERT( FALSE, "WriteType not implemented" ) + } + } +} + +/************************************************************************* +|* SvMetaType::WriteTheType() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaType::WriteTheType( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab, WriteType nT ) +{ + WriteTypePrefix( rBase, rOutStm, nTab, nT ); + if( GetType() == TYPE_METHOD ) + WriteMethodArgs( rBase, rOutStm, nTab +2, nT ); +} + +/************************************************************************* +|* SvMetaType::GetParserString() +|* +|* Beschreibung +*************************************************************************/ +ByteString SvMetaType::GetParserString() const +{ + SvMetaType * pBT = GetBaseType(); + if( pBT != this ) + return pBT->GetParserString(); + + int nType = GetType(); + ByteString aPStr; + + if( TYPE_METHOD == nType || TYPE_STRUCT == nType ) + { + ULONG nAttrCount = GetAttrCount(); + // Die einzelnen Attribute schreiben + for( ULONG n = 0; n < nAttrCount; n++ ) + { + SvMetaAttribute * pT = pAttrList->GetObject( n ); + aPStr += pT->GetType()->GetParserString(); + } + } + else + aPStr = GetParserChar(); + return aPStr; +} + +/************************************************************************* +|* SvMetaType::WriteParamNames() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaType::WriteParamNames( SvIdlDataBase & rBase, + SvStream & rOutStm, + const ByteString & rChief ) +{ + SvMetaType * pBT = GetBaseType(); + if( pBT != this ) + pBT->WriteParamNames( rBase, rOutStm, rChief ); + else + { + int nType = GetType(); + ByteString aPStr; + + if( TYPE_METHOD == nType || TYPE_STRUCT == nType ) + { + ULONG nAttrCount = GetAttrCount(); + // Die einzelnen Attribute schreiben + for( ULONG n = 0; n < nAttrCount; n++ ) + { + SvMetaAttribute * pA = pAttrList->GetObject( n ); + // Fuer Methoden ist rChief immer "" + ByteString aStr = /*rChief; + if( aStr.Len() ) + aStr += "->"; + aStr += */pA->GetName(); + pA->GetType()->WriteParamNames( rBase, rOutStm, aStr ); + if( n +1 < nAttrCount ) + rOutStm << ", "; + } + } + else + rOutStm << rChief.GetBuffer(); + } +} + +#endif // IDL_COMPILER + +/************************************************************************/ +/************************************************************************/ +SV_IMPL_META_FACTORY1( SvMetaTypeString, SvMetaType ); +#ifdef IDL_COMPILER +SvAttributeList & SvMetaTypeString::GetAttributeList() +{ + if( !pAttribList ) + { + pAttribList = new SvAttributeList(); + } + return *pAttribList; +} +#endif +/************************************************************************* +|* +|* SvMetaTypeString::SvMetaTypeString() +|* +|* Beschreibung +|* +*************************************************************************/ +SvMetaTypeString::SvMetaTypeString() + : SvMetaType( "String", "SbxSTRING", "BSTR", 's', "char *", "String", "$" ) +{ +} + +void SvMetaTypeString::Load( SvPersistStream & rStm ) +{ + SvMetaType::Load( rStm ); +} + +void SvMetaTypeString::Save( SvPersistStream & rStm ) +{ + SvMetaType::Save( rStm ); +} + +/************************************************************************/ +/************************************************************************/ +SV_IMPL_META_FACTORY1( SvMetaEnumValue, SvMetaName ); +#ifdef IDL_COMPILER +SvAttributeList & SvMetaEnumValue::GetAttributeList() +{ + if( !pAttribList ) + { + pAttribList = new SvAttributeList(); + } + return *pAttribList; +} +#endif +/************************************************************************* +|* +|* SvMetaEnumValue::SvMetaEnumValue() +|* +|* Beschreibung +|* +*************************************************************************/ +SvMetaEnumValue::SvMetaEnumValue() +{ +} + +void SvMetaEnumValue::Load( SvPersistStream & rStm ) +{ + SvMetaName::Load( rStm ); + + BYTE nMask; + rStm >> nMask; + if( nMask >= 0x02 ) + { + rStm.SetError( SVSTREAM_FILEFORMAT_ERROR ); + DBG_ERROR( "wrong format" ) + return; + } + if( nMask & 0x01 ) rStm.ReadByteString( aEnumValue ); +} + +void SvMetaEnumValue::Save( SvPersistStream & rStm ) +{ + SvMetaName::Save( rStm ); + + // Maske erstellen + BYTE nMask = 0; + if( aEnumValue.Len() ) nMask |= 0x01; + + // Daten schreiben + rStm << nMask; + if( nMask & 0x01 ) rStm.WriteByteString( aEnumValue ); +} + +#ifdef IDL_COMPILER +/************************************************************************* +|* +|* SvMetaEnumValue::ReadSvIdl() +|* +|* Beschreibung +|* +*************************************************************************/ +BOOL SvMetaEnumValue::ReadSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm ) +{ + if( !ReadNameSvIdl( rBase, rInStm ) ) + return FALSE; + return TRUE; +} + +/************************************************************************* +|* +|* SvMetaEnumValue::WriteSvIdl() +|* +|* Beschreibung +|* +*************************************************************************/ +void SvMetaEnumValue::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab ) +{ + rOutStm << GetName().GetBuffer(); +} + +/************************************************************************* +|* +|* SvMetaEnumValue::Write() +|* +|* Beschreibung +|* +*************************************************************************/ +void SvMetaEnumValue::Write( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab, + WriteType nT, WriteAttribute nA ) +{ + if ( nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE ) + rOutStm << C_PREF << GetName().GetBuffer(); + else + rOutStm << GetName().GetBuffer(); +} +#endif // IDL_COMPILER + +/************************************************************************/ +/************************************************************************/ +SV_IMPL_META_FACTORY1( SvMetaTypeEnum, SvMetaType ); +#ifdef IDL_COMPILER +SvAttributeList & SvMetaTypeEnum::GetAttributeList() +{ + if( !pAttribList ) + { + pAttribList = new SvAttributeList(); + } + return *pAttribList; +} +#endif +/************************************************************************* +|* +|* SvMetaTypeEnum::SvMetaTypeEnum() +|* +|* Beschreibung +|* +*************************************************************************/ +SvMetaTypeEnum::SvMetaTypeEnum() +{ + SetBasicName( "Integer" ); +} + +void SvMetaTypeEnum::Load( SvPersistStream & rStm ) +{ + SvMetaType::Load( rStm ); + + BYTE nMask; + rStm >> nMask; + if( nMask >= 0x04 ) + { + rStm.SetError( SVSTREAM_FILEFORMAT_ERROR ); + DBG_ERROR( "wrong format" ) + return; + } + if( nMask & 0x01 ) rStm >> aEnumValueList; + if( nMask & 0x02 ) rStm.ReadByteString( aPrefix ); +} + +void SvMetaTypeEnum::Save( SvPersistStream & rStm ) +{ + SvMetaType::Save( rStm ); + + // Maske erstellen + BYTE nMask = 0; + if( aEnumValueList.Count() ) nMask |= 0x01; + if( aPrefix.Len() ) nMask |= 0x02; + + // Daten schreiben + rStm << nMask; + if( nMask & 0x01 ) rStm << aEnumValueList; + if( nMask & 0x02 ) rStm.WriteByteString( aPrefix ); +} + +/************************************************************************* +|* +|* SvMetaTypeEnum::GetMaxValue() +|* +|* Beschreibung +|* +*************************************************************************/ +/* +USHORT SvMetaTypeEnum::GetMaxValue() const +{ + USHORT nMax = 0; + for( ULONG n = 0; n < aEnumValueList.Count(); n++ ) + { + SvMetaEnumValue * pObj = aEnumValueList.GetObject( n ); + if( nMax < pObj->GetValue() ) + nMax = pObj->GetValue(); + } + return nMax; +} +*/ + +#ifdef IDL_COMPILER +/************************************************************************* +|* +|* SvMetaTypeEnum::ReadContextSvIdl() +|* +|* Beschreibung +|* +*************************************************************************/ +void SvMetaTypeEnum::ReadContextSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm ) +{ + UINT32 nTokPos = rInStm.Tell(); + + SvMetaEnumValueRef aEnumVal = new SvMetaEnumValue(); + BOOL bOk = aEnumVal->ReadSvIdl( rBase, rInStm ); + if( bOk ) + { + if( 0 == aEnumValueList.Count() ) + // der Erste + aPrefix = aEnumVal->GetName(); + else + { + USHORT nPos = aPrefix.Match( aEnumVal->GetName() ); + if( nPos != aPrefix.Len() && nPos != STRING_MATCH ) + aPrefix.Erase( nPos ); + } + aEnumValueList.Append( aEnumVal ); + } + if( !bOk ) + rInStm.Seek( nTokPos ); +} + +/************************************************************************* +|* +|* SvMetaTypeEnum::WriteSvIdl() +|* +|* Beschreibung +|* +*************************************************************************/ +void SvMetaTypeEnum::WriteContextSvIdl( SvIdlDataBase & rBase, + SvStream & rOutStm, + USHORT nTab ) +{ + WriteTab( rOutStm, nTab +1 ); + for( ULONG n = 0; n < aEnumValueList.Count(); n++ ) + { + aEnumValueList.GetObject( n )->WriteSvIdl( rBase, rOutStm, nTab ); + if( n +1 != aEnumValueList.Count() ) + rOutStm << ", "; + else + rOutStm << endl; + } +} + +/************************************************************************* +|* +|* SvMetaTypeEnum::ReadSvIdl() +|* +|* Beschreibung +|* +*************************************************************************/ +BOOL SvMetaTypeEnum::ReadSvIdl( SvIdlDataBase & rBase, + SvTokenStream & rInStm ) +{ + UINT32 nTokPos = rInStm.Tell(); + if( SvMetaType::ReadHeaderSvIdl( rBase, rInStm ) + && GetType() == TYPE_ENUM ) + { + if( SvMetaName::ReadSvIdl( rBase, rInStm ) ) + return TRUE; + } + rInStm.Seek( nTokPos ); + return FALSE; +} + +/************************************************************************* +|* +|* SvMetaTypeEnum::WriteSvIdl() +|* +|* Beschreibung +|* +*************************************************************************/ +void SvMetaTypeEnum::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab ) +{ + WriteHeaderSvIdl( rBase, rOutStm, nTab ); + rOutStm << endl; + SvMetaName::WriteSvIdl( rBase, rOutStm, nTab ); + rOutStm << endl; +} + +/************************************************************************* +|* +|* SvMetaTypeEnum::Write() +|* +|* Beschreibung +|* +*************************************************************************/ +void SvMetaTypeEnum::Write( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab, + WriteType nT, WriteAttribute nA ) +{ + SvMetaType::Write( rBase, rOutStm, nTab, nT, nA ); +} + +/************************************************************************* +|* SvMetaTypeEnum::WriteContext() +|* +|* Beschreibung +*************************************************************************/ +void SvMetaTypeEnum::WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm, + USHORT nTab, + WriteType nT, WriteAttribute nA ) +{ + WriteTab( rOutStm, nTab +1 ); + for( ULONG n = 0; n < aEnumValueList.Count(); n++ ) + { + aEnumValueList.GetObject( n )->Write( rBase, rOutStm, nTab +1, nT, nA ); + + if( n +1 != aEnumValueList.Count() ) + { + if( 2 == n % 3 ) + { + rOutStm << ',' << endl; + WriteTab( rOutStm, nTab +1 ); + } + else + rOutStm << ",\t"; + } + else + rOutStm << endl; + } + rOutStm << endl; +} + +#endif // IDL_COMPILER + +/************************************************************************/ +/************************************************************************/ +SV_IMPL_META_FACTORY1( SvMetaTypevoid, SvMetaType ); +#ifdef IDL_COMPILER +SvAttributeList & SvMetaTypevoid::GetAttributeList() +{ + if( !pAttribList ) + { + pAttribList = new SvAttributeList(); + } + return *pAttribList; +} +#endif +/************************************************************************* +|* +|* SvMetaTypevoid::SvMetaTypevoid() +|* +|* Beschreibung +|* +*************************************************************************/ +SvMetaTypevoid::SvMetaTypevoid() + : SvMetaType( "void", "SbxVOID", "void", 'v', "void", "", "" ) +{ +} + +void SvMetaTypevoid::Load( SvPersistStream & rStm ) +{ + SvMetaType::Load( rStm ); +} + +void SvMetaTypevoid::Save( SvPersistStream & rStm ) +{ + SvMetaType::Save( rStm ); +} + +ByteString SvMetaAttribute::Compare( SvMetaAttribute* pAttr ) +{ + ByteString aStr; + + if ( aType.Is() ) + { + if ( aType->GetType() == TYPE_METHOD ) + { + // Nur testen, wenn das Attribut eine Methode ist, nicht wenn es + // eine hat !! + if ( !pAttr->GetType()->GetType() == TYPE_METHOD ) + aStr += " IsMethod\n"; + else if ( aType->GetReturnType() && + aType->GetReturnType()->GetType() != pAttr->GetType()->GetReturnType()->GetType() ) + aStr += " ReturnType\n"; + + if ( aType->GetAttrCount() ) + { + USHORT nCount = aType->GetAttrCount(); + SvMetaAttributeMemberList& rList = aType->GetAttrList(); + SvMetaAttributeMemberList& rOtherList = pAttr->GetType()->GetAttrList(); + USHORT nOtherCount = pAttr->GetType()->GetAttrCount(); + if ( nOtherCount != nCount ) + { + aStr += " AttributeCount\n"; + } + else + { + for ( USHORT n=0; n<nCount; n++ ) + { + SvMetaAttribute *pAttr1 = rList.GetObject(n); + SvMetaAttribute *pAttr2 = rOtherList.GetObject(n); + pAttr1->Compare( pAttr2 ); + } + } + } + } + + if ( GetType()->GetType() != pAttr->GetType()->GetType() ) + aStr += " Type\n"; + + if ( !GetType()->GetSvName().Equals( pAttr->GetType()->GetSvName() ) ) + aStr += " ItemType\n"; + } + + if ( GetExport() != pAttr->GetExport() ) + aStr += " Export\n"; + + if ( GetAutomation() != pAttr->GetAutomation() ) + aStr += " Automation\n"; + + if ( GetIsCollection() != pAttr->GetIsCollection() ) + aStr += " IsCollection\n"; + + if ( GetReadOnlyDoc() != pAttr->GetReadOnlyDoc() ) + aStr += " ReadOnlyDoc\n"; + + if ( GetExport() && GetReadonly() != pAttr->GetReadonly() ) + aStr += " Readonly\n"; + + return aStr; +} + +void SvMetaAttribute::WriteCSV( SvIdlDataBase& rBase, SvStream& rStrm ) +{ + rStrm << GetType()->GetSvName().GetBuffer() << ' '; + rStrm << GetName().GetBuffer() << ' '; + rStrm << GetSlotId().GetBuffer(); +} + + diff --git a/idl/source/prj/command.cxx b/idl/source/prj/command.cxx new file mode 100644 index 000000000000..9961f737339d --- /dev/null +++ b/idl/source/prj/command.cxx @@ -0,0 +1,472 @@ +/************************************************************************* + * + * $RCSfile: command.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________ + * + * + ************************************************************************/ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <ctype.h> + +#include <command.hxx> +#include <globals.hxx> +#include <database.hxx> + +#ifndef _FSYS_HXX //autogen +#include <tools/fsys.hxx> +#endif + +#pragma hdrstop + +/************************************************************************* +|* +|* Syntaxbeschreibung +|* +*************************************************************************/ +char* SyntaxStrings[] = { +"basic-type:", +"\tvoid| char| int| float| double|", +"\tUINT16| INT16| UINT32| INT32| BOOL|", +"\tBYTE| String| SbxObject", +"", +"{ import \"filename\" }\n", +"module definition:", +"module", +"\tunique id range (ask MM)", +"modul-name", +"'['", +"\tSlotIdFile( \"filename\" )", +"']'", +"'{'", +"\t{ include \"filename\" }\n", + +"\titem definition:", +"\titem type item-name;\n", + +"\ttype definition:", +"\tstruct | union identifier", +"\t'{'", +"\t\t{ type idetifier }", +"\t'}'", +"\t|", +"\tenum identifier", +"\t'{'", +"\t\t{ identifier, }", +"\t'}'", +"\t|", +"\ttypedef type identifier\n", + +"\titem-method:", +"\titem identifier item-method-args\n", + +"\titem-method-args:", +"\t( { item parameter-name SLOT_ID } )\n", + +"\tslot definition:", +"\titem identifier SLOT_ID [ item-method-args ]", +"\t'['\n", + +"\t\titem-method-args", +"\t\tAccelConfig, MenuConfig, StatusBarConfig, ToolbarConfig", +"\t\tAutomation*", +"\t\tAutoUpdate", +"\t\tCachable*, Volatile", +"\t\tContainer", +"\t\tDefault = Identifier", +"\t\tExecMethod = Identifier", +"\t\tExport*", +"\t\tFastCall", +"\t\tGet, Set", +"\t\tGroupId = Identifier", +"\t\tHasCoreId", +"\t\tHasDialog", +"\t\tIsCollection", +"\t\tPlugComm", +"\t\tPseudoPrefix = Identifier", +"\t\tPseudoSlots", +"\t\tReadOnly", +"\t\tReadOnlyDoc*", +"\t\tRecordPerSet*, RecordPerItem, RecordManual, NoRecord", +"\t\tRecordAbsolute", +"\t\tStateMethod = Identifier", +"\t\tSynchron*, Asynchron", +"\t\tToggle", +"\t']'\n", + +"\tinterface definition:", +"\tshell | interface identifier ':' interface", +"\t'{'", +"\t\t{ slot }", +"\t'}'\n", +"---syntax example is sfx.idl---\n", +NULL }; + +char CommandLineSyntax[] = +"-fs<slotmap file> -fl<listing file>\n" +"-fo<odl file> -fd<data base file>\n" +"-fi<item implementation> -ft<type library file> (not OLE)\n" +"-fr<ressource file> -fm<makefile target file>\n" +"-fC<c++ source file> -fH<c++ header file>\n" +"-fc<c source file> -fh<c header file>\n" +"-rsc <*.srs header line>\n" +"-help, ? @<file> response file\n" +" <filenames>\n"; + +/************************************************************************* +|* +|* Init() +|* +|* Beschreibung +|* Ersterstellung MM 15.12.94 +|* Letzte Aenderung MM 15.12.94 +|* +*************************************************************************/ +void Init( const SvCommand & rCommand ) +{ + if( !IDLAPP->pHashTable ) + IDLAPP->pHashTable = new SvStringHashTable( 2801 ); + if( !IDLAPP->pGlobalNames ) + IDLAPP->pGlobalNames = new SvGlobalHashNames(); +} + +/************************************************************************* +|* +|* DeInit() +|* +|* Beschreibung +|* +*************************************************************************/ +void DeInit() +{ + delete IDLAPP; +} + +/************************************************************************* +|* +|* DeInit() +|* +|* Beschreibung +|* +*************************************************************************/ +BOOL ReadIdl( SvIdlWorkingBase * pDataBase, const SvCommand & rCommand ) +{ + for( USHORT n = 0; n < rCommand.aInFileList.Count(); n++ ) + { + String aFileName ( *rCommand.aInFileList.GetObject( n ) ); + SvFileStream aStm( aFileName, STREAM_STD_READ | STREAM_NOCREATE ); + if( aStm.GetError() == SVSTREAM_OK ) + { + if( pDataBase->IsBinaryFormat( aStm ) ) + { + pDataBase->Load( aStm ); + if( aStm.GetError() != SVSTREAM_OK ) + { + ByteString aStr; + if( aStm.GetError() == SVSTREAM_FILEFORMAT_ERROR ) + aStr = "error: incompatible format, file "; + else if( aStm.GetError() == SVSTREAM_WRONGVERSION ) + aStr = "error: wrong version, file "; + else + aStr = "error during load, file "; + aStr += ByteString( aFileName, RTL_TEXTENCODING_UTF8 ); + fprintf( stderr, "%s\n", aStr.GetBuffer() ); + return FALSE; + } + } + else + { + SvTokenStream aTokStm( aStm, aFileName ); + if( !pDataBase->ReadSvIdl( aTokStm, FALSE, rCommand.aPath ) ) + return FALSE; + } + } + else + return FALSE; + } + return TRUE; +} + +/************************************************************************* +|* +|* SvCommand::SvCommand() +|* +|* Beschreibung +|* Ersterstellung MM 15.12.94 +|* Letzte Aenderung MM 15.12.94 +|* +*************************************************************************/ +SvCommand::SvCommand() + : nFlags( 0 ) +{ + DirEntry aEntry; + aPath = aEntry.GetFull(); //Immer im Aktuellen Pfad suchen +} + +/************************************************************************* +|* +|* SvCommand::SvCommand() +|* +|* Beschreibung +|* +*************************************************************************/ +static BOOL ResponseFile( StringList * pList, int argc, char ** argv ) +{ + // Programmname + pList->Insert( new String( String::CreateFromAscii(*argv) ), LIST_APPEND ); + for( int i = 1; i < argc; i++ ) + { + if( '@' == **(argv +i) ) + { // wenn @, dann Response-Datei + SvFileStream aStm( String::CreateFromAscii((*(argv +i)) +1), STREAM_STD_READ | STREAM_NOCREATE ); + if( aStm.GetError() != SVSTREAM_OK ) + return FALSE; + + ByteString aStr; + while( aStm.ReadLine( aStr ) ) + { + USHORT n = 0; + USHORT nPos = 1; + while( n != nPos ) + { + while( aStr.GetChar(n) && isspace( aStr.GetChar(n) ) ) + n++; + nPos = n; + while( aStr.GetChar(n) && !isspace( aStr.GetChar(n) ) ) + n++; + if( n != nPos ) + pList->Insert( new String( String::CreateFromAscii( aStr.Copy( nPos, n - nPos ).GetBuffer() ) ), LIST_APPEND ); + } + } + } + else if( argv[ i ] ) + pList->Insert( new String( String::CreateFromAscii( argv[ i ] ) ), LIST_APPEND ); + } + return TRUE; +} + +/************************************************************************* +|* SvCommand::SvCommand() +|* +|* Beschreibung +*************************************************************************/ +SvCommand::SvCommand( int argc, char ** argv ) + : nFlags( 0 ) +{ + StringList aList; + + if( ResponseFile( &aList, argc, argv ) ) + for( ULONG i = 1; i < aList.Count(); i++ ) + { + String aParam( *aList.GetObject( i ) ); + sal_Unicode aFirstChar( aParam.GetChar(0) ); + if( '-' == aFirstChar ) + { + aParam.Erase( 0, 1 ); + aFirstChar = aParam.GetChar(0); + if( aFirstChar == 'F' || aFirstChar == 'f' ) + { + aParam.Erase( 0, 1 ); + aFirstChar = aParam.GetChar(0); + String aName( aParam.Copy( 1 ) ); + if( 's' == aFirstChar ) + { // Name der Slot-Ausgabe + aSlotMapFile = aName; + } + else if( 'l' == aFirstChar ) + { // Name der Listing + aListFile = aName; + } + else if( 'i' == aFirstChar ) + { // Name der Item-Datei +// aSfxItemFile = aName; + } + else if( 'o' == aFirstChar ) + { // Name der ODL-Datei +// aODLFile = aName; + } + else if( 'd' == aFirstChar ) + { // Name der Datenbasis-Datei + aDataBaseFile = aName; + } + else if( 'D' == aFirstChar ) + { // Name der Docu-Datei f"ur das API +// aDocuFile = aName; + } + else if( 'C' == aFirstChar ) + { // Name der cxx-Datei +// aCxxFile = aName; + } + else if( 'H' == aFirstChar ) + { // Name der hxx-Datei +// aHxxFile = aName; + } + else if( 'c' == aFirstChar ) + { // Name der C-Header-Datei +// aCSourceFile = aName; + } + else if( 'h' == aFirstChar ) + { // Name der C-Header-Datei +// aCHeaderFile = aName; + } + else if( 't' == aFirstChar ) + { // Name der Info-Datei +// aCallingFile = aName; + } + else if( 'm' == aFirstChar ) + { // Name der Info-Datei + aTargetFile = aName; + } + else if( 'r' == aFirstChar ) + { // Name der Resource-Datei +// aSrcFile = aName; + } + else if( 'z' == aFirstChar ) + { // Name der HelpId-Datei + aHelpIdFile = aName; + } + else if( 'y' == aFirstChar ) + { // Name der CSV-Datei + aCSVFile = aName; + } + else if( 'x' == aFirstChar ) + { // Name der IDL-Datei fuer die CSV-Datei + aExportFile = aName; + } + else + { + printf( "unknown switch: %s\n", aParam.GetBuffer() ); + exit( -1 ); + } + } + else if( aParam.EqualsIgnoreCaseAscii( "help" ) || aParam.EqualsIgnoreCaseAscii( "?" ) ) + { // Hilfe + printf( CommandLineSyntax ); + } + else if( aParam.EqualsIgnoreCaseAscii( "syntax" ) ) + { // Hilfe + int i = 0; + while(SyntaxStrings[i]) + printf("%s\n",SyntaxStrings[i++]); + } + else if( aParam.EqualsIgnoreCaseAscii( "i", 0, 1 ) ) + { // Include-Pfade definieren + String aName( aParam.Copy( 1 ) ); + if( aPath.Len() ) + aPath += DirEntry::GetSearchDelimiter(); + aPath += aName; + } + else if( aParam.EqualsIgnoreCaseAscii( "rsc", 0, 3 ) ) + { // erste Zeile im *.srs File + if( aList.GetObject( i +1 ) ) + { + aSrsLine = ByteString( *aList.GetObject( i +1 ), RTL_TEXTENCODING_UTF8 ); + i++; + } + } + else + { +#if SUPD>589 + // temporary compatibility hack + printf( "unknown switch: %s\n", aParam.GetBuffer() ); + exit( -1 ); +#endif + } + } + else + { + aInFileList.Insert( new String( aParam ), LIST_APPEND ); + } + } + else + { + printf( CommandLineSyntax ); + } + + String * pStr = aList.First(); + while( pStr ) + { + delete pStr; + pStr = aList.Next(); + } + + ByteString aInc( getenv( "INCLUDE" ) ); + // Include Environmentvariable anhaengen + if( aInc.Len() ) + { + if( aPath.Len() ) + aPath += DirEntry::GetSearchDelimiter(); + aPath += String::CreateFromAscii( aInc.GetBuffer() ); + } +} + +/************************************************************************* +|* +|* SvCommand::~SvCommand() +|* +|* Beschreibung +|* +*************************************************************************/ +SvCommand::~SvCommand() +{ + // ByteString Liste freigeben + String * pStr; + while( NULL != (pStr = aInFileList.Remove()) ) + delete pStr; +} + diff --git a/idl/source/prj/database.cxx b/idl/source/prj/database.cxx new file mode 100644 index 000000000000..ec47b5d73530 --- /dev/null +++ b/idl/source/prj/database.cxx @@ -0,0 +1,1378 @@ +/************************************************************************* + * + * $RCSfile: database.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________ + * + * + ************************************************************************/ + +#include <ctype.h> +#include <stdio.h> +#include <stdlib.h> + +#ifndef _FSYS_HXX //autogen +#include <tools/fsys.hxx> +#endif +#include <tools/debug.hxx> +#include <database.hxx> +#include <globals.hxx> +#pragma hdrstop + + +/****************** SvIdlDataBase ****************************************/ +/************************************************************************* +|* SvIdlDataBase::SvIdlDataBase() +|* +|* Beschreibung +*************************************************************************/ +/* +void PrimeNumber(){ + USHORT i, n; + for( i = 5001; i < 5500; i += 2 ){ + for( n = 2; n < i && ((i % n) != 0); n++ ); + if( n == i ){ + printf( "\nPrimzahl: %d\n", i ); + return; + } + } +} +*/ + +SvIdlDataBase::SvIdlDataBase() + : bIsModified( FALSE ) + , bExport( FALSE ) + , aPersStream( *IDLAPP->pClassMgr, NULL ) + , pIdTable( NULL ) + , nUniqueId( 0 ) +{ + //PrimeNumber(); +} + +/************************************************************************* +|* SvIdlDataBase::~SvIdlDataBase() +|* +|* Beschreibung +*************************************************************************/ +SvIdlDataBase::~SvIdlDataBase() +{ + String * pStr = aIdFileList.First(); + while( pStr ) + { + delete pStr; + pStr = aIdFileList.Next(); + } + delete pIdTable; +} + +/************************************************************************* +|* SvIdlDataBase::IsModified() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvIdlDataBase::IsModified() const +{ + for( ULONG n = 0; n < aModuleList.Count(); n++ ) + if( aModuleList.GetObject( n )->IsModified() ) + return TRUE; + //bIsModified; + return FALSE; +} + +/************************************************************************* +|* SvIdlDataBase::GetTypeList() +|* +|* Beschreibung +*************************************************************************/ +#define ADD_TYPE( Name, OdlName, ParserChar, CName, BasName, BasPost ) \ + aTypeList.Append( new SvMetaType( SvHash_##Name()->GetName(), \ + BasName, OdlName, ParserChar, CName, BasName, BasPost ) ); + +SvMetaTypeMemberList & SvIdlDataBase::GetTypeList() +{ + if( aTypeList.Count() == 0 ) + { // Initial fuellen + aTypeList.Append( new SvMetaTypeString() ); + aTypeList.Append( new SvMetaTypevoid() ); + + // MI: IDispatch::Invoke kann keine unsigned + ADD_TYPE( UINT16, "long", 'h', "unsigned short", "Long", "&" ); + ADD_TYPE( INT16, "short", 'h', "short", "Integer", "%" ); + ADD_TYPE( UINT32, "long", 'l', "unsigned long", "Long", "&" ); + ADD_TYPE( INT32, "long", 'l', "long", "Long", "&" ); + ADD_TYPE( int, "int", 'i', "int", "Integer", "%" ); + ADD_TYPE( BOOL, "boolean", 'b', "unsigned char", "Boolean", "" ); + ADD_TYPE( char, "char", 'c', "char", "Integer", "%" ); + ADD_TYPE( BYTE, "char", 'c', "unsigned char", "Integer", "%" ); + ADD_TYPE( float, "float", 'f', "float", "Single", "!" ); + ADD_TYPE( double, "double", 'F', "double", "Double", "#" ); + ADD_TYPE( SbxObject, "VARIANT", 'o', "C_Object", "Object", "" ); + + // A c h t u n g !!!, bei hinzufuegen von Typen werden alle + // binren Datenbasen inkompatibel + + /* + // So tun als ob die Init-Daten auf einem Stream gelesen wurden + SvMemoryStream aStm; + aPersStream.SetStream( &aStm ); + // Alle Init-Daten Streamen + aPersStream << aTypeList; + // Nur die Id-Zuordnung merken + aPersStream.SetStream( NULL ); + */ + } + return aTypeList; +} + +/************************************************************************* +|* +|* SvIdlDataBase::GetModuleInfo() +|* +|* Beschreibung +|* Ersterstellung MM 13.12.94 +|* Letzte Aenderung MM 13.12.94 +|* +*************************************************************************/ +SvMetaModule * SvIdlDataBase::GetModule( const ByteString & rName ) +{ + for( ULONG n = 0; n < aModuleList.Count(); n++ ) + if( aModuleList.GetObject( n )->GetName() == rName ) + return aModuleList.GetObject( n ); + return NULL; +} + +/************************************************************************* +|* +|* SvIdlDataBase::IsBinaryFormat() +|* +|* Beschreibung +|* +*************************************************************************/ +#define DATABASE_SIGNATURE (UINT32)0x13B799F2 +#define DATABASE_VER 0x0006 +BOOL SvIdlDataBase::IsBinaryFormat( SvStream & rStm ) +{ + UINT32 nSig = 0; + ULONG nPos = rStm.Tell(); + rStm >> nSig; + rStm.Seek( nPos ); + + return nSig == DATABASE_SIGNATURE; +} + +/************************************************************************* +|* +|* SvIdlDataBase::Load() +|* +|* Beschreibung +|* +*************************************************************************/ +void SvIdlDataBase::Load( SvStream & rStm ) +{ + DBG_ASSERT( aTypeList.Count() == 0, "type list already initialized" ) + SvPersistStream aPStm( *IDLAPP->pClassMgr, &rStm ); + + USHORT nVersion = 0; + UINT32 nSig = 0; + + aPStm >> nSig; + aPStm >> nVersion; + if( nSig != DATABASE_SIGNATURE ) + { + aPStm.SetError( SVSTREAM_FILEFORMAT_ERROR ); + return; + } + if( nVersion != DATABASE_VER ) + { + aPStm.SetError( SVSTREAM_WRONGVERSION ); + return; + } + aPStm >> aClassList; + aPStm >> aTypeList; + aPStm >> aAttrList; + aPStm >> aModuleList; + aPStm >> nUniqueId; + + if( aPStm.IsEof() ) + aPStm.SetError( SVSTREAM_GENERALERROR ); +} + +/************************************************************************* +|* SvIdlDataBase::Save() +|* +|* Beschreibung +*************************************************************************/ +void SvIdlDataBase::Save( SvStream & rStm, UINT32 nFlags ) +{ + SvPersistStream aPStm( *IDLAPP->pClassMgr, &rStm ); + aPStm.SetContextFlags( nFlags ); + + aPStm << (UINT32)DATABASE_SIGNATURE; + aPStm << (USHORT)DATABASE_VER; + + BOOL bOnlyStreamedObjs = FALSE; + if( nFlags & IDL_WRITE_CALLING ) + bOnlyStreamedObjs = TRUE; + + if( bOnlyStreamedObjs ) + { + SvMetaClassMemberList aList; + for( ULONG n = 0; n < GetModuleList().Count(); n++ ) + { + SvMetaModule * pModule = GetModuleList().GetObject( n ); + if( !pModule->IsImported() ) + aList.Append( pModule->GetClassList() ); + } + aPStm << aList; + } + else + aPStm << aClassList; + + //aClassList.WriteObjects( aPStm, bOnlyStreamedObjs ); + aTypeList.WriteObjects( aPStm, bOnlyStreamedObjs ); + aAttrList.WriteObjects( aPStm, bOnlyStreamedObjs ); + aModuleList.WriteObjects( aPStm, bOnlyStreamedObjs ); + aPStm << nUniqueId; +} + +/************************************************************************* +|* SvIdlDataBase::SetError() +|* +|* Beschreibung +*************************************************************************/ +void SvIdlDataBase::SetError( const ByteString & rError, SvToken * pTok ) +{ + if( pTok->GetLine() > 10000 ) + aError.SetText( "hgchcg" ); + + if( aError.nLine < pTok->GetLine() + || aError.nLine == pTok->GetLine() && aError.nColumn < pTok->GetColumn() ) + { + aError = SvIdlError( pTok->GetLine(), pTok->GetColumn() ); + aError.SetText( rError ); + } +} + +/************************************************************************* +|* SvIdlDataBase::Push() +|* +|* Beschreibung +*************************************************************************/ +void SvIdlDataBase::Push( SvMetaObject * pObj ) +{ + GetStack().Push( pObj ); +} + +#ifdef IDL_COMPILER +/************************************************************************* +|* +|* SvIdlDataBase::FindId() +|* +|* Beschreibung +|* +*************************************************************************/ +BOOL SvIdlDataBase::FindId( const ByteString & rIdName, ULONG * pVal ) +{ + if( pIdTable ) + { + UINT32 nHash; + if( pIdTable->Test( rIdName, &nHash ) ) + { + *pVal = pIdTable->Get( nHash )->GetValue(); + return TRUE; + } + } + return FALSE; +} + +/************************************************************************* +|* +|* SvIdlDataBase::InsertId() +|* +|* Beschreibung +|* +*************************************************************************/ +BOOL SvIdlDataBase::InsertId( const ByteString & rIdName, ULONG nVal ) +{ + if( !pIdTable ) + pIdTable = new SvStringHashTable( 20003 ); + + UINT32 nHash; + if( pIdTable->Insert( rIdName, &nHash ) ) + { + pIdTable->Get( nHash )->SetValue( nVal ); + return TRUE; + } + return FALSE; +} + +/************************************************************************* +|* SvIdlDataBase::ReadIdFile() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvIdlDataBase::ReadIdFile( const String & rFileName ) +{ +#ifndef MAC + DirEntry aFullName( rFileName ); +#else + DirEntry aFullName( rFileName, FSYS_STYLE_UNX ); +#endif + aFullName.Find( GetPath() ); + + String * pIdFile = aIdFileList.First(); + while( pIdFile ) + { + if( *pIdFile == rFileName ) + return TRUE; // schon eingelesen + pIdFile = aIdFileList.Next(); + } + + aIdFileList.Insert( new String( rFileName ), LIST_APPEND ); + + SvTokenStream aTokStm( aFullName.GetFull() ); + if( aTokStm.GetStream().GetError() == SVSTREAM_OK ) + { + SvToken * pTok = aTokStm.GetToken_Next(); + + while( !pTok->IsEof() ) + { + if( pTok->IsChar() && pTok->GetChar() == '#' ) + { + pTok = aTokStm.GetToken_Next(); + if( pTok->Is( SvHash_define() ) ) + { + pTok = aTokStm.GetToken_Next(); + ByteString aDefName; + if( pTok->IsIdentifier() ) + aDefName = pTok->GetString(); + else + { + ByteString aStr( "unexpected token after define" ); + // Fehler setzen + SetError( aStr, pTok ); + WriteError( aTokStm ); + return FALSE; + } + + ULONG nVal = 0; + BOOL bOk = TRUE; + while( bOk ) + { + pTok = aTokStm.GetToken_Next(); + if( pTok->IsIdentifier() ) + { + ULONG n; + if( FindId( pTok->GetString(), &n ) ) + nVal += n; + else + bOk = FALSE; + } + else if( pTok->IsChar() ) + { + if( pTok->GetChar() == '-' + || pTok->GetChar() == '/' + || pTok->GetChar() == '*' + || pTok->GetChar() == '&' + || pTok->GetChar() == '|' + || pTok->GetChar() == '^' + || pTok->GetChar() == '~' ) + { + ByteString aStr( "unknown operator '" ); + aStr += pTok->GetChar(); + aStr += "'in define"; + // Fehler setzen + SetError( aStr, pTok ); + WriteError( aTokStm ); + return FALSE; + } + if( pTok->GetChar() != '+' + && pTok->GetChar() != '(' + && pTok->GetChar() != ')' ) + // nur + erlaubt, Klammern spielen kein Rolle, + // da + komutativ ist + break; + } + else if( pTok->IsInteger() ) + { + nVal += pTok->GetNumber(); + } + else + break; + } + if( bOk ) + { + if( !InsertId( aDefName, nVal ) ) + { + ByteString aStr = "hash table overflow: "; + SetError( aStr, pTok ); + WriteError( aTokStm ); + return FALSE; + } + } + } + else if( pTok->Is( SvHash_include() ) ) + { + pTok = aTokStm.GetToken_Next(); + ByteString aName; + if( pTok->IsString() ) + aName = pTok->GetString(); + else if( pTok->IsChar() && pTok->GetChar() == '<' ) + { + pTok = aTokStm.GetToken_Next(); + while( !pTok->IsEof() + && !(pTok->IsChar() && pTok->GetChar() == '>') ) + { + aName += pTok->GetTokenAsString(); + pTok = aTokStm.GetToken_Next(); + } + if( pTok->IsEof() ) + { + ByteString aStr( "unexpected eof in #include" ); + // Fehler setzen + SetError( aStr, pTok ); + WriteError( aTokStm ); + return FALSE; + } + } + if( !ReadIdFile( String::CreateFromAscii(aName.GetBuffer()) ) ) + { + ByteString aStr = "cannot read file: "; + aStr += aName; + SetError( aStr, pTok ); + WriteError( aTokStm ); + return FALSE; + } + } + } + else + pTok = aTokStm.GetToken_Next(); + } + } + else + return FALSE; + return TRUE; +} + +/************************************************************************* +|* SvIdlDataBase::FindType() +|* +|* Beschreibung +*************************************************************************/ +SvMetaType * SvIdlDataBase::FindType( const SvMetaType * pPType, + SvMetaTypeMemberList & rList ) +{ + SvMetaType * pType = rList.First(); + while( pType && pPType != pType ) + pType = rList.Next(); + return pType; +} + +SvMetaType * SvIdlDataBase::FindType( const ByteString & rName ) +{ + SvMetaType * pType = aTypeList.First(); + while( pType && rName != pType->GetName() ) + pType = aTypeList.Next(); + return pType; +} + +/************************************************************************* +|* SvIdlDataBase::FindName() +|* +|* Beschreibung +*************************************************************************/ +ByteString * SvIdlDataBase::FindName( const ByteString & rName, ByteStringList & rList ) +{ + ByteString * pS = rList.First(); + while( pS && *pS != rName ) + pS = rList.Next(); + return pS; +} + +/************************************************************************* +|* SvIdlDataBase::FillTypeList() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvIdlDataBase::FillTypeList( SvMetaTypeList & rOutList, + SvToken * pNameTok ) +{ + rOutList.Clear(); +// if( pNameTok->IsIdentifierHash() ) Optimierung spaeter + if( pNameTok->IsIdentifier() ) + { + ByteString aName = pNameTok->GetString(); + SvMetaType * pMetaType = GetTypeList().First(); + while( pMetaType ) + { + if( pMetaType->GetName() == aName ) + rOutList.Insert( pMetaType, LIST_APPEND ); + pMetaType = GetTypeList().Next(); + } + } + return rOutList.Count() != 0; +} + +/************************************************************************* +|* SvIdlDataBase::ReadKnownType() +|* +|* Beschreibung +*************************************************************************/ +SvMetaType * SvIdlDataBase::ReadKnownType( SvTokenStream & rInStm ) +{ + BOOL bIn = FALSE; + BOOL bOut = FALSE; + int nCall0 = CALL_VALUE; + int nCall1 = CALL_VALUE; + BOOL bSet = FALSE; //irgent ein Attribut gesetzt + + UINT32 nTokPos = rInStm.Tell(); + SvToken * pTok = rInStm.GetToken_Next(); + + if( pTok->HasHash() ) + { + UINT32 nBeginPos = 0; // kann mit Tell nicht vorkommen + while( nBeginPos != rInStm.Tell() ) + { + nBeginPos = rInStm.Tell(); + if( pTok->Is( SvHash_in() ) ) + { + bIn = TRUE; + pTok = rInStm.GetToken_Next(); + bSet = TRUE; + } + if( pTok->Is( SvHash_out() ) ) + { + bOut = TRUE; + pTok = rInStm.GetToken_Next(); + bSet = TRUE; + } + if( pTok->Is( SvHash_inout() ) ) + { + bIn = TRUE; + bOut = TRUE; + pTok = rInStm.GetToken_Next(); + bSet = TRUE; + } + } + } +/* + SvMetaTypeList aTmpTypeList; + if( FillTypeList( aTmpTypeList, pTok ) ) +*/ + if( pTok->IsIdentifier() ) + { + ByteString aName = pTok->GetString(); + SvMetaTypeMemberList & rList = GetTypeList(); + SvMetaType * pType = rList.First(); + while( pType ) + { + if( pType->GetName() == aName ) + break; + pType = rList.Next(); + } + if( pType ) + { + pTok = rInStm.GetToken(); + if( pTok->IsChar() ) + { + if( pTok->GetChar() == '&' || pTok->GetChar() == '*' ) + { + nCall0 = (pTok->GetChar() == '&') ? CALL_REFERENCE : + CALL_POINTER; + rInStm.GetToken_Next(); + pTok = rInStm.GetToken(); + if( pTok->GetChar() == '&' || pTok->GetChar() == '*' ) + { + nCall1 = (pTok->GetChar() == '&') ? CALL_REFERENCE : + CALL_POINTER; + rInStm.GetToken_Next(); + } + bSet = TRUE; + } + } + /* + SvMetaType * pMetaType = aTmpTypeList.First(); + while( pMetaType ) + { + if( pMetaType->GetIn() == bIn + && pMetaType->GetOut() == bOut + && pMetaType->GetCall0() == nCall0 + && pMetaType->GetCall1() == nCall1 ) + { + return pMetaType; + } + pMetaType = aTmpTypeList.Next(); + } + */ + //SvMetaType * pType = aTmpTypeList.First(); + if( !bSet ) + // Ist genau dieser Typ + return pType; + + DBG_ASSERT( aTmpTypeList.First(), "mindestens ein Element" ) + SvMetaTypeRef xType = new SvMetaType( pType->GetName(), 'h', "dummy" ); + xType->SetRef( pType ); + xType->SetIn( bIn ); + xType->SetOut( bOut ); + xType->SetCall0( nCall0 ); + xType->SetCall1( nCall1 ); + + aTmpTypeList.Append( xType ); + return xType; + } + } + rInStm.Seek( nTokPos ); + return NULL; +} + +/************************************************************************* +|* +|* SvIdlDataBase::ReadKnownAttr() +|* +|* Beschreibung +|* +*************************************************************************/ +SvMetaAttribute * SvIdlDataBase::FindAttr( SvMetaAttributeMemberList * pList, + SvMetaAttribute * pAttr ) const +{ + for( ULONG n = 0; n < pList->Count(); n++ ) + { + SvMetaAttribute * p = pList->GetObject( n ); + if( p->GetName() == pAttr->GetName() ) + return pAttr; + else if( p->GetSlotId().GetValue() == pAttr->GetSlotId().GetValue() ) + { + ByteString aStr = "different slot names with same id: "; + aStr += p->GetName(); + aStr += " and "; + aStr += pAttr->GetName(); + WriteError( "warning", "*.srs", aStr ); + return FALSE; + } + } + return NULL; +} + +/************************************************************************* +|* +|* SvIdlDataBase::ReadKnownAttr() +|* +|* Beschreibung +|* +*************************************************************************/ +SvMetaAttribute * SvIdlDataBase::ReadKnownAttr +( + SvTokenStream & rInStm, + SvMetaType * pType /* Wenn der pType == NULL, dann muss der Typ + noch gelesen werden. */ +) +{ + UINT32 nTokPos = rInStm.Tell(); + + if( !pType ) + pType = ReadKnownType( rInStm ); + + if( pType ) + { + // Wenn wir Slots auf die Wiese stellen, d"urfen wir nicht voraussetzen, + // da\s jeder Slot einen anderen Namen hat! +/* + SvToken * pTok = rInStm.GetToken_Next(); + if( pTok->IsIdentifier() ) + for( ULONG n = 0; n < aAttrList.Count(); n++ ) + { + SvMetaAttribute * pAttr = aAttrList.GetObject( n ); + if( pAttr->GetName() == pTok->GetString() ) + return pAttr; + } +*/ + } + else + { + // sonst SlotId? + SvToken * pTok = rInStm.GetToken_Next(); + if( pTok->IsIdentifier() ) + { + ULONG n; + if( FindId( pTok->GetString(), &n ) ) + { + for( ULONG n = 0; n < aAttrList.Count(); n++ ) + { + SvMetaAttribute * pAttr = aAttrList.GetObject( n ); + if( pAttr->GetSlotId() == pTok->GetString() ) + return pAttr; + } + } + + ByteString aStr( "Nicht gefunden : " ); + aStr += pTok->GetString(); + DBG_ERROR( aStr.GetBuffer() ); + } + } + + rInStm.Seek( nTokPos ); + return NULL; +} + +SvMetaAttribute* SvIdlDataBase::SearchKnownAttr +( + const SvNumberIdentifier& rId +) +{ + ULONG n; + if( FindId( rId, &n ) ) + { + for( ULONG n = 0; n < aAttrList.Count(); n++ ) + { + SvMetaAttribute * pAttr = aAttrList.GetObject( n ); + if( pAttr->GetSlotId() == rId ) + return pAttr; + } + } + + return NULL; +} + +/************************************************************************* +|* SvIdlDataBase::ReadKnownClass() +|* +|* Beschreibung +*************************************************************************/ +SvMetaClass * SvIdlDataBase::ReadKnownClass( SvTokenStream & rInStm ) +{ + UINT32 nTokPos = rInStm.Tell(); + SvToken * pTok = rInStm.GetToken_Next(); + + if( pTok->IsIdentifier() ) + for( ULONG n = 0; n < aClassList.Count(); n++ ) + { + SvMetaClass * pClass = aClassList.GetObject( n ); + if( pClass->GetName() == pTok->GetString() ) + return pClass; + } + + rInStm.Seek( nTokPos ); + return NULL; +} + +/************************************************************************* +|* SvIdlDataBase::Write() +|* +|* Beschreibung +*************************************************************************/ +void SvIdlDataBase::Write( const ByteString & rText ) +{ +#ifndef W31 + fprintf( stdout, "%s", rText.GetBuffer() ); +#endif +} + +/************************************************************************* +|* SvIdlDataBase::WriteError() +|* +|* Beschreibung +*************************************************************************/ +void SvIdlDataBase::WriteError( const ByteString & rErrWrn, + const ByteString & rFileName, + const ByteString & rErrorText, + ULONG nRow, ULONG nColumn ) const +{ + //Fehlerbehandlung +#ifndef W31 + fprintf( stderr, "\n%s --- %s: ( %ld, %ld )\n", + rFileName.GetBuffer(), rErrWrn.GetBuffer(), nRow, nColumn ); + + if( rErrorText.Len() ) + { // Fehler gesetzt + fprintf( stderr, "\t%s\n", rErrorText.GetBuffer() ); + } +#endif +} + +/************************************************************************* +|* SvIdlDataBase::WriteError() +|* +|* Beschreibung +*************************************************************************/ +void SvIdlDataBase::WriteError( SvTokenStream & rInStm ) +{ + //Fehlerbehandlung +#ifndef W31 + String aFileName( rInStm.GetFileName() ); + ByteString aErrorText; + ULONG nRow = 0, nColumn = 0; + + rInStm.SeekEnd(); + SvToken *pTok = rInStm.GetToken(); + + // Fehlerposition + nRow = pTok->GetLine(); + nColumn = pTok->GetColumn(); + + if( aError.IsError() ) + { // Fehler gesetzt + // Fehler Token suchen + // Fehlertext + if( aError.GetText().Len() ) + { + aErrorText = "may be <"; + aErrorText += aError.GetText(); + } + SvToken * pPrevTok = NULL; + while( pTok != pPrevTok ) + { + pPrevTok = pTok; + if( pTok->GetLine() == aError.nLine + && pTok->GetColumn() == aError.nColumn ) + break; + pTok = rInStm.GetToken_PrevAll(); + } + + // Fehlerposition + aErrorText += "> at ( "; + aErrorText += aError.nLine; + aErrorText += ", "; + aErrorText += aError.nColumn; + aErrorText += " )"; + + // Fehler zuruecksetzen + aError = SvIdlError(); + } + + WriteError( "error", ByteString( aFileName, RTL_TEXTENCODING_UTF8 ), aErrorText, nRow, nColumn ); + + DBG_ASSERT( pTok, "token must be found" ) + if( !pTok ) + return; + + // Identifier in der Naehe suchen + if( !pTok->IsIdentifier() ) + { + rInStm.GetToken_PrevAll(); + pTok = rInStm.GetToken(); + } + if( pTok && pTok->IsIdentifier() ) + { + ByteString aN = IDLAPP->pHashTable->GetNearString( pTok->GetString() ); + if( aN.Len() ) + fprintf( stderr, "%s versus %s\n", pTok->GetString().GetBuffer(), aN.GetBuffer() ); + } +#endif +} + +/****************** SvIdlWorkingBase ****************************************/ +/************************************************************************* +|* SvIdlWorkingBase::SvIdlWorkingBase() +|* +|* Beschreibung +*************************************************************************/ +SvIdlWorkingBase::SvIdlWorkingBase() +{ +} + +/************************************************************************* +|* SvIdlWorkingBase::ReadSvIdl() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvIdlWorkingBase::ReadSvIdl( SvTokenStream & rInStm, BOOL bImported, const String & rPath ) +{ + aPath = rPath; // nur fuer den durchlauf gueltig + SvToken * pTok; + BOOL bOk = TRUE; + pTok = rInStm.GetToken(); + // nur ein import ganz am Anfang + if( pTok->Is( SvHash_import() ) ) + { + rInStm.GetToken_Next(); + rInStm.Read( '(' ); // optional + pTok = rInStm.GetToken_Next(); + if( pTok->IsString() ) + { + DirEntry aFullName( String::CreateFromAscii( pTok->GetString().GetBuffer() ) ); + if( aFullName.Find( rPath ) ) + { + SvFileStream aStm( aFullName.GetFull(), + STREAM_STD_READ | STREAM_NOCREATE ); + Load( aStm ); + if( aStm.GetError() != SVSTREAM_OK ) + { + if( aStm.GetError() == SVSTREAM_WRONGVERSION ) + { + ByteString aStr( "wrong version, file " ); + aStr += ByteString( aFullName.GetFull(), RTL_TEXTENCODING_UTF8 ); + SetError( aStr, pTok ); + WriteError( rInStm ); + bOk = FALSE; + } + else + { + aStm.Seek( 0 ); + aStm.ResetError(); + SvTokenStream aTokStm( aStm, aFullName.GetFull() ); + bOk = ReadSvIdl( aTokStm, TRUE, rPath ); + } + } + } + else + bOk = FALSE; + } + else + bOk = FALSE; + } + + UINT32 nBeginPos = 0xFFFFFFFF; // kann mit Tell nicht vorkommen + + while( bOk && nBeginPos != rInStm.Tell() ) + { + nBeginPos = rInStm.Tell(); + pTok = rInStm.GetToken(); + if( pTok->IsEof() ) + return TRUE; + if( pTok->IsEmpty() ) + bOk = FALSE; + + // nur ein import ganz am Anfang + /*else */if( pTok->Is( SvHash_module() ) ) + { + SvMetaModuleRef aModule = new SvMetaModule( rInStm.GetFileName(), bImported ); + if( aModule->ReadSvIdl( *this, rInStm ) ) + GetModuleList().Append( aModule ); + else + bOk = FALSE; + } + else + bOk = FALSE; + } + if( !bOk || !pTok->IsEof() ) + { + //Fehlerbehandlung + WriteError( rInStm ); + return FALSE; + } + return TRUE; +} + +/************************************************************************* +|* SvIdlWorkingBase::WriteSvIdl() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvIdlWorkingBase::WriteSvIdl( SvStream & rOutStm ) +{ + if( rOutStm.GetError() != SVSTREAM_OK ) + return FALSE; + + SvStringHashList aList; + if( GetIdTable() ) + { + GetIdTable()->FillHashList( &aList ); + SvStringHashEntry * pEntry = aList.First(); + while( pEntry ) + { + rOutStm << "#define " << pEntry->GetName().GetBuffer() + << '\t' << ByteString( pEntry->GetValue() ).GetBuffer() + << endl; + pEntry = aList.Next(); + } + } + + for( ULONG n = 0; n < GetModuleList().Count(); n++ ) + { + SvMetaModule * pModule = GetModuleList().GetObject( n ); + //if( !pModule->IsImported() ) + pModule->WriteSvIdl( *this, rOutStm, 0 ); + } + return TRUE; +} + +/************************************************************************* +|* SvIdlWorkingBase::WriteSfx() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvIdlWorkingBase::WriteSfx( SvStream & rOutStm ) +{ + if( rOutStm.GetError() != SVSTREAM_OK ) + return FALSE; + + // alle Tmp-Variablen fuer das Schreiben zuruecksetzen + WriteReset(); + SvMemoryStream aTmpStm( 256000, 256000 ); + ULONG n; + for( n = 0; n < GetModuleList().Count(); n++ ) + { + SvMetaModule * pModule = GetModuleList().GetObject( n ); + if( !pModule->IsImported() ) + pModule->WriteSfx( *this, aTmpStm ); + aTmpStm.Seek( 0 ); + } + for( n = 0; n < aUsedTypes.Count(); n++ ) + { + SvMetaType * pType = aUsedTypes.GetObject( n ); + pType->WriteSfx( *this, rOutStm ); + } + aUsedTypes.Clear(); + rOutStm << aTmpStm; + return TRUE; +} + +BOOL SvIdlWorkingBase::WriteHelpIds( SvStream& rOutStm ) +{ + if( rOutStm.GetError() != SVSTREAM_OK ) + return FALSE; + + Table aIdTable; + ULONG n; + for( n = 0; n < GetModuleList().Count(); n++ ) + { + SvMetaModule * pModule = GetModuleList().GetObject( n ); + //if( !pModule->IsImported() ) + pModule->WriteHelpIds( *this, rOutStm, &aIdTable ); + } + + const SvMetaAttributeMemberList & rAttrList = GetAttrList(); + for( n = 0; n < rAttrList.Count(); n++ ) + { + SvMetaAttribute * pAttr = rAttrList.GetObject( n ); + pAttr->WriteHelpId( *this, rOutStm, &aIdTable ); + } + + return TRUE; +} + +/************************************************************************* +|* SvIdlWorkingBase::WriteCHeader() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvIdlWorkingBase::WriteCHeader( SvStream & rOutStm ) +{ + if( rOutStm.GetError() != SVSTREAM_OK ) + return FALSE; + + ULONG n; + for( n = 0; n < GetTypeList().Count(); n++ ) + { + SvMetaType * pType = GetTypeList().GetObject( n ); + pType->Write( *this, rOutStm, 0, WRITE_C_HEADER ); + } + for( n = 0; n < GetModuleList().Count(); n++ ) + { + SvMetaModule * pModule = GetModuleList().GetObject( n ); + if( !pModule->IsImported() ) + { + aModulePrefix = pModule->GetModulePrefix(); + pModule->Write( *this, rOutStm, 0, WRITE_C_HEADER ); + } + } + return TRUE; +} + +/************************************************************************* +|* SvIdlWorkingBase::WriteCSource() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvIdlWorkingBase::WriteCSource( SvStream & rOutStm ) +{ + if( rOutStm.GetError() != SVSTREAM_OK ) + return FALSE; + + ULONG n; + for( n = 0; n < GetTypeList().Count(); n++ ) + { + SvMetaType * pType = GetTypeList().GetObject( n ); + pType->Write( *this, rOutStm, 0, WRITE_C_SOURCE ); + } + rOutStm << endl; + for( n = 0; n < GetModuleList().Count(); n++ ) + { + SvMetaModule * pModule = GetModuleList().GetObject( n ); + if( !pModule->IsImported() ) + { + aModulePrefix = pModule->GetModulePrefix(); + pModule->Write( *this, rOutStm, 0, WRITE_C_SOURCE ); + } + } + return TRUE; +} + + + +/************************************************************************* +|* SvIdlWorkingBase::WriteSfxItem() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvIdlWorkingBase::WriteSfxItem( SvStream & rOutStm ) +{ +/* + if( rOutStm.GetError() != SVSTREAM_OK ) + return FALSE; + + for( ULONG n = 0; n < GetModuleList().Count(); n++ ) + { + SvMetaModule * pModule = GetModuleList().GetObject( n ); + if( !pModule->IsImported() ) + { + const SvMetaItemMemberList & rItemList = pModule->GetItemList(); + for( ULONG i = 0; i < rItemList.Count(); i++ ) + { + SvMetaItem * pItem = rItemList.GetObject( i ); + if( HAS_BASE( SvMetaItem, pItem ) ) + { + // Header + ((SvMetaItem*)pItem)->WriteSfxItem( *this, rOutStm, TRUE ); + // Source + ((SvMetaItem*)pItem)->WriteSfxItem( *this, rOutStm, FALSE ); + } + } + } + } + return TRUE; +*/ + return FALSE; +} + +/************************************************************************* +|* SvIdlWorkingBase::WriteSbx() +|* +|* Beschreibung +*************************************************************************/ +/* +BOOL SvIdlWorkingBase::WriteSbx( SvStream & rOutStm ) +{ + if( rOutStm.GetError() != SVSTREAM_OK ) + return FALSE; + + SvNamePosList aList; + SvMemoryStream aTmpStm( 256000, 256000 ); + for( ULONG n = 0; n < GetModuleList().Count(); n++ ) + { + SvMetaModule * pModule = GetModuleList().GetObject( n ); + if( !pModule->IsImported() ) + pModule->WriteSbx( *this, aTmpStm, aList ); + } + // Version, steht auch in so2 auto.cxx + rOutStm << (UINT32)0x1258F170; + rOutStm << (UINT32)aList.Count(); + ULONG i ; + for( i = 0; i < aList.Count(); i++ ) + { + SvNamePos * p = aList.GetObject( i ); + rOutStm << p->aUUId; + rOutStm << (UINT32)0; + } + // Ende der Tabelle + ULONG nEndPos = rOutStm.Tell(); + rOutStm.Seek( 2 * sizeof( UINT32 ) ); + SvGlobalName aTmpName; + for( i = 0; i < aList.Count(); i++ ) + { + SvNamePos * p = aList.GetObject( i ); + // Um an die richtige Position zu gelangen + rOutStm >> aTmpName; + // richtigen Offset schreiben + rOutStm << (UINT32)(nEndPos + p->nStmPos); + } + aTmpStm.Seek( 0L ); + rOutStm << aTmpStm; + + return TRUE; +} +*/ + +/************************************************************************* +|* SvIdlWorkingBase::WriteOdl() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvIdlWorkingBase::WriteOdl( SvStream & rOutStm ) +{ + if( rOutStm.GetError() != SVSTREAM_OK ) + return FALSE; + + for( ULONG n = 0; n < GetModuleList().Count(); n++ ) + { + SvMetaModule * pModule = GetModuleList().GetObject( n ); + if( !pModule->IsImported() ) + pModule->Write( *this, rOutStm, 0, WRITE_ODL ); + } + return TRUE; +} + +/************************************************************************* +|* OdlWorkingBase::WriteSrc() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvIdlWorkingBase::WriteSrc( SvStream & rOutStm ) +{ + if( rOutStm.GetError() != SVSTREAM_OK ) + return FALSE; + + Table aIdTable; + ULONG n; + for( n = 0; n < GetModuleList().Count(); n++ ) + { + SvMetaModule * pModule = GetModuleList().GetObject( n ); + //if( !pModule->IsImported() ) + pModule->WriteSrc( *this, rOutStm, &aIdTable ); + } + const SvMetaAttributeMemberList & rAttrList = GetAttrList(); + for( n = 0; n < rAttrList.Count(); n++ ) + { + SvMetaAttribute * pAttr = rAttrList.GetObject( n ); + pAttr->WriteSrc( *this, rOutStm, &aIdTable ); + } + + return TRUE; +} + +/************************************************************************* +|* OdlWorkingBase::WriteCxx() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvIdlWorkingBase::WriteCxx( SvStream & rOutStm ) +{ + if( rOutStm.GetError() != SVSTREAM_OK ) + return FALSE; + + for( ULONG n = 0; n < GetModuleList().Count(); n++ ) + { + SvMetaModule * pModule = GetModuleList().GetObject( n ); + if( !pModule->IsImported() ) + pModule->WriteCxx( *this, rOutStm, 0 ); + } + + return TRUE; +} + +/************************************************************************* +|* OdlWorkingBase::WriteHxx() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvIdlWorkingBase::WriteHxx( SvStream & rOutStm ) +{ + if( rOutStm.GetError() != SVSTREAM_OK ) + return FALSE; + + for( ULONG n = 0; n < GetModuleList().Count(); n++ ) + { + SvMetaModule * pModule = GetModuleList().GetObject( n ); + if( !pModule->IsImported() ) + pModule->WriteHxx( *this, rOutStm, 0 ); + } + + return TRUE; +} + +void SvIdlDataBase::StartNewFile( const String& rName ) +{ + bExport = ( aExportFile.EqualsIgnoreCaseAscii( rName ) ); +} + +void SvIdlDataBase::AppendAttr( SvMetaAttribute *pAttr ) +{ + aAttrList.Append( pAttr ); + if ( bExport ) + pAttr->SetNewAttribute( TRUE ); +} + +BOOL SvIdlWorkingBase::WriteCSV( SvStream& rStrm ) +{ + SvMetaAttributeMemberList &rList = GetAttrList(); + ULONG nCount = rList.Count(); + for ( ULONG n=0; n<nCount; n++ ) + { + if ( rList.GetObject(n)->IsNewAttribute() ) + { + rList.GetObject(n)->WriteCSV( *this, rStrm ); + } + } + + if ( rStrm.GetError() != SVSTREAM_OK ) + return FALSE; + else + return TRUE; +} + +/************************************************************************* +|* SvIdlWorkingBase::WriteDocumentation() +|* +|* Beschreibung +*************************************************************************/ +BOOL SvIdlWorkingBase::WriteDocumentation( SvStream & rOutStm ) +{ + if( rOutStm.GetError() != SVSTREAM_OK ) + return FALSE; + + for( ULONG n = 0; n < GetModuleList().Count(); n++ ) + { + SvMetaModule * pModule = GetModuleList().GetObject( n ); + if( !pModule->IsImported() ) + pModule->Write( *this, rOutStm, 0, WRITE_DOCU ); + } + return TRUE; +} + + + +#endif // IDL_COMPILER + diff --git a/idl/source/prj/globals.cxx b/idl/source/prj/globals.cxx new file mode 100644 index 000000000000..9e3468439842 --- /dev/null +++ b/idl/source/prj/globals.cxx @@ -0,0 +1,233 @@ +/************************************************************************* + * + * $RCSfile: globals.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________ + * + * + ************************************************************************/ + +/****************** I N C L U D E S **************************************/ + +#ifndef _SHL_HXX //autogen +#include <tools/shl.hxx> +#endif + +#include <globals.hxx> +#include <database.hxx> +#pragma hdrstop + +/****************** G L O B A L S ****************************************/ +#ifdef DOS +static IdlDll * pApp = NULL; +IdlDll * GetIdlApp() +{ + if( !pApp ) + pApp = new IdlDll(); + return pApp; +} +#else +IdlDll * GetIdlApp() +{ + if( !(*(IdlDll**)GetAppData(SHL_IDL)) ) + { + (*(IdlDll**)GetAppData(SHL_IDL)) = new IdlDll(); + // Temporaer, sonst nur wenn Compiler + //GetIdlApp()->pHashTable = new SvStringHashTable( 2801 ); + //GetIdlApp()->pGlobalNames = new SvGlobalHashNames(); + } + return (*(IdlDll**)GetAppData(SHL_IDL)); +} +#endif + +IdlDll::IdlDll() + : pHashTable( NULL ) + , pGlobalNames( NULL ) + , pClassMgr( NULL ) + +{ + pClassMgr = new SvClassManager(); + // File OBJECT.HXX: + pClassMgr->SV_CLASS_REGISTER( SvMetaAttribute ); + pClassMgr->SV_CLASS_REGISTER( SvMetaClass ); + //File SLOT.HXX: + pClassMgr->SV_CLASS_REGISTER( SvMetaSlot ); + //File MODULE.HXX: + pClassMgr->SV_CLASS_REGISTER( SvMetaModule ); + //File BASOBJ.HXX: + pClassMgr->SV_CLASS_REGISTER( SvMetaObject ); + pClassMgr->SV_CLASS_REGISTER( SvMetaName ); + pClassMgr->SV_CLASS_REGISTER( SvMetaExtern ); + pClassMgr->SV_CLASS_REGISTER( SvMetaReference ); + //File TYPES.HXX: + pClassMgr->SV_CLASS_REGISTER( SvMetaType ); + pClassMgr->SV_CLASS_REGISTER( SvMetaTypeString ); + pClassMgr->SV_CLASS_REGISTER( SvMetaEnumValue ); + pClassMgr->SV_CLASS_REGISTER( SvMetaTypeEnum ); + pClassMgr->SV_CLASS_REGISTER( SvMetaTypevoid ); + pClassMgr->SV_CLASS_REGISTER( SvClassElement ); +} + +IdlDll::~IdlDll() +{ + delete pGlobalNames; + delete pClassMgr; + delete pHashTable; +} + +/************************************************************************* +|* +|* SvGlobalHashNames::SvGlobalHashNames() +|* +|* Beschreibung +|* Ersterstellung MM 08.08.91 +|* Letzte Aenderung MM 08.08.91 +|* +*************************************************************************/ +inline SvStringHashEntry * INS( const ByteString & rName ) +{ + UINT32 nIdx; + IDLAPP->pHashTable->Insert( rName, &nIdx ); + return (SvStringHashEntry * )IDLAPP->pHashTable->Get( nIdx ); +} +#define A_ENTRY( Name ) , MM_##Name( INS( #Name ) ) + +SvGlobalHashNames::SvGlobalHashNames() + : MM_Name( INS( "Name" ) ) + , MM_module( INS( "module" ) ) + , MM_interface( INS( "interface" ) ) + , MM_in( INS( "in" ) ) + , MM_out( INS( "out" ) ) + , MM_inout( INS( "inout" ) ) + , MM_String( INS( "String" ) ) + , MM_UCHAR( INS( "UCHAR" ) ) + , MM_USHORT( INS( "USHORT" ) ) + , MM_uuid( INS( "uuid" ) ) + , MM_HelpContext( INS( "HelpContext" ) ) + , MM_HelpText( INS( "HelpText" ) ) + , MM_void( INS( "void" ) ) + , MM_shell( INS( "shell" ) ) + , MM_Get( INS( "Get" ) ) + , MM_Set( INS( "Set" ) ) + , MM_SlotId( INS( "SlotId" ) ) + , MM_HasCoreId( INS( "HasCoreId" ) ) + , MM_Cachable( INS( "Cachable" ) ) + , MM_Volatile( INS( "Volatile" ) ) + , MM_Toggle( INS( "Toggle" ) ) + , MM_AutoUpdate( INS( "AutoUpdate" ) ) + , MM_Synchron( INS( "Synchron" ) ) + , MM_Asynchron( INS( "Asynchron" ) ) + A_ENTRY(RecordPerItem) + A_ENTRY(RecordPerSet) + A_ENTRY(RecordManual) + A_ENTRY(NoRecord) + A_ENTRY(RecordAbsolute) + A_ENTRY(enum) + A_ENTRY(UINT16) + A_ENTRY(INT16) + A_ENTRY(UINT32) + A_ENTRY(INT32) + A_ENTRY(int) + A_ENTRY(BOOL) + A_ENTRY(char) + A_ENTRY(BYTE) + A_ENTRY(float) + A_ENTRY(double) + A_ENTRY(item) + A_ENTRY(PseudoSlots) + A_ENTRY(map) + A_ENTRY(Default) + A_ENTRY(HelpFile) + A_ENTRY(Version) + A_ENTRY(import) + A_ENTRY(SlotIdFile) + A_ENTRY(SvName) + A_ENTRY(SbxName) + A_ENTRY(ItemName) + A_ENTRY(OdlName) + A_ENTRY(include) + A_ENTRY(ExecMethod) + A_ENTRY(StateMethod) + A_ENTRY(GroupId) + A_ENTRY(HasDialog) + A_ENTRY(MenuConfig) + A_ENTRY(ToolBoxConfig) + A_ENTRY(StatusBarConfig) + A_ENTRY(AccelConfig) + A_ENTRY(AllConfig) + A_ENTRY(FastCall) + A_ENTRY(TypeLibFile) + A_ENTRY(Export) + A_ENTRY(Automation) + A_ENTRY(PseudoPrefix) + A_ENTRY(define) + A_ENTRY(SbxObject) + A_ENTRY(Container) + A_ENTRY(PlugComm) + A_ENTRY(IsCollection) + A_ENTRY(ReadOnlyDoc) + A_ENTRY(ConfigName) + A_ENTRY(struct) + A_ENTRY(union) + A_ENTRY(typedef) + A_ENTRY(Readonly) + A_ENTRY(SlotType) + A_ENTRY(ModulePrefix) + A_ENTRY(DisableFlags) + A_ENTRY(Hidden) + A_ENTRY(Description) + A_ENTRY(UnoName) +{} + diff --git a/idl/source/prj/idldll.cxx b/idl/source/prj/idldll.cxx new file mode 100644 index 000000000000..b0862cd6f335 --- /dev/null +++ b/idl/source/prj/idldll.cxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * $RCSfile: idldll.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________ + * + * + ************************************************************************/ + +#pragma hdrstop + +#ifdef WIN + +#ifndef _SVWIN_H +#include <svwin.h> +#endif + +#ifndef _SYSDEP_HXX +#include <sysdep.hxx> +#endif + +// Statische DLL-Verwaltungs-Variablen +static HINSTANCE hDLLInst = 0; // HANDLE der DLL + + +/*************************************************************************** +|* +|* LibMain() +|* +|* Beschreibung Initialisierungsfunktion der DLL +|* Ersterstellung TH 05.05.93 +|* Letzte Aenderung TH 05.05.93 +|* +***************************************************************************/ + +extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) +{ +#ifndef WNT + if ( nHeap ) + UnlockData( 0 ); +#endif + + hDLLInst = hDLL; + + return TRUE; +} + +/*************************************************************************** +|* +|* WEP() +|* +|* Beschreibung DLL-Deinitialisierung +|* Ersterstellung TH 05.05.93 +|* Letzte Aenderung TH 05.05.93 +|* +***************************************************************************/ + +extern "C" int CALLBACK WEP( int ) +{ + return 1; +} + +#endif diff --git a/idl/source/prj/makefile.mk b/idl/source/prj/makefile.mk new file mode 100644 index 000000000000..e142121cdd68 --- /dev/null +++ b/idl/source/prj/makefile.mk @@ -0,0 +1,101 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:30: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=..$/.. + +PROJECTPCH4DLL=TRUE +PROJECTPCH=idlpch +PROJECTPCHSOURCE=$(PRJ)$/util$/idlpch + +PRJNAME=SVIDL +TARGET=prj + +# --- Settings ----------------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +.IF "$(COM)"=="WTC" +CFLAGS+=-od +.ENDIF + +CDEFS+=-DIDL_COMPILER +# --- Files -------------------------------------------------------------- + +CXXFILES= command.cxx \ + globals.cxx \ + database.cxx \ + svidl.cxx \ + idldll.cxx \ + $(PROJECTPCHSOURCE).cxx + +OBJFILES= $(OBJ)$/command.obj \ + $(OBJ)$/svidl.obj \ + $(OBJ)$/globals.obj \ + $(OBJ)$/idldll.obj \ + $(OBJ)$/database.obj + +# --- Targets ------------------------------------------------------------ + +.INCLUDE : target.mk + diff --git a/idl/source/prj/svidl.cxx b/idl/source/prj/svidl.cxx new file mode 100644 index 000000000000..6bd36f4b4fdb --- /dev/null +++ b/idl/source/prj/svidl.cxx @@ -0,0 +1,463 @@ +/************************************************************************* + * + * $RCSfile: svidl.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________ + * + * + ************************************************************************/ + +#include <stdlib.h> +#include <stdio.h> +#include <database.hxx> +#include <globals.hxx> +#include <command.hxx> + +#ifndef _FSYS_HXX //autogen +#include <tools/fsys.hxx> +#endif + +#ifndef _STRING_HXX //autogen +#include <tools/string.hxx> +#endif + +#pragma hdrstop + +#define BR 0x8000 +BOOL FileMove_Impl( const String & rFile1, const String & rFile2, BOOL bImmerVerschieben ) +{ + //printf( "Move from %s to %s\n", rFile2.GetStr(), rFile1.GetStr() ); + ULONG nC1 = 0; + ULONG nC2 = 1; + if( !bImmerVerschieben ) + { + SvFileStream aOutStm1( rFile1, STREAM_STD_READ ); + SvFileStream aOutStm2( rFile2, STREAM_STD_READ ); + if( aOutStm1.GetError() == SVSTREAM_OK ) + { + void * pBuf1 = new BYTE[ BR ]; + void * pBuf2 = new BYTE[ BR ]; + nC1 = aOutStm1.Read( pBuf1, BR ); + nC2 = aOutStm2.Read( pBuf2, BR ); + BOOL bOk = TRUE; + while( nC1 == nC2 ) + { + if( memcmp( pBuf1, pBuf2, nC1 ) ) + { + nC1++; + break; + } + else + { + if( 0x8000 != nC1 ) + break; + nC1 = aOutStm1.Read( pBuf1, BR ); + nC2 = aOutStm2.Read( pBuf2, BR ); + } + } + delete pBuf1; + delete pBuf2; + } + } + DirEntry aF2( rFile2 ); + if( nC1 != nC2 ) + {// es hat sich etwas geaendert + DirEntry aF1( rFile1 ); + aF1.Kill(); + // Datei verschieben + if( aF2.MoveTo( aF1 ) ) + { + // Beide Dateien loeschen + aF1.Kill(); + aF2.Kill(); + return FALSE; + } +/* + else + { + printf( "%s to %s moved\n", + rFile2.GetStr(), rFile1.GetStr() ); + } +*/ + return TRUE; + } + return 0 == aF2.Kill(); +} + +/************************************************************************* +|* main() +|* +|* Beschreibung +*************************************************************************/ +#if defined( UNX ) || (defined( PM2 ) && defined( CSET )) || defined (WTC) || defined (MAC) || defined (MTW) +int main ( int argc, char ** argv) +{ +#else +int cdecl main ( int argc, char ** argv) +{ +#endif + + printf( "StarView Interface Definition Language (IDL) Compiler 3.0\n" ); + +/* + pStr = ::ResponseFile( &aCmdLine, argv, argc ); + if( pStr ) + { + printf( "Cannot open response file <%s>\n", pStr ); + return( 1 ); + }; +*/ + + String aTmpListFile; + String aTmpSlotMapFile; + String aTmpSfxItemFile; + String aTmpDataBaseFile; + String aTmpCallingFile; + String aTmpSrcFile; + String aTmpCxxFile; + String aTmpHxxFile; + String aTmpHelpIdFile; + String aTmpCSVFile; + String aTmpDocuFile; + + SvCommand aCommand( argc, argv ); + Init( aCommand ); + SvIdlWorkingBase * pDataBase = new SvIdlWorkingBase(); + + int nExit = 0; + if( aCommand.aExportFile.Len() ) + { + DirEntry aDE( aCommand.aExportFile ); + pDataBase->SetExportFile( aDE.GetName() ); + } + + if( ReadIdl( pDataBase, aCommand ) ) + { + if( nExit == 0 && aCommand.aDocuFile.Len() ) + { + DirEntry aDE( aCommand.aDocuFile ); + aDE.ToAbs(); + aTmpDocuFile = aDE.GetPath().TempName().GetFull(); + SvFileStream aOutStm( aTmpDocuFile, STREAM_READWRITE | STREAM_TRUNC ); + if( !pDataBase->WriteDocumentation( aOutStm ) ) + { + nExit = -1; + ByteString aStr = "cannot write documentation file: "; + aStr += ByteString( aCommand.aDocuFile, RTL_TEXTENCODING_UTF8 ); + fprintf( stderr, "%s\n", aStr.GetBuffer() ); + } + } + if( nExit == 0 && aCommand.aListFile.Len() ) + { + DirEntry aDE( aCommand.aListFile ); + aDE.ToAbs(); + aTmpListFile = aDE.GetPath().TempName().GetFull(); + SvFileStream aOutStm( aTmpListFile, STREAM_READWRITE | STREAM_TRUNC ); + if( !pDataBase->WriteSvIdl( aOutStm ) ) + { + nExit = -1; + ByteString aStr = "cannot write list file: "; + aStr += ByteString( aCommand.aListFile, RTL_TEXTENCODING_UTF8 ); + fprintf( stderr, "%s\n", aStr.GetBuffer() ); + } + } + if( nExit == 0 && aCommand.aSlotMapFile.Len() ) + { + DirEntry aDE( aCommand.aSlotMapFile ); + aDE.ToAbs(); + aTmpSlotMapFile = aDE.GetPath().TempName().GetFull(); + SvFileStream aOutStm( aTmpSlotMapFile, STREAM_READWRITE | STREAM_TRUNC ); + if( !pDataBase->WriteSfx( aOutStm ) ) + { + nExit = -1; + ByteString aStr = "cannot write slotmap file: "; + aStr += ByteString( aCommand.aSlotMapFile, RTL_TEXTENCODING_UTF8 ); + fprintf( stderr, "%s\n", aStr.GetBuffer() ); + } + } + if( nExit == 0 && aCommand.aHelpIdFile.Len() ) + { + DirEntry aDE( aCommand.aHelpIdFile ); + aDE.ToAbs(); + aTmpHelpIdFile = aDE.GetPath().TempName().GetFull(); + SvFileStream aStm( aTmpHelpIdFile, STREAM_READWRITE | STREAM_TRUNC ); + if (!pDataBase->WriteHelpIds( aStm ) ) + { + nExit = -1; + ByteString aStr = "cannot write help ID file: "; + aStr += ByteString( aCommand.aHelpIdFile, RTL_TEXTENCODING_UTF8 ); + fprintf( stderr, "%s\n", aStr.GetBuffer() ); + } + } + if( nExit == 0 && aCommand.aCSVFile.Len() ) + { + DirEntry aDE( aCommand.aCSVFile ); + aDE.ToAbs(); + aTmpCSVFile = aDE.GetPath().TempName().GetFull(); + SvFileStream aStm( aTmpCSVFile, STREAM_READWRITE | STREAM_TRUNC ); + if (!pDataBase->WriteCSV( aStm ) ) + { + nExit = -1; + ByteString aStr = "cannot write CSV file: "; + aStr += ByteString( aCommand.aCSVFile, RTL_TEXTENCODING_UTF8 ); + fprintf( stderr, "%s\n", aStr.GetBuffer() ); + } + } + if( nExit == 0 && aCommand.aSfxItemFile.Len() ) + { + DirEntry aDE( aCommand.aSfxItemFile ); + aDE.ToAbs(); + aTmpSfxItemFile = aDE.GetPath().TempName().GetFull(); + SvFileStream aOutStm( aTmpSfxItemFile, STREAM_READWRITE | STREAM_TRUNC ); + if( !pDataBase->WriteSfxItem( aOutStm ) ) + { + nExit = -1; + ByteString aStr = "cannot write item file: "; + aStr += ByteString( aCommand.aSfxItemFile, RTL_TEXTENCODING_UTF8 ); + fprintf( stderr, "%s\n", aStr.GetBuffer() ); + } + } + if( nExit == 0 && aCommand.aDataBaseFile.Len() ) + { + DirEntry aDE( aCommand.aDataBaseFile ); + aDE.ToAbs(); + aTmpDataBaseFile = aDE.GetPath().TempName().GetFull(); + SvFileStream aOutStm( aTmpDataBaseFile, STREAM_READWRITE | STREAM_TRUNC ); + pDataBase->Save( aOutStm, aCommand.nFlags ); + if( aOutStm.GetError() != SVSTREAM_OK ) + { + nExit = -1; + ByteString aStr = "cannot write database file: "; + aStr += ByteString( aCommand.aDataBaseFile, RTL_TEXTENCODING_UTF8 ); + fprintf( stderr, "%s\n", aStr.GetBuffer() ); + } + } +/* + if( nExit == 0 && aCommand.aCallingFile.Len() ) + { + DirEntry aDE( aCommand.aCallingFile ); + aDE.ToAbs(); + aTmpCallingFile = aDE.GetPath().TempName().GetFull(); + SvFileStream aOutStm( aTmpCallingFile, STREAM_READWRITE | STREAM_TRUNC ); + pDataBase->WriteSbx( aOutStm ); + //pDataBase->Save( aOutStm, aCommand.nFlags | IDL_WRITE_CALLING ); + if( aOutStm.GetError() != SVSTREAM_OK ) + { + nExit = -1; + ByteString aStr = "cannot write calling file: "; + aStr += aCommand.aCallingFile; + fprintf( stderr, "%s\n", aStr.GetStr() ); + } + } + if( nExit == 0 && aCommand.aCxxFile.Len() ) + { + DirEntry aDE( aCommand.aCxxFile ); + aDE.ToAbs(); + aTmpCxxFile = aDE.GetPath().TempName().GetFull(); + SvFileStream aOutStm( aTmpCxxFile, STREAM_READWRITE | STREAM_TRUNC ); + + aOutStm << "#pragma hdrstop" << endl; + aOutStm << "#include <"; + if( aCommand.aHxxFile.Len() ) + aOutStm << DirEntry(aCommand.aHxxFile).GetName().GetBuffer(); + else + { + DirEntry aDE( aCommand.aCxxFile ); + aDE.SetExtension( "hxx" ); + aOutStm << aDE.GetName().GetBuffer); + } + aOutStm << '>' << endl; + if( !pDataBase->WriteCxx( aOutStm ) ) + { + nExit = -1; + ByteString aStr = "cannot write cxx file: "; + aStr += ByteString( aCommand.aCxxFile, RTL_TEXTENCODING_UTF8 ); + fprintf( stderr, "%s\n", aStr.GetBuffer() ); + } + } + if( nExit == 0 && aCommand.aHxxFile.Len() ) + { + DirEntry aDE( aCommand.aHxxFile ); + aDE.ToAbs(); + aTmpHxxFile = aDE.GetPath().TempName().GetFull(); + SvFileStream aOutStm( aTmpHxxFile, STREAM_READWRITE | STREAM_TRUNC ); + + aOutStm << "#include <somisc.hxx>" << endl; + if( !pDataBase->WriteHxx( aOutStm ) ) + { + nExit = -1; + ByteString aStr = "cannot write cxx file: "; + aStr += ByteString( aCommand.aHxxFile, RTL_TEXTENCODING_UTF8 ); + fprintf( stderr, "%s\n", aStr.GetBuffer() ); + } + } + */ + } + else + nExit = -1; + + if( nExit == 0 ) + { + BOOL bErr = FALSE; + BOOL bDoMove = aCommand.aTargetFile.Len() == 0; + String aErrFile; + if( !bErr && aCommand.aListFile.Len() ) + { + bErr |= !FileMove_Impl( aCommand.aListFile, aTmpListFile, bDoMove ); + if( bErr ) + aErrFile = aCommand.aListFile; + } + if( !bErr && aCommand.aSlotMapFile.Len() ) + { + bErr |= !FileMove_Impl( aCommand.aSlotMapFile, aTmpSlotMapFile, bDoMove ); + if( bErr ) + aErrFile = aCommand.aSlotMapFile; + } + if( !bErr && aCommand.aSfxItemFile.Len() ) + { + bErr |= !FileMove_Impl( aCommand.aSfxItemFile, aTmpSfxItemFile, bDoMove ); + if( bErr ) + aErrFile = aCommand.aSfxItemFile; + } + if( !bErr && aCommand.aDataBaseFile.Len() ) + { + bErr |= !FileMove_Impl( aCommand.aDataBaseFile, aTmpDataBaseFile, bDoMove ); + if( bErr ) + aErrFile = aCommand.aDataBaseFile; + } + if( !bErr && aCommand.aCallingFile.Len() ) + { + bErr |= !FileMove_Impl( aCommand.aCallingFile, aTmpCallingFile, bDoMove ); + if( bErr ) + aErrFile = aCommand.aCallingFile; + } + if( !bErr && aCommand.aCxxFile.Len() ) + { + bErr |= !FileMove_Impl( aCommand.aCxxFile, aTmpCxxFile, bDoMove ); + if( bErr ) + aErrFile = aCommand.aCxxFile; + } + if( !bErr && aCommand.aHxxFile.Len() ) + { + bErr |= !FileMove_Impl( aCommand.aHxxFile, aTmpHxxFile, bDoMove ); + if( bErr ) + aErrFile = aCommand.aHxxFile; + } + if( !bErr && aCommand.aHelpIdFile.Len() ) + { + bErr |= !FileMove_Impl( aCommand.aHelpIdFile, aTmpHelpIdFile, bDoMove ); + if( bErr ) + aErrFile = aCommand.aHelpIdFile; + } + if( !bErr && aCommand.aCSVFile.Len() ) + { + bErr |= !FileMove_Impl( aCommand.aCSVFile, aTmpCSVFile, bDoMove ); + if( bErr ) + aErrFile = aCommand.aCSVFile; + } + if( !bErr && aCommand.aDocuFile.Len() ) + { + bErr |= !FileMove_Impl( aCommand.aDocuFile, aTmpDocuFile, bDoMove ); + if( bErr ) + aErrFile = aCommand.aDocuFile; + } + + if( bErr ) + { + nExit = -1; + ByteString aStr = "cannot write file: "; + aStr += ByteString( aErrFile, RTL_TEXTENCODING_UTF8 ); + fprintf( stderr, "%s\n", aStr.GetBuffer() ); + } + else + { + if( aCommand.aTargetFile.Len() ) + { +#ifdef ICC + DirEntry aT(aCommand.aTargetFile); + aT.Kill(); +#endif + // Datei stempeln, da idl korrekt durchlaufen wurde + SvFileStream aOutStm( aCommand.aTargetFile, + STREAM_READWRITE | STREAM_TRUNC ); + } + } + } + + if( nExit != 0 ) + { + if( aCommand.aListFile.Len() ) + DirEntry( aTmpListFile ).Kill(); + if( aCommand.aSlotMapFile.Len() ) + DirEntry( aTmpSlotMapFile ).Kill(); + if( aCommand.aSfxItemFile.Len() ) + DirEntry( aTmpSfxItemFile ).Kill(); + if( aCommand.aDataBaseFile.Len() ) + DirEntry( aTmpDataBaseFile ).Kill(); + if( aCommand.aCallingFile.Len() ) + DirEntry( aTmpCallingFile ).Kill(); + if( aCommand.aCxxFile.Len() ) + DirEntry( aTmpCxxFile ).Kill(); + if( aCommand.aHxxFile.Len() ) + DirEntry( aTmpHxxFile ).Kill(); + } + + delete pDataBase; + DeInit(); + if( nExit != 0 ) + fprintf( stderr, "svidl terminated with errors\n" ); + return nExit; +} + diff --git a/idl/source/svidl.dat b/idl/source/svidl.dat Binary files differnew file mode 100644 index 000000000000..4750475c7462 --- /dev/null +++ b/idl/source/svidl.dat diff --git a/idl/util/idlpch.cxx b/idl/util/idlpch.cxx new file mode 100644 index 000000000000..66b80a176971 --- /dev/null +++ b/idl/util/idlpch.cxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * $RCSfile: idlpch.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________ + * + * + ************************************************************************/ +#ifdef MAC +#include <string.h> +#else +#include <memory.h> +#endif +#include <stdlib.h> +#include <stdio.h> +#include <ctype.h> +#include <limits.h> + +#include <tlbigint.hxx> +#include <tlfsys.hxx> +#include <char.hxx> +#include <command.hxx> +#include <hash.hxx> +#include <lex.hxx> +#include <attrib.hxx> +#include <globals.hxx> +#include <bastype.hxx> +#include <object.hxx> +#include <slot.hxx> +#include <module.hxx> +#include <database.hxx> + +#pragma hdrstop diff --git a/idl/util/makefile.mk b/idl/util/makefile.mk new file mode 100644 index 000000000000..b4161ec45e82 --- /dev/null +++ b/idl/util/makefile.mk @@ -0,0 +1,151 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:30: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=.. + +PRJPCH= + +PRJNAME=SVIDL +TARGET=idl +VERSION=$(UPD) + +TARGETTYPE=CUI + +# --- Settings ----------------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Files -------------------------------------------------------------- + +LIB1TARGET= $(LB)$/$(TARGET).lib +LIB1FILES = $(LB)$/prj.lib \ + $(LB)$/objects.lib \ + $(LB)$/cmptools.lib + +.IF "$(GUI)" != "WIN" +APP1TARGET= svidl + +.IF "$(GUI)" != "MAC" +APP1DEPN= $(L)$/itools.lib +.ENDIF + +APP1STDLIBS=\ + $(TOOLSLIB) + +APP1LIBS= $(LIBPRE) $(LB)$/$(TARGET).lib +.IF "$(GUI)" != "UNX" +.IF "$(COM)"=="WTC" +APP1OBJS= $(OBJ)$/svidl.obj +.ELSE +APP1OBJS= $(OBJ)$/svidl.obj \ + $(OBJ)$/command.obj +.ENDIF +.ENDIF +.IF "$(COM)" == "WTC" +APP1STACK=32768 +.ENDIF +.IF "$(GUI)" != "OS2" +APP1STACK=32768 +.ENDIF +.ENDIF + +.IF "$(OS)"=="LINUX" +APP1STDLIBS+=-lcrypt +.ENDIF + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + +# ------------------------------------------------------------------- +# PM2 +# ------------------------------------------------------------------- + +.IF "$(GUI)" == "OS2" + +$(MISC)$/$(APP1TARGET).def : makefile + echo NAME SV-IDL WINDOWCOMPAT >$@ + echo DESCRIPTION 'SV-IDL-Compiler' >>$@ +.IF "$(COM)" != "BLC" + echo STUB 'os2STUB.EXE' >>$@ +.ENDIF + echo DATA MULTIPLE >>$@ + echo EXETYPE OS2 >>$@ + echo PROTMODE >>$@ + echo HEAPSIZE 16000 >>$@ + echo STACKSIZE 48000 >>$@ +.ENDIF + +# --- Filter-Datei --- + +.IF "$(GUI)" != "DOS" +$(MISC)$/$(SHL1TARGET).flt: makefile + @echo ------------------------------ + @echo Making: $@ + @echo WEP>$@ + @echo LIBMAIN>>$@ + @echo LibMain>>$@ + @echo Stg>>$@ +.ENDIF + diff --git a/idl/util/svidl.hdb b/idl/util/svidl.hdb new file mode 100644 index 000000000000..d57bedb45373 --- /dev/null +++ b/idl/util/svidl.hdb @@ -0,0 +1,25 @@ +write "/*************************************************************************" +write "* SV.HXX" +write "* __DATE__" +write "* (c) 1992-1994 STAR DIVISION" +write "*************************************************************************/" +write "#ifndef _SVIDL_HXX" +write "#define _SVIDL_HXX" +write "#ifndef _PSTREAM_HXX" +write "#include <pstream.hxx>" +write "#endif" +write "#ifndef _SBX_HXX" +write "#include <sbx.hxx>" +write "#endif" +write "#define IDL_COMPILER /*vorlaeufig immer */" +file char.hxx +file hash.hxx +file lex.hxx +file bastype.hxx +file basobj.hxx +file types.hxx +file object.hxx +file slot.hxx +file module.hxx +file database.hxx +write "#endif" diff --git a/officecfg/prj/d.lst b/officecfg/prj/d.lst new file mode 100644 index 000000000000..4d5b5b84a7a6 --- /dev/null +++ b/officecfg/prj/d.lst @@ -0,0 +1,28 @@ +mkdir: %_DEST%\xml%_EXT% +mkdir: %_DEST%\xml%_EXT%\office +mkdir: %_DEST%\xml%_EXT%\office\instance +mkdir: %_DEST%\xml%_EXT%\office\schema +mkdir: %_DEST%\xml%_EXT%\office\definition + +..\schema\schema.description.dtd %_DEST%\xml%_EXT%\office\schema\schema.description.dtd + +..\%__SRC%\misc\org.openoffice.Office.Calc.ins %_DEST%\xml%_EXT%\office\instance\org.openoffice.Office.Calc.xml +..\%__SRC%\misc\org.openoffice.Office.Chart.ins %_DEST%\xml%_EXT%\office\instance\org.openoffice.Office.Chart.xml +..\%__SRC%\misc\org.openoffice.Office.Common.ins %_DEST%\xml%_EXT%\office\instance\org.openoffice.Office.Common.xml +..\%__SRC%\misc\org.openoffice.Office.DataAccess.ins %_DEST%\xml%_EXT%\office\instance\org.openoffice.Office.DataAccess.xml +..\%__SRC%\misc\org.openoffice.Office.Draw.ins %_DEST%\xml%_EXT%\office\instance\org.openoffice.Office.Draw.xml +..\%__SRC%\misc\org.openoffice.Office.Impress.ins %_DEST%\xml%_EXT%\office\instance\org.openoffice.Office.Impress.xml +..\%__SRC%\misc\org.openoffice.Office.Java.ins %_DEST%\xml%_EXT%\office\instance\org.openoffice.Office.Java.xml +..\%__SRC%\misc\org.openoffice.Office.Linguistic.ins %_DEST%\xml%_EXT%\office\instance\org.openoffice.Office.Linguistic.xml +..\%__SRC%\misc\org.openoffice.Office.Math.ins %_DEST%\xml%_EXT%\office\instance\org.openoffice.Office.Math.xml +..\%__SRC%\misc\org.openoffice.Office.Writer.ins %_DEST%\xml%_EXT%\office\instance\org.openoffice.Office.Writer.xml +..\%__SRC%\misc\org.openoffice.Office.WriterWeb.ins %_DEST%\xml%_EXT%\office\instance\org.openoffice.Office.WriterWeb.xml +..\%__SRC%\misc\org.openoffice.Inet.ins %_DEST%\xml%_EXT%\office\instance\org.openoffice.Inet.xml +..\%__SRC%\misc\org.openoffice.ucb.Hierarchy.ins %_DEST%\xml%_EXT%\office\instance\org.openoffice.ucb.Hierarchy.xml +..\%__SRC%\misc\org.openoffice.Setup.ins %_DEST%\xml%_EXT%\office\instance\org.openoffice.Setup.xml +..\%__SRC%\misc\org.openoffice.Templates.ins %_DEST%\xml%_EXT%\office\instance\org.openoffice.Templates.xml +..\%__SRC%\misc\org.openoffice.UserProfile.ins %_DEST%\xml%_EXT%\office\instance\org.openoffice.UserProfile.xml + +..\%__SRC%\misc\*.xsd %_DEST%\xml%_EXT%\office\schema\*.xsd +..\data\*.xml %_DEST%\xml%_EXT%\office\definition\*.xml + diff --git a/officecfg/util/makefile.pmk b/officecfg/util/makefile.pmk new file mode 100644 index 000000000000..88cfcdbf499c --- /dev/null +++ b/officecfg/util/makefile.pmk @@ -0,0 +1,14 @@ + +$(MISC)$/%.ins : %.xml + java -classpath $(COMMON_BUILD_TOOLS)$/xt19991105.jar$(PATH_SEPERATOR)$(COMMON_BUILD_TOOLS)$/parser.jar -Dcom.jclark.xsl.sax.parser=com.sun.xml.parser.Parser com.jclark.xsl.sax.Driver $< $(PRJ)$/util$/instance.xsl $@ path=$(PRJ)$/data + +$(MISC)$/%.tpl : %.xml + java -classpath $(COMMON_BUILD_TOOLS)$/xt19991105.jar$(PATH_SEPERATOR)$(COMMON_BUILD_TOOLS)$/parser.jar -Dcom.jclark.xsl.sax.parser=com.sun.xml.parser.Parser com.jclark.xsl.sax.Driver $< $(PRJ)$/util$/instance.xsl $@ templates=true path=$(PRJ)$/data + +$(MISC)$/%.xsd : %.xml + java -classpath $(COMMON_BUILD_TOOLS)$/xt19991105.jar$(PATH_SEPERATOR)$(COMMON_BUILD_TOOLS)$/parser.jar -Dcom.jclark.xsl.sax.parser=com.sun.xml.parser.Parser com.jclark.xsl.sax.Driver $< $(PRJ)$/util$/schema.xsl $@ + + + + + diff --git a/officecfg/util/template.gen b/officecfg/util/template.gen new file mode 100644 index 000000000000..5b2c3d40886a --- /dev/null +++ b/officecfg/util/template.gen @@ -0,0 +1,34 @@ +: # -*- perl -*- +eval 'exec perl -wS $0 ${1+"$@"}' + if 0; + +open(OUTFILE, ">$ARGV[1]"); + +print OUTFILE "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; +print OUTFILE "<org.openoffice.Templates>\n"; + + +chdir($ARGV[0]) or die "can't chdir() to $ARGV[0]"; + +opendir(DIR, "."); + +@files=readdir(DIR); + +foreach $file (@files) { + if ( $file =~ /\w*\.tpl/ ) { + open(INFILE, "<$file") or die "can't open file $file"; + while(<INFILE>) { + if ( /xml version=/ ) { + next; + } + print OUTFILE; + } + close(INFILE); + } +} + +print OUTFILE "</org.openoffice.Templates>\n"; + +closedir(DIR); + +close(OUTFILE); |