initial import

This commit is contained in:
Jens-Heiner Rechtien
2000-09-18 15:18:56 +00:00
commit 95117e7fef
218 changed files with 72880 additions and 0 deletions
+637
View File
@@ -0,0 +1,637 @@
/*************************************************************************
*
* $RCSfile: basecontainercontrol.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _UNOCONTROLS_BASECONTAINERCONTROL_CTRL_HXX
#define _UNOCONTROLS_BASECONTAINERCONTROL_CTRL_HXX
//____________________________________________________________________________________________________________
// includes of other projects
//____________________________________________________________________________________________________________
#ifndef _COM_SUN_STAR_LANG_XSERVICENAME_HPP_
#include <com/sun/star/lang/XServiceName.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
#include <com/sun/star/lang/XServiceInfo.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XCONTAINER_HPP_
#include <com/sun/star/container/XContainer.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XINDEXCONTAINER_HPP_
#include <com/sun/star/container/XIndexContainer.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XNAMEREPLACE_HPP_
#include <com/sun/star/container/XNameReplace.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XCONTAINERLISTENER_HPP_
#include <com/sun/star/container/XContainerListener.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XSET_HPP_
#include <com/sun/star/container/XSet.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_CONTAINEREVENT_HPP_
#include <com/sun/star/container/ContainerEvent.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XINDEXREPLACE_HPP_
#include <com/sun/star/container/XIndexReplace.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
#include <com/sun/star/container/XNameContainer.hpp>
#endif
#ifndef _LIST_HXX
#include <tools/list.hxx>
#endif
//____________________________________________________________________________________________________________
// includes of my own project
//____________________________________________________________________________________________________________
#ifndef _UNOCONTROLS_BASECONTROL_CTRL_HXX
#include "basecontrol.hxx"
#endif
//____________________________________________________________________________________________________________
// "namespaces"
//____________________________________________________________________________________________________________
namespace unocontrols{
#define UNO3_REFERENCE ::com::sun::star::uno::Reference
#define UNO3_XCONTROL ::com::sun::star::awt::XControl
#define UNO3_OUSTRING ::rtl::OUString
#define UNO3_XCONTROLMODEL ::com::sun::star::awt::XControlModel
#define UNO3_XCONTROLCONTAINER ::com::sun::star::awt::XControlContainer
#define UNO3_XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory
#define UNO3_TYPE ::com::sun::star::uno::Type
#define UNO3_RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
#define UNO3_XTOOLKIT ::com::sun::star::awt::XToolkit
#define UNO3_XWINDOWPEER ::com::sun::star::awt::XWindowPeer
#define UNO3_EVENTOBJECT ::com::sun::star::lang::EventObject
#define UNO3_SEQUENCE ::com::sun::star::uno::Sequence
#define UNO3_XCONTAINERLISTENER ::com::sun::star::container::XContainerListener
#define UNO3_ANY ::com::sun::star::uno::Any
#define UNO3_XTABCONTROLLER ::com::sun::star::awt::XTabController
#define UNO3_WINDOWDESCRIPTOR ::com::sun::star::awt::WindowDescriptor
#define UNO3_XGRAPHICS ::com::sun::star::awt::XGraphics
#define UNO3_OMULTITYPEINTERFACECONTAINERHELPER ::cppu::OMultiTypeInterfaceContainerHelper
#define UNO3_ILLEGALARGUMENTEXCEPTION ::com::sun::star::lang::IllegalArgumentException
//____________________________________________________________________________________________________________
// structs, types, forwards
//____________________________________________________________________________________________________________
struct IMPL_ControlInfo
{
UNO3_REFERENCE< UNO3_XCONTROL > xControl ;
UNO3_OUSTRING sName ;
};
// makro define a list-class for struct IMPL_ControlInfo!
class IMPL_ControlInfoList ;
DECLARE_LIST( IMPL_ControlInfoList, IMPL_ControlInfo* )
//____________________________________________________________________________________________________________
// classes
//____________________________________________________________________________________________________________
class BaseContainerControl : public UNO3_XCONTROLMODEL
, public UNO3_XCONTROLCONTAINER
, public BaseControl
{
//____________________________________________________________________________________________________________
// public methods
//____________________________________________________________________________________________________________
public:
//________________________________________________________________________________________________________
// construct/destruct
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
BaseContainerControl( const UNO3_REFERENCE< UNO3_XMULTISERVICEFACTORY >& xFactory );
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual ~BaseContainerControl();
//________________________________________________________________________________________________________
// XInterface
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short give answer, if interface is supported
@descr The interfaces are searched by type.
@seealso XInterface
@param "rType" is the type of searched interface.
@return Any information about found interface
@onerror A RuntimeException is thrown.
*/
virtual UNO3_ANY SAL_CALL queryInterface( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
//________________________________________________________________________________________________________
// XTypeProvider
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short get information about supported interfaces
@descr -
@seealso XTypeProvider
@param -
@return Sequence of types of all supported interfaces
@onerror A RuntimeException is thrown.
*/
virtual UNO3_SEQUENCE< UNO3_TYPE > SAL_CALL getTypes() throw( UNO3_RUNTIMEEXCEPTION );
//________________________________________________________________________________________________________
// XAggregation
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual UNO3_ANY SAL_CALL queryAggregation( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
//________________________________________________________________________________________________________
// XControl
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL createPeer( const UNO3_REFERENCE< UNO3_XTOOLKIT >& xToolkit ,
const UNO3_REFERENCE< UNO3_XWINDOWPEER >& xParent ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual sal_Bool SAL_CALL setModel( const UNO3_REFERENCE< UNO3_XCONTROLMODEL >& xModel ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual UNO3_REFERENCE< UNO3_XCONTROLMODEL > SAL_CALL getModel() throw( UNO3_RUNTIMEEXCEPTION );
//________________________________________________________________________________________________________
// XComponent
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL dispose() throw( UNO3_RUNTIMEEXCEPTION );
//________________________________________________________________________________________________________
// XEventListener
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL disposing( const UNO3_EVENTOBJECT& rEvent ) throw( UNO3_RUNTIMEEXCEPTION );
//________________________________________________________________________________________________________
// XControlContainer
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL addControl( const UNO3_OUSTRING& sName ,
const UNO3_REFERENCE< UNO3_XCONTROL >& xControl ) throw( UNO3_ILLEGALARGUMENTEXCEPTION ,
UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL addContainerListener( const UNO3_REFERENCE< UNO3_XCONTAINERLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL removeControl( const UNO3_REFERENCE< UNO3_XCONTROL >& xControl ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL removeContainerListener( const UNO3_REFERENCE< UNO3_XCONTAINERLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL setStatusText( const UNO3_OUSTRING& sStatusText ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual UNO3_REFERENCE< UNO3_XCONTROL > SAL_CALL getControl( const UNO3_OUSTRING& sName) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual UNO3_SEQUENCE< UNO3_REFERENCE< UNO3_XCONTROL > > SAL_CALL getControls() throw( UNO3_RUNTIMEEXCEPTION );
//________________________________________________________________________________________________________
// XUnoControlContainer
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL addTabController( const UNO3_REFERENCE< UNO3_XTABCONTROLLER >& xTabController ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL removeTabController( const UNO3_REFERENCE< UNO3_XTABCONTROLLER >& xTabController ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL setTabControllers( const UNO3_SEQUENCE< UNO3_REFERENCE< UNO3_XTABCONTROLLER > >& xTabControllers ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual UNO3_SEQUENCE< UNO3_REFERENCE< UNO3_XTABCONTROLLER > > SAL_CALL getTabControllers() throw( UNO3_RUNTIMEEXCEPTION );
//________________________________________________________________________________________________________
// XWindow
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL setVisible( sal_Bool bVisible ) throw( UNO3_RUNTIMEEXCEPTION );
//____________________________________________________________________________________________________________
// protected methods
//____________________________________________________________________________________________________________
protected:
/**_______________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual UNO3_WINDOWDESCRIPTOR* impl_getWindowDescriptor( const UNO3_REFERENCE< UNO3_XWINDOWPEER >& xParentPeer );
/**_______________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual void impl_paint( sal_Int32 nX ,
sal_Int32 nY ,
const UNO3_REFERENCE< UNO3_XGRAPHICS >& xGraphics );
//____________________________________________________________________________________________________________
// private methods
//____________________________________________________________________________________________________________
private:
/**_______________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
void impl_activateTabControllers();
/**_______________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
void impl_cleanMemory();
//____________________________________________________________________________________________________________
// private variables
//____________________________________________________________________________________________________________
private:
IMPL_ControlInfoList* m_pControlInfoList ; /// list of pointer of "struct IMPL_ControlInfo" to hold child-controls
UNO3_SEQUENCE< UNO3_REFERENCE< UNO3_XTABCONTROLLER > > m_xTabControllerList ; /// list of references of XTabController to hold tab-order in this container
UNO3_OMULTITYPEINTERFACECONTAINERHELPER m_aListeners ;
}; // class BaseContainerControl
} // namespace unocontrols
#endif // ifndef _UNOCONTROLS_BASECONTAINERCONTROL_CTRL_HXX
File diff suppressed because it is too large Load Diff
+169
View File
@@ -0,0 +1,169 @@
/*************************************************************************
*
* $RCSfile: definesunocontrols.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _UNOCONTROLS_DEFINES_CTRL_HXX
#define _UNOCONTROLS_DEFINES_CTRL_HXX
//-------------------------------------------------------------------------------------------------------------------
// includes
#include <limits.h> // defines for min/max of INT
namespace unocontrols{
//-------------------------------------------------------------------------------------------------------------------
// global defines for all UnoControls
//-------------------------------------------------------------------------------------------------------------------
#define UNOCONTROLS_TRGB_COLORDATA( t,r,g,b ) ((INT32)(((UINT32)((UINT8)(b))))|(((UINT32)((UINT8)(g)))<<8)|(((UINT32)((UINT8)(r)))<<16)|(((UINT32)((UINT8)(t)))<<24))
//-------------------------------------------------------------------------------------------------------------------
// defines for BaseControl
#ifdef _UNOCONTROLS_BASECONTROL_CTRL_HXX
#define BASECONTROL_IDLCLASSNAME "BaseControl"
#define BASECONTROL_DEFAULT_PMULTIPLEXER NULL
#define BASECONTROL_DEFAULT_X 0
#define BASECONTROL_DEFAULT_Y 0
#define BASECONTROL_DEFAULT_WIDTH 100
#define BASECONTROL_DEFAULT_HEIGHT 100
#define BASECONTROL_DEFAULT_VISIBLE FALSE
#define BASECONTROL_DEFAULT_INDESIGNMODE FALSE
#define BASECONTROL_DEFAULT_ENABLE TRUE
#define BASECONTROL_SERVICE_VCLTOOLKIT "com.sun.star.awt.VclToolkit"
#endif
//-------------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------------
// defines for BaseContainerControl
#ifdef _UNOCONTROLS_BASECONTAINERCONTROL_CTRL_HXX
#define BASECONTAINERCONTROL_IDLCLASSNAME "BaseContainerControl"
#endif
//-------------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------------
// defines for ProgressBar
#ifdef _UNOCONTROLS_PROGRESSBAR_CTRL_HXX
#define PROGRESSBAR_IDLCLASSNAME "XProgressbar"
#define PROGRESSBAR_SERVICENAME "com.sun.star.awt.XProgressBar"
#define PROGRESSBAR_IMPLEMENTATIONNAME "stardiv.UnoControls.ProgressBar"
#define PROGRESSBAR_FREEBORDER 2
#define PROGRESSBAR_DEFAULT_HORIZONTAL TRUE
#define PROGRESSBAR_DEFAULT_BLOCKDIMENSION Size(1,1)
#define PROGRESSBAR_DEFAULT_BACKGROUNDCOLOR UNOCONTROLS_TRGB_COLORDATA( 0x00, 0xC0, 0xC0, 0xC0 ) // lightgray
#define PROGRESSBAR_DEFAULT_FOREGROUNDCOLOR UNOCONTROLS_TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x80 ) // blue
#define PROGRESSBAR_DEFAULT_MINRANGE INT_MIN
#define PROGRESSBAR_DEFAULT_MAXRANGE INT_MAX
#define PROGRESSBAR_DEFAULT_BLOCKVALUE 1
#define PROGRESSBAR_DEFAULT_VALUE PROGRESSBAR_DEFAULT_MINRANGE
#define PROGRESSBAR_LINECOLOR_BRIGHT UNOCONTROLS_TRGB_COLORDATA( 0x00, 0xFF, 0xFF, 0xFF ) // white
#define PROGRESSBAR_LINECOLOR_SHADOW UNOCONTROLS_TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x00 ) // black
#endif
//-------------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------------
// defines for FrameControl
#ifdef _UNOCONTROLS_FRAMECONTROL_CTRL_HXX
#define FRAMECONTROL_IDLCLASSNAME "FrameControl"
#define FRAMECONTROL_SERVICENAME "com.sun.star.frame.FrameControl"
#define FRAMECONTROL_IMPLEMENTATIONNAME "stardiv.UnoControls.FrameControl"
#define FRAMECONTROL_DEFAULT_COMPONENTURL "private:factory/swriter"
#define FRAMECONTROL_PROPERTYNAME_LOADERARGUMENTS "LoaderArguments"
#define FRAMECONTROL_PROPERTYNAME_COMPONENTURL "ComponentURL"
#define FRAMECONTROL_PROPERTYNAME_FRAME "Frame"
#define FRAMECONTROL_PROPERTYNAME_IDLCLASSES "IDLClasses"
#define FRAMECONTROL_ERRORTEXT_VOSENSHURE "This is an invalid property handle."
#define FRAMECONTROL_PROPERTY_COUNT 4 // you must count the propertys
#define FRAMECONTROL_PROPERTY_COMPONENTURL 0 // Id must be the index into the array
#define FRAMECONTROL_PROPERTY_FRAME 1
#define FRAMECONTROL_PROPERTY_IDLCLASSES 2
#define FRAMECONTROL_PROPERTY_LOADERARGUMENTS 3
#endif
//-------------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------------
// defines for ProgressMonitor
#ifdef _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX
#define PROGRESSMONITOR_IDLCLASSNAME "XProgressMonitor"
#define PROGRESSMONITOR_SERVICENAME "com.sun.star.awt.XProgressMonitor"
#define PROGRESSMONITOR_IMPLEMENTATIONNAME "stardiv.UnoControls.ProgressMonitor"
#define PROGRESSMONITOR_FREEBORDER 10 // border around and between the controls
#define PROGRESSMONITOR_WIDTH_RELATION 4 // reserve 1/4 for button width and rest for progressbar width
#define PROGRESSMONITOR_HEIGHT_RELATION 5 // reserve 1/5 for button and progressbar heigth and rest for text height
#define PROGRESSMONITOR_FIXEDTEXT_SERVICENAME "com.sun.star.awt.UnoControlFixedText"
#define PROGRESSMONITOR_BUTTON_SERVICENAME "com.sun.star.awt.UnoControlButton"
#define PROGRESSMONITOR_FIXEDTEXT_MODELNAME "com.sun.star.awt.UnoControlFixedTextModel"
#define PROGRESSMONITOR_BUTTON_MODELNAME "com.sun.star.awt.UnoControlButtonModel"
#define PROGRESSMONITOR_CONTROLNAME_TEXT "Text" // identifier the control in container
#define PROGRESSMONITOR_CONTROLNAME_BUTTON "Button" // -||-
#define PROGRESSMONITOR_CONTROLNAME_PROGRESSBAR "ProgressBar" // -||-
#define PROGRESSMONITOR_DEFAULT_BUTTONLABEL "Abbrechen"
#define PROGRESSMONITOR_DEFAULT_TOPIC "\0"
#define PROGRESSMONITOR_DEFAULT_TEXT "\0"
#define PROGRESSMONITOR_BACKGROUNDCOLOR UNOCONTROLS_TRGB_COLORDATA( 0x00, 0xC0, 0xC0, 0xC0 ) // lighgray
#define PROGRESSMONITOR_LINECOLOR_BRIGHT UNOCONTROLS_TRGB_COLORDATA( 0x00, 0xFF, 0xFF, 0xFF ) // white
#define PROGRESSMONITOR_LINECOLOR_SHADOW UNOCONTROLS_TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x00 ) // black
#define PROGRESSMONITOR_HEIGHT_PROGRESSBAR 15
#define PROGRESSMONITOR_DEFAULT_WIDTH 350
#define PROGRESSMONITOR_DEFAULT_HEIGHT 100
#endif
//-------------------------------------------------------------------------------------------------------------------
} // namespace unocontrols
#endif // #ifndef _UNOCONTROLS_DEFINES_CTRL_HXX
+855
View File
@@ -0,0 +1,855 @@
/*************************************************************************
*
* $RCSfile: multiplexer.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _UNOCONTROLS_MULTIPLEXER_HXX
#define _UNOCONTROLS_MULTIPLEXER_HXX
//____________________________________________________________________________________________________________
// includes of other projects
//____________________________________________________________________________________________________________
#ifndef _COM_SUN_STAR_AWT_XKEYLISTENER_HPP_
#include <com/sun/star/awt/XKeyListener.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XPAINTLISTENER_HPP_
#include <com/sun/star/awt/XPaintListener.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_KEYEVENT_HPP_
#include <com/sun/star/awt/KeyEvent.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_KEYMODIFIER_HPP_
#include <com/sun/star/awt/KeyModifier.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XMOUSEMOTIONLISTENER_HPP_
#include <com/sun/star/awt/XMouseMotionListener.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_FOCUSEVENT_HPP_
#include <com/sun/star/awt/FocusEvent.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XWINDOWLISTENER_HPP_
#include <com/sun/star/awt/XWindowListener.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XACTIVATELISTENER_HPP_
#include <com/sun/star/awt/XActivateListener.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_MOUSEEVENT_HPP_
#include <com/sun/star/awt/MouseEvent.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XTOPWINDOWLISTENER_HPP_
#include <com/sun/star/awt/XTopWindowListener.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_PAINTEVENT_HPP_
#include <com/sun/star/awt/PaintEvent.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_INPUTEVENT_HPP_
#include <com/sun/star/awt/InputEvent.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_KEYGROUP_HPP_
#include <com/sun/star/awt/KeyGroup.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_KEY_HPP_
#include <com/sun/star/awt/Key.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_WINDOWEVENT_HPP_
#include <com/sun/star/awt/WindowEvent.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XMOUSELISTENER_HPP_
#include <com/sun/star/awt/XMouseListener.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_KEYFUNCTION_HPP_
#include <com/sun/star/awt/KeyFunction.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_FOCUSCHANGEREASON_HPP_
#include <com/sun/star/awt/FocusChangeReason.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_MOUSEBUTTON_HPP_
#include <com/sun/star/awt/MouseButton.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XFOCUSLISTENER_HPP_
#include <com/sun/star/awt/XFocusListener.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XTOPWINDOW_HPP_
#include <com/sun/star/awt/XTopWindow.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
#include <com/sun/star/awt/XWindow.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_
#include <com/sun/star/awt/PosSize.hpp>
#endif
#ifndef _CPPUHELPER_WEAK_HXX_
#include <cppuhelper/weak.hxx>
#endif
#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
#include <cppuhelper/interfacecontainer.hxx>
#endif
//____________________________________________________________________________________________________________
// includes of my own project
//____________________________________________________________________________________________________________
//____________________________________________________________________________________________________________
// "namespaces"
//____________________________________________________________________________________________________________
namespace unocontrols{
#define UNO3_OWEAKOBJECT ::cppu::OWeakObject
#define UNO3_XWINDOW ::com::sun::star::awt::XWindow
#define UNO3_REFERENCE ::com::sun::star::uno::Reference
#define UNO3_WEAKREFERENCE ::com::sun::star::uno::WeakReference
#define UNO3_MUTEX ::osl::Mutex
#define UNO3_XWINDOWLISTENER ::com::sun::star::awt::XWindowListener
#define UNO3_XKEYLISTENER ::com::sun::star::awt::XKeyListener
#define UNO3_XMOUSELISTENER ::com::sun::star::awt::XMouseListener
#define UNO3_XMOUSEMOTIONLISTENER ::com::sun::star::awt::XMouseMotionListener
#define UNO3_XPAINTLISTENER ::com::sun::star::awt::XPaintListener
#define UNO3_XTOPWINDOWLISTENER ::com::sun::star::awt::XTopWindowListener
#define UNO3_XFOCUSLISTENER ::com::sun::star::awt::XFocusListener
#define UNO3_ANY ::com::sun::star::uno::Any
#define UNO3_TYPE ::com::sun::star::uno::Type
#define UNO3_RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
#define UNO3_XINTERFACE ::com::sun::star::uno::XInterface
#define UNO3_EVENTOBJECT ::com::sun::star::lang::EventObject
#define UNO3_FOCUSEVENT ::com::sun::star::awt::FocusEvent
#define UNO3_WINDOWEVENT ::com::sun::star::awt::WindowEvent
#define UNO3_KEYEVENT ::com::sun::star::awt::KeyEvent
#define UNO3_MOUSEEVENT ::com::sun::star::awt::MouseEvent
#define UNO3_PAINTEVENT ::com::sun::star::awt::PaintEvent
#define UNO3_OMULTITYPEINTERFACECONTAINERHELPER ::cppu::OMultiTypeInterfaceContainerHelper
//____________________________________________________________________________________________________________
// class
//____________________________________________________________________________________________________________
class OMRCListenerMultiplexerHelper : public UNO3_XFOCUSLISTENER
, public UNO3_XWINDOWLISTENER
, public UNO3_XKEYLISTENER
, public UNO3_XMOUSELISTENER
, public UNO3_XMOUSEMOTIONLISTENER
, public UNO3_XPAINTLISTENER
, public UNO3_XTOPWINDOWLISTENER
, public UNO3_OWEAKOBJECT
{
//____________________________________________________________________________________________________________
// public methods
//____________________________________________________________________________________________________________
public:
//________________________________________________________________________________________________________
// construct/destruct
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short constructor
@descr Create a Multiplexer of XWindowEvents.
@seealso -
@param rControl The control. All listeners think that this is the original broadcaster.
@param rPeer The peer from which the original events are dispatched. Null is allowed.
@return -
@onerror -
*/
OMRCListenerMultiplexerHelper( const UNO3_REFERENCE< UNO3_XWINDOW >& xControl ,
const UNO3_REFERENCE< UNO3_XWINDOW >& xPeer );
/**_______________________________________________________________________________________________________
@short copy-constructor
@descr
@seealso -
@param rCopyInstance C++-Reference to instance to make copy from.
@return -
@onerror -
*/
OMRCListenerMultiplexerHelper( const OMRCListenerMultiplexerHelper& aCopyInstance );
/**_______________________________________________________________________________________________________
@short destructor
@descr -
@seealso -
@param -
@return -
@onerror -
*/
~OMRCListenerMultiplexerHelper();
//________________________________________________________________________________________________________
// XInterface
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short give answer, if interface is supported
@descr The interfaces are searched by type.
@seealso XInterface
@param "rType" is the type of searched interface.
@return Any information about found interface
@onerror A RuntimeException is thrown.
*/
virtual UNO3_ANY SAL_CALL queryInterface( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short increment refcount
@descr -
@seealso XInterface
@seealso release()
@param -
@return -
@onerror A RuntimeException is thrown.
*/
virtual void SAL_CALL acquire() throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short decrement refcount
@descr -
@seealso XInterface
@seealso acquire()
@param -
@return -
@onerror A RuntimeException is thrown.
*/
virtual void SAL_CALL release() throw( UNO3_RUNTIMEEXCEPTION );
//________________________________________________________________________________________________________
// operator
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
operator UNO3_REFERENCE< UNO3_XINTERFACE >() const;
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
OMRCListenerMultiplexerHelper& operator= ( const OMRCListenerMultiplexerHelper& aCopyInstance );
//________________________________________________________________________________________________________
// container methods
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short Remove all listeners from the previous set peer and add the needed listeners to rPeer.
@descr -
@seealso -
@param rPeer The peer from which the original events are dispatched. Null is allowed.
@return -
@onerror -
*/
void setPeer( const UNO3_REFERENCE< UNO3_XWINDOW >& xPeer );
/**_______________________________________________________________________________________________________
@short Remove all listeners and send a disposing message.
@descr -
@seealso -
@param -
@return -
@onerror -
*/
void disposeAndClear();
/**_______________________________________________________________________________________________________
@short Add the specified listener to the source.
@descr -
@seealso -
@param -
@return -
@onerror -
*/
void advise( const UNO3_TYPE& aType ,
const UNO3_REFERENCE< UNO3_XINTERFACE >& xListener );
/**_______________________________________________________________________________________________________
@short Remove the specified listener from the source.
@descr -
@seealso -
@param -
@return -
@onerror -
*/
void unadvise( const UNO3_TYPE& aType ,
const UNO3_REFERENCE< UNO3_XINTERFACE >& xListener );
//________________________________________________________________________________________________________
// XEventListener
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL disposing(const UNO3_EVENTOBJECT& aSource) throw( UNO3_RUNTIMEEXCEPTION ) ;
//________________________________________________________________________________________________________
// XFocusListener
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL focusGained(const UNO3_FOCUSEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL focusLost(const UNO3_FOCUSEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
//________________________________________________________________________________________________________
// XWindowListener
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL windowResized(const UNO3_WINDOWEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL windowMoved(const UNO3_WINDOWEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL windowShown(const UNO3_EVENTOBJECT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL windowHidden(const UNO3_EVENTOBJECT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
//________________________________________________________________________________________________________
// XKeyListener
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL keyPressed( const UNO3_KEYEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL keyReleased( const UNO3_KEYEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
//________________________________________________________________________________________________________
// XMouseListener
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL mousePressed(const UNO3_MOUSEEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL mouseReleased(const UNO3_MOUSEEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL mouseEntered(const UNO3_MOUSEEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL mouseExited(const UNO3_MOUSEEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
//________________________________________________________________________________________________________
// XMouseMotionListener
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL mouseDragged(const UNO3_MOUSEEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL mouseMoved(const UNO3_MOUSEEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
//________________________________________________________________________________________________________
// XPaintListener
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL windowPaint(const UNO3_PAINTEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
//________________________________________________________________________________________________________
// XTopWindowListener
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL windowOpened( const UNO3_EVENTOBJECT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL windowClosing( const UNO3_EVENTOBJECT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL windowClosed( const UNO3_EVENTOBJECT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL windowMinimized( const UNO3_EVENTOBJECT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL windowNormalized( const UNO3_EVENTOBJECT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL windowActivated( const UNO3_EVENTOBJECT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL windowDeactivated( const UNO3_EVENTOBJECT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
//____________________________________________________________________________________________________________
// protected methods
//____________________________________________________________________________________________________________
protected:
/**_______________________________________________________________________________________________________
@short Remove the listener from the peer.
@descr -
@seealso -
@param xPeer The peer from which the listener is removed.
@param rType The listener type, which specify the type of the listener.
@return -
@onerror -
*/
void impl_adviseToPeer( const UNO3_REFERENCE< UNO3_XWINDOW >& xPeer ,
const UNO3_TYPE& aType );
/**_______________________________________________________________________________________________________
@short Add the listener to the peer.
@descr -
@seealso -
@param xPeer The peer to which the listener is added.
@param rType The listener type, which specify the type of the listener.
@return -
@onerror -
*/
void impl_unadviseFromPeer( const UNO3_REFERENCE< UNO3_XWINDOW >& xPeer ,
const UNO3_TYPE& aType );
//____________________________________________________________________________________________________________
// private variables
//____________________________________________________________________________________________________________
private:
UNO3_MUTEX m_aMutex ;
UNO3_REFERENCE< UNO3_XWINDOW > m_xPeer ; /// The source of the events. Normally this is the peer object.
UNO3_WEAKREFERENCE< UNO3_XWINDOW > m_xControl ;
UNO3_OMULTITYPEINTERFACECONTAINERHELPER m_aListenerHolder ;
}; // class OMRCListenerMultiplexerHelper
} // namespace unocontrols
#endif // ifndef _UNOCONTROLS_MULTIPLEXER_HXX
+6
View File
@@ -0,0 +1,6 @@
..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\*.so
..\%__SRC%\lib\*.sl %_DEST%\lib%_EXT%\*.sl
..\%__SRC%\bin\*.bin %_DEST%\bin%_EXT%\*.bin
..\%__SRC%\misc\*.hid %_DEST%\bin%_EXT%\*.hid
..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res
@@ -0,0 +1,683 @@
/*************************************************************************
*
* $RCSfile: basecontainercontrol.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning 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 _UNOCONTROLS_BASECONTAINERCONTROL_CTRL_HXX
#include "basecontainercontrol.hxx"
#endif
//____________________________________________________________________________________________________________
// includes of other projects
//____________________________________________________________________________________________________________
#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
#include <cppuhelper/typeprovider.hxx>
#endif
//____________________________________________________________________________________________________________
// includes of my own project
//____________________________________________________________________________________________________________
//____________________________________________________________________________________________________________
// namespaces
//____________________________________________________________________________________________________________
using namespace ::cppu ;
using namespace ::osl ;
using namespace ::rtl ;
using namespace ::com::sun::star::uno ;
using namespace ::com::sun::star::lang ;
using namespace ::com::sun::star::awt ;
using namespace ::com::sun::star::container ;
namespace unocontrols{
//____________________________________________________________________________________________________________
// construct/destruct
//____________________________________________________________________________________________________________
BaseContainerControl::BaseContainerControl( const Reference< XMultiServiceFactory >& xFactory )
: BaseControl ( xFactory )
, m_aListeners ( m_aMutex )
{
// initialize info list for controls
m_pControlInfoList = new IMPL_ControlInfoList ;
}
BaseContainerControl::~BaseContainerControl()
{
impl_cleanMemory();
}
//____________________________________________________________________________________________________________
// XInterface
//____________________________________________________________________________________________________________
Any SAL_CALL BaseContainerControl::queryInterface( const Type& rType ) throw( RuntimeException )
{
// Attention:
// Don't use mutex or guard in this method!!! Is a method of XInterface.
Any aReturn ;
Reference< XInterface > xDelegator = BaseControl::impl_getDelegator();
if ( xDelegator.is() == sal_True )
{
// If an delegator exist, forward question to his queryInterface.
// Delegator will ask his own queryAggregation!
aReturn = xDelegator->queryInterface( rType );
}
else
{
// If an delegator unknown, forward question to own queryAggregation.
aReturn = queryAggregation( rType );
}
return aReturn ;
}
//____________________________________________________________________________________________________________
// XTypeProvider
//____________________________________________________________________________________________________________
Sequence< Type > SAL_CALL BaseContainerControl::getTypes() throw( 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 OTypeCollection* pTypeCollection = NULL ;
if ( pTypeCollection == NULL )
{
// Ready for multithreading; get global mutex for first call of this method only! see before
MutexGuard aGuard( 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 OTypeCollection aTypeCollection ( ::getCppuType(( const Reference< XControlModel >*)NULL ) ,
::getCppuType(( const Reference< XControlContainer >*)NULL ) ,
BaseControl::getTypes()
);
// ... and set his address to static pointer!
pTypeCollection = &aTypeCollection ;
}
}
return pTypeCollection->getTypes();
}
//____________________________________________________________________________________________________________
// XAggregation
//____________________________________________________________________________________________________________
Any SAL_CALL BaseContainerControl::queryAggregation( const Type& aType ) throw( RuntimeException )
{
// Ask for my own supported interfaces ...
// Attention: XTypeProvider and XInterface are supported by OComponentHelper!
Any aReturn ( ::cppu::queryInterface( aType ,
static_cast< XControlModel* > ( this ) ,
static_cast< XControlContainer* > ( this )
)
);
// If searched interface supported by this class ...
if ( aReturn.hasValue() == sal_True )
{
// ... return this information.
return aReturn ;
}
else
{
// Else; ... ask baseclass for interfaces!
return BaseControl::queryAggregation( aType );
}
}
//____________________________________________________________________________________________________________
// XControl
//____________________________________________________________________________________________________________
void SAL_CALL BaseContainerControl::createPeer( const Reference< XToolkit >& xToolkit ,
const Reference< XWindowPeer >& xParent ) throw( RuntimeException )
{
if ( getPeer().is() == sal_False )
{
// create own peer
BaseControl::createPeer( xToolkit, xParent );
// create peers at all childs
Sequence< Reference< XControl > > seqControlList = getControls();
sal_uInt32 nControls = seqControlList.getLength();
for ( sal_uInt32 n=0; n<nControls; n++ )
{
seqControlList.getArray()[n]->createPeer( xToolkit, getPeer() );
}
// activate new tab order
impl_activateTabControllers();
/*
Reference< XVclContainerPeer > xC;
mxPeer->queryInterface( ::getCppuType((const Reference< XVclContainerPeer >*)0), xC );
xC->enableDialogControl( sal_True );
*/
}
}
//____________________________________________________________________________________________________________
// XControl
//____________________________________________________________________________________________________________
sal_Bool SAL_CALL BaseContainerControl::setModel( const Reference< XControlModel >& xModel ) throw( RuntimeException )
{
// This object has NO model.
return sal_False ;
}
//____________________________________________________________________________________________________________
// XControl
//____________________________________________________________________________________________________________
Reference< XControlModel > SAL_CALL BaseContainerControl::getModel() throw( RuntimeException )
{
// This object has NO model.
// return (XControlModel*)this ;
return Reference< XControlModel >();
}
//____________________________________________________________________________________________________________
// XComponent
//____________________________________________________________________________________________________________
void SAL_CALL BaseContainerControl::dispose() throw( RuntimeException )
{
// Zuerst der Welt mitteilen, daß der Container wegfliegt. Dieses ist um einiges
// schneller wenn die Welt sowohl an den Controls als auch am Container horcht
// Ready for multithreading
MutexGuard aGuard( m_aMutex );
// remove listeners
EventObject aObject ;
aObject.Source = Reference< XComponent > ( (XControlContainer*)this, UNO_QUERY );
m_aListeners.disposeAndClear( aObject );
// remove controls
Sequence< Reference< XControl > > seqCtrls = getControls();
Reference< XControl > * pCtrls = seqCtrls.getArray();
sal_uInt32 nCtrls = seqCtrls.getLength();
sal_uInt32 nMaxCount = m_pControlInfoList->Count();
sal_uInt32 nCount = 0;
for ( nCount = 0; nCount < nMaxCount; ++nCount )
{
delete m_pControlInfoList->GetObject( 0 );
}
m_pControlInfoList->Clear();
for ( nCount = 0; nCount < nCtrls; ++nCount )
{
pCtrls [ nCount ] -> removeEventListener ( this ) ;
pCtrls [ nCount ] -> dispose ( ) ;
}
// call baseclass
BaseControl::dispose();
}
//____________________________________________________________________________________________________________
// XEventListener
//____________________________________________________________________________________________________________
void SAL_CALL BaseContainerControl::disposing( const EventObject& rEvent ) throw( RuntimeException )
{
Reference< XControl > xControl( rEvent.Source, UNO_QUERY );
// "removeControl" remove only, when control is an active control
removeControl( xControl );
}
//____________________________________________________________________________________________________________
// XControlContainer
//____________________________________________________________________________________________________________
void SAL_CALL BaseContainerControl::addControl ( const OUString& rName, const Reference< XControl > & rControl ) throw( IllegalArgumentException, RuntimeException )
{
// only correct references can add to list!!!
if ( !rControl.is () )
{
throw IllegalArgumentException ();
}
// take memory for new item
IMPL_ControlInfo* pNewControl = new IMPL_ControlInfo ;
if (pNewControl!=(IMPL_ControlInfo*)0)
{
// Ready for multithreading
MutexGuard aGuard (m_aMutex) ;
// set control
pNewControl->sName = rName ;
pNewControl->xControl = rControl ;
// and insert in list
m_pControlInfoList->Insert ( pNewControl, LIST_APPEND ) ;
// initialize new control
pNewControl->xControl->setContext ( (OWeakObject*)this ) ;
pNewControl->xControl->addEventListener ( this ) ;
// when container has a peer ...
if (getPeer().is())
{
// .. then create a peer on child
pNewControl->xControl->createPeer ( getPeer()->getToolkit(), getPeer() ) ;
impl_activateTabControllers () ;
}
// Send message to all listener
OInterfaceContainerHelper* pInterfaceContainer = m_aListeners.getContainer( ::getCppuType((const Reference< XContainerListener >*)0) ) ;
if (pInterfaceContainer)
{
// Build event
ContainerEvent aEvent ;
aEvent.Source = *this ;
aEvent.Element <<= rControl ;
// Get all listener
OInterfaceIteratorHelper aIterator (*pInterfaceContainer) ;
// Send event
while ( aIterator.hasMoreElements() )
{
((XContainerListener*)aIterator.next())->elementInserted (aEvent) ;
}
}
}
}
//____________________________________________________________________________________________________________
// XControlContainer
//____________________________________________________________________________________________________________
void SAL_CALL BaseContainerControl::addContainerListener ( const Reference< XContainerListener > & rListener ) throw( RuntimeException )
{
// Ready for multithreading
MutexGuard aGuard ( m_aMutex ) ;
m_aListeners.addInterface ( ::getCppuType((const Reference< XContainerListener >*)0), rListener ) ;
}
//____________________________________________________________________________________________________________
// XControlContainer
//____________________________________________________________________________________________________________
void SAL_CALL BaseContainerControl::removeControl ( const Reference< XControl > & rControl ) throw( RuntimeException )
{
if ( rControl.is() )
{
// Ready for multithreading
MutexGuard aGuard (m_aMutex) ;
sal_uInt32 nControls = m_pControlInfoList->Count () ;
for ( sal_uInt32 n=0; n<nControls; n++ )
{
// Search for right control
IMPL_ControlInfo* pControl = m_pControlInfoList->GetObject (n) ;
if ( rControl == pControl->xControl )
{
//.is it found ... remove listener from control
pControl->xControl->removeEventListener ( this ) ;
pControl->xControl->setContext ( Reference< XInterface > () ) ;
// ... free memory
delete pControl ;
m_pControlInfoList->Remove (n) ;
// Send message to all other listener
OInterfaceContainerHelper * pInterfaceContainer = m_aListeners.getContainer( ::getCppuType((const Reference< XContainerListener >*)0) ) ;
if (pInterfaceContainer)
{
ContainerEvent aEvent ;
aEvent.Source = *this ;
aEvent.Element <<= rControl ;
OInterfaceIteratorHelper aIterator (*pInterfaceContainer) ;
while ( aIterator.hasMoreElements() )
{
((XContainerListener*)aIterator.next())->elementRemoved (aEvent) ;
}
}
// Break "for" !
break ;
}
}
}
}
//____________________________________________________________________________________________________________
// XControlContainer
//____________________________________________________________________________________________________________
void SAL_CALL BaseContainerControl::removeContainerListener ( const Reference< XContainerListener > & rListener ) throw( RuntimeException )
{
// Ready for multithreading
MutexGuard aGuard ( m_aMutex ) ;
m_aListeners.removeInterface ( ::getCppuType((const Reference< XContainerListener >*)0), rListener ) ;
}
//____________________________________________________________________________________________________________
// XControlContainer
//____________________________________________________________________________________________________________
void SAL_CALL BaseContainerControl::setStatusText ( const OUString& rStatusText ) throw( RuntimeException )
{
// go down to each parent
Reference< XControlContainer > xContainer ( getContext(), UNO_QUERY ) ;
if ( xContainer.is () )
{
xContainer->setStatusText ( rStatusText ) ;
}
}
//____________________________________________________________________________________________________________
// XControlContainer
//____________________________________________________________________________________________________________
Reference< XControl > SAL_CALL BaseContainerControl::getControl ( const OUString& rName ) throw( RuntimeException )
{
// Ready for multithreading
MutexGuard aGuard ( Mutex::getGlobalMutex() ) ;
Reference< XControl > xRetControl = Reference< XControl > () ;
sal_uInt32 nControls = m_pControlInfoList->Count () ;
// Search for right control
for( sal_uInt32 nCount = 0; nCount < nControls; ++nCount )
{
IMPL_ControlInfo* pSearchControl = m_pControlInfoList->GetObject ( nCount ) ;
if ( pSearchControl->sName == rName )
{
// We have found it ...
// Break operation and return.
return pSearchControl->xControl ;
}
}
// We have not found it ... return NULL.
return Reference< XControl > () ;
}
//____________________________________________________________________________________________________________
// XControlContainer
//____________________________________________________________________________________________________________
Sequence< Reference< XControl > > SAL_CALL BaseContainerControl::getControls () throw( RuntimeException )
{
// Ready for multithreading
MutexGuard aGuard ( Mutex::getGlobalMutex() ) ;
sal_uInt32 nControls = m_pControlInfoList->Count () ;
Sequence< Reference< XControl > > aDescriptor ( nControls ) ;
Reference< XControl > * pDestination = aDescriptor.getArray () ;
sal_uInt32 nCount = 0 ;
// Copy controls to sequence
for( nCount = 0; nCount < nControls; ++nCount )
{
IMPL_ControlInfo* pCopyControl = m_pControlInfoList->GetObject ( nCount ) ;
pDestination [ nCount ] = pCopyControl->xControl ;
}
// Return sequence
return aDescriptor ;
}
//____________________________________________________________________________________________________________
// XUnoControlContainer
//____________________________________________________________________________________________________________
void SAL_CALL BaseContainerControl::addTabController ( const Reference< XTabController > & rTabController ) throw( RuntimeException )
{
// Ready for multithreading
MutexGuard aGuard (m_aMutex) ;
sal_uInt32 nOldCount = m_xTabControllerList.getLength () ;
Sequence< Reference< XTabController > > aNewList ( nOldCount + 1 ) ;
sal_uInt32 nCount = 0 ;
// Copy old elements of sequence to new list.
for ( nCount = 0; nCount < nOldCount; ++nCount )
{
aNewList.getArray () [nCount] = m_xTabControllerList.getConstArray () [nCount] ;
}
// Add new controller
aNewList.getArray () [nOldCount] = rTabController ;
// change old and new list
m_xTabControllerList = aNewList ;
}
//____________________________________________________________________________________________________________
// XUnoControlContainer
//____________________________________________________________________________________________________________
void SAL_CALL BaseContainerControl::removeTabController ( const Reference< XTabController > & rTabController ) throw( RuntimeException )
{
// Ready for multithreading
MutexGuard aGuard (m_aMutex) ;
sal_uInt32 nMaxCount = m_xTabControllerList.getLength () ;
sal_uInt32 nCount = 0 ;
// Search right tabcontroller ...
for ( nCount = 0; nCount < nMaxCount; ++nCount )
{
if ( m_xTabControllerList.getConstArray () [nCount] == rTabController )
{
// ... if is it found ... remove it from list.
m_xTabControllerList.getArray()[ nCount ] = Reference< XTabController >() ;
break ;
}
}
}
//____________________________________________________________________________________________________________
// XUnoControlContainer
//____________________________________________________________________________________________________________
void SAL_CALL BaseContainerControl::setTabControllers ( const Sequence< Reference< XTabController > >& rTabControllers ) throw( RuntimeException )
{
// Ready for multithreading
MutexGuard aGuard (m_aMutex) ;
m_xTabControllerList = rTabControllers ;
}
Sequence<Reference< XTabController > > SAL_CALL BaseContainerControl::getTabControllers () throw( RuntimeException )
{
// Ready for multithreading
MutexGuard aGuard (m_aMutex) ;
return m_xTabControllerList ;
}
//____________________________________________________________________________________________________________
// XWindow
//____________________________________________________________________________________________________________
void SAL_CALL BaseContainerControl::setVisible ( sal_Bool bVisible ) throw( RuntimeException )
{
// override baseclass definition
BaseControl::setVisible ( bVisible ) ;
// is it a top window ?
if ( !getContext().is() && bVisible )
{
// then show it automaticly
createPeer ( Reference< XToolkit > (), Reference< XWindowPeer > () ) ;
}
}
//____________________________________________________________________________________________________________
// protected method
//____________________________________________________________________________________________________________
WindowDescriptor* BaseContainerControl::impl_getWindowDescriptor ( const Reference< XWindowPeer > & rParentPeer )
{
// - used from "createPeer()" to set the values of an WindowDescriptor !!!
// - if you will change the descriptor-values, you must override thid virtuell function
// - the caller must release the memory for this dynamical descriptor !!!
WindowDescriptor * aDescriptor = new WindowDescriptor ;
aDescriptor->Type = WindowClass_CONTAINER ;
aDescriptor->WindowServiceName = OUString(RTL_CONSTASCII_USTRINGPARAM("window")) ;
aDescriptor->ParentIndex = -1 ;
aDescriptor->Parent = rParentPeer ;
aDescriptor->Bounds = getPosSize () ;
aDescriptor->WindowAttributes = 0 ;
return aDescriptor ;
}
//____________________________________________________________________________________________________________
// protected method
//____________________________________________________________________________________________________________
void BaseContainerControl::impl_paint ( sal_Int32 nX, sal_Int32 nY, const Reference< XGraphics > & rGraphics )
{
/*
if (rGraphics.is())
{
for ( sal_uInt32 n=m_pControlInfoList->Count(); n; )
{
ControlInfo* pSearchControl = m_pControlInfoList->GetObject (--n) ;
pSearchControl->xControl->paint ( nX, nY, rGraphics ) ;
}
}
*/
}
//____________________________________________________________________________________________________________
// private method
//____________________________________________________________________________________________________________
void BaseContainerControl::impl_activateTabControllers ()
{
// Ready for multithreading
MutexGuard aGuard (m_aMutex) ;
sal_uInt32 nMaxCount = m_xTabControllerList.getLength () ;
sal_uInt32 nCount = 0 ;
for ( nCount = 0; nCount < nMaxCount; ++nCount )
{
m_xTabControllerList.getArray () [nCount]->setContainer ( this ) ;
m_xTabControllerList.getArray () [nCount]->activateTabOrder ( ) ;
}
}
//____________________________________________________________________________________________________________
// private method
//____________________________________________________________________________________________________________
void BaseContainerControl::impl_cleanMemory ()
{
// Get count of listitems.
sal_uInt32 nMaxCount = m_pControlInfoList->Count () ;
sal_uInt32 nCount = 0 ;
// Delete all items.
for ( nCount = 0; nCount < nMaxCount; ++nCount )
{
// Delete everytime first element of list!
// We count from 0 to MAX, where "MAX=count of items" BEFORE we delete some elements!
// If we use "GetObject ( nCount )" ... it can be, that we have an index greater then count of current elements!
IMPL_ControlInfo* pSearchControl = m_pControlInfoList->GetObject ( 0 ) ;
delete pSearchControl ;
}
// Delete list himself.
m_pControlInfoList->Clear () ;
delete m_pControlInfoList ;
}
} // namespace unocontrols
File diff suppressed because it is too large Load Diff
+104
View File
@@ -0,0 +1,104 @@
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1.1.1 $
#
# last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
#
# - GNU Lesser General Public License Version 2.1
# - Sun Industry Standards Source License Version 1.1
#
# Sun Microsystems Inc., October, 2000
#
# GNU Lesser General Public License Version 2.1
# =============================================
# Copyright 2000 by Sun Microsystems, Inc.
# 901 San Antonio Road, Palo Alto, CA 94303, USA
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1, as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
#
# Sun Industry Standards Source License Version 1.1
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.1 (the "License"); You may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at http://www.openoffice.org/license.html.
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning 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=UnoControls
TARGET=base
ENABLE_EXCEPTIONS=TRUE
#LIBTARGET=NO
#USE_LDUMP2=TRUE
#USE_DEFFILE=TRUE
# --- Settings -----------------------------------------------------
.INCLUDE : $(PRJ)$/util$/makefile.pmk
# --- Files --------------------------------------------------------
SLOFILES= $(SLO)$/multiplexer.obj \
$(SLO)$/basecontrol.obj \
$(SLO)$/basecontainercontrol.obj \
$(SLO)$/registercontrols.obj
#LIB1TARGET= $(SLB)$/$(TARGET).lib
#LIB1OBJFILES= $(SLOFILES)
#SHL1TARGET= $(TARGET)$(UPD)$(DLLPOSTFIX)
#SHL1STDLIBS=\
# $(ONELIB) \
# $(USRLIB) \
# $(UNOLIB) \
# $(VOSLIB) \
# $(OSLLIB) \
# $(TOOLSLIB) \
# $(RTLLIB)
#SHL1DEPN= makefile.mk
#SHL1LIBS= $(LIB1TARGET)
#SHL1DEF= $(MISC)$/$(SHL1TARGET).def
#DEF1NAME= $(SHL1TARGET)
#DEF1EXPORTFILE= exports.dxp
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
#.INCLUDE : $(PRJ)$/util$/target.pmk
+610
View File
@@ -0,0 +1,610 @@
/*************************************************************************
*
* $RCSfile: multiplexer.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning 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 include
//____________________________________________________________________________________________________________
#ifndef _UNOCONTROLS_MULTIPLEXER_HXX
#include "multiplexer.hxx"
#endif
//____________________________________________________________________________________________________________
// includes of other projects
//____________________________________________________________________________________________________________
#ifndef _VOS_DIAGNOSE_H_
#include <vos/diagnose.hxx>
#endif
//____________________________________________________________________________________________________________
// includes of my own project
//____________________________________________________________________________________________________________
//____________________________________________________________________________________________________________
// namespaces
//____________________________________________________________________________________________________________
using namespace ::cppu ;
using namespace ::osl ;
using namespace ::com::sun::star::uno ;
using namespace ::com::sun::star::awt ;
using namespace ::com::sun::star::lang ;
namespace unocontrols{
//____________________________________________________________________________________________________________
// macros
//____________________________________________________________________________________________________________
#define MULTIPLEX( INTERFACE, METHOD, EVENTTYP, EVENT ) \
\
/* First get all interfaces from container with right type.*/ \
OInterfaceContainerHelper* pContainer = m_aListenerHolder.getContainer( ::getCppuType((const Reference< INTERFACE## >*)0) ); \
/* Do the follow only, if elements in container exist.*/ \
if( pContainer != NULL ) \
{ \
OInterfaceIteratorHelper aIterator( *pContainer ); \
EVENTTYP aLocalEvent = EVENT##; \
/* Remark: The control is the event source not the peer.*/ \
/* We must change the source of the event. */ \
aLocalEvent.Source = m_xControl ; \
/* Is the control not destroyed? */ \
if( aLocalEvent.Source.is() == sal_True ) \
{ \
if( aIterator.hasMoreElements() ) \
{ \
INTERFACE## * pListener = (INTERFACE## *)aIterator.next(); \
try \
{ \
pListener->METHOD##( aLocalEvent ); \
} \
catch( RuntimeException& ) \
{ \
/* Ignore all system exceptions from the listener! */ \
} \
} \
} \
}
//____________________________________________________________________________________________________________
// construct/destruct
//____________________________________________________________________________________________________________
OMRCListenerMultiplexerHelper::OMRCListenerMultiplexerHelper( const Reference< XWindow >& xControl ,
const Reference< XWindow >& xPeer )
: m_aListenerHolder ( m_aMutex )
, m_xControl ( xControl )
, m_xPeer ( xPeer )
{
}
OMRCListenerMultiplexerHelper::OMRCListenerMultiplexerHelper( const OMRCListenerMultiplexerHelper& aCopyInstance )
: m_aListenerHolder ( m_aMutex )
{
}
OMRCListenerMultiplexerHelper::~OMRCListenerMultiplexerHelper()
{
}
//____________________________________________________________________________________________________________
// XInterface
//____________________________________________________________________________________________________________
Any SAL_CALL OMRCListenerMultiplexerHelper::queryInterface( const Type& rType ) throw( RuntimeException )
{
// Attention:
// Don't use mutex or guard in this method!!! Is a method of XInterface.
// Ask for my own supported interfaces ...
// Attention: XTypeProvider and XInterface are supported by OComponentHelper!
Any aReturn ( ::cppu::queryInterface( rType ,
static_cast< XWindowListener* > ( this ) ,
static_cast< XKeyListener* > ( this ) ,
static_cast< XFocusListener* > ( this ) ,
static_cast< XMouseListener* > ( this ) ,
static_cast< XMouseMotionListener* > ( this ) ,
static_cast< XPaintListener* > ( this ) ,
static_cast< XTopWindowListener* > ( this ) ,
static_cast< XTopWindowListener* > ( this )
)
);
// If searched interface supported by this class ...
if ( aReturn.hasValue() == sal_True )
{
// ... return this information.
return aReturn ;
}
else
{
// Else; ... ask baseclass for interfaces!
return OWeakObject::queryInterface( rType );
}
}
//____________________________________________________________________________________________________________
// XInterface
//____________________________________________________________________________________________________________
void SAL_CALL OMRCListenerMultiplexerHelper::acquire() throw( RuntimeException )
{
// Attention:
// Don't use mutex or guard in this method!!! Is a method of XInterface.
// Forward to baseclass
OWeakObject::acquire();
}
//____________________________________________________________________________________________________________
// XInterface
//____________________________________________________________________________________________________________
void SAL_CALL OMRCListenerMultiplexerHelper::release() throw( RuntimeException )
{
// Attention:
// Don't use mutex or guard in this method!!! Is a method of XInterface.
// Forward to baseclass
OWeakObject::release();
}
//____________________________________________________________________________________________________________
// operator
//____________________________________________________________________________________________________________
OMRCListenerMultiplexerHelper::operator Reference< XInterface >() const
{
return ((OWeakObject*)this) ;
}
//____________________________________________________________________________________________________________
// operator
//____________________________________________________________________________________________________________
//OMRCListenerMultiplexerHelper& OMRCListenerMultiplexerHelper::operator= ( const OMRCListenerMultiplexerHelper& aCopyInstance )
//{
// return this ;
//}
//____________________________________________________________________________________________________________
// container method
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::setPeer( const Reference< XWindow >& xPeer )
{
MutexGuard aGuard( m_aMutex );
if( m_xPeer != xPeer )
{
if( m_xPeer.is() )
{
// get all types from the listener added to the peer
Sequence< Type > aContainedTypes = m_aListenerHolder.getContainedTypes();
const Type* pArray = aContainedTypes.getConstArray();
sal_Int32 nCount = aContainedTypes.getLength();
// loop over all listener types and remove the listeners from the peer
for( sal_Int32 i=0; i<nCount; i++ )
impl_unadviseFromPeer( m_xPeer, pArray[i] );
}
m_xPeer = xPeer;
if( m_xPeer.is() )
{
// get all types from the listener added to the peer
Sequence< Type > aContainedTypes = m_aListenerHolder.getContainedTypes();
const Type* pArray = aContainedTypes.getConstArray();
sal_Int32 nCount = aContainedTypes.getLength();
// loop over all listener types and add the listeners to the peer
for( sal_Int32 i = 0; i < nCount; i++ )
impl_adviseToPeer( m_xPeer, pArray[i] );
}
}
}
//____________________________________________________________________________________________________________
// container method
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::disposeAndClear()
{
EventObject aEvent ;
aEvent.Source = m_xControl ;
m_aListenerHolder.disposeAndClear( aEvent );
}
//____________________________________________________________________________________________________________
// container method
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::advise( const Type& aType ,
const Reference< XInterface >& xListener )
{
MutexGuard aGuard( m_aMutex );
if( m_aListenerHolder.addInterface( aType, xListener ) == 1 )
{
// the first listener is added
if( m_xPeer.is() )
{
impl_adviseToPeer( m_xPeer, aType );
}
}
}
//____________________________________________________________________________________________________________
// container method
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::unadvise( const Type& aType ,
const Reference< XInterface >& xListener )
{
MutexGuard aGuard( m_aMutex );
if( m_aListenerHolder.removeInterface( aType, xListener ) == 0 )
{
// the last listener is removed
if ( m_xPeer.is() )
{
impl_unadviseFromPeer( m_xPeer, aType );
}
}
}
//____________________________________________________________________________________________________________
// XEventListener
//____________________________________________________________________________________________________________
void SAL_CALL OMRCListenerMultiplexerHelper::disposing( const EventObject& aSource ) throw( RuntimeException )
{
MutexGuard aGuard( m_aMutex );
// peer is disposed, clear the reference
m_xPeer = Reference< XWindow >();
}
//____________________________________________________________________________________________________________
// XFcousListener
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::focusGained(const FocusEvent& aEvent ) throw( UNO3_RUNTIMEEXCEPTION )
{
/*
OInterfaceContainerHelper * pCont = aListenerHolder.getContainer( ::getCppuType((const Reference< XFocusListener >*)0) );
if( pCont )
{
OInterfaceIteratorHelper aIt( *pCont );
FocusEvent aEvt = e;
// Reamark: The control is the event source not the peer. We must change
// the source of the event
xControl.queryHardRef( ((XInterface*)NULL)->getSmartUik(), aEvt.Source );
//.is the control not destroyed
if( aEvt.Source.is() )
{
if( aIt.hasMoreElements() )
{
XFocusListener * pListener = (XFocusListener *)aIt.next();
TRY
{
pListener->focusGained( aEvt );
}
CATCH( RuntimeException, e )
{
// ignore all usr system exceptions from the listener
}
END_CATCH;
}
}
}
*/
MULTIPLEX( XFocusListener, focusGained, FocusEvent, aEvent )
}
//____________________________________________________________________________________________________________
// XFcousListener
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::focusLost(const FocusEvent& aEvent ) throw( UNO3_RUNTIMEEXCEPTION )
{
MULTIPLEX( XFocusListener, focusLost, FocusEvent, aEvent )
}
//____________________________________________________________________________________________________________
// XWindowListener
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::windowResized(const WindowEvent& aEvent ) throw( UNO3_RUNTIMEEXCEPTION )
{
MULTIPLEX( XWindowListener, windowResized, WindowEvent, aEvent )
}
//____________________________________________________________________________________________________________
// XWindowListener
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::windowMoved(const WindowEvent& aEvent ) throw( UNO3_RUNTIMEEXCEPTION )
{
MULTIPLEX( XWindowListener, windowMoved, WindowEvent, aEvent )
}
//____________________________________________________________________________________________________________
// XWindowListener
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::windowShown(const EventObject& aEvent ) throw( UNO3_RUNTIMEEXCEPTION )
{
MULTIPLEX( XWindowListener, windowShown, EventObject, aEvent )
}
//____________________________________________________________________________________________________________
// XWindowListener
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::windowHidden(const EventObject& aEvent ) throw( UNO3_RUNTIMEEXCEPTION )
{
MULTIPLEX( XWindowListener, windowHidden, EventObject, aEvent )
}
//____________________________________________________________________________________________________________
// XKeyListener
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::keyPressed(const KeyEvent& aEvent) throw( UNO3_RUNTIMEEXCEPTION )
{
MULTIPLEX( XKeyListener, keyPressed, KeyEvent, aEvent )
}
//____________________________________________________________________________________________________________
// XKeyListener
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::keyReleased(const KeyEvent& aEvent) throw( UNO3_RUNTIMEEXCEPTION )
{
MULTIPLEX( XKeyListener, keyReleased, KeyEvent, aEvent )
}
//____________________________________________________________________________________________________________
// XMouseListener
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::mousePressed(const MouseEvent& aEvent) throw( UNO3_RUNTIMEEXCEPTION )
{
MULTIPLEX( XMouseListener, mousePressed, MouseEvent, aEvent )
}
//____________________________________________________________________________________________________________
// XMouseListener
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::mouseReleased(const MouseEvent& aEvent) throw( UNO3_RUNTIMEEXCEPTION )
{
MULTIPLEX( XMouseListener, mouseReleased, MouseEvent, aEvent )
}
//____________________________________________________________________________________________________________
// XMouseListener
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::mouseEntered(const MouseEvent& aEvent) throw( UNO3_RUNTIMEEXCEPTION )
{
MULTIPLEX( XMouseListener, mouseEntered, MouseEvent, aEvent )
}
//____________________________________________________________________________________________________________
// XMouseListener
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::mouseExited(const MouseEvent& aEvent) throw( UNO3_RUNTIMEEXCEPTION )
{
MULTIPLEX( XMouseListener, mouseExited, MouseEvent, aEvent )
}
//____________________________________________________________________________________________________________
// XMouseMotionListener
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::mouseDragged(const MouseEvent& aEvent) throw( UNO3_RUNTIMEEXCEPTION )
{
MULTIPLEX( XMouseMotionListener, mouseDragged, MouseEvent, aEvent )
}
//____________________________________________________________________________________________________________
// XMouseMotionListener
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::mouseMoved(const MouseEvent& aEvent) throw( UNO3_RUNTIMEEXCEPTION )
{
MULTIPLEX( XMouseMotionListener, mouseMoved, MouseEvent, aEvent )
}
//____________________________________________________________________________________________________________
// XPaintListener
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::windowPaint(const PaintEvent& aEvent) throw( UNO3_RUNTIMEEXCEPTION )
{
MULTIPLEX( XPaintListener, windowPaint, PaintEvent, aEvent )
}
//____________________________________________________________________________________________________________
// XTopWindowListener
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::windowOpened(const EventObject& aEvent) throw( UNO3_RUNTIMEEXCEPTION )
{
MULTIPLEX( XTopWindowListener, windowOpened, EventObject, aEvent )
}
//____________________________________________________________________________________________________________
// XTopWindowListener
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::windowClosing( const EventObject& aEvent ) throw( UNO3_RUNTIMEEXCEPTION )
{
MULTIPLEX( XTopWindowListener, windowClosing, EventObject, aEvent )
}
//____________________________________________________________________________________________________________
// XTopWindowListener
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::windowClosed( const EventObject& aEvent ) throw( UNO3_RUNTIMEEXCEPTION )
{
MULTIPLEX( XTopWindowListener, windowClosed, EventObject, aEvent )
}
//____________________________________________________________________________________________________________
// XTopWindowListener
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::windowMinimized( const EventObject& aEvent ) throw( UNO3_RUNTIMEEXCEPTION )
{
MULTIPLEX( XTopWindowListener, windowMinimized, EventObject, aEvent )
}
//____________________________________________________________________________________________________________
// XTopWindowListener
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::windowNormalized( const EventObject& aEvent ) throw( UNO3_RUNTIMEEXCEPTION )
{
MULTIPLEX( XTopWindowListener, windowNormalized, EventObject, aEvent )
}
//____________________________________________________________________________________________________________
// XTopWindowListener
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::windowActivated( const EventObject& aEvent ) throw( UNO3_RUNTIMEEXCEPTION )
{
MULTIPLEX( XTopWindowListener, windowActivated, EventObject, aEvent )
}
//____________________________________________________________________________________________________________
// XTopWindowListener
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::windowDeactivated( const EventObject& aEvent ) throw( UNO3_RUNTIMEEXCEPTION )
{
MULTIPLEX( XTopWindowListener, windowDeactivated, EventObject, aEvent )
}
//____________________________________________________________________________________________________________
// protected method
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::impl_adviseToPeer( const Reference< XWindow >& xPeer ,
const Type& aType )
{
// add a listener to the source (peer)
if( aType == ::getCppuType((const Reference< XWindowListener >*)0) )
xPeer->addWindowListener( this );
else if( aType == ::getCppuType((const Reference< XKeyListener >*)0) )
xPeer->addKeyListener( this );
else if( aType == ::getCppuType((const Reference< XFocusListener >*)0) )
xPeer->addFocusListener( this );
else if( aType == ::getCppuType((const Reference< XMouseListener >*)0) )
xPeer->addMouseListener( this );
else if( aType == ::getCppuType((const Reference< XMouseMotionListener >*)0) )
xPeer->addMouseMotionListener( this );
else if( aType == ::getCppuType((const Reference< XPaintListener >*)0) )
xPeer->addPaintListener( this );
else if( aType == ::getCppuType((const Reference< XTopWindowListener >*)0) )
{
Reference< XTopWindow > xTop( xPeer, UNO_QUERY );
if( xTop.is() )
xTop->addTopWindowListener( this );
}
else
{
VOS_ENSHURE( sal_False, "unknown listener" );
}
}
//____________________________________________________________________________________________________________
// protected method
//____________________________________________________________________________________________________________
void OMRCListenerMultiplexerHelper::impl_unadviseFromPeer( const Reference< XWindow >& xPeer ,
const Type& aType )
{
// the last listener is removed, remove the listener from the source (peer)
if( aType == ::getCppuType((const Reference< XWindowListener >*)0) )
xPeer->removeWindowListener( this );
else if( aType == ::getCppuType((const Reference< XKeyListener >*)0) )
xPeer->removeKeyListener( this );
else if( aType == ::getCppuType((const Reference< XFocusListener >*)0) )
xPeer->removeFocusListener( this );
else if( aType == ::getCppuType((const Reference< XMouseListener >*)0) )
xPeer->removeMouseListener( this );
else if( aType == ::getCppuType((const Reference< XMouseMotionListener >*)0) )
xPeer->removeMouseMotionListener( this );
else if( aType == ::getCppuType((const Reference< XPaintListener >*)0) )
xPeer->removePaintListener( this );
else if( aType == ::getCppuType((const Reference< XTopWindowListener >*)0) )
{
Reference< XTopWindow > xTop( xPeer, UNO_QUERY );
if( xTop.is() )
xTop->removeTopWindowListener( this );
}
else
{
VOS_ENSHURE( sal_False, "unknown listener" );
}
}
} // namespace unocontrols
@@ -0,0 +1,393 @@
/*************************************************************************
*
* $RCSfile: registercontrols.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning 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 other projects
//______________________________________________________________________________________________________________
#ifndef _CPPUHELPER_FACTORY_HXX_
#include <cppuhelper/factory.hxx>
#endif
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_
#include <com/sun/star/registry/XRegistryKey.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XSET_HPP_
#include <com/sun/star/container/XSet.hpp>
#endif
#include <stdio.h>
//______________________________________________________________________________________________________________
// includes of my own project
//______________________________________________________________________________________________________________
//=============================================================================
// Add new include line to use new services.
//=============================================================================
#ifndef _UNOCONTROLS_FRAMECONTROL_CTRL_HXX
#include "framecontrol.hxx"
#endif
#ifndef _UNOCONTROLS_PROGRESSBAR_CTRL_HXX
#include "progressbar.hxx"
#endif
#ifndef _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX
#include "progressmonitor.hxx"
#endif
//=============================================================================
//______________________________________________________________________________________________________________
// defines
//______________________________________________________________________________________________________________
// If you will debug macros of this file ... you must define follow constant!
// Ths switch on another macro AS_DBG_OUT(...), which will print text to "stdout".
//#define AS_DBG_SWITCH
//______________________________________________________________________________________________________________
// namespaces
//______________________________________________________________________________________________________________
using namespace ::rtl ;
using namespace ::cppu ;
using namespace ::unocontrols ;
using namespace ::com::sun::star::uno ;
using namespace ::com::sun::star::container ;
using namespace ::com::sun::star::lang ;
using namespace ::com::sun::star::registry ;
//______________________________________________________________________________________________________________
// macros
//______________________________________________________________________________________________________________
//******************************************************************************************************************************
// See AS_DBG_SWITCH below !!!
#ifdef AS_DBG_SWITCH
#define AS_DBG_OUT(OUTPUT) printf( OUTPUT );
#else
#define AS_DBG_OUT(OUTPUT)
#endif
//******************************************************************************************************************************
#define CREATEINSTANCE(CLASS) \
\
static Reference< XInterface > SAL_CALL CLASS##_createInstance ( const Reference< XMultiServiceFactory >& rServiceManager ) throw ( Exception ) \
{ \
AS_DBG_OUT ( "\tCREATEINSTANCE():\tOK\n" ) \
return Reference< XInterface >( *(OWeakObject*)(new CLASS##( rServiceManager )) ); \
}
//******************************************************************************************************************************
#define COMPONENT_INFO(CLASS) \
\
AS_DBG_OUT ( "\tCOMPONENT_INFO():\t[start]\n" ) \
try \
{ \
/* Set default result of follow operations !!! */ \
bReturn = sal_False ; \
\
/* Do the follow only, if given key is valid ! */ \
if ( xKey.is () ) \
{ \
AS_DBG_OUT ( "\tCOMPONENT_INFO():\t\txkey is valid ...\n" ) \
/* Build new keyname */ \
sKeyName = OUString::createFromAscii( "/" ) ; \
sKeyName += CLASS##::impl_getStaticImplementationName() ; \
sKeyName += OUString::createFromAscii( "/UNO/SERVICES" ); \
\
/* Create new key with new name. */ \
xNewKey = xKey->createKey( sKeyName ); \
\
/* If this new key valid ... */ \
if ( xNewKey.is () ) \
{ \
AS_DBG_OUT ( "\tCOMPONENT_INFO():\t\txNewkey is valid ...\n" ) \
/* Get information about supported services. */ \
seqServiceNames = CLASS##::impl_getStaticSupportedServiceNames() ; \
pArray = seqServiceNames.getArray() ; \
nLength = seqServiceNames.getLength() ; \
nCounter = 0 ; \
\
AS_DBG_OUT ( "\tCOMPONENT_INFO():\t\tloop ..." ) \
/* Then set this information on this key. */ \
for ( nCounter = 0; nCounter < nLength; ++nCounter ) \
{ \
xNewKey->createKey( pArray [nCounter] ); \
} \
AS_DBG_OUT ( " OK\n" ) \
\
/* Result of this operations = OK. */ \
bReturn = sal_True ; \
} \
AS_DBG_OUT ( "\tCOMPONENT_INFO():\t\t... leave xNewKey\n" ) \
} \
AS_DBG_OUT ( "\tCOMPONENT_INFO():\t\t... leave xKey\n" ) \
} \
catch( InvalidRegistryException& ) \
{ \
AS_DBG_OUT ( "\tCOMPONENT_INFO():\t\tInvalidRegistryException detected!!!\n" ) \
bReturn = sal_False ; \
} \
AS_DBG_OUT ( "\tCOMPONENT_INFO():\t[end]\n" )
//******************************************************************************************************************************
#define CREATEFACTORY_ONEINSTANCE(CLASS) \
\
AS_DBG_OUT ( "\tCREATEFACTORY_ONEINSTANCE():\t[start]\n" ) \
/* Create right factory ... */ \
xFactory = Reference< XSingleServiceFactory > \
( \
cppu::createOneInstanceFactory ( xServiceManager , \
CLASS##::impl_getStaticImplementationName () , \
CLASS##_createInstance , \
CLASS##::impl_getStaticSupportedServiceNames () ) \
) ; \
AS_DBG_OUT ( "\tCREATEFACTORY_ONEINSTANCE():\t[end]\n" )
//******************************************************************************************************************************
#define CREATEFACTORY_SINGLE(CLASS) \
\
AS_DBG_OUT ( "\tCREATEFACTORY_SINGLE():\t[start]\n" ) \
/* Create right factory ... */ \
xFactory = Reference< XSingleServiceFactory > \
( \
cppu::createSingleFactory ( xServiceManager , \
CLASS##::impl_getStaticImplementationName () , \
CLASS##_createInstance , \
CLASS##::impl_getStaticSupportedServiceNames () ) \
) ; \
AS_DBG_OUT ( "\tCREATEFACTORY_SINGLE():\t[end]\n" )
//******************************************************************************************************************************
#ifdef MACOSX
#define IF_NAME_CREATECOMPONENTFACTORY_ONEINSTANCE(CLASS) \
\
if ( CLASS##::impl_getStaticImplementationName().equals( OUString::createFromAscii( pImplementationName ) ) ) \
{ \
AS_DBG_OUT ( "\tIF_NAME_CREATECOMPONENTFACTORY_ONEINSTANCE():\timplementationname found\n" ) \
CREATEFACTORY_ONEINSTANCE ( CLASS ) \
}
#else /* MACOSX */
#define IF_NAME_CREATECOMPONENTFACTORY_ONEINSTANCE(CLASS) \
\
if ( CLASS##::impl_getStaticImplementationName().equals( OUString::createFromAscii( pImplementationName ) ) ) \
{ \
AS_DBG_OUT ( "\tIF_NAME_CREATECOMPONENTFACTORY_ONEINSTANCE():\timplementationname found\n" ) \
CREATEFACTORY_ONEINSTANCE ( CLASS## ) \
}
#endif /* MACOSX */
//******************************************************************************************************************************
#ifdef MACOSX
#define IF_NAME_CREATECOMPONENTFACTORY_SINGLE(CLASS) \
\
if ( CLASS##::impl_getStaticImplementationName().equals( OUString::createFromAscii( pImplementationName ) ) ) \
{ \
AS_DBG_OUT ( "\tIF_NAME_CREATECOMPONENTFACTORY_SINGLE():\timplementationname found\n" ) \
CREATEFACTORY_SINGLE ( CLASS ) \
}
#else /* MACOSX */
#define IF_NAME_CREATECOMPONENTFACTORY_SINGLE(CLASS) \
\
if ( CLASS##::impl_getStaticImplementationName().equals( OUString::createFromAscii( pImplementationName ) ) ) \
{ \
AS_DBG_OUT ( "\tIF_NAME_CREATECOMPONENTFACTORY_SINGLE():\timplementationname found\n" ) \
CREATEFACTORY_SINGLE ( CLASS## ) \
}
#endif /* MACOSX */
//______________________________________________________________________________________________________________
// declare functions to create a new instance of service
//______________________________________________________________________________________________________________
//=============================================================================
// Add new macro line to use new services.
//
// !!! ATTENTION !!!
// Write no ";" at end of line! (see macro)
//=============================================================================
CREATEINSTANCE ( FrameControl )
CREATEINSTANCE ( ProgressBar )
CREATEINSTANCE ( ProgressMonitor )
//=============================================================================
//______________________________________________________________________________________________________________
// return environment
//______________________________________________________________________________________________________________
extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvironmentTypeName ,
uno_Environment** ppEnvironment )
{
*ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ;
}
//______________________________________________________________________________________________________________
// write component info to registry
//______________________________________________________________________________________________________________
extern "C" sal_Bool SAL_CALL component_writeInfo( void* pServiceManager ,
void* pRegistryKey )
{
AS_DBG_OUT ( "component_writeInfo():\t[start]\n" )
// Set default return value for this operation - if it failed.
sal_Bool bReturn = sal_False ;
if ( pRegistryKey != NULL )
{
AS_DBG_OUT ( "component_writeInfo():\t\tpRegistryKey is valid ... enter scope\n" )
// Define variables for following macros!
// bReturn is set automaticly.
Reference< XRegistryKey > xKey( reinterpret_cast< XRegistryKey* >( pRegistryKey ) ) ;
Reference< XRegistryKey > xNewKey ;
Sequence< OUString > seqServiceNames ;
const OUString* pArray ;
sal_Int32 nLength ;
sal_Int32 nCounter ;
OUString sKeyName ;
//=============================================================================
// Add new macro line to register new services.
//
// !!! ATTENTION !!!
// Write no ";" at end of line! (see macro)
//=============================================================================
COMPONENT_INFO ( FrameControl )
COMPONENT_INFO ( ProgressBar )
COMPONENT_INFO ( ProgressMonitor )
//=============================================================================
AS_DBG_OUT ( "component_writeInfo():\t\t... leave pRegistryKey scope\n" )
}
AS_DBG_OUT ( "component_writeInfo():\t[end]\n" )
// Return with result of this operation.
return bReturn ;
}
//______________________________________________________________________________________________________________
// create right component factory
//______________________________________________________________________________________________________________
extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplementationName ,
void* pServiceManager ,
void* pRegistryKey )
{
AS_DBG_OUT( "component_getFactory():\t[start]\n" )
// Set default return value for this operation - if it failed.
void* pReturn = NULL ;
if (
( pImplementationName != NULL ) &&
( pServiceManager != NULL )
)
{
AS_DBG_OUT( "component_getFactory():\t\t... enter scope - pointer are valid\n" )
// Define variables which are used in following macros.
Reference< XSingleServiceFactory > xFactory ;
Reference< XMultiServiceFactory > xServiceManager( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
//=============================================================================
// Add new macro line to handle new service.
//
// !!! ATTENTION !!!
// Write no ";" at end of line and dont forget "else" ! (see macro)
//=============================================================================
IF_NAME_CREATECOMPONENTFACTORY_SINGLE( FrameControl )
else
IF_NAME_CREATECOMPONENTFACTORY_SINGLE( ProgressBar )
else
IF_NAME_CREATECOMPONENTFACTORY_SINGLE( ProgressMonitor )
//=============================================================================
// Factory is valid - service was found.
if ( xFactory.is() )
{
AS_DBG_OUT( "component_getFactory():\t\t\t... xFactory valid - service was found\n" )
xFactory->acquire();
pReturn = xFactory.get();
}
AS_DBG_OUT( "component_getFactory():\t\t... leave scope\n" )
}
AS_DBG_OUT ( "component_getFactory():\t[end]\n" )
// Return with result of this operation.
return pReturn ;
}
@@ -0,0 +1,226 @@
/*************************************************************************
*
* $RCSfile: OConnectionPointContainerHelper.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning 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 include
//______________________________________________________________________________________________________________
#ifndef _OCONNECTIONPOINTCONTAINERHELPER_HXX
#include "OConnectionPointContainerHelper.hxx"
#endif
//______________________________________________________________________________________________________________
// includes of other projects
//______________________________________________________________________________________________________________
//______________________________________________________________________________________________________________
// include of my own project
//______________________________________________________________________________________________________________
#ifndef _OCONNECTIONPOINTHELPER_HXX
#include "OConnectionPointHelper.hxx"
#endif
//______________________________________________________________________________________________________________
// namespaces
//______________________________________________________________________________________________________________
using namespace ::rtl ;
using namespace ::osl ;
using namespace ::cppu ;
using namespace ::com::sun::star::uno ;
using namespace ::com::sun::star::lang ;
namespace unocontrols{
//______________________________________________________________________________________________________________
// construct/destruct
//______________________________________________________________________________________________________________
OConnectionPointContainerHelper::OConnectionPointContainerHelper( Mutex& aMutex )
: m_aSharedMutex ( aMutex )
, m_aMultiTypeContainer ( aMutex )
{
}
OConnectionPointContainerHelper::~OConnectionPointContainerHelper()
{
}
//____________________________________________________________________________________________________________
// XInterface
//____________________________________________________________________________________________________________
Any SAL_CALL OConnectionPointContainerHelper::queryInterface( const Type& aType ) throw( RuntimeException )
{
// Attention:
// Don't use mutex or guard in this method!!! Is a method of XInterface.
// Ask for my own supported interfaces ...
Any aReturn ( ::cppu::queryInterface( aType ,
static_cast< XConnectionPointContainer* > ( this )
)
);
// If searched interface not supported by this class ...
if ( aReturn.hasValue() == sal_False )
{
// ... ask baseclasses.
aReturn = OWeakObject::queryInterface( aType );
}
return aReturn ;
}
//____________________________________________________________________________________________________________
// XInterface
//____________________________________________________________________________________________________________
void SAL_CALL OConnectionPointContainerHelper::acquire() throw( RuntimeException )
{
// Attention:
// Don't use mutex or guard in this method!!! Is a method of XInterface.
// Forward to baseclass
OWeakObject::acquire();
}
//____________________________________________________________________________________________________________
// XInterface
//____________________________________________________________________________________________________________
void SAL_CALL OConnectionPointContainerHelper::release() throw( RuntimeException )
{
// Attention:
// Don't use mutex or guard in this method!!! Is a method of XInterface.
// Forward to baseclass
OWeakObject::release();
}
//______________________________________________________________________________________________________________
// XConnectionPointContainer
//______________________________________________________________________________________________________________
Sequence< Type > SAL_CALL OConnectionPointContainerHelper::getConnectionPointTypes() throw( RuntimeException )
{
// Container is threadsafe himself !
return m_aMultiTypeContainer.getContainedTypes();
}
//______________________________________________________________________________________________________________
// XConnectionPointContainer
//______________________________________________________________________________________________________________
Reference< XConnectionPoint > SAL_CALL OConnectionPointContainerHelper::queryConnectionPoint( const Type& aType ) throw( RuntimeException )
{
// Set default return value, if method failed.
Reference< XConnectionPoint > xConnectionPoint = Reference< XConnectionPoint >();
// Get all elements of the container, which have the searched type.
OInterfaceContainerHelper* pSpecialContainer = m_aMultiTypeContainer.getContainer( aType );
if ( pSpecialContainer->getLength() > 0 )
{
// Ready for multithreading
MutexGuard aGuard( m_aSharedMutex );
// If this container contains elements, build a connectionpoint-instance.
OConnectionPointHelper* pNewConnectionPoint = new OConnectionPointHelper( m_aSharedMutex, this, aType );
xConnectionPoint = Reference< XConnectionPoint >( (OWeakObject*)pNewConnectionPoint, UNO_QUERY );
}
return xConnectionPoint ;
}
//______________________________________________________________________________________________________________
// XConnectionPointContainer
//______________________________________________________________________________________________________________
void SAL_CALL OConnectionPointContainerHelper::advise( const Type& aType ,
const Reference< XInterface >& xListener ) throw( RuntimeException )
{
// Container is threadsafe himself !
m_aMultiTypeContainer.addInterface( aType, xListener );
}
//______________________________________________________________________________________________________________
// XConnectionPointContainer
//______________________________________________________________________________________________________________
void SAL_CALL OConnectionPointContainerHelper::unadvise( const Type& aType ,
const Reference< XInterface >& xListener ) throw( RuntimeException )
{
// Container is threadsafe himself !
m_aMultiTypeContainer.removeInterface( aType, xListener );
}
//______________________________________________________________________________________________________________
// public but impl method!
// Is neccessary to get container member at OConnectionPoint-instance.
//______________________________________________________________________________________________________________
OMultiTypeInterfaceContainerHelper& OConnectionPointContainerHelper::impl_getMultiTypeContainer()
{
// Impl methods are not threadsafe!
// "Parent" function must do this.
return m_aMultiTypeContainer;
}
} // namespace unocontrols
@@ -0,0 +1,310 @@
/*************************************************************************
*
* $RCSfile: OConnectionPointHelper.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning 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 include
//______________________________________________________________________________________________________________
#ifndef _OCONNECTIONPOINTHELPER_HXX
#include "OConnectionPointHelper.hxx"
#endif
//______________________________________________________________________________________________________________
// includes of other projects
//______________________________________________________________________________________________________________
//______________________________________________________________________________________________________________
// include of my own project
//______________________________________________________________________________________________________________
#ifndef _OCONNECTIONPOINTCONTAINERHELPER_HXX
#include "OConnectionPointContainerHelper.hxx"
#endif
//______________________________________________________________________________________________________________
// namespaces
//______________________________________________________________________________________________________________
using namespace ::rtl ;
using namespace ::osl ;
using namespace ::cppu ;
using namespace ::com::sun::star::uno ;
using namespace ::com::sun::star::lang ;
namespace unocontrols{
//______________________________________________________________________________________________________________
// construct/destruct
//______________________________________________________________________________________________________________
OConnectionPointHelper::OConnectionPointHelper( Mutex& aMutex ,
OConnectionPointContainerHelper* pContainerImplementation ,
UNO3_TYPE aType )
: m_aSharedMutex ( aMutex )
, m_oContainerWeakReference ( pContainerImplementation )
, m_pContainerImplementation ( pContainerImplementation )
, m_aInterfaceType ( aType )
{
}
OConnectionPointHelper::~OConnectionPointHelper()
{
}
//____________________________________________________________________________________________________________
// XInterface
//____________________________________________________________________________________________________________
Any SAL_CALL OConnectionPointHelper::queryInterface( const Type& aType ) throw( RuntimeException )
{
// Attention:
// Don't use mutex or guard in this method!!! Is a method of XInterface.
// Ask for my own supported interfaces ...
Any aReturn ( ::cppu::queryInterface( aType ,
static_cast< XConnectionPoint* > ( this )
)
);
// If searched interface not supported by this class ...
if ( aReturn.hasValue() == sal_False )
{
// ... ask baseclasses.
aReturn = OWeakObject::queryInterface( aType );
}
return aReturn ;
}
//____________________________________________________________________________________________________________
// XInterface
//____________________________________________________________________________________________________________
void SAL_CALL OConnectionPointHelper::acquire() throw( RuntimeException )
{
// Attention:
// Don't use mutex or guard in this method!!! Is a method of XInterface.
// Forward to baseclass
OWeakObject::acquire();
}
//____________________________________________________________________________________________________________
// XInterface
//____________________________________________________________________________________________________________
void SAL_CALL OConnectionPointHelper::release() throw( RuntimeException )
{
// Attention:
// Don't use mutex or guard in this method!!! Is a method of XInterface.
// Forward to baseclass
OWeakObject::release();
}
//______________________________________________________________________________________________________________
// XConnectionPoint
//______________________________________________________________________________________________________________
Type SAL_CALL OConnectionPointHelper::getConnectionType() throw( RuntimeException )
{
// Ready for multithreading
MutexGuard aGuard( m_aSharedMutex );
// Set default return value, if method failed.
if ( impl_LockContainer() == sal_False )
{
// Container not exist! Its an runtime error.
throw RuntimeException();
}
// If container reference valid, return right type of supported interfaces of THIS connectionpoint.
Type aReturnType = m_aInterfaceType ;
// Don't forget this!
impl_UnlockContainer();
return aReturnType;
}
//______________________________________________________________________________________________________________
// XConnectionPoint
//______________________________________________________________________________________________________________
Reference< XConnectionPointContainer > SAL_CALL OConnectionPointHelper::getConnectionPointContainer() throw( RuntimeException )
{
// Ready for multithreading
MutexGuard aGuard( m_aSharedMutex );
// Convert weakreference to correct uno3-reference and return value. It can be NULL, if container destroyed!
return Reference< XConnectionPointContainer >( m_oContainerWeakReference.get(), UNO_QUERY );
}
//______________________________________________________________________________________________________________
// XConnectionPoint
//______________________________________________________________________________________________________________
void SAL_CALL OConnectionPointHelper::advise( const Reference< XInterface >& xListener ) throw( ListenerExistException ,
InvalidListenerException ,
RuntimeException )
{
// Ready for multithreading
MutexGuard aGuard( m_aSharedMutex );
// If type of listener not the same for this special container ...
Any aCheckType = xListener->queryInterface( m_aInterfaceType );
if ( aCheckType.hasValue() )
{
// ... throw an exception.
throw InvalidListenerException();
}
// ListenerExistException is obsolete!?
// Its the same container for XConnectionPointContainer and XConnectionPoint. But only here we must control, if a listener already exist!?
// You can add a listener more then one time at XConnectionPointContainer, but here only one ...
// Operation is permitted only, if reference to container is valid!
if ( impl_LockContainer() == sal_False )
{
// Container not exist! Its an runtime error.
throw RuntimeException();
}
// Forward it to OConnectionPointHelperContainer!
m_pContainerImplementation->advise( m_aInterfaceType, xListener );
// Don't forget this!
impl_UnlockContainer();
}
//______________________________________________________________________________________________________________
// XConnectionPoint
//______________________________________________________________________________________________________________
void SAL_CALL OConnectionPointHelper::unadvise( const Reference< XInterface >& xListener ) throw( RuntimeException )
{
// Ready for multithreading
MutexGuard aGuard( m_aSharedMutex );
// Operation is permitted only, if reference to container is valid!
if ( impl_LockContainer() == sal_False )
{
// Container not exist! Its an runtime error.
throw RuntimeException();
}
// Forward it to OConnectionPointHelperContainer!
m_pContainerImplementation->unadvise( m_aInterfaceType, xListener );
// Don't forget this!
impl_UnlockContainer();
}
//______________________________________________________________________________________________________________
// XConnectionPoint
//______________________________________________________________________________________________________________
Sequence< Reference< XInterface > > SAL_CALL OConnectionPointHelper::getConnections() throw( RuntimeException )
{
// Ready for multithreading
MutexGuard aGuard( m_aSharedMutex );
// Operation is permitted only, if reference to container is valid!
if ( impl_LockContainer() == sal_False )
{
// Container not exist! Its an runtime error.
throw RuntimeException();
}
// Set default return value, if method failed.
Sequence< Reference< XInterface > > seqReturnConnections = Sequence< Reference< XInterface > >();
// Get reference to private member of OConnectionPointHelperContainer!
OMultiTypeInterfaceContainerHelper& aSharedContainer = m_pContainerImplementation->impl_getMultiTypeContainer();
// Get pointer to specialized container which hold all interfaces of searched type.
OInterfaceContainerHelper* pSpecialContainer = aSharedContainer.getContainer( m_aInterfaceType );
// Get elements of searched type, if somelse exist.
if ( pSpecialContainer != NULL )
{
seqReturnConnections = pSpecialContainer->getElements();
}
// Don't forget this!
impl_UnlockContainer();
return seqReturnConnections;
}
//______________________________________________________________________________________________________________
// private method
//______________________________________________________________________________________________________________
sal_Bool OConnectionPointHelper::impl_LockContainer()
{
// Convert weakreference to hard uno3-reference and return state.
// If this reference different from NULL, there exist a hard reference to container. Container-instance can't be destroyed.
// Don't forget to "unlock" this reference!
m_xLock = m_oContainerWeakReference.get();
return m_xLock.is();
}
//______________________________________________________________________________________________________________
// private method
//______________________________________________________________________________________________________________
void OConnectionPointHelper::impl_UnlockContainer()
{
// Free hard uno3-reference to container.
// see also "impl_LockContainer()"
m_xLock = Reference< XInterface >();
}
} // namespace unocontrols
@@ -0,0 +1,663 @@
/*************************************************************************
*
* $RCSfile: framecontrol.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning 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 include
//______________________________________________________________________________________________________________
#ifndef _UNOCONTROLS_FRAMECONTROL_CTRL_HXX
#include "framecontrol.hxx"
#endif
//______________________________________________________________________________________________________________
// includes of other projects
//______________________________________________________________________________________________________________
#ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDER_HPP_
#include <com/sun/star/frame/XDispatchProvider.hpp>
#endif
#ifndef _COM_SUN_STAR_UTIL_XURLTRANSFORMER_HPP_
#include <com/sun/star/util/XURLTransformer.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_XDISPATCH_HPP_
#include <com/sun/star/frame/XDispatch.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HPP_
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HPP_
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
#include <com/sun/star/beans/PropertyAttribute.hpp>
#endif
#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
#include <cppuhelper/typeprovider.hxx>
#endif
#ifndef _VOS_DIAGNOSE_H_
#include <vos/diagnose.hxx>
#endif
//______________________________________________________________________________________________________________
// include of my own project
//______________________________________________________________________________________________________________
//______________________________________________________________________________________________________________
// namespaces
//______________________________________________________________________________________________________________
using namespace ::rtl ;
using namespace ::osl ;
using namespace ::cppu ;
using namespace ::com::sun::star::uno ;
using namespace ::com::sun::star::lang ;
using namespace ::com::sun::star::beans ;
using namespace ::com::sun::star::awt ;
using namespace ::com::sun::star::frame ;
using namespace ::com::sun::star::util ;
namespace unocontrols{
//______________________________________________________________________________________________________________
// construct/destruct
//______________________________________________________________________________________________________________
FrameControl::FrameControl( const Reference< XMultiServiceFactory >& xFactory )
: BaseControl ( xFactory )
, OBroadcastHelper ( m_aMutex )
, OPropertySetHelper ( *SAL_STATIC_CAST( OBroadcastHelperVar< OMultiTypeInterfaceContainerHelper >*, this ) )
, m_aInterfaceContainer ( m_aMutex )
, m_aConnectionPointContainer ( m_aMutex )
{
}
FrameControl::~FrameControl()
{
}
//____________________________________________________________________________________________________________
// XInterface
//____________________________________________________________________________________________________________
Any SAL_CALL FrameControl::queryInterface( const Type& rType ) throw( RuntimeException )
{
// Attention:
// Don't use mutex or guard in this method!!! Is a method of XInterface.
Any aReturn ;
Reference< XInterface > xDelegator = BaseControl::impl_getDelegator();
if ( xDelegator.is() == sal_True )
{
// If an delegator exist, forward question to his queryInterface.
// Delegator will ask his own queryAggregation!
aReturn = xDelegator->queryInterface( rType );
}
else
{
// If an delegator unknown, forward question to own queryAggregation.
aReturn = queryAggregation( rType );
}
return aReturn ;
}
//____________________________________________________________________________________________________________
// XInterface
//____________________________________________________________________________________________________________
void SAL_CALL FrameControl::acquire() throw( RuntimeException )
{
// Attention:
// Don't use mutex or guard in this method!!! Is a method of XInterface.
// Forward to baseclass
BaseControl::acquire();
}
//____________________________________________________________________________________________________________
// XInterface
//____________________________________________________________________________________________________________
void SAL_CALL FrameControl::release() throw( RuntimeException )
{
// Attention:
// Don't use mutex or guard in this method!!! Is a method of XInterface.
// Forward to baseclass
BaseControl::release();
}
//____________________________________________________________________________________________________________
// XTypeProvider
//____________________________________________________________________________________________________________
Sequence< Type > SAL_CALL FrameControl::getTypes() throw( 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 OTypeCollection* pTypeCollection = NULL ;
if ( pTypeCollection == NULL )
{
// Ready for multithreading; get global mutex for first call of this method only! see before
MutexGuard aGuard( 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 OTypeCollection aTypeCollection ( ::getCppuType(( const Reference< XControlModel >*)NULL ) ,
::getCppuType(( const Reference< XControlContainer >*)NULL ) ,
::getCppuType(( const Reference< XConnectionPointContainer >*)NULL ) ,
BaseControl::getTypes()
);
// ... and set his address to static pointer!
pTypeCollection = &aTypeCollection ;
}
}
return pTypeCollection->getTypes();
}
//____________________________________________________________________________________________________________
// XAggregation
//____________________________________________________________________________________________________________
Any SAL_CALL FrameControl::queryAggregation( const Type& aType ) throw( RuntimeException )
{
// Ask for my own supported interfaces ...
// Attention: XTypeProvider and XInterface are supported by OComponentHelper!
Any aReturn ( ::cppu::queryInterface( aType ,
static_cast< XControlModel* > ( this ) ,
static_cast< XConnectionPointContainer* > ( this )
)
);
// If searched interface not supported by this class ...
if ( aReturn.hasValue() == sal_False )
{
// ... ask baseclasses.
aReturn = OPropertySetHelper::queryInterface( aType );
if ( aReturn.hasValue() == sal_False )
{
aReturn = BaseControl::queryAggregation( aType );
}
}
return aReturn ;
}
//____________________________________________________________________________________________________________
// XControl
//____________________________________________________________________________________________________________
void SAL_CALL FrameControl::createPeer( const Reference< XToolkit >& xToolkit ,
const Reference< XWindowPeer >& xParentPeer ) throw( RuntimeException )
{
BaseControl::createPeer( xToolkit, xParentPeer );
if ( impl_getPeerWindow().is() )
{
if( m_sComponentURL.getLength() > 0 )
{
impl_createFrame( getPeer(), m_sComponentURL, m_seqLoaderArguments );
}
}
}
//____________________________________________________________________________________________________________
// XControl
//____________________________________________________________________________________________________________
sal_Bool SAL_CALL FrameControl::setModel( const Reference< XControlModel >& xModel ) throw( RuntimeException )
{
// We have no model.
return sal_False ;
}
//____________________________________________________________________________________________________________
// XControl
//____________________________________________________________________________________________________________
Reference< XControlModel > SAL_CALL FrameControl::getModel() throw( RuntimeException )
{
// We have no model.
return Reference< XControlModel >();
}
//____________________________________________________________________________________________________________
// XControl
//____________________________________________________________________________________________________________
void SAL_CALL FrameControl::dispose() throw( RuntimeException )
{
impl_deleteFrame();
BaseControl::dispose();
}
//____________________________________________________________________________________________________________
// XView
//____________________________________________________________________________________________________________
sal_Bool SAL_CALL FrameControl::setGraphics( const Reference< XGraphics >& xDevice ) throw( RuntimeException )
{
// it is not possible to print this control
return sal_False ;
}
//____________________________________________________________________________________________________________
// XView
//____________________________________________________________________________________________________________
Reference< XGraphics > SAL_CALL FrameControl::getGraphics() throw( RuntimeException )
{
// when its not posible to set graphics ! then its possible to return null
return Reference< XGraphics >();
}
//____________________________________________________________________________________________________________
// XConnectionPointContainer
//____________________________________________________________________________________________________________
Sequence< Type > SAL_CALL FrameControl::getConnectionPointTypes() throw( RuntimeException )
{
// Forwarded to helper class
return m_aConnectionPointContainer.getConnectionPointTypes();
}
//____________________________________________________________________________________________________________
// XConnectionPointContainer
//____________________________________________________________________________________________________________
Reference< XConnectionPoint > SAL_CALL FrameControl::queryConnectionPoint( const Type& aType ) throw( RuntimeException )
{
// Forwarded to helper class
return m_aConnectionPointContainer.queryConnectionPoint( aType );
}
//____________________________________________________________________________________________________________
// XConnectionPointContainer
//____________________________________________________________________________________________________________
void SAL_CALL FrameControl::advise( const Type& aType ,
const Reference< XInterface >& xListener ) throw( RuntimeException )
{
// Forwarded to helper class
m_aConnectionPointContainer.advise( aType, xListener );
}
//____________________________________________________________________________________________________________
// XConnectionPointContainer
//____________________________________________________________________________________________________________
void SAL_CALL FrameControl::unadvise( const Type& aType ,
const Reference< XInterface >& xListener ) throw( RuntimeException )
{
// Forwarded to helper class
m_aConnectionPointContainer.unadvise( aType, xListener );
}
//____________________________________________________________________________________________________________
// impl but public method to register service
//____________________________________________________________________________________________________________
const Sequence< OUString > FrameControl::impl_getStaticSupportedServiceNames()
{
MutexGuard aGuard( Mutex::getGlobalMutex() );
Sequence< OUString > seqServiceNames( 1 );
seqServiceNames.getArray() [0] = OUString::createFromAscii( SERVICENAME_FRAMECONTROL );
return seqServiceNames ;
}
//____________________________________________________________________________________________________________
// impl but public method to register service
//____________________________________________________________________________________________________________
const OUString FrameControl::impl_getStaticImplementationName()
{
return OUString::createFromAscii( IMPLEMENTATIONNAME_FRAMECONTROL );
}
//____________________________________________________________________________________________________________
// OPropertySetHelper
//____________________________________________________________________________________________________________
sal_Bool FrameControl::convertFastPropertyValue( Any& rConvertedValue ,
Any& rOldValue ,
sal_Int32 nHandle ,
const Any& rValue ) throw( IllegalArgumentException )
{
sal_Bool bReturn = sal_False ;
switch (nHandle)
{
case PROPERTYHANDLE_COMPONENTURL : rConvertedValue = rValue ;
rOldValue <<= m_sComponentURL ;
bReturn = sal_True ;
break ;
case PROPERTYHANDLE_LOADERARGUMENTS : rConvertedValue = rValue ;
rOldValue <<= m_seqLoaderArguments ;
bReturn = sal_True ;
break ;
}
if ( bReturn == sal_False )
{
throw IllegalArgumentException();
}
return bReturn ;
}
//____________________________________________________________________________________________________________
// OPropertySetHelper
//____________________________________________________________________________________________________________
void FrameControl::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle ,
const Any& rValue )
{
// this method only set the value
MutexGuard aGuard (m_aMutex) ;
switch (nHandle)
{
case PROPERTYHANDLE_COMPONENTURL : rValue >>= m_sComponentURL ;
if (getPeer().is())
{
impl_createFrame ( getPeer(), m_sComponentURL, m_seqLoaderArguments ) ;
}
break ;
case PROPERTYHANDLE_LOADERARGUMENTS : rValue >>= m_seqLoaderArguments ;
break ;
default : VOS_ENSHURE ( nHandle == -1, ERRORTEXT_VOSENSHURE ) ;
}
}
//____________________________________________________________________________________________________________
// OPropertySetHelper
//____________________________________________________________________________________________________________
void FrameControl::getFastPropertyValue( Any& rRet ,
sal_Int32 nHandle ) const
{
MutexGuard aGuard ( Mutex::getGlobalMutex() ) ;
switch (nHandle)
{
case PROPERTYHANDLE_COMPONENTURL : rRet <<= m_sComponentURL ;
break ;
case PROPERTYHANDLE_LOADERARGUMENTS : rRet <<= m_seqLoaderArguments ;
break ;
case PROPERTYHANDLE_FRAME : rRet <<= m_xFrame ;
break ;
default : VOS_ENSHURE ( nHandle == -1, ERRORTEXT_VOSENSHURE ) ;
}
}
//____________________________________________________________________________________________________________
// OPropertySetHelper
//____________________________________________________________________________________________________________
IPropertyArrayHelper& FrameControl::getInfoHelper()
{
// Create a table that map names to index values.
static OPropertyArrayHelper* pInfo ;
if (!pInfo)
{
// global method must be guarded
MutexGuard aGuard ( Mutex::getGlobalMutex() ) ;
if (!pInfo)
{
pInfo = new OPropertyArrayHelper( impl_getStaticPropertyDescriptor(), sal_True );
}
}
return *pInfo ;
}
/*
//--------------------------------------------------------------------------------------------------
// start OConnectionPointContainerHelper
//--------------------------------------------------------------------------------------------------
Uik* FrameControl::getConnectionPointUiks ( sal_Int32* pCount ) const
{
static Uik szUiks[] =
{
((XEventListener*)NULL)->getSmartUik (),
::getCppuType((const Reference< XPropertyChangeListener >*)0),
::getCppuType((const Reference< XVetoableChangeListener >*)0),
::getCppuType((const Reference< XPropertiesChangeListener >*)0)
} ;
*pCount = 4 ;
return szUiks ;
}
//--------------------------------------------------------------------------------------------------
// end OConnectionPointContainerHelper
//--------------------------------------------------------------------------------------------------
*/
//____________________________________________________________________________________________________________
// OPropertySetHelper
//____________________________________________________________________________________________________________
Reference< XPropertySetInfo > SAL_CALL FrameControl::getPropertySetInfo() throw( 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; pInfo is NULL - for the second call pInfo is different from NULL!
static Reference< XPropertySetInfo >* pInfo = (Reference< XPropertySetInfo >*)0 ;
if ( pInfo == (Reference< XPropertySetInfo >*)0 )
{
// Ready for multithreading
MutexGuard aGuard ( Mutex::getGlobalMutex () ) ;
// Control this pointer again, another instance can be faster then these!
if ( pInfo == (Reference< XPropertySetInfo >*)0 )
{
// Create structure of propertysetinfo for baseclass "OPropertySetHelper".
// (Use method "getInfoHelper()".)
static Reference< XPropertySetInfo > xInfo ( createPropertySetInfo ( getInfoHelper () ) ) ;
pInfo = &xInfo ;
}
}
return ( *pInfo ) ;
}
//____________________________________________________________________________________________________________
// BaseControl
//____________________________________________________________________________________________________________
WindowDescriptor* FrameControl::impl_getWindowDescriptor( const Reference< XWindowPeer >& xParentPeer )
{
WindowDescriptor* pDescriptor = new WindowDescriptor ;
pDescriptor->Type = WindowClass_CONTAINER ;
pDescriptor->ParentIndex = -1 ;
pDescriptor->Parent = xParentPeer ;
pDescriptor->Bounds = getPosSize () ;
pDescriptor->WindowAttributes = 0 ;
return pDescriptor ;
}
//____________________________________________________________________________________________________________
// private method
//____________________________________________________________________________________________________________
void FrameControl::impl_createFrame( const Reference< XWindowPeer >& xPeer ,
const OUString& rURL ,
const Sequence< PropertyValue >& rArguments )
{
Reference< XFrame > xOldFrame ;
Reference< XFrame > xNewFrame ;
{
MutexGuard aGuard ( m_aMutex ) ;
xOldFrame = m_xFrame ;
}
xNewFrame = Reference< XFrame > ( impl_getMultiServiceFactory()->createInstance ( OUString::createFromAscii( "com.sun.star.frame.Frame" ) ), UNO_QUERY ) ;
Reference< XDispatchProvider > xDSP ( xNewFrame, UNO_QUERY ) ;
if (xDSP.is())
{
Reference< XWindow > xWP ( xPeer, UNO_QUERY ) ;
xNewFrame->initialize ( xWP ) ;
// option
//xFrame->setName( "WhatYouWant" );
Reference< XURLTransformer > xTrans ( impl_getMultiServiceFactory()->createInstance ( OUString::createFromAscii( "com.sun.star.util.URLTransformer" ) ), UNO_QUERY ) ;
if(xTrans.is())
{
// load file
URL aURL ;
aURL.Complete = rURL ;
xTrans->parseStrict( aURL ) ;
Reference< XDispatch > xDisp = xDSP->queryDispatch ( aURL, OUString (), FrameSearchFlag::SELF ) ;
if (xDisp.is())
{
xDisp->dispatch ( aURL, rArguments ) ;
}
}
}
// set the frame
{
MutexGuard aGuard ( m_aMutex ) ;
m_xFrame = xNewFrame ;
}
// notify the listeners
sal_Int32 nFrameId = PROPERTYHANDLE_FRAME ;
Any aNewFrame ( &xNewFrame, ::getCppuType((const Reference< XFrame >*)0) ) ;
Any aOldFrame ( &xOldFrame, ::getCppuType((const Reference< XFrame >*)0) ) ;
fire ( &nFrameId, &aNewFrame, &aOldFrame, 1, sal_False ) ;
if (xOldFrame.is())
{
xOldFrame->dispose () ;
}
}
//____________________________________________________________________________________________________________
// private method
//____________________________________________________________________________________________________________
void FrameControl::impl_deleteFrame()
{
Reference< XFrame > xOldFrame;
Reference< XFrame > xNullFrame;
{
// do not dispose the frame in this guarded section (deadlock?)
MutexGuard aGuard( m_aMutex );
xOldFrame = m_xFrame;
m_xFrame = Reference< XFrame > ();
}
// notify the listeners
sal_Int32 nFrameId = PROPERTYHANDLE_FRAME;
Any aNewFrame( &xNullFrame, ::getCppuType((const Reference< XFrame >*)0) );
Any aOldFrame( &xOldFrame, ::getCppuType((const Reference< XFrame >*)0) );
fire( &nFrameId, &aNewFrame, &aOldFrame, 1, sal_False );
// dispose the frame
if( xOldFrame.is() )
xOldFrame->dispose();
}
//____________________________________________________________________________________________________________
// private method
//____________________________________________________________________________________________________________
const Sequence< Property > FrameControl::impl_getStaticPropertyDescriptor()
{
// All Properties of this implementation. The array must be sorted!
static const Property pPropertys[PROPERTY_COUNT] =
{
Property( OUString::createFromAscii( PROPERTYNAME_COMPONENTURL ), PROPERTYHANDLE_COMPONENTURL , ::getCppuType((const OUString*)0) , PropertyAttribute::BOUND | PropertyAttribute::CONSTRAINED ),
Property( OUString::createFromAscii( PROPERTYNAME_FRAME ), PROPERTYHANDLE_FRAME , ::getCppuType((const Reference< XFrame >*)0) , PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT ),
Property( OUString::createFromAscii( PROPERTYNAME_LOADERARGUMENTS ), PROPERTYHANDLE_LOADERARGUMENTS , ::getCppuType((const Sequence< PropertyValue >*)0), PropertyAttribute::BOUND | PropertyAttribute::CONSTRAINED )
};
static const Sequence< Property > seqPropertys( pPropertys, PROPERTY_COUNT );
return seqPropertys ;
}
} // namespace unocontrols
+80
View File
@@ -0,0 +1,80 @@
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1.1.1 $
#
# last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
#
# - GNU Lesser General Public License Version 2.1
# - Sun Industry Standards Source License Version 1.1
#
# Sun Microsystems Inc., October, 2000
#
# GNU Lesser General Public License Version 2.1
# =============================================
# Copyright 2000 by Sun Microsystems, Inc.
# 901 San Antonio Road, Palo Alto, CA 94303, USA
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1, as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
#
# Sun Industry Standards Source License Version 1.1
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.1 (the "License"); You may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at http://www.openoffice.org/license.html.
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning 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=UnoControls
TARGET=controls
ENABLE_EXCEPTIONS=TRUE
# --- Settings -----------------------------------------------------
.INCLUDE : $(PRJ)$/util$/makefile.pmk
# --- Files --------------------------------------------------------
SLOFILES=\
$(SLO)$/progressbar.obj \
$(SLO)$/framecontrol.obj \
$(SLO)$/progressmonitor.obj \
$(SLO)$/OConnectionPointHelper.obj \
$(SLO)$/OConnectionPointContainerHelper.obj
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
+600
View File
@@ -0,0 +1,600 @@
/*************************************************************************
*
* $RCSfile: progressbar.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning 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 _UNOCONTROLS_PROGRESSBAR_CTRL_HXX
#include "progressbar.hxx"
#endif
//____________________________________________________________________________________________________________
// includes of other projects
//____________________________________________________________________________________________________________
#ifndef _COM_SUN_STAR_AWT_GRADIENTSTYLE_HPP_
#include <com/sun/star/awt/GradientStyle.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_RASTEROPERATION_HPP_
#include <com/sun/star/awt/RasterOperation.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_GRADIENT_HPP_
#include <com/sun/star/awt/Gradient.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XGRAPHICS_HPP_
#include <com/sun/star/awt/XGraphics.hpp>
#endif
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
#include <cppuhelper/typeprovider.hxx>
#endif
#include <math.h>
//____________________________________________________________________________________________________________
// includes of my project
//____________________________________________________________________________________________________________
//____________________________________________________________________________________________________________
// namespace
//____________________________________________________________________________________________________________
using namespace ::cppu ;
using namespace ::osl ;
using namespace ::rtl ;
using namespace ::com::sun::star::uno ;
using namespace ::com::sun::star::lang ;
using namespace ::com::sun::star::awt ;
namespace unocontrols{
//____________________________________________________________________________________________________________
// construct/destruct
//____________________________________________________________________________________________________________
ProgressBar::ProgressBar( const Reference< XMultiServiceFactory >& xFactory )
: BaseControl ( xFactory )
, m_bHorizontal ( DEFAULT_HORIZONTAL )
, m_aBlockSize ( DEFAULT_BLOCKDIMENSION )
, m_nBackgroundColor ( DEFAULT_BACKGROUNDCOLOR )
, m_nForegroundColor ( DEFAULT_FOREGROUNDCOLOR )
, m_nMinRange ( DEFAULT_MINRANGE )
, m_nMaxRange ( DEFAULT_MAXRANGE )
, m_nBlockValue ( DEFAULT_BLOCKVALUE )
, m_nValue ( DEFAULT_VALUE )
{
}
ProgressBar::~ProgressBar()
{
}
//____________________________________________________________________________________________________________
// XInterface
//____________________________________________________________________________________________________________
Any SAL_CALL ProgressBar::queryInterface( const Type& rType ) throw( RuntimeException )
{
// Attention:
// Don't use mutex or guard in this method!!! Is a method of XInterface.
Any aReturn ;
Reference< XInterface > xDelegator = BaseControl::impl_getDelegator();
if ( xDelegator.is() == sal_True )
{
// If an delegator exist, forward question to his queryInterface.
// Delegator will ask his own queryAggregation!
aReturn = xDelegator->queryInterface( rType );
}
else
{
// If an delegator unknown, forward question to own queryAggregation.
aReturn = queryAggregation( rType );
}
return aReturn ;
}
//____________________________________________________________________________________________________________
// XInterface
//____________________________________________________________________________________________________________
void SAL_CALL ProgressBar::acquire() throw( RuntimeException )
{
// Attention:
// Don't use mutex or guard in this method!!! Is a method of XInterface.
// Forward to baseclass
BaseControl::acquire();
}
//____________________________________________________________________________________________________________
// XInterface
//____________________________________________________________________________________________________________
void SAL_CALL ProgressBar::release() throw( RuntimeException )
{
// Attention:
// Don't use mutex or guard in this method!!! Is a method of XInterface.
// Forward to baseclass
BaseControl::release();
}
//____________________________________________________________________________________________________________
// XTypeProvider
//____________________________________________________________________________________________________________
Sequence< Type > SAL_CALL ProgressBar::getTypes() throw( 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 OTypeCollection* pTypeCollection = NULL ;
if ( pTypeCollection == NULL )
{
// Ready for multithreading; get global mutex for first call of this method only! see before
MutexGuard aGuard( 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 OTypeCollection aTypeCollection ( ::getCppuType(( const Reference< XControlModel >*)NULL ) ,
::getCppuType(( const Reference< XProgressBar >*)NULL ) ,
BaseControl::getTypes()
);
// ... and set his address to static pointer!
pTypeCollection = &aTypeCollection ;
}
}
return pTypeCollection->getTypes();
}
//____________________________________________________________________________________________________________
// XAggregation
//____________________________________________________________________________________________________________
Any SAL_CALL ProgressBar::queryAggregation( const Type& aType ) throw( RuntimeException )
{
// Ask for my own supported interfaces ...
// Attention: XTypeProvider and XInterface are supported by OComponentHelper!
Any aReturn ( ::cppu::queryInterface( aType ,
static_cast< XControlModel* > ( this ) ,
static_cast< XProgressBar* > ( this )
)
);
// If searched interface not supported by this class ...
if ( aReturn.hasValue() == sal_False )
{
// ... ask baseclasses.
aReturn = BaseControl::queryAggregation( aType );
}
return aReturn ;
}
//____________________________________________________________________________________________________________
// XProgressBar
//____________________________________________________________________________________________________________
void SAL_CALL ProgressBar::setForegroundColor( sal_Int32 nColor ) throw( RuntimeException )
{
// Ready for multithreading
MutexGuard aGuard (m_aMutex) ;
// Safe color for later use.
m_nForegroundColor = nColor ;
// Repaint control
impl_paint ( 0, 0, impl_getGraphicsPeer() ) ;
}
//____________________________________________________________________________________________________________
// XProgressBar
//____________________________________________________________________________________________________________
void SAL_CALL ProgressBar::setBackgroundColor ( sal_Int32 nColor ) throw( RuntimeException )
{
// Ready for multithreading
MutexGuard aGuard (m_aMutex) ;
// Safe color for later use.
m_nBackgroundColor = nColor ;
// Repaint control
impl_paint ( 0, 0, impl_getGraphicsPeer() ) ;
}
//____________________________________________________________________________________________________________
// XProgressBar
//____________________________________________________________________________________________________________
void SAL_CALL ProgressBar::setValue ( sal_Int32 nValue ) throw( RuntimeException )
{
// This method is defined for follow things:
// 1) Values >= _nMinRange
// 2) Values <= _nMaxRange
// Ready for multithreading
MutexGuard aGuard (m_aMutex) ;
// save impossible cases
// This method is only defined for valid values
DBG_ASSERT ( (( nValue >= m_nMinRange ) && ( nValue <= m_nMaxRange )), "ProgressBar::setValue()\nNot valid value.\n" ) ;
// If new value not valid ... do nothing in release version!
if (
( nValue >= m_nMinRange ) &&
( nValue <= m_nMaxRange )
)
{
// New value is ok => save this
m_nValue = nValue ;
// Repaint to display changes
impl_paint ( 0, 0, impl_getGraphicsPeer() ) ;
}
}
//____________________________________________________________________________________________________________
// XProgressBar
//____________________________________________________________________________________________________________
void SAL_CALL ProgressBar::setRange ( sal_Int32 nMin, sal_Int32 nMax ) throw( RuntimeException )
{
// This method is defined for follow things:
// 1) All values of sal_Int32
// 2) Min < Max
// 3) Min > Max
// save impossible cases
// This method is only defined for valid values
// If you ignore this, the release version wil produce an error "division by zero" in "ProgressBar::setValue()"!
DBG_ASSERT ( ( nMin != nMax ) , "ProgressBar::setRange()\nValues for MIN and MAX are the same. This is not allowed!\n" ) ;
// Ready for multithreading
MutexGuard aGuard (m_aMutex) ;
// control the values for min and max
if ( nMin < nMax )
{
// Take correct Min and Max
m_nMinRange = nMin ;
m_nMaxRange = nMax ;
}
else
{
// Change Min and Max automaticly
m_nMinRange = nMax ;
m_nMaxRange = nMin ;
}
impl_recalcRange () ;
// Do not repaint the control at this place!!!
// An old "m_nValue" is set and can not be correct for this new range.
// Next call of "ProgressBar::setValue()" do this.
}
//____________________________________________________________________________________________________________
// XProgressBar
//____________________________________________________________________________________________________________
sal_Int32 SAL_CALL ProgressBar::getValue () throw( RuntimeException )
{
// Ready for multithreading
MutexGuard aGuard (m_aMutex) ;
return ( m_nValue ) ;
}
//____________________________________________________________________________________________________________
// XWindow
//____________________________________________________________________________________________________________
void SAL_CALL ProgressBar::setPosSize ( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nFlags ) throw( RuntimeException )
{
// Take old size BEFORE you set the new values at baseclass!
// You will control changes. At the other way, the values are the same!
Rectangle aBasePosSize = getPosSize () ;
BaseControl::setPosSize (nX, nY, nWidth, nHeight, nFlags) ;
// Do only, if size has changed.
if (
( nWidth != aBasePosSize.Width ) ||
( nHeight != aBasePosSize.Height )
)
{
impl_recalcRange ( ) ;
impl_paint ( 0, 0, impl_getGraphicsPeer () ) ;
}
}
//____________________________________________________________________________________________________________
// XControl
//____________________________________________________________________________________________________________
sal_Bool SAL_CALL ProgressBar::setModel( const Reference< XControlModel >& xModel ) throw( RuntimeException )
{
// A model is not possible for this control.
return sal_False ;
}
//____________________________________________________________________________________________________________
// XControl
//____________________________________________________________________________________________________________
Reference< XControlModel > SAL_CALL ProgressBar::getModel() throw( RuntimeException )
{
// A model is not possible for this control.
return Reference< XControlModel >();
}
//____________________________________________________________________________________________________________
// impl but public method to register service
//____________________________________________________________________________________________________________
const Sequence< OUString > ProgressBar::impl_getStaticSupportedServiceNames()
{
MutexGuard aGuard( Mutex::getGlobalMutex() );
Sequence< OUString > seqServiceNames( 1 );
seqServiceNames.getArray() [0] = OUString::createFromAscii( SERVICENAME_PROGRESSBAR );
return seqServiceNames ;
}
//____________________________________________________________________________________________________________
// impl but public method to register service
//____________________________________________________________________________________________________________
const OUString ProgressBar::impl_getStaticImplementationName()
{
return OUString::createFromAscii( IMPLEMENTATIONNAME_PROGRESSBAR );
}
//____________________________________________________________________________________________________________
// protected method
//____________________________________________________________________________________________________________
void ProgressBar::impl_paint ( sal_Int32 nX, sal_Int32 nY, const Reference< XGraphics > & rGraphics )
{
// save impossible cases
DBG_ASSERT ( rGraphics.is(), "ProgressBar::paint()\nCalled with invalid Reference< XGraphics > ." ) ;
// This paint method ist not buffered !!
// Every request paint the completely control. ( but only, if peer exist )
if ( rGraphics.is () )
{
MutexGuard aGuard (m_aMutex) ;
// Clear background
// (same color for line and fill)
rGraphics->setFillColor ( m_nBackgroundColor ) ;
rGraphics->setLineColor ( m_nBackgroundColor ) ;
rGraphics->drawRect ( nX, nY, impl_getWidth(), impl_getHeight() ) ;
sal_Int32 nBlockStart = 0 ; // = left site of new block
sal_Int32 nBlockCount = 0 ; // = number of next block
// same color for line and fill for blocks
rGraphics->setFillColor ( m_nForegroundColor ) ;
rGraphics->setLineColor ( m_nForegroundColor ) ;
sal_Int32 nDifference = labs ( m_nValue - m_nMinRange ) ;
if ( m_nBlockValue == 0 )
{
// Prevent "division by zero"
m_nBlockValue = 1 ;
}
// number of blocks for current value
nBlockCount = nDifference / m_nBlockValue ;
// Round to next valid block number
if ( fmod ( (float)nDifference, (float)m_nBlockValue ) != 0 )
{
++nBlockCount ;
}
// Draw horizontal progressbar
// decision in "recalcRange()"
if (m_bHorizontal)
{
// Step to left side of window
nBlockStart = nX ;
for ( sal_Int16 i=1; i<=nBlockCount; ++i )
{
// step free field
nBlockStart += FREESPACE ;
// paint block
rGraphics->drawRect (nBlockStart, nY+FREESPACE, m_aBlockSize.Width, m_aBlockSize.Height) ;
// step next free field
nBlockStart += m_aBlockSize.Width ;
}
}
// draw vertikal progressbar
// decision in "recalcRange()"
else
{
// step to bottom side of window
nBlockStart = nY+impl_getHeight() ;
nBlockStart -= m_aBlockSize.Height ;
for ( sal_Int16 i=1; i<=nBlockCount; ++i )
{
// step free field
nBlockStart -= FREESPACE ;
// paint block
rGraphics->drawRect (nX+FREESPACE, nBlockStart, m_aBlockSize.Width, m_aBlockSize.Height) ;
// step next free field
nBlockStart -= m_aBlockSize.Height;
}
}
// Paint shadow border around the progressbar
rGraphics->setLineColor ( LINECOLOR_SHADOW ) ;
rGraphics->drawLine ( nX, nY, impl_getWidth(), nY ) ;
rGraphics->drawLine ( nX, nY, nX , impl_getHeight() ) ;
rGraphics->setLineColor ( LINECOLOR_BRIGHT ) ;
rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, impl_getWidth()-1, nY ) ;
rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, nX , impl_getHeight()-1 ) ;
}
}
//____________________________________________________________________________________________________________
// protected method
//____________________________________________________________________________________________________________
void ProgressBar::impl_recalcRange ()
{
MutexGuard aGuard (m_aMutex) ;
// Calculate size of block in progressbar
// and switch the orientation of the control
sal_Int32 nMaxBlock = 0 ;
sal_Int32 nWidth = impl_getWidth () ; // it's better for debug !
sal_Int32 nHeight = impl_getHeight () ; // it's better for debug !
// Default = horizontal progressbar ...
m_bHorizontal = sal_True ;
// ... but, if programmer say "NO IT's VERTICAL ..."
if ( nWidth > nHeight )
{
// Don't forget to save this state! Used in "ProgressBar::paint()"
m_bHorizontal = sal_True ;
// Calculate count of blocks for actual size
// (prevent error "division by zero")
if ( nHeight == 0 )
{
nHeight = 1 ;
}
nMaxBlock = nWidth / nHeight ;
nMaxBlock *= 2 ;
// prevent error "division by zero"
if ( nMaxBlock == 0 )
{
nMaxBlock = 1 ;
}
// Calculate new value and new size for ONE block.
// Do not a calculation like this: "m_nBlockValue=(m_nMaxRange-m_nMinRange)/nMaxBlock" !
// If difference between m_nMaxRange and m_nMinRange to large, it give an overflow and a
// following error "division by zero" in method "paint() ... nBlockCount=nDifference/m_nBlockValue ..."
// Overflow ? => example: _I32_MAX - _I32_MIN = -1 and not _UI32_MAX !!!
m_nBlockValue = ( m_nMaxRange / nMaxBlock ) - ( m_nMinRange / nMaxBlock ) ;
m_aBlockSize.Height = ( nHeight - ( FREESPACE * 2 ) ) ;
m_aBlockSize.Width = ( ( nWidth / nMaxBlock ) - FREESPACE ) ;
}
else
{
// Don't forget to save this state! Used in "ProgressBar::paint()"
m_bHorizontal = sal_False ;
// Calculate count of blocks for actual size
// (prevent error "division by zero")
if ( nWidth == 0 )
{
nWidth = 1 ;
}
nMaxBlock = nHeight / nWidth ;
nMaxBlock *= 2 ;
// prevent error "division by zero"
if ( nMaxBlock == 0 )
{
nMaxBlock = 1 ;
}
// Calculate new value and new size for ONE block.
// Do not a calculation like this: "m_nBlockValue=(m_nMaxRange-m_nMinRange)/nMaxBlock" !
// If difference between m_nMaxRange and m_nMinRange to large, it give an overflow and a
// following error "division by zero" in method "paint() ... nBlockCount=nDifference/m_nBlockValue ..."
// Overflow ? => example: _I32_MAX - _I32_MIN = -1 and not _UI32_MAX !!!
m_nBlockValue = ( m_nMaxRange / nMaxBlock ) - ( m_nMinRange / nMaxBlock ) ;
m_aBlockSize.Height = ( ( nHeight / nMaxBlock ) - FREESPACE ) ;
m_aBlockSize.Width = ( nWidth - ( FREESPACE * 2 ) ) ;
}
}
} // namespace unocontrols
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,307 @@
/*************************************************************************
*
* $RCSfile: OConnectionPointContainerHelper.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _OCONNECTIONPOINTCONTAINERHELPER_HXX
#define _OCONNECTIONPOINTCONTAINERHELPER_HXX
//______________________________________________________________________________________________________________
// includes of other projects
//______________________________________________________________________________________________________________
#ifndef _COM_SUN_STAR_LANG_XCONNECTIONPOINTCONTAINER_HPP_
#include <com/sun/star/lang/XConnectionPointContainer.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XCONNECTIONPOINT_HPP_
#include <com/sun/star/lang/XConnectionPoint.hpp>
#endif
#ifndef _CPPUHELPER_WEAK_HXX_
#include <cppuhelper/weak.hxx>
#endif
#ifndef _CPPUHELPER_PROPSHLP_HXX
#include <cppuhelper/propshlp.hxx>
#endif
//______________________________________________________________________________________________________________
// includes of my own project
//______________________________________________________________________________________________________________
//______________________________________________________________________________________________________________
// namespaces
//______________________________________________________________________________________________________________
namespace unocontrols{
#define UNO3_ANY ::com::sun::star::uno::Any
#define UNO3_SEQUENCE ::com::sun::star::uno::Sequence
#define UNO3_TYPE ::com::sun::star::uno::Type
#define UNO3_REFERENCE ::com::sun::star::uno::Reference
#define UNO3_XCONNECTIONPOINTCONTAINER ::com::sun::star::lang::XConnectionPointContainer
#define UNO3_XCONNECTIONPOINT ::com::sun::star::lang::XConnectionPoint
#define UNO3_MUTEX ::osl::Mutex
#define UNO3_RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
#define UNO3_XINTERFACE ::com::sun::star::uno::XInterface
#define UNO3_OMULTITYPEINTERFACECONTAINERHELPER ::cppu::OMultiTypeInterfaceContainerHelper
#define UNO3_LISTENEREXISTEXCEPTION ::com::sun::star::lang::ListenerExistException
#define UNO3_INVALIDLISTENEREXCEPTION ::com::sun::star::lang::InvalidListenerException
#define UNO3_WEAKREFERENCE ::com::sun::star::uno::WeakReference
#define UNO3_OWEAKOBJECT ::cppu::OWeakObject
//______________________________________________________________________________________________________________
// defines
//______________________________________________________________________________________________________________
//______________________________________________________________________________________________________________
// class declaration OConnectionPointContainerHelper
//______________________________________________________________________________________________________________
class OConnectionPointContainerHelper : public UNO3_XCONNECTIONPOINTCONTAINER
, public UNO3_OWEAKOBJECT
{
//______________________________________________________________________________________________________________
// public methods
//______________________________________________________________________________________________________________
public:
//__________________________________________________________________________________________________________
// construct/destruct
//__________________________________________________________________________________________________________
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
OConnectionPointContainerHelper( UNO3_MUTEX& aMutex );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual ~OConnectionPointContainerHelper();
//________________________________________________________________________________________________________
// XInterface
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short give answer, if interface is supported
@descr The interfaces are searched by type.
@seealso XInterface
@param "rType" is the type of searched interface.
@return Any information about found interface
@onerror A RuntimeException is thrown.
*/
virtual UNO3_ANY SAL_CALL queryInterface( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short increment refcount
@descr -
@seealso XInterface
@seealso release()
@param -
@return -
@onerror A RuntimeException is thrown.
*/
virtual void SAL_CALL acquire() throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short decrement refcount
@descr -
@seealso XInterface
@seealso acquire()
@param -
@return -
@onerror A RuntimeException is thrown.
*/
virtual void SAL_CALL release() throw( UNO3_RUNTIMEEXCEPTION );
//__________________________________________________________________________________________________________
// XConnectionPointContainer
//__________________________________________________________________________________________________________
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual UNO3_SEQUENCE< UNO3_TYPE > SAL_CALL getConnectionPointTypes() throw( UNO3_RUNTIMEEXCEPTION );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual UNO3_REFERENCE< UNO3_XCONNECTIONPOINT > SAL_CALL queryConnectionPoint( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual void SAL_CALL advise( const UNO3_TYPE& aType ,
const UNO3_REFERENCE< UNO3_XINTERFACE >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual void SAL_CALL unadvise( const UNO3_TYPE& aType ,
const UNO3_REFERENCE< UNO3_XINTERFACE >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
UNO3_OMULTITYPEINTERFACECONTAINERHELPER& impl_getMultiTypeContainer();
//______________________________________________________________________________________________________________
// private variables
//______________________________________________________________________________________________________________
private:
UNO3_MUTEX& m_aSharedMutex ;
UNO3_OMULTITYPEINTERFACECONTAINERHELPER m_aMultiTypeContainer ; // Container to hold listener
}; // class OConnectionPointContainerHelper
} // namespace unocontrols
#endif // #ifndef _OCONNECTIONPOINTCONTAINERHELPER_HXX
@@ -0,0 +1,354 @@
/*************************************************************************
*
* $RCSfile: OConnectionPointHelper.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _OCONNECTIONPOINTHELPER_HXX
#define _OCONNECTIONPOINTHELPER_HXX
//______________________________________________________________________________________________________________
// includes of other projects
//______________________________________________________________________________________________________________
#ifndef _COM_SUN_STAR_LANG_XCONNECTIONPOINTCONTAINER_HPP_
#include <com/sun/star/lang/XConnectionPointContainer.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XCONNECTIONPOINT_HPP_
#include <com/sun/star/lang/XConnectionPoint.hpp>
#endif
#ifndef _CPPUHELPER_WEAK_HXX_
#include <cppuhelper/weak.hxx>
#endif
#ifndef _CPPUHELPER_PROPSHLP_HXX
#include <cppuhelper/propshlp.hxx>
#endif
//______________________________________________________________________________________________________________
// includes of my own project
//______________________________________________________________________________________________________________
#ifndef _OCONNECTIONPOINTCONTAINERHELPER_HXX
#include "OConnectionPointContainerHelper.hxx"
#endif
//______________________________________________________________________________________________________________
// namespaces
//______________________________________________________________________________________________________________
namespace unocontrols{
#define UNO3_ANY ::com::sun::star::uno::Any
#define UNO3_SEQUENCE ::com::sun::star::uno::Sequence
#define UNO3_TYPE ::com::sun::star::uno::Type
#define UNO3_REFERENCE ::com::sun::star::uno::Reference
#define UNO3_XCONNECTIONPOINTCONTAINER ::com::sun::star::lang::XConnectionPointContainer
#define UNO3_XCONNECTIONPOINT ::com::sun::star::lang::XConnectionPoint
#define UNO3_MUTEX ::osl::Mutex
#define UNO3_RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
#define UNO3_XINTERFACE ::com::sun::star::uno::XInterface
#define UNO3_OMULTITYPEINTERFACECONTAINERHELPER ::cppu::OMultiTypeInterfaceContainerHelper
#define UNO3_LISTENEREXISTEXCEPTION ::com::sun::star::lang::ListenerExistException
#define UNO3_INVALIDLISTENEREXCEPTION ::com::sun::star::lang::InvalidListenerException
#define UNO3_WEAKREFERENCE ::com::sun::star::uno::WeakReference
#define UNO3_OWEAKOBJECT ::cppu::OWeakObject
#define UNO3_OCONNECTIONPOINTCONTAINERHELPER OConnectionPointContainerHelper
//______________________________________________________________________________________________________________
// defines
//______________________________________________________________________________________________________________
//______________________________________________________________________________________________________________
// class declaration OConnectionPointHelper
//______________________________________________________________________________________________________________
class OConnectionPointHelper : public UNO3_XCONNECTIONPOINT
, public UNO3_OWEAKOBJECT
{
//______________________________________________________________________________________________________________
// public methods
//______________________________________________________________________________________________________________
public:
//__________________________________________________________________________________________________________
// construct/destruct
//__________________________________________________________________________________________________________
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
OConnectionPointHelper( UNO3_MUTEX& aMutex ,
UNO3_OCONNECTIONPOINTCONTAINERHELPER* pContainerImplementation ,
UNO3_TYPE aType );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual ~OConnectionPointHelper();
//________________________________________________________________________________________________________
// XInterface
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short give answer, if interface is supported
@descr The interfaces are searched by type.
@seealso XInterface
@param "rType" is the type of searched interface.
@return Any information about found interface
@onerror A RuntimeException is thrown.
*/
virtual UNO3_ANY SAL_CALL queryInterface( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short increment refcount
@descr -
@seealso XInterface
@seealso release()
@param -
@return -
@onerror A RuntimeException is thrown.
*/
virtual void SAL_CALL acquire() throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short decrement refcount
@descr -
@seealso XInterface
@seealso acquire()
@param -
@return -
@onerror A RuntimeException is thrown.
*/
virtual void SAL_CALL release() throw( UNO3_RUNTIMEEXCEPTION );
//__________________________________________________________________________________________________________
// XConnectionPoint
//__________________________________________________________________________________________________________
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual UNO3_TYPE SAL_CALL getConnectionType() throw( UNO3_RUNTIMEEXCEPTION );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual UNO3_REFERENCE< UNO3_XCONNECTIONPOINTCONTAINER > SAL_CALL getConnectionPointContainer() throw( UNO3_RUNTIMEEXCEPTION );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual void SAL_CALL advise( const UNO3_REFERENCE< UNO3_XINTERFACE >& xListener ) throw( UNO3_LISTENEREXISTEXCEPTION ,
UNO3_INVALIDLISTENEREXCEPTION ,
UNO3_RUNTIMEEXCEPTION );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual void SAL_CALL unadvise( const UNO3_REFERENCE< UNO3_XINTERFACE >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual UNO3_SEQUENCE< UNO3_REFERENCE< UNO3_XINTERFACE > > SAL_CALL getConnections() throw( UNO3_RUNTIMEEXCEPTION );
//______________________________________________________________________________________________________________
// private methods
//______________________________________________________________________________________________________________
private:
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
sal_Bool impl_LockContainer();
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
void impl_UnlockContainer();
//______________________________________________________________________________________________________________
// private variables
//______________________________________________________________________________________________________________
private:
UNO3_MUTEX& m_aSharedMutex ;
UNO3_WEAKREFERENCE< UNO3_XCONNECTIONPOINTCONTAINER > m_oContainerWeakReference ; // Reference to container-class!. Don't use Reference<...>
// It is a ring-reference => and must be a wekreference!
UNO3_OCONNECTIONPOINTCONTAINERHELPER* m_pContainerImplementation ;
UNO3_TYPE m_aInterfaceType ;
UNO3_REFERENCE< UNO3_XINTERFACE > m_xLock ;
}; // class OConnectionPointHelper
} // namespace unocontrols
#endif // #ifndef _OCONNECTIONPOINTHELPER_HXX
+690
View File
@@ -0,0 +1,690 @@
/*************************************************************************
*
* $RCSfile: framecontrol.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _UNOCONTROLS_FRAMECONTROL_CTRL_HXX
#define _UNOCONTROLS_FRAMECONTROL_CTRL_HXX
//______________________________________________________________________________________________________________
// includes of other projects
//______________________________________________________________________________________________________________
#ifndef _COM_SUN_STAR_FRAME_XFRAMEACTIONLISTENER_HPP_
#include <com/sun/star/frame/XFrameActionListener.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_
#include <com/sun/star/frame/XComponentLoader.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
#include <com/sun/star/frame/XFrame.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_FRAMEACTIONEVENT_HPP_
#include <com/sun/star/frame/FrameActionEvent.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_FRAMEACTION_HPP_
#include <com/sun/star/frame/FrameAction.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XSERVICENAME_HPP_
#include <com/sun/star/lang/XServiceName.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
#include <com/sun/star/lang/XServiceInfo.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XCONNECTIONPOINTCONTAINER_HPP_
#include <com/sun/star/lang/XConnectionPointContainer.hpp>
#endif
#ifndef _CPPUHELPER_PROPSHLP_HXX
#include <cppuhelper/propshlp.hxx>
#endif
//______________________________________________________________________________________________________________
// includes of my own project
//______________________________________________________________________________________________________________
#ifndef _UNOCONTROLS_BASECONTROL_CTRL_HXX
#include "basecontrol.hxx"
#endif
#ifndef _OCONNECTIONPOINTCONTAINERHELPER_HXX
#include "OConnectionPointContainerHelper.hxx"
#endif
//______________________________________________________________________________________________________________
// namespaces
//______________________________________________________________________________________________________________
namespace unocontrols{
#define UNO3_ANY ::com::sun::star::uno::Any
#define UNO3_ILLEGALARGUMENTEXCEPTION ::com::sun::star::lang::IllegalArgumentException
#define UNO3_IPROPERTYARRAYHELPER ::cppu::IPropertyArrayHelper
#define UNO3_OBROADCASTHELPER ::cppu::OBroadcastHelper
#define UNO3_OCONNECTIONPOINTCONTAINERHELPER OConnectionPointContainerHelper
#define UNO3_OMULTITYPEINTERFACECONTAINERHELPER ::cppu::OMultiTypeInterfaceContainerHelper
#define UNO3_OPROPERTYSETHELPER ::cppu::OPropertySetHelper
#define UNO3_OUSTRING ::rtl::OUString
#define UNO3_PROPERTY ::com::sun::star::beans::Property
#define UNO3_PROPERTYVALUE ::com::sun::star::beans::PropertyValue
#define UNO3_REFERENCE ::com::sun::star::uno::Reference
#define UNO3_RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
#define UNO3_SEQUENCE ::com::sun::star::uno::Sequence
#define UNO3_TYPE ::com::sun::star::uno::Type
#define UNO3_WINDOWDESCRIPTOR ::com::sun::star::awt::WindowDescriptor
#define UNO3_XCONNECTIONPOINT ::com::sun::star::lang::XConnectionPoint
#define UNO3_XCONNECTIONPOINTCONTAINER ::com::sun::star::lang::XConnectionPointContainer
#define UNO3_XCONTROLMODEL ::com::sun::star::awt::XControlModel
#define UNO3_XFRAME ::com::sun::star::frame::XFrame
#define UNO3_XGRAPHICS ::com::sun::star::awt::XGraphics
#define UNO3_XINTERFACE ::com::sun::star::uno::XInterface
#define UNO3_XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory
#define UNO3_XPROPERTYSETINFO ::com::sun::star::beans::XPropertySetInfo
#define UNO3_XTOOLKIT ::com::sun::star::awt::XToolkit
#define UNO3_XWINDOWPEER ::com::sun::star::awt::XWindowPeer
//______________________________________________________________________________________________________________
// defines
//______________________________________________________________________________________________________________
#define SERVICENAME_FRAMECONTROL "com.sun.star.frame.FrameControl"
#define IMPLEMENTATIONNAME_FRAMECONTROL "stardiv.UnoControls.FrameControl"
#define PROPERTYNAME_LOADERARGUMENTS "LoaderArguments"
#define PROPERTYNAME_COMPONENTURL "ComponentURL"
#define PROPERTYNAME_FRAME "Frame"
#define ERRORTEXT_VOSENSHURE "This is an invalid property handle."
#define PROPERTY_COUNT 3 // you must count the propertys
#define PROPERTYHANDLE_COMPONENTURL 0 // Id must be the index into the array
#define PROPERTYHANDLE_FRAME 1
#define PROPERTYHANDLE_LOADERARGUMENTS 2
//______________________________________________________________________________________________________________
// class
//______________________________________________________________________________________________________________
class FrameControl : public UNO3_XCONTROLMODEL
, public UNO3_XCONNECTIONPOINTCONTAINER
, public BaseControl // This order is neccessary for right initialization of m_aMutex!
, public UNO3_OBROADCASTHELPER
, public UNO3_OPROPERTYSETHELPER
{
//______________________________________________________________________________________________________________
// public methods
//______________________________________________________________________________________________________________
public:
//__________________________________________________________________________________________________________
// construct/destruct
//__________________________________________________________________________________________________________
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
FrameControl( const UNO3_REFERENCE< UNO3_XMULTISERVICEFACTORY >& xFactory );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual ~FrameControl();
//__________________________________________________________________________________________________________
// XInterface
//__________________________________________________________________________________________________________
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual UNO3_ANY SAL_CALL queryInterface( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short increment refcount
@descr -
@seealso XInterface
@seealso release()
@param -
@return -
@onerror A RuntimeException is thrown.
*/
virtual void SAL_CALL acquire() throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short decrement refcount
@descr -
@seealso XInterface
@seealso acquire()
@param -
@return -
@onerror A RuntimeException is thrown.
*/
virtual void SAL_CALL release() throw( UNO3_RUNTIMEEXCEPTION );
//__________________________________________________________________________________________________________
// XTypeProvider
//__________________________________________________________________________________________________________
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual UNO3_SEQUENCE< UNO3_TYPE > SAL_CALL getTypes() throw( UNO3_RUNTIMEEXCEPTION );
//__________________________________________________________________________________________________________
// XAggregation
//__________________________________________________________________________________________________________
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
UNO3_ANY SAL_CALL queryAggregation( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
//__________________________________________________________________________________________________________
// XControl
//__________________________________________________________________________________________________________
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual void SAL_CALL createPeer( const UNO3_REFERENCE< UNO3_XTOOLKIT >& xToolkit ,
const UNO3_REFERENCE< UNO3_XWINDOWPEER >& xParent ) throw( UNO3_RUNTIMEEXCEPTION );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual sal_Bool SAL_CALL setModel( const UNO3_REFERENCE< UNO3_XCONTROLMODEL >& xModel ) throw( UNO3_RUNTIMEEXCEPTION );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual UNO3_REFERENCE< UNO3_XCONTROLMODEL > SAL_CALL getModel() throw( UNO3_RUNTIMEEXCEPTION );
//__________________________________________________________________________________________________________
// XComponent
//__________________________________________________________________________________________________________
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual void SAL_CALL dispose() throw( UNO3_RUNTIMEEXCEPTION );
//__________________________________________________________________________________________________________
// XView
//__________________________________________________________________________________________________________
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual sal_Bool SAL_CALL setGraphics( const UNO3_REFERENCE< UNO3_XGRAPHICS >& xDevice ) throw( UNO3_RUNTIMEEXCEPTION );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual UNO3_REFERENCE< UNO3_XGRAPHICS > SAL_CALL getGraphics() throw( UNO3_RUNTIMEEXCEPTION );
//__________________________________________________________________________________________________________
// XConnectionPointContainer
//__________________________________________________________________________________________________________
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual UNO3_SEQUENCE< UNO3_TYPE > SAL_CALL getConnectionPointTypes() throw( UNO3_RUNTIMEEXCEPTION );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual UNO3_REFERENCE< UNO3_XCONNECTIONPOINT > SAL_CALL queryConnectionPoint( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual void SAL_CALL advise( const UNO3_TYPE& aType ,
const UNO3_REFERENCE< UNO3_XINTERFACE >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual void SAL_CALL unadvise( const UNO3_TYPE& aType ,
const UNO3_REFERENCE< UNO3_XINTERFACE >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
//__________________________________________________________________________________________________________
// impl but public methods to register service!
//__________________________________________________________________________________________________________
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
static const UNO3_SEQUENCE< UNO3_OUSTRING > impl_getStaticSupportedServiceNames();
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
static const UNO3_OUSTRING impl_getStaticImplementationName();
//______________________________________________________________________________________________________________
// protected methods
//______________________________________________________________________________________________________________
protected:
//__________________________________________________________________________________________________________
// OPropertySetHelper
//__________________________________________________________________________________________________________
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual sal_Bool SAL_CALL convertFastPropertyValue( UNO3_ANY& rConvertedValue ,
UNO3_ANY& rOldValue ,
sal_Int32 nHandle ,
const UNO3_ANY& rValue ) throw( UNO3_ILLEGALARGUMENTEXCEPTION );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle ,
const UNO3_ANY& rValue );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual void SAL_CALL getFastPropertyValue( UNO3_ANY& rValue ,
sal_Int32 nHandle ) const ;
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual UNO3_IPROPERTYARRAYHELPER& SAL_CALL getInfoHelper();
//__________________________________________________________________________________________________________
// XPropertySet
//__________________________________________________________________________________________________________
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
UNO3_REFERENCE< UNO3_XPROPERTYSETINFO > SAL_CALL getPropertySetInfo() throw( UNO3_RUNTIMEEXCEPTION );
//__________________________________________________________________________________________________________
// BaseControl
//__________________________________________________________________________________________________________
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual UNO3_WINDOWDESCRIPTOR* impl_getWindowDescriptor( const UNO3_REFERENCE< UNO3_XWINDOWPEER >& xParentPeer );
//______________________________________________________________________________________________________________
// private methods
//______________________________________________________________________________________________________________
private:
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
void impl_createFrame( const UNO3_REFERENCE< UNO3_XWINDOWPEER >& xPeer ,
const UNO3_OUSTRING& sURL ,
const UNO3_SEQUENCE< UNO3_PROPERTYVALUE >& seqArguments );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
void impl_deleteFrame();
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
static const UNO3_SEQUENCE< UNO3_PROPERTY > impl_getStaticPropertyDescriptor();
//______________________________________________________________________________________________________________
// private variables
//______________________________________________________________________________________________________________
private:
UNO3_REFERENCE< UNO3_XFRAME > m_xFrame ;
UNO3_OUSTRING m_sComponentURL ;
UNO3_SEQUENCE< UNO3_PROPERTYVALUE > m_seqLoaderArguments ;
UNO3_OMULTITYPEINTERFACECONTAINERHELPER m_aInterfaceContainer ;
UNO3_OCONNECTIONPOINTCONTAINERHELPER m_aConnectionPointContainer ;
}; // class FrameControl
} // namespace unocontrols
#endif // #ifndef _UNOCONTROLS_FRAMECONTROL_CTRL_HXX
+487
View File
@@ -0,0 +1,487 @@
/*************************************************************************
*
* $RCSfile: progressbar.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _UNOCONTROLS_PROGRESSBAR_CTRL_HXX
#define _UNOCONTROLS_PROGRESSBAR_CTRL_HXX
//____________________________________________________________________________________________________________
// includes of other projects
//____________________________________________________________________________________________________________
#ifndef _COM_SUN_STAR_LANG_XSERVICENAME_HPP_
#include <com/sun/star/lang/XServiceName.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
#include <com/sun/star/lang/XServiceInfo.hpp>
#endif
//____________________________________________________________________________________________________________
// includes of my own project
//____________________________________________________________________________________________________________
#ifndef _UNOCONTROLS_BASECONTROL_CTRL_HXX
#include "basecontrol.hxx"
#endif
//____________________________________________________________________________________________________________
// namespaces
//____________________________________________________________________________________________________________
namespace unocontrols{
#define UNO3_REFERENCE ::com::sun::star::uno::Reference
#define UNO3_XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory
#define UNO3_RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
#define UNO3_XCONTROLMODEL ::com::sun::star::awt::XControlModel
#define UNO3_XPROGRESSBAR ::com::sun::star::awt::XProgressBar
#define UNO3_ANY ::com::sun::star::uno::Any
#define UNO3_TYPE ::com::sun::star::uno::Type
#define UNO3_SEQUENCE ::com::sun::star::uno::Sequence
#define UNO3_XGRAPHICS ::com::sun::star::awt::XGraphics
#define UNO3_OUSTRING ::rtl::OUString
#define UNO3_SIZE ::com::sun::star::awt::Size
//____________________________________________________________________________________________________________
// defines
//____________________________________________________________________________________________________________
#define SERVICENAME_PROGRESSBAR "com.sun.star.awt.XProgressBar"
#define IMPLEMENTATIONNAME_PROGRESSBAR "stardiv.UnoControls.ProgressBar"
#define FREESPACE 2
#define DEFAULT_HORIZONTAL sal_True
#define DEFAULT_BLOCKDIMENSION Size(1,1)
#define DEFAULT_BACKGROUNDCOLOR TRGB_COLORDATA( 0x00, 0xC0, 0xC0, 0xC0 ) // lightgray
#define DEFAULT_FOREGROUNDCOLOR TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x80 ) // blue
#define DEFAULT_MINRANGE INT_MIN
#define DEFAULT_MAXRANGE INT_MAX
#define DEFAULT_BLOCKVALUE 1
#define DEFAULT_VALUE DEFAULT_MINRANGE
#define LINECOLOR_BRIGHT TRGB_COLORDATA( 0x00, 0xFF, 0xFF, 0xFF ) // white
#define LINECOLOR_SHADOW TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x00 ) // black
//____________________________________________________________________________________________________________
// classes
//____________________________________________________________________________________________________________
class ProgressBar : public UNO3_XCONTROLMODEL
, public UNO3_XPROGRESSBAR
, public BaseControl
{
//____________________________________________________________________________________________________________
// public methods
//____________________________________________________________________________________________________________
public:
//________________________________________________________________________________________________________
// construct/destruct
//________________________________________________________________________________________________________
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
ProgressBar( const UNO3_REFERENCE< UNO3_XMULTISERVICEFACTORY >& xFactory );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual ~ProgressBar();
//__________________________________________________________________________________________________________
// XInterface
//__________________________________________________________________________________________________________
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual UNO3_ANY SAL_CALL queryInterface( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short increment refcount
@descr -
@seealso XInterface
@seealso release()
@param -
@return -
@onerror A RuntimeException is thrown.
*/
virtual void SAL_CALL acquire() throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short decrement refcount
@descr -
@seealso XInterface
@seealso acquire()
@param -
@return -
@onerror A RuntimeException is thrown.
*/
virtual void SAL_CALL release() throw( UNO3_RUNTIMEEXCEPTION );
//__________________________________________________________________________________________________________
// XTypeProvider
//__________________________________________________________________________________________________________
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual UNO3_SEQUENCE< UNO3_TYPE > SAL_CALL getTypes() throw( UNO3_RUNTIMEEXCEPTION );
//__________________________________________________________________________________________________________
// XAggregation
//__________________________________________________________________________________________________________
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
UNO3_ANY SAL_CALL queryAggregation( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
//________________________________________________________________________________________________________
// XProgressBar
//________________________________________________________________________________________________________
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual void SAL_CALL setForegroundColor( sal_Int32 nColor ) throw( UNO3_RUNTIMEEXCEPTION );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual void SAL_CALL setBackgroundColor( sal_Int32 nColor ) throw( UNO3_RUNTIMEEXCEPTION );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual void SAL_CALL setValue( sal_Int32 nValue ) throw( UNO3_RUNTIMEEXCEPTION );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual void SAL_CALL setRange( sal_Int32 nMin ,
sal_Int32 nMax ) throw( UNO3_RUNTIMEEXCEPTION );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual sal_Int32 SAL_CALL getValue() throw( UNO3_RUNTIMEEXCEPTION );
//__________________________________________________________________________________________________________
// XWindow
//__________________________________________________________________________________________________________
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual void SAL_CALL setPosSize( sal_Int32 nX ,
sal_Int32 nY ,
sal_Int32 nWidth ,
sal_Int32 nHeight ,
sal_Int16 nFlags ) throw( UNO3_RUNTIMEEXCEPTION );
//__________________________________________________________________________________________________________
// XControl
//__________________________________________________________________________________________________________
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual sal_Bool SAL_CALL setModel( const UNO3_REFERENCE< UNO3_XCONTROLMODEL >& xModel ) throw( UNO3_RUNTIMEEXCEPTION );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual UNO3_REFERENCE< UNO3_XCONTROLMODEL > SAL_CALL getModel() throw( UNO3_RUNTIMEEXCEPTION );
//__________________________________________________________________________________________________________
// BaseControl
//__________________________________________________________________________________________________________
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
static const UNO3_SEQUENCE< UNO3_OUSTRING > impl_getStaticSupportedServiceNames();
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
static const UNO3_OUSTRING impl_getStaticImplementationName();
//____________________________________________________________________________________________________________
// protected methods
//____________________________________________________________________________________________________________
protected:
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual void impl_paint( sal_Int32 nX ,
sal_Int32 nY ,
const UNO3_REFERENCE< UNO3_XGRAPHICS >& xGraphics );
/**_________________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
void impl_recalcRange();
//____________________________________________________________________________________________________________
// private variables
//____________________________________________________________________________________________________________
private:
sal_Bool m_bHorizontal ; // orientation for steps [true=horizontal/false=vertikal]
UNO3_SIZE m_aBlockSize ; // width and height of a block [>=0,0]
sal_Int32 m_nForegroundColor ; // (alpha,r,g,b)
sal_Int32 m_nBackgroundColor ; // (alpha,r,g,b)
sal_Int32 m_nMinRange ; // lowest value = 0% [long, <_nMaxRange]
sal_Int32 m_nMaxRange ; // highest value = 100% [long, >_nMinRange]
sal_Int32 m_nBlockValue ; // value for one block [long, >0]
sal_Int32 m_nValue ; // value for progress [long]
}; // class ProgressBar
} // namespace unocontrols
#endif // #ifndef _UNOCONTROLS_PROGRESSBAR_CTRL_HXX
+918
View File
@@ -0,0 +1,918 @@
/*************************************************************************
*
* $RCSfile: progressmonitor.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX
#define _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX
//____________________________________________________________________________________________________________
// includes of other projects
//____________________________________________________________________________________________________________
#ifndef _COM_SUN_STAR_AWT_XFILEDIALOG_HPP_
#include <com/sun/star/awt/XFileDialog.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XTEXTCOMPONENT_HPP_
#include <com/sun/star/awt/XTextComponent.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XLISTBOX_HPP_
#include <com/sun/star/awt/XListBox.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XPROGRESSMONITOR_HPP_
#include <com/sun/star/awt/XProgressMonitor.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_TEXTALIGN_HPP_
#include <com/sun/star/awt/TextAlign.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XSCROLLBAR_HPP_
#include <com/sun/star/awt/XScrollBar.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINERPEER_HPP_
#include <com/sun/star/awt/XVclContainerPeer.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XTABCONTROLLERMODEL_HPP_
#include <com/sun/star/awt/XTabControllerModel.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XMESSAGEBOX_HPP_
#include <com/sun/star/awt/XMessageBox.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XTEXTEDITFIELD_HPP_
#include <com/sun/star/awt/XTextEditField.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_STYLE_HPP_
#include <com/sun/star/awt/Style.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XTIMEFIELD_HPP_
#include <com/sun/star/awt/XTimeField.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XVCLWINDOWPEER_HPP_
#include <com/sun/star/awt/XVclWindowPeer.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XCONTROLMODEL_HPP_
#include <com/sun/star/awt/XControlModel.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XSPINFIELD_HPP_
#include <com/sun/star/awt/XSpinField.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XUNOCONTROLCONTAINER_HPP_
#include <com/sun/star/awt/XUnoControlContainer.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XTEXTLAYOUTCONSTRAINS_HPP_
#include <com/sun/star/awt/XTextLayoutConstrains.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XNUMERICFIELD_HPP_
#include <com/sun/star/awt/XNumericField.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XBUTTON_HPP_
#include <com/sun/star/awt/XButton.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XTEXTAREA_HPP_
#include <com/sun/star/awt/XTextArea.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XIMAGEBUTTON_HPP_
#include <com/sun/star/awt/XImageButton.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XFIXEDTEXT_HPP_
#include <com/sun/star/awt/XFixedText.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XCONTROLCONTAINER_HPP_
#include <com/sun/star/awt/XControlContainer.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XDIALOG_HPP_
#include <com/sun/star/awt/XDialog.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_SCROLLBARORIENTATION_HPP_
#include <com/sun/star/awt/ScrollBarOrientation.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XRADIOBUTTON_HPP_
#include <com/sun/star/awt/XRadioButton.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XCURRENCYFIELD_HPP_
#include <com/sun/star/awt/XCurrencyField.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XPATTERNFIELD_HPP_
#include <com/sun/star/awt/XPatternField.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_VCLWINDOWPEERATTRIBUTE_HPP_
#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XTABCONTROLLER_HPP_
#include <com/sun/star/awt/XTabController.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINER_HPP_
#include <com/sun/star/awt/XVclContainer.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XDATEFIELD_HPP_
#include <com/sun/star/awt/XDateField.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XCOMBOBOX_HPP_
#include <com/sun/star/awt/XComboBox.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_
#include <com/sun/star/awt/XControl.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XCHECKBOX_HPP_
#include <com/sun/star/awt/XCheckBox.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_MESSAGEBOXCOMMAND_HPP_
#include <com/sun/star/awt/MessageBoxCommand.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XLAYOUTCONSTRAINS_HPP_
#include <com/sun/star/awt/XLayoutConstrains.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XPROGRESSBAR_HPP_
#include <com/sun/star/awt/XProgressBar.hpp>
#endif
//____________________________________________________________________________________________________________
// includes of my own project
//____________________________________________________________________________________________________________
#ifndef _UNOCONTROLS_BASECONTAINERCONTROL_CTRL_HXX
#include "basecontainercontrol.hxx"
#endif
//____________________________________________________________________________________________________________
// namespace
//____________________________________________________________________________________________________________
namespace unocontrols{
#define UNO3_ANY ::com::sun::star::uno::Any
#define UNO3_OUSTRING ::rtl::OUString
#define UNO3_RECTANGLE ::com::sun::star::awt::Rectangle
#define UNO3_REFERENCE ::com::sun::star::uno::Reference
#define UNO3_RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
#define UNO3_SEQUENCE ::com::sun::star::uno::Sequence
#define UNO3_SIZE ::com::sun::star::awt::Size
#define UNO3_TYPE ::com::sun::star::uno::Type
#define UNO3_XACTIONLISTENER ::com::sun::star::awt::XActionListener
#define UNO3_XBUTTON ::com::sun::star::awt::XButton
#define UNO3_XCONTROLMODEL ::com::sun::star::awt::XControlModel
#define UNO3_XFIXEDTEXT ::com::sun::star::awt::XFixedText
#define UNO3_XGRAPHICS ::com::sun::star::awt::XGraphics
#define UNO3_XLAYOUTCONSTRAINS ::com::sun::star::awt::XLayoutConstrains
#define UNO3_XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory
#define UNO3_XPROGRESSBAR ::com::sun::star::awt::XProgressBar
#define UNO3_XPROGRESSMONITOR ::com::sun::star::awt::XProgressMonitor
#define UNO3_XTOOLKIT ::com::sun::star::awt::XToolkit
#define UNO3_XWINDOWPEER ::com::sun::star::awt::XWindowPeer
//____________________________________________________________________________________________________________
// defines
//____________________________________________________________________________________________________________
#define SERVICENAME_PROGRESSMONITOR "com.sun.star.awt.XProgressMonitor"
#define IMPLEMENTATIONNAME_PROGRESSMONITOR "stardiv.UnoControls.ProgressMonitor"
#define FREEBORDER 10 // border around and between the controls
#define WIDTH_RELATION 4 // reserve 1/4 for button width and rest for progressbar width
#define HEIGHT_RELATION 5 // reserve 1/5 for button and progressbar heigth and rest for text height
#define FIXEDTEXT_SERVICENAME "com.sun.star.awt.UnoControlFixedText"
#define BUTTON_SERVICENAME "com.sun.star.awt.UnoControlButton"
#define FIXEDTEXT_MODELNAME "com.sun.star.awt.UnoControlFixedTextModel"
#define BUTTON_MODELNAME "com.sun.star.awt.UnoControlButtonModel"
#define CONTROLNAME_TEXT "Text" // identifier the control in container
#define CONTROLNAME_BUTTON "Button" // -||-
#define CONTROLNAME_PROGRESSBAR "ProgressBar" // -||-
#define DEFAULT_BUTTONLABEL "Abbrechen"
#define DEFAULT_TOPIC "\0"
#define DEFAULT_TEXT "\0"
#define BACKGROUNDCOLOR TRGB_COLORDATA( 0x00, 0xC0, 0xC0, 0xC0 ) // lighgray
#define LINECOLOR_BRIGHT TRGB_COLORDATA( 0x00, 0xFF, 0xFF, 0xFF ) // white
#define LINECOLOR_SHADOW TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x00 ) // black
#define HEIGHT_PROGRESSBAR 15
// Overwrite defines from basecontrol.hxx!!!
#undef DEFAULT_WIDTH
#undef DEFAULT_HEIGHT
#define DEFAULT_WIDTH 350
#define DEFAULT_HEIGHT 100
//____________________________________________________________________________________________________________
// structs, types
//____________________________________________________________________________________________________________
/// Item of TextList
struct IMPL_TextlistItem
{
UNO3_OUSTRING sTopic ; /// Left site of textline in dialog
UNO3_OUSTRING sText ; /// Right site of textline in dialog
};
/// Define a list-class for struct IMPL_TextlistItem
class IMPL_Textlist ;
DECLARE_LIST( IMPL_Textlist, IMPL_TextlistItem* )
//____________________________________________________________________________________________________________
// class declaration
//____________________________________________________________________________________________________________
class ProgressMonitor : public UNO3_XLAYOUTCONSTRAINS
, public UNO3_XBUTTON
, public UNO3_XPROGRESSMONITOR
, public BaseContainerControl
{
//____________________________________________________________________________________________________________
// public methods
//____________________________________________________________________________________________________________
public:
//________________________________________________________________________________________________________
// construct/destruct
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
ProgressMonitor( const UNO3_REFERENCE< UNO3_XMULTISERVICEFACTORY >& xFactory );
/**_______________________________________________________________________________________________________
@short
@descr
@seealso
@param
@return
@onerror
*/
virtual ~ProgressMonitor();
//________________________________________________________________________________________________________
// XInterface
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short give answer, if interface is supported
@descr The interfaces are searched by type.
@seealso XInterface
@param "rType" is the type of searched interface.
@return Any information about found interface
@onerror A RuntimeException is thrown.
*/
virtual UNO3_ANY SAL_CALL queryInterface( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short increment refcount
@descr -
@seealso XInterface
@seealso release()
@param -
@return -
@onerror A RuntimeException is thrown.
*/
virtual void SAL_CALL acquire() throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short decrement refcount
@descr -
@seealso XInterface
@seealso acquire()
@param -
@return -
@onerror A RuntimeException is thrown.
*/
virtual void SAL_CALL release() throw( UNO3_RUNTIMEEXCEPTION );
//________________________________________________________________________________________________________
// XTypeProvider
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short get information about supported interfaces
@descr -
@seealso XTypeProvider
@param -
@return Sequence of types of all supported interfaces
@onerror A RuntimeException is thrown.
*/
virtual UNO3_SEQUENCE< UNO3_TYPE > SAL_CALL getTypes() throw( UNO3_RUNTIMEEXCEPTION );
//________________________________________________________________________________________________________
// XAggregation
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual UNO3_ANY SAL_CALL queryAggregation( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
//________________________________________________________________________________________________________
// XProgressMonitor
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short add topic to dialog
@descr Add a topic with a text in right textlist (used for FixedText-member).<BR>
( "beforeProgress" fix the right list ). The dialog metric is recalculated.
@seealso removeText(), updateText()
@param sTopic Name of topic<BR>
[sTopic != "" && sTopic != NULL]
@param sText Value of topic<BR>
[sText != "" && sText != NULL]
@param bbeforeProgress Position of topic<BR>
[True => before progressbar / False => below progressbar]
@return -
@onerror DEBUG = Assertion<BR>
RELEASE = nothing
*/
virtual void SAL_CALL addText( const UNO3_OUSTRING& sTopic ,
const UNO3_OUSTRING& sText ,
sal_Bool bbeforeProgress ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL removeText( const UNO3_OUSTRING& sTopic ,
sal_Bool bbeforeProgress ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL updateText( const UNO3_OUSTRING& sTopic ,
const UNO3_OUSTRING& sText ,
sal_Bool bbeforeProgress ) throw( UNO3_RUNTIMEEXCEPTION );
//________________________________________________________________________________________________________
// XProgressBar
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL setForegroundColor( sal_Int32 nColor ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL setBackgroundColor( sal_Int32 nColor ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL setValue( sal_Int32 nValue ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL setRange( sal_Int32 nMin ,
sal_Int32 nMax ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual sal_Int32 SAL_CALL getValue() throw( UNO3_RUNTIMEEXCEPTION );
//________________________________________________________________________________________________________
// XButton
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL addActionListener( const UNO3_REFERENCE< UNO3_XACTIONLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL removeActionListener( const UNO3_REFERENCE< UNO3_XACTIONLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL setLabel( const UNO3_OUSTRING& sLabel ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL setActionCommand( const UNO3_OUSTRING& sCommand ) throw( UNO3_RUNTIMEEXCEPTION );
//________________________________________________________________________________________________________
// XLayoutConstrains
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual UNO3_SIZE SAL_CALL getMinimumSize() throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual UNO3_SIZE SAL_CALL getPreferredSize() throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual UNO3_SIZE SAL_CALL calcAdjustedSize( const UNO3_SIZE& aNewSize ) throw( UNO3_RUNTIMEEXCEPTION );
//________________________________________________________________________________________________________
// XControl
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL createPeer( const UNO3_REFERENCE< UNO3_XTOOLKIT >& xToolkit ,
const UNO3_REFERENCE< UNO3_XWINDOWPEER >& xParent ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual sal_Bool SAL_CALL setModel( const UNO3_REFERENCE< UNO3_XCONTROLMODEL >& xModel ) throw( UNO3_RUNTIMEEXCEPTION );
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual UNO3_REFERENCE< UNO3_XCONTROLMODEL > SAL_CALL getModel() throw( UNO3_RUNTIMEEXCEPTION );
//________________________________________________________________________________________________________
// XComponent
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL dispose() throw( UNO3_RUNTIMEEXCEPTION );
//________________________________________________________________________________________________________
// XWindow
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void SAL_CALL setPosSize( sal_Int32 nX ,
sal_Int32 nY ,
sal_Int32 nWidth ,
sal_Int32 nHeight ,
sal_Int16 nFlags ) throw( UNO3_RUNTIMEEXCEPTION );
//________________________________________________________________________________________________________
// BaseControl
//________________________________________________________________________________________________________
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
static const UNO3_SEQUENCE< UNO3_OUSTRING > impl_getStaticSupportedServiceNames();
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
static const UNO3_OUSTRING impl_getStaticImplementationName();
//____________________________________________________________________________________________________________
// protected methods
//____________________________________________________________________________________________________________
protected:
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
virtual void impl_paint( sal_Int32 nX ,
sal_Int32 nY ,
const UNO3_REFERENCE< UNO3_XGRAPHICS >& xGraphics );
//____________________________________________________________________________________________________________
// private methods
//____________________________________________________________________________________________________________
private:
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
void impl_recalcLayout();
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
void impl_rebuildFixedText();
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
void impl_cleanMemory();
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
IMPL_TextlistItem* impl_searchTopic( const UNO3_OUSTRING& sTopic ,
sal_Bool bbeforeProgress );
//____________________________________________________________________________________________________________
// debug methods
//____________________________________________________________________________________________________________
private:
/**_______________________________________________________________________________________________________
@short -
@descr -
@seealso -
@param -
@return -
@onerror -
*/
#ifdef DBG_UTIL
sal_Bool impl_debug_checkParameter( const UNO3_OUSTRING& sTopic, const UNO3_OUSTRING& sText, sal_Bool bbeforeProgress ); // addText, updateText
sal_Bool impl_debug_checkParameter( const UNO3_OUSTRING& rTopic, sal_Bool bbeforeProgress ); // removeText
#endif
//____________________________________________________________________________________________________________
// private variables
//____________________________________________________________________________________________________________
private:
IMPL_Textlist* m_pTextlist_Top ; // Elements before progress
UNO3_REFERENCE< UNO3_XFIXEDTEXT > m_xTopic_Top ; // (used, if parameter "beforeProgress"=sal_True in "addText, updateText, removeText")
UNO3_REFERENCE< UNO3_XFIXEDTEXT > m_xText_Top ;
IMPL_Textlist* m_pTextlist_Bottom ; // Elements below of progress
UNO3_REFERENCE< UNO3_XFIXEDTEXT > m_xTopic_Bottom ; // (used, if parameter "beforeProgress"=sal_False in "addText, updateText, removeText")
UNO3_REFERENCE< UNO3_XFIXEDTEXT > m_xText_Bottom ;
UNO3_REFERENCE< UNO3_XPROGRESSBAR > m_xProgressBar ;
UNO3_REFERENCE< UNO3_XBUTTON > m_xButton ;
UNO3_RECTANGLE m_a3DLine ;
}; // class ProgressMonitor
} // namespace unocontrols
#endif // #ifndef _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX
+99
View File
@@ -0,0 +1,99 @@
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1.1.1 $
#
# last change: $Author: hr $ $Date: 2000-09-18 16:11:18 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
#
# - GNU Lesser General Public License Version 2.1
# - Sun Industry Standards Source License Version 1.1
#
# Sun Microsystems Inc., October, 2000
#
# GNU Lesser General Public License Version 2.1
# =============================================
# Copyright 2000 by Sun Microsystems, Inc.
# 901 San Antonio Road, Palo Alto, CA 94303, USA
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1, as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
#
# Sun Industry Standards Source License Version 1.1
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.1 (the "License"); You may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at http://www.openoffice.org/license.html.
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning the Software.
#
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
#
# Copyright: 2000 by Sun Microsystems, Inc.
#
# All Rights Reserved.
#
# Contributor(s): _______________________________________
#
#
#
#*************************************************************************
PRJ=..
PRJNAME=UnoControls
TARGET=ctl
LIBTARGET=NO
USE_LDUMP2=TRUE
USE_DEFFILE=TRUE
# --- Settings -----------------------------------------------------
.INCLUDE : $(PRJ)$/util$/makefile.pmk
# --- Files --------------------------------------------------------
LIB1TARGET= $(SLB)$/$(TARGET).lib
#LIB1OBJFILES= $(SLOFILES)
LIB1FILES= $(SLB)$/base.lib \
$(SLB)$/controls.lib
SHL1TARGET= $(TARGET)$(UPD)$(DLLPOSTFIX)
SHL1IMPLIB= i$(TARGET)
SHL1STDLIBS= \
$(CPPULIB) \
$(CPPUHELPERLIB) \
$(VOSLIB) \
$(SALLIB) \
$(TOOLSLIB)
SHL1DEPN= makefile.mk
SHL1LIBS= $(LIB1TARGET)
#SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
DEF1EXPORTFILE= exports.dxp
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
+64
View File
@@ -0,0 +1,64 @@
#*************************************************************************
#
# $RCSfile: makefile.pmk,v $
#
# $Revision: 1.1.1.1 $
#
# last change: $Author: hr $ $Date: 2000-09-18 16:11:18 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
#
# - GNU Lesser General Public License Version 2.1
# - Sun Industry Standards Source License Version 1.1
#
# Sun Microsystems Inc., October, 2000
#
# GNU Lesser General Public License Version 2.1
# =============================================
# Copyright 2000 by Sun Microsystems, Inc.
# 901 San Antonio Road, Palo Alto, CA 94303, USA
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1, as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
#
# Sun Industry Standards Source License Version 1.1
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.1 (the "License"); You may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at http://www.openoffice.org/license.html.
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning the Software.
#
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
#
# Copyright: 2000 by Sun Microsystems, Inc.
#
# All Rights Reserved.
#
# Contributor(s): _______________________________________
#
#
#
#*************************************************************************
.INCLUDE : svpre.mk
.INCLUDE : settings.mk
.INCLUDE : sv.mk
+70
View File
@@ -0,0 +1,70 @@
#*************************************************************************
#
# $RCSfile: target.pmk,v $
#
# $Revision: 1.1.1.1 $
#
# last change: $Author: hr $ $Date: 2000-09-18 16:11:18 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
#
# - GNU Lesser General Public License Version 2.1
# - Sun Industry Standards Source License Version 1.1
#
# Sun Microsystems Inc., October, 2000
#
# GNU Lesser General Public License Version 2.1
# =============================================
# Copyright 2000 by Sun Microsystems, Inc.
# 901 San Antonio Road, Palo Alto, CA 94303, USA
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1, as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
#
# Sun Industry Standards Source License Version 1.1
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.1 (the "License"); You may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at http://www.openoffice.org/license.html.
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning the Software.
#
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
#
# Copyright: 2000 by Sun Microsystems, Inc.
#
# All Rights Reserved.
#
# Contributor(s): _______________________________________
#
#
#
#*************************************************************************
ALLSLO: $(SLOFILES)
SOSHL: $(SHL1TARGETN)
WHOLEPRJ:
cd $(PRJ)$/prj
make debug linkinc prjpch compinc
@echo "READY"
+8
View File
@@ -0,0 +1,8 @@
mkdir: %_DEST%\inc%_EXT%\automation
..\%__SRC%\bin\sts%UPD%*.dll %_DEST%\bin%_EXT%\sts%UPD%*.dll
..\%__SRC%\lib\libsts* %_DEST%\lib%_EXT%\*
..\%__SRC%\lib\automation.lib %_DEST%\lib%_EXT%\automation.lib
hedabu: ..\inc\automation.hxx %_DEST%\inc%_EXT%\automation\automation.hxx
+231
View File
@@ -0,0 +1,231 @@
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1.1.1 $
#
# last change: $Author: hr $ $Date: 2000-09-18 16:11:22 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
#
# - GNU Lesser General Public License Version 2.1
# - Sun Industry Standards Source License Version 1.1
#
# Sun Microsystems Inc., October, 2000
#
# GNU Lesser General Public License Version 2.1
# =============================================
# Copyright 2000 by Sun Microsystems, Inc.
# 901 San Antonio Road, Palo Alto, CA 94303, USA
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1, as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
#
# Sun Industry Standards Source License Version 1.1
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.1 (the "License"); You may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at http://www.openoffice.org/license.html.
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning the Software.
#
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
#
# Copyright: 2000 by Sun Microsystems, Inc.
#
# All Rights Reserved.
#
# Contributor(s): _______________________________________
#
#
#
#*************************************************************************
PRJ=..
PRJNAME=automation
TARGET=automation
#basic.hid generieren
GEN_HID=TRUE
# --- Settings ---------------------------------------------------
.INCLUDE : svpre.mk
.INCLUDE : settings.mk
.INCLUDE : sv.mk
.IF "$(GUI)"=="WIN"
.IF "$(product)" != ""
LINKFLAGS=$(LINKFLAGS) /NOPACKC
.ENDIF
.ENDIF
.IF "$(depend)" == ""
# --- Allgemein ---------------------------------------------------
USE_LDUMP2=TRUE
.IF "$(header)" == ""
LIB1TARGET=$(SLB)$/$(TARGET).lib
LIB1FILES= \
$(SLB)$/server.lib
SHL1TARGET= sts$(UPD)$(DLLPOSTFIX)
SHL1IMPLIB= $(TARGET)
#SHL1STDLIBS= \
# $(TOOLSLIB) \
# $(SVTOOLLIB) \
# $(SVLLIB) \
# $(SVLIB) \
# $(VOSLIB) \
# $(SALLIB) \
$(SVMEMLIB) \
# $(SJLIB) \
# $(UNOTOOLSLIB)
#.IF "$(GUI)"=="WNT"
#SHL1STDLIBS+=$(LIBCIMT) \
# $(LIBPRE) advapi32.lib \
# $(LIBPRE) gdi32.lib
#.ENDIF
#.IF "$(SO3)" != ""
#SHL1STDLIBS+=\
# $(SOTLIB) \
# $(VOSLIB)
#.ENDIF
#SHL1DEPN= $(L)$/itools.lib $(SVLIBDEPEND) $(L)$/so2.lib $(L)$/svtool.lib
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
SHL1LIBS= $(SLB)$/$(TARGET).lib
DEF1NAME =$(SHL1TARGET)
DEF1DEPN = \
$(MISC)$/$(SHL1TARGET).flt
DEFLIB1NAME =$(TARGET)
DEF1DES =TestToolServer
# --- Targets -----------------------------------------------------------
ALL: $(LIB1TARGET) \
ALLTAR
#-------------------------------------------------------------------------
# Windows 3.x
#-------------------------------------------------------------------------
.IF "$(GUI)" == "WIN"
LINKFLAGS+=/NOCV /IG
LINK=$(DEVROOT)$/bin\optlinks\optlinks
$(MISC)$/$(PRJNAME).def: makefile.mk
echo NAME BASIC >$@
echo DESCRIPTION 'StarBASIC DevSystem (C)1994 STAR DIVISION GmbH'>>$@
echo EXETYPE WINDOWS >>$@
echo PROTMODE >>$@
echo STUB 'winSTUB.EXE' >>$@
echo CODE LOADONCALL MOVEABLE >>$@
echo DATA PRELOAD MULTIPLE MOVEABLE >>$@
echo HEAPSIZE 4096 >>$@
echo STACKSIZE 30000 >>$@
.ENDIF # GUI == WIN
#-------------------------------------------------------------------------
# MAC
#-------------------------------------------------------------------------
.IF "$(GUI)" == "MAC"
$(MISC)$/$(PRJNAME).def: makefile.mk
echo Kein def-File fuer Applikationen auf Mac
.ENDIF # GUI == MAC
#-------------------------------------------------------------------------
# OS/2
#-------------------------------------------------------------------------
.IF "$(GUI)" == "OS2"
$(MISC)$/$(PRJNAME).def: makefile.mk
.IF "$(COM)"!="WTC"
echo NAME BASIC WINDOWAPI >$@
echo DESCRIPTION 'StarBASIC DevSystem (C)1993 STAR DIVISION GmbH' >>$@
echo EXETYPE OS2 >>$@
echo PROTMODE >>$@
echo STUB 'OS2STUB.EXE' >>$@
echo CODE LOADONCALL >>$@
echo DATA PRELOAD MULTIPLE >>$@
echo HEAPSIZE 4096 >>$@
echo STACKSIZE 30000 >>$@
.ELSE
@echo option DESCRIPTION 'StarBasic DLL' >$@
@echo name $(BIN)$/$(SHL1TARGET).dll >>$@
# @ldump -E1 -A -F$(MISC)$/$(SHL1TARGET).flt $(SLB)$/sb.lib >>temp.def
@ldump -E1 -A -F$(MISC)$/$(SHL1TARGET).flt $(LIB1TARGET) >>temp.def
@awk -f s:\util\exp.awk temp.def
del temp.def
.ENDIF
.ENDIF # GUI == OS2
#-------------------------------------------------------------------------
# Windows NT
#-------------------------------------------------------------------------
#
# default targets aus target.mk
#
# --- Basic-Filter-Datei ---
$(MISC)$/$(SHL1TARGET).flt: makefile.mk
@echo ------------------------------
@echo Making: $@
@echo WEP > $@
@echo LIBMAIN >> $@
@echo LibMain >> $@
@echo Sbi >> $@
@echo exception >> $@
@echo bad_alloc >> $@
@echo __CT >> $@
.IF "$(GUI)"=="OS2"
@echo __alloc >> $@
@echo __malloc >> $@
.ENDIF
.ENDIF
# ------------------------------------------------------------------------
.ENDIF
.INCLUDE : target.mk
+79
View File
@@ -0,0 +1,79 @@
/*************************************************************************
*
* $RCSfile: appsettings.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _APPSETTINGS_HXX
#define _APPSETTINGS_HXX
#ifndef __STARDIV_UNO_UTIL_CONTAINR_HXX__
#include <stardiv/uno/util/containr.hxx>
#endif
#ifdef __cplusplus
extern "C" {
#endif
XNameContainer* getApplicationSettings();
#ifdef __cplusplus
}
#endif
#endif
+110
View File
@@ -0,0 +1,110 @@
/*************************************************************************
*
* $RCSfile: extensio.hrc,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef __EXTENSIONS_INC_EXTENSIO_HRC__
#define __EXTENSIONS_INC_EXTENSIO_HRC__
#include <svtools/solar.hrc>
#define HID_PROTOCOLS HID_EXTENSIONS_START
#define HID_BIB_CHANGESOURCE (HID_EXTENSIONS_START + 1)
#define HID_BIB_MAPPINGDLG (HID_EXTENSIONS_START + 2)
#define HID_BIB_TBX_TABLE (HID_EXTENSIONS_START + 3)
#define HID_BIB_TBX_SEARCH (HID_EXTENSIONS_START + 4)
#define HID_BIB_TBX_AUTOFILTER (HID_EXTENSIONS_START + 5)
#define HID_BIB_IDENTIFIER_POS (HID_EXTENSIONS_START + 6)
#define HID_BIB_AUTHORITYTYPE_POS (HID_EXTENSIONS_START + 7)
#define HID_BIB_AUTHOR_POS (HID_EXTENSIONS_START + 8)
#define HID_BIB_TITLE_POS (HID_EXTENSIONS_START + 9)
#define HID_BIB_YEAR_POS (HID_EXTENSIONS_START + 10)
#define HID_BIB_ISBN_POS (HID_EXTENSIONS_START + 11)
#define HID_BIB_BOOKTITLE_POS (HID_EXTENSIONS_START + 12)
#define HID_BIB_CHAPTER_POS (HID_EXTENSIONS_START + 13)
#define HID_BIB_EDITION_POS (HID_EXTENSIONS_START + 14)
#define HID_BIB_EDITOR_POS (HID_EXTENSIONS_START + 15)
#define HID_BIB_HOWPUBLISHED_POS (HID_EXTENSIONS_START + 16)
#define HID_BIB_INSTITUTION_POS (HID_EXTENSIONS_START + 17)
#define HID_BIB_JOURNAL_POS (HID_EXTENSIONS_START + 18)
#define HID_BIB_MONTH_POS (HID_EXTENSIONS_START + 19)
#define HID_BIB_NOTE_POS (HID_EXTENSIONS_START + 20)
#define HID_BIB_ANNOTE_POS (HID_EXTENSIONS_START + 21)
#define HID_BIB_NUMBER_POS (HID_EXTENSIONS_START + 22)
#define HID_BIB_ORGANIZATIONS_POS (HID_EXTENSIONS_START + 23)
#define HID_BIB_PAGES_POS (HID_EXTENSIONS_START + 24)
#define HID_BIB_PUBLISHER_POS (HID_EXTENSIONS_START + 25)
#define HID_BIB_ADDRESS_POS (HID_EXTENSIONS_START + 26)
#define HID_BIB_SCHOOL_POS (HID_EXTENSIONS_START + 27)
#define HID_BIB_SERIES_POS (HID_EXTENSIONS_START + 28)
#define HID_BIB_REPORTTYPE_POS (HID_EXTENSIONS_START + 29)
#define HID_BIB_VOLUME_POS (HID_EXTENSIONS_START + 30)
#define HID_BIB_URL_POS (HID_EXTENSIONS_START + 31)
#define HID_BIB_CUSTOM1_POS (HID_EXTENSIONS_START + 32)
#define HID_BIB_CUSTOM2_POS (HID_EXTENSIONS_START + 33)
#define HID_BIB_CUSTOM3_POS (HID_EXTENSIONS_START + 34)
#define HID_BIB_CUSTOM4_POS (HID_EXTENSIONS_START + 35)
#define HID_BIB_CUSTOM5_POS (HID_EXTENSIONS_START + 36)
#define HID_BIB_DB_TBX (HID_EXTENSIONS_START + 37)
#define HID_BIB_DB_GRIDCTRL (HID_EXTENSIONS_START + 38)
#endif
+401
View File
@@ -0,0 +1,401 @@
/*************************************************************************
*
* $RCSfile: ext_content.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _UCBHELPER_CONTENT_HXX_
#define _UCBHELPER_CONTENT_HXX_
#include <rtl/string.hxx>
#include <rtl/ustring>
#include <osl/mutex.hxx>
#include <osl/thread.h>
#include <cppuhelper/weak.hxx>
#ifndef _COM_SUN_STAR_UCB_XCOMMANDTASKPROCESSOR_HPP_
#include <com/sun/star/ucb/XCommandTaskProcessor.hpp>
#endif
#ifndef _COM_SUN_STAR_UCB_XCOMMANDINFO_HPP_
#include <com/sun/star/ucb/XCommandInfo.hpp>
#endif
#ifndef _COM_SUN_STAR_UCB_XCONTENT_HPP_
#include <com/sun/star/ucb/XContent.hpp>
#endif
#ifndef _COM_SUN_STAR_UCB_XPROPERTYTASKPROCESSOR_HPP_
#include <com/sun/star/ucb/XPropertyTaskProcessor.hpp>
#endif
#ifndef _COM_SUN_STAR_UCB_XCONTENTIDENTIFIER_HPP_
#include <com/sun/star/ucb/XContentIdentifier.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTIESCHANGELISTENER_HPP_
#include <com/sun/star/beans/XPropertiesChangeListener.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
#include <com/sun/star/lang/XComponent.hpp>
#endif
#include <list>
#include <hash_map>
#if defined(TF_TYPE) || (SUPD >= 564)
using namespace cppu;
#endif
using namespace com::sun::star::ucb;
using namespace com::sun::star::uno;
using namespace com::sun::star::beans;
using namespace com::sun::star::lang;
using namespace std;
using namespace rtl;
using namespace osl;
template <class Type> class safe_list : public osl::Mutex, public std::list< Type > {};
class OSimpleContentIdentifier : public OWeakObject,
public XContentIdentifier
{
private:
OUString Identifier;
OUString ProviderScheme;
public:
OSimpleContentIdentifier( const OUString& rIdentifier, const OUString& rProviderScheme );
// XInterface
#if defined(TF_TYPE) || (SUPD >= 564)
virtual Any SAL_CALL queryInterface( const Type &type ) throw( RuntimeException );
#else
virtual sal_Bool SAL_CALL queryInterface( const Uik& type, Any& ifc ) throw( RuntimeException );
#endif
virtual void SAL_CALL acquire() throw(RuntimeException);
virtual void SAL_CALL release() throw(RuntimeException);
// XContentIdentifier
virtual OUString SAL_CALL getContentIdentifier() throw(RuntimeException);
virtual OUString SAL_CALL getContentProviderScheme() throw(RuntimeException);
};
//---------------------------------------------------------------------------
//
// FileSystemContent
//
//---------------------------------------------------------------------------
class OContent :
public OWeakObject,
public XContent,
public XCommandTaskProcessor,
public XPropertyTaskProcessor,
public XCommandInfo,
public XPropertySetInfo,
public XComponent
{
public:
struct PropertyChangeEventInfo
{
OUString Name;
long Handle;
PropertyChangeEventInfo() : Handle( -1 ) {}
inline int operator ==( const PropertyChangeEventInfo& crInfo ) const
{ return Handle == crInfo.Handle && Handle > 0 || Name == crInfo.Name; }
#ifdef __SUNPRO_CC
inline int operator <( const PropertyChangeEventInfo& crInfo ) const
{ return Handle != crInfo.Handle ? Handle < crInfo.Handle : Name < crInfo.Name; }
#endif
};
struct PropertyChangeListenerInfo
{
Reference< XPropertiesChangeListener > xListener;
list< PropertyChangeEventInfo > aEventInfos;
inline int operator ==( const PropertyChangeListenerInfo& crInfo ) const
{ return xListener == crInfo.xListener; }
#ifdef __SUNPRO_CC
inline int operator <( const PropertyChangeListenerInfo& crInfo ) const
{ return xListener < crInfo.xListener; }
#endif
};
protected:
Sequence< PropertyChangeEvent > matchListenerEvents( const Sequence< PropertyChangeEvent >& crEvents, const PropertyChangeListenerInfo & crInfo );
safe_list< Reference< XContentEventListener > > m_aContentListeners;
safe_list< Reference< XEventListener > > m_aComponentListeners;
safe_list< PropertyChangeListenerInfo > m_aPropertyChangeListeners;
public:
virtual ~OContent() {}
virtual void broadcastContentEvent( const ContentEvent & crEvent );
virtual void broadcastPropertiesChangeEvents( const Sequence< PropertyChangeEvent >& crEvents );
// To be implemented by inheritents
virtual Any doCommand( const Command & crCommand ) = 0;
// XInterface
#if defined(TF_TYPE) || (SUPD >= 564)
virtual Any SAL_CALL queryInterface( const Type &type ) throw( RuntimeException );
#else
virtual sal_Bool SAL_CALL queryInterface( const Uik& type, Any& ifc ) throw( RuntimeException );
#endif
virtual void SAL_CALL acquire() throw(RuntimeException);
virtual void SAL_CALL release() throw(RuntimeException);
// XContent
virtual void SAL_CALL addContentEventListener( const Reference< XContentEventListener >& rListener ) throw();
virtual void SAL_CALL removeContentEventListener( const Reference< XContentEventListener >& rListener ) throw();
// XComponent
virtual void SAL_CALL dispose() throw();
virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw();
virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& xListener ) throw();
// XCommmandTaskProcessor
virtual Reference< XCommandInfo > SAL_CALL getCommandsInfo() throw();
// XCommandInfo
virtual CommandInfo SAL_CALL getCommandInfoByName( const OUString& rName ) throw( UnsupportedCommandException );
virtual CommandInfo SAL_CALL getCommandInfoByHandle( long nHandle ) throw( UnsupportedCommandException );
virtual sal_Bool SAL_CALL hasCommandByName( const OUString& rName ) throw();
virtual sal_Bool SAL_CALL hasCommandByHandle( long nHandle ) throw();
// XPropertyTaskProcessor
virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo() throw();
// XPropertySetInfo
virtual Property SAL_CALL getPropertyByName( const OUString& Name ) throw( UnknownPropertyException );
virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) throw();
virtual void SAL_CALL addPropertiesChangeListener( const Sequence< OUString >& Names, const Reference< XPropertiesChangeListener >& xListener ) throw();
virtual void SAL_CALL removePropertiesChangeListener( const Sequence< OUString >& Names, const Reference< XPropertiesChangeListener >& xListener ) throw();
};
//---------------------------------------------------------------------------
//
// FolderContent
//
//---------------------------------------------------------------------------
// supported Commands
static const sal_Int32 OPEN = 0;
static const sal_Int32 CLOSE = 1;
class OFolderContent : public OContent
{
protected:
// Already provided children
safe_list< XContent > m_aChildList;
// OContent
virtual Any doCommand( const Command & crCommand );
// new methods, can be overloaded
virtual Any doOpenCommand();
virtual Any doCloseCommand();
// To be implemented by inheritants
virtual Sequence< XContent > getAllChildren() = 0;
public:
// XCommmandTaskProcessor
virtual Reference< XCommandTask > SAL_CALL createCommandTask(const Command& rCommand, const Reference< XContentTaskEnvironment >& rEnvironment ) throw();
// XCommandInfo
virtual Sequence< CommandInfo > SAL_CALL getCommands() throw();
};
//---------------------------------------------------------------------------
//
// OContentTask
//
//---------------------------------------------------------------------------
class OContentTask :
public OWeakObject,
public XContentTask
{
Guard< OContent > m_aContentGuard;
protected:
OContent *m_pContent;
Reference< XContentTaskEnvironment > m_xEnvironment;
ContentTaskStatus m_eStatus;
oslThread m_aThread;
static void executeWorker( void * );
virtual ContentTaskStatus setStatus( ContentTaskStatus eStatus );
// To be implemented by inheritants
virtual void doExecute() = 0;
public:
OContentTask( const Reference< XContentTaskEnvironment >& xEnv, OContent *pContent );
virtual ~OContentTask();
// XInterface
#if defined(TF_TYPE) || (SUPD >= 564)
virtual Any SAL_CALL queryInterface( const Type &type ) throw( RuntimeException );
#else
virtual sal_Bool SAL_CALL queryInterface( const Uik& type, Any& ifc ) throw( RuntimeException );
#endif
virtual void SAL_CALL acquire() throw(RuntimeException);
virtual void SAL_CALL release() throw(RuntimeException);
// XContentTask
virtual void SAL_CALL start() throw();
virtual void SAL_CALL execute() throw( Exception );
virtual void SAL_CALL abort() throw();
virtual ContentTaskStatus SAL_CALL getStatus() throw();
virtual Reference< XContentTaskEnvironment > SAL_CALL getEnvironment() throw();
};
//---------------------------------------------------------------------------
//
// OCommandTask
//
//---------------------------------------------------------------------------
class OCommandTask :
public OContentTask,
public XCommandTask
{
protected:
Command m_aCommand;
Any m_aResult;
public:
OCommandTask( const Reference< XContentTaskEnvironment >& xEnv, OContent *pContent, const Command& rCommand );
virtual ~OCommandTask();
virtual void doExecute();
// XInterface
#if defined(TF_TYPE) || (SUPD >= 564)
virtual Any SAL_CALL queryInterface( const Type &type ) throw( RuntimeException );
#else
virtual sal_Bool SAL_CALL queryInterface( const Uik& type, Any& ifc ) throw( RuntimeException );
#endif
virtual void SAL_CALL acquire() throw(RuntimeException);
virtual void SAL_CALL release() throw(RuntimeException);
// XContentTask
virtual void SAL_CALL start() throw();
virtual void SAL_CALL execute() throw( Exception );
virtual void SAL_CALL abort() throw();
virtual ContentTaskStatus SAL_CALL getStatus() throw();
virtual Reference< XContentTaskEnvironment > SAL_CALL getEnvironment() throw();
// XCommandTask
virtual Command SAL_CALL getCommand() throw();
virtual Any SAL_CALL getResult() throw();
};
//---------------------------------------------------------------------------
//
// OPropertyTask
//
//---------------------------------------------------------------------------
class OPropertyTask :
public OContentTask,
public XPropertyTask
{
protected:
Sequence< PropertyValueInfo > m_aProperties;
PropertyTaskType m_eType;
public:
OPropertyTask(const Reference< XContentTaskEnvironment >& Environment, OContent *pContent, const Sequence< PropertyValue >& Properties, PropertyTaskType Type );
virtual ~OPropertyTask();
virtual void doExecute();
// To be implemented by inheritants
virtual Any setPropertyValue( PropertyValueInfo & rProperty ) = 0;
virtual void getPropertyValue( PropertyValueInfo & rProperty ) = 0;
// XInterface
#if defined(TF_TYPE) || (SUPD >= 564)
virtual Any SAL_CALL queryInterface( const Type &type ) throw( RuntimeException );
#else
virtual sal_Bool SAL_CALL queryInterface( const Uik& type, Any& ifc ) throw( RuntimeException );
#endif
virtual void SAL_CALL acquire() throw(RuntimeException);
virtual void SAL_CALL release() throw(RuntimeException);
// XContentTask
virtual void SAL_CALL start() throw();
virtual void SAL_CALL execute() throw( Exception );
virtual void SAL_CALL abort() throw();
virtual ContentTaskStatus SAL_CALL getStatus() throw();
virtual Reference< XContentTaskEnvironment > SAL_CALL getEnvironment() throw();
// XPropertyTask
PropertyTaskType SAL_CALL getType() throw();
Sequence< PropertyValueInfo > SAL_CALL getProperties() throw();
};
#endif // _UCBHELPER_CONTENT_HXX_
+7
View File
@@ -0,0 +1,7 @@
..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
..\%__SRC%\class\*.jar %_DEST%\bin%_EXT%\*.jar
..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\*.so
..\%__SRC%\lib\*.sl %_DEST%\lib%_EXT%\*.sl
..\%__SRC%\bin\*.bin %_DEST%\bin%_EXT%\*.bin
..\%__SRC%\misc\*.hid %_DEST%\bin%_EXT%\*.hid
..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res
+114
View File
@@ -0,0 +1,114 @@
/*************************************************************************
*
* $RCSfile: bib.hrc,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef BIB_HRC
#define BIB_HRC
#include <svtools/solar.hrc>
#ifndef RID_BIB_START
#define RID_BIB_START RID_EXTENSIONS_START
#endif
// ResIDs
//Dialogs (100)
#define RID_BIB_DIALOG (RID_BIB_START)
#define RID_TP_GENERAL (RID_BIB_DIALOG)
#define RID_DLG_MAPPING (RID_BIB_DIALOG + 1)
#define RID_DLG_DBCHANGE (RID_BIB_DIALOG + 2)
//Controls(100)
#define RID_BIB_CONTROLS (RID_BIB_START + 100)
#define RID_BIB_BMPEXPANDER (RID_BIB_CONTROLS)
#define RID_BIB_TOOLBAR (RID_BIB_CONTROLS+ 1)
//Menu(100)
#define RID_BIB_MENU (RID_BIB_CONTROLS + 100)
#define RID_MAIN_MENU (RID_BIB_MENU +1)
//#define RID_MAIN_ME_HIERARCHICAL (RID_BIB_MENU +2)
#define RID_MAIN_ME_NEWENTRY (RID_BIB_MENU +3)
#define RID_MAIN_ME_CHANGEENTRY (RID_BIB_MENU +4)
#define RID_MAIN_ME_REMOVEENTRY (RID_BIB_MENU +5)
#define RID_MAIN_ME_SEARCH (RID_BIB_MENU +6)
#define RID_MAIN_ME_FIELDDLG (RID_BIB_MENU +7)
//#define RID_MAIN_ME_LAYOUT (RID_BIB_MENU +8)
#define RID_MAIN_ME_MAPPING (RID_BIB_MENU +9)
#define RID_MAIN_ME_DBSOURCE (RID_BIB_MENU +10)
#define RID_POPUP_ME_VIEW (RID_BIB_MENU +50)
// Strings (500)
#define RID_BIB_STRING (RID_BIB_START + 200)
#define RID_BIB_STR_SECTION (RID_BIB_STRING + 1)
#define RID_BIB_STR_FIELDSELECTION (RID_BIB_STRING + 2)
#define RID_BIB_STR_TABWIN_PREFIX (RID_BIB_STRING + 3)
#define RID_BIB_STR_FRAME_TITLE (RID_BIB_STRING + 4)
#define RID_MAP_QUESTION (RID_BIB_STRING + 5)
// HelpIDs *** nicht bestaetigt ***
#ifndef HID_BIB_START
#define HID_BIB_START 5000
#define HID_DLG_MAPPING (HID_BIB_START + 1)
#define HID_DLG_DBCHANGE (HID_BIB_START + 2)
#define HID_SELECTION_TLB (HID_BIB_START + 3)
#endif
#endif
+187
View File
@@ -0,0 +1,187 @@
/*************************************************************************
*
* $RCSfile: bib.src,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning 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 "bib.hrc"
ImageList RID_BIB_BMPEXPANDER
{
ImageBitmap = Bitmap { File = "expander.bmp" ; };
IdList = { 1 ; 2 ; 3 ; 4 ; 5 ; 6 ; 7 ; 8 ; 9 ; };
IdCount = { 9 ; };
};
String RID_BIB_STR_SECTION
{
Text = "Abschnitt";
Text [ ENGLISH ] = "Section" ;
Text[ english_us ] = "Section";
Text[ portuguese ] = "Secção";
Text[ russian ] = "Ðàçäåë";
Text[ greek ] = "ÔïìÝáò";
Text[ dutch ] = "Sectie";
Text[ french ] = "Section";
Text[ spanish ] = "Sección";
Text[ italian ] = "Sezione";
Text[ danish ] = "Sektion";
Text[ swedish ] = "Avsnitt";
Text[ polish ] = "Sekcja";
Text[ portuguese_brazilian ] = "Section";
Text[ japanese ] = "¾¸¼®Ý";
Text[ korean ] = "±¸¿ª";
Text[ chinese_simplified ] = "¶ÎÂä";
Text[ chinese_traditional ] = "°Ï¬q";
Text[ arabic ] = "äØÇÞ";
Text[ turkish ] = "Bölüm";
};
String RID_BIB_STR_FIELDSELECTION
{
Text = "Feldauswahl:" ;
Text [ English ] = "Fieldselection:" ;
Text[ english_us ] = "Field selection:";
Text[ portuguese ] = "Selecção de campo:";
Text[ russian ] = "Âûáîð ïîëÿ:";
Text[ greek ] = "ÅðéëïãÞ ðåäßïõ:";
Text[ dutch ] = "Veldselectie:";
Text[ french ] = "Sélection de champ :";
Text[ spanish ] = "Selección de campo:";
Text[ italian ] = "Selezione campo:";
Text[ danish ] = "Feltudvalg:";
Text[ swedish ] = "Fälturval:";
Text[ polish ] = "Wybór pola:";
Text[ portuguese_brazilian ] = "Fieldselection:";
Text[ japanese ] = "̨°ÙÄÞ‘I‘ð:";
Text[ korean ] = "ÇÊµå ¼±ÅÃ:";
Text[ chinese_simplified ] = "ÇøÓòÑ¡Ôñ£º";
Text[ chinese_traditional ] = "¿ï¾ÜÄæ¦ì¡G";
Text[ arabic ] = "ÇÎÊíÇÑ ÇáÍÞá:";
Text[ turkish ] = "Alan seçimi:";
Text[ language_user1 ] = " ";
};
String RID_BIB_STR_TABWIN_PREFIX
{
Text = "Tabelle;Abfrage;Sql;Sql [Native]" ;
Text [ English ] = "Table;Query;Sql;Sql [Native]" ;
Text[ english_us ] = "Table;Query;Sql;Sql [Native]";
Text[ portuguese ] = "Tabela; Consulta; Sql;Sql [Native]";
Text[ russian ] = "Òàáëèöà;Çàïðîñ;Sql;Sql [Native]";
Text[ greek ] = "Ðßíáêáò;Åñþôçìá;Sql;Sql [Native]";
Text[ dutch ] = "Tabel;Query;Sql;Sql [Native]";
Text[ french ] = "Table;Requête;Sql;Sql [Natif]";
Text[ spanish ] = "Tabla;Consulta;Sql;Sql [Native]";
Text[ italian ] = "Tabella;Ricerca;Sql;Sql [native]";
Text[ danish ] = "Tabel;Forespørgsel;Sql;Sql [native]";
Text[ swedish ] = "Tabell;Sökning;Sql;Sql [Native]";
Text[ polish ] = "Tabela;Kwerenda;Sql;Sql [Native]";
Text[ portuguese_brazilian ] = "Table;Query;Sql;Sql [Native]";
Text[ japanese ] = "ðÌÞÙ;¸´Ø°;Sql;Sql [Native]";
Text[ korean ] = "Å×À̺í;ÁúÀÇ;Sql;Sql [Native]";
Text[ chinese_simplified ] = "±í¸ñ;²éѯ;Sql;Sql [Native]";
Text[ chinese_traditional ] = "ªí®æ;¬d¸ß;Sql;Sql [Native]";
Text[ arabic ] = "ÌÏæá;ÇÓÊÝÓÇÑ;Sql;Sql [Native]";
Text[ turkish ] = "Tablo;Sorgu;Sql;Sql [Native]";
};
String RID_BIB_STR_FRAME_TITLE
{
Text = "Literaturdatenbank" ;
Text [ English ] = "Bibliography database" ;
Text[ english_us ] = "Bibliography Database";
Text[ portuguese ] = "Base de dados bibliográfica";
Text[ russian ] = "Áàçà äàííûõ áèáëèîãðàôèè";
Text[ greek ] = "ÂÜóç äåäïìÝíùí âéâëéïãñáößáò";
Text[ dutch ] = "Literatuurdatabase";
Text[ french ] = "Base de données bibliographique";
Text[ spanish ] = "Base de datos bibliográfica";
Text[ italian ] = "Database bibliografico";
Text[ danish ] = "Litteraturdatabase";
Text[ swedish ] = "Litteraturdatabas";
Text[ polish ] = "Bibliograficzna baza danych";
Text[ portuguese_brazilian ] = "Bibliography database";
Text[ japanese ] = "‘ �‘ŠÇ—�ÃÞ°ÀÍÞ°½";
Text[ korean ] = "Âü°í¹®Çå µ¥ÀÌÅͺ£À̽º";
Text[ chinese_simplified ] = "ÎÄÏ×Êý¾Ý¿â";
Text[ chinese_traditional ] = "¤åÄm¸ê®Æ®w";
Text[ arabic ] = "ÞÇÚÏÉ ÈíÇäÇÊ ÇáãÑÇÌÚ";
Text[ turkish ] = "Kaynakça veritabaný";
};
String RID_MAP_QUESTION
{
Text = "Möchten Sie die Spaltenzuordnung bearbeiten?" ;
Text [ English ] = "Dow you want to edit the column arrangement" ;
Text[ english_us ] = "Do you want to edit the column arrangement?";
Text[ portuguese ] = "Editar disposição de colunas?";
Text[ russian ] = "Âû õîòèòå èçìåíèòü ðàçìåùåíèå êîëîíîê?";
Text[ greek ] = "ÈÝëåôå íá ãßíåé åðåîåñãáóßá ôçò áíôéóôïß÷éóçò óôçëþí;";
Text[ dutch ] = "Wilt u de kolomindeling veranderen?";
Text[ french ] = "Souhaitez-vous éditer l'assignation des colonnes ?";
Text[ spanish ] = "¿Desea modificar el orden de las columnas?";
Text[ italian ] = "Volete modificare l'ordine delle colonne?";
Text[ danish ] = "Vil du redigere kolonnetildelingen?";
Text[ swedish ] = "Vill Du redigera kolumntilldelningen?";
Text[ polish ] = "Chcesz edytowaæ przyporz¹dkowanie kolumn?";
Text[ portuguese_brazilian ] = "Dow you want to edit the column arrangement";
Text[ japanese ] = "—ñ‚Ì•ª—Þ‚ð•Ò�W‚µ‚Ü‚·‚©?";
Text[ korean ] = "¿­ ¹è¿­À» ÆíÁýÇϽðڽÀ´Ï±î?";
Text[ chinese_simplified ] = "ÄúÒª±à¼­ÁеÄÅÅÁÐ˳Ðò£¿";
Text[ chinese_traditional ] = "±z­n½s±ÆÄæ¡H";
Text[ arabic ] = "åá ÊÑíÏ ÊÍÑíÑ ÊÚííä ÇáÚãæÏ¿";
Text[ turkish ] = "Sütunlarý düzenlemek istiyor musunuz?";
};
+309
View File
@@ -0,0 +1,309 @@
/*************************************************************************
*
* $RCSfile: bibbeam.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _OSL_MUTEX_HXX_
#include <osl/mutex.hxx>
#endif
#ifndef _URLOBJ_HXX
#include <tools/urlobj.hxx>
#endif
#ifndef _TOOLKIT_UNOHLP_HXX
#include <toolkit/helper/vclunohelper.hxx>
#endif
#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
#include <unotools/processfactory.hxx>
#endif
#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_
#include <com/sun/star/awt/PosSize.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_XDISPATCH_HPP_
#include <com/sun/star/frame/XDispatch.hpp>
#endif
#ifndef _COM_SUN_STAR_UTIL_XURLTRANSFORMER_HPP_
#include <com/sun/star/util/XURLTransformer.hpp>
#endif
#include <svtools/iniprop.hxx>
#include <svtools/iniman.hxx>
#include <extensio.hrc>
#ifndef _SV_LSTBOX_HXX //autogen wg. form::component::ListBox
#include <vcl/lstbox.hxx>
#endif
#ifndef _SV_EDIT_HXX //autogen wg. Edit
#include <vcl/edit.hxx>
#endif
#ifndef _TOOLS_DEBUG_HXX //autogen wg. DBG_ASSERT
#include <tools/debug.hxx>
#endif
#include "bibbeam.hxx"
#include "toolbar.hrc"
#include "bibresid.hxx"
#include "datman.hxx"
using namespace rtl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::uno;
#define C2U(cChar) OUString::createFromAscii(cChar)
#define PROPERTY_FRAME 1
#define ID_TOOLBAR 1
#define ID_GRIDWIN 2
#define ID_ALPHAWIN 3
rtl::OUString gGridModelCommand( OUString::createFromAscii(".uno:Bib/newGridModel"));
BibGridwin::BibGridwin(Window* pParent, WinBits nStyle):
DockingWindow(pParent,nStyle)
{
aCtrContainer = VCLUnoHelper::CreateControlContainer(this);
}
BibGridwin::~BibGridwin()
{
}
void BibGridwin::Resize()
{
if(xGridWinRef.is())
{
::Size aSize = GetOutputSizePixel();
xGridWinRef->setPosSize(0, 0, aSize.Width(),aSize.Height(), PosSize::SIZE);
}
}
void BibGridwin::createGridWin(const uno::Reference< XControlModel > & xGModel)
{
xGridModel=xGModel;
if( aCtrContainer.is())
{
uno::Reference< lang::XMultiServiceFactory > xMgr = utl::getProcessServiceFactory();
if ( xGridModel.is() && xMgr.is())
{
uno::Reference< XPropertySet > xPropSet( xGridModel, UNO_QUERY );
if ( xPropSet.is() && xGridModel.is() )
{
uno::Any aAny = xPropSet->getPropertyValue( C2U("DefaultControl") );
rtl::OUString aControlName;
aAny >>= aControlName;
xControl=uno::Reference< XControl > (xMgr->createInstance( aControlName ), UNO_QUERY );
if ( xControl.is() )
{
xControl->setModel( xGridModel);
}
}
if ( xControl.is() )
{
// Peer als Child zu dem FrameWindow
aCtrContainer->addControl(C2U("Bla"), xControl);
xGridWinRef=uno::Reference< XWindow > (xControl, UNO_QUERY );
xGridWinRef->setVisible( sal_True );
xControl->setDesignMode(sal_False);
::Size aSize = GetOutputSizePixel();
xGridWinRef->setPosSize(0, 0, aSize.Width(),aSize.Height(), PosSize::POSSIZE);
// Window* pWindow = ::GetWindow( xGridWinRef );
// pWindow->SetHelpId(HID_BIB_DB_GRIDCTRL);
}
}
}
}
void BibGridwin::disposeGridWin()
{
if ( xControl.is() )
{
aCtrContainer->removeControl(xControl);
xControl->dispose();
}
}
void BibGridwin::changeGridModel(const uno::Reference< XControlModel > & xGModel)
{
xGridModel=xGModel;
if ( xControl.is() )
{
xControl->setModel( xGridModel);
}
}
void BibGridwin::statusChanged(const frame::FeatureStateEvent& rEvt)throw( uno::RuntimeException )
{
if(rEvt.FeatureURL.Complete == gGridModelCommand)
{
if(IsEnabled() != rEvt.IsEnabled) Enable(rEvt.IsEnabled);
uno::Any aModel=rEvt.State;
if(aModel.getValueType()==::getCppuType((Reference< XControlModel>*)0))
{
uno::Reference< XControlModel > xGModel=*(uno::Reference< XControlModel > *) aModel.getValue();
changeGridModel(xGModel);
}
}
};
BibBeamer::BibBeamer(Window* pParent,BibDataManager* pDM, WinBits nStyle):
SplitWindow(pParent,nStyle|WB_NOSPLITDRAW),
pDatMan(pDM),
pToolBar (NULL),
pGridWin (NULL),
pAlphaWin(NULL)
{
createToolBar();
createGridWin();
createAlphaWin();
pDatMan->SetToolbar(pToolBar);
pDatMan->SetGridWin(pGridWin);
}
BibBeamer::~BibBeamer()
{
if ( xToolBarRef.is() ) xToolBarRef->dispose();
if ( xGridRef.is() ) xGridRef->dispose();
if ( xAlphaRef.is() ) xAlphaRef->dispose();
if(pToolBar)
{
if(pDatMan)
{
pDatMan->SetToolbar(0);
pDatMan->SetGridWin(0);
}
delete pToolBar;
}
if(pGridWin)
{
pGridWin->disposeGridWin();
// delete pGridWin;
xpGridWin = 0;
}
if(pAlphaWin) delete pAlphaWin;
}
void BibBeamer::createToolBar()
{
pToolBar= new BibToolBar(this);
::Size aSize=pToolBar->GetSizePixel();
InsertItem(ID_TOOLBAR, pToolBar, aSize.Height(), 0, 0, SWIB_FIXED );
if(xController.is()) pToolBar->SetXController(xController);
}
void BibBeamer::createGridWin()
{
xpGridWin = pGridWin= new BibGridwin(this,0);
InsertItem(ID_GRIDWIN, pGridWin, 40, 1, 0, SWIB_RELATIVESIZE );
pGridWin->createGridWin(pDatMan->createGridModel());
}
void BibBeamer::createAlphaWin()
{
}
void BibBeamer::SetXController(const uno::Reference< frame::XController > & xCtr)
{
xController=xCtr;
if(xController.is())
{
uno::Reference< frame::XDispatch > xDisp(xController, UNO_QUERY);
uno::Reference< lang::XMultiServiceFactory > xMgr = utl::getProcessServiceFactory();
uno::Reference< util::XURLTransformer > xTrans ( xMgr->createInstance( C2U("com.sun.star.util.URLTransformer") ), UNO_QUERY );
if( xTrans.is() && xDisp.is())
{
util::URL aURL;
aURL.Complete =gGridModelCommand;
xTrans->parseStrict( aURL );
xDisp->addStatusListener(uno::Reference< frame::XStatusListener > (pGridWin),aURL);
}
}
if(pToolBar)
{
pToolBar->SetXController(xController);
}
}
+169
View File
@@ -0,0 +1,169 @@
/*************************************************************************
*
* $RCSfile: bibbeam.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef ADRBEAM_HXX
#define ADRBEAM_HXX
#ifndef _COM_SUN_STAR_AWT_XCONTROLCONTAINER_HPP_
#include <com/sun/star/awt/XControlContainer.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_
#include <com/sun/star/awt/XControl.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XCONTROLMODEL_HPP_
#include <com/sun/star/awt/XControlModel.hpp>
#endif
#ifndef _COM_SUN_STAR_FORM_XFORM_HPP_
#include <com/sun/star/form/XForm.hpp>
#endif
#ifndef _CPPUHELPER_IMPLBASE1_HXX_
#include <cppuhelper/implbase1.hxx> // helper for implementations
#endif
#ifndef _SV_SPLITWIN_HXX
#include <vcl/splitwin.hxx>
#endif
#ifndef _BIB_TOOLBAR_HXX
#include "toolbar.hxx"
#endif
extern rtl::OUString gGridModelCommand;
class BibDataManager;
class BibGridwin: public DockingWindow,
public cppu::WeakImplHelper1 < ::com::sun::star::frame::XStatusListener>
{
private:
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xGridWinRef;
::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > xForm;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xGridModel;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xControl;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > aCtrContainer;
protected:
void Resize();
public:
BibGridwin(Window* pParent, WinBits nStyle = 0 );
~BibGridwin();
void createGridWin(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & xDbForm);
void changeGridModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & xGModel);
void disposeGridWin();
// ::com::sun::star::lang::XEventListener
// we do not hold References to dispatches, so there is nothing to do on disposal
virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source)
throw( ::com::sun::star::uno::RuntimeException ){};
// ::com::sun::star::frame::XStatusListener
virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
throw( ::com::sun::star::uno::RuntimeException );
};
class BibBeamer: public SplitWindow
{
private:
BibDataManager* pDatMan;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > xController;
::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > xForm;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xToolBarRef;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xGridRef;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xAlphaRef;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xToolBarWinRef;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xGridWinRef;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xAlphaWinRef;
BibToolBar* pToolBar;
BibGridwin* pGridWin;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener> xpGridWin;
DockingWindow* pAlphaWin;
protected:
void createToolBar();
void createGridWin();
void createAlphaWin();
public:
BibBeamer(Window* pParent,BibDataManager* pDatMan, WinBits nStyle = 0 );
~BibBeamer();
void SetXController(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > &);
};
#endif
+372
View File
@@ -0,0 +1,372 @@
/*************************************************************************
*
* $RCSfile: bibcont.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning 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 <osl/mutex.hxx>
#include <tools/urlobj.hxx>
#include <cppuhelper/weak.hxx>
#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
#include <unotools/processfactory.hxx>
#endif
#include <toolkit/helper/vclunohelper.hxx>
#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_XDISPATCHPROVIDER_HPP_
#include <com/sun/star/frame/XDispatchProvider.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HPP_
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#endif
#ifndef _COM_SUN_STAR_UTIL_XURLTRANSFORMER_HPP_
#include <com/sun/star/util/XURLTransformer.hpp>
#endif
#include <svtools/iniprop.hxx>
#include <svtools/iniman.hxx>
#include "datman.hxx"
#include "bibcont.hxx"
using namespace vos;
using namespace osl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::frame;
using namespace ::rtl;
#define C2U(cChar) OUString::createFromAscii(cChar)
#define PROPERTY_FRAME 1
BibWindowContainer::BibWindowContainer( Window* pParent,WinBits nStyle):
DockingWindow(pParent,nStyle),
pChild(NULL)
{
}
BibWindowContainer::BibWindowContainer( Window* pParent,Window* pWin, WinBits nStyle):
DockingWindow(pParent,nStyle),
pChild(pWin)
{
if(pChild!=NULL)
{
pChild->SetParent(this);
pChild->Show();
pChild->SetPosPixel(Point(0,0));
}
}
BibWindowContainer::~BibWindowContainer()
{
if(pChild!=NULL) delete pChild;
}
void BibWindowContainer::Resize()
{
::Size aSize=GetOutputSizePixel();
if(pChild!=NULL) pChild->SetSizePixel(aSize);
}
void BibWindowContainer::SetChild(Window* pWin)
{
pChild=pWin;
if(pChild!=NULL)
{
pChild->SetParent(this);
pChild->Show();
pChild->SetPosPixel(Point(0,0));
}
}
BibBookContainer::BibBookContainer(Window* pParent,BibDataManager* pDtMn, WinBits nStyle):
SplitWindow(pParent,nStyle),
pDatMan(pDtMn),
pTopWin(NULL),
pBottomWin(NULL),
bFirstTime(sal_True)
{
pBibMod = OpenBibModul();
aTimer.SetTimeoutHdl(LINK( this, BibBookContainer, SplitHdl));
aTimer.SetTimeout(400);
}
BibBookContainer::~BibBookContainer()
{
if ( xTopFrameRef.is() )
xTopFrameRef->dispose();
if ( xBottomFrameRef.is() )
xBottomFrameRef->dispose();
if(pTopWin)
delete pTopWin;
if(pBottomWin)
delete pBottomWin;
CloseBibModul(pBibMod);
}
void BibBookContainer::Split()
{
aTimer.Start();
}
IMPL_LINK( BibBookContainer, SplitHdl, Timer*,pT)
{
long nSize= GetItemSize( TOP_WINDOW);
pDatMan->setBeamerSize(nSize);
nSize= GetItemSize( BOTTOM_WINDOW);
pDatMan->setViewSize(nSize);
return 0;
}
uno::Reference < awt::XWindowPeer> BibBookContainer::GetTopComponentInterface( sal_Bool bCreate)
{
return pTopWin->GetComponentInterface(bCreate);
}
void BibBookContainer::SetTopComponentInterface( awt::XWindowPeer* pIFace )
{
pTopWin->SetComponentInterface(pIFace);
}
uno::Reference < awt::XWindowPeer > BibBookContainer::GetBottomComponentInterface( sal_Bool bCreate)
{
return pBottomWin->GetComponentInterface(bCreate);
}
void BibBookContainer::SetBottomComponentInterface( awt::XWindowPeer* pIFace )
{
pBottomWin->SetComponentInterface(pIFace);
}
/*VCLXWindow* BibBookContainer::GetTopWindowPeer()
{
return pTopWin->GetWindowPeer();
}
*//*void BibBookContainer::SetTopWindowPeer( VCLXWindow* pPeer )
{
pTopWin->SetWindowPeer(pPeer );
}
*/
/*VCLXWindow* BibBookContainer::GetBottomWindowPeer()
{
return pBottomWin->GetWindowPeer();
}
*//*void BibBookContainer::SetBottomWindowPeer( VCLXWindow* pPeer )
{
pBottomWin->SetWindowPeer(pPeer );
}
*/
void BibBookContainer::CreateTopWin()
{
if ( xTopFrameRef.is() ) xTopFrameRef->dispose();
if(pTopWin)
{
RemoveItem(TOP_WINDOW);
delete pTopWin;
}
pTopWin= new DockingWindow(this,0);
long nSize=pDatMan->getBeamerSize();
InsertItem(TOP_WINDOW, pTopWin, nSize, 0, 0, SWIB_PERCENTSIZE );
}
void BibBookContainer::CreateBottomWin()
{
if ( xBottomFrameRef.is() ) xBottomFrameRef->dispose();
if(pBottomWin)
{
RemoveItem(BOTTOM_WINDOW);
delete pBottomWin;
}
pBottomWin= new DockingWindow(this,0);
long nSize=pDatMan->getViewSize();
InsertItem(BOTTOM_WINDOW, pBottomWin, nSize, 1, 0, SWIB_PERCENTSIZE );
}
void BibBookContainer::createTopFrame(const ::rtl::OUString & rURL )
{
uno::Reference< frame::XFrame > xNewFrame;
CreateTopWin();
xTopPeerRef=uno::Reference< awt::XWindow > (GetTopComponentInterface(), UNO_QUERY );
uno::Reference< lang::XMultiServiceFactory > xMgr = utl::getProcessServiceFactory();
xNewFrame = uno::Reference< frame::XFrame > ( xMgr->createInstance( C2U("com.sun.star.frame.Frame") ), UNO_QUERY );
uno::Reference< frame::XDispatchProvider > xDSP( xNewFrame, UNO_QUERY );
if( xDSP.is() )
{
xNewFrame->initialize( xTopPeerRef);
// optional:
//xFrame->setName( C2U("WhatYouWant") );
uno::Reference< util::XURLTransformer > xTrans ( xMgr->createInstance( C2U("com.sun.star.util.URLTransformer") ), UNO_QUERY );
if( xTrans.is() )
{
// Datei laden
util::URL aURL;
aURL.Complete = rURL;
xTrans->parseStrict( aURL );
uno::Reference< frame::XDispatch > xDisp = xDSP->queryDispatch( aURL, C2U("_self"), FrameSearchFlag::SELF );
if ( xDisp.is() )
xDisp->dispatch( aURL, uno::Sequence<beans::PropertyValue>() );
}
}
// set the frame
{
MutexGuard aGuard(Mutex::getGlobalMutex());
xTopFrameRef = xNewFrame;
}
}
void BibBookContainer::createBottomFrame(const ::rtl::OUString & rURL )
{
uno::Reference< frame::XFrame > xNewFrame;
CreateBottomWin();
xBottomPeerRef=uno::Reference< awt::XWindow > (GetBottomComponentInterface(), UNO_QUERY );
uno::Reference< lang::XMultiServiceFactory > xMgr = utl::getProcessServiceFactory();
xNewFrame = uno::Reference< frame::XFrame > ( xMgr->createInstance( C2U("com.sun.star.frame.Frame") ), UNO_QUERY );
uno::Reference< frame::XDispatchProvider > xDSP( xNewFrame, UNO_QUERY );
if( xDSP.is() )
{
xNewFrame->initialize( xBottomPeerRef);
// optional:
//xFrame->setName( C2U("WhatYouWant") );
uno::Reference< util::XURLTransformer > xTrans ( xMgr->createInstance( C2U("com.sun.star.util.URLTransformer") ), UNO_QUERY );
if( xTrans.is() )
{
// Datei laden
util::URL aURL;
aURL.Complete = rURL;
xTrans->parseStrict( aURL );
uno::Reference< frame::XDispatch > xDisp = xDSP->queryDispatch( aURL, ::rtl::OUString(), FrameSearchFlag::SELF );
if ( xDisp.is() )
xDisp->dispatch( aURL, uno::Sequence<beans::PropertyValue>() );
}
}
// set the frame
{
MutexGuard aGuard(Mutex::getGlobalMutex());
xBottomFrameRef = xNewFrame;
}
}
void BibBookContainer::createTopFrame(Window* pWin)
{
if ( xTopFrameRef.is() ) xTopFrameRef->dispose();
if(pTopWin)
{
RemoveItem(TOP_WINDOW);
delete pTopWin;
}
pTopWin=new BibWindowContainer(this,pWin);
long nSize=pDatMan->getBeamerSize();
InsertItem(TOP_WINDOW, pTopWin, nSize, 1, 0, SWIB_PERCENTSIZE );
}
void BibBookContainer::createBottomFrame(Window* pWin)
{
if ( xBottomFrameRef.is() ) xBottomFrameRef->dispose();
if(pBottomWin)
{
RemoveItem(BOTTOM_WINDOW);
delete pBottomWin;
}
pBottomWin=new BibWindowContainer(this,pWin);
long nSize=pDatMan->getViewSize();
InsertItem(BOTTOM_WINDOW, pBottomWin, nSize, 1, 0, SWIB_PERCENTSIZE );
}
+158
View File
@@ -0,0 +1,158 @@
/*************************************************************************
*
* $RCSfile: bibcont.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef ADDRCONT_HXX
#define ADDRCONT_HXX
#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
#include <com/sun/star/frame/XFrame.hpp>
#endif
#ifndef _SV_SPLITWIN_HXX
#include <vcl/splitwin.hxx>
#endif
#ifndef _SV_TIMER_HXX //autogen wg. Timer
#include <vcl/timer.hxx>
#endif
#include "bibmod.hxx"
#define TOP_WINDOW 1
#define BOTTOM_WINDOW 2
class BibDataManager;
class BibWindowContainer: public DockingWindow
{
private:
Window* pChild;
protected:
virtual void Resize();
public:
BibWindowContainer( Window* pParent,WinBits nStyle = 0);
BibWindowContainer( Window* pParent,Window* pChild, WinBits nStyle = 0 );
~BibWindowContainer();
Window* GetChild(){return pChild;}
void SetChild(Window* pWin);
};
class BibBookContainer: public SplitWindow
{
private:
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xTopFrameRef;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xBottomFrameRef;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xTopPeerRef;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xBottomPeerRef;
sal_Bool bFirstTime;
DockingWindow* pTopWin;
DockingWindow* pBottomWin;
BibDataManager* pDatMan;
HdlBibModul pBibMod;
Timer aTimer;
DECL_LINK( SplitHdl, Timer*);
protected:
virtual void Split();
void CreateTopWin();
void CreateBottomWin();
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > GetTopComponentInterface( sal_Bool bCreate = sal_True );
void SetTopComponentInterface( ::com::sun::star::awt::XWindowPeer* pIFace );
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > GetBottomComponentInterface( sal_Bool bCreate = sal_True );
void SetBottomComponentInterface( ::com::sun::star::awt::XWindowPeer* pIFace );
// VCLXWindow* GetTopWindowPeer();
// void SetTopWindowPeer( VCLXWindow* pPeer );
// VCLXWindow* GetBottomWindowPeer();
// void SetBottomWindowPeer( VCLXWindow* pPeer );
public:
BibBookContainer(Window* pParent,BibDataManager*, WinBits nStyle = 0 );
~BibBookContainer();
DockingWindow* GetTopWin() {return pTopWin;}
DockingWindow* GetBottomWin() {return pBottomWin;}
void createTopFrame(const rtl::OUString & rURL );
void createBottomFrame(const rtl::OUString & rURL );
void createTopFrame(Window* pWin);
void createBottomFrame(Window* pWin);
};
#endif
+881
View File
@@ -0,0 +1,881 @@
/*************************************************************************
*
* $RCSfile: bibload.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _OSL_MUTEX_HXX_
#include <osl/mutex.hxx>
#endif
#ifndef _URLOBJ_HXX
#include <tools/urlobj.hxx>
#endif
#ifndef _CPPUHELPER_WEAK_HXX_
#include <cppuhelper/weak.hxx>
#endif
#ifndef _SFX_ITEMPROP_HXX
#include <svtools/itemprop.hxx>
#endif
#ifndef _UNO_ENVIRONMENT_H_
#include <uno/environment.h>
#endif
#ifndef SVTOOLS_URIHELPER_HXX
#include <svtools/urihelper.hxx>
#endif
#ifndef _TOOLKIT_UNOHLP_HXX
#include <toolkit/helper/vclunohelper.hxx>
#endif
#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
#include <unotools/processfactory.hxx>
#endif
#ifndef _CPPUHELPER_FACTORY_HXX_
#include <cppuhelper/factory.hxx> // helper for factories
#endif
#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_
#include <com/sun/star/sdbc/ResultSetType.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_
#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
#endif
#ifndef _COM_SUN_STAR_SDB_XCOLUMN_HPP_
#include <com/sun/star/sdb/XColumn.hpp>
#endif
#ifndef _COM_SUN_STAR_UTIL_XURLTRANSFORMER_HPP_
#include <com/sun/star/util/XURLTransformer.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_XROWSET_HPP_
#include <com/sun/star/sdbc/XRowSet.hpp>
#endif
#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_
#include <com/sun/star/sdb/CommandType.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_XFRAMELOADER_HPP_
#include <com/sun/star/frame/XFrameLoader.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
#include <com/sun/star/lang/XServiceInfo.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
#include <com/sun/star/beans/PropertyAttribute.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
#include <com/sun/star/container/XNameAccess.hpp>
#endif
#ifndef _COM_SUN_STAR_TEXT_BIBLIOGRAPHYDATAFIELD_HPP_
#include <com/sun/star/text/BibliographyDataField.hpp>
#endif
#ifndef _SV_WINDOW_HXX
#include <vcl/window.hxx>
#endif
#ifndef _SV_EDIT_HXX
#include <vcl/edit.hxx>
#endif
#ifndef _SV_SVAPP_HXX
#include <vcl/svapp.hxx>
#endif
#ifndef _SV_GROUP_HXX //autogen wg. form
#include <vcl/group.hxx>
#endif
#ifndef _SFXINIPROP_HXX
#include <svtools/iniprop.hxx>
#endif
#ifndef _SFXINIMGR_HXX
#include <svtools/iniman.hxx>
#endif
#ifndef _SVEDIT_HXX
#include <svtools/svmedit.hxx>
#endif
#ifndef BIB_HRC
#include "bib.hrc"
#endif
#ifndef ADDRCONT_HXX
#include "bibcont.hxx"
#endif
#ifndef ADRBEAM_HXX
#include "bibbeam.hxx"
#endif
#ifndef ADDRMOD_HXX
#include "bibmod.hxx"
#endif
#ifndef _BIB_VIEW_HXX
#include "bibview.hxx"
#endif
#ifndef _BIB_FRAMECTR_HXX
#include "framectr.hxx"
#endif
#ifndef _BIB_DATMAN_HXX
#include "datman.hxx"
#endif
#ifndef _CPPUHELPER_IMPLBASE4_HXX_
#include <cppuhelper/implbase4.hxx> // helper for implementations
#endif
using namespace ::rtl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbc;
#define C2U(cChar) OUString::createFromAscii(cChar)
//-----------------------------------------------------------------------------
#define PROPERTY_FRAME 1
class BibliographyLoader : public cppu::WeakImplHelper4
<
XServiceInfo,
container::XNameAccess,
XPropertySet,
frame::XFrameLoader
>
{
HdlBibModul pBibMod;
Reference< XPropertyChangeListener > xDatMan;
BibDataManager* pDatMan;
Reference< container::XNameAccess > xColumns;
Reference< XResultSet > xCursor;
private:
void loadView(const Reference< frame::XFrame > & aFrame, const rtl::OUString& aURL,
const Sequence< PropertyValue >& aArgs,
const Reference< frame::XLoadEventListener > & aListener);
BibDataManager* GetDataManager()const;
Reference< container::XNameAccess > GetDataColumns() const;
Reference< XResultSet > GetDataCursor() const;
Reference< sdb::XColumn > GetIdentifierColumn() const;
public:
BibliographyLoader();
~BibliographyLoader();
// XServiceInfo
rtl::OUString SAL_CALL getImplementationName() throw( );
sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( );
Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( );
static rtl::OUString getImplementationName_Static() throw( )
{
//!
return C2U("com.sun.star.extensions.Bibliography");
//!
}
//XNameAccess
virtual Any SAL_CALL getByName(const rtl::OUString& aName) throw ( container::NoSuchElementException, WrappedTargetException, RuntimeException );
virtual Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw ( RuntimeException );
virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& aName) throw ( RuntimeException );
//XElementAccess
virtual Type SAL_CALL getElementType(void) throw ( RuntimeException );
virtual sal_Bool SAL_CALL hasElements(void) throw ( RuntimeException );
//XPropertySet
virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo(void) throw ( RuntimeException );
virtual void SAL_CALL setPropertyValue(const rtl::OUString& PropertyName, const Any& aValue) throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException );
virtual Any SAL_CALL getPropertyValue(const rtl::OUString& PropertyName) throw ( UnknownPropertyException, WrappedTargetException, RuntimeException );
virtual void SAL_CALL addPropertyChangeListener(const rtl::OUString& PropertyName, const Reference< XPropertyChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException );
virtual void SAL_CALL removePropertyChangeListener(const rtl::OUString& PropertyName, const Reference< XPropertyChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException );
virtual void SAL_CALL addVetoableChangeListener(const rtl::OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException );
virtual void SAL_CALL removeVetoableChangeListener(const rtl::OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException );
static Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames_Static(void) throw( );
friend Reference< XInterface > SAL_CALL BibliographyLoader_CreateInstance( const Reference< XMultiServiceFactory > & rSMgr ) throw( Exception );
// XLoader
virtual void SAL_CALL load(const Reference< frame::XFrame > & aFrame, const rtl::OUString& aURL,
const Sequence< PropertyValue >& aArgs,
const Reference< frame::XLoadEventListener > & aListener);
virtual void SAL_CALL cancel(void);
};
BibliographyLoader::BibliographyLoader() :
pBibMod(0),
pDatMan(0)
{
}
BibliographyLoader::~BibliographyLoader()
{
if(pBibMod)
CloseBibModul(pBibMod);
}
Reference< XInterface > SAL_CALL BibliographyLoader_CreateInstance( const Reference< XMultiServiceFactory > & rSMgr ) throw( Exception )
{
return *(new BibliographyLoader);
}
// XServiceInfo
rtl::OUString BibliographyLoader::getImplementationName() throw( )
{
return getImplementationName_Static();
}
// XServiceInfo
sal_Bool BibliographyLoader::supportsService(const rtl::OUString& ServiceName) throw( )
{
Sequence< rtl::OUString > aSNL = getSupportedServiceNames();
const rtl::OUString * pArray = aSNL.getConstArray();
for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
if( pArray[i] == ServiceName )
return sal_True;
return sal_False;
}
// XServiceInfo
Sequence< rtl::OUString > BibliographyLoader::getSupportedServiceNames(void) throw( )
{
return getSupportedServiceNames_Static();
}
// ORegistryServiceManager_Static
Sequence< rtl::OUString > BibliographyLoader::getSupportedServiceNames_Static(void) throw( )
{
Sequence< rtl::OUString > aSNS( 2 );
aSNS.getArray()[0] = C2U("com.sun.star.frame.FrameLoader");
//!
aSNS.getArray()[1] = C2U("com.sun.star.frame.Bibliography");
//!
return aSNS;
}
extern "C"
{
void SAL_CALL component_getImplementationEnvironment(
const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
{
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
sal_Bool SAL_CALL component_writeInfo( void * //pServiceManager
, registry::XRegistryKey * pRegistryKey )
{
try
{
rtl::OUString sKey = rtl::OUString::createFromAscii("/");
sKey += BibliographyLoader::getImplementationName_Static();
//creates the impl key: /com.sun.star.extensions.Bibliography
Reference< registry::XRegistryKey > xImplKey = pRegistryKey->createKey(sKey);
//sKey += rtl::OUString::createFromAscii("/UNO/SERVICES");
Reference< registry::XRegistryKey > xNewKey = xImplKey->createKey( C2U("/UNO/SERVICES") );
Sequence< rtl::OUString > aServices = BibliographyLoader::getSupportedServiceNames_Static();
for( INT32 i = 0; i < aServices.getLength(); i++ )
xNewKey->createKey( aServices.getConstArray()[i]);
xNewKey = xImplKey->createKey( C2U("/UNO/Loader"));
Reference< registry::XRegistryKey > xPatternKey = xImplKey->createKey( C2U("/Loader/Pattern" ));
xPatternKey->setAsciiValue( C2U( ".component:Bibliography/*" ) );
return sal_True;
}
catch (Exception &)
{
return sal_False;
}
}
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, XMultiServiceFactory * pServiceManager, void * /*pRegistryKey*/ )
{
void * pRet = 0;
if (!BibliographyLoader::getImplementationName_Static().compareToAscii( pImplName ) )
{
// create the factory
Reference< XSingleServiceFactory > xFactory =
cppu::createSingleFactory(
pServiceManager,
BibliographyLoader::getImplementationName_Static(),
BibliographyLoader_CreateInstance,
BibliographyLoader::getSupportedServiceNames_Static() );
// acquire, because we return an interface pointer instead of a reference
xFactory->acquire();
pRet = xFactory.get();
}
return pRet;
}
}
// -----------------------------------------------------------------------
void BibliographyLoader::cancel(void)
{
//!
//!
}
// -----------------------------------------------------------------------
void BibliographyLoader::load(const Reference< frame::XFrame > & rFrame, const rtl::OUString& rURL,
const Sequence< PropertyValue >& rArgs,
const Reference< frame::XLoadEventListener > & rListener)
{
//!
pBibMod = OpenBibModul();
String aURLStr( rURL );
String aPartName = aURLStr.GetToken( 1, '/' );
if(aPartName.EqualsAscii("View") || aPartName.EqualsAscii("View1"))
{
loadView(rFrame, rURL, rArgs, rListener);
}
}
// -----------------------------------------------------------------------
void BibliographyLoader::loadView(const Reference< frame::XFrame > & rFrame, const rtl::OUString& rURL,
const Sequence< PropertyValue >& rArgs,
const Reference< frame::XLoadEventListener > & rListener)
{
//!
if(!pBibMod)
pBibMod = OpenBibModul();
BibDataManager* pDatMan=(*pBibMod)->createDataManager();
xDatMan = pDatMan;
String sTableName;
rtl::OUString aBibUrl=BibModul::GetBibliographyURL(&sTableName);
Reference< form::XForm > xForm = pDatMan->createDatabaseForm(aBibUrl, OUString(sTableName));
if(xForm.is())
{
Reference< awt::XWindow > aWindow = rFrame->getContainerWindow();
Window* pParent = VCLUnoHelper::GetWindow( aWindow );
BibBookContainer *pMyWindow = new BibBookContainer( pParent, pDatMan );
BibView* pView = new BibView(pMyWindow,pDatMan,WB_SECTION_STYLE);
pDatMan->SetView(pView);
BibBeamer* pBeamer=new BibBeamer( pMyWindow,pDatMan);
pMyWindow->createTopFrame(pBeamer);
pMyWindow->createBottomFrame(pView);
Reference< awt::XWindow > xWin ( pMyWindow->GetComponentInterface(), UNO_QUERY );
Reference< frame::XController > xCtrRef(new BibFrameController_Impl( xWin,pDatMan));
xCtrRef->attachFrame(rFrame);
rFrame->setComponent( xWin, xCtrRef);
pBeamer->SetXController(xCtrRef);
//!
long nBeamerSize = pDatMan->getBeamerSize();
pDatMan->loadDatabase();
ResMgr* pResMgr = (*pBibMod)->GetResMgr();
INetURLObject aEntry( URIHelper::SmartRelToAbs(pResMgr->GetFileName()) );
String aResFile = String::CreateFromAscii(".component:");
( aResFile += aEntry.GetName() ) += '/';
String aMenuRes = aResFile;
aMenuRes+=String::CreateFromInt32(RID_MAIN_MENU);
util::URL aURL;
aURL.Complete = aMenuRes;
Reference< XMultiServiceFactory > xMgr = utl::getProcessServiceFactory();
Reference< util::XURLTransformer > xTrans ( xMgr->createInstance( C2U("com.sun.star.util.URLTransformer") ), UNO_QUERY );
if( xTrans.is() )
{
// Datei laden
xTrans->parseStrict( aURL );
Reference< frame::XDispatchProvider > xProv( rFrame, UNO_QUERY );
if ( xProv.is() )
{
Reference< frame::XDispatch > aDisp = xProv->queryDispatch( aURL, C2U("_tool:_menubar"), 0 );
if ( aDisp.is() )
aDisp->dispatch( aURL, Sequence<PropertyValue>() );
}
}
if ( rListener.is() )
rListener->loadFinished( this );
}
else
{
if ( rListener.is() )
rListener->loadCancelled( this );
}
}
/* -----------------06.12.99 14:37-------------------
--------------------------------------------------*/
BibDataManager* BibliographyLoader::GetDataManager()const
{
if(!pDatMan)
{
if(!pBibMod)
((BibliographyLoader*)this)->pBibMod = OpenBibModul();
((BibliographyLoader*)this)->pDatMan = (*pBibMod)->createDataManager();
((BibliographyLoader*)this)->xDatMan = pDatMan;
}
return pDatMan;
}
/* -----------------06.12.99 14:39-------------------
--------------------------------------------------*/
Reference< container::XNameAccess > BibliographyLoader::GetDataColumns() const
{
if (!xColumns.is())
{
Reference< XMultiServiceFactory > xMgr = utl::getProcessServiceFactory();
Reference< XRowSet > xRowSet(xMgr->createInstance(C2U("com.sun.star.sdb.RowSet")), UNO_QUERY);
Reference< XPropertySet > xResultSetProps(xRowSet, UNO_QUERY);
DBG_ASSERT(xResultSetProps.is() , "BibliographyLoader::GetDataCursor : invalid row set (no XResultSet or no XPropertySet) !");
String sTableName;
rtl::OUString aBibUrl = BibModul::GetBibliographyURL(&sTableName);
Any aBibUrlAny; aBibUrlAny <<= aBibUrl;
xResultSetProps->setPropertyValue(C2U("DataSourceName"), aBibUrlAny);
Any aCommandType; aCommandType <<= (sal_Int32)(CommandType::TABLE);
xResultSetProps->setPropertyValue(C2U("CommandType"), aCommandType);
Any aTableName; aTableName <<= OUString(sTableName);
xResultSetProps->setPropertyValue(C2U("Command"), aTableName);
Any aResultSetType; aResultSetType <<= (sal_Int32)(ResultSetType::SCROLL_INSENSITIVE);
xResultSetProps->setPropertyValue(C2U("ResultSetType"), aResultSetType);
Any aResultSetCurrency; aResultSetCurrency <<= (sal_Int32)(ResultSetConcurrency::UPDATABLE);
xResultSetProps->setPropertyValue(C2U("ResultSetConcurrency"), aResultSetCurrency);
sal_Bool bSuccess = sal_False;
try
{
xRowSet->execute();
bSuccess = sal_True;
}
catch(SQLException& e)
{
#ifdef DBG_UTIL
// TODO : show a real error message
String sMsg(String::CreateFromAscii("BibliographyLoader::GetDataCursor : could not execute the result set (catched an SQL-exception"));
sMsg += String(e.Message);
sMsg.AppendAscii(") !");
DBG_ERROR( ByteString(sMsg, RTL_TEXTENCODING_ASCII_US ).GetBuffer());
#endif
}
catch(...)
{
DBG_ERROR("BibliographyLoader::GetDataCursor : could not execute the result set !");
bSuccess = sal_False;
}
if (!bSuccess)
{
Reference< XComponent > xSetComp(xRowSet, UNO_QUERY);
if (xSetComp.is())
xSetComp->dispose();
xRowSet = NULL;
}
else
((BibliographyLoader*)this)->xCursor = xRowSet.get();
Reference< sdbcx::XColumnsSupplier > xSupplyCols(xCursor, UNO_QUERY);
if (xSupplyCols.is())
((BibliographyLoader*)this)->xColumns = xSupplyCols->getColumns();
}
return xColumns;
}
/* -----------------17.12.99 12:29-------------------
--------------------------------------------------*/
Reference< sdb::XColumn > BibliographyLoader::GetIdentifierColumn() const
{
BibDataManager* pDatMan = GetDataManager();
Reference< container::XNameAccess > xColumns = GetDataColumns();
rtl::OUString sIdentifierColumnName = pDatMan->GetIdentifierMapping();
Reference< sdb::XColumn > xReturn;
if (xColumns.is() && xColumns->hasByName(sIdentifierColumnName))
{
xReturn = Reference< XColumn > (*(Reference< XInterface > *)
xColumns->getByName(sIdentifierColumnName).getValue(), UNO_QUERY);
}
return xReturn;
}
/* -----------------06.12.99 15:05-------------------
--------------------------------------------------*/
Reference< XResultSet > BibliographyLoader::GetDataCursor() const
{
if (!xCursor.is())
GetDataColumns();
if (xCursor.is())
xCursor->first();
return xCursor;
}
/*-- 17.11.99 12:51:38---------------------------------------------------
-----------------------------------------------------------------------*/
rtl::OUString lcl_AddProperty(Reference< container::XNameAccess > xColumns,
const Mapping* pMapping, const String& rColumnName)
{
String sColumnName(rColumnName);
if(pMapping)
{
for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++)
{
if(pMapping->aColumnPairs[nEntry].sLogicalColumnName == rColumnName)
{
sColumnName = pMapping->aColumnPairs[nEntry].sRealColumnName;
break;
}
}
}
rtl::OUString uColumnName(sColumnName);
rtl::OUString uRet;
Reference< sdb::XColumn > xCol;
if (xColumns->hasByName(uColumnName))
xCol = Reference< sdb::XColumn > (*(Reference< XInterface > *)xColumns->getByName(uColumnName).getValue(), UNO_QUERY);
if (xCol.is())
uRet = xCol->getString();
return uRet;
}
//-----------------------------------------------------------------------------
Any BibliographyLoader::getByName(const rtl::OUString& rName) throw
( container::NoSuchElementException, WrappedTargetException, RuntimeException )
{
Any aRet;
try
{
BibDataManager* pDatMan = ((BibliographyLoader*)this)->GetDataManager();
Reference< XResultSet > xCursor = GetDataCursor();
Reference< sdbcx::XColumnsSupplier > xSupplyCols(xCursor, UNO_QUERY);
Reference< container::XNameAccess > xColumns;
if (!xSupplyCols.is())
return aRet;
xColumns = xSupplyCols->getColumns();
DBG_ASSERT(xSupplyCols.is(), "BibliographyLoader::getByName : invalid columns returned by the data cursor (may be the result set is not alive ?) !");
if (!xColumns.is())
return aRet;
String sIdentifierMapping = pDatMan->GetIdentifierMapping();
rtl::OUString sId = sIdentifierMapping;
Reference< sdb::XColumn > xColumn;
if (xColumns->hasByName(sId))
xColumn = Reference< sdb::XColumn > (*(Reference< XInterface > *)xColumns->getByName(sId).getValue(), UNO_QUERY);
if (xColumn.is())
{
do
{
if ((rName == xColumn->getString()) && !xColumn->wasNull())
{
Sequence<PropertyValue> aPropSequ(COLUMN_COUNT);
PropertyValue* pValues = aPropSequ.getArray();
String sTableName;
rtl::OUString aBibUrl = BibModul::GetBibliographyURL(&sTableName);
const Mapping* pMapping = pDatMan->GetMapping(sTableName, &aBibUrl);
for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++)
{
const String sColName = pDatMan->GetDefColumnName(
nEntry);
pValues[nEntry].Name = sColName;
pValues[nEntry].Value <<= lcl_AddProperty(xColumns, pMapping, sColName);
}
aRet.setValue(&aPropSequ, ::getCppuType((Sequence<PropertyValue>*)0));
break;
}
}
while(xCursor->next());
}
}
catch(...)
{
DBG_ERROR("Exception in BibliographyLoader::getByName")
}
return aRet;
}
/*-- 17.11.99 12:51:39---------------------------------------------------
-----------------------------------------------------------------------*/
Sequence< rtl::OUString > BibliographyLoader::getElementNames(void) throw ( RuntimeException )
{
Sequence< rtl::OUString > aRet(10);
int nRealNameCount = 0;
try
{
BibDataManager* pDatMan = ((BibliographyLoader*)this)->GetDataManager();
Reference< XResultSet > xCursor(GetDataCursor());
Reference< sdb::XColumn > xIdColumn(GetIdentifierColumn());
if (xIdColumn.is()) // implies xCursor.is()
{
do
{
rtl::OUString sTemp = xIdColumn->getString();
if (sTemp.len() && !xIdColumn->wasNull())
{
int nLen = aRet.getLength();
if (nLen = nRealNameCount)
aRet.realloc(nLen + 10);
rtl::OUString* pArray = aRet.getArray();
pArray[nRealNameCount] = sTemp;
nRealNameCount++;
}
}
while (xCursor->next());
}
}
catch(...)
{
DBG_ERROR("Exception in BibliographyLoader::getElementNames")
}
aRet.realloc(nRealNameCount);
return aRet;
}
/*-- 17.11.99 12:51:39---------------------------------------------------
-----------------------------------------------------------------------*/
sal_Bool BibliographyLoader::hasByName(const rtl::OUString& rName) throw ( RuntimeException )
{
sal_Bool bRet = sal_False;
try
{
BibDataManager* pDatMan = GetDataManager();
Reference< XResultSet > xCursor = GetDataCursor();
Reference< sdb::XColumn > xIdColumn = GetIdentifierColumn();
if (xIdColumn.is()) // implies xCursor.is()
{
do
{
rtl::OUString sCurrentId = xIdColumn->getString();
if (!xIdColumn->wasNull() && (rName.compareTo(sCurrentId) == COMPARE_EQUAL))
{
bRet = sal_True;
break;
}
}
while(xCursor->next());
}
}
catch(...)
{
DBG_ERROR("Exception in BibliographyLoader::getElementNames")
}
return bRet;
}
/*-- 17.11.99 12:51:39---------------------------------------------------
-----------------------------------------------------------------------*/
Type BibliographyLoader::getElementType(void) throw ( RuntimeException )
{
return ::getCppuType((Sequence<PropertyValue>*)0);
}
/*-- 17.11.99 12:51:40---------------------------------------------------
-----------------------------------------------------------------------*/
sal_Bool BibliographyLoader::hasElements(void) throw ( RuntimeException )
{
Reference< XResultSet > xCursor = GetDataCursor();
Reference< container::XNameAccess > xColumns = GetDataColumns();
return xColumns.is() && (xColumns->getElementNames().getLength() != 0);
}
/*-- 07.12.99 14:28:39---------------------------------------------------
-----------------------------------------------------------------------*/
Reference< XPropertySetInfo > BibliographyLoader::getPropertySetInfo(void) throw
( RuntimeException )
{
static SfxItemPropertyMap aBibProps_Impl[] =
{
{ MAP_CHAR_LEN("BibliographyDataFieldNames"), 0, &::getCppuType((Sequence<PropertyValue>*)0), PropertyAttribute::READONLY, 0},
{0,0,0,0}
};
static Reference< XPropertySetInfo > xRet =
SfxItemPropertySet(aBibProps_Impl).getPropertySetInfo();
return xRet;
}
/*-- 07.12.99 14:28:39---------------------------------------------------
-----------------------------------------------------------------------*/
void BibliographyLoader::setPropertyValue(const rtl::OUString& PropertyName,
const Any& aValue)
throw( UnknownPropertyException, PropertyVetoException,
IllegalArgumentException, WrappedTargetException, RuntimeException)
{
throw UnknownPropertyException();
//no changeable properties
}
/*-- 07.12.99 14:28:39---------------------------------------------------
-----------------------------------------------------------------------*/
Any BibliographyLoader::getPropertyValue(const rtl::OUString& rPropertyName)
throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
{
Any aRet;
static const sal_uInt16 aInternalMapping[] =
{
IDENTIFIER_POS , // BibliographyDataField_IDENTIFIER
AUTHORITYTYPE_POS , // BibliographyDataField_BIBILIOGRAPHIC_TYPE
ADDRESS_POS , // BibliographyDataField_ADDRESS
ANNOTE_POS , // BibliographyDataField_ANNOTE
AUTHOR_POS , // BibliographyDataField_AUTHOR
BOOKTITLE_POS , // BibliographyDataField_BOOKTITLE
CHAPTER_POS , // BibliographyDataField_CHAPTER
EDITION_POS , // BibliographyDataField_EDITION
EDITOR_POS , // BibliographyDataField_EDITOR
HOWPUBLISHED_POS , // BibliographyDataField_HOWPUBLISHED
INSTITUTION_POS , // BibliographyDataField_INSTITUTION
JOURNAL_POS , // BibliographyDataField_JOURNAL
MONTH_POS , // BibliographyDataField_MONTH
NOTE_POS , // BibliographyDataField_NOTE
NUMBER_POS , // BibliographyDataField_NUMBER
ORGANIZATIONS_POS , // BibliographyDataField_ORGANIZATIONS
PAGES_POS , // BibliographyDataField_PAGES
PUBLISHER_POS , // BibliographyDataField_PUBLISHER
SCHOOL_POS , // BibliographyDataField_SCHOOL
SERIES_POS , // BibliographyDataField_SERIES
TITLE_POS , // BibliographyDataField_TITLE
REPORTTYPE_POS , // BibliographyDataField_REPORT_TYPE
VOLUME_POS , // BibliographyDataField_VOLUME
YEAR_POS , // BibliographyDataField_YEAR
URL_POS , // BibliographyDataField_URL
CUSTOM1_POS , // BibliographyDataField_CUSTOM1
CUSTOM2_POS , // BibliographyDataField_CUSTOM2
CUSTOM3_POS , // BibliographyDataField_CUSTOM3
CUSTOM4_POS , // BibliographyDataField_CUSTOM4
CUSTOM5_POS , // BibliographyDataField_CUSTOM5
ISBN_POS //BibliographyDataField_ISBN
};
if(C2U("BibliographyDataFieldNames") == rPropertyName)
{
Sequence<PropertyValue> aSeq(COLUMN_COUNT);
PropertyValue* pArray = aSeq.getArray();
BibDataManager* pDatMan = GetDataManager();
for(sal_uInt16 i = 0; i <= text::BibliographyDataField::ISBN ; i++)
{
pArray[i].Name = pDatMan->GetDefColumnName(aInternalMapping[i]);
pArray[i].Value <<= (sal_Int16) i;
}
aRet.setValue(&aSeq, ::getCppuType((Sequence<PropertyValue>*)0));
}
else
throw UnknownPropertyException();
return aRet;
}
/*-- 07.12.99 14:28:40---------------------------------------------------
-----------------------------------------------------------------------*/
void BibliographyLoader::addPropertyChangeListener(
const rtl::OUString& PropertyName, const Reference< XPropertyChangeListener > & aListener)
throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
{
//no bound properties
}
/*-- 07.12.99 14:28:40---------------------------------------------------
-----------------------------------------------------------------------*/
void BibliographyLoader::removePropertyChangeListener(
const rtl::OUString& PropertyName, const Reference< XPropertyChangeListener > & aListener)
throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
{
//no bound properties
}
/*-- 07.12.99 14:28:40---------------------------------------------------
-----------------------------------------------------------------------*/
void BibliographyLoader::addVetoableChangeListener(
const rtl::OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener)
throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
{
//no vetoable properties
}
/*-- 07.12.99 14:28:40---------------------------------------------------
-----------------------------------------------------------------------*/
void BibliographyLoader::removeVetoableChangeListener(
const rtl::OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener)
throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
{
//no vetoable properties
}
+409
View File
@@ -0,0 +1,409 @@
/*************************************************************************
*
* $RCSfile: bibmod.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning 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/resmgr.hxx>
#include <svtools/iniprop.hxx>
#include <svtools/iniman.hxx>
#ifndef _URLOBJ_HXX
#include <tools/urlobj.hxx>
#endif
#ifndef SVTOOLS_URIHELPER_HXX
#include <svtools/urihelper.hxx>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
#include <com/sun/star/container/XNameAccess.hpp>
#endif
#ifndef _COM_SUN_STAR_UTIL_XLOCALIZEDALIASES_HPP_
#include <com/sun/star/util/XLocalizedAliases.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XLOCALIZABLE_HPP_
#include <com/sun/star/lang/XLocalizable.hpp>
#endif
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
#include <unotools/processfactory.hxx>
#endif
#include "bibmod.hxx"
#include "bibresid.hxx"
#include "registry.hxx"
#include "datman.hxx"
static PtrBibModul pBibModul=NULL;
static nBibModulCount=0;
#ifndef _UCBHELPER_CONTENT_HXX
#include <ucbhelper/content.hxx>
#endif
using namespace ::rtl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::ucb;
#define C2U(cChar) OUString::createFromAscii(cChar)
#define C2S(cChar) String::CreateFromAscii(cChar)
HdlBibModul OpenBibModul()
{
if(pBibModul==NULL)
{
pBibModul=new BibModul();
}
nBibModulCount++;
return &pBibModul;
}
void CloseBibModul(HdlBibModul ppBibModul)
{
nBibModulCount--;
if(nBibModulCount==0 && ppBibModul!=NULL)
{
delete pBibModul;
pBibModul=NULL;
}
}
/*PtrBibModul GetBibModul()
{
return pBibModul;
} */
BibResId::BibResId( sal_uInt16 nId ) :
ResId( nId, pBibModul->GetResMgr() )
{
}
BibModul::BibModul()
{
pResMgr = ResMgr::CreateResMgr( "bib" MAKE_NUMSTR(SUPD) );
pRegistry = new BibRegistry();
xRegistry = pRegistry;
}
BibModul::~BibModul()
{
delete pResMgr;
xRegistry = 0;
//delete pRegistry;
}
BibDataManager* BibModul::createDataManager()
{
return new BibDataManager(pRegistry);
}
//-----------------------------------------------------------------------------
String BibModul::GetBibliographyURL(String* pTableName)
{
String aURL;
SfxAppIniManagerProperty aProp;
GetpApp()->Property( aProp );
SfxIniManager* pIniMan = aProp.GetIniManager();
if( !pIniMan )
return String();
String aBib = pIniMan->Get( C2S(BIBLIOGRAPHY_INI_GROUP),
sal_False, sal_False,
C2S(BIBLIOGRAPHY_INI_CUR_NAME));
sal_Bool bCorrect = sal_False;
if(aBib.Len())
{
aURL = aBib.GetToken( 0, ';' );
aURL = pIniMan->SubstPathVars( aURL );
aURL = URIHelper::SmartRelToAbs(aURL);
INetURLObject aTmpURL(aURL);
BOOL bExist = FALSE;
if(aTmpURL.GetProtocol() == INET_PROT_FILE)
try
{
bExist = ::ucb::Content(
aTmpURL.GetMainURL(), uno::Reference< XCommandEnvironment >()).isDocument();
}
catch(...){}
if(bExist)
{
bCorrect = sal_True;
if(pTableName)
*pTableName = aBib.GetToken( 1, ';' );
}
}
if(!bCorrect)
{
//if there's no entry defined take the first *.sdb from the database favorites
try
{
uno::Reference< lang::XMultiServiceFactory > xMgr = utl::getProcessServiceFactory();
uno::Reference< container::XNameAccess > xDatabaseContext(xMgr->createInstance(
C2U("com.sun.star.sdb.DatabaseAccessContext") ), UNO_QUERY );
// uno::Sequence<rtl::OUString> aFavorites;
// if (xDatabaseContext.is())
// aFavorites = xDatabaseContext->getElementNames();
// if (aFavorites.getLength())
// aURL = INetURLObject::SmartRelToAbs(U2S(aFavorites.getConstArray()[0]));
Reference<XLocalizedAliases> xAlias(xDatabaseContext, UNO_QUERY);
Reference<XLocalizable> xLocal(xDatabaseContext, UNO_QUERY);
Sequence< AliasProgrammaticPair > aAliasPairs =
xAlias->listAliases(xLocal->getLocale());
const AliasProgrammaticPair* pPairs = aAliasPairs.getConstArray();
for(INT32 nFav = 0; nFav < aAliasPairs.getLength(); nFav++)
{
String sURL = pPairs[nFav].ProgrammaticName;
aURL = URIHelper::SmartRelToAbs(sURL);
INetURLObject aTmpURL(aURL);
BOOL bExist = FALSE;
if(aTmpURL.GetProtocol() == INET_PROT_FILE)
try
{
bExist = ::ucb::Content(
aTmpURL.GetMainURL(), uno::Reference< XCommandEnvironment >()).isDocument();
}
catch(...){}
if(bExist)
break;
else
aURL.Erase();
}
}
catch(...)
{
DBG_ERROR("Exception in BibDataManager::DBChangeDialog_Impl::DBChangeDialog_Impl")
}
}
return aURL;
}
//-----------------------------------------------------------------------------
void BibModul::SetBibliographyURL(const String& rURL, const String& rTable)
{
SfxAppIniManagerProperty aProp;
GetpApp()->Property( aProp );
SfxIniManager* pIniMan = aProp.GetIniManager();
if( !pIniMan )
return;
String sEntry(rURL);
sEntry = pIniMan->UsePathVars( sEntry );
sEntry += ';';
sEntry += rTable;
pIniMan->WriteKey( C2S(BIBLIOGRAPHY_INI_GROUP),
C2S(BIBLIOGRAPHY_INI_CUR_NAME), sEntry);
}
// PropertyNames
#define STATIC_USTRING(a,b) rtl::OUString a(b)
STATIC_USTRING(FM_PROP_LABEL,C2U("Label"));
STATIC_USTRING(FM_PROP_CONTROLSOURCE,C2U("DataField"));
STATIC_USTRING(FM_PROP_NAME,C2U("Name"));
STATIC_USTRING(FM_PROP_FORMATKEY,C2U("FormatKey"));
#ifdef TF_SDBAPI
#else // !TF_SDBAPI
STATIC_USTRING(FM_PROP_EDITMODE,C2U("RecordMode"));
STATIC_USTRING(FM_PROP_CURSORSOURCETYPE,C2U("DataSelectionType"));
STATIC_USTRING(FM_PROP_CURSORSOURCE,C2U("DataSelection"));
STATIC_USTRING(FM_PROP_DATASOURCE, C2U("DataSource"));
#endif // !TF_SDBAPI
STATIC_USTRING(FM_PROP_VALUE,C2U("Value"));
STATIC_USTRING(FM_PROP_TEXT,C2U("Text"));
/*
STATIC_USTRING(FM_PROP_TABINDEX,C2U("TabIndex"));
STATIC_USTRING(FM_PROP_TAG,C2U("Tag"));
STATIC_USTRING(FM_PROP_CLASSID,C2U("ClassId"));
STATIC_USTRING(FM_PROP_RECORDCOUNT,C2U("RecordCount"));
STATIC_USTRING(FM_PROP_RECORDSTATUS,C2U("RecordStatus"));
STATIC_USTRING(FM_PROP_RECORDCOUNTFINAL,C2U("IsRecordCountFinal"));
STATIC_USTRING(FM_PROP_CANINSERT,C2U("CanInsert"));
STATIC_USTRING(FM_PROP_CANUPDATE,C2U("CanUpdate"));
STATIC_USTRING(FM_PROP_CANDELETE,C2U("CanDelete"));
STATIC_USTRING(FM_PROP_NAVIGATION,C2U("NavigationBarMode"));
STATIC_USTRING(FM_PROP_HASNAVIGATION,C2U("HasNavigationBar"));
STATIC_USTRING(FM_PROP_CYCLE,C2U("Cycle"));
STATIC_USTRING(FM_PROP_ENABLED,C2U("Enabled"));
STATIC_USTRING(FM_PROP_READONLY,C2U("ReadOnly"));
STATIC_USTRING(FM_PROP_ISREADONLY,C2U("IsReadOnly"));
STATIC_USTRING(FM_PROP_FILTER_CRITERIA,C2U("Filter"));
STATIC_USTRING(FM_PROP_SORT_CRITERIA,C2U("SortOrder"));
STATIC_USTRING(FM_PROP_ISREQUIRED,C2U("IsRequired"));
STATIC_USTRING(FM_PROP_AUTOINCREMENT,C2U("IsAutoIncrement"));
STATIC_USTRING(FM_PROP_CACHESIZE,C2U("CacheSize"));
STATIC_USTRING(FM_PROP_DATAENTRY,C2U("DataEntry"));
STATIC_USTRING(FM_PROP_LASTDIRTY,C2U("LastUpdated"));
STATIC_USTRING(FM_PROP_STATEMENT,C2U("Statement"));
STATIC_USTRING(FM_PROP_WIDTH,C2U("Width"));
STATIC_USTRING(FM_PROP_SEARCHINFO,C2U("SearchInfo"));
STATIC_USTRING(FM_PROP_MULTILINE,C2U("MultiLine"));
STATIC_USTRING(FM_PROP_TARGET_URL,C2U("TargetURL"));
STATIC_USTRING(FM_PROP_TARGET_FRAME,C2U("TargetFrame"));
STATIC_USTRING(FM_PROP_DEFAULTCONTROL,C2U("DefaultControl"));
STATIC_USTRING(FM_PROP_MAXTEXTLEN,C2U("MaxTextLen"));
STATIC_USTRING(FM_PROP_EDITMASK,C2U("EditMask"));
STATIC_USTRING(FM_PROP_SIZE,C2U("Size"));
STATIC_USTRING(FM_PROP_SPIN,C2U("Spin"));
STATIC_USTRING(FM_PROP_DATE,C2U("Date"));
STATIC_USTRING(FM_PROP_TIME,C2U("Time"));
STATIC_USTRING(FM_PROP_STATE,C2U("State"));
STATIC_USTRING(FM_PROP_TRISTATE,C2U("TriState"));
STATIC_USTRING(FM_PROP_HIDDEN_VALUE, C2U("HiddenValue"));
STATIC_USTRING(FM_PROP_BUTTONTYPE,C2U("ButtonType"));
STATIC_USTRING(FM_PROP_STRINGITEMLIST,C2U("StringItemList"));
STATIC_USTRING(FM_PROP_DEFAULT_TEXT,C2U("DefaultText"));
STATIC_USTRING(FM_PROP_DEFAULTCHECKED,C2U("DefaultState"));
STATIC_USTRING(FM_PROP_FORMATSSUPPLIER,C2U("FormatsSupplier"));
STATIC_USTRING(FM_PROP_SUBMIT_ACTION,C2U("SubmitAction"));
STATIC_USTRING(FM_PROP_SUBMIT_TARGET,C2U("SubmitTarget"));
STATIC_USTRING(FM_PROP_SUBMIT_METHOD,C2U("SubmitMethod"));
STATIC_USTRING(FM_PROP_SUBMIT_ENCODING,C2U("SubmitEncoding"));
STATIC_USTRING(FM_PROP_IMAGE_URL,C2U("ImageURL"));
STATIC_USTRING(FM_PROP_EMPTY_IS_NULL,C2U("ConvertEmptyToNull"));
STATIC_USTRING(FM_PROP_LISTSOURCETYPE,C2U("ListSourceType"));
STATIC_USTRING(FM_PROP_LISTSOURCE,C2U("ListSource"));
STATIC_USTRING(FM_PROP_SELECT_SEQ,C2U("SelectedItems"));
STATIC_USTRING(FM_PROP_VALUE_SEQ,C2U("SelectedValues"));
STATIC_USTRING(FM_PROP_DEFAULT_SELECT_SEQ,C2U("DefaultSelection"));
STATIC_USTRING(FM_PROP_MULTISELECTION,C2U("MultiSelection"));
STATIC_USTRING(FM_PROP_ALIGN,C2U("Align"));
STATIC_USTRING(FM_PROP_DEFAULT_DATE,C2U("DefaultDate"));
STATIC_USTRING(FM_PROP_DEFAULT_TIME,C2U("DefaultTime"));
STATIC_USTRING(FM_PROP_DEFAULT_VALUE,C2U("DefaultValue"));
STATIC_USTRING(FM_PROP_DECIMAL_ACCURACY,C2U("DecimalAccuracy"));
STATIC_USTRING(FM_PROP_FIELDTYPE,C2U("Type"));
STATIC_USTRING(FM_PROP_DECIMALS,C2U("Decimals"));
STATIC_USTRING(FM_PROP_REFVALUE,C2U("RefValue"));
STATIC_USTRING(FM_PROP_VALUEMIN,C2U("ValueMin"));
STATIC_USTRING(FM_PROP_VALUEMAX,C2U("ValueMax"));
STATIC_USTRING(FM_PROP_STRICTFORMAT,C2U("StrictFormat"));
STATIC_USTRING(FM_PROP_ALLOWADDITIONS,C2U("AllowInserts"));
STATIC_USTRING(FM_PROP_ALLOWEDITS,C2U("AllowUpdates"));
STATIC_USTRING(FM_PROP_ALLOWDELETIONS,C2U("AllowDeletes"));
STATIC_USTRING(FM_PROP_MASTERFIELDS,C2U("MasterFields"));
STATIC_USTRING(FM_PROP_SLAVEFIELDS,C2U("SlaveFields"));
STATIC_USTRING(FM_PROP_ISPASSTHROUGH,C2U("IsPassThrough"));
STATIC_USTRING(FM_PROP_QUERY,C2U("Query"));
STATIC_USTRING(FM_PROP_LITERALMASK,C2U("LiteralMask"));
STATIC_USTRING(FM_PROP_VALUESTEP,C2U("ValueStep"));
STATIC_USTRING(FM_PROP_SHOWTHOUSANDSEP,C2U("ShowThousandsSeparator"));
STATIC_USTRING(FM_PROP_CURRENCYSYMBOL,C2U("CurrencySymbol"));
STATIC_USTRING(FM_PROP_DATEFORMAT,C2U("DateFormat"));
STATIC_USTRING(FM_PROP_DATEMIN,C2U("DateMin"));
STATIC_USTRING(FM_PROP_DATEMAX,C2U("DateMax"));
STATIC_USTRING(FM_PROP_DATE_SHOW_CENTURY,C2U("DateShowCentury"));
STATIC_USTRING(FM_PROP_TIMEFORMAT, C2U("TimeFormat"));
STATIC_USTRING(FM_PROP_TIMEMIN, C2U("TimeMin"));
STATIC_USTRING(FM_PROP_TIMEMAX,C2U("TimeMax"));
STATIC_USTRING(FM_PROP_LINECOUNT,C2U("LineCount"));
STATIC_USTRING(FM_PROP_BOUNDCOLUMN, C2U("BoundColumn"));
STATIC_USTRING(FM_PROP_FONT,C2U("FontDescriptor"));
STATIC_USTRING(FM_PROP_BACKGROUNDCOLOR,C2U("BackgroundColor"));
STATIC_USTRING(FM_PROP_FILLCOLOR,C2U("FillColor"));
STATIC_USTRING(FM_PROP_TEXTCOLOR,C2U("TextColor"));
STATIC_USTRING(FM_PROP_LINECOLOR,C2U("LineColor"));
STATIC_USTRING(FM_PROP_BORDER,C2U("Border"));
STATIC_USTRING(FM_PROP_DROPDOWN,C2U("Dropdown"));
STATIC_USTRING(FM_PROP_MULTI,C2U("Multi"));
STATIC_USTRING(FM_PROP_HSCROLL,C2U("HScroll"));
STATIC_USTRING(FM_PROP_VSCROLL,C2U("VScroll"));
STATIC_USTRING(FM_PROP_TABSTOP,C2U("Tabstop"));
STATIC_USTRING(FM_PROP_AUTOCOMPLETE,C2U("Autocomplete"));
STATIC_USTRING(FM_PROP_HARDLINEBREAKS,C2U("HardLineBreaks"));
STATIC_USTRING(FM_PROP_PRINTABLE,C2U("Printable"));
STATIC_USTRING(FM_PROP_ECHO_CHAR,C2U("EchoChar"));
STATIC_USTRING(FM_PROP_ROWHEIGHT,C2U("RowHeight"));
STATIC_USTRING(FM_PROP_HELPTEXT, C2U("HelpText"));
STATIC_USTRING(FM_PROP_FONT_NAME, C2U("FontName"));
STATIC_USTRING(FM_PROP_FONT_STYLENAME, C2U("FontStyleName"));
STATIC_USTRING(FM_PROP_FONT_FAMILY, C2U("FontFamily"));
STATIC_USTRING(FM_PROP_FONT_CHARSET, C2U("FontCharset"));
STATIC_USTRING(FM_PROP_FONT_HEIGHT, C2U("FontHeight"));
STATIC_USTRING(FM_PROP_FONT_WEIGHT, C2U("FontWeight"));
STATIC_USTRING(FM_PROP_FONT_SLANT, C2U("FontSlant"));
STATIC_USTRING(FM_PROP_FONT_UNDERLINE, C2U("FontUnderline"));
STATIC_USTRING(FM_PROP_FONT_STRIKEOUT, C2U("FontStrikeout"));
STATIC_USTRING(FM_PROP_HELPURL, C2U("HelpURL"));
STATIC_USTRING(FM_PROP_RECORDMARKER, C2U("HasRecordMarker"));
STATIC_USTRING(FM_PROP_BOUNDFIELD, C2U("BoundField"));
STATIC_USTRING(FM_PROP_TREATASNUMERIC, C2U("TreatAsNumber"));
STATIC_USTRING(FM_PROP_EFFECTIVE_VALUE, C2U("EffectiveValue"));
STATIC_USTRING(FM_PROP_EFFECTIVE_DEFAULT, C2U("EffectiveDefault"));
STATIC_USTRING(FM_PROP_EFFECTIVE_MIN, C2U("EffectiveMin"));
STATIC_USTRING(FM_PROP_EFFECTIVE_MAX, C2U("EffectiveMax"));
STATIC_USTRING(FM_PROP_HIDDEN, C2U("Hidden"));
STATIC_USTRING(FM_PROP_FILTERPROPOSAL, C2U("useFilterValueProposal"));
STATIC_USTRING(FM_PROP_FIELDSOURCE, C2U("FieldSource"));
STATIC_USTRING(FM_PROP_TABLENAME, C2U("TableName"));
STATIC_USTRING(FM_PROP_FILTERSUPPLIER, C2U("FilterSupplier"));
STATIC_USTRING(FM_PROP_CURRENTFILTER, C2U("CurrentFilter"));
STATIC_USTRING(FM_PROP_SELECTED_FIELDS, C2U("SelectedFields"));
STATIC_USTRING(FM_PROP_SELECTED_TABLES, C2U("SelectedTables"));
STATIC_USTRING(FM_PROP_THREADSAFE, C2U("ThreadSafe"));
*/
+113
View File
@@ -0,0 +1,113 @@
/*************************************************************************
*
* $RCSfile: bibmod.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef ADDRMOD_HXX
#define ADDRMOD_HXX
#ifndef _COM_SUN_STAR_REGISTRY_MERGECONFLICTEXCEPTION_HPP_
#include <com/sun/star/registry/MergeConflictException.hpp>
#endif
#ifndef _COM_SUN_STAR_REGISTRY_XSIMPLEREGISTRY_HPP_
#include <com/sun/star/registry/XSimpleRegistry.hpp>
#endif
class ResMgr;
class BibDataManager;
class BibRegistry;
#define BIBLIOGRAPHY_INI_GROUP "Bibliography"
#define BIBLIOGRAPHY_INI_CUR_NAME "BibliographyCurrent"
#define BIBLIOGRAPHY_INI_DB_ENTRY "Bibliography"
#define BIBLIOGRAPHY_INI_MAPPING "BibliographyFields"
#define BIBLIOGRAPHY_TYPE_NAMES "BibliographyTypeNames"
class BibModul
{
private:
ResMgr* pResMgr;
BibRegistry* pRegistry;
::com::sun::star::uno::Reference< ::com::sun::star::registry::XSimpleRegistry > xRegistry;
public:
BibModul();
~BibModul();
ResMgr* GetResMgr(){return pResMgr;}
static String GetBibliographyURL(String* pTableName);
static void SetBibliographyURL(const String& rURL, const String& rTable);
BibDataManager* createDataManager();
};
typedef BibModul* PtrBibModul;
typedef PtrBibModul* HdlBibModul;
HdlBibModul OpenBibModul();
void CloseBibModul(HdlBibModul ppBibModul);
//PtrBibModul GetBibModul();
#endif
+211
View File
@@ -0,0 +1,211 @@
/*************************************************************************
*
* $RCSfile: bibprop.hrc,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _BIB_FMPROP_HRC
#define _BIB_FMPROP_HRC
extern rtl::OUString FM_PROP_LABEL;
extern rtl::OUString FM_PROP_NAME;
extern rtl::OUString FM_PROP_CONTROLSOURCE;
extern rtl::OUString FM_PROP_FORMATKEY;
extern rtl::OUString FM_PROP_VALUE;
#ifdef TF_SDBAPI
#else // !TF_SDBAPI
extern rtl::OUString FM_PROP_EDITMODE;
extern rtl::OUString FM_PROP_DATASOURCE;
extern rtl::OUString FM_PROP_CURSORSOURCE;
extern rtl::OUString FM_PROP_CURSORSOURCETYPE;
#endif // !TF_SDBAPI
extern rtl::OUString FM_PROP_TEXT;
/*
extern rtl::OUString FM_PROP_TAG;
extern rtl::OUString FM_PROP_TABINDEX;
extern rtl::OUString FM_PROP_CLASSID;
extern rtl::OUString FM_PROP_ALIGN;
extern rtl::OUString FM_PROP_RECORDCOUNT;
extern rtl::OUString FM_PROP_RECORDSTATUS;
extern rtl::OUString FM_PROP_RECORDCOUNTFINAL;
extern rtl::OUString FM_PROP_VALUEMIN;
extern rtl::OUString FM_PROP_VALUEMAX;
extern rtl::OUString FM_PROP_VALUESTEP;
extern rtl::OUString FM_PROP_CANINSERT;
extern rtl::OUString FM_PROP_CANUPDATE;
extern rtl::OUString FM_PROP_CANDELETE;
extern rtl::OUString FM_PROP_NAVIGATION;
extern rtl::OUString FM_PROP_CYCLE;
extern rtl::OUString FM_PROP_ENABLED;
extern rtl::OUString FM_PROP_SPIN;
extern rtl::OUString FM_PROP_READONLY;
extern rtl::OUString FM_PROP_FILTER_CRITERIA;
extern rtl::OUString FM_PROP_SORT_CRITERIA;
extern rtl::OUString FM_PROP_AUTOINCREMENT;
extern rtl::OUString FM_PROP_CACHESIZE;
extern rtl::OUString FM_PROP_DATAENTRY;
extern rtl::OUString FM_PROP_LASTDIRTY;
extern rtl::OUString FM_PROP_STATEMENT;
extern rtl::OUString FM_PROP_WIDTH;
extern rtl::OUString FM_PROP_SEARCHINFO;
extern rtl::OUString FM_PROP_MULTILINE;
extern rtl::OUString FM_PROP_TARGET_URL;
extern rtl::OUString FM_PROP_DEFAULTCONTROL;
extern rtl::OUString FM_PROP_MAXTEXTLEN;
extern rtl::OUString FM_PROP_SIZE;
extern rtl::OUString FM_PROP_DATE;
extern rtl::OUString FM_PROP_TIME;
extern rtl::OUString FM_PROP_STATE;
extern rtl::OUString FM_PROP_TRISTATE;
extern rtl::OUString FM_PROP_HIDDEN_VALUE;
extern rtl::OUString FM_PROP_TARGET_FRAME;
extern rtl::OUString FM_PROP_BUTTONTYPE;
extern rtl::OUString FM_PROP_STRINGITEMLIST;
extern rtl::OUString FM_PROP_DEFAULT_TEXT;
extern rtl::OUString FM_PROP_DEFAULTCHECKED;
extern rtl::OUString FM_PROP_DEFAULT_DATE;
extern rtl::OUString FM_PROP_DEFAULT_TIME;
extern rtl::OUString FM_PROP_DEFAULT_VALUE;
extern rtl::OUString FM_PROP_FORMATSSUPPLIER;
extern rtl::OUString FM_PROP_SUBMIT_ACTION;
extern rtl::OUString FM_PROP_SUBMIT_TARGET;
extern rtl::OUString FM_PROP_SUBMIT_METHOD;
extern rtl::OUString FM_PROP_SUBMIT_ENCODING;
extern rtl::OUString FM_PROP_IMAGE_URL;
extern rtl::OUString FM_PROP_EMPTY_IS_NULL;
extern rtl::OUString FM_PROP_LISTSOURCETYPE;
extern rtl::OUString FM_PROP_LISTSOURCE;
extern rtl::OUString FM_PROP_SELECT_SEQ;
extern rtl::OUString FM_PROP_VALUE_SEQ;
extern rtl::OUString FM_PROP_DEFAULT_SELECT_SEQ;
extern rtl::OUString FM_PROP_MULTISELECTION;
extern rtl::OUString FM_PROP_DECIMAL_ACCURACY;
extern rtl::OUString FM_PROP_EDITMASK;
extern rtl::OUString FM_PROP_ISREADONLY;
extern rtl::OUString FM_PROP_ISREQUIRED;
extern rtl::OUString FM_PROP_FIELDTYPE;
extern rtl::OUString FM_PROP_DECIMALS;
extern rtl::OUString FM_PROP_REFVALUE;
extern rtl::OUString FM_PROP_STRICTFORMAT;
extern rtl::OUString FM_PROP_ALLOWADDITIONS;
extern rtl::OUString FM_PROP_ALLOWEDITS;
extern rtl::OUString FM_PROP_ALLOWDELETIONS;
extern rtl::OUString FM_PROP_MASTERFIELDS;
extern rtl::OUString FM_PROP_SLAVEFIELDS;
extern rtl::OUString FM_PROP_ISPASSTHROUGH;
extern rtl::OUString FM_PROP_QUERY;
extern rtl::OUString FM_PROP_LITERALMASK;
extern rtl::OUString FM_PROP_SHOWTHOUSANDSEP;
extern rtl::OUString FM_PROP_CURRENCYSYMBOL;
extern rtl::OUString FM_PROP_DATEFORMAT;
extern rtl::OUString FM_PROP_DATEMIN;
extern rtl::OUString FM_PROP_DATEMAX;
extern rtl::OUString FM_PROP_DATE_SHOW_CENTURY;
extern rtl::OUString FM_PROP_TIMEFORMAT;
extern rtl::OUString FM_PROP_TIMEMIN;
extern rtl::OUString FM_PROP_TIMEMAX;
extern rtl::OUString FM_PROP_LINECOUNT;
extern rtl::OUString FM_PROP_BOUNDCOLUMN;
extern rtl::OUString FM_PROP_HASNAVIGATION;
extern rtl::OUString FM_PROP_FONT;
extern rtl::OUString FM_PROP_BACKGROUNDCOLOR;
extern rtl::OUString FM_PROP_FILLCOLOR;
extern rtl::OUString FM_PROP_TEXTCOLOR;
extern rtl::OUString FM_PROP_LINECOLOR;
extern rtl::OUString FM_PROP_BORDER;
extern rtl::OUString FM_PROP_DROPDOWN;
extern rtl::OUString FM_PROP_MULTI;
extern rtl::OUString FM_PROP_HSCROLL;
extern rtl::OUString FM_PROP_VSCROLL;
extern rtl::OUString FM_PROP_TABSTOP;
extern rtl::OUString FM_PROP_AUTOCOMPLETE;
extern rtl::OUString FM_PROP_HARDLINEBREAKS;
extern rtl::OUString FM_PROP_PRINTABLE;
extern rtl::OUString FM_PROP_ECHO_CHAR;
extern rtl::OUString FM_PROP_ROWHEIGHT;
extern rtl::OUString FM_PROP_HELPTEXT;
extern rtl::OUString FM_PROP_FONT_NAME;
extern rtl::OUString FM_PROP_FONT_STYLENAME;
extern rtl::OUString FM_PROP_FONT_FAMILY;
extern rtl::OUString FM_PROP_FONT_CHARSET;
extern rtl::OUString FM_PROP_FONT_HEIGHT;
extern rtl::OUString FM_PROP_FONT_WEIGHT;
extern rtl::OUString FM_PROP_FONT_SLANT;
extern rtl::OUString FM_PROP_FONT_UNDERLINE;
extern rtl::OUString FM_PROP_FONT_STRIKEOUT;
extern rtl::OUString FM_PROP_HELPURL;
extern rtl::OUString FM_PROP_RECORDMARKER;
extern rtl::OUString FM_PROP_BOUNDFIELD;
extern rtl::OUString FM_PROP_TREATASNUMERIC;
extern rtl::OUString FM_PROP_EFFECTIVE_VALUE;
extern rtl::OUString FM_PROP_EFFECTIVE_DEFAULT;
extern rtl::OUString FM_PROP_EFFECTIVE_MIN;
extern rtl::OUString FM_PROP_EFFECTIVE_MAX;
extern rtl::OUString FM_PROP_HIDDEN;
extern rtl::OUString FM_PROP_FILTERPROPOSAL;
extern rtl::OUString FM_PROP_FIELDSOURCE;
extern rtl::OUString FM_PROP_TABLENAME;
extern rtl::OUString FM_PROP_FILTERSUPPLIER;
extern rtl::OUString FM_PROP_CURRENTFILTER;
extern rtl::OUString FM_PROP_SELECTED_FIELDS;
extern rtl::OUString FM_PROP_SELECTED_TABLES;
extern rtl::OUString FM_PROP_THREADSAFE;
*/
#endif // _SVX_FMPROP_HRC
@@ -0,0 +1,80 @@
/*************************************************************************
*
* $RCSfile: bibresid.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef ADRRESID_HXX
#define ADRRESID_HXX
#ifndef _TOOLS_RESID_HXX //autogen
#include <tools/resid.hxx>
#endif
//===================================================================
class BibResId : public ResId
{
public:
BibResId( USHORT nId );
};
#endif // ADRRESID_HXX
+193
View File
@@ -0,0 +1,193 @@
/*************************************************************************
*
* $RCSfile: bibview.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning 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 "bib.hrc"
#include "bibcont.hxx"
#include "bibbeam.hxx"
#include "bibmod.hxx"
#include "general.hxx"
#include "bibview.hxx"
#include "datman.hxx"
#include "bibresid.hxx"
#include "bibmod.hxx"
#include "sections.hrc"
#include "viewsect.hxx"
#ifndef _SV_SVAPP_HXX
#include <vcl/svapp.hxx>
#endif
#ifndef _COM_SUN_STAR_SDBC_XRESULTSETUPDATE_HPP_
#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
#endif
#ifndef _SV_MSGBOX_HXX
#include <vcl/msgbox.hxx>
#endif
#ifndef _TOOLS_DEBUG_HXX //autogen wg. DBG_ASSERT
#include <tools/debug.hxx>
#endif
#define DEFAULT_SIZE 500
using namespace ::com::sun::star;
using namespace ::com::sun::star::form;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::uno;
using namespace ::rtl;
#define C2U(cChar) OUString::createFromAscii(cChar)
rtl::OUString gSectionSizes(C2U("TheSectionSizes"));
rtl::OUString gSectionNames(C2U("TheSectionNames"));
rtl::OUString gSectionExpander(C2U("TheSectionExpander"));
rtl::OUString gSectionPos(C2U("TheSectionPosition"));
// -----------------------------------------------------------------------
BibView::BibView(Window* pParent, BibDataManager* pDM, WinBits nStyle):
Window(pParent,nStyle),
pDatMan(pDM),
xDatMan(pDM),
pGeneralPage(NULL),
nDefNameCount(0)
{
String aDefName(BibResId(RID_BIB_STR_SECTION));
aDefaultName=aDefName;
UpdatePages();
}
BibView::~BibView()
{
pGeneralPage->CommitActiveControl();
uno::Reference< XForm > xForm = pDatMan->getDatabaseForm();
uno::Reference< XPropertySet > xPrSet(xForm, UNO_QUERY);
if(xPrSet.is())
{
uno::Any aProp = xPrSet->getPropertyValue(C2U("IsModified"));
if(*(sal_Bool*)aProp.getValue())
{
uno::Any aNew = xPrSet->getPropertyValue(C2U("IsNew"));
uno::Reference< sdbc::XResultSetUpdate > xResUpd(xForm, UNO_QUERY);
if(*(sal_Bool*)aNew.getValue())
xResUpd->insertRow();
else
xResUpd->updateRow();
}
}
//delete pGeneralPage;
pGeneralPage->RemoveListeners();
xGeneralPage = 0;
}
/* -----------------16.11.99 13:13-------------------
--------------------------------------------------*/
void BibView::UpdatePages()
{
BOOL bResize = FALSE;
if(pGeneralPage)
{
bResize = TRUE;
pGeneralPage->Hide();
// delete pGeneralPage;
pGeneralPage->RemoveListeners();
xGeneralPage = 0;
}
// pGeneralPage = new BibGeneralPage(this, pDatMan);
xGeneralPage = pGeneralPage = new BibGeneralPage(this, pDatMan);
if(bResize)
Resize();
String sErrorString(pGeneralPage->GetErrorString());
if(sErrorString.Len())
{
sErrorString += '\n';
sErrorString += String(BibResId(RID_MAP_QUESTION));
QueryBox aQuery( this, WB_YES_NO, sErrorString );
if(RET_YES == aQuery.Execute())
{
Application::PostUserEvent( STATIC_LINK(
this, BibView, CallMappingHdl ) );
}
}
}
/* -----------------------------02.02.00 16:49--------------------------------
---------------------------------------------------------------------------*/
IMPL_STATIC_LINK(BibView, CallMappingHdl, BibView*, EMPTYARG)
{
pThis->pDatMan->CreateMappingDialog(pThis);
return 0;
}
/* -----------------------------13.04.00 16:12--------------------------------
---------------------------------------------------------------------------*/
void BibView::Resize()
{
if(pGeneralPage)
{
Size aSz(GetOutputSizePixel());
pGeneralPage->SetSizePixel(aSz);
}
Window::Resize();
}
+112
View File
@@ -0,0 +1,112 @@
/*************************************************************************
*
* $RCSfile: bibview.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _BIB_VIEW_HXX
#define _BIB_VIEW_HXX
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
#endif
#ifndef _SV_SECTION_HXX
#include <svtools/section.hxx>
#endif
#ifndef _SV_SECTCTR_HXX
#include <svtools/sectctr.hxx>
#endif
class BibGeneralPage;
class BibBusinessAddress;
class BibBusinessPhone;
class BibDataManager;
namespace com{ namespace sun{ namespace star{ namespace awt{ class XFocusListener;}}}}
// -----------------------------------------------------------------------
class BibView: public Window//SvSectionControl
{
private:
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xViewSet;
BibDataManager* pDatMan;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > xDatMan;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener> xGeneralPage;
BibGeneralPage* pGeneralPage;
rtl::OUString aDefaultName;
sal_Int32 nDefNameCount;
protected:
// void InitPages();
protected:
virtual void Resize();
DECL_STATIC_LINK(BibView, CallMappingHdl, BibView*);
public:
BibView(Window* pParent,BibDataManager* pDatMan,WinBits nStyle=0);
~BibView();
void UpdatePages();
};
#endif
File diff suppressed because it is too large Load Diff
+137
View File
@@ -0,0 +1,137 @@
/*************************************************************************
*
* $RCSfile: datman.hrc,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#define BT_OK 1
#define BT_CANCEL 2
#define BT_HELP 3
#define GB_MAPPING 4
#define FT_IDENTIFIER 5
#define LB_IDENTIFIER 6
#define ST_NONE 7
#define FT_AUTHORITYTYPE 8
#define LB_AUTHORITYTYPE 9
#define FT_ADDRESS 10
#define LB_ADDRESS 11
#define FT_ANNOTE 12
#define LB_ANNOTE 13
#define FT_AUTHOR 14
#define LB_AUTHOR 15
#define FT_TITLE 16
#define LB_TITLE 17
#define FT_MONTH 18
#define LB_MONTH 19
#define FT_YEAR 20
#define LB_YEAR 21
#define FT_ISBN 22
#define LB_ISBN 23
#define FT_BOOKTITLE 24
#define LB_BOOKTITLE 25
#define FT_CHAPTER 26
#define LB_CHAPTER 27
#define FT_EDITION 28
#define LB_EDITION 29
#define FT_EDITOR 30
#define LB_EDITOR 31
#define FT_HOWPUBLISHED 32
#define LB_HOWPUBLISHED 33
#define FT_INSTITUTION 34
#define LB_INSTITUTION 35
#define FT_JOURNAL 36
#define LB_JOURNAL 37
#define FT_NOTE 38
#define LB_NOTE 39
#define FT_NUMBER 40
#define LB_NUMBER 41
#define FT_ORGANIZATIONS 42
#define LB_ORGANIZATIONS 43
#define FT_PAGES 44
#define LB_PAGES 45
#define FT_PUBLISHER 46
#define LB_PUBLISHER 47
#define FT_SCHOOL 48
#define LB_SCHOOL 49
#define FT_SERIES 50
#define LB_SERIES 51
#define FT_REPORTTYPE 52
#define LB_REPORTTYPE 53
#define FT_VOLUME 54
#define LB_VOLUME 55
#define FT_URL 56
#define LB_URL 57
#define FT_CUSTOM1 58
#define LB_CUSTOM1 59
#define FT_CUSTOM2 60
#define LB_CUSTOM2 61
#define FT_CUSTOM3 62
#define LB_CUSTOM3 63
#define FT_CUSTOM4 64
#define LB_CUSTOM4 65
#define FT_CUSTOM5 66
#define LB_CUSTOM5 67
#define GB_SELECTION 68
#define ST_ENTRY 69
#define ST_URL 70
#define LB_SELECTION 71
#define HB_SELECTION 72
+253
View File
@@ -0,0 +1,253 @@
/*************************************************************************
*
* $RCSfile: datman.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _BIB_DATMAN_HXX
#define _BIB_DATMAN_HXX
#ifndef _COM_SUN_STAR_AWT_XCONTROLMODEL_HPP_
#include <com/sun/star/awt/XControlModel.hpp>
#endif
#ifndef _COM_SUN_STAR_FORM_XFORM_HPP_
#include <com/sun/star/form/XForm.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_
#include <com/sun/star/sdbc/XResultSet.hpp>
#endif
#ifndef _COM_SUN_STAR_SDB_XSQLQUERYCOMPOSER_HPP_
#include <com/sun/star/sdb/XSQLQueryComposer.hpp>
#endif
#ifndef _COM_SUN_STAR_REGISTRY_XSIMPLEREGISTRY_HPP_
#include <com/sun/star/registry/XSimpleRegistry.hpp>
#endif
#ifndef _CPPUHELPER_IMPLBASE1_HXX_
#include <cppuhelper/implbase1.hxx> // helper for implementations
#endif
class BibRegistry;
class MappingArray;
class Window;
//-----------------------------------------------------------------------------
#define COLUMN_COUNT 31
#define IDENTIFIER_POS 0
#define AUTHORITYTYPE_POS 1
#define AUTHOR_POS 2
#define TITLE_POS 3
#define YEAR_POS 4
#define ISBN_POS 5
#define BOOKTITLE_POS 6
#define CHAPTER_POS 7
#define EDITION_POS 8
#define EDITOR_POS 9
#define HOWPUBLISHED_POS 10
#define INSTITUTION_POS 11
#define JOURNAL_POS 12
#define MONTH_POS 13
#define NOTE_POS 14
#define ANNOTE_POS 15
#define NUMBER_POS 16
#define ORGANIZATIONS_POS 17
#define PAGES_POS 18
#define PUBLISHER_POS 19
#define ADDRESS_POS 20
#define SCHOOL_POS 21
#define SERIES_POS 22
#define REPORTTYPE_POS 23
#define VOLUME_POS 24
#define URL_POS 25
#define CUSTOM1_POS 26
#define CUSTOM2_POS 27
#define CUSTOM3_POS 28
#define CUSTOM4_POS 29
#define CUSTOM5_POS 30
//-----------------------------------------------------------------------------
struct StringPair
{
String sRealColumnName;
String sLogicalColumnName;
};
//-----------------------------------------------------------------------------
struct Mapping
{
String sTableName;
String sURL;
StringPair aColumnPairs[COLUMN_COUNT];
};
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
class BibView;
class BibToolBar;
class BibGridwin;
class BibDataManager : public cppu::WeakImplHelper1 < ::com::sun::star::beans::XPropertyChangeListener>
{
private:
::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > xForm;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xGridModel;
::com::sun::star::uno::Reference< ::com::sun::star::registry::XSimpleRegistry > xRegistry;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xSourceProps;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xGlobalProps;
::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLQueryComposer > xParser;
::rtl::OUString aActiveDataTable;
::rtl::OUString aDataSourceURL;
::rtl::OUString aQuoteChar;
// sal_Bool bNew;
// sal_Bool bModified;
::com::sun::star::uno::Any aUID;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > xBibCursor;
MappingArray* pMappingsArr;
BibView* pBibView;
BibToolBar* pToolbar;
BibGridwin* pGridWin;
String aColumnDefaults[COLUMN_COUNT];
String sIdentifierMapping;
protected:
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createGlobalProperties();
void InsertFields(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > & xGrid);
void InitRegistry();
void SetMeAsUidListener();
void RemoveMeAsUidListener();
void UpdateAddressbookCursor(::rtl::OUString aSourceName);
public:
BibDataManager(BibRegistry * pRegistry);
~BibDataManager();
virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt)
throw( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source );
::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > createDatabaseForm(const ::rtl::OUString& rURL, ::rtl::OUString& rTableName);
::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > getDatabaseForm();
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > createGridModel(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > & xDbForm);
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > createGridModel();
void loadDatabase();
void unloadDatabase();
::com::sun::star::uno::Sequence< ::rtl::OUString> getDataSources();
::rtl::OUString getActiveDataSource() {return aDataSourceURL;}
void setActiveDataSource(const ::rtl::OUString& rURL);
::rtl::OUString getActiveDataTable();
void setActiveDataTable(const ::rtl::OUString& rTable);
void setFilter(const ::rtl::OUString& rQuery);
::rtl::OUString getFilter();
::com::sun::star::uno::Sequence< ::rtl::OUString> getQueryFields();
void setQueryField(const ::rtl::OUString& rField);
::rtl::OUString getQueryField();
void startQueryWith(const ::rtl::OUString& rQuery);
::rtl::OUString getQueryString();
::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLQueryComposer > getParser();
// void saveGridModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & xDbForm);
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > loadGridModel(const ::rtl::OUString& rName);
void setBeamerSize(long nSize);
long getBeamerSize();
void setViewSize(long nSize);
long getViewSize();
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getViewProperties();
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getChildViewProperties(const ::rtl::OUString& rName);
::rtl::OUString getControlName(sal_Int32 nFormatKey );
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > loadControlModel(const ::rtl::OUString& rName,
sal_Bool bForceListBox = sal_False);
void saveCtrModel(const ::rtl::OUString& rName,
const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & rCtrModel);
// sal_Bool isNew() { return bNew;}
// sal_Bool isModified() { return bModified;}
sal_Bool moveRelative(long nMove);
void CreateMappingDialog(Window* pParent);
::rtl::OUString CreateDBChangeDialog(Window* pParent);
const Mapping* GetMapping(const ::rtl::OUString& rTableName, const ::rtl::OUString* pURL = 0) const;
void SetMapping(const ::rtl::OUString& rTableName, const Mapping* pMapping);
const String& GetDefColumnName(sal_uInt16 nIndex) const
{return aColumnDefaults[nIndex];}
void SetView(BibView* pView) {pBibView = pView;}
void SetToolbar(BibToolBar* pSet) {pToolbar = pSet;}
void SetGridWin(BibGridwin* pSet) {pGridWin = pSet;}
const String& GetIdentifierMapping();
void ResetIdentifierMapping() {sIdentifierMapping.Erase();}
};
#endif
File diff suppressed because it is too large Load Diff
+629
View File
@@ -0,0 +1,629 @@
/*************************************************************************
*
* $RCSfile: framectr.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _SV_WAITOBJ_HXX //autogen wg. WaitObject
#include <vcl/waitobj.hxx>
#endif
#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
#include <cppuhelper/interfacecontainer.hxx>
#endif
#ifndef _COM_SUN_STAR_UTIL_URL_HPP_
#include <com/sun/star/util/URL.hpp>
#endif
#ifndef _OSL_MUTEX_HXX_
#include <osl/mutex.hxx>
#endif
//#ifndef _USR_ITERHLP_HXX
//#include <usr/iterhlp.hxx>
//#endif
#ifndef _SV_MSGBOX_HXX
#include <vcl/msgbox.hxx>
#endif
//#ifndef _TOOLKIT_UNOIFACE_HXX
//#include <toolkit/unoiface.hxx>
//#endif
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
#ifndef _BIB_FRAMECTR_HXX
#include "framectr.hxx"
#endif
#ifndef _BIB_DATMAN_HXX
#include "datman.hxx"
#endif
#ifndef _BIB_FIELDWIN_HXX
#include "fieldwin.hxx"
#endif
#ifndef ADRRESID_HXX
#include "bibresid.hxx"
#endif
#ifndef BIB_HRC
#include "bib.hrc"
#endif
#ifndef _TOOLKIT_UNOHLP_HXX
#include <toolkit/helper/vclunohelper.hxx>
#endif
#ifndef _COM_SUN_STAR_DATA_XDATABASEDIALOGS_HPP_
#include <com/sun/star/data/XDatabaseDialogs.hpp>
#endif
#ifndef _CPPUHELPER_IMPLBASE1_HXX_
#include <cppuhelper/implbase1.hxx> // helper for implementations
#endif
//using namespace vos;
using namespace osl;
using namespace cppu;
using namespace rtl;
using namespace com::sun::star::frame;
using namespace com::sun::star::uno;
using namespace com::sun::star;
#define C2U(cChar) OUString::createFromAscii(cChar)
extern rtl::OUString gGridModelCommand;
SV_IMPL_PTRARR( BibStatusDispatchArr, BibStatusDispatchPtr );
class BibFrameCtrl_Impl : public cppu::WeakImplHelper1 < XFrameActionListener >
{
public:
Mutex aMutex;
OMultiTypeInterfaceContainerHelper aLC;
BibFrameController_Impl* pController;
BibFrameCtrl_Impl()
: aLC( aMutex )
, pController(0)
{}
~BibFrameCtrl_Impl();
virtual void SAL_CALL frameAction(const FrameActionEvent& aEvent) throw( RuntimeException );
virtual void SAL_CALL disposing( const lang::EventObject& Source );
};
BibFrameCtrl_Impl::~BibFrameCtrl_Impl()
{
}
void BibFrameCtrl_Impl::frameAction(const FrameActionEvent& aEvent) throw( uno::RuntimeException )
{
if ( pController && aEvent.Frame == pController->getFrame())
{
if(aEvent.Action == FrameAction_FRAME_ACTIVATED)
{
pController->activate();
}
else if(aEvent.Action == FrameAction_FRAME_DEACTIVATING)
{
pController->deactivate();
}
}
}
void BibFrameCtrl_Impl::disposing( const lang::EventObject& Source )
{
if ( pController )
pController->getFrame()->removeFrameActionListener( this );
}
BibFrameController_Impl::BibFrameController_Impl( const uno::Reference< awt::XWindow > & xComponent):
xWindow( xComponent ),
pDatMan(NULL),
pFieldWin(NULL)
{
pBibMod = OpenBibModul();
pDatMan = (*pBibMod)->createDataManager();
xDatman = pDatMan;
bDisposing=sal_False;
bHierarchical=sal_True;
pImp = new BibFrameCtrl_Impl;
pImp->pController = this;
pImp->acquire();
}
BibFrameController_Impl::BibFrameController_Impl( const uno::Reference< awt::XWindow > & xComponent,
BibDataManager* pDataManager):
xWindow( xComponent ),
pDatMan(pDataManager),
pFieldWin(NULL),
pBibMod(NULL)
{
bDisposing=sal_False;
bHierarchical=sal_True;
pImp = new BibFrameCtrl_Impl;
pImp->pController = this;
pImp->acquire();
}
BibDataManager* BibFrameController_Impl::GetDataManager()
{
return pDatMan;
}
BibFrameController_Impl::~BibFrameController_Impl()
{
pImp->pController = NULL;
pImp->release();
delete pDatMan;
if(pBibMod)
CloseBibModul(pBibMod);
}
void BibFrameController_Impl::attachFrame( const uno::Reference< XFrame > & xArg )
{
xFrame = xArg;
xFrame->addFrameActionListener( pImp );
}
sal_Bool BibFrameController_Impl::attachModel( const uno::Reference< XModel > & xModel )
{
return sal_False;
}
sal_Bool BibFrameController_Impl::suspend( sal_Bool bSuspend )
{
if ( bSuspend )
getFrame()->removeFrameActionListener( pImp );
else
getFrame()->addFrameActionListener( pImp );
return sal_True;
}
uno::Any BibFrameController_Impl::getViewData()
{
return uno::Any();
}
void BibFrameController_Impl::restoreViewData( const uno::Any& Value )
{
}
uno::Reference< XFrame > BibFrameController_Impl::getFrame()
{
return xFrame;
}
uno::Reference< XModel > BibFrameController_Impl::getModel()
{
return uno::Reference< XModel > ();
}
void BibFrameController_Impl::dispose()
{
util::URL aURL;
aURL.Complete = C2U("0");
uno::Reference< XDispatchProvider > xProv( xFrame, UNO_QUERY );
if ( xProv.is() )
{
uno::Reference< XDispatch > aDisp = xProv->queryDispatch( aURL, C2U("_tool:_menubar"), 0 );
if ( aDisp.is() )
aDisp->dispatch( aURL, uno::Sequence<beans::PropertyValue>() );
}
delete pFieldWin;
bDisposing = sal_True;
lang::EventObject aObject;
aObject.Source = (XController*)this;
pImp->aLC.disposeAndClear(aObject);
xDatman = 0;
pDatMan = 0;
aStatusListeners.DeleteAndDestroy( 0, aStatusListeners.Count() );
}
void BibFrameController_Impl::addEventListener( const uno::Reference< lang::XEventListener > & aListener )
{
pImp->aLC.addInterface( ::getCppuType((const Reference< lang::XEventListener >*)0), aListener );
}
void BibFrameController_Impl::removeEventListener( const uno::Reference< lang::XEventListener > & aListener )
{
pImp->aLC.removeInterface( ::getCppuType((const Reference< lang::XEventListener >*)0), aListener );
}
uno::Reference< frame::XDispatch > BibFrameController_Impl::queryDispatch( const util::URL& aURL, const rtl::OUString& aTarget, sal_Int32 nSearchFlags )
{
if ( !bDisposing )
{
String aCommand( aURL.Path );
if ( aCommand.EqualsAscii("Undo") || aCommand.EqualsAscii("Cut") ||
aCommand.EqualsAscii("Copy") || aCommand.EqualsAscii("Paste") ||
aCommand.EqualsAscii("SelectAll") || aCommand.Copy(0,4).EqualsAscii("Bib/")||
aCommand.EqualsAscii("Title"))
return (frame::XDispatch*) this;
}
return uno::Reference< frame::XDispatch > ();
}
uno::Sequence<uno::Reference< XDispatch > > BibFrameController_Impl::queryDispatches( const uno::Sequence<DispatchDescriptor>& aDescripts )
{
return uno::Sequence<uno::Reference< XDispatch > >();
}
//class XDispatch
void BibFrameController_Impl::dispatch(const util::URL& aURL, const uno::Sequence< beans::PropertyValue >& aArgs)
{
if ( !bDisposing )
{
WaitObject aWaitObject;
String aCommand( aURL.Path);
if(aCommand.EqualsAscii("Bib/Mapping"))
{
Window* pParent = VCLUnoHelper::GetWindow( xWindow );
pDatMan->CreateMappingDialog(pParent);
}
else if(aCommand.EqualsAscii("Bib/source"))
{
ChangeDataSource(aArgs);
}
else if(aCommand.EqualsAscii("Bib/sdbsource"))
{
Window* pParent = VCLUnoHelper::GetWindow( xWindow );
rtl::OUString aURL = pDatMan->CreateDBChangeDialog(pParent);
if(aURL.getLength())
{
uno::Sequence< beans::PropertyValue > aArgs(2);
beans::PropertyValue* pProps = aArgs.getArray();
pProps[0].Value <<= rtl::OUString();
pProps[1].Value <<= aURL;
ChangeDataSource(aArgs);
}
}
else if(aCommand.EqualsAscii("Bib/autoFilter"))
{
sal_uInt16 nCount = aStatusListeners.Count();
for ( sal_uInt16 n=0; n<nCount; n++ )
{
BibStatusDispatch *pObj = aStatusListeners[n];
if ( pObj->aURL.Path == C2U("Bib/removeFilter") )
{
FeatureStateEvent aEvent;
aEvent.FeatureURL = pObj->aURL;
aEvent.IsEnabled = sal_True;
aEvent.Requery = sal_False;
aEvent.Source = (XDispatch *) this;
pObj->xListener->statusChanged( aEvent );
//break; because there are more than one
}
}
const beans::PropertyValue* pPropertyValue = aArgs.getConstArray();
uno::Any aValue=pPropertyValue[0].Value;
rtl::OUString aQuery;
aValue >>= aQuery;
aValue=pPropertyValue[1].Value;
rtl::OUString aQueryField;
aValue >>= aQueryField;
pDatMan->setQueryField(aQueryField);
pDatMan->startQueryWith(aQuery);
}
else if(aCommand.EqualsAscii("Bib/standardFilter"))
{
sal_uInt16 nCount = aStatusListeners.Count();
for ( sal_uInt16 n=0; n<nCount; n++ )
{
BibStatusDispatch *pObj = aStatusListeners[n];
if ( pObj->aURL.Path == C2U("Bib/removeFilter") )
{
FeatureStateEvent aEvent;
aEvent.FeatureURL = pObj->aURL;
aEvent.IsEnabled = sal_True;
aEvent.Requery = sal_False;
aEvent.Source = (XDispatch *) this;
pObj->xListener->statusChanged( aEvent );
//break; because there are more than one
}
}
uno::Reference< sdb::XSQLQueryComposer > xParser=pDatMan->getParser();
uno::Reference< data::XDatabaseDialogs > xDlgs(xParser, UNO_QUERY);
if (xDlgs.is())
{
uno::Reference< container::XNamed > xField;
xDlgs->executeFilter(xField);
pDatMan->setFilter(xParser->getFilter());
}
}
else if(aCommand.EqualsAscii("Bib/removeFilter"))
{
RemoveFilter();
}
}
}
//-----------------------------------------------------------------------------
void BibFrameController_Impl::addStatusListener(
const uno::Reference< frame::XStatusListener > & aListener,
const util::URL& aURL)
{
// create a new Reference and insert into listener array
aStatusListeners.Insert( new BibStatusDispatch( aURL, aListener ), aStatusListeners.Count() );
// den ersten Status synchron zusenden
if ( aURL.Path == C2U("Bib/hierarchical") )
{
FeatureStateEvent aEvent;
aEvent.FeatureURL = aURL;
aEvent.IsEnabled = sal_True;
aEvent.Requery = sal_False;
aEvent.Source = (XDispatch *) this;
const char* pHier = bHierarchical? "" : "*" ;
aEvent.State <<= rtl::OUString::createFromAscii(pHier);
aListener->statusChanged( aEvent );
}
else if(aURL.Path == C2U("Bib/MenuFilter"))
{
FeatureStateEvent aEvent;
aEvent.FeatureURL = aURL;
aEvent.IsEnabled = sal_True;
aEvent.Requery = sal_False;
aEvent.Source = (XDispatch *) this;
aEvent.FeatureDescriptor=pDatMan->getQueryField();
uno::Sequence<rtl::OUString> aStringSeq=pDatMan->getQueryFields();
aEvent.State.setValue(&aStringSeq,::getCppuType((uno::Sequence<rtl::OUString>*)0));
aListener->statusChanged( aEvent );
}
else if ( aURL.Path == C2U("Bib/source"))
{
FeatureStateEvent aEvent;
aEvent.FeatureURL = aURL;
aEvent.IsEnabled = sal_True;
aEvent.Requery = sal_False;
aEvent.Source = (XDispatch *) this;
aEvent.FeatureDescriptor=pDatMan->getActiveDataTable();
uno::Sequence<rtl::OUString> aStringSeq=pDatMan->getDataSources();
aEvent.State.setValue(&aStringSeq,::getCppuType((uno::Sequence<rtl::OUString>*)0));
aListener->statusChanged( aEvent );
}
else if(aURL.Path == C2U("Bib/query"))
{
FeatureStateEvent aEvent;
aEvent.FeatureURL = aURL;
aEvent.IsEnabled = sal_True;
aEvent.Requery = sal_False;
aEvent.Source = (XDispatch *) this;
aEvent.State <<= pDatMan->getQueryString();
aListener->statusChanged( aEvent );
}
else if (aURL.Path == C2U("Bib/removeFilter") )
{
rtl::OUString aFilterStr=pDatMan->getFilter();
FeatureStateEvent aEvent;
aEvent.FeatureURL = aURL;
aEvent.IsEnabled = (aFilterStr.len() > 0);
aEvent.Requery = sal_False;
aEvent.Source = (XDispatch *) this;
aListener->statusChanged( aEvent );
//break; because there are more than one
}
else
{
FeatureStateEvent aEvent;
aEvent.FeatureURL = aURL;
aEvent.IsEnabled = sal_True;
aEvent.Requery = sal_False;
aEvent.Source = (XDispatch *) this;
aEvent.State <<= OUString(String(BibResId(RID_BIB_STR_FRAME_TITLE)));
aListener->statusChanged( aEvent );
}
}
//-----------------------------------------------------------------------------
void BibFrameController_Impl::removeStatusListener(
const uno::Reference< frame::XStatusListener > & aObject, const util::URL& aURL)
{
// search listener array for given listener
// for checking equality always "cast" to XInterface
if ( !bDisposing )
{
sal_uInt16 nCount = aStatusListeners.Count();
for ( sal_uInt16 n=0; n<nCount; n++ )
{
BibStatusDispatch *pObj = aStatusListeners[n];
sal_Bool bFlag=pObj->xListener.is();
if (!bFlag || (pObj->xListener == aObject &&
( !aURL.Complete.len() || pObj->aURL.Path == aURL.Path )))
{
aStatusListeners.DeleteAndDestroy( n );
break;
}
}
}
}
//-----------------------------------------------------------------------------
void BibFrameController_Impl::RemoveFilter()
{
rtl::OUString aQuery;
pDatMan->startQueryWith(aQuery);
sal_uInt16 nCount = aStatusListeners.Count();
FeatureStateEvent aEvent;
sal_Bool bRemoveFilter=sal_False;
sal_Bool bQueryText=sal_False;
for ( sal_uInt16 n=0; n<nCount; n++ )
{
BibStatusDispatch *pObj = aStatusListeners[n];
if ( pObj->aURL.Path == C2U("Bib/removeFilter") )
{
FeatureStateEvent aEvent;
aEvent.FeatureURL = pObj->aURL;
aEvent.IsEnabled = sal_False;
aEvent.Requery = sal_False;
aEvent.Source = (XDispatch *) this;
pObj->xListener->statusChanged( aEvent );
bRemoveFilter=sal_True;
}
else if(pObj->aURL.Path == C2U("Bib/query"))
{
FeatureStateEvent aEvent;
aEvent.FeatureURL = pObj->aURL;
aEvent.IsEnabled = sal_True;
aEvent.Requery = sal_False;
aEvent.Source = (XDispatch *) this;
aEvent.State <<= aQuery;
pObj->xListener->statusChanged( aEvent );
bQueryText=sal_True;
}
if(bRemoveFilter && bQueryText)
break;
}
}
//-----------------------------------------------------------------------------
void BibFrameController_Impl::ChangeDataSource(const uno::Sequence< beans::PropertyValue >& aArgs)
{
const beans::PropertyValue* pPropertyValue = aArgs.getConstArray();
uno::Any aValue=pPropertyValue[0].Value;
rtl::OUString aDBTableName;
aValue >>= aDBTableName;
pDatMan->unloadDatabase();
if(aArgs.getLength() > 1)
{
uno::Any aDB = pPropertyValue[1].Value;
rtl::OUString aURL;
aDB >>= aURL;
pDatMan->setActiveDataSource(aURL);
aDBTableName = pDatMan->getActiveDataTable();
}
else
pDatMan->setActiveDataTable(aDBTableName);
uno::Reference< awt::XControlModel > xNewModel=pDatMan->createGridModel();
sal_uInt16 nCount = aStatusListeners.Count();
FeatureStateEvent aEvent;
sal_Bool bGridMod=sal_False;
sal_Bool bMenuFilter=sal_False;
sal_Bool bQueryText=sal_False;
for ( sal_uInt16 n=0; n<nCount; n++ )
{
BibStatusDispatch *pObj = aStatusListeners[n];
if ( COMPARE_EQUAL == pObj->aURL.Path.compareToAscii("Bib/newGridModel"))
{
aEvent.FeatureURL = pObj->aURL;
aEvent.IsEnabled = sal_True;
aEvent.Requery = sal_False;
aEvent.Source = (XDispatch *) this;
aEvent.State.setValue(&xNewModel, ::getCppuType((uno::Reference<awt::XControlModel>*)0));
pObj->xListener->statusChanged( aEvent );
bGridMod=sal_True;
}
else if(COMPARE_EQUAL == pObj->aURL.Path.compareToAscii("Bib/MenuFilter"))
{
aEvent.FeatureURL = pObj->aURL;
aEvent.IsEnabled = sal_True;
aEvent.Requery = sal_False;
aEvent.Source = (XDispatch *) this;
aEvent.FeatureDescriptor=pDatMan->getQueryField();
uno::Sequence<rtl::OUString> aStringSeq=pDatMan->getQueryFields();
aEvent.State.setValue(&aStringSeq,::getCppuType((uno::Sequence<rtl::OUString>*)0));
pObj->xListener->statusChanged( aEvent );
bMenuFilter=sal_True;
}
else if(COMPARE_EQUAL == pObj->aURL.Path.compareToAscii("Bib/query"))
{
FeatureStateEvent aEvent;
aEvent.FeatureURL = pObj->aURL;
aEvent.IsEnabled = sal_True;
aEvent.Requery = sal_False;
aEvent.Source = (XDispatch *) this;
aEvent.State <<= pDatMan->getQueryString();
pObj->xListener->statusChanged( aEvent );
bQueryText=sal_True;
}
if(bGridMod && bMenuFilter && bQueryText) break;
}
pDatMan->loadDatabase();
if(pFieldWin)
pFieldWin->Update(pDatMan->getDatabaseForm());
}
void BibFrameController_Impl::activate()
{
if(pFieldWin) pFieldWin->Show();
}
void BibFrameController_Impl::deactivate()
{
if(pFieldWin) pFieldWin->Hide();
}
+198
View File
@@ -0,0 +1,198 @@
/*************************************************************************
*
* $RCSfile: framectr.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _BIB_FRAMECTR_HXX
#define _BIB_FRAMECTR_HXX
//#ifndef _COM_SUN_STAR_FRAME_XCONTROLLER_HPP_
//#include <com/sun/star/frame/XController.hpp>
//#endif
//#ifndef _COM_SUN_STAR_FRAME_XSTORABLE_HPP_
//#include <com/sun/star/frame/XStorable.hpp>
//#endif
//#ifndef _COM_SUN_STAR_FRAME_XMODEL_HPP_
//#include <com/sun/star/frame/XModel.hpp>
//#endif
//#ifndef _COM_SUN_STAR_FRAME_XFRAMEACTIONLISTENER_HPP_
//#include <com/sun/star/frame/XFrameActionListener.hpp>
//#endif
//#ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_
//#include <com/sun/star/frame/XComponentLoader.hpp>
//#endif
//#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
//#include <com/sun/star/frame/XFrame.hpp>
//#endif
//#ifndef _COM_SUN_STAR_FRAME_FRAMEACTIONEVENT_HPP_
//#include <com/sun/star/frame/FrameActionEvent.hpp>
//#endif
//#ifndef _COM_SUN_STAR_FRAME_FRAMEACTION_HPP_
//#include <com/sun/star/frame/FrameAction.hpp>
//#endif
//#ifndef _COM_SUN_STAR_UTIL_XURLTRANSFORMER_HPP_
//#include <com/sun/star/util/XURLTransformer.hpp>
//#endif
//#ifndef _COM_SUN_STAR_AWT_XTOPWINDOW_HPP_
//#include <com/sun/star/awt/XTopWindow.hpp>
//#endif
//#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
//#include <com/sun/star/awt/XWindow.hpp>
//#endif
//#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_
//#include <com/sun/star/awt/PosSize.hpp>
//#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCHANGELISTENER_HPP_
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDER_HPP_
#include <com/sun/star/frame/XDispatchProvider.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_XDISPATCH_HPP_
#include <com/sun/star/frame/XDispatch.hpp>
#endif
//#include <usr/uno.hxx>
#ifndef _CPPUHELPER_IMPLBASE3_HXX_
#include <cppuhelper/implbase3.hxx> // helper for implementations
#endif
#ifndef _SVARRAY_HXX
#include <svtools/svarray.hxx>
#endif
#ifndef _BIB_FIELDWIN_HXX
#include "fieldwin.hxx"
#endif
#include "bibmod.hxx"
class BibDataManager;
class BibStatusDispatch
{
public:
::com::sun::star::util::URL aURL;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > xListener;
BibStatusDispatch( const ::com::sun::star::util::URL& rURL, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > xRef )
: aURL( rURL )
, xListener( xRef )
{}
};
typedef BibStatusDispatch* BibStatusDispatchPtr;
SV_DECL_PTRARR_DEL( BibStatusDispatchArr, BibStatusDispatchPtr, 4, 4 );
class BibFrameController_Impl : public cppu::WeakImplHelper3 <
::com::sun::star::frame::XController,
::com::sun::star::frame::XDispatch,
::com::sun::star::frame::XDispatchProvider
>
{
friend class BibFrameCtrl_Impl;
BibFrameCtrl_Impl* pImp;
BibStatusDispatchArr aStatusListeners;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xWindow;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame;
sal_Bool bDisposing;
sal_Bool bHierarchical;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > xDatman;
BibDataManager* pDatMan;
BibFieldWin* pFieldWin;
HdlBibModul pBibMod;
public:
BibFrameController_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > & xComponent);
BibFrameController_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > & xComponent,
BibDataManager* pDatMan);
~BibFrameController_Impl();
void activate();
void deactivate();
BibDataManager* GetDataManager();
void ChangeDataSource(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs);
void RemoveFilter();
// ::com::sun::star::frame::XController
virtual void SAL_CALL attachFrame( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > & xFrame );
virtual sal_Bool SAL_CALL attachModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xModel );
virtual sal_Bool SAL_CALL suspend( sal_Bool bSuspend );
virtual ::com::sun::star::uno::Any SAL_CALL getViewData();
virtual void SAL_CALL restoreViewData( const ::com::sun::star::uno::Any& Value );
virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame();
virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SAL_CALL getModel();
// ::com::sun::star::lang::XComponent
virtual void SAL_CALL dispose();
virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener );
virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener );
// ::com::sun::star::frame::XDispatchProvider
virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags);
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts);
//class ::com::sun::star::frame::XDispatch
virtual void SAL_CALL dispatch(const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs);
virtual void SAL_CALL addStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl, const ::com::sun::star::util::URL& aURL);
virtual void SAL_CALL removeStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl, const ::com::sun::star::util::URL& aURL);
};
#endif
+803
View File
@@ -0,0 +1,803 @@
/*************************************************************************
*
* $RCSfile: general.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning 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
#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
#include <unotools/processfactory.hxx>
#endif
#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_
#include <com/sun/star/awt/PosSize.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_XROWSET_HPP_
#include <com/sun/star/sdbc/XRowSet.hpp>
#endif
#ifndef _COM_SUN_STAR_SDB_XCOLUMN_HPP_
#include <com/sun/star/sdb/XColumn.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#endif
#ifndef _COM_SUN_STAR_FORM_LISTSOURCETYPE_HPP_
#include <com/sun/star/form/ListSourceType.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
#include <com/sun/star/awt/XWindow.hpp>
#endif
#ifndef _TOOLKIT_UNOHLP_HXX
#include <toolkit/helper/vclunohelper.hxx>
#endif
#ifndef _CPPUHELPER_IMPLBASE1_HXX_
#include <cppuhelper/implbase1.hxx> // helper for implementations
#endif
#ifndef _BIB_GENERAL_HXX
#include "general.hxx"
#endif
#include "sections.hrc"
#ifndef ADRRESID_HXX
#include "bibresid.hxx"
#endif
#ifndef _BIB_DATMAN_HXX
#include "datman.hxx"
#endif
#ifndef _BIB_FMPROP_HRC
#include "bibprop.hrc"
#endif
//#ifndef _TOOLKIT_UNOIFACE_HXX
//#include <toolkit/unoiface.hxx>
//#endif
#include <extensio.hrc>
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::form;
using namespace ::rtl;
#define C2U(cChar) OUString::createFromAscii(cChar)
#define C2S(cChar) String::CreateFromAscii(cChar)
Point lcl_MovePoint(const FixedText& rFixedText)
{
Point aRet(rFixedText.GetPosPixel());
aRet.X() += rFixedText.GetSizePixel().Width();
aRet.X() += 5;
return aRet;
}
//-----------------------------------------------------------------------------
String lcl_GetColumnName(BibDataManager* pDatMan, const Mapping* pMapping, sal_uInt16 nIndexPos)
{
String sRet = pDatMan->GetDefColumnName(nIndexPos);
if(pMapping)
for(sal_uInt16 i = 0; i < COLUMN_COUNT; i++)
{
if(pMapping->aColumnPairs[i].sLogicalColumnName == sRet)
{
sRet = pMapping->aColumnPairs[i].sRealColumnName;
break;
}
}
return sRet;
}
/* -----------------------------04.01.00 10:54--------------------------------
---------------------------------------------------------------------------*/
class BibPosListener :public cppu::WeakImplHelper1 <sdbc::XRowSetListener>
{
BibGeneralPage* pParentPage;
public:
BibPosListener(BibGeneralPage* pParent);
//XPositioningListener
virtual void SAL_CALL cursorMoved(const lang::EventObject& event) throw( uno::RuntimeException );
virtual void SAL_CALL rowChanged(const lang::EventObject& event) throw( uno::RuntimeException ){ /* not interested in */ }
virtual void SAL_CALL rowSetChanged(const lang::EventObject& event) throw( uno::RuntimeException ){ /* not interested in */ }
//XEventListener
virtual void SAL_CALL disposing(const lang::EventObject& Source) throw( uno::RuntimeException );
};
/* -----------------------------04.01.00 10:57--------------------------------
---------------------------------------------------------------------------*/
BibPosListener::BibPosListener(BibGeneralPage* pParent) :
pParentPage(pParent)
{
}
/* -----------------------------04.01.00 10:57--------------------------------
---------------------------------------------------------------------------*/
void BibPosListener::cursorMoved(const lang::EventObject& /*aEvent*/) throw( uno::RuntimeException )
{
try
{
uno::Reference< form::XBoundComponent > xLstBox = pParentPage->GetTypeListBoxModel();
uno::Reference< beans::XPropertySet > xPropSet(xLstBox, UNO_QUERY);
if(xPropSet.is())
{
BibDataManager* pDatMan = pParentPage->GetDataManager();
const Mapping* pMapping = pDatMan->GetMapping(pDatMan->getActiveDataTable());
String sTypeMapping = pDatMan->GetDefColumnName(AUTHORITYTYPE_POS);
if(pMapping)
{
for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++)
{
if(pMapping->aColumnPairs[nEntry].sLogicalColumnName == sTypeMapping)
{
sTypeMapping = pMapping->aColumnPairs[nEntry].sRealColumnName;
break;
}
}
}
rtl::OUString uTypeMapping = sTypeMapping;
uno::Reference< form::XForm > xForm = pDatMan->getDatabaseForm();
uno::Reference< sdbcx::XColumnsSupplier > xSupplyCols(xForm, UNO_QUERY);
uno::Reference< container::XNameAccess > xValueAcc;
if (xSupplyCols.is())
xValueAcc = xSupplyCols->getColumns();
sal_Int16 nTempVal = -1;
if(xValueAcc.is() && xValueAcc->hasByName(uTypeMapping))
{
uno::Any aVal = xValueAcc->getByName(uTypeMapping);
uno::Reference< uno::XInterface > xInt = *(uno::Reference< uno::XInterface > *)aVal.getValue();
uno::Reference< sdb::XColumn > xCol(xInt, UNO_QUERY);
DBG_ASSERT(xCol.is(), "BibPosListener::positioned : invalid column (no sdb::XColumn) !");
if (xCol.is())
{
nTempVal = xCol->getShort();
// getShort returns zero if the value is not a number
if (!nTempVal || xCol->wasNull())
{
rtl::OUString sTempVal = xCol->getString();
if(sTempVal != rtl::OUString('0'))
nTempVal = -1;
}
}
}
if(nTempVal < 0 || nTempVal >= TYPE_COUNT)
{
uno::Any aSel;
uno::Sequence<sal_Int16> aSelSeq(1);
sal_Int16* pArr = aSelSeq.getArray();
pArr[0] = TYPE_COUNT;
aSel.setValue(&aSelSeq, ::getCppuType((Sequence<sal_Int16>*)0));
xPropSet->setPropertyValue(C2U("SelectedItems"), aSel);
}
}
}
catch(...)
{
DBG_ERROR("BibPosListener::positioned: something went wrong !");
}
}
/* -----------------------------04.01.00 11:28--------------------------------
---------------------------------------------------------------------------*/
void BibPosListener::disposing(const lang::EventObject& Source) throw( uno::RuntimeException )
{
}
/* -----------------16.11.99 13:06-------------------
--------------------------------------------------*/
BibGeneralPage::BibGeneralPage(Window* pParent, BibDataManager* pMan):
TabPage(pParent,BibResId(RID_TP_GENERAL)),
pDatMan(pMan),
aControlParentWin(this, WB_DIALOGCONTROL),
aIdentifierFT(&aControlParentWin, ResId(FT_IDENTIFIER )),
aAuthTypeFT(&aControlParentWin, ResId(FT_AUTHTYPE )),
aAuthorFT(&aControlParentWin, ResId(FT_AUTHOR )),
aMonthFT(&aControlParentWin, ResId(FT_MONTH )),
aYearFT(&aControlParentWin, ResId(FT_YEAR )),
aPublisherFT(&aControlParentWin, ResId(FT_PUBLISHER )),
aISBNFT(&aControlParentWin, ResId(FT_ISBN )),
aAddressFT(&aControlParentWin, ResId(FT_ADDRESS )),
aAnnoteFT(&aControlParentWin, ResId(FT_ANNOTE )),
aBooktitleFT(&aControlParentWin, ResId(FT_BOOKTITLE )),
aChapterFT(&aControlParentWin, ResId(FT_CHAPTER )),
aEditionFT(&aControlParentWin, ResId(FT_EDITION )),
aEditorFT(&aControlParentWin, ResId(FT_EDITOR )),
aHowpublishedFT(&aControlParentWin, ResId(FT_HOWPUBLISHED )),
aInstitutionFT(&aControlParentWin, ResId(FT_INSTITUTION )),
aJournalFT(&aControlParentWin, ResId(FT_JOURNAL )),
aNoteFT(&aControlParentWin, ResId(FT_NOTE )),
aNumberFT(&aControlParentWin, ResId(FT_NUMBER )),
aOrganizationsFT(&aControlParentWin, ResId(FT_ORGANIZATION )),
aPagesFT(&aControlParentWin, ResId(FT_PAGE )),
aSchoolFT(&aControlParentWin, ResId(FT_SCHOOL )),
aSeriesFT(&aControlParentWin, ResId(FT_SERIES )),
aTitleFT(&aControlParentWin, ResId(FT_TITLE )),
aReportTypeFT(&aControlParentWin, ResId(FT_REPORT )),
aVolumeFT(&aControlParentWin, ResId(FT_VOLUME )),
aURLFT(&aControlParentWin, ResId(FT_URL )),
aCustom1FT(&aControlParentWin, ResId(FT_CUSTOM1 )),
aCustom2FT(&aControlParentWin, ResId(FT_CUSTOM2 )),
aCustom3FT(&aControlParentWin, ResId(FT_CUSTOM3 )),
aCustom4FT(&aControlParentWin, ResId(FT_CUSTOM4 )),
aCustom5FT(&aControlParentWin, ResId(FT_CUSTOM5 )),
aHoriScroll(this, WB_HORZ),
aVertScroll(this, WB_VERT),
sErrorPrefix(ResId(ST_ERROR_PREFIX))
{
aControlParentWin.Show();
aStdSize = GetOutputSizePixel();
aBibTypeArr[0] = String(ResId(ST_TYPE_ARTICLE));
aBibTypeArr[1] = String(ResId(ST_TYPE_BOOK));
aBibTypeArr[2] = String(ResId(ST_TYPE_BOOKLET));
aBibTypeArr[3] = String(ResId(ST_TYPE_CONFERENCE));
aBibTypeArr[4] = String(ResId(ST_TYPE_INBOOK ));
aBibTypeArr[5] = String(ResId(ST_TYPE_INCOLLECTION));
aBibTypeArr[6] = String(ResId(ST_TYPE_INPROCEEDINGS));
aBibTypeArr[7] = String(ResId(ST_TYPE_JOURNAL ));
aBibTypeArr[8] = String(ResId(ST_TYPE_MANUAL ));
aBibTypeArr[9] = String(ResId(ST_TYPE_MASTERSTHESIS));
aBibTypeArr[10] = String(ResId(ST_TYPE_MISC ));
aBibTypeArr[11] = String(ResId(ST_TYPE_PHDTHESIS ));
aBibTypeArr[12] = String(ResId(ST_TYPE_PROCEEDINGS ));
aBibTypeArr[13] = String(ResId(ST_TYPE_TECHREPORT ));
aBibTypeArr[14] = String(ResId(ST_TYPE_UNPUBLISHED ));
aBibTypeArr[15] = String(ResId(ST_TYPE_EMAIL ));
aBibTypeArr[16] = String(ResId(ST_TYPE_WWW ));
aBibTypeArr[17] = String(ResId(ST_TYPE_CUSTOM1 ));
aBibTypeArr[18] = String(ResId(ST_TYPE_CUSTOM2 ));
aBibTypeArr[19] = String(ResId(ST_TYPE_CUSTOM3 ));
aBibTypeArr[20] = String(ResId(ST_TYPE_CUSTOM4 ));
aBibTypeArr[21] = String(ResId(ST_TYPE_CUSTOM5 ));
FreeResource();
aBasePos = aIdentifierFT.GetPosPixel();
aFixedTexts[0] = &aIdentifierFT;
aFixedTexts[1] = &aAuthTypeFT;
aFixedTexts[2] = &aAuthorFT;
aFixedTexts[3] = &aMonthFT;
aFixedTexts[4] = &aYearFT;
aFixedTexts[5] = &aPublisherFT;
aFixedTexts[6] = &aISBNFT;
aFixedTexts[7] = &aAddressFT;
aFixedTexts[8] = &aAnnoteFT;
aFixedTexts[9] = &aBooktitleFT;
aFixedTexts[10] = &aChapterFT;
aFixedTexts[11] = &aEditionFT;
aFixedTexts[12] = &aEditorFT;
aFixedTexts[13] = &aHowpublishedFT;
aFixedTexts[14] = &aInstitutionFT;
aFixedTexts[15] = &aJournalFT;
aFixedTexts[16] = &aNoteFT;
aFixedTexts[17] = &aNumberFT;
aFixedTexts[18] = &aOrganizationsFT;
aFixedTexts[19] = &aPagesFT;
aFixedTexts[20] = &aSchoolFT;
aFixedTexts[21] = &aSeriesFT;
aFixedTexts[22] = &aTitleFT;
aFixedTexts[23] = &aReportTypeFT;
aFixedTexts[24] = &aVolumeFT;
aFixedTexts[25] = &aURLFT;
aFixedTexts[26] = &aCustom1FT;
aFixedTexts[27] = &aCustom2FT;
aFixedTexts[28] = &aCustom3FT;
aFixedTexts[29] = &aCustom4FT;
aFixedTexts[30] = &aCustom5FT;
for(USHORT i = 0; i < FIELD_COUNT; i++)
aControls[i] = 0;
AdjustScrollbars();
Link aScrollLnk(LINK(this, BibGeneralPage, ScrollHdl));
aHoriScroll.SetScrollHdl( aScrollLnk );
aVertScroll.SetScrollHdl( aScrollLnk );
aHoriScroll.SetLineSize(10);
aVertScroll.SetLineSize(10);
aHoriScroll.SetPageSize( aIdentifierFT.GetSizePixel().Width());
aVertScroll.SetPageSize(
aPublisherFT.GetPosPixel().Y() - aIdentifierFT.GetPosPixel().Y());
aHoriScroll.Show();
aVertScroll.Show();
const Mapping* pMapping = pDatMan->GetMapping(pDatMan->getActiveDataTable());
xCtrlContnr = VCLUnoHelper::CreateControlContainer(&aControlParentWin);
xMgr = utl::getProcessServiceFactory();
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, IDENTIFIER_POS),
lcl_MovePoint(aIdentifierFT), aIdentifierFT.GetSizePixel(), sTableErrorString,
aIdentifierFT.GetText(), HID_BIB_IDENTIFIER_POS);
sTypeColumnName = lcl_GetColumnName(pDatMan, pMapping, AUTHORITYTYPE_POS);
AddControlWithError(
sTypeColumnName,
lcl_MovePoint(aAuthTypeFT ), aAuthTypeFT .GetSizePixel(), sTableErrorString, aAuthTypeFT.GetText(), HID_BIB_AUTHORITYTYPE_POS);
Point aYearPos = lcl_MovePoint(aYearFT);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, YEAR_POS),
aYearPos, aYearFT.GetSizePixel(), sTableErrorString, aYearFT.GetText(), HID_BIB_YEAR_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, AUTHOR_POS),
lcl_MovePoint(aAuthorFT ), aAuthorFT .GetSizePixel(), sTableErrorString, aAuthorFT.GetText(), HID_BIB_AUTHOR_POS);
Point aTitlePos(lcl_MovePoint(aTitleFT));
Size aTitleSize = aTitleFT .GetSizePixel();
aTitleSize.Width() = aYearPos.X() + aYearFT.GetSizePixel().Width() - aTitlePos.X();
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, TITLE_POS),
aTitlePos, aTitleSize, sTableErrorString, aTitleFT.GetText(), HID_BIB_TITLE_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, PUBLISHER_POS),
lcl_MovePoint(aPublisherFT), aPublisherFT.GetSizePixel(), sTableErrorString, aPublisherFT.GetText(), HID_BIB_PUBLISHER_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, ADDRESS_POS),
lcl_MovePoint(aAddressFT ), aAddressFT .GetSizePixel(), sTableErrorString, aAddressFT.GetText(), HID_BIB_ADDRESS_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, ISBN_POS),
lcl_MovePoint(aISBNFT ), aISBNFT .GetSizePixel(), sTableErrorString, aISBNFT.GetText(), HID_BIB_ISBN_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, CHAPTER_POS),
lcl_MovePoint(aChapterFT ), aChapterFT .GetSizePixel(), sTableErrorString, aChapterFT.GetText(), HID_BIB_CHAPTER_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, PAGES_POS),
lcl_MovePoint(aPagesFT ), aPagesFT .GetSizePixel(), sTableErrorString, aPagesFT.GetText(), HID_BIB_PAGES_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, EDITOR_POS),
lcl_MovePoint(aEditorFT ), aEditorFT .GetSizePixel(), sTableErrorString, aEditorFT.GetText(), HID_BIB_EDITOR_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, EDITION_POS),
lcl_MovePoint(aEditionFT ), aEditionFT .GetSizePixel(), sTableErrorString, aEditionFT.GetText(), HID_BIB_EDITION_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, BOOKTITLE_POS),
lcl_MovePoint(aBooktitleFT ), aBooktitleFT .GetSizePixel(), sTableErrorString, aBooktitleFT.GetText(), HID_BIB_BOOKTITLE_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, VOLUME_POS),
lcl_MovePoint(aVolumeFT ), aVolumeFT .GetSizePixel(), sTableErrorString, aVolumeFT.GetText(), HID_BIB_VOLUME_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, HOWPUBLISHED_POS),
lcl_MovePoint(aHowpublishedFT ), aHowpublishedFT .GetSizePixel(), sTableErrorString, aHowpublishedFT.GetText(), HID_BIB_HOWPUBLISHED_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, ORGANIZATIONS_POS),
lcl_MovePoint(aOrganizationsFT), aOrganizationsFT.GetSizePixel(), sTableErrorString, aOrganizationsFT.GetText(), HID_BIB_ORGANIZATIONS_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, INSTITUTION_POS),
lcl_MovePoint(aInstitutionFT ), aInstitutionFT .GetSizePixel(), sTableErrorString, aInstitutionFT.GetText(), HID_BIB_INSTITUTION_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, SCHOOL_POS),
lcl_MovePoint(aSchoolFT ), aSchoolFT .GetSizePixel(), sTableErrorString, aSchoolFT.GetText(), HID_BIB_SCHOOL_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, REPORTTYPE_POS),
lcl_MovePoint(aReportTypeFT ), aReportTypeFT .GetSizePixel(), sTableErrorString, aReportTypeFT.GetText(), HID_BIB_REPORTTYPE_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, MONTH_POS),
lcl_MovePoint(aMonthFT), aMonthFT .GetSizePixel(), sTableErrorString, aMonthFT.GetText(), HID_BIB_MONTH_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, JOURNAL_POS),
lcl_MovePoint(aJournalFT ), aJournalFT .GetSizePixel(), sTableErrorString, aJournalFT.GetText(), HID_BIB_JOURNAL_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, NUMBER_POS),
lcl_MovePoint(aNumberFT ), aNumberFT .GetSizePixel(), sTableErrorString, aNumberFT.GetText(), HID_BIB_NUMBER_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, SERIES_POS),
lcl_MovePoint(aSeriesFT ), aSeriesFT .GetSizePixel(), sTableErrorString, aSeriesFT.GetText(), HID_BIB_SERIES_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, ANNOTE_POS),
lcl_MovePoint(aAnnoteFT ), aAnnoteFT .GetSizePixel(), sTableErrorString, aAnnoteFT.GetText(), HID_BIB_ANNOTE_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, NOTE_POS),
lcl_MovePoint(aNoteFT ), aNoteFT .GetSizePixel(), sTableErrorString, aNoteFT.GetText(), HID_BIB_NOTE_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, URL_POS),
lcl_MovePoint(aURLFT ), aURLFT .GetSizePixel(), sTableErrorString, aURLFT.GetText(), HID_BIB_URL_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, CUSTOM1_POS),
lcl_MovePoint(aCustom1FT ), aCustom1FT.GetSizePixel(), sTableErrorString, aCustom1FT.GetText(), HID_BIB_CUSTOM1_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, CUSTOM2_POS),
lcl_MovePoint(aCustom2FT ), aCustom2FT.GetSizePixel(), sTableErrorString, aCustom2FT.GetText(), HID_BIB_CUSTOM2_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, CUSTOM3_POS),
lcl_MovePoint(aCustom3FT ), aCustom3FT.GetSizePixel(), sTableErrorString, aCustom3FT.GetText(), HID_BIB_CUSTOM3_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, CUSTOM4_POS),
lcl_MovePoint(aCustom4FT ), aCustom4FT.GetSizePixel(), sTableErrorString, aCustom4FT.GetText(), HID_BIB_CUSTOM4_POS);
AddControlWithError(
lcl_GetColumnName(pDatMan, pMapping, CUSTOM5_POS),
lcl_MovePoint(aCustom5FT ), aCustom5FT.GetSizePixel(), sTableErrorString, aCustom5FT.GetText(), HID_BIB_CUSTOM5_POS);
// AddXControl("", lcl_MovePoint(.GetPosPixel()), .GetSizePixel(), sTableErrorString);
xPosListener = new BibPosListener(this);
uno::Reference< sdbc::XRowSet > xRowSet(pDatMan->getDatabaseForm(), UNO_QUERY);
if(xRowSet.is())
xRowSet->addRowSetListener(xPosListener);
xFormCtrl = uno::Reference< form::XFormController > (
xMgr->createInstance(C2U("com.sun.star.form.controller.FormController")), UNO_QUERY);
xFormCtrl->setModel(uno::Reference< awt::XTabControllerModel > (pDatMan->getDatabaseForm(), UNO_QUERY));
xFormCtrl->setContainer(xCtrlContnr);
xFormCtrl->activateTabOrder();
if(sTableErrorString.Len())
sTableErrorString.Insert(sErrorPrefix, 0);
}
//-----------------------------------------------------------------------------
BibGeneralPage::~BibGeneralPage()
{
if (pDatMan && xPosListener.is())
{
uno::Reference< sdbc::XRowSet > xRowSet(pDatMan->getDatabaseForm(), UNO_QUERY);
if(xRowSet.is())
xRowSet->removeRowSetListener(xPosListener);
}
}
/* -----------------------------14.04.00 13:11--------------------------------
---------------------------------------------------------------------------*/
void BibGeneralPage::RemoveListeners()
{
for(USHORT i = 0; i < FIELD_COUNT; i++)
{
if(aControls[i].is())
{
uno::Reference< awt::XWindow > xCtrWin(aControls[i], uno::UNO_QUERY );
xCtrWin->removeFocusListener( this );
aControls[i] = 0;
}
}
}
/* -----------------------------21.01.00 17:05--------------------------------
---------------------------------------------------------------------------*/
void BibGeneralPage::CommitActiveControl()
{
uno::Reference< awt::XControl > xCurr = xFormCtrl->getCurrentControl();
if(xCurr.is())
{
uno::Reference< awt::XControlModel > xModel = xCurr->getModel();
uno::Reference< form::XBoundComponent > xBound(xModel, UNO_QUERY);
if(xBound.is())
xBound->commit();
}
}
//-----------------------------------------------------------------------------
void BibGeneralPage::AddControlWithError(const String& rColumnName,
const Point& rPos,
const Size& rSize,
String& rErrorString,
String aColumnUIName,
sal_uInt16 nHelpId)
{
uno::Reference< awt::XControlModel > xTmp = AddXControl(rColumnName, rPos, rSize, nHelpId);
if(!xTmp.is())
{
if(rErrorString.Len())
{
rErrorString += '\n';
}
aColumnUIName.EraseAllChars('~');
rErrorString += aColumnUIName;
}
}
//-----------------------------------------------------------------------------
uno::Reference< awt::XControlModel > BibGeneralPage::AddXControl(
const String& rName,
Point rPos, Size rSize, sal_uInt16 nHelpId)
{
uno::Reference< awt::XControlModel > xCtrModel;
try
{
sal_Bool bTypeListBox = sTypeColumnName == rName;
xCtrModel = pDatMan->loadControlModel(rName, bTypeListBox);
if ( xCtrModel.is() && xMgr.is())
{
uno::Reference< beans::XPropertySet > xPropSet( xCtrModel, UNO_QUERY );
if( xPropSet.is())
{
uno::Reference< beans::XPropertySetInfo > xPropInfo = xPropSet->getPropertySetInfo();
uno::Any aAny = xPropSet->getPropertyValue( C2U("DefaultControl") );
rtl::OUString aControlName;
aAny >>= aControlName;
rtl::OUString uProp(C2U("HelpURL"));
if(xPropInfo->hasPropertyByName(uProp))
{
String sId(C2S("HID:"));
sId += nHelpId;
rtl::OUString uId(sId) ;
uno::Any aVal; aVal <<= uId;
xPropSet->setPropertyValue(uProp, aVal);
}
if(bTypeListBox)
{
//uno::Reference< beans::XPropertySet > xPropSet(xControl, UNO_QUERY);
uno::Any aAny;
aAny <<= (sal_Int16)1;
xPropSet->setPropertyValue(C2U("BoundColumn"), aAny);
// ListSourceType eSet = ListSourceType_SQL;
ListSourceType eSet = ListSourceType_VALUELIST;
aAny.setValue( &eSet, ::getCppuType((const ListSourceType*)0) );
xPropSet->setPropertyValue(C2U("ListSourceType"), aAny);
uno::Sequence<rtl::OUString> aListSource(TYPE_COUNT);
rtl::OUString* pListSourceArr = aListSource.getArray();
//pListSourceArr[0] = C2U("select TypeName, TypeIndex from TypeNms");
for(sal_uInt16 i = 0; i < TYPE_COUNT; i++)
pListSourceArr[i] = String::CreateFromInt32(i);
aAny.setValue(&aListSource, ::getCppuType((uno::Sequence<rtl::OUString>*)0));
xPropSet->setPropertyValue(C2U("ListSource"), aAny);
uno::Sequence<rtl::OUString> aValues(TYPE_COUNT + 1);
rtl::OUString* pValuesArr = aValues.getArray();
for(sal_uInt16 j = 0; j < TYPE_COUNT; j++)
pValuesArr[j] = aBibTypeArr[j];
// empty string if an invalid value no values is set
pValuesArr[TYPE_COUNT] = rtl::OUString();
aAny.setValue(&aValues, ::getCppuType((uno::Sequence<rtl::OUString>*)0));
xPropSet->setPropertyValue(C2U("StringItemList"), aAny);
BOOL bTrue = sal_True;
aAny.setValue( &bTrue, ::getBooleanCppuType() );
xPropSet->setPropertyValue( C2U("Dropdown"), aAny );
aControlName = C2U("com.sun.star.form.control.ListBox");
xLBModel = Reference< form::XBoundComponent >(xCtrModel, UNO_QUERY);
}
uno::Reference< awt::XControl > xControl(xMgr->createInstance( aControlName ), UNO_QUERY );
if ( xControl.is() )
{
xControl->setModel( xCtrModel);
// Peer als Child zu dem FrameWindow
xCtrlContnr->addControl(rName, xControl);
uno::Reference< awt::XWindow > xCtrWin(xControl, UNO_QUERY );
xCtrWin->addFocusListener( this );
for(USHORT i = 0; i < FIELD_COUNT; i++)
if(!aControls[i].is())
{
aControls[i] = xCtrWin;
break;
}
xCtrWin->setVisible( sal_True );
xControl->setDesignMode(sal_False);
xCtrWin->setPosSize(rPos.X(), rPos.Y(), rSize.Width(),
rSize.Height(), awt::PosSize::POSSIZE);
}
}
}
}
catch(...)
{
DBG_ERROR("BibGeneralPage::AddXControl: something went wrong !");
}
return xCtrModel;
}
/* -----------------------------14.04.00 11:15--------------------------------
---------------------------------------------------------------------------*/
void BibGeneralPage::AdjustScrollbars()
{
long nVertScrollWidth = aVertScroll.GetSizePixel().Width();
long nHoriScrollHeight = aHoriScroll.GetSizePixel().Height();
Size aOutSize(GetOutputSizePixel());
BOOL bHoriVisible = aOutSize.Width() <= aStdSize.Width();
BOOL bVertVisible = (aOutSize.Height()-(bHoriVisible ? nHoriScrollHeight : 0)) <= (aStdSize.Height());
aHoriScroll.Show(bHoriVisible);
aVertScroll.Show(bVertVisible);
if(bHoriVisible)
{
Size aHoriSize(aOutSize.Width() - (bVertVisible ? nVertScrollWidth : 0),
nHoriScrollHeight);
aHoriScroll.SetSizePixel(aHoriSize);
aHoriScroll.SetRange( Range(0, aStdSize.Width()));
aHoriScroll.SetVisibleSize( aHoriSize.Width() - (bVertVisible ? nVertScrollWidth : 0));
}
if(bVertVisible)
{
Size aVertSize(nHoriScrollHeight, aOutSize.Height() -
(bHoriVisible ? nHoriScrollHeight : 0));
aVertScroll.SetSizePixel(aVertSize);
aVertScroll.SetRange( Range(0, aStdSize.Height()));
aVertScroll.SetVisibleSize( aVertSize.Height() );
}
Size aSize(8, 8);
aSize = LogicToPixel(aSize, MapMode(MAP_APPFONT));
Size aScrollSize(aOutSize.Width() - aSize.Height(), aSize.Height());
Point aScrollPos(0, aOutSize.Height() - aSize.Height());
aHoriScroll.SetPosSizePixel(aScrollPos, aScrollSize);
aScrollPos.X() = aOutSize.Width() - aSize.Width();
aScrollPos.Y() = 0;
aScrollSize.Width() = aSize.Width();
aScrollSize.Height() = aOutSize.Height() - aSize.Height();
aVertScroll.SetPosSizePixel(aScrollPos, aScrollSize);
Size aControlParentWinSz(aOutSize);
if(bHoriVisible)
aControlParentWinSz.Height() -= aSize.Height();
if(bVertVisible)
aControlParentWinSz.Width() -= aSize.Width();
aControlParentWin.SetSizePixel(aControlParentWinSz);
}
/* -----------------------------13.04.00 16:54--------------------------------
---------------------------------------------------------------------------*/
void BibGeneralPage::Resize()
{
AdjustScrollbars();
ScrollHdl(&aVertScroll);
ScrollHdl(&aHoriScroll);
Window::Resize();
}
/* -----------------------------14.04.00 11:18--------------------------------
---------------------------------------------------------------------------*/
IMPL_LINK(BibGeneralPage, ScrollHdl, ScrollBar*, pScroll)
{
BOOL bVertical = &aVertScroll == pScroll;
long nOffset = 0;
if(bVertical)
{
long nCurrentOffset = aFixedTexts[0]->GetPosPixel().Y() - aBasePos.Y();
nOffset = pScroll->GetThumbPos() + nCurrentOffset;
}
else
{
long nCurrentOffset = aFixedTexts[0]->GetPosPixel().X() - aBasePos.X();
nOffset = pScroll->GetThumbPos() + nCurrentOffset;
}
for(USHORT i = 0; i < FIELD_COUNT; i++)
{
Point aPos = aFixedTexts[i]->GetPosPixel();
if(bVertical)
aPos.Y() -= nOffset;
else
aPos.X() -= nOffset;
aFixedTexts[i]->SetPosPixel(aPos);
if(aControls[i].is())
{
awt::Rectangle aRect = aControls[i]->getPosSize();
long nX = aRect.X;
long nY = aRect.Y;
if(bVertical)
nY -= nOffset;
else
nX -= nOffset;
aControls[i]->setPosSize(nX, nY, 0, 0, awt::PosSize::POS);
}
}
return 0;
}
/* -----------------------------14.04.00 12:49--------------------------------
---------------------------------------------------------------------------*/
void BibGeneralPage::focusGained(const awt::FocusEvent& rEvent) throw( uno::RuntimeException )
{
Reference<awt::XWindow> xCtrWin(rEvent.Source, UNO_QUERY );
if(xCtrWin.is())
{
Size aOutSize = aControlParentWin.GetOutputSizePixel();
awt::Rectangle aRect = xCtrWin->getPosSize();
long nX = aRect.X;
if(nX < 0)
{
// left of the visible area
aHoriScroll.SetThumbPos(aHoriScroll.GetThumbPos() + nX);
ScrollHdl(&aHoriScroll);
}
else if(nX > aOutSize.Width())
{
// right of the visible area
aHoriScroll.SetThumbPos(aHoriScroll.GetThumbPos() + nX - aOutSize.Width() + aFixedTexts[0]->GetSizePixel().Width());
ScrollHdl(&aHoriScroll);
}
long nY = aRect.Y;
if(nY < 0)
{
// below the visible area
aVertScroll.SetThumbPos(aVertScroll.GetThumbPos() + nY);
ScrollHdl(&aVertScroll);
}
else if(nY > aOutSize.Height())
{
// over the visible area
aVertScroll.SetThumbPos(aVertScroll.GetThumbPos() + nY - aOutSize.Height()+ aFixedTexts[0]->GetSizePixel().Height());
ScrollHdl(&aVertScroll);
}
}
}
/* -----------------------------14.04.00 12:49--------------------------------
---------------------------------------------------------------------------*/
void BibGeneralPage::focusLost(const awt::FocusEvent& ) throw( uno::RuntimeException )
{
}
/* -----------------------------14.04.00 12:52--------------------------------
---------------------------------------------------------------------------*/
void BibGeneralPage::disposing(const lang::EventObject& Source) throw( uno::RuntimeException )
{
}
+225
View File
@@ -0,0 +1,225 @@
/*************************************************************************
*
* $RCSfile: general.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _BIB_GENERAL_HXX
#define _BIB_GENERAL_HXX
#ifndef _COM_SUN_STAR_AWT_XFOCUSLISTENER_HPP_
#include <com/sun/star/awt/XFocusListener.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XCONTROLCONTAINER_HPP_
#include <com/sun/star/awt/XControlContainer.hpp>
#endif
//#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
//#include <com/sun/star/lang/XMultiServiceFactory.hpp>
//#endif
#ifndef _COM_SUN_STAR_FORM_XBOUNDCOMPONENT_HPP_
#include <com/sun/star/form/XBoundComponent.hpp>
#endif
#ifndef _COM_SUN_STAR_FORM_XFORMCONTROLLER_HPP_
#include <com/sun/star/form/XFormController.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_XROWSETLISTENER_HPP_
#include <com/sun/star/sdbc/XRowSetListener.hpp>
#endif
#ifndef _STDCTRL_HXX //autogen
#include <svtools/stdctrl.hxx>
#endif
#ifndef _LSTBOX_HXX //autogen
#include <vcl/lstbox.hxx>
#endif
#ifndef _SV_GROUP_HXX //autogen
#include <vcl/group.hxx>
#endif
#ifndef _SVEDIT_HXX //autogen
#include <svtools/svmedit.hxx>
#endif
#ifndef _SV_TABPAGE_HXX //autogen
#include <vcl/tabpage.hxx>
#endif
#ifndef _SV_COMBOBOX_HXX //
#include <vcl/combobox.hxx>
#endif
#ifndef _SV_SCRBAR_HXX
#include <vcl/scrbar.hxx>
#endif
#ifndef _CPPUHELPER_IMPLBASE1_HXX_
#include <cppuhelper/implbase1.hxx> // helper for implementations
#endif
class BibDataManager;
#define TYPE_COUNT 22
#define FIELD_COUNT 31
typedef cppu::WeakAggImplHelper1
<
::com::sun::star::awt::XFocusListener
> BibGeneralPageBaseClass;
class BibGeneralPage:
public BibGeneralPageBaseClass,
public TabPage
{
Window aControlParentWin;
FixedText aIdentifierFT;
FixedText aAuthTypeFT;
FixedText aAuthorFT;
FixedText aMonthFT;
FixedText aYearFT;
FixedText aPublisherFT;
FixedText aISBNFT;
FixedText aAddressFT;
FixedText aAnnoteFT;
FixedText aBooktitleFT;
FixedText aChapterFT;
FixedText aEditionFT;
FixedText aEditorFT;
FixedText aHowpublishedFT;
FixedText aInstitutionFT;
FixedText aJournalFT;
FixedText aNoteFT;
FixedText aNumberFT;
FixedText aOrganizationsFT;
FixedText aPagesFT;
FixedText aSchoolFT;
FixedText aSeriesFT;
FixedText aTitleFT;
FixedText aReportTypeFT;
FixedText aVolumeFT;
FixedText aURLFT;
FixedText aCustom1FT;
FixedText aCustom2FT;
FixedText aCustom3FT;
FixedText aCustom4FT;
FixedText aCustom5FT;
ScrollBar aHoriScroll;
ScrollBar aVertScroll;
FixedText* aFixedTexts[FIELD_COUNT];
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> aControls[FIELD_COUNT];
Size aStdSize;
Point aBasePos;
String aBibTypeArr[TYPE_COUNT];
String sErrorPrefix;
String sTableErrorString;
String sTypeColumnName;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > xCtrlContnr;
::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > xFormCtrl;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMgr;
::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent > xCurrentBoundComponent;
::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent > xLBModel;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener > xPosListener;
BibDataManager* pDatMan;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > AddXControl(const String& rName, Point aPos, Size aSize, sal_uInt16 nHelpId);
void AddControlWithError(const String& rColumnName,
const Point& rPos, const Size& rSize, String& rErrorString,
String aColumnUIName, sal_uInt16 nHelpId);
void AdjustScrollbars();
DECL_LINK(ScrollHdl, ScrollBar*);
protected:
virtual void Resize();
public:
BibGeneralPage(Window* pParent, BibDataManager* pDatMan);
virtual ~BibGeneralPage();
const String& GetErrorString() const {return sTableErrorString;}
::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent > GetTypeListBoxModel() {return xLBModel;}
BibDataManager* GetDataManager() {return pDatMan;}
void CommitActiveControl();
virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( com::sun::star::uno::RuntimeException );
void SAL_CALL focusGained(const ::com::sun::star::awt::FocusEvent& e) throw( com::sun::star::uno::RuntimeException );
void SAL_CALL focusLost(const ::com::sun::star::awt::FocusEvent& e) throw( com::sun::star::uno::RuntimeException );
void RemoveListeners();
};
#endif
@@ -0,0 +1,95 @@
/*************************************************************************
*
* $RCSfile: hidother.src,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning 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 "..\..\inc\extensio.hrc" // HID_FUNC_XXX
//#include "hidother.hrc"
hidspecial HID_BIB_IDENTIFIER_POS { HelpID = HID_BIB_IDENTIFIER_POS ; };
hidspecial HID_BIB_AUTHORITYTYPE_POS { HelpID = HID_BIB_AUTHORITYTYPE_POS ; };
hidspecial HID_BIB_AUTHOR_POS { HelpID = HID_BIB_AUTHOR_POS ; };
hidspecial HID_BIB_TITLE_POS { HelpID = HID_BIB_TITLE_POS ; };
hidspecial HID_BIB_YEAR_POS { HelpID = HID_BIB_YEAR_POS ; };
hidspecial HID_BIB_ISBN_POS { HelpID = HID_BIB_ISBN_POS ; };
hidspecial HID_BIB_BOOKTITLE_POS { HelpID = HID_BIB_BOOKTITLE_POS ; };
hidspecial HID_BIB_CHAPTER_POS { HelpID = HID_BIB_CHAPTER_POS ; };
hidspecial HID_BIB_EDITION_POS { HelpID = HID_BIB_EDITION_POS ; };
hidspecial HID_BIB_EDITOR_POS { HelpID = HID_BIB_EDITOR_POS ; };
hidspecial HID_BIB_HOWPUBLISHED_POS { HelpID = HID_BIB_HOWPUBLISHED_POS ; };
hidspecial HID_BIB_INSTITUTION_POS { HelpID = HID_BIB_INSTITUTION_POS ; };
hidspecial HID_BIB_JOURNAL_POS { HelpID = HID_BIB_JOURNAL_POS ; };
hidspecial HID_BIB_MONTH_POS { HelpID = HID_BIB_MONTH_POS ; };
hidspecial HID_BIB_NOTE_POS { HelpID = HID_BIB_NOTE_POS ; };
hidspecial HID_BIB_ANNOTE_POS { HelpID = HID_BIB_ANNOTE_POS ; };
hidspecial HID_BIB_NUMBER_POS { HelpID = HID_BIB_NUMBER_POS ; };
hidspecial HID_BIB_ORGANIZATIONS_POS { HelpID = HID_BIB_ORGANIZATIONS_POS ; };
hidspecial HID_BIB_PAGES_POS { HelpID = HID_BIB_PAGES_POS ; };
hidspecial HID_BIB_PUBLISHER_POS { HelpID = HID_BIB_PUBLISHER_POS ; };
hidspecial HID_BIB_ADDRESS_POS { HelpID = HID_BIB_ADDRESS_POS ; };
hidspecial HID_BIB_SCHOOL_POS { HelpID = HID_BIB_SCHOOL_POS ; };
hidspecial HID_BIB_SERIES_POS { HelpID = HID_BIB_SERIES_POS ; };
hidspecial HID_BIB_REPORTTYPE_POS { HelpID = HID_BIB_REPORTTYPE_POS ; };
hidspecial HID_BIB_VOLUME_POS { HelpID = HID_BIB_VOLUME_POS ; };
hidspecial HID_BIB_URL_POS { HelpID = HID_BIB_URL_POS ; };
hidspecial HID_BIB_CUSTOM1_POS { HelpID = HID_BIB_CUSTOM1_POS ; };
hidspecial HID_BIB_CUSTOM2_POS { HelpID = HID_BIB_CUSTOM2_POS ; };
hidspecial HID_BIB_CUSTOM3_POS { HelpID = HID_BIB_CUSTOM3_POS ; };
hidspecial HID_BIB_CUSTOM4_POS { HelpID = HID_BIB_CUSTOM4_POS ; };
hidspecial HID_BIB_CUSTOM5_POS { HelpID = HID_BIB_CUSTOM5_POS ; };
hidspecial HID_BIB_DB_GRIDCTRL { HelpID = HID_BIB_DB_GRIDCTRL ; };
+225
View File
@@ -0,0 +1,225 @@
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1.1.1 $
#
# last change: $Author: hr $ $Date: 2000-09-18 16:16:45 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
#
# - GNU Lesser General Public License Version 2.1
# - Sun Industry Standards Source License Version 1.1
#
# Sun Microsystems Inc., October, 2000
#
# GNU Lesser General Public License Version 2.1
# =============================================
# Copyright 2000 by Sun Microsystems, Inc.
# 901 San Antonio Road, Palo Alto, CA 94303, USA
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1, as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
#
# Sun Industry Standards Source License Version 1.1
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.1 (the "License"); You may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at http://www.openoffice.org/license.html.
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning 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=bib
TARGET=bib
GEN_HID=TRUE
ENABLE_EXCEPTIONS=TRUE
USE_DEFFILE=TRUE
NO_BSYMBOLIC=TRUE
# --- Settings -----------------------------------------------------
.INCLUDE : $(PRJ)$/util$/makefile.pmk
# --- Files --------------------------------------------------------
CXXFILES= bibcont.cxx \
bibload.cxx \
bibmod.cxx \
general.cxx \
framectr.cxx \
bibview.cxx \
bibbeam.cxx \
toolbar.cxx \
datman.cxx \
registry.cxx \
bibexch.cxx \
fieldwin.cxx \
viewsect.cxx
SLOFILES= $(SLO)$/bibcont.obj \
$(SLO)$/bibload.obj \
$(SLO)$/bibmod.obj \
$(SLO)$/general.obj \
$(SLO)$/framectr.obj \
$(SLO)$/bibview.obj \
$(SLO)$/bibbeam.obj \
$(SLO)$/toolbar.obj \
$(SLO)$/datman.obj \
$(SLO)$/registry.obj \
$(SLO)$/bibexch.obj \
$(SLO)$/fieldwin.obj\
$(SLO)$/viewsect.obj
SRCFILES= bib.src \
datman.src \
sections.src \
menu.src \
toolbar.src
RESLIB1NAME=bib
RESLIB1SRSFILES= $(SRS)/bib.srs
RESLIB1DEPN= bib.src bib.hrc
SHL1TARGET= $(TARGET)$(UPD)$(DLLPOSTFIX)
# $(UNOLIB) \
SHL1STDLIBS= \
$(CPPULIB) \
$(CPPUHELPERLIB) \
$(VOSLIB) \
$(TOOLSLIB) \
$(SO2LIB) \
$(VCLLIB) \
$(TKLIB) \
$(SVTOOLLIB)\
$(SVLLIB) \
$(OSLLIB) \
$(SALLIB) \
$(UNOTOOLSLIB) \
$(SOTLIB) \
$(UCBHELPERLIB)
#Create UNO Header files
UNOUCROUT=$(OUT)$/inc$/$(PRJNAME)
INCPRE+=$(UNOUCROUT)
UNOUCRDEP= $(SOLARBINDIR)$/applicat.rdb
UNOUCRRDB= $(SOLARBINDIR)$/applicat.rdb
UNOTYPES=\
com.sun.star.awt.PosSize \
com.sun.star.awt.XPointer \
com.sun.star.awt.XControl \
com.sun.star.awt.XControlContainer \
com.sun.star.awt.XControlModel \
com.sun.star.awt.XWindowPeer \
com.sun.star.beans.PropertyAttribute \
com.sun.star.beans.PropertyValue \
com.sun.star.beans.PropertyValues \
com.sun.star.data.XDatabaseDialogs \
com.sun.star.data.XDatabaseFavorites \
com.sun.star.form.XBoundComponent \
com.sun.star.form.XLoadable \
com.sun.star.form.XGridColumnFactory \
com.sun.star.form.ListSourceType \
com.sun.star.form.XForm \
com.sun.star.form.XFormController \
com.sun.star.frame.XComponentLoader \
com.sun.star.frame.XDispatchProvider \
com.sun.star.frame.XFilterDetect\
com.sun.star.frame.FrameSearchFlag \
com.sun.star.io.XPersistObject \
com.sun.star.io.XDataInputStream \
com.sun.star.io.XActiveDataSource \
com.sun.star.io.XMarkableStream \
com.sun.star.io.XActiveDataSink \
com.sun.star.lang.XLocalizable \
com.sun.star.lang.XServiceName \
com.sun.star.registry.XSimpleRegistry \
com.sun.star.sdb.CommandType\
com.sun.star.sdb.XDatabaseEnvironment \
com.sun.star.sdb.XColumn\
com.sun.star.sdb.XSQLQueryComposerFactory\
com.sun.star.sdbc.DataType \
com.sun.star.sdbc.ResultSetType \
com.sun.star.sdbc.ResultSetConcurrency \
com.sun.star.sdbc.XConnection \
com.sun.star.sdbc.XDataSource \
com.sun.star.sdbc.XResultSetUpdate \
com.sun.star.sdbcx.XTablesSupplier \
com.sun.star.sdbcx.XColumnsSupplier \
com.sun.star.sdbcx.XRowLocate \
com.sun.star.sdb.XSQLQueryComposer\
com.sun.star.sdbc.XResultSet \
com.sun.star.sdbc.ResultSetType \
com.sun.star.sdbc.XRowSet\
com.sun.star.text.BibliographyDataField \
com.sun.star.uno.XNamingService\
com.sun.star.util.XLocalizedAliases\
com.sun.star.util.XURLTransformer
#END
SHL1LIBS= $(SLB)$/$(TARGET).lib
SHL1IMPLIB= i$(TARGET)
SHL1DEPN= $(SHL1LIBS)
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
DEF1EXPORTFILE= exports.dxp
ALL:\
$(do_build) \
$(SRS)$/hidother.hid\
ALLTAR
$(SRS)$/hidother.hid: hidother.src
.IF "$(GUI)" =="WNT"
@+echo
@+echo NO HIDS!
@+echo
+copy ..\..\inc\extensio.hrc .
+mhids hidother.src ..$/..$/$(INPATH)$/srs bib hidother
+del extensio.hrc
.ELSE
@echo wnt only
.ENDIF
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
+594
View File
@@ -0,0 +1,594 @@
/*************************************************************************
*
* $RCSfile: menu.src,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include <svtools/solar.hrc>
#include <sfx2/sfxsids.hrc>
#ifndef _GLOBLMN_HRC
#include <svx/globlmn.hrc>
#endif
#ifndef _GLOBALACC_SRC
#include <svx/globlac.hrc>
#endif
#include <offmgr/ofaids.hrc>
#include <offmgr/sbasltid.hrc>
#include <extensio.hrc>
#include "bib.hrc"
#define MN_EDIT 20
#define MN_VIEW 21
#define MN_EXTRA 22
#define MN_WIN 30
#define MN_HELP 31
Menu RID_MAIN_MENU
{
ItemList =
{
MenuItem
{
ITEM_FILE_PICKLIST
SubMenu = Menu
{
ItemList =
{
MenuItem
{
ITEM_FILE_NEWDOC
};
MenuItem
{
ITEM_FILE_OPENDOC
};
ITEM_FILE_AUTOPILOT
MenuItem
{
Separator = TRUE ;
};
MenuItem
{
ITEM_FILE_CLOSEDOC
};
/*
MenuItem
{
ITEM_FILE_SAVEDOC
};
MenuItem
{
ITEM_FILE_SAVEASDOC
};
*/
MenuItem
{
ITEM_FILE_SAVEDOCS //!!muss fuer andere geoeffnete Tasks drinbleiben
};
MenuItem
{
Command = ".uno:ss/sendasemail" ;
Identifier = 369;
Text = "Als E-Mail ~versenden..." ;
Text[ English ] = "Send as EMail...";
Text [ english_us ] = "Send as ~E-mail..." ;
Text[ portuguese ] = "~Enviar como e-mail...";
Text[ russian ] = "Îòïðàâèòü êàê ýëåêòðîííîå ïèñüìî...";
Text[ dutch ] = "Als ~e-mail verzenden...";
Text[ french ] = "~Envoyer par e-mail...";
Text[ spanish ] = "Enviar como ~mensaje electrónico...";
Text[ italian ] = "~Invia come eMail...";
Text[ danish ] = "Send som e-mail...";
Text[ swedish ] = "~Skicka som e-post...";
Text[ polish ] = "Wyœlij jako e-mail...";
Text[ portuguese_brazilian ] = "Send Even~t as EMail...";
Text[ japanese ] = "E-mail‚Æ‚µ‚Ä‘—�M(~E)...";
Text[ chinese_simplified ] = "µ±×÷µç×ÓÓʼþ¼Ä·¢(~E)...";
Text[ chinese_traditional ] = "·í§@¹q¤l¶l¥óµo°e(~E)...";
Text[ arabic ] = "ÅÑÓÇá ßÈÑíÏ ÅáßÊÑæäí...";
Text[ greek ] = "ÁðïóôïëÞ ~ùò E-mail...";
Text[ korean ] = "ÀüÀÚ¿ìÆíÀ¸·Î º¸³»±â(~E)...";
Text[ turkish ] = "E-posta olarak gönder...";
Text[ language_user1 ] = " ";
};
/*
MenuItem
{
ITEM_FILE_MAIL_SENDDOC
};
*/
MenuItem
{
Separator = TRUE ;
};
MenuItem
{
ITEM_FILE_PRINTDOC
};
MenuItem
{
ITEM_FILE_SETUPPRINTER
};
MenuItem
{
Separator = TRUE ;
};
MenuItem
{
ITEM_FILE_QUITAPP
};
};
};
};
MenuItem
{
Identifier = MN_EDIT ;
HelpID = MN_EDIT ;
Text = "~Bearbeiten" ;
Text [ English ] = "~Edit" ;
Text [ norwegian ] = "~Rediger" ;
Text [ italian ] = "~Modifica" ;
Text [ portuguese_brazilian ] = "~Editar" ;
Text [ portuguese ] = "~Editar" ;
Text [ finnish ] = "~Muokkaa" ;
Text [ danish ] = "~Rediger" ;
Text [ french ] = "~Édition" ;
Text [ swedish ] = "R~edigera" ;
Text [ dutch ] = "Be~werken" ;
Text [ spanish ] = "~Editar" ;
Text [ english_us ] = "~Edit" ;
SubMenu = Menu
{
ItemList =
{
/* MenuItem
{
ITEM_EDIT_UNDO
Command = ".uno:Bib/undo" ;
};
MenuItem
{
ITEM_EDIT_REDO
};
MenuItem
{
ITEM_EDIT_REPEAT
};
MenuItem
{
Separator = TRUE ;
};*/
MenuItem
{
ITEM_EDIT_CUT
};
MenuItem
{
ITEM_EDIT_COPY
};
MenuItem
{
ITEM_EDIT_PASTE
};
MenuItem
{
ITEM_EDIT_SELECTALL
};
MenuItem
{
Separator = TRUE ;
};
MenuItem
{
HelpId = HID_BIB_MAPPINGDLG;
Text = "~Spaltenzuordnung..." ;
Text[ English ] = "~Column assignment..." ;
Command = ".uno:Bib/Mapping" ;
Identifier = RID_MAIN_ME_MAPPING ;
Checkable=TRUE;
Text[ english_us ] = "~Column Arrangement...";
Text[ portuguese ] = "~Dispor colunas...";
Text[ russian ] = "~Ðàñïîëîæåíèå êîëîíîê...";
Text[ greek ] = "Áíôéóôïß÷éóç ~óôÞëçò...";
Text[ dutch ] = "~Kolomindeling...";
Text[ french ] = "~Assignation de colonnes...";
Text[ spanish ] = "~Asignación de columnas...";
Text[ italian ] = "A~ssegnazione colonne...";
Text[ danish ] = "Kolonnetildeling...";
Text[ swedish ] = "~Kolumntilldelning...";
Text[ polish ] = "Przyporz¹dkowanie kolumn...";
Text[ portuguese_brazilian ] = "~Column assignment...";
Text[ japanese ] = "—ñ‚Ì•ª—Þ(~C)...";
Text[ korean ] = "¿­ ¹èÁ¤(~C)...";
Text[ chinese_simplified ] = "±àÅÅÁÐ(~C)...";
Text[ chinese_traditional ] = "½s±ÆÄæ(~C)...";
Text[ arabic ] = "ÊÚííä ÇáÃÚãÏÉ...";
Text[ turkish ] = "~Sütun düzeni...";
Text[ language_user1 ] = " ";
};
MenuItem
{
HelpId = HID_BIB_CHANGESOURCE;
Text = "~Datenquelle..." ;
Text[ English ] = "~Data source..." ;
Command = ".uno:Bib/sdbsource" ;
Identifier = RID_MAIN_ME_DBSOURCE;
Checkable=TRUE;
Text[ english_us ] = "~Data Source...";
Text[ portuguese ] = "~Fonte de dados...";
Text[ russian ] = "~Èñõîäíûå äàííûå...";
Text[ greek ] = "ÐñïÝëåõóç ~äåäïìÝíùí...";
Text[ dutch ] = "~Gegevensbron...";
Text[ french ] = "~Source de données...";
Text[ spanish ] = "~Fuente de datos...";
Text[ italian ] = "Sorgente ~dati...";
Text[ danish ] = "Datakilde...";
Text[ swedish ] = "~Datakälla...";
Text[ polish ] = "�ród³o danych...";
Text[ portuguese_brazilian ] = "~Data source...";
Text[ japanese ] = "ÃÞ°À¿°½(~D)...";
Text[ korean ] = "µ¥ÀÌÅÍ ¼Ò½º(~D)...";
Text[ chinese_simplified ] = "Êý¾ÝÀ´Ô´(~D)...";
Text[ chinese_traditional ] = "¼ÆÕu·½(~D)...";
Text[ arabic ] = "ãÕÏÑ ÇáÈíÇäÇÊ...";
Text[ turkish ] = "~Veri kaynaðý...";
Text[ language_user1 ] = " ";
};
/* MenuItem
{
Separator = TRUE ;
};
MenuItem
{
Text = "~Layout" ;
Text[ English ] = "~Layout" ;
Command = ".uno:Bib/Layout" ;
Identifier = RID_MAIN_ME_LAYOUT;
Checkable=TRUE;
};
MenuItem
{
Separator = TRUE ;
};
MenuItem
{
ITEM_EDIT_SEARCH_DLG
};
MenuItem
{
ITEM_EDIT_SBA_ADDRPI
};
MenuItem
{
Separator = TRUE ;
};
MenuItem
{
ITEM_EDIT_EDIT_FRAMESET
};
*/
};
};
Text[ russian ] = "~Ïðàâêà";
Text[ polish ] = "~Edytuj";
Text[ japanese ] = "•Ò�W(~E)";
Text[ chinese_simplified ] = "±à¼­(~E)";
Text[ chinese_traditional ] = "½s¿è(~E)";
Text[ arabic ] = "~ÊÍÑíÑ";
Text[ greek ] = "~Åðåîåñãáóßá";
Text[ korean ] = "ÆíÁý(~E)";
Text[ turkish ] = "~Düzenle";
Text[ language_user1 ] = " ";
};
MenuItem
{
Identifier = MN_VIEW ;
HelpID = MN_VIEW ;
Text = "~Ansicht" ;
Text [ English ] = "~View" ;
Text [ norwegian ] = "~Vis" ;
Text [ italian ] = "~Visualizza" ;
Text [ portuguese_brazilian ] = "~Ver" ;
Text [ portuguese ] = "~Ver" ;
Text [ finnish ] = "~Näytä" ;
Text [ danish ] = "~Vis" ;
Text [ french ] = "~Affichage" ;
Text [ swedish ] = "Vi~sa" ;
Text [ dutch ] = "Beel~d" ;
Text [ spanish ] = "~Ver" ;
Text [ english_us ] = "~View" ;
SubMenu = Menu
{
ItemList =
{
MenuItem
{
ITEM_VIEW_EXPLORER
};
MenuItem
{
ITEM_VIEW_BROWSER
};
MenuItem
{
Separator = TRUE ;
};
MenuItem
{
Identifier = 22 ;
HelpID = 22 ;
Text = "S~ymbolleisten" ;
Text [ English ] = "Toolbars" ;
Text [ english_us ] = "~Toolbars" ;
Text [ swedish ] = "S~ymbollister" ;
Text [ danish ] = "Ikonlin~jer" ;
Text [ italian ] = "Barr~e dei simboli" ;
Text [ spanish ] = "Barras de ~símbolos" ;
Text [ french ] = "Barres d'~outils" ;
Text [ dutch ] = "We~rkbalken" ;
Text [ portuguese ] = "Barras de ~ferramentas" ;
Text [ portuguese_brazilian ] = "Symbolleisten" ;
SubMenu = Menu
{
ItemList =
{
MenuItem
{
ITEM_VIEW_TOGGLEFUNCTIONBAR
};
MenuItem
{
ITEM_VIEW_TOGGLEOBJECTBAR
};
MenuItem
{
ITEM_INSERT_HYPERLINK_INSERT
};
/*
MenuItem
{
Separator = TRUE ;
};
MenuItem
{
Identifier = SID_CUSTOMIZETOOLBOX ;
HelpID = SID_CUSTOMIZETOOLBOX ;
Text = "~Bearbeiten..." ;
Text [ English ] = "~Customize..." ;
Text [ english_us ] = "~Customize..." ;
Text [ swedish ] = "~Redigera..." ;
Text [ danish ] = "~Rediger..." ;
Text [ italian ] = "~Modifica..." ;
Text [ spanish ] = "~Personalizar..." ;
Text [ french ] = "~Personnaliser..." ;
Text [ dutch ] = "~Bewerken..." ;
Text [ portuguese ] = "~Personalizar..." ;
Text [ portuguese_brazilian ] = "~Bearbeiten..." ;
};
*/
};
};
Text[ russian ] = "Ïàíåëè ñèìâîëîâ";
Text[ polish ] = "Paski symboli";
Text[ japanese ] = "°ÙÊÞ°(~T)";
Text[ chinese_simplified ] = "ͼ±êÀ¸(~T)";
Text[ chinese_traditional ] = "¤u¨ã¦C(~T)";
Text[ arabic ] = "ÃÔÑØÉ ÇáÑãæÒ";
Text[ greek ] = "ÃñáììÝò ó~õìâüëùí";
Text[ korean ] = "µµ±¸¸ðÀ½(~T)";
Text[ turkish ] = "Araç çubuklarý";
Text[ language_user1 ] = " ";
};
MenuItem
{
ITEM_VIEW_TOGGLESTATUSBAR
};
/* MenuItem
{
Separator = TRUE ;
};
MenuItem
{
Text = "Hierarchisch" ;
Text[ English ] = "Hierarchical" ;
Command = ".uno:Bib/hierarchical" ;
Identifier = RID_MAIN_ME_HIERARCHICAL;
Checkable=TRUE;
};
*/ MenuItem
{
Separator = TRUE ;
};
ITEM_VIEW_SCREENMODE
};
};
Text[ russian ] = "~Âèä";
Text[ greek ] = "Ðñï~âïëÞ";
Text[ polish ] = "~Widok";
Text[ japanese ] = "•\\ަ(~V)";
Text[ korean ] = "º¸±â(~V)";
Text[ chinese_simplified ] = "ÊÓͼ(~V)";
Text[ chinese_traditional ] = "À˵ø(~V)";
Text[ arabic ] = "~ÚÑÖ";
Text[ turkish ] = "Görünüm";
Text[ language_user1 ] = " ";
};
MenuItem
{
Identifier = MN_EXTRA ;
HelpID = MN_EXTRA ;
Text = "E~xtras" ;
Text [ English ] = "T~ools" ;
Text [ norwegian ] = "Verk~tøy" ;
Text [ italian ] = "~Strumenti" ;
Text [ portuguese_brazilian ] = "F~erramentas" ;
Text [ portuguese ] = "~Ferramentas" ;
Text [ finnish ] = "~Työkalut" ;
Text [ danish ] = "Fun~ktioner" ;
Text [ french ] = "~Outils" ;
Text [ swedish ] = "~Verktyg" ;
Text [ dutch ] = "E~xtra" ;
Text [ spanish ] = "~Herramientas" ;
Text [ english_us ] = "~Tools" ;
SubMenu = Menu
{
ItemList =
{
/* MenuItem
{
Text = "Neue Adresse" ;
Text [ English ] = "New Address" ;
Command = ".uno:Bib/newEntry" ;
Identifier = RID_MAIN_ME_NEWENTRY;
};
MenuItem
{
Text = "Adresse ändern" ;
Text [ English ] = "Change Address" ;
Command = ".uno:Bib/changeEntry" ;
Identifier = RID_MAIN_ME_CHANGEENTRY;
};
MenuItem
{
Text = "Adresse löschen" ;
Text [ English ] = "Remove Address" ;
Command = ".uno:Bib/removeEntry" ;
Identifier = RID_MAIN_ME_REMOVEENTRY;
};
MenuItem
{
Separator = TRUE ;
};
*/ MenuItem
{
Command = ".uno:Bib/standardFilter" ;
Identifier = RID_MAIN_ME_SEARCH;
Text = "~Filtern...";
Text[ English ] = "Filter..." ;
Text[ english_us ] = "~Filter...";
Text[ portuguese ] = "~Filtrar...";
Text[ russian ] = "Ôèëüòð...";
Text[ greek ] = "ÖéëôñÜñéóìá...";
Text[ dutch ] = "~Filteren...";
Text[ french ] = "~Filtrer...";
Text[ spanish ] = "~Filtrar...";
Text[ italian ] = "~Filtra...";
Text[ danish ] = "Filtrer...";
Text[ swedish ] = "~Filtrera...";
Text[ polish ] = "Filtruj...";
Text[ portuguese_brazilian ] = "Filter...";
Text[ japanese ] = "̨ÙÀ(~F)...";
Text[ korean ] = "ÇÊÅÍ(~F)...";
Text[ chinese_simplified ] = "ɸѡ(~F)...";
Text[ chinese_traditional ] = "¿z¿ï(~F)...";
Text[ arabic ] = "ÊÕÝíÉ...";
Text[ turkish ] = "~Filtrele...";
Text[ language_user1 ] = " ";
};
/* MenuItem
{
Separator = TRUE ;
};
MenuItem
{
Command = ".uno:Bib/InsertFieldDlg" ;
Identifier = RID_MAIN_ME_FIELDDLG;
Text = "Felder ~einfügen...";
Text[ English ] = "Insert Fields..." ;
};
*/ MenuItem
{
Separator = TRUE ;
};
MenuItem
{
ITEM_TOOLS_BASICCHOOSER
};
/*
MenuItem
{
ITEM_TOOLS_CONFIG
};
*/
ITEM_MN_OPTIONS
};
};
Text[ russian ] = "~Ñåðâèñ";
Text[ greek ] = "Å~ñãáëåßá";
Text[ polish ] = "~Narzêdzia";
Text[ japanese ] = "°Ù(~T)";
Text[ korean ] = "µµ±¸(~T)";
Text[ chinese_simplified ] = "¹¤¾ß(~T)";
Text[ chinese_traditional ] = "¤u¨ã(~T)";
Text[ arabic ] = "Ã~ÏæÇÊ";
Text[ turkish ] = "~Araçlar";
Text[ language_user1 ] = " ";
};
ITEM_WINDOW_MENU
ITEM_HELP_MENU
};
};
+159
View File
@@ -0,0 +1,159 @@
/*************************************************************************
*
* $RCSfile: sections.hrc,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning 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 "bib.hrc"
//General
/*#define FT_FIRST_MIDDLE 1
#define ED_FIRST 2
#define ED_MIDDLE 3
#define FT_NAME_SUFFIX 4
#define ED_NAME 5
#define CB_SUFFIX 6
#define ED_INITIALS 8
#define FT_COMPANY 9
#define ED_COMPANY 10
#define FT_DEPARTMENT 11
#define ED_DEPARTMENT 12
#define FT_SALUTATION 13
#define CB_SALUTATION 14
#define FT_SHOWNNAME 15
#define ED_SHOWNNAME 16*/
#define FT_IDENTIFIER 1
#define FT_AUTHTYPE 2
#define FT_AUTHOR 3
#define FT_YEAR 4
#define FT_ISBN 5
#define FT_MONTH 6
#define FT_PUBLISHER 8
#define FT_ADDRESS 9
#define FT_ANNOTE 10
#define FT_BOOKTITLE 11
#define FT_CHAPTER 12
#define FT_EDITION 13
#define FT_EDITOR 14
#define FT_HOWPUBLISHED 15
#define FT_INSTITUTION 16
#define FT_JOURNAL 17
#define FT_NOTE 18
#define FT_NUMBER 19
#define FT_ORGANIZATION 20
#define FT_PAGE 21
#define FT_SCHOOL 22
#define FT_SERIES 23
#define FT_TITLE 24
#define FT_REPORT 25
#define FT_VOLUME 26
#define FT_URL 27
#define FT_CUSTOM1 28
#define FT_CUSTOM2 29
#define FT_CUSTOM3 30
#define FT_CUSTOM4 31
#define FT_CUSTOM5 32
#define ST_ERROR_PREFIX 33
//Business Address
#define FT_OFFICE 1
#define FT_STREET 2
#define FT_CITY 3
#define FT_STATE 4
#define FT_COUNTRY 5
#define FT_ZIP 6
#define ED_OFFICE 7
#define ED_STREET 8
#define ED_CITY 9
#define ED_STATE 10
#define ED_COUNTRY 11
#define ED_ZIP 12
#define ED_POBOX 13
//Popup SectionControl
#define PU_INSERT 1
#define PU_REMOVE 2
#define PU_CHG_NAME 3
#define ST_TYPE_ARTICLE 40
#define ST_TYPE_BOOK 41
#define ST_TYPE_BOOKLET 42
#define ST_TYPE_CONFERENCE 43
#define ST_TYPE_INBOOK 44
#define ST_TYPE_INCOLLECTION 45
#define ST_TYPE_INPROCEEDINGS 46
#define ST_TYPE_JOURNAL 47
#define ST_TYPE_MANUAL 48
#define ST_TYPE_MASTERSTHESIS 49
#define ST_TYPE_MISC 50
#define ST_TYPE_PHDTHESIS 51
#define ST_TYPE_PROCEEDINGS 52
#define ST_TYPE_TECHREPORT 53
#define ST_TYPE_UNPUBLISHED 54
#define ST_TYPE_EMAIL 55
#define ST_TYPE_WWW 56
#define ST_TYPE_CUSTOM1 57
#define ST_TYPE_CUSTOM2 58
#define ST_TYPE_CUSTOM3 59
#define ST_TYPE_CUSTOM4 60
#define ST_TYPE_CUSTOM5 61
File diff suppressed because it is too large Load Diff
+566
View File
@@ -0,0 +1,566 @@
/*************************************************************************
*
* $RCSfile: toolbar.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning 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 <osl/mutex.hxx>
#include <tools/urlobj.hxx>
#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
#include <unotools/processfactory.hxx>
#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_UTIL_XURLTRANSFORMER_HPP_
#include <com/sun/star/util/XURLTransformer.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HPP_
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#endif
#include <svtools/iniprop.hxx>
#include <svtools/iniman.hxx>
#ifndef _TOOLS_DEBUG_HXX //autogen wg. DBG_ASSERT
#include <tools/debug.hxx>
#endif
#include "bibbeam.hxx"
#include "toolbar.hrc"
#include "bibresid.hxx"
using namespace ::rtl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
#define C2U(cChar) OUString::createFromAscii(cChar)
// Konstanten -------------------------------------------------------------
BibToolBarListener::BibToolBarListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId):
pToolBar(pTB),
nIndex(nId),
aCommand(aStr)
{
}
BibToolBarListener::~BibToolBarListener()
{
}
void BibToolBarListener::statusChanged(const ::com::sun::star::frame::FeatureStateEvent& rEvt)throw( ::com::sun::star::uno::RuntimeException )
{
if(rEvt.FeatureURL.Complete == aCommand)
{
pToolBar->EnableItem(nIndex,rEvt.IsEnabled);
::com::sun::star::uno::Any aState=rEvt.State;
if(aState.getValueType()==::getBooleanCppuType())
{
sal_Bool bChecked= *(sal_Bool*)aState.getValue();
pToolBar->CheckItem(nIndex, bChecked);
}
/*
rtl::OUString FeatureDescriptor;
sal_Bool Requery;
::com::sun::star::uno::Any State;*/
}
};
sal_uInt16 BibToolBarListener::GetIndex()
{
return nIndex;
}
void BibToolBarListener::SetIndex(sal_uInt16 nId)
{
nIndex=nId;
}
rtl::OUString BibToolBarListener::GetCommand()
{
return aCommand;
}
void BibToolBarListener::SetCommand(const rtl::OUString& aStr)
{
aCommand=aStr;
}
BibTBListBoxListener::BibTBListBoxListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId):
BibToolBarListener(pTB,aStr,nId)
{
}
BibTBListBoxListener::~BibTBListBoxListener()
{
}
void BibTBListBoxListener::statusChanged(const ::com::sun::star::frame::FeatureStateEvent& rEvt)throw( ::com::sun::star::uno::RuntimeException )
{
if(rEvt.FeatureURL.Complete == GetCommand())
{
pToolBar->EnableSourceList(rEvt.IsEnabled);
Any aState = rEvt.State;
if(aState.getValueType() == ::getCppuType((Sequence<rtl::OUString>*)0))
{
pToolBar->UpdateSourceList(sal_False);
pToolBar->ClearSourceList();
Sequence<rtl::OUString>* pStringSeq = (Sequence<rtl::OUString>*)aState.getValue();
const rtl::OUString* pStringArray = (const rtl::OUString*)pStringSeq->getConstArray();
sal_uInt32 nCount = pStringSeq->getLength();
XubString aEntry;
for( sal_uInt32 i=0; i<nCount; i++ )
{
aEntry = String(pStringArray[i]);
pToolBar->InsertSourceEntry(aEntry);
}
pToolBar->UpdateSourceList(sal_True);
}
XubString aStr = String(rEvt.FeatureDescriptor);
pToolBar->SelectSourceEntry(aStr);
}
};
BibTBQueryMenuListener::BibTBQueryMenuListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId):
BibToolBarListener(pTB,aStr,nId)
{
}
BibTBQueryMenuListener::~BibTBQueryMenuListener()
{
}
void BibTBQueryMenuListener::statusChanged(const frame::FeatureStateEvent& rEvt)throw( uno::RuntimeException )
{
if(rEvt.FeatureURL.Complete == GetCommand())
{
pToolBar->EnableSourceList(rEvt.IsEnabled);
uno::Any aState=rEvt.State;
if(aState.getValueType()==::getCppuType((Sequence<rtl::OUString>*)0))
{
pToolBar->ClearFilterMenu();
Sequence<rtl::OUString>* pStringSeq = (Sequence<rtl::OUString>*) aState.getValue();
const rtl::OUString* pStringArray = (const rtl::OUString*)pStringSeq->getConstArray();
sal_uInt32 nCount = pStringSeq->getLength();
for( sal_uInt32 i=0; i<nCount; i++ )
{
sal_uInt16 nID=pToolBar->InsertFilterItem(String(pStringArray[i]));
if(pStringArray[i]==rEvt.FeatureDescriptor)
{
// XubString aStr = rEvt.FeatureDescriptor;
pToolBar->SelectFilterItem(nID);
}
}
}
}
};
BibTBEditListener::BibTBEditListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId):
BibToolBarListener(pTB,aStr,nId)
{
}
BibTBEditListener::~BibTBEditListener()
{
}
void BibTBEditListener::statusChanged(const frame::FeatureStateEvent& rEvt)throw( uno::RuntimeException )
{
if(rEvt.FeatureURL.Complete == GetCommand())
{
pToolBar->EnableQuery(rEvt.IsEnabled);
uno::Any aState=rEvt.State;
if(aState.getValueType()==::getCppuType((const OUString*)0))
{
String aStr = String(*(OUString*) aState.getValue());
pToolBar->SetQueryString(aStr);
}
}
}
SV_IMPL_PTRARR( BibToolBarListenerArr, BibToolBarListenerPtr);
BibToolBar::BibToolBar(Window* pParent, WinBits nStyle):
ToolBox(pParent,BibResId(RID_BIB_TOOLBAR)),
aFtSource(this,WB_VCENTER),
aLBSource(this,WB_DROPDOWN),
aFtQuery(this,WB_VCENTER),
aEdQuery(this),
nSelMenuItem(0),
nMenuId(0)
{
SetStyle(GetStyle()|nStyle);
SetOutStyle(TOOLBOX_STYLE_FLAT);
Size aSize=GetSizePixel();
Size a2Size(GetOutputSizePixel());
a2Size.Width()=100;
aLBSource.SetSizePixel(a2Size);
aLBSource.SetDropDownLineCount(9);
aLBSource.Show();
aLBSource.SetSelectHdl(LINK( this, BibToolBar, SelHdl));
aTimer.SetTimeoutHdl(LINK( this, BibToolBar, SendSelHdl));
aTimer.SetTimeout(400);
aMenuTimer.SetTimeoutHdl(LINK( this, BibToolBar, MenuHdl));
aMenuTimer.SetTimeout(300);
aEdQuery.SetSizePixel(aLBSource.GetSizePixel());
aEdQuery.Show();
XubString aStr=GetItemText(TBC_FT_SOURCE);
Rectangle aRect=GetItemRect(TBC_FT_SOURCE);
aFtSource.SetText(aStr);
aFtSource.SetSizePixel(aRect.GetSize());
aStr=GetItemText(TBC_FT_QUERY);
aRect=GetItemRect(TBC_FT_QUERY);
aFtQuery.SetText(aStr);
aFtQuery.SetSizePixel(aRect.GetSize());
SetItemWindow(TBC_FT_SOURCE,&aFtSource);
SetItemWindow(TBC_LB_SOURCE,&aLBSource);
SetItemWindow(TBC_FT_QUERY ,&aFtQuery);
SetItemWindow(TBC_ED_QUERY ,&aEdQuery);
}
BibToolBar::~BibToolBar()
{
}
void BibToolBar::InitListener()
{
sal_uInt16 nCount=GetItemCount();
uno::Reference< lang::XMultiServiceFactory > xMgr = utl::getProcessServiceFactory();
uno::Reference< frame::XDispatch > xDisp(xController,UNO_QUERY);
uno::Reference< util::XURLTransformer > xTrans ( xMgr->createInstance( C2U("com.sun.star.util.URLTransformer") ), UNO_QUERY );
if( xTrans.is() )
{
util::URL aQueryURL;
aQueryURL.Complete = C2U(".uno:Bib/MenuFilter");
xTrans->parseStrict( aQueryURL);
BibToolBarListener* pQuery=new BibTBQueryMenuListener(this,aQueryURL.Complete,TBC_BT_AUTOFILTER);
xDisp->addStatusListener(uno::Reference< frame::XStatusListener > (pQuery),aQueryURL);
for(sal_uInt16 nPos=0;nPos<nCount;nPos++)
{
sal_uInt16 nId=GetItemId(nPos);
if(nId==TBC_FT_SOURCE || nId==TBC_FT_QUERY) continue;
util::URL aURL;
aURL.Complete = GetItemCommand(nId);
xTrans->parseStrict( aURL );
BibToolBarListener* pListener=NULL;
if(nId==TBC_LB_SOURCE)
{
pListener=new BibTBListBoxListener(this,aURL.Complete,nId);
}
else if(nId==TBC_ED_QUERY)
{
pListener=new BibTBEditListener(this,aURL.Complete,nId);
}
else
{
pListener=new BibToolBarListener(this,aURL.Complete,nId);
}
BibToolBarListenerPtr pxInsert = new Reference<frame::XStatusListener>;
(*pxInsert) = pListener;
aListenerArr.Insert( pxInsert, aListenerArr.Count() );
xDisp->addStatusListener(uno::Reference< frame::XStatusListener > (pListener),aURL);
}
}
}
void BibToolBar::SetXController(const uno::Reference< frame::XController > & xCtr)
{
xController=xCtr;
InitListener();
}
void BibToolBar::Select()
{
sal_uInt16 nId=GetCurItemId();
if(nId!=TBC_BT_AUTOFILTER)
{
SendDispatch(nId,Sequence<PropertyValue>() );
}
else
{
Sequence<PropertyValue> aPropVal(2);
PropertyValue* pPropertyVal = (PropertyValue*)aPropVal.getConstArray();
pPropertyVal[0].Name=C2U("QueryText");
rtl::OUString aSelection = aEdQuery.GetText();
pPropertyVal[0].Value <<= aSelection;
pPropertyVal[1].Name=C2U("QueryField");
pPropertyVal[1].Value <<= aQueryField;
SendDispatch(nId,aPropVal);
}
}
void BibToolBar::SendDispatch(sal_uInt16 nId, const Sequence< PropertyValue >& rArgs)
{
rtl::OUString aCommand = GetItemCommand(nId);
uno::Reference< frame::XDispatchProvider > xDSP( xController, UNO_QUERY );
if( xDSP.is() && aCommand.len())
{
uno::Reference< lang::XMultiServiceFactory > xMgr = utl::getProcessServiceFactory();
uno::Reference< util::XURLTransformer > xTrans ( xMgr->createInstance( C2U("com.sun.star.util.URLTransformer") ), UNO_QUERY );
if( xTrans.is() )
{
// Datei laden
util::URL aURL;
aURL.Complete = aCommand;
xTrans->parseStrict( aURL );
uno::Reference< frame::XDispatch > xDisp = xDSP->queryDispatch( aURL, rtl::OUString(), frame::FrameSearchFlag::SELF );
if ( xDisp.is() )
xDisp->dispatch( aURL, rArgs);
}
}
}
void BibToolBar::Click()
{
sal_uInt16 nId=GetCurItemId();
if(nId==TBC_BT_AUTOFILTER)
{
aMenuTimer.Start();
}
}
void BibToolBar::ClearFilterMenu()
{
aPopupMenu.Clear();
nMenuId=0;
}
sal_uInt16 BibToolBar::InsertFilterItem(const XubString& aMenuEntry)
{
nMenuId++;
aPopupMenu.InsertItem(nMenuId,aMenuEntry);
return nMenuId;
}
void BibToolBar::SelectFilterItem(sal_uInt16 nId)
{
aPopupMenu.CheckItem(nId);
nSelMenuItem=nId;
aQueryField = aPopupMenu.GetItemText(nId).EraseAllChars( '~' );
}
void BibToolBar::EnableSourceList(sal_Bool bFlag)
{
aFtSource.Enable(bFlag);
aLBSource.Enable(bFlag);
}
void BibToolBar::ClearSourceList()
{
aLBSource.Clear();
}
void BibToolBar::UpdateSourceList(sal_Bool bFlag)
{
aLBSource.SetUpdateMode(bFlag);
}
void BibToolBar::InsertSourceEntry(const XubString& aEntry, sal_uInt16 nPos)
{
aLBSource.InsertEntry(aEntry, nPos);
}
void BibToolBar::SelectSourceEntry(const XubString& aStr)
{
aLBSource.SelectEntry(aStr);
}
void BibToolBar::EnableQuery(sal_Bool bFlag)
{
aFtQuery.Enable(bFlag);
aEdQuery.Enable(bFlag);
}
void BibToolBar::SetQueryString(const XubString& aStr)
{
aEdQuery.SetText(aStr);
}
long BibToolBar::PreNotify( NotifyEvent& rNEvt )
{
long nResult=sal_True;
sal_uInt16 nSwitch=rNEvt.GetType();
if(aEdQuery.HasFocus() && nSwitch==EVENT_KEYINPUT)// || nSwitch==EVENT_KEYUP)
{
const KeyCode& aKeyCode=rNEvt.GetKeyEvent()->GetKeyCode();
sal_uInt16 nKey = aKeyCode.GetCode();
if(nKey == KEY_RETURN)
{
Sequence<PropertyValue> aPropVal(2);
PropertyValue* pPropertyVal = (PropertyValue*)aPropVal.getConstArray();
pPropertyVal[0].Name = C2U("QueryText");
rtl::OUString aSelection = aEdQuery.GetText();
pPropertyVal[0].Value <<= aSelection;
pPropertyVal[1].Name=C2U("QueryField");
pPropertyVal[1].Value <<= aQueryField;
SendDispatch(TBC_BT_AUTOFILTER,aPropVal);
return nResult;
}
}
nResult=ToolBox::PreNotify(rNEvt);
return nResult;
}
IMPL_LINK( BibToolBar, SelHdl, ListBox*, pLb )
{
aTimer.Start();
return 0;
}
IMPL_LINK( BibToolBar, SendSelHdl, Timer*,pT)
{
Sequence<PropertyValue> aPropVal(1);
PropertyValue* pPropertyVal = (PropertyValue*)aPropVal.getConstArray();
pPropertyVal[0].Name = C2U("DataSourceName");
String aEntry( aLBSource.GetSelectEntry().EraseAllChars( '~' ) );
rtl::OUString aSelection = aEntry;
pPropertyVal[0].Value <<= aSelection;
SendDispatch(TBC_LB_SOURCE,aPropVal);
return 0;
}
//-----------------------------------------------------------------------------
IMPL_LINK( BibToolBar, MenuHdl, Timer*,pT)
{
if(IsItemDown(TBC_BT_AUTOFILTER))
{
EndSelection(); // vor SetDropMode (SetDropMode ruft SetItemImage)
SetItemDown(TBC_BT_AUTOFILTER,sal_True);
sal_uInt16 nId = aPopupMenu.Execute(this, GetItemRect(TBC_BT_AUTOFILTER));
if(nId>0)
{
aPopupMenu.CheckItem(nSelMenuItem,sal_False);
aPopupMenu.CheckItem(nId);
nSelMenuItem=nId;
aQueryField = aPopupMenu.GetItemText(nId).EraseAllChars( '~' );
Sequence<PropertyValue> aPropVal(2);
PropertyValue* pPropertyVal = (PropertyValue*)aPropVal.getConstArray();
pPropertyVal[0].Name = C2U("QueryText");
rtl::OUString aSelection = aEdQuery.GetText();
pPropertyVal[0].Value <<= aSelection;
pPropertyVal[1].Name=C2U("QueryField");
pPropertyVal[1].Value <<= aQueryField;
SendDispatch(TBC_BT_AUTOFILTER,aPropVal);
}
Point aPoint;
MouseEvent aLeave( aPoint, 0, MOUSE_LEAVEWINDOW | MOUSE_SYNTHETIC );
MouseMove( aLeave );
SetItemDown(TBC_BT_AUTOFILTER,sal_False);
}
return 0;
}
//-----------------------------------------------------------------------------
void BibToolBar::statusChanged(const frame::FeatureStateEvent& rEvent)
throw( uno::RuntimeException )
{
for(sal_uInt16 i = 0; i < aListenerArr.Count(); i++)
{
BibToolBarListenerPtr pListener = aListenerArr.GetObject(i);
(*pListener)->statusChanged(rEvent);
}
}
@@ -0,0 +1,77 @@
/*************************************************************************
*
* $RCSfile: toolbar.hrc,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning 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 "bib.hrc"
#define TBC_FT_SOURCE 1
#define TBC_LB_SOURCE 2
#define TBC_FT_QUERY 3
#define TBC_ED_QUERY 4
#define TBC_BT_AUTOFILTER 5
#define TBC_BT_FILTERCRIT 6
#define TBC_BT_REMOVEFILTER 7
#define TBC_BT_NEWCARD 8
#define TBC_BT_EDITCARD 9
#define TBC_BT_REMOVECARD 10
#define TBC_BT_INSERT 11
#define TBC_BT_UPDATE 12
#define TBC_BT_MAIL 13
#define TBC_BT_URL 14
+234
View File
@@ -0,0 +1,234 @@
/*************************************************************************
*
* $RCSfile: toolbar.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _BIB_TOOLBAR_HXX
#define _BIB_TOOLBAR_HXX
#ifndef _COM_SUN_STAR_FRAME_XCONTROLLER_HPP_
#include <com/sun/star/frame/XController.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_XSTATUSLISTENER_HPP_
#include <com/sun/star/frame/XStatusListener.hpp>
#endif
#ifndef _SV_TOOLBOX_HXX //autogen wg. ToolBox
#include <vcl/toolbox.hxx>
#endif
#ifndef _SV_LSTBOX_HXX //autogen wg. ::com::sun::star::form
#include <vcl/lstbox.hxx>
#endif
#ifndef _SV_EDIT_HXX //autogen wg. Edit
#include <vcl/edit.hxx>
#endif
#ifndef _SV_FIXED_HXX //autogen wg. FixedText
#include <vcl/fixed.hxx>
#endif
#ifndef _SVARRAY_HXX
#include <svtools/svarray.hxx>
#endif
#ifndef _SV_TIMER_HXX //autogen wg. Timer
#include <vcl/timer.hxx>
#endif
#ifndef _CPPUHELPER_IMPLBASE1_HXX_
#include <cppuhelper/implbase1.hxx> // helper for implementations
#endif
class BibToolBar;
class BibToolBarListener: public cppu::WeakImplHelper1 < ::com::sun::star::frame::XStatusListener>
{
private:
sal_uInt16 nIndex;
rtl::OUString aCommand;
protected:
BibToolBar *pToolBar;
public:
BibToolBarListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId);
~BibToolBarListener();
rtl::OUString GetCommand();
void SetCommand(const rtl::OUString& aStr);
sal_uInt16 GetIndex();
void SetIndex(sal_uInt16 nIndex);
// ::com::sun::star::lang::XEventListener
// we do not hold References to dispatches, so there is nothing to do on disposal
virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source)
throw( ::com::sun::star::uno::RuntimeException ){};
// ::com::sun::star::frame::XStatusListener
virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
throw( ::com::sun::star::uno::RuntimeException );
};
class BibTBListBoxListener: public BibToolBarListener
{
public:
BibTBListBoxListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId);
~BibTBListBoxListener();
virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
throw( ::com::sun::star::uno::RuntimeException );
};
class BibTBEditListener: public BibToolBarListener
{
public:
BibTBEditListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId);
~BibTBEditListener();
virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
throw( ::com::sun::star::uno::RuntimeException );
};
class BibTBQueryMenuListener: public BibToolBarListener
{
public:
BibTBQueryMenuListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId);
~BibTBQueryMenuListener();
virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
throw( ::com::sun::star::uno::RuntimeException );
};
typedef ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener>* BibToolBarListenerPtr;
SV_DECL_PTRARR_DEL( BibToolBarListenerArr, BibToolBarListenerPtr, 4, 4 );
class BibToolBar: public ToolBox
{
private:
BibToolBarListenerArr aListenerArr;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > xController;
Timer aTimer;
Timer aMenuTimer;
FixedText aFtSource;
ListBox aLBSource;
FixedText aFtQuery;
Edit aEdQuery;
PopupMenu aPopupMenu;
sal_uInt16 nMenuId;
sal_uInt16 nSelMenuItem;
rtl::OUString aQueryField;
DECL_LINK( SelHdl, ListBox* );
DECL_LINK( SendSelHdl, Timer* );
DECL_LINK( MenuHdl, Timer* );
protected:
void InitListener();
virtual void Select();
virtual void Click();
void SendDispatch(sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs);
long PreNotify( NotifyEvent& rNEvt );
public:
BibToolBar(Window* pParent, WinBits nStyle = 0 );
~BibToolBar();
void SetXController(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > &);
void ClearSourceList();
void UpdateSourceList(sal_Bool bFlag=sal_True);
void EnableSourceList(sal_Bool bFlag=sal_True);
void InsertSourceEntry(const XubString&,sal_uInt16 nPos=LISTBOX_APPEND );
void SelectSourceEntry(const XubString& );
void EnableQuery(sal_Bool bFlag=sal_True);
void SetQueryString(const XubString& );
void ClearFilterMenu();
sal_uInt16 InsertFilterItem(const XubString& );
void SelectFilterItem(sal_uInt16 nId);
void statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
throw( ::com::sun::star::uno::RuntimeException );
};
#endif
+421
View File
@@ -0,0 +1,421 @@
/*************************************************************************
*
* $RCSfile: toolbar.src,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning 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 <offmgr/sba.hrc>
#include "extensio.hrc"
#include "toolbar.hrc"
ToolBox RID_BIB_TOOLBAR
{
HelpId = HID_BIB_DB_TBX;
Sizeable = TRUE ;
HideWhenDeactivate = TRUE ;
LineSpacing = TRUE ;
Border = TRUE ;
SVLook = TRUE ;
Pos = MAP_APPFONT ( 0 , 0 ) ;
Size = MAP_APPFONT ( 200 , 16 ) ;
ButtonType = BUTTON_SYMBOL ;
ItemList =
{
ToolBoxItem
{
Identifier = TBC_FT_SOURCE;
//HelpID = SID_SBA_BRW_INSERT ;
Text = "Tabelle" ;
Text [ ENGLISH ] = "Table" ;
Text[ english_us ] = "Table";
Text[ portuguese ] = "Tabela";
Text[ russian ] = "Òàáëèöà";
Text[ greek ] = "Ðßíáêáò";
Text[ dutch ] = "Tabel";
Text[ french ] = "Table";
Text[ spanish ] = "Tabla";
Text[ italian ] = "Tabella";
Text[ danish ] = "Tabel";
Text[ swedish ] = "Tabell";
Text[ polish ] = "Tabela";
Text[ portuguese_brazilian ] = "Data source";
Text[ japanese ] = "ðÌÞÙ";
Text[ korean ] = "µ¥ÀÌÅÍ ¼Ò½º";
Text[ chinese_simplified ] = "±í¸ñ";
Text[ chinese_traditional ] = "ªí®æ";
Text[ arabic ] = "ÌÏæá";
Text[ turkish ] = "Tablo";
Text[ language_user1 ] = " ";
};
ToolBoxItem
{
Identifier = TBC_LB_SOURCE;
HelpID = HID_BIB_TBX_TABLE;
Command = ".uno:Bib/source" ;
};
ToolBoxItem
{
Type = TOOLBOXITEM_SEPARATOR ;
};
ToolBoxItem
{
Identifier = TBC_FT_QUERY;
//HelpID = SID_SBA_BRW_INSERT ;
Text = "Suchbegriff" ;
Text [ ENGLISH ] = "Search key" ;
Text[ english_us ] = "Search Key";
Text[ portuguese ] = "Expressão procurada";
Text[ russian ] = "Èñêîìîå ïîíÿòèå";
Text[ greek ] = "¼ñïò áíáæÞôçóçò";
Text[ dutch ] = "Zoekbegrip";
Text[ french ] = "Élément recherché";
Text[ spanish ] = "Expresión de búsqueda";
Text[ italian ] = "Termine ricercato";
Text[ danish ] = "Søgeord";
Text[ swedish ] = "Sökord";
Text[ polish ] = "Szukane has³o";
Text[ portuguese_brazilian ] = "Search key";
Text[ japanese ] = "ŒŸ�õ·°";
Text[ korean ] = "°Ë»ö Ű";
Text[ chinese_simplified ] = "ËÑѰÄÚÈÝ";
Text[ chinese_traditional ] = "·j´MÃöÁä¦r";
Text[ arabic ] = "ãÕØáÍ ÇáÈÍË";
Text[ turkish ] = "Arama ölçütü";
};
ToolBoxItem
{
Identifier = TBC_ED_QUERY;
HelpID = HID_BIB_TBX_SEARCH;
Command = ".uno:Bib/query" ;
};
ToolBoxItem
{
Type = TOOLBOXITEM_SEPARATOR ;
};
ToolBoxItem
{
Identifier = TBC_BT_AUTOFILTER ;
HelpID = HID_BIB_TBX_AUTOFILTER;
ItemBitmap = Bitmap { File = "sc10716.bmp" ; };
DropDown = TRUE ;
Text = "AutoFilter" ;
Text [ ENGLISH ] = "AutoFilter" ;
Command = ".uno:Bib/autoFilter" ;
Text[ english_us ] = "AutoFilter";
Text[ portuguese ] = "AutoFiltro";
Text[ russian ] = "Àâòîôèëüòð";
Text[ greek ] = "ÁõôïÖßëôñï";
Text[ dutch ] = "AutoFilter";
Text[ french ] = "AutoFiltre";
Text[ spanish ] = "AutoFiltro";
Text[ italian ] = "Filtro automatico";
Text[ danish ] = "AutoFilter";
Text[ swedish ] = "AutoFilter";
Text[ polish ] = "Autofiltr";
Text[ portuguese_brazilian ] = "AutoFilter";
Text[ japanese ] = "µ°Ą̈ÙÀ";
Text[ korean ] = "ÀÚµ¿ÇÊÅÍ";
Text[ chinese_simplified ] = "×Ô¶¯É¸Ñ¡";
Text[ chinese_traditional ] = "¦Û­q¿z¿ï";
Text[ arabic ] = "ÝáÊÑ Âáí";
Text[ turkish ] = "Otomatik filtre";
Text[ language_user1 ] = " ";
};
ToolBoxItem
{
Identifier = TBC_BT_FILTERCRIT ;
HelpID = SID_SBA_QRY_FILTERCRIT ;
ItemBitmap = Bitmap { File = "sc10715.bmp" ; };
Text = "Standard Filter" ;
Text [ ENGLISH ] = "Standard Filter" ;
Command = ".uno:Bib/standardFilter" ;
Text[ english_us ] = "Standard Filter";
Text[ portuguese ] = "Filtro padrão";
Text[ russian ] = "Ñòàíäàðòíûé ôèëüòð";
Text[ greek ] = "Ößëôñï ðñïåðéëïãÞò";
Text[ dutch ] = "Standaardfilter";
Text[ french ] = "Filtre par défaut";
Text[ spanish ] = "Filtro estándar";
Text[ italian ] = "Filtro standard";
Text[ danish ] = "Standardfilter";
Text[ swedish ] = "Standardfilter";
Text[ polish ] = "Filtr standardowy";
Text[ portuguese_brazilian ] = "Standard Filter";
Text[ japanese ] = "•W�€Ì¨ÙÀ";
Text[ korean ] = "±âº» ÇÊÅÍ";
Text[ chinese_simplified ] = "±ê׼ɸѡ";
Text[ chinese_traditional ] = "¼Ð­ã¿z¿ï";
Text[ arabic ] = "ÝáÊÑ ÞíÇÓí";
Text[ turkish ] = "Standart filtre";
Text[ language_user1 ] = " ";
};
ToolBoxItem
{
Identifier = TBC_BT_REMOVEFILTER ;
HelpID = SID_SBA_QRY_REMOVEFILTER ;
ItemBitmap = Bitmap { File = "sc10711.bmp" ; };
Text = "Filter entfernen" ;
Text [ ENGLISH ] = "Remove Filter" ;
Command = ".uno:Bib/removeFilter" ;
Text[ english_us ] = "Remove Filter";
Text[ portuguese ] = "Eliminar filtro";
Text[ russian ] = "Óáðàòü ôèëüòð";
Text[ greek ] = "ÄéáãñáöÞ ößëôñïõ";
Text[ dutch ] = "Filter verwijderen";
Text[ french ] = "Supprimer le filtre";
Text[ spanish ] = "Eliminar filtro";
Text[ italian ] = "Rimuovi filtro";
Text[ danish ] = "Fjern filter";
Text[ swedish ] = "Ta bort filter";
Text[ polish ] = "Usuñ filtr";
Text[ portuguese_brazilian ] = "Remove Filter";
Text[ japanese ] = "̨ÙÀ‚̉ð�œ";
Text[ korean ] = "ÇÊÅÍ Á¦°Å";
Text[ chinese_simplified ] = "ɾ³ýɸѡ";
Text[ chinese_traditional ] = "§R°£¿z¿ï";
Text[ arabic ] = "ÅÒÇáÉ ÝáÊÑ";
Text[ turkish ] = "Filtreyi kaldýr";
Text[ language_user1 ] = " ";
};
/*
ToolBoxItem
{
Type = TOOLBOXITEM_SEPARATOR ;
};
ToolBoxItem
{
Identifier = TBC_BT_NEWCARD ;
//HelpID = SID_SBA_QRY_REMOVEFILTER ;
Command = ".uno:Bib/newEntry" ;
ItemBitmap = Bitmap { File = "newcard.bmp" ; };
Text = "Neue Adresse" ;
Text [ ENGLISH ] = "New Address" ;
Text[ english_us ] = "New Address";
Text[ portuguese ] = "Novo endereço";
Text[ russian ] = "Íîâûé àäðåñ";
Text[ greek ] = "New Address";
Text[ dutch ] = "Nieuw adres";
Text[ french ] = "Nouvelle adresse";
Text[ spanish ] = "Nueva dirección";
Text[ italian ] = "Nuovo indirizzo";
Text[ danish ] = "Ny adresse";
Text[ swedish ] = "Ny adress";
Text[ polish ] = "Nowy adres";
Text[ portuguese_brazilian ] = "New Address";
Text[ japanese ] = "�V‚µ‚¢�Z�Š";
Text[ korean ] = "New Address";
Text[ chinese_simplified ] = "еØÖ·";
Text[ chinese_traditional ] = "·s¦a§}";
Text[ arabic ] = "ÚäæÇä ÌÏíÏ";
};
ToolBoxItem
{
Identifier = TBC_BT_EDITCARD ;
//HelpID = SID_SBA_QRY_REMOVEFILTER ;
Command = ".uno:Bib/changeEntry" ;
ItemBitmap = Bitmap { File = "modcard.bmp" ; };
Text = "Adresse bearbeiten" ;
Text [ ENGLISH ] = "Edit address" ;
Text[ english_us ] = "Edit Address";
Text[ portuguese ] = "Editar endereço";
Text[ russian ] = "Ïðàâêà àäðåñà";
Text[ greek ] = "Edit address";
Text[ dutch ] = "Adres wijzigen";
Text[ french ] = "Éditer une adresse";
Text[ spanish ] = "Editar dirección";
Text[ italian ] = "Modifica indirizzo";
Text[ danish ] = "Rediger adresse";
Text[ swedish ] = "Redigera adress";
Text[ polish ] = "Edytuj adres";
Text[ portuguese_brazilian ] = "Edit address";
Text[ japanese ] = "±ÄÞÚ½‚Ì•Ò�W";
Text[ korean ] = "Edit address";
Text[ chinese_simplified ] = "±à¼­µØÖ·";
Text[ chinese_traditional ] = "½s¿è¦a§}";
Text[ arabic ] = "ÊÍÑíÑ ÚäæÇä";
};
ToolBoxItem
{
Identifier = TBC_BT_REMOVECARD ;
//HelpID = SID_SBA_QRY_REMOVEFILTER ;
Command = ".uno:Bib/removeEntry" ;
ItemBitmap = Bitmap { File = "remcard.bmp" ; };
Text = "Adresse löschen" ;
Text [ ENGLISH ] = "Remove address" ;
Text[ english_us ] = "Remove Address";
Text[ portuguese ] = "Eliminar endereço";
Text[ russian ] = "Óäàëèòü àäðåñ";
Text[ greek ] = "ÄéáãñáöÞ äéåýèõíóçò";
Text[ dutch ] = "Adres wissen";
Text[ french ] = "Supprimer une adresse";
Text[ spanish ] = "Eliminar dirección";
Text[ italian ] = "Elimina indirizzo";
Text[ danish ] = "Slet adresse";
Text[ swedish ] = "Ta bort adress";
Text[ polish ] = "Usuñ adres";
Text[ portuguese_brazilian ] = "Remove address";
Text[ japanese ] = "±ÄÞÚ½‚Ì�í�œ";
Text[ korean ] = "Remove address";
Text[ chinese_simplified ] = "ɾ³ýµØÖ·";
Text[ chinese_traditional ] = "§R°£¦a§}";
Text[ arabic ] = "ÍÐÝ ÚäæÇä";
};
ToolBoxItem
{
Type = TOOLBOXITEM_SEPARATOR ;
};
ToolBoxItem
{
Identifier = TBC_BT_INSERT ;
HelpID = SID_SBA_BRW_INSERT ;
ItemBitmap = Bitmap { File = "sc12202.bmp" ; };
Text = "Daten in Text" ;
Text [ ENGLISH ] = "Insert" ;
Text[ english_us ] = "Data into Text";
Text[ portuguese ] = "Dados no texto";
Text[ russian ] = "Äàííûå â òåêñò";
Text[ greek ] = "ÄåäïìÝíá óôï êåßìåíï";
Text[ dutch ] = "Gegevens in tekst";
Text[ french ] = "Données dans le texte";
Text[ spanish ] = "Datos en texto";
Text[ italian ] = "Dati nel testo";
Text[ danish ] = "Data i tekst";
Text[ swedish ] = "Data i text";
Text[ polish ] = "Dane w tekœcie";
Text[ portuguese_brazilian ] = "Insert";
Text[ japanese ] = "•¶�‘‚ÉÃÞ°À";
Text[ korean ] = "Insert";
Text[ chinese_simplified ] = "²åÈëÊý¾ÝÖÁÎı¾ÖÐ";
Text[ chinese_traditional ] = "¼ÆÕuÂà´«¦¨¤å¦r";
Text[ arabic ] = "ÈíÇäÇÊ Åáì äÕ";
};
ToolBoxItem
{
Identifier = TBC_BT_UPDATE ;
HelpID = SID_SBA_BRW_UPDATE ;
ItemBitmap = Bitmap { File = "sc12201.bmp" ; };
Text = "Daten in Felder" ;
};
ToolBoxItem
{
Type = TOOLBOXITEM_SEPARATOR ;
};
ToolBoxItem
{
Identifier = TBC_BT_MAIL ;
//HelpID = HID_ADDRPI_AUTOMAIL ;
ItemBitmap = Bitmap { File = "sc06305.bmp" ; };
Text = "AutoMail" ;
Text [ ENGLISH ] = "AutoMail" ;
Text[ english_us ] = "AutoMail";
Text[ portuguese ] = "AutoMail";
Text[ russian ] = "AutoMail";
Text[ greek ] = "AutoMail";
Text[ dutch ] = "AutoMail";
Text[ french ] = "AutoMail";
Text[ spanish ] = "AutoMail";
Text[ italian ] = "Mail automatica";
Text[ danish ] = "AutoPost";
Text[ swedish ] = "AutoMail";
Text[ polish ] = "AutoMail";
Text[ portuguese_brazilian ] = "AutoMail";
Text[ japanese ] = "µ°ÄÒ°Ù";
Text[ korean ] = "AutoMail";
Text[ chinese_simplified ] = "×Ô¶¯µç×ÓÓʼþ";
Text[ chinese_traditional ] = "¦Û°Ê¹q¤l¶l¥ó";
Text[ arabic ] = "ÈÑíÏ Âáí";
};
ToolBoxItem
{
Identifier = TBC_BT_URL ;
//HelpID = HID_ADDRPI_AUTOBROWSE ;
ItemBitmap = Bitmap { File = "sc06304.bmp" ; };
Text = "AutoBrowse" ;
Text [ ENGLISH ] = "AutoBrowse" ;
Text[ english_us ] = "AutoBrowse";
Text[ portuguese ] = "AutoBrowse";
Text[ russian ] = "Àâòîïðîñìîòð";
Text[ greek ] = "AutoBrowse";
Text[ dutch ] = "AutoBrowse";
Text[ french ] = "AutoBrowse";
Text[ spanish ] = "AutoBrowse";
Text[ italian ] = "Browse automatico";
Text[ danish ] = "AutoBrowse";
Text[ swedish ] = "AutoBrowse";
Text[ polish ] = "AutoBrowse";
Text[ portuguese_brazilian ] = "AutoBrowse";
Text[ japanese ] = "µ°ÄÌÞ׳¾Þ";
Text[ korean ] = "AutoBrowse";
Text[ chinese_simplified ] = "×Ô¶¯ä¯ÀÀ";
Text[ chinese_traditional ] = "¦Û°ÊÂsÄý";
Text[ arabic ] = "ÇÓÊÚÑÇÖ Âáí";
};*/
};
Scroll = TRUE ;
};
+90
View File
@@ -0,0 +1,90 @@
/*************************************************************************
*
* $RCSfile: comifaces.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16: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 __COMIFACES_HXX
#define __COMIFACES_HXX
#include <com/sun/star/uno/XInterface.hpp>
using namespace com::sun::star::uno;
MIDL_INTERFACE("e40a2331-3bc1-11d4-8321-005004526ab4")
IJScriptValueObject: public IUnknown
{
STDMETHOD( Set)( VARIANT type, VARIANT value)= 0;
STDMETHOD( Get)( VARIANT *val)= 0;
STDMETHOD( InitOutParam)()= 0;
STDMETHOD( InitInOutParam)( VARIANT type, VARIANT value)= 0;
STDMETHOD( IsOutParam)( VARIANT_BOOL * flag)= 0;
STDMETHOD( IsInOutParam)( VARIANT_BOOL * flag)= 0;
STDMETHOD( GetValue)( BSTR* type, VARIANT *value)= 0;
};
MIDL_INTERFACE("7B5C3410-66FA-11d4-832A-005004526AB4")
IUnoObjectWrapper: public IUnknown
{
STDMETHOD( getWrapperXInterface)( Reference<XInterface>* pInt)=0;
STDMETHOD( getOriginalUnoObject)( Reference<XInterface>* pInt)=0;
STDMETHOD( getOriginalUnoStruct)( Any * pStruct)=0;
};
#endif
+350
View File
@@ -0,0 +1,350 @@
/*************************************************************************
*
* $RCSfile: jscriptclasses.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:40 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include "jscriptclasses.hxx"
//========================================================================
// JScriptValue
//========================================================================
JScriptValue::JScriptValue(): m_bOutParam(0), m_bInOutParam(0)
{
}
JScriptValue::~JScriptValue()
{
}
// JScriptValue, IDispatch --------------------------------------------
STDMETHODIMP JScriptValue::GetTypeInfoCount(UINT *pctinfo)
{
return E_NOTIMPL;
}
// JScriptValue, IDispatch --------------------------------------------
STDMETHODIMP JScriptValue::GetTypeInfo( UINT iTInfo,
LCID lcid,
ITypeInfo **ppTInfo)
{
return E_NOTIMPL;
}
// JScriptValue, IDispatch --------------------------------------------
STDMETHODIMP JScriptValue::GetIDsOfNames( REFIID riid,
LPOLESTR *rgszNames,
UINT cNames,
LCID lcid,
DISPID *rgDispId)
{
if( !rgDispId)
return E_POINTER;
HRESULT ret= S_OK;
CComBSTR name(*rgszNames);
name.ToLower();
if( name == CComBSTR( L"set") )
*rgDispId= 1;
else if( name == CComBSTR( L"get") )
*rgDispId= 2;
else if( name == CComBSTR( L"initoutparam") )
*rgDispId= 3;
else if( name == CComBSTR( L"initinoutparam") )
*rgDispId= 4;
else
ret= DISP_E_UNKNOWNNAME;
return ret;
}
// JScriptValue, IDispatch --------------------------------------------
STDMETHODIMP JScriptValue::Invoke( DISPID dispIdMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS *pDispParams,
VARIANT *pVarResult,
EXCEPINFO *pExcepInfo,
UINT *puArgErr)
{
if( pDispParams->cNamedArgs)
return DISP_E_NONAMEDARGS;
HRESULT ret= S_OK;
switch( dispIdMember)
{
case 0: // DISPID_VALUE
if( wFlags & DISPATCH_PROPERTYGET && pVarResult)
{
if( FAILED( VariantCopy( pVarResult, &m_varValue)))
ret= E_FAIL;
}
else
ret= E_POINTER;
break;
case 1:
if( wFlags & DISPATCH_METHOD)
ret= Set( pDispParams->rgvarg[1], pDispParams->rgvarg[0]);
if( FAILED( ret))
ret= DISP_E_EXCEPTION;
break;
case 2:
if( wFlags & DISPATCH_METHOD)
ret= Get( pVarResult);
if( FAILED( ret))
ret= DISP_E_EXCEPTION;
break;
case 3:
if( wFlags & DISPATCH_METHOD)
ret= InitOutParam();
if( FAILED( ret))
ret= DISP_E_EXCEPTION;
break;
case 4:
if( wFlags & DISPATCH_METHOD)
ret= InitInOutParam( pDispParams->rgvarg[1], pDispParams->rgvarg[0]);
if( FAILED( ret))
ret= DISP_E_EXCEPTION;
break;
default:
ret= DISP_E_MEMBERNOTFOUND;
break;
}
return ret;
}
// JScriptValue, IScriptOutParam-----------------------
STDMETHODIMP JScriptValue::Set( VARIANT type, VARIANT value)
{
Lock();
HRESULT hr= S_OK;
m_varValue= value;
VARIANT var;
VariantInit( &var);
if( SUCCEEDED( hr= VariantChangeType( &var, &type, 0, VT_BSTR)))
m_bstrType= var.bstrVal;
Unlock();
return hr;
}
// JScriptValue, IScriptOutParam-----------------------
STDMETHODIMP JScriptValue::Get( VARIANT *val)
{
Lock();
if( !val)
return E_POINTER;
HRESULT hr= VariantCopy( val, &m_varValue);
Unlock();
return hr;
}
STDMETHODIMP JScriptValue::InitOutParam()
{
Lock();
m_bOutParam= true;
m_bInOutParam= false;
Unlock();
return S_OK;
}
STDMETHODIMP JScriptValue::InitInOutParam( VARIANT type, VARIANT value)
{
Lock();
m_bInOutParam= true;
m_bOutParam= false;
Unlock();
return Set( type, value);
}
STDMETHODIMP JScriptValue::IsOutParam( VARIANT_BOOL * flag)
{
Lock();
if( !flag)
return E_POINTER;
*flag= m_bOutParam ? VARIANT_TRUE : VARIANT_FALSE;
Unlock();
return S_OK;
}
STDMETHODIMP JScriptValue::IsInOutParam( VARIANT_BOOL * flag)
{
Lock();
if( !flag)
return E_POINTER;
*flag= m_bInOutParam ? VARIANT_TRUE : VARIANT_FALSE;
Unlock();
return S_OK;
}
STDMETHODIMP JScriptValue::GetValue( BSTR* type, VARIANT *value)
{
Lock();
if( !type || !value)
return E_POINTER;
HRESULT hr;
if( SUCCEEDED( hr= m_bstrType.CopyTo( type)))
hr= VariantCopy( value, &m_varValue);
Unlock();
return hr;
}
//##########################################################################################
// JScriptOutValue
//##########################################################################################
JScriptOutParam::JScriptOutParam()
{
}
JScriptOutParam::~JScriptOutParam()
{
}
// JScriptOutParam, IDispatch --------------------------------------------
STDMETHODIMP JScriptOutParam::GetTypeInfoCount(UINT *pctinfo)
{
return E_NOTIMPL;
}
// JScriptOutParam, IDispatch --------------------------------------------
STDMETHODIMP JScriptOutParam::GetTypeInfo( UINT iTInfo,
LCID lcid,
ITypeInfo **ppTInfo)
{
return E_NOTIMPL;
}
// JScriptOutParam, IDispatch --------------------------------------------
STDMETHODIMP JScriptOutParam::GetIDsOfNames( REFIID riid,
LPOLESTR *rgszNames,
UINT cNames,
LCID lcid,
DISPID *rgDispId)
{
if( !rgDispId)
return E_POINTER;
HRESULT ret= S_OK;
CComBSTR name(*rgszNames);
name.ToLower();
if( name == CComBSTR( L"0") )
*rgDispId= 1;
else
ret= DISP_E_UNKNOWNNAME;
return ret;
}
// JScriptOutParam, IDispatch --------------------------------------------
STDMETHODIMP JScriptOutParam::Invoke( DISPID dispIdMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS *pDispParams,
VARIANT *pVarResult,
EXCEPINFO *pExcepInfo,
UINT *puArgErr)
{
HRESULT ret= S_OK;
switch( dispIdMember)
{
case 0: // DISPID_VALUE
if( wFlags & DISPATCH_PROPERTYGET && pVarResult)
{
if( FAILED( VariantCopy( pVarResult, &m_varValue)))
ret= E_FAIL;
}
else if( wFlags & DISPATCH_PROPERTYPUT || wFlags & DISPATCH_PROPERTYPUTREF)
{
m_varValue.Clear();
if( FAILED( VariantCopyInd( &m_varValue, &pDispParams->rgvarg[0])))
ret= E_FAIL;
}
else
ret= E_POINTER;
break;
case 1: //
if( wFlags & DISPATCH_PROPERTYGET && pVarResult)
{
if( FAILED( VariantCopy( pVarResult, &m_varValue)))
ret= E_FAIL;
}
else if( wFlags & DISPATCH_PROPERTYPUT || wFlags & DISPATCH_PROPERTYPUTREF)
{
m_varValue.Clear();
if( FAILED( VariantCopyInd( &m_varValue, &pDispParams->rgvarg[0])))
ret= E_FAIL;
}
else
ret= E_POINTER;
break;
default:
ret= DISP_E_MEMBERNOTFOUND;
break;
}
return ret;
}
+177
View File
@@ -0,0 +1,177 @@
/*************************************************************************
*
* $RCSfile: jscriptclasses.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16: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 __JSCRIPTCLASSES_HXX
#define __JSCRIPTCLASSES_HXX
#include <tools/presys.h>
#include "stdafx.h"
#include <tools/postsys.h>
#include "comifaces.hxx"
// Sequences are represented by prepending "[]", e.g. []char, [][]byte, [][][]object, etc.
// To make a JScriptValue object to an out parameter, call
// "InitOutParam" and to make it a in/out parameter call
// "InitInOutParam"
// If the object represents an out parameter then the value can after the call
// be retrived by "Get".
// From JavaScript the functions Get, Set, InitOutParam and InitInOutParam are
// used, that is they are accessible through IDispatch. The functions are used
// by the bridge.
class JScriptValue:
public CComObjectRootEx<CComMultiThreadModel>,
public IJScriptValueObject,
public IDispatch
{
public:
JScriptValue();
virtual ~JScriptValue();
BEGIN_COM_MAP(JScriptValue)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IJScriptValueObject)
END_COM_MAP()
// IDispatch -------------------------------------------
STDMETHOD( GetTypeInfoCount)(UINT *pctinfo);
STDMETHOD( GetTypeInfo)( UINT iTInfo,
LCID lcid,
ITypeInfo **ppTInfo);
STDMETHOD( GetIDsOfNames)( REFIID riid,
LPOLESTR *rgszNames,
UINT cNames,
LCID lcid,
DISPID *rgDispId);
STDMETHOD( Invoke)( DISPID dispIdMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS *pDispParams,
VARIANT *pVarResult,
EXCEPINFO *pExcepInfo,
UINT *puArgErr);
// IJScriptOutParam --------------------------------------
STDMETHOD( Set)( VARIANT type, VARIANT value);
STDMETHOD( Get)( VARIANT *val);
STDMETHOD( InitOutParam)();
STDMETHOD( InitInOutParam)( VARIANT type, VARIANT value);
STDMETHOD( IsOutParam)( VARIANT_BOOL * flag);
STDMETHOD( IsInOutParam)( VARIANT_BOOL * flag);
STDMETHOD( GetValue)( BSTR* type, VARIANT *value);
CComVariant m_varValue;
CComBSTR m_bstrType;
unsigned m_bOutParam: 1;
unsigned m_bInOutParam: 1;
};
// If a class is implemented in JScript, then its method
class JScriptOutParam:
public CComObjectRootEx<CComMultiThreadModel>,
public IDispatch
{
public:
JScriptOutParam();
virtual ~JScriptOutParam();
BEGIN_COM_MAP(JScriptOutParam)
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
// IDispatch -------------------------------------------
STDMETHOD( GetTypeInfoCount)(UINT *pctinfo);
STDMETHOD( GetTypeInfo)( UINT iTInfo,
LCID lcid,
ITypeInfo **ppTInfo);
STDMETHOD( GetIDsOfNames)( REFIID riid,
LPOLESTR *rgszNames,
UINT cNames,
LCID lcid,
DISPID *rgDispId);
STDMETHOD( Invoke)( DISPID dispIdMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS *pDispParams,
VARIANT *pVarResult,
EXCEPINFO *pExcepInfo,
UINT *puArgErr);
private:
CComVariant m_varValue;
};
#endif
+188
View File
@@ -0,0 +1,188 @@
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1.1.1 $
#
# last change: $Author: hr $ $Date: 2000-09-18 16:16:40 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
#
# - GNU Lesser General Public License Version 2.1
# - Sun Industry Standards Source License Version 1.1
#
# Sun Microsystems Inc., October, 2000
#
# GNU Lesser General Public License Version 2.1
# =============================================
# Copyright 2000 by Sun Microsystems, Inc.
# 901 San Antonio Road, Palo Alto, CA 94303, USA
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1, as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
#
# Sun Industry Standards Source License Version 1.1
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.1 (the "License"); You may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at http://www.openoffice.org/license.html.
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning the Software.
#
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
#
# Copyright: 2000 by Sun Microsystems, Inc.
#
# All Rights Reserved.
#
# Contributor(s): _______________________________________
#
#
#
#*************************************************************************
PRJ=..$/..
# from cppumaker --------------------------------------------------
UNOUCRDEP= $(SOLARBINDIR)$/applicat.rdb
UNOUCRRDB= $(SOLARBINDIR)$/applicat.rdb
UNOUCRRDB= $(SOLARBINDIR)$/applicat.rdb
.IF "$(BOOTSTRAP_SERVICE)" == "TRUE"
UNOUCROUT= $(OUT)$/inc$/comprehensive
INCPRE+= $(OUT)$/inc$/comprehensive
CPPUMAKERFLAGS += -C
.ELSE
UNOUCROUT= $(OUT)$/inc
INCPRE+= $(OUT)$/inc
.ENDIF
# -----------------------------------------------------------------
PRJNAME=extensions
TARGET=olebrdg
.INCLUDE : $(PRJ)$/util$/makefile.pmk
LIBTARGET=NO
USE_DEFFILE=YES
USE_DEFFILE=TRUE
INCPRE+= -I$(SOLARINCDIR)$/external$/atl
.IF "$(PRODUCT)"=="" || "$(debug)"!=""
LIBCMT=msvcrtd.lib
.ENDIF
# --- Settings -----------------------------------------------------
ENABLE_EXCEPTIONS=TRUE
#----------------------------------------------------------------
#.INCLUDE: .$/cppumaker.mk
UNOTYPES= \
com.sun.star.lang.XMultiServiceFactory \
com.sun.star.lang.XSingleServiceFactory \
com.sun.star.lang.XEventListener \
com.sun.star.lang.XUnoTunnel \
com.sun.star.lang.XInitialization \
com.sun.star.uno.TypeClass \
com.sun.star.script.FinishEngineEvent \
com.sun.star.script.XInvocation \
com.sun.star.script.XInvocation \
com.sun.star.script.XLibraryAccess \
com.sun.star.script.XAllListener \
com.sun.star.script.FailReason \
com.sun.star.script.XEventAttacher \
com.sun.star.script.XEventAttacherManager \
com.sun.star.script.XAllListenerAdapterService \
com.sun.star.script.XInvocationAdapterFactory \
com.sun.star.script.XInvocationAdapterFactory2 \
com.sun.star.registry.InvalidValueException \
com.sun.star.registry.RegistryKeyType \
com.sun.star.registry.XRegistryKey \
com.sun.star.registry.RegistryValueType \
com.sun.star.registry.InvalidRegistryException \
com.sun.star.loader.XImplementationLoader \
com.sun.star.loader.CannotActivateFactoryException \
com.sun.star.bridge.XBridgeSupplier \
com.sun.star.bridge.XBridgeSupplier2 \
com.sun.star.bridge.ModelDependent \
com.sun.star.reflection.InvocationTargetException \
com.sun.star.beans.UnknownPropertyException \
com.sun.star.beans.MethodConcept \
com.sun.star.beans.PropertyConcept \
com.sun.star.beans.XExactName \
com.sun.star.beans.XMaterialHolder \
com.sun.star.uno.Exception \
com.sun.star.uno.XWeak \
com.sun.star.uno.XAggregation \
com.sun.star.reflection.XIdlReflection
# com.sun.star.beans.XMaterialHolder \
.IF "$(GUI)"=="WNT"
SLOFILES= \
$(SLO)$/servreg.obj \
$(SLO)$/servprov.obj \
$(SLO)$/unoobjw.obj \
$(SLO)$/oleobjw.obj \
$(SLO)$/oleclassw.obj \
$(SLO)$/olethread.obj \
$(SLO)$/oledll.obj \
$(SLO)$/StdAfx.obj \
$(SLO)$/jscriptclasses.obj
SHL1TARGET=$(TARGET)
SHL1STDLIBS=\
$(SALLIB) \
$(VOSLIB) \
$(CPPULIB) \
$(CPPUHELPERLIB) \
$(LIBCIMT) \
ole32.lib \
uuid.lib \
oleaut32.lib
#SHL1LIBS = $(SLB)$/$(TARGET).lib
SHL1LIBS=
SHL1OBJS=$(SLOFILES)
#SHL1DEF=$(MISC)$/$(SHL1TARGET).def
#SHL1DEF=$(TARGET).def
DEF1NAME=$(SHL1TARGET)
DEF1EXPORTFILE=$(SHL1TARGET).dxp
.ENDIF
#----------------------------------------------------------------
.INCLUDE : target.mk
#.INCLUDE : $(PRJ)$/util$/target.pmk
+408
View File
@@ -0,0 +1,408 @@
/*************************************************************************
*
* $RCSfile: ole2uno.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16: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 _OLE2UNO_HXX
#define _OLE2UNO_HXX
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define STRICT
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif
#define _WIN32_DCOM
#ifdef _DEBUG
//#define _ATL_DEBUG_INTERFACES
#endif
//#include <atlbase.h>
//You may derive a class from CComModule and use it if you want to override
//something, but do not change the name of _Module
#include <tools/prewin.h>
//#include <stdlib.h>
//#include <malloc.h>
//#include <ole2.h>
//#include <oleauto.h>
//#include <oaidl.h>
//#include <ocidl.h>
#include <tchar.h>
//#include <objbase.h>
//#include <atlbase.h>
//extern CComModule _Module;
//#include <atlcom.h>
#if _MSC_VER >= 1200
#include <dispex.h>
//#include <winbase.h>
#endif
#include <tools/postwin.h>
#include <tools/presys.h>
#include <list>
#include <hash_map>
#include <tools/postsys.h>
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_SCRIPT_XTYPECONVERTER_HPP_
#include <com/sun/star/script/XTypeConverter.hpp>
#endif
#ifndef _COM_SUN_STAR_SCRIPT_FINISHENGINEEVENT_HPP_
#include <com/sun/star/script/FinishEngineEvent.hpp>
#endif
#ifndef _COM_SUN_STAR_SCRIPT_INTERRUPTREASON_HPP_
#include <com/sun/star/script/InterruptReason.hpp>
#endif
#ifndef _COM_SUN_STAR_SCRIPT_XENGINELISTENER_HPP_
#include <com/sun/star/script/XEngineListener.hpp>
#endif
#ifndef _COM_SUN_STAR_SCRIPT_XDEBUGGING_HPP__
#include <com/sun/star/script/XDebugging.hpp>
#endif
#ifndef _COM_SUN_STAR_SCRIPT_XINVOCATION_HPP_
#include <com/sun/star/script/XInvocation.hpp>
#endif
#ifndef _COM_SUN_STAR_SCRIPT_CONTEXTINFORMATION_HPP_
#include <com/sun/star/script/ContextInformation.hpp>
#endif
#ifndef _COM_SUN_STAR_SCRIPT_FINISHREASON_HPP_
#include <com/sun/star/script/FinishReason.hpp>
#endif
#ifndef _COM_SUN_STAR_SCRIPT_XENGINE_HPP_
#include <com/sun/star/script/XEngine.hpp>
#endif
#ifndef _COM_SUN_STAR_SCRIPT_INTERRUPTENGINEEVENT_HPP_
#include <com/sun/star/script/InterruptEngineEvent.hpp>
#endif
#ifndef _COM_SUN_STAR_SCRIPT_XLIBRARYACCESS_HXX_
#include <com/sun/star/script/XLibraryAccess.hpp>
#endif
#ifndef _COM_SUN_STAR_REGISTRY_INVALIDVALUEEXCEPTION_HPP_
#include <com/sun/star/registry/InvalidValueException.hpp>
#endif
#ifndef _COM_SUN_STAR_REGISTRY_REGISTRYKEYTYPE_HPP_
#include <com/sun/star/registry/RegistryKeyType.hpp>
#endif
#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_
#include <com/sun/star/registry/XRegistryKey.hpp>
#endif
#ifndef _COM_SUN_STAR_REGISTRY_REGISTRYVALUETYPE_HPP_
#include <com/sun/star/registry/RegistryValueType.hpp>
#endif
#ifndef _COM_SUN_STAR_REGISTRY_INVALIDREGISTRYEXCEPTION_HPP_
#include <com/sun/star/registry/InvalidRegistryException.hpp>
#endif
#ifndef _COM_SUN_STAR_LOADER_XIMPLEMENTATIONLOADER_HPP_
#include <com/sun/star/loader/XImplementationLoader.hpp>
#endif
#ifndef _COM_SUN_STAR_LOADER_CANNOTACTIVATEFACTORYEXCEPTION_HPP_
#include <com/sun/star/loader/CannotActivateFactoryException.hpp>
#endif
#ifndef _COM_SUN_STAR_BRIDGE_XBRIDGESUPPLIER_HPP_
#include <com/sun/star/bridge/XBridgeSupplier.hpp>
#endif
#ifndef _COM_SUN_STAR_BRIDGE_XBRIDGESUPPLIER2_HPP_
#include <com/sun/star/bridge/XBridgeSupplier2.hpp>
#endif
#ifndef _COM_SUN_STAR_BRIDGE_MODELDEPENDENT_HPP_
#include <com/sun/star/bridge/ModelDependent.hpp>
#endif
#ifndef _COM_SUN_STAR_REFLECTION_INVOCATIONTARGETEXCEPTION_HPP_
#include <com/sun/star/reflection/InvocationTargetException.hpp>
#endif
#ifndef _COM_SUN_STAR_UNO_EXCEPTION_HPP_
#include <com/sun/star/uno/Exception.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_UNKNOWNPROPERTYEXCEPTION_HPP_
#include <com/sun/star/beans/UnknownPropertyException.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
#include <com/sun/star/lang/XUnoTunnel.hpp>
#endif
#ifndef _CPPUHELPER_IMPLBASE2_HXX_
#include <cppuhelper/implbase2.hxx>
#endif
#ifndef _CPPUHELPER_IMPLBASE1_HXX_
#include <cppuhelper/implbase1.hxx>
#endif
#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
#include <cppuhelper/typeprovider.hxx>
#endif
#ifndef _CPPUHELPER_FACTORY_HXX_
#include <cppuhelper/factory.hxx>
#endif
#ifndef _SAL_TYPES_H_
#include <sal/types.h>
#endif
#ifndef _TYPELIB_TYPECLASS_H_
#include <typelib/typeclass.h>
#endif
#ifndef _UNO_DISPATCHER_H_
#include <uno/dispatcher.h>
#endif
#ifndef _UNO_MAPPING_H_
#include <uno/mapping.hxx>
#endif
#ifndef _OSL_DIAGNOSE_H_
#include <osl/diagnose.h>
#endif
#ifndef _OSL_MUTEX_HXX_
#include <osl/mutex.hxx>
#endif
#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
#include <com/sun/star/uno/Reference.h>
#endif
#ifndef _RTL_PROCESS_H_
#include <rtl/process.h>
#endif
#ifndef _RTL_UUID_H_
#include <rtl/uuid.h>
#endif
#define UNO_2_OLE_EXCEPTIONCODE 1001
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::script;
using namespace com::sun::star::registry;
using namespace com::sun::star::reflection;
using namespace com::sun::star::beans;
using namespace osl;
using namespace rtl;
using namespace std;
namespace ole_adapter
{
// function shared in this component
Reference<XSingleServiceFactory> o2u_getConverterProvider2(const Reference<XMultiServiceFactory>& xMan, const Reference<XRegistryKey>& xKey);
Reference<XSingleServiceFactory> o2u_getConverterProviderVar1(const Reference<XMultiServiceFactory>& xMan, const Reference<XRegistryKey>& xKey);
Reference<XSingleServiceFactory> o2u_getClientProvider(const Reference<XMultiServiceFactory>& xMan, const Reference<XRegistryKey>& xKey);
Reference<XSingleServiceFactory> o2u_getServerProvider(const Reference<XMultiServiceFactory>& xMan, const Reference<XRegistryKey>& xKey);
Reference<XMultiServiceFactory> o2u_getMultiServiceFactory();
Reference<XRegistryKey> o2u_getRegistryKey();
const VARTYPE getVarType( const Any& val);
Type getType( BSTR type);
Uik o2u_uikFromGUID(GUID* pGuid);
void o2u_attachCurrentThread();
struct equalOUString_Impl
{
bool operator()(const OUString & s1, const OUString & s2) const
{
return s1 == s2;
}
};
struct hashOUString_Impl
{
size_t operator()(const OUString & rName) const
{
return rName.hashCode();
}
};
// ask the object for XBridgeSupplier2 and on success bridges
// the uno object to IDispatch.
template < class T >
sal_Bool convertSelfToIDispatch( T& unoInterface, IDispatch** ppDisp)
{
OSL_ASSERT( ppDisp);
*ppDisp= NULL;
Reference< XInterface > xInt( unoInterface, UNO_QUERY);
if( xInt.is())
{
Reference< XBridgeSupplier2 > xSupplier( xInt, UNO_QUERY);
if( xSupplier.is())
{
sal_Int8 arId[16];
rtl_getGlobalProcessId( (sal_uInt8*)arId);
Sequence<sal_Int8> seqId( arId, 16);
Any anySource;
anySource <<= xInt;
Any anyDisp= xSupplier->createBridge( anySource, seqId, UNO, OLE);
if( anyDisp.getValueTypeClass() == TypeClass_UNSIGNED_LONG)
{
VARIANT* pvar= *(VARIANT**)anyDisp.getValue();
if( pvar->vt == VT_DISPATCH)
{
*ppDisp= pvar->pdispVal;
(*ppDisp)->AddRef();
}
VariantClear( pvar);
CoTaskMemFree( pvar);
}
}
}
return *ppDisp ? sal_True : sal_False;
}
// ----------------------------------------------------------------------
// see the overloaded getCppuType function in this file
//class IUnknownWrapper: public XInterface
//{
//public:
//
// virtual Any invokeWithDispId(DISPID dispID, const Sequence< Any >& Params, Sequence< sal_Int16 >& OutParamIndex, Sequence< Any >& OutParam) throw ( IllegalArgumentException, CannotConvertException, InvocationTargetException, Exception ) = 0;
// virtual void setValueWithDispId(DISPID dispID, const Any& Value) throw( UnknownPropertyException, CannotConvertException, InvocationTargetException, Exception) = 0;
// virtual Any getValueWithDispId(DISPID dispID) throw( UnknownPropertyException, Exception) = 0;
//};
//-----------------------------------------------------------------------
/* ref class to hold IUnknown pointer
*/
template <class UnknownClass> class OleRef
{
public:
typedef OleRef<UnknownClass> self;
OleRef()
: m_pUnknown(NULL)
{}
OleRef(const self& copy)
: m_pUnknown(copy.m_pUnknown)
{
if (m_pUnknown) m_pUnknown->AddRef();
}
OleRef(UnknownClass* pUnknown)
: m_pUnknown(pUnknown)
{
if (m_pUnknown) m_pUnknown->AddRef();
}
~OleRef()
{
if (m_pUnknown) m_pUnknown->Release();
}
self& operator = (const self& copy)
{
if (m_pUnknown) m_pUnknown->Release();
m_pUnknown = copy.m_pUnknown;
if (m_pUnknown) m_pUnknown->AddRef();
return *this;
}
self& operator = (UnknownClass* pUnknown)
{
if (m_pUnknown) m_pUnknown->Release();
m_pUnknown = pUnknown;
if (m_pUnknown) m_pUnknown->AddRef();
return *this;
}
UnknownClass* get() { return m_pUnknown; }
UnknownClass* operator->() { return m_pUnknown; }
const UnknownClass* operator->() const { return m_pUnknown; }
Boolean is() { return (m_pUnknown != NULL); }
protected:
UnknownClass* m_pUnknown;
};
inline sal_Bool operator == (const Uik & uik1, const Uik & uik2)
{
if( ! memcmp( &uik1, &uik2, sizeof( Uik)))
return sal_True;
else
return sal_False;
}
} // end namespace
#endif _OLE2UNO_HXX
+85
View File
@@ -0,0 +1,85 @@
/*************************************************************************
*
* $RCSfile: oledll.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:40 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include "stdafx.h"
CComModule _Module;
BEGIN_OBJECT_MAP(ObjectMap)
END_OBJECT_MAP()
/////////////////////////////////////////////////////////////////////////////
// DLL Entry Point
extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
_Module.Init(ObjectMap, hInstance, NULL);
DisableThreadLibraryCalls(hInstance);
}
else if (dwReason == DLL_PROCESS_DETACH)
{
_Module.Term();
}
return TRUE; // ok
}
File diff suppressed because it is too large Load Diff
+241
View File
@@ -0,0 +1,241 @@
/*************************************************************************
*
* $RCSfile: oleobjw.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16: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 __OLEOBJW_HXX
#define __OLEOBJW_HXX
#include "ole2uno.hxx"
#include <tools/presys.h>
#include "stdafx.h"
#include <vector>
#include <hash_map>
#include <tools/postsys.h>
#ifndef _CPPUHELPER_IMPLBASE3_HXX_
#include <cppuhelper/implbase3.hxx>
#endif
#include <com/sun/star/lang/XInitialization.hpp>
#ifndef _RTL_USTRING_
#include <rtl/ustring>
#endif
#include <typelib/typedescription.hxx>
#include "unoconversionutilities.hxx"
using namespace cppu;
using namespace rtl;
using namespace std;
using namespace com::sun::star::lang;
using namespace com::sun::star::bridge;
namespace ole_adapter
{
typedef hash_map<OUString, pair<DISPID, unsigned short>, hashOUString_Impl, equalOUString_Impl> DispIdMap;
typedef hash_map<OUString, unsigned int, hashOUString_Impl, equalOUString_Impl> TLBFuncIndexMap;
// This class wraps an IDispatch and maps XInvocation calls to IDispatch calls on the wrapped object.
// If m_TypeDescription is set then this class represents an UNO interface implemented in a COM component.
// The interface is not a real interface in terms of an abstract class but is realized through IDispatch.
class IUnknownWrapper_Impl : public WeakImplHelper3<XInvocation, XBridgeSupplier2, XInitialization>,
public UnoConversionUtilities<IUnknownWrapper_Impl>
{
public:
IUnknownWrapper_Impl(Reference<XMultiServiceFactory> &xFactory, sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass);
~IUnknownWrapper_Impl();
// XIdlClassProvider
// virtual Sequence< Reference<XIdlClass > > getIdlClasses( void );
// XInvokation
virtual Reference< XIntrospectionAccess > SAL_CALL getIntrospection( ) throw(RuntimeException);
virtual Any SAL_CALL invoke( const OUString& aFunctionName, const Sequence< Any >& aParams, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam ) throw(IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException);
virtual void SAL_CALL setValue( const OUString& aPropertyName, const Any& aValue ) throw(UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException);
virtual Any SAL_CALL getValue( const OUString& aPropertyName ) throw(UnknownPropertyException, RuntimeException);
virtual sal_Bool SAL_CALL hasMethod( const OUString& aName ) throw(RuntimeException);
virtual sal_Bool SAL_CALL hasProperty( const OUString& aName ) throw(RuntimeException);
// XBridgeSupplier2
// This interface is implemented to provide a safe way to obtain the original
// IUnknown or IDispatch within the function anyToVariant. The function asks
// every UNO object for its XBridgeSupplier and if it is available uses it to convert
// the object with its own supplier.
virtual Any SAL_CALL createBridge( const Any& modelDepObject, const Sequence< sal_Int8 >& aProcessId, sal_Int16 sourceModelType, sal_Int16 destModelType ) throw(IllegalArgumentException, RuntimeException);
// XInitialization
virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException);
// XUnoTunnel ------------------------------------------------------------------------------------------
// virtual sal_Int64 SAL_CALL getSomething( const Sequence< sal_Int8 >& aIdentifier ) throw( RuntimeException);
// Helper for XUnoTunnel --------------------------------------------------------------------------------
// static Sequence<sal_Int8> getUnoTunnelId();
virtual Any invokeWithDispIdUnoTlb(DISPID dispID, const Sequence< Any >& Params, Sequence<sal_Int16 >& OutParamIndex, Sequence< Any >& OutParam) throw (IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException);
// Is used for OleClient service
virtual Any invokeWithDispIdComTlb(DISPID dispID,
const Sequence< Any >& Params,
Sequence< sal_Int16 >& OutParamIndex,
Sequence< Any >& OutParam)
throw ( IllegalArgumentException, CannotConvertException,
InvocationTargetException, RuntimeException);
void processOutParameters( VARIANT* pOrgParams,
VARIANT* pResultParams,
sal_uInt32 n,
Sequence< sal_Int16 >& OutParamIndex,
Sequence< Any >& OutParam);
virtual void setValueWithDispId(DISPID dispID, const Any& Value) throw ( UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException);
virtual Any getValueWithDispId(DISPID dispID) throw (UnknownPropertyException, RuntimeException );
// UnoConversionUtilities -------------------------------------------------------------------------------
virtual Reference<XInterface> createUnoWrapperInstance();
virtual Reference<XInterface> createComWrapperInstance();
protected:
// These functions are for the case if an object of this class wraps an IDispatch
// object that implements UNO interfaces. In that case the member m_seqTypes
// is set through XInitialization::initialize.
void getMethodInfo( TypeDescription& methodDescription);
// used by get MethodInfo
TypeDescription getInterfaceMemberDescOfCurrentCall( );
ITypeInfo* getTypeInfo();
// Gets information about the parameter types ( VARTYPE) and mode ( in, out, in/out)
sal_Bool getParameterInfo();
// analyses the type information provided by the COM component and saves the idizes of the
// out and in/out parameter in the member m_outIndizes
// sal_Bool prepareOutParams( VARIANT* params, sal_uInt32 count );
// Builds up the complete vartype from a TYPEDESC, e.g VT_BSTR, VT_BYREF | VT_I4, VT_BYREF|VT_ARRAY|VT_I1
sal_Bool getElementTypeDesc( TYPEDESC *desc, VARTYPE& varType );
// Iterates over all functions and put the names and indices into a map (TLBFuncIndexMap)
sal_Bool buildComTlbIndex();
// Determines whether the map m_mapComFunc has already been set up
sal_Bool isComTlbIndex();
// The information is necessary for getReturnType and getOutParameterType because they obtain
// the information for the current call on Invocation.
void setCurrentInvokeCall( const OUString& name){ m_usCurrentGet=L""; m_usCurrentInvoke= name;}
void setCurrentGetCall( const OUString& name){ m_usCurrentInvoke= L""; m_usCurrentGet= name;}
// Finds out wheter the wrapped IDispatch is an JScript Object. This is is done by
// asking for the property "_environment". If it has the value "JScript" ( case insensitive)
// then the IDispatch is considered a JScript object.
sal_Bool isJScriptObject();
// -------------------------------------------------------------------------------
// void processOutParameters( VARIANT* pOrgParams,
// VARIANT* pResultParams,
// sal_uInt32 n,
// Sequence< sal_Int16 >& OutParamIndex,
// Sequence< Any >& OutParam);
DispIdMap::iterator getDispIdEntry(const OUString& name);
// If UNO interfaces are being implemented in JScript objects, VB or C++ COM objects
// and those are passed as parameter to a UNO interface function, then
// the IDispatch* are wrapped by objects of this class. Assuming that the functions
// implemented by the IDispatch object returns another UNO interface then
// it has to be wrapped to this type. But this is only possible if an object of this
// wrapper class knows what type it is represting. The member m_TypeDescription holds this
// information.
// m_TypeDescription is only useful when an object wrapps an IDispatch object that implements
// an UNO interface. The value is set during a call to XInitialization::initialize.
Sequence<Type> m_seqTypes;
IUnknown* m_pUnknown;
IDispatch* m_pDispatch;
DispIdMap m_dispIdMap;
Reference<XIdlClass>* m_pxIdlClass;
Mutex m_mutex;
// see prepare OutParams
Sequence< sal_Int16 > m_seqOutIndizes;
// The name of the function being executed ( invoke)
OUString m_usCurrentInvoke;
// The name of the property being retrieved ( getValue)
OUString m_usCurrentGet;
// used by isJScriptObject
enum JScriptDetermination{ JScriptUndefined=0, NoJScript, IsJScript};
JScriptDetermination m_eJScript;
// The map is filled by buildComTlbIndex and
TLBFuncIndexMap m_mapComFunc;
// Keeps the ITypeInfo obtained from IDispatch::GetTypeInfo
CComPtr< ITypeInfo > m_spTypeInfo;
// keeps the modes of parameters of the current function call
// These values correspond to Windows PARAMFLAGS constants ( PARAMFLAG_FIN, PARAMFLAG_FOUT)
// The Sequence contains only the in and out flag
Sequence< sal_Int32> m_seqCurrentParamTypes;
// contains the VARTYPES of the parameters of the current call
Sequence<sal_uInt16> m_seqCurrentVartypes;
};
} // end namespace
#endif
+109
View File
@@ -0,0 +1,109 @@
/*************************************************************************
*
* $RCSfile: olethread.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16: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): _______________________________________
*
*
************************************************************************/
#if defined _MSC_VER && ( _MSC_VER >= 1200 )
#define _WIN32_WINNT 0x0400
#endif
#include "ole2uno.hxx"
#include <tools/presys.h>
#include <hash_map>
#include <tools/postsys.h>
#include <vos/thread.hxx>
using namespace vos;
using namespace std;
namespace ole_adapter
{
// CoInitializeEx *
typedef DECLSPEC_IMPORT HRESULT (STDAPICALLTYPE *ptrCoInitEx)( LPVOID, DWORD);
// CoInitialize *
typedef DECLSPEC_IMPORT HRESULT (STDAPICALLTYPE *ptrCoInit)( LPVOID);
void o2u_attachCurrentThread()
{
static OThreadData oleThreadData;
if ((sal_Bool)oleThreadData.getData() != sal_True)
{
HINSTANCE inst= LoadLibrary( _T("ole32.dll"));
if( inst )
{
HRESULT hr;
// Try DCOM
ptrCoInitEx initFuncEx= (ptrCoInitEx)GetProcAddress( inst, _T("CoInitializeEx"));
if( initFuncEx)
hr= initFuncEx( NULL, COINIT_MULTITHREADED);
// No DCOM, try COM
else
{
ptrCoInit initFunc= (ptrCoInit)GetProcAddress( inst,_T("CoInitialize"));
if( initFunc)
hr= initFunc( NULL);
}
}
oleThreadData.setData((void*)sal_True);
}
}
} // end namespace
+898
View File
@@ -0,0 +1,898 @@
/*************************************************************************
*
* $RCSfile: servprov.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:40 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include <vos/mutex.hxx>
#include "ole2uno.hxx"
#include "unoconversionutilities.hxx"
#include "servprov.hxx"
//#include <vos/xception.hxx>
#include "unoobjw.hxx"
#include "oleobjw.hxx"
using namespace std;
using namespace cppu;
using namespace rtl;
using namespace osl;
using namespace vos;
using namespace com::sun::star::lang;
using namespace com::sun::star::uno;
using namespace com::sun::star::bridge;
using namespace com::sun::star::bridge::ModelDependent;
//#define INVOCATION_SERVICE L"com.sun.star.script.Invocation"
namespace ole_adapter
{
#include <initguid.h>
// prior 5.2 ( src569 ver m)
// {3ECF78F0-B149-11D2-8EBE-00105AD848AF}
//DEFINE_GUID(OID_ServiceManager, 0x3ECF78F0, 0xB149, 0x11d2, 0x8E, 0xBE, 0x00, 0x10, 0x5A, 0xD8, 0x48, 0xAF);
// GUID used since 5.2 ( src569 m)
// {82154420-0FBF-11d4-8313-005004526AB4}
DEFINE_GUID(OID_ServiceManager, 0x82154420, 0xfbf, 0x11d4, 0x83, 0x13, 0x0, 0x50, 0x4, 0x52, 0x6a, 0xb4);
static Reference<XMultiServiceFactory> xMultiServiceFactory;
static Reference<XRegistryKey> xRegistryKey;
Reference<XMultiServiceFactory> o2u_getMultiServiceFactory()
{
return xMultiServiceFactory;
}
Reference<XRegistryKey> o2u_getRegistryKey()
{
return xRegistryKey;
}
extern OMutex globalWrapperMutex;
Reference<XSingleServiceFactory> getInvocationFactory()
{
OGuard aGuard(globalWrapperMutex);
static Reference<XSingleServiceFactory> factory= Reference<XSingleServiceFactory>(o2u_getMultiServiceFactory()->createInstance( INVOCATION_SERVICE), UNO_QUERY);
return factory;
}
/*****************************************************************************
class implementation ProviderOleWrapper_Impl
*****************************************************************************/
ProviderOleWrapper_Impl::ProviderOleWrapper_Impl(const Reference<XSingleServiceFactory>& xSFact, GUID* pGuid)
: m_xSingleServiceFactory(xSFact)
{
m_guid = *pGuid;
Reference<XInterface> xInt = o2u_getMultiServiceFactory()->createInstance(L"com.sun.star.bridge.OleBridgeSupplier2");
if (xInt.is())
{
Any a= xInt->queryInterface( ::getCppuType( reinterpret_cast<
Reference< XBridgeSupplier2>* >(0)));
a >>= m_bridgeSupplier;
}
}
ProviderOleWrapper_Impl::~ProviderOleWrapper_Impl()
{
}
sal_Bool ProviderOleWrapper_Impl::registerClass()
{
HRESULT hresult;
o2u_attachCurrentThread();
hresult = CoRegisterClassObject(
m_guid,
this,
CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER,
REGCLS_MULTIPLEUSE,
&m_factoryHandle);
return (hresult == NOERROR);
}
sal_Bool ProviderOleWrapper_Impl::deregisterClass()
{
HRESULT hresult = CoRevokeClassObject(m_factoryHandle);
return (hresult == NOERROR);
}
STDMETHODIMP ProviderOleWrapper_Impl::QueryInterface(REFIID riid, void FAR* FAR* ppv)
{
if(IsEqualIID(riid, IID_IUnknown))
{
AddRef();
*ppv = (IUnknown*) (IClassFactory*) this;
return NOERROR;
}
else if (IsEqualIID(riid, IID_IClassFactory))
{
AddRef();
*ppv = (IClassFactory*) this;
return NOERROR;
}
*ppv = NULL;
return ResultFromScode(E_NOINTERFACE);
}
STDMETHODIMP_(ULONG) ProviderOleWrapper_Impl::AddRef()
{
return osl_incrementInterlockedCount( &m_refCount);
}
STDMETHODIMP_(ULONG) ProviderOleWrapper_Impl::Release()
{
MutexGuard aGuard( Mutex::getGlobalMutex());
m_refCount--;
if (m_refCount == 0)
{
delete this;
}
return m_refCount;
}
STDMETHODIMP ProviderOleWrapper_Impl::CreateInstance(IUnknown FAR* punkOuter,
REFIID riid,
void FAR* FAR* ppv)
{
HRESULT ret = ResultFromScode(E_UNEXPECTED);
punkOuter = NULL;
Reference<XInterface> xInstance;
if (m_xSingleServiceFactory.is())
{
xInstance = m_xSingleServiceFactory->createInstance();
if (xInstance.is())
{
Any usrAny(&xInstance, getCppuType( & xInstance));
sal_uInt8 arId[16];
rtl_getGlobalProcessId( arId );
Any oleAny = m_bridgeSupplier->createBridge(usrAny,
Sequence<sal_Int8>((sal_Int8*)arId, 16),
UNO,
OLE);
if (oleAny.getValueTypeClass() == getCppuType( (sal_uInt32 *)0).getTypeClass())
{
VARIANT* pVariant = (VARIANT*)oleAny.getValue();
if ((pVariant->vt == VT_UNKNOWN) || (pVariant->vt == VT_DISPATCH))
{
ret = pVariant->punkVal->QueryInterface(riid, ppv);
}
VariantClear(pVariant);
CoTaskMemFree(pVariant);
}
}
}
return ret;
}
STDMETHODIMP ProviderOleWrapper_Impl::LockServer(int fLock)
{
return NOERROR;
}
/*****************************************************************************
class implementation OneInstanceOleWrapper_Impl
*****************************************************************************/
OneInstanceOleWrapper_Impl::OneInstanceOleWrapper_Impl(const Reference<XInterface>& xInst, GUID* pGuid)
: m_xInst(xInst)
{
m_guid = *pGuid;
Reference<XInterface> xInt = o2u_getMultiServiceFactory()->createInstance(L"com.sun.star.bridge.OleBridgeSupplier2");
if (xInt.is())
{
Any a= xInt->queryInterface( getCppuType(
reinterpret_cast< Reference<XBridgeSupplier2>*>(0)));
a >>= m_bridgeSupplier;
}
}
OneInstanceOleWrapper_Impl::~OneInstanceOleWrapper_Impl()
{
}
sal_Bool OneInstanceOleWrapper_Impl::registerClass()
{
HRESULT hresult;
o2u_attachCurrentThread();
hresult = CoRegisterClassObject(
m_guid,
this,
CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER,
REGCLS_MULTIPLEUSE,
&m_factoryHandle);
return (hresult == NOERROR);
}
sal_Bool OneInstanceOleWrapper_Impl::deregisterClass()
{
HRESULT hresult = CoRevokeClassObject(m_factoryHandle);
return (hresult == NOERROR);
}
STDMETHODIMP OneInstanceOleWrapper_Impl::QueryInterface(REFIID riid, void FAR* FAR* ppv)
{
if(IsEqualIID(riid, IID_IUnknown))
{
AddRef();
*ppv = (IUnknown*) (IClassFactory*) this;
return NOERROR;
}
else if (IsEqualIID(riid, IID_IClassFactory))
{
AddRef();
*ppv = (IClassFactory*) this;
return NOERROR;
}
*ppv = NULL;
return ResultFromScode(E_NOINTERFACE);
}
STDMETHODIMP_(ULONG) OneInstanceOleWrapper_Impl::AddRef()
{
return osl_incrementInterlockedCount( &m_refCount);
}
STDMETHODIMP_(ULONG) OneInstanceOleWrapper_Impl::Release()
{
MutexGuard oGuard( Mutex::getGlobalMutex());
m_refCount--;
if ( m_refCount == 0)
{
delete this;
}
return m_refCount;
}
STDMETHODIMP OneInstanceOleWrapper_Impl::CreateInstance(IUnknown FAR* punkOuter,
REFIID riid,
void FAR* FAR* ppv)
{
HRESULT ret = ResultFromScode(E_UNEXPECTED);
punkOuter = NULL;
if (m_xInst.is())
{
Any usrAny(&m_xInst, getCppuType( &m_xInst));
sal_uInt8 arId[16];
rtl_getGlobalProcessId( arId);
Any oleAny = m_bridgeSupplier->createBridge(usrAny,
Sequence<sal_Int8>( (sal_Int8*)arId, 16),
UNO,
OLE);
if (oleAny.getValueTypeClass() == TypeClass_UNSIGNED_LONG)
{
VARIANT* pVariant = *(VARIANT**)oleAny.getValue();
if ((pVariant->vt == VT_UNKNOWN) || (pVariant->vt == VT_DISPATCH))
{
ret = pVariant->punkVal->QueryInterface(riid, ppv);
}
VariantClear(pVariant);
CoTaskMemFree(pVariant);
}
}
return ret;
}
STDMETHODIMP OneInstanceOleWrapper_Impl::LockServer(int fLock)
{
return NOERROR;
}
/*****************************************************************************
class implementation OleConverter_Impl2
*****************************************************************************/
OleConverter_Impl2::OleConverter_Impl2()
{
}
// The XMultiServiceFactory is later set by XInitialization
OleConverter_Impl2::OleConverter_Impl2( sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass ):
UnoConversionUtilities<OleConverter_Impl2>( unoWrapperClass, comWrapperClass )
{
}
OleConverter_Impl2::~OleConverter_Impl2()
{
}
// XBridgeSupplier --------------------------------------------------------------
Any SAL_CALL OleConverter_Impl2::createBridge(const Any& modelDepObject,
const Sequence< sal_Int8 >& ProcessId,
sal_Int16 sourceModelType,
sal_Int16 destModelType)
throw (IllegalArgumentException,
RuntimeException )
{
Any ret;
sal_uInt8 arId[16];
rtl_getGlobalProcessId( arId );
Sequence< sal_Int8 > seqProcessId( (sal_Int8*)arId, 16);
if ( seqProcessId == ProcessId)
{
if (sourceModelType == UNO)
{
if (destModelType == UNO)
{
// same model -> copy value only
ret = modelDepObject;
}
else if (destModelType == OLE)
{
// convert UNO any into variant
VARIANT* pVariant = (VARIANT*) CoTaskMemAlloc(sizeof(VARIANT));
VariantInit( pVariant);
if (! anyToVariant( pVariant, modelDepObject))
{
CoTaskMemFree(pVariant);
throw IllegalArgumentException();
}
else
{
ret.setValue((void*) &pVariant, getCppuType((sal_uInt32*)0));
}
}
else
throw IllegalArgumentException();
}
else if (sourceModelType == OLE)
{
if (modelDepObject.getValueType() != getCppuType((sal_uInt32*)0))
{
throw IllegalArgumentException();
}
else if (destModelType == OLE)
{
// same model -> copy value only
VARIANT* pVariant = (VARIANT*) CoTaskMemAlloc(sizeof(VARIANT));
if (NOERROR != VariantCopy(pVariant, (VARIANT*)modelDepObject.getValue()))
{
CoTaskMemFree(pVariant);
throw(IllegalArgumentException());
}
else
{
ret.setValue((void*) &pVariant, getCppuType((sal_uInt32*)0));
}
}
else if (destModelType == UNO)
{
// convert variant into UNO any
VARIANT* pVariant = (VARIANT*)modelDepObject.getValue();
if (!variantToAny(pVariant, ret))
{
throw IllegalArgumentException();
}
}
else
throw IllegalArgumentException();
}
else
throw IllegalArgumentException();
}
return ret;
}
// XInitialize ------------------------------------------------------------------------------
// the first argument is an XMultiServiceFactory if at all
void SAL_CALL OleConverter_Impl2::initialize( const Sequence< Any >& aArguments )
throw(Exception, RuntimeException)
{
if( aArguments.getLength() == 1 && aArguments[0].getValueTypeClass() == TypeClass_INTERFACE)
{
Reference < XInterface > xInt;
aArguments[0] >>= xInt;
Reference <XMultiServiceFactory> xMulti( xInt, UNO_QUERY);
m_xMultiServiceFactory= xMulti;
}
}
// UnoConversionUtilities -------------------------------------------------------------------
Reference< XInterface > OleConverter_Impl2::createUnoWrapperInstance()
{
if( m_nUnoWrapperClass == INTERFACE_OLE_WRAPPER_IMPL)
{
Reference<XWeak> xWeak= static_cast<XWeak*>( new InterfaceOleWrapper_Impl(
m_xMultiServiceFactory, m_nUnoWrapperClass, m_nComWrapperClass));
return Reference<XInterface>( xWeak, UNO_QUERY);
}
else if( m_nUnoWrapperClass == UNO_OBJECT_WRAPPER_REMOTE_OPT)
{
Reference<XWeak> xWeak= static_cast<XWeak*>( new UnoObjectWrapperRemoteOpt(
m_xMultiServiceFactory, m_nUnoWrapperClass, m_nComWrapperClass));
return Reference<XInterface>( xWeak, UNO_QUERY);
}
else
return Reference<XInterface>();
}
Reference< XInterface > OleConverter_Impl2::createComWrapperInstance()
{
Reference<XWeak> xWeak= static_cast<XWeak*>( new IUnknownWrapper_Impl(
m_xMultiServiceFactory, m_nUnoWrapperClass, m_nComWrapperClass));
return Reference<XInterface>( xWeak, UNO_QUERY);
}
/*****************************************************************************
class implementation OleClient_Impl
*****************************************************************************/
OleClient_Impl::OleClient_Impl()
{
Reference<XInterface> xInt = o2u_getMultiServiceFactory()->createInstance(L"com.sun.star.bridge.OleBridgeSupplier2");
if (xInt.is())
{
Any a= xInt->queryInterface(getCppuType(
reinterpret_cast<Reference<XBridgeSupplier2>*>(0)));
a >>= m_bridgeSupplier;
}
}
OleClient_Impl::~OleClient_Impl()
{
}
Sequence< OUString > SAL_CALL OleClient_Impl::getAvailableServiceNames() throw( RuntimeException )
{
Sequence< OUString > ret;
return ret;
}
OUString OleClient_Impl::getImplementationName()
{
return OUString(L"com.sun.star.comp.ole.OleClient");
}
Reference<XInterface> SAL_CALL OleClient_Impl::createInstance(const OUString& ServiceSpecifier) throw (Exception, RuntimeException )
{
Reference<XInterface> ret;
HRESULT result;
IUnknown* pUnknown = NULL;
CLSID classId;
o2u_attachCurrentThread();
result = CLSIDFromProgID(
ServiceSpecifier.getStr(), //Pointer to the ProgID
&classId); //Pointer to the CLSID
if (result == NOERROR)
{
result = CoCreateInstance(
classId, //Class identifier (CLSID) of the object
NULL, //Pointer to whether object is or isn't part of an aggregate
CLSCTX_ALL, //Context for running executable code
IID_IUnknown, //Reference to the identifier of the interface
(void**)&pUnknown); //Address of output variable that receives
// the interface pointer requested in riid
}
if (pUnknown != NULL)
{
Any any;
VARIANT variant;
VariantInit(&variant);
V_VT(&variant) = VT_UNKNOWN;
V_UNKNOWN(&variant) = pUnknown;
pUnknown->AddRef();
if (variantToAny(&variant, any))
{
if (any.getValueTypeClass() == TypeClass_INTERFACE)
{
ret = *(Reference<XInterface>*)any.getValue();
}
}
VariantClear(&variant);
}
return ret;
}
Reference<XInterface> SAL_CALL OleClient_Impl::createInstanceWithArguments(const OUString& ServiceSpecifier, const Sequence< Any >& Arguments) throw (Exception, RuntimeException)
{
Reference<XInterface> ret;
HRESULT result;
IUnknown* pUnknown = NULL;
CLSID classId;
o2u_attachCurrentThread();
result = CLSIDFromProgID(
ServiceSpecifier.getStr(), //Pointer to the ProgID
&classId); //Pointer to the CLSID
if (result == NOERROR)
{
result = CoCreateInstance(
classId, //Class identifier (CLSID) of the object
NULL, //Pointer to whether object is or isn't part of an aggregate
CLSCTX_LOCAL_SERVER, //Context for running executable code
IID_IUnknown, //Reference to the identifier of the interface
(void**)&pUnknown); //Address of output variable that receives
// the interface pointer requested in riid
}
if (pUnknown != NULL)
{
Any any;
VARIANT variant;
VariantInit(&variant);
V_VT(&variant) = VT_UNKNOWN;
V_UNKNOWN(&variant) = pUnknown;
pUnknown->AddRef();
if (variantToAny(&variant, any))
{
if (any.getValueTypeClass() == TypeClass_INTERFACE)
{
ret = *(Reference<XInterface>*)any.getValue();
}
}
VariantClear(&variant);
}
return ret;
}
// UnoConversionUtilities -----------------------------------------------------------------------------
Reference< XInterface > OleClient_Impl::createUnoWrapperInstance()
{
if( m_nUnoWrapperClass == INTERFACE_OLE_WRAPPER_IMPL)
{
Reference<XWeak> xWeak= static_cast<XWeak*>( new InterfaceOleWrapper_Impl(
m_xMultiServiceFactory, m_nUnoWrapperClass, m_nComWrapperClass));
return Reference<XInterface>( xWeak, UNO_QUERY);
}
else if( m_nUnoWrapperClass == UNO_OBJECT_WRAPPER_REMOTE_OPT)
{
Reference<XWeak> xWeak= static_cast<XWeak*>( new UnoObjectWrapperRemoteOpt(
m_xMultiServiceFactory, m_nUnoWrapperClass, m_nComWrapperClass));
return Reference<XInterface>( xWeak, UNO_QUERY);
}
else
return Reference< XInterface>();
}
// UnoConversionUtilities -----------------------------------------------------------------------------
Reference< XInterface > OleClient_Impl::createComWrapperInstance( )
{
Reference<XWeak> xWeak= static_cast<XWeak*>( new IUnknownWrapper_Impl(
m_xMultiServiceFactory, m_nUnoWrapperClass, m_nComWrapperClass));
return Reference<XInterface>( xWeak, UNO_QUERY);
}
/*****************************************************************************
class implementation OleServer_Impl
*****************************************************************************/
OleServer_Impl::OleServer_Impl()
{
Reference<XInterface> xInt = o2u_getMultiServiceFactory()->createInstance(L"com.sun.star.bridge.OleBridgeSupplier2");
if (xInt.is())
{
Any a= xInt->queryInterface( getCppuType(
reinterpret_cast< Reference<XBridgeSupplier2>*>(0)));
a >>= m_bridgeSupplier;
}
sal_Bool ret = provideInstance(o2u_getMultiServiceFactory(), (GUID*)&OID_ServiceManager);
}
OleServer_Impl::~OleServer_Impl()
{
while (!m_wrapperList.empty())
{
(*m_wrapperList.begin())->deregisterClass();
(*m_wrapperList.begin())->Release();
m_wrapperList.pop_front();
}
}
// XInterface --------------------------------------------------
Any SAL_CALL OleServer_Impl::queryInterface( const Type& aType ) throw(RuntimeException)
{
Any a= ::cppu::queryInterface( aType, static_cast<XTypeProvider*>(this));
if( a == Any())
return OWeakObject::queryInterface( aType);
else
return a;
}
void SAL_CALL OleServer_Impl::acquire( ) throw(RuntimeException)
{
OWeakObject::acquire();
}
void SAL_CALL OleServer_Impl::release( ) throw (RuntimeException)
{
OWeakObject::release();
}
// XTypeProvider --------------------------------------------------
Sequence< Type > SAL_CALL OleServer_Impl::getTypes( ) throw(RuntimeException)
{
static OTypeCollection *pCollection = 0;
if( ! pCollection )
{
MutexGuard guard( Mutex::getGlobalMutex() );
if( ! pCollection )
{
static OTypeCollection collection(
getCppuType(reinterpret_cast< Reference< XWeak>*>(0)),
getCppuType(reinterpret_cast< Reference< XTypeProvider>*>(0)) );
pCollection = &collection;
}
}
return (*pCollection).getTypes();
}
Sequence< sal_Int8 > SAL_CALL OleServer_Impl::getImplementationId() throw(RuntimeException)
{
static OImplementationId *pId = 0;
if( ! pId )
{
MutexGuard guard( Mutex::getGlobalMutex() );
if( ! pId )
{
static OImplementationId id( sal_False );
pId = &id;
}
}
return (*pId).getImplementationId();
}
sal_Bool OleServer_Impl::provideService(const Reference<XSingleServiceFactory>& xSFact, GUID* guid)
{
sal_Bool ret = FALSE;
IClassFactoryWrapper* pFac = new ProviderOleWrapper_Impl(xSFact, guid);
pFac->AddRef();
m_wrapperList.push_back(pFac);
return pFac->registerClass();
}
sal_Bool OleServer_Impl::provideInstance(const Reference<XInterface>& xInst, GUID* guid)
{
sal_Bool ret = FALSE;
IClassFactoryWrapper* pFac = new OneInstanceOleWrapper_Impl(xInst, guid);
pFac->AddRef();
m_wrapperList.push_back(pFac);
return pFac->registerClass();
}
/*****************************************************************************
functions to create the service providers
*****************************************************************************/
Reference<XSingleServiceFactory> o2u_getConverterProvider2(const Reference<XMultiServiceFactory>& xMan,
const Reference<XRegistryKey>& xKey)
{
static Reference<XSingleServiceFactory> ret = NULL;
if (!ret.is())
{
if (!xMultiServiceFactory.is()) xMultiServiceFactory = xMan;
Sequence<OUString> seqServiceNames;
ret = createSingleFactory( xMan, L"com.sun.star.comp.ole.OleConverter2",
ConverterProvider_CreateInstance2, seqServiceNames );
}
return ret;
}
Reference<XSingleServiceFactory> o2u_getConverterProviderVar1(const Reference<XMultiServiceFactory>& xMan,
const Reference<XRegistryKey>& xKey)
{
static Reference<XSingleServiceFactory> ret = NULL;
if (!ret.is())
{
if (!xMultiServiceFactory.is()) xMultiServiceFactory = xMan;
Sequence<OUString> seqServiceNames;
ret = createSingleFactory( xMan, L"com.sun.star.comp.ole.OleConverterVar1",
ConverterProvider_CreateInstanceVar1, seqServiceNames );
}
return ret;
}
Reference<XSingleServiceFactory> o2u_getClientProvider(const Reference<XMultiServiceFactory>& xMan,
const Reference<XRegistryKey>& xKey)
{
static Reference<XSingleServiceFactory> ret = NULL;
if (!ret.is())
{
if (!xMultiServiceFactory.is()) xMultiServiceFactory = xMan;
Sequence<OUString> seqServiceNames;
ret = createSingleFactory( xMan, L"com.sun.star.comp.ole.OleClient",
OleClient_CreateInstance, seqServiceNames);
}
return ret;
}
Reference<XSingleServiceFactory> o2u_getServerProvider(const Reference<XMultiServiceFactory>& xMan,
const Reference<XRegistryKey>& xKey)
{
static Reference<XSingleServiceFactory> ret = NULL;
if (!ret.is())
{
if (!xMultiServiceFactory.is()) xMultiServiceFactory = xMan;
Sequence<OUString> seqServiceNames;
ret = createOneInstanceFactory( xMan, L"com.sun.star.comp.ole.OleServer",
OleServer_CreateInstance, seqServiceNames);
}
return ret;
}
// Creator functions --------------------
Reference<XInterface> SAL_CALL ConverterProvider_CreateInstance2( const Reference<XMultiServiceFactory> & xSMgr)
throw(Exception)
{
Reference<XInterface> xService = *new OleConverter_Impl2();
return xService;
}
Reference<XInterface> SAL_CALL ConverterProvider_CreateInstanceVar1( const Reference<XMultiServiceFactory> & xSMgr)
throw(Exception)
{
Reference<XInterface> xService = *new OleConverter_Impl2( UNO_OBJECT_WRAPPER_REMOTE_OPT, IUNKNOWN_WRAPPER_IMPL);
return xService;
}
Reference<XInterface> SAL_CALL OleClient_CreateInstance( const Reference<XMultiServiceFactory> & xSMgr)
throw(Exception)
{
Reference<XInterface> xService = *new OleClient_Impl();
return xService;
}
Reference<XInterface> SAL_CALL OleServer_CreateInstance( const Reference<XMultiServiceFactory> & xSMgr)
throw (Exception)
{
Reference<XInterface > xService = *new OleServer_Impl();
return xService;
}
} // end namespace
+308
View File
@@ -0,0 +1,308 @@
/*************************************************************************
*
* $RCSfile: servprov.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16: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 _SERVPROV_HXX
#define _SERVPROV_HXX
#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_
#include <com/sun/star/lang/XInitialization.hpp>
#endif
#ifndef _CPPUHELPER_IMPLBASE3_HXX_
#include <cppuhelper/implbase2.hxx>
#endif
#include "ole2uno.hxx"
#include "unoconversionutilities.hxx"
using namespace com::sun::star::bridge;
using namespace cppu;
using namespace std;
namespace ole_adapter
{
Reference< XInterface> SAL_CALL ConverterProvider_CreateInstance( const Reference<XMultiServiceFactory> & xSMgr)
throw( Exception);
Reference< XInterface> SAL_CALL ConverterProvider_CreateInstance2( const Reference<XMultiServiceFactory> & xSMgr)
throw( Exception);
Reference< XInterface> SAL_CALL ConverterProvider_CreateInstanceVar1( const Reference<XMultiServiceFactory> & xSMgr)
throw( Exception);
Reference<XInterface> SAL_CALL OleClient_CreateInstance( const Reference<XMultiServiceFactory> & xSMgr)
throw( Exception);
Reference<XInterface> SAL_CALL OleServer_CreateInstance( const Reference<XMultiServiceFactory> & xSMgr)
throw( Exception);
/*****************************************************************************
class declaration IClassFactoryWrapper
Specify abstract helper methods on class factories, which provide
UNO objects. These methods are used by objects of class OleServer_Impl,
to handle the OLE registration of different class factories.
*****************************************************************************/
class IClassFactoryWrapper : public IClassFactory
{
public:
virtual sal_Bool registerClass() = 0;
virtual sal_Bool deregisterClass() = 0;
};
/*****************************************************************************
class declaration ProviderOleWrapper_Impl
Provides an UNO service provider as OLE class factory. Handle the
OLE registration by overloading the abstract methods from
IClassFactoryWrapper.
Acts as a COM class factory. When IClassFactory::CreateInstance is being called
then it creates an service by help of the XSingleServiceFactory member and maps
maps it to a COM object.
*****************************************************************************/
class ProviderOleWrapper_Impl : public IClassFactoryWrapper
{
public:
ProviderOleWrapper_Impl(const Reference<XSingleServiceFactory>& xSFactory, GUID* pGuid);
~ProviderOleWrapper_Impl();
sal_Bool registerClass();
sal_Bool deregisterClass();
/* IUnknown methods */
STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj);
STDMETHOD_(ULONG, AddRef)();
STDMETHOD_(ULONG, Release)();
/* IClassFactory methods */
STDMETHOD(CreateInstance)(IUnknown FAR* punkOuter, REFIID riid, void FAR* FAR* ppv);
STDMETHOD(LockServer)(int fLock);
protected:
oslInterlockedCount m_refCount;
Reference<XSingleServiceFactory> m_xSingleServiceFactory;
GUID m_guid;
DWORD m_factoryHandle;
Reference<XBridgeSupplier2> m_bridgeSupplier;
};
/*****************************************************************************
class declaration OneInstanceOleWrapper_Impl
Provides an single UNO object as OLE object. Handle the
OLE registration by overloading the abstract methods from
IClassFactoryWrapper.
Acts as a COM class factory. When IClassFactory::CreateInstance is being called
then it maps the XInstance member it to a COM object.
*****************************************************************************/
class OneInstanceOleWrapper_Impl : public IClassFactoryWrapper
{
public:
OneInstanceOleWrapper_Impl(const Reference<XInterface>& xInst, GUID* pGuid);
~OneInstanceOleWrapper_Impl();
sal_Bool registerClass();
sal_Bool deregisterClass();
/* IUnknown methods */
STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj);
STDMETHOD_(ULONG, AddRef)();
STDMETHOD_(ULONG, Release)();
/* IClassFactory methods */
STDMETHOD(CreateInstance)(IUnknown FAR* punkOuter, REFIID riid, void FAR* FAR* ppv);
STDMETHOD(LockServer)(int fLock);
protected:
//ORefCount m_refCount;
oslInterlockedCount m_refCount;
Reference<XInterface> m_xInst;
GUID m_guid;
DWORD m_factoryHandle;
Reference<XBridgeSupplier2> m_bridgeSupplier;
};
/*****************************************************************************
class declaration OleConverter_Impl2
Implementation of the UNO service com.sun.star.bridge.OleBridgeSupplier2.
*****************************************************************************/
// This class realizes the service com.sun.star.bridge.OleBridgeSupplier2 and
// com.sun.star.bridge.OleBridgeSupplierVar1. The class implements XBridgeSupplier2
// instead of XBridgeSuppplier as done by class OleConverter_Impl. The XBridgeSupplier2
// interface does not need a Maschine Id in its createBridge function anymore,
// If an UNO interface is to be converted then the member m_nUnoWrapperClass determines
// what wrapper class is to be used. There are currently InterfaceOleWrapper_Impl and
// UnoObjectWrapperRemoteOpt. The first is used for the OleBridgeSupplier2 and the
// latter for OleBridgeSupplierVar1.
// The m_nComWrapperClass specifies the class which is used as wrapper for COM interfaces.
// Currently there is only one class available ( IUnknownWrapper_Impl).
class OleConverter_Impl2 : public WeakImplHelper2<XBridgeSupplier2, XInitialization>,
public UnoConversionUtilities<OleConverter_Impl2>
{
public:
OleConverter_Impl2();
OleConverter_Impl2( sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass );
virtual ~OleConverter_Impl2();
// XBridgeSupplier2 ---------------------------------------------------
virtual Any SAL_CALL createBridge(const Any& modelDepObject,
const Sequence<sal_Int8>& ProcessId,
sal_Int16 sourceModelType,
sal_Int16 destModelType)
throw (IllegalArgumentException, RuntimeException);
// XInitialization
virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException);
// Abstract struct UnoConversionUtilities
virtual Reference< XInterface > createUnoWrapperInstance();
virtual Reference< XInterface > createComWrapperInstance();
};
/*****************************************************************************
class declaration OleClient_Impl
Implementation of the UNO service com.sun.star.bridge.OleObjectFactory.
*****************************************************************************/
class OleClient_Impl : public WeakImplHelper1<XMultiServiceFactory>,
public UnoConversionUtilities<OleClient_Impl>
{
public:
OleClient_Impl();
~OleClient_Impl();
// XMultiServiceFactory
virtual Reference<XInterface> SAL_CALL createInstance(const OUString& ServiceSpecifier) throw( Exception, RuntimeException);
virtual Reference<XInterface> SAL_CALL createInstanceWithArguments(const OUString& ServiceSpecifier, const Sequence< Any >& Arguments) throw (Exception, RuntimeException);
Sequence< OUString > SAL_CALL getAvailableServiceNames() throw (RuntimeException);
// Abstract struct UnoConversionUtilities
virtual Reference< XInterface > createUnoWrapperInstance();
virtual Reference< XInterface > createComWrapperInstance();
OUString getImplementationName();
protected:
Reference<XBridgeSupplier2> m_bridgeSupplier;
};
/*****************************************************************************
class declaration OleServer_Impl
Implementation of the UNO service com.sun.star.bridge.OleApplicationRegistration.
Register the calling application as OLE automation server for
standard OLE object. The objects will be registered while instanciating
this implementation and deregistrated, if this implementation is destroyed.
*****************************************************************************/
class OleServer_Impl : public OWeakObject, XTypeProvider
{
public:
OleServer_Impl();
~OleServer_Impl();
// XInterface
virtual Any SAL_CALL queryInterface( const Type& aType ) throw(RuntimeException);
virtual void SAL_CALL acquire( ) throw (RuntimeException);
virtual void SAL_CALL release( ) throw (RuntimeException);
// XTypeProvider
virtual Sequence< Type > SAL_CALL getTypes( ) throw(RuntimeException);
virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(RuntimeException);
protected:
sal_Bool provideService(const Reference<XSingleServiceFactory>& xMulFact, GUID* guid);
sal_Bool provideInstance(const Reference<XInterface>& xInst, GUID* guid);
list< IClassFactoryWrapper* > m_wrapperList;
Reference< XBridgeSupplier2 > m_bridgeSupplier;
};
} // end namespace
#endif
+154
View File
@@ -0,0 +1,154 @@
/*************************************************************************
*
* $RCSfile: servreg.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:40 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include "ole2uno.hxx"
#ifndef _RTL_USTRING_
#include <rtl/ustring>
#endif
using namespace rtl;
using namespace ole_adapter;
extern "C" void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
void * pRet = 0;
OUString aImplName( OUString::createFromAscii( pImplName ) );
Reference< XSingleServiceFactory > xFactory;
if (pServiceManager && aImplName.equals( L"com.sun.star.comp.ole.OleConverter2" ))
{
xFactory= o2u_getConverterProvider2(
reinterpret_cast< XMultiServiceFactory*>(pServiceManager),
reinterpret_cast< XRegistryKey*>(pRegistryKey));
}
else if (pServiceManager && aImplName.equals( L"com.sun.star.comp.ole.OleConverterVar1" ))
{
xFactory= o2u_getConverterProviderVar1(
reinterpret_cast< XMultiServiceFactory*>(pServiceManager),
reinterpret_cast< XRegistryKey*>(pRegistryKey));
}
else if(pServiceManager && aImplName.equals(L"com.sun.star.comp.ole.OleClient"))
{
xFactory= o2u_getClientProvider(
reinterpret_cast< XMultiServiceFactory*>(pServiceManager),
reinterpret_cast< XRegistryKey*>(pRegistryKey));
}
else if(pServiceManager && aImplName.equals(L"com.sun.star.comp.ole.OleServer"))
{
xFactory= o2u_getServerProvider(
reinterpret_cast< XMultiServiceFactory*>(pServiceManager),
reinterpret_cast< XRegistryKey*>(pRegistryKey));
}
if (xFactory.is())
{
xFactory->acquire();
pRet = xFactory.get();
}
return pRet;
}
extern "C" sal_Bool SAL_CALL component_writeInfo( void * pServiceManager, void * pRegistryKey )
{
if (pRegistryKey)
{
try
{
Reference<XRegistryKey> xNewKey =
reinterpret_cast<XRegistryKey*>( pRegistryKey)->createKey(L"/com.sun.star.comp.ole.OleConverter2/UNO/SERVICES");
xNewKey->createKey(L"com.sun.star.bridge.OleBridgeSupplier2");
xNewKey =
reinterpret_cast<XRegistryKey*>( pRegistryKey)->createKey(L"/com.sun.star.comp.ole.OleConverterVar1/UNO/SERVICES");
xNewKey->createKey(L"com.sun.star.bridge.OleBridgeSupplierVar1");
xNewKey =
reinterpret_cast<XRegistryKey*>( pRegistryKey)->createKey(L"/com.sun.star.comp.ole.OleClient/UNO/SERVICES");
xNewKey->createKey(L"com.sun.star.bridge.OleObjectFactory");
xNewKey =
reinterpret_cast<XRegistryKey*>( pRegistryKey)->createKey(L"/com.sun.star.comp.ole.OleServer/UNO/SERVICES");
xNewKey->createKey(L"com.sun.star.bridge.OleApplicationRegistration");
return sal_True;
}
catch (InvalidRegistryException &)
{
OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
}
}
return sal_False;
}
extern "C" void SAL_CALL component_getImplementationEnvironment(
const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
{
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+505
View File
@@ -0,0 +1,505 @@
/*************************************************************************
*
* $RCSfile: unoobjw.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16: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 _UNOOBJW_HXX
#define _UNOOBJW_HXX
#include <com/sun/star/script/XAllListener.hpp>
#include <com/sun/star/script/XEventAttacher.hpp>
#include <com/sun/star/bridge/XBridgeSupplier2.hpp>
#include <com/sun/star/beans/XExactName.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <vos/refernce.hxx>
#include <tools/presys.h>
#include "stdafx.h"
#include "comifaces.hxx"
#include <tools/postsys.h>
#include "ole2uno.hxx"
#include "unoconversionutilities.hxx"
using namespace std;
using namespace cppu;
using namespace com::sun::star::bridge;
namespace ole_adapter
{
struct hash_IUnknown_Impl
{
size_t operator()(const IUnknown* p) const
{
return (size_t)p;
}
};
struct equal_to_IUnknown_Impl
{
bool operator()(const IUnknown* s1, const IUnknown* s2) const
{
return s1 == s2;
}
};
typedef hash_map
<
IUnknown*,
Reference<XInterface>,
hash_IUnknown_Impl,
equal_to_IUnknown_Impl
> WrapperMap;
typedef hash_map
<
DWORD,
OleRef<IDispatch>,
hash<DWORD>,
equal_to<DWORD>
> ConnectionMap;
struct GenListenerData
{
Any helper;
OUString listenerType;
OUString addListenerParam;
Reference<XEventListener> xGenListener;
};
typedef vector<GenListenerData> GenListenerDataList;
struct MemberInfo
{
MemberInfo() : flags(0), name() {}
MemberInfo(WORD f, const OUString& n) : flags(f), name(n) {}
WORD flags;
OUString name;
};
typedef hash_map
<
OUString,
DISPID,
hashOUString_Impl,
equalOUString_Impl
> NameToIdMap;
typedef hash_map
<
OUString,
sal_Bool,
hashOUString_Impl,
equalOUString_Impl
> BadNameMap;
typedef hash_map
<
DISPID,
MemberInfo
> IdToMemberInfoMap;
/*****************************************************************************
class declaration: EnumConnections_Impl
*****************************************************************************/
//class EnumConnections_Impl : public IEnumConnections
//{
//public:
//
// EnumConnections_Impl(CONNECTDATA* pConnection, ULONG numOfConn);
// ~EnumConnections_Impl();
//
// /* IUnknown methods */
// STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj);
// STDMETHOD_(ULONG, AddRef)();
// STDMETHOD_(ULONG, Release)();
//
// /* IEnumConnections */
// virtual /* [local] */ HRESULT STDMETHODCALLTYPE Next(
// /* [in] */ ULONG cConnections,
// /* [out] */ CONNECTDATA __RPC_FAR *rgcd,
// /* [out] */ ULONG __RPC_FAR *lpcFetched);
//
// virtual HRESULT STDMETHODCALLTYPE Skip(
// /* [in] */ ULONG cConnections);
//
// virtual HRESULT STDMETHODCALLTYPE Reset(void);
//
// virtual HRESULT STDMETHODCALLTYPE Clone(
// /* [out] */ IEnumConnections __RPC_FAR *__RPC_FAR *ppEnum);
//
//protected:
//
// vos::ORefCount m_refCount;
// CONNECTDATA* m_pConnection;
// ULONG m_numOfConn;
// ULONG m_index;
//};
/*****************************************************************************
class declaration: ConnectionPoint_Impl
*****************************************************************************/
//class ConnectionPoint_Impl : public IConnectionPoint
// , public WeakImplHelper1<XAllListener>
//{
//public:
//
// ConnectionPoint_Impl(const Reference<XInvocation>& xInv,
// const Reference<XInterface>& xOrigin,
// const Reference<XEventAttacher>& xEventAttacher,
// IConnectionPointContainer* pContainer);
//
// ~ConnectionPoint_Impl();
//
// /* IUnknown methods */
// STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj);
// STDMETHOD_(ULONG, AddRef)();
// STDMETHOD_(ULONG, Release)();
//
// /* IConnectionPoint */
// virtual HRESULT STDMETHODCALLTYPE GetConnectionInterface(
// /* [out] */ IID __RPC_FAR *piid);
//
// virtual HRESULT STDMETHODCALLTYPE GetConnectionPointContainer(
// /* [out] */ IConnectionPointContainer __RPC_FAR *__RPC_FAR *ppCPC);
//
// virtual HRESULT STDMETHODCALLTYPE Advise(
// /* [in] */ IUnknown __RPC_FAR *pUnkSink,
// /* [out] */ DWORD __RPC_FAR *pdwCookie);
//
// virtual HRESULT STDMETHODCALLTYPE Unadvise(
// /* [in] */ DWORD dwCookie);
//
// virtual HRESULT STDMETHODCALLTYPE EnumConnections(
// /* [out] */ IEnumConnections __RPC_FAR *__RPC_FAR *ppEnum);
//
//
//
// /* XEventListener */
// virtual void SAL_CALL disposing( const EventObject& Source ) throw(RuntimeException);
//
// /* XAllListener */
// virtual void SAL_CALL firing( const AllEventObject& iaEvent ) throw(RuntimeException);
// virtual Any SAL_CALL approveFiring( const AllEventObject& aEvent ) throw(InvocationTargetException, RuntimeException);
//
//
//protected:
//
// void registerListener();
// void unregisterListener();
//
// vos::ORefCount m_refCount;
// Reference<XInvocation> m_xInvocation;
// Reference<XInterface> m_xOrigin;
// OleRef<IConnectionPointContainer> m_rContainer;
// ConnectionMap m_connection;
// DWORD m_nextCookie;
// Reference<XEventAttacher> m_xEventAttacher;
// GenListenerDataList m_xGenListenerList;
//};
/*****************************************************************************
class declaration: EnumConnectionPoints_Impl
*****************************************************************************/
//class EnumConnectionPoints_Impl : public IEnumConnectionPoints
//{
//public:
//
// EnumConnectionPoints_Impl(OleRef<IConnectionPoint>* pPoints, ULONG numOfPoints);
// ~EnumConnectionPoints_Impl();
//
// /* IUnknown methods */
// STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj);
// STDMETHOD_(ULONG, AddRef)();
// STDMETHOD_(ULONG, Release)();
//
// /* IEnumConnectionPoints */
// virtual /* [local] */ HRESULT STDMETHODCALLTYPE Next(
// /* [in] */ ULONG cConnections,
// /* [out] */ IConnectionPoint __RPC_FAR *__RPC_FAR *rgpcn,
// /* [out] */ ULONG __RPC_FAR *lpcFetched);
//
// virtual HRESULT STDMETHODCALLTYPE Skip(
// /* [in] */ ULONG cConnections);
//
// virtual HRESULT STDMETHODCALLTYPE Reset(void);
//
// virtual HRESULT STDMETHODCALLTYPE Clone(
// /* [out] */ IEnumConnectionPoints __RPC_FAR *__RPC_FAR *ppEnum);
//
//protected:
//
// vos::ORefCount m_refCount;
// OleRef<IConnectionPoint>* m_pPoints;
// ULONG m_numOfPoints;
// ULONG m_index;
//};
/*****************************************************************************
class declaration: InterfaceOleWrapper_Impl
*****************************************************************************/
class InterfaceOleWrapper_Impl : public WeakImplHelper2<XBridgeSupplier2, XInitialization>,
public IDispatchEx,
// public IConnectionPointContainer,
public UnoConversionUtilities<InterfaceOleWrapper_Impl>,
public IUnoObjectWrapper
{
public:
InterfaceOleWrapper_Impl(Reference<XMultiServiceFactory>& xFactory, sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass);
~InterfaceOleWrapper_Impl();
/* IUnknown methods */
STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj);
STDMETHOD_(ULONG, AddRef)();
STDMETHOD_(ULONG, Release)();
/* IDispatch methods */
STDMETHOD( GetTypeInfoCount )( unsigned int * pctinfo );
STDMETHOD( GetTypeInfo )( unsigned int itinfo, LCID lcid, ITypeInfo ** pptinfo );
STDMETHOD( GetIDsOfNames )( REFIID riid, OLECHAR ** rgszNames, unsigned int cNames,
LCID lcid, DISPID * rgdispid );
STDMETHOD( Invoke )( DISPID dispidMember, REFIID riid, LCID lcid, unsigned short wFlags,
DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo,
unsigned int * puArgErr );
/* IDispatchEx methods */
virtual HRESULT STDMETHODCALLTYPE GetDispID(
/* [in] */ BSTR bstrName,
/* [in] */ DWORD grfdex,
/* [out] */ DISPID __RPC_FAR *pid);
virtual /* [local] */ HRESULT STDMETHODCALLTYPE InvokeEx(
/* [in] */ DISPID id,
/* [in] */ LCID lcid,
/* [in] */ WORD wFlags,
/* [in] */ DISPPARAMS __RPC_FAR *pdp,
/* [out] */ VARIANT __RPC_FAR *pvarRes,
/* [out] */ EXCEPINFO __RPC_FAR *pei,
/* [unique][in] */ IServiceProvider __RPC_FAR *pspCaller);
virtual HRESULT STDMETHODCALLTYPE DeleteMemberByName(
/* [in] */ BSTR bstr,
/* [in] */ DWORD grfdex);
virtual HRESULT STDMETHODCALLTYPE DeleteMemberByDispID(
/* [in] */ DISPID id);
virtual HRESULT STDMETHODCALLTYPE GetMemberProperties(
/* [in] */ DISPID id,
/* [in] */ DWORD grfdexFetch,
/* [out] */ DWORD __RPC_FAR *pgrfdex);
virtual HRESULT STDMETHODCALLTYPE GetMemberName(
/* [in] */ DISPID id,
/* [out] */ BSTR __RPC_FAR *pbstrName);
virtual HRESULT STDMETHODCALLTYPE GetNextDispID(
/* [in] */ DWORD grfdex,
/* [in] */ DISPID id,
/* [out] */ DISPID __RPC_FAR *pid);
virtual HRESULT STDMETHODCALLTYPE GetNameSpaceParent(
/* [out] */ IUnknown __RPC_FAR *__RPC_FAR *ppunk);
/* IConnectionPointContainer */
// virtual HRESULT STDMETHODCALLTYPE EnumConnectionPoints(
// /* [out] */ IEnumConnectionPoints __RPC_FAR *__RPC_FAR *ppEnum);
//
// virtual HRESULT STDMETHODCALLTYPE FindConnectionPoint(
// /* [in] */ REFIID riid,
// /* [out] */ IConnectionPoint __RPC_FAR *__RPC_FAR *ppCP);
//XInterface ----------------------------------------------------------
void SAL_CALL InterfaceOleWrapper_Impl::acquire( ) throw();
void SAL_CALL InterfaceOleWrapper_Impl::release( ) throw();
// XBridgeSupplier2 ---------------------------------------------------
virtual Any SAL_CALL createBridge(const Any& modelDepObject,
const Sequence<sal_Int8>& ProcessId,
sal_Int16 sourceModelType,
sal_Int16 destModelType)
throw (IllegalArgumentException, RuntimeException);
//XInitialization -----------------------------------------------------
virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException);
// IUnoObjectWrapper
STDMETHOD( getWrapperXInterface)( Reference<XInterface>* pXInt);
STDMETHOD( getOriginalUnoObject)( Reference<XInterface>* pXInt);
STDMETHOD( getOriginalUnoStruct)( Any * pStruct);
// UnoConversionUtility
// virtual Reference< XSingleServiceFactory > getInvocationFactory();
virtual Reference< XInterface > createUnoWrapperInstance();
virtual Reference< XInterface > createComWrapperInstance();
protected:
virtual HRESULT doInvoke( DISPPARAMS * pdispparams, VARIANT * pvarResult,
EXCEPINFO * pexcepinfo, unsigned int * puArgErr, OUString & name, Sequence<Any>& params);
virtual HRESULT doGetProperty( DISPPARAMS * pdispparams, VARIANT * pvarResult,
EXCEPINFO * pexcepinfo, OUString & name );
virtual HRESULT doSetProperty( DISPPARAMS * pdispparams, VARIANT * pvarResult,
EXCEPINFO * pexcepinfo, unsigned int * puArgErr, OUString & name, Sequence<Any> params);
virtual HRESULT InvokeGeneral( DISPID dispidMember, unsigned short wFlags,
DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo,
unsigned int * puArgErr, sal_Bool& bHandled);
sal_Bool convertVARIANTARGS( DISPID id, unsigned short wFlags, DISPPARAMS* pdispparams,
Sequence<Any>& rSeq);
vos::ORefCount m_refCount;
Reference<XInvocation> m_xInvocation;
Reference<XExactName> m_xExactName;
Reference<XInterface> m_xOrigin;
Reference<XEventAttacher> m_xEventAttacher;
NameToIdMap m_nameToDispIdMap;
vector<MemberInfo> m_MemberInfos;
OleRef<IConnectionPoint> m_rConnectionPoint;
// This member is used to determine the default value
// denoted by DISPID_VALUE (0). For proper results in JavaScript
// we have to return the default value when we write an object
// as out parameter. That is, we get an JScript Array as parameter
// and put a wrapped object on index null. The array object tries
// to detect the default value. The wrapped object must then return
// its own IDispatch* otherwise we cannot access it within the script.
// see InterfaceOleWrapper_Impl::Invoke
VARTYPE m_defaultValueType;
};
/*****************************************************************************
class declaration: UnoObjectWrapperRemoteOpt
( Uno Object Wrapper Remote Optimized)
This is the UNO wrapper used in the service com.sun.star.bridge.OleBridgeSupplierVar1.
Key features:
DISPIDs are passed out blindly. That is in GetIDsOfNames is no name checking carried out.
Only if Invoke fails the name is being checked. Moreover Invoke tries to figure out
if a call is made to a property or method if the flags are DISPATCH_METHOD | DISPATCH_PROPERTYPUT.
If something has been found out about a property or member than it is saved
in a MemberInfo structure hold by a IdToMemberInfoMap stl map.
*****************************************************************************/
class UnoObjectWrapperRemoteOpt: public InterfaceOleWrapper_Impl
{
public:
UnoObjectWrapperRemoteOpt( Reference<XMultiServiceFactory>& aFactory, sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass);
~UnoObjectWrapperRemoteOpt();
STDMETHOD( GetIDsOfNames )( REFIID riid, OLECHAR ** rgszNames, unsigned int cNames,
LCID lcid, DISPID * rgdispid );
STDMETHOD( Invoke )( DISPID dispidMember, REFIID riid, LCID lcid, unsigned short wFlags,
DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo,
unsigned int * puArgErr );
// UnoConversionUtility
// If UNO interfaces are converted in methods of this class then
// they are always wrapped with instances of this class
virtual Reference< XInterface > createUnoWrapperInstance();
protected:
HRESULT methodInvoke( DISPID dispidMember, DISPPARAMS * pdispparams, VARIANT * pvarResult,
EXCEPINFO * pexcepinfo, unsigned int * puArgErr, Sequence<Any> params);
// In GetIDsOfNames are blindly passed out, that is without verifying
// the name. If two names are passed in during different calls to
// GetIDsOfNames and the names differ only in their cases then different
// id's are passed out ( e.g. "doSomethingMethod" or "dosomethingmethod").
// In Invoke the DISPID is remapped to the name passed to GetIDsOfNames
// and the name is used as parameter for XInvocation::invoke. If invoke
// fails because of a wrong name, then m_xExactName ( XExactName) is used
// to verify the name. The correct name is then inserted to m_MemberInfos
// ( vector<MemberInfo> ). During the next call to Invoke the right name
// is used. .
BadNameMap m_badNameMap;
IdToMemberInfoMap m_idToMemberInfoMap;
};
} // end namespace
#endif
+364
View File
@@ -0,0 +1,364 @@
/*************************************************************************
*
* $RCSfile: context.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#if STLPORT_VERSION>=321
#include <cstdarg>
#endif
#include <plugin/impl.hxx>
#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAGS_HPP_
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_
#include <com/sun/star/frame/XComponentLoader.hpp>
#endif
#include <tools/fsys.hxx>
#include <tools/urlobj.hxx>
#include <cppuhelper/implbase1.hxx>
namespace ext_plug {
class FileSink : public ::cppu::WeakAggImplHelper1< ::com::sun::star::io::XOutputStream >
{
private:
Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
FILE* fp;
Reference< ::com::sun::star::plugin::XPlugin > m_xPlugin;
::rtl::OUString m_aMIMEType;
::rtl::OUString m_aTarget;
::rtl::OUString m_aFileName;
public:
FileSink( const Reference< ::com::sun::star::lang::XMultiServiceFactory > &,
const Reference< ::com::sun::star::plugin::XPlugin > & plugin,
const ::rtl::OUString& mimetype,
const ::rtl::OUString& target,
const Reference< ::com::sun::star::io::XActiveDataSource > & source );
virtual ~FileSink();
// ::com::sun::star::io::XOutputStream
virtual void SAL_CALL writeBytes( const Sequence<sal_Int8>& );
virtual void SAL_CALL flush();
virtual void SAL_CALL closeOutput();
};
}
using namespace ext_plug;
class XPluginContext_Impl : public ::cppu::WeakAggImplHelper1< ::com::sun::star::plugin::XPluginContext >
{
Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
rtl_TextEncoding m_aEncoding;
public:
XPluginContext_Impl( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & );
virtual ~XPluginContext_Impl();
virtual ::rtl::OUString SAL_CALL getValue(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, ::com::sun::star::plugin::PluginVariable variable) throw( ::com::sun::star::plugin::PluginException, RuntimeException );
virtual void SAL_CALL getURLNotify(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target, const Reference< ::com::sun::star::lang::XEventListener > & listener) throw( ::com::sun::star::plugin::PluginException, RuntimeException );
virtual void SAL_CALL getURL(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target) throw( ::com::sun::star::plugin::PluginException, RuntimeException );
virtual void SAL_CALL postURLNotify(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target, const Sequence< sal_Int8 >& buf, sal_Bool file, const Reference< ::com::sun::star::lang::XEventListener > & listener) throw( ::com::sun::star::plugin::PluginException, RuntimeException );
virtual void SAL_CALL postURL(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target, const Sequence< sal_Int8 >& buf, sal_Bool file) throw( ::com::sun::star::plugin::PluginException, RuntimeException );
virtual void SAL_CALL newStream(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& mimetype, const ::rtl::OUString& target, const Reference< ::com::sun::star::io::XActiveDataSource > & source) throw( ::com::sun::star::plugin::PluginException, RuntimeException );
virtual void SAL_CALL displayStatusText(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& message) throw( ::com::sun::star::plugin::PluginException, RuntimeException );
virtual ::rtl::OUString SAL_CALL getUserAgent(const Reference< ::com::sun::star::plugin::XPlugin > & plugin) throw( ::com::sun::star::plugin::PluginException, RuntimeException );
};
Reference< ::com::sun::star::plugin::XPluginContext > XPluginManager_Impl::createPluginContext()
{
return new XPluginContext_Impl( m_xSMgr );
}
XPluginContext_Impl::XPluginContext_Impl( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr )
: m_xSMgr( rSMgr ),
m_aEncoding( gsl_getSystemTextEncoding() )
{
}
XPluginContext_Impl::~XPluginContext_Impl()
{
}
::rtl::OUString XPluginContext_Impl::getValue( const Reference< ::com::sun::star::plugin::XPlugin > & plugin, ::com::sun::star::plugin::PluginVariable variable )
throw( ::com::sun::star::plugin::PluginException, RuntimeException )
{
return ::rtl::OUString();
}
void XPluginContext_Impl::getURL(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target) throw( ::com::sun::star::plugin::PluginException, RuntimeException )
{
Reference< XInterface > xInst = m_xSMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ) );
if( ! xInst.is() )
return;
if( ! target.len() )
{
INetURLObject aURL;
aURL.SetSmartProtocol( INET_PROT_FILE );
aURL.SetSmartURL( ::rtl::OUStringToOString( url, m_aEncoding ) );
Reference< ::com::sun::star::lang::XMultiServiceFactory > xFact( m_xSMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.DataSourceFactory" ) ), UNO_QUERY );
if ( xFact.is() )
{
Sequence < Any > aArgs(1);
::rtl::OUString aUURL( aURL.GetMainURL() );
aArgs.getArray()[0] <<= aUURL;
::rtl::OUString aProt( INetURLObject::GetScheme( aURL.GetProtocol() ) );
Reference< ::com::sun::star::io::XActiveDataSource > aSource( xFact->createInstanceWithArguments( aProt, aArgs ), UNO_QUERY );
if ( aSource.is() )
{
// the mimetype cannot be specified
plugin->provideNewStream( ::rtl::OUString(),
aSource,
aUURL,
0, 0, sal_False );
}
}
return;
}
Reference< ::com::sun::star::frame::XComponentLoader > xLoader( xInst, UNO_QUERY );
XPlugin_Impl* pPlugin = XPluginManager_Impl::getPluginImplementation( plugin );
if( xLoader.is() && pPlugin )
{
::com::sun::star::beans::PropertyValue aValue;
aValue.Name = ::rtl::OUString::createFromAscii( "Referer" );
aValue.Value <<= pPlugin->getRefererURL();
Sequence< ::com::sun::star::beans::PropertyValue > aArgs( &aValue, 1 );
Reference< ::com::sun::star::lang::XComponent > xComp =
xLoader->loadComponentFromURL(
url,
target,
::com::sun::star::frame::FrameSearchFlag::PARENT |
::com::sun::star::frame::FrameSearchFlag::SELF |
::com::sun::star::frame::FrameSearchFlag::CHILDREN |
::com::sun::star::frame::FrameSearchFlag::SIBLINGS |
::com::sun::star::frame::FrameSearchFlag::TASKS |
::com::sun::star::frame::FrameSearchFlag::CREATE,
aArgs
);
}
}
void XPluginContext_Impl::getURLNotify(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target, const Reference< ::com::sun::star::lang::XEventListener > & listener )
throw( ::com::sun::star::plugin::PluginException, RuntimeException )
{
getURL( plugin, url, target );
if( listener.is() )
listener->disposing( ::com::sun::star::lang::EventObject() );
}
::rtl::OUString XPluginContext_Impl::getUserAgent(const Reference< ::com::sun::star::plugin::XPlugin > & plugin)
throw( ::com::sun::star::plugin::PluginException, RuntimeException )
{
return ::rtl::OUString::createFromAscii( "Mozilla 3.0" );
}
void XPluginContext_Impl::displayStatusText(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& message)
throw( ::com::sun::star::plugin::PluginException, RuntimeException )
{
}
void XPluginContext_Impl::postURL(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target, const Sequence< sal_Int8 >& buf, sal_Bool file)
throw( ::com::sun::star::plugin::PluginException, RuntimeException )
{
Sequence< sal_Int8 > aBuf;
if( file )
{
String aFileName( (char*)buf.getConstArray(), m_aEncoding );
INetURLObject aFilePath( aFileName );
aFileName = aFilePath.PathToFileName();
SvFileStream aStream( aFileName, STREAM_READ );
if( aStream.IsOpen() )
{
int nBytes = 0;
aStream.Seek( STREAM_SEEK_TO_END );
aBuf = Sequence<sal_Int8>( nBytes = aStream.Tell() );
aStream.Seek( STREAM_SEEK_TO_BEGIN );
aStream.Read( aBuf.getArray(), nBytes );
aStream.Close();
DirEntry( aFileName ).Kill();
}
}
Reference< XInterface > xInst = m_xSMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ) );
if( ! xInst.is() )
return ;
Reference< ::com::sun::star::frame::XComponentLoader > xLoader( xInst, UNO_QUERY );
XPlugin_Impl* pPlugin = XPluginManager_Impl::getPluginImplementation( plugin );
if( xLoader.is() && pPlugin )
{
::com::sun::star::beans::PropertyValue aValues[2];
aValues[0].Name = ::rtl::OUString::createFromAscii( "Referer" );
aValues[0].Value <<= pPlugin->getRefererURL();
aValues[1].Name = ::rtl::OUString::createFromAscii( "PostString" );
aValues[1].Value <<= ::rtl::OStringToOUString( (char*)( file ? aBuf : buf ).getConstArray(), m_aEncoding );
Sequence< ::com::sun::star::beans::PropertyValue > aArgs( aValues, 2 );
Reference< ::com::sun::star::lang::XComponent > xComp =
xLoader->loadComponentFromURL(
url,
target,
::com::sun::star::frame::FrameSearchFlag::PARENT |
::com::sun::star::frame::FrameSearchFlag::SELF |
::com::sun::star::frame::FrameSearchFlag::CHILDREN |
::com::sun::star::frame::FrameSearchFlag::SIBLINGS |
::com::sun::star::frame::FrameSearchFlag::TASKS |
::com::sun::star::frame::FrameSearchFlag::CREATE,
aArgs
);
}
}
void XPluginContext_Impl::postURLNotify(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target, const Sequence< sal_Int8 >& buf, sal_Bool file, const Reference< ::com::sun::star::lang::XEventListener > & listener )
throw( ::com::sun::star::plugin::PluginException, RuntimeException )
{
postURL( plugin, url, target, buf, file );
if( listener.is() )
listener->disposing( ::com::sun::star::lang::EventObject() );
}
void XPluginContext_Impl::newStream( const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& mimetype, const ::rtl::OUString& target, const Reference< ::com::sun::star::io::XActiveDataSource > & source )
throw( ::com::sun::star::plugin::PluginException, RuntimeException )
{
FileSink* pNewSink = new FileSink( m_xSMgr, plugin, mimetype, target, source );
pNewSink->acquire();
}
FileSink::FileSink( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr, const Reference< ::com::sun::star::plugin::XPlugin > & plugin,
const ::rtl::OUString& mimetype,
const ::rtl::OUString& target, const Reference< ::com::sun::star::io::XActiveDataSource > & source ) :
m_xSMgr( rSMgr ),
m_aMIMEType( mimetype ),
m_aTarget( target ),
m_xPlugin( plugin )
{
DirEntry aEntry;
m_aFileName = aEntry.TempName().GetFull();
::rtl::OString aFile = ::rtl::OUStringToOString( m_aFileName, gsl_getSystemTextEncoding() );
fp = fopen( aFile.getStr() , "wb" );
Reference< ::com::sun::star::io::XActiveDataControl > xControl( source, UNO_QUERY );
source->setOutputStream( Reference< ::com::sun::star::io::XOutputStream > ( this ) );
if( xControl.is() )
xControl->start();
}
FileSink::~FileSink()
{
DirEntry aEntry( m_aFileName );
aEntry.Kill();
}
void FileSink::closeOutput()
{
if( fp )
fclose( fp );
Reference< XInterface > xInst = m_xSMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ) );
Reference< ::com::sun::star::frame::XComponentLoader > xLoader( xInst, UNO_QUERY );
XPlugin_Impl* pPlugin = XPluginManager_Impl::getPluginImplementation( m_xPlugin );
if( xLoader.is() && pPlugin )
{
::com::sun::star::beans::PropertyValue aValue;
aValue.Name = ::rtl::OUString::createFromAscii( "Referer" );
aValue.Value <<= pPlugin->getRefererURL();
Sequence< ::com::sun::star::beans::PropertyValue > aArgs( &aValue, 1 );
Reference< ::com::sun::star::lang::XComponent > xComp =
xLoader->loadComponentFromURL(
m_aFileName,
m_aTarget,
::com::sun::star::frame::FrameSearchFlag::PARENT |
::com::sun::star::frame::FrameSearchFlag::SELF |
::com::sun::star::frame::FrameSearchFlag::CHILDREN |
::com::sun::star::frame::FrameSearchFlag::SIBLINGS |
::com::sun::star::frame::FrameSearchFlag::TASKS |
::com::sun::star::frame::FrameSearchFlag::CREATE,
aArgs
);
}
release();
}
void FileSink::writeBytes( const Sequence<sal_Int8>& Buffer )
{
if( fp )
fwrite( Buffer.getConstArray(), 1, Buffer.getLength(), fp );
}
void FileSink::flush()
{
if( fp )
fflush( fp );
}
@@ -0,0 +1,95 @@
/*************************************************************************
*
* $RCSfile: evtlstnr.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#if STLPORT_VERSION>=321
#include <cstdarg>
#endif
#include <plugin/impl.hxx>
PluginEventListener::PluginEventListener( XPlugin_Impl* pPlugin,
const char* url,
const char* normurl,
void* notifyData ) :
m_pPlugin( pPlugin ),
m_xPlugin( pPlugin ),
m_pUrl( strdup( url ) ),
m_pNormalizedUrl( strdup( normurl ) ),
m_pNotifyData( notifyData )
{
}
PluginEventListener::~PluginEventListener()
{
if( m_pUrl )
free( m_pUrl );
if( m_pNormalizedUrl )
free( m_pNormalizedUrl );
}
void PluginEventListener::disposing( const ::com::sun::star::lang::EventObject& rEvt )
{
m_pPlugin->getPluginComm()->
NPP_URLNotify( m_pPlugin->getNPPInstance(),
m_pUrl,
NPRES_DONE,
m_pNotifyData );
}
+159
View File
@@ -0,0 +1,159 @@
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1.1.1 $
#
# last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
#
# - GNU Lesser General Public License Version 2.1
# - Sun Industry Standards Source License Version 1.1
#
# Sun Microsystems Inc., October, 2000
#
# GNU Lesser General Public License Version 2.1
# =============================================
# Copyright 2000 by Sun Microsystems, Inc.
# 901 San Antonio Road, Palo Alto, CA 94303, USA
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1, as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
#
# Sun Industry Standards Source License Version 1.1
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.1 (the "License"); You may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at http://www.openoffice.org/license.html.
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning 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=plugin
TARGET=plbase
ENABLE_EXCEPTIONS=TRUE
.INCLUDE : ..$/util$/makefile.pmk
# --- Types -------------------------------------
UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
UNOUCROUT=$(OUT)$/inc$/$(PRJNAME)
INCPRE+=$(UNOUCROUT)
# --- Types -------------------------------------
UNOTYPES=\
com.sun.star.awt.PosSize \
com.sun.star.awt.MouseButton \
com.sun.star.awt.FocusChangeReason \
com.sun.star.awt.KeyFunction \
com.sun.star.awt.Key \
com.sun.star.awt.KeyModifier \
com.sun.star.awt.KeyGroup \
com.sun.star.awt.XAdjustmentListener \
com.sun.star.awt.XActionListener \
com.sun.star.awt.XTextListener \
com.sun.star.awt.XSpinListener \
com.sun.star.awt.XItemListener \
com.sun.star.awt.XVclContainerListener \
com.sun.star.awt.XVclContainerPeer \
com.sun.star.awt.XVclContainer \
com.sun.star.awt.XVclWindowPeer \
com.sun.star.awt.VclWindowPeerAttribute \
com.sun.star.awt.XActivateListener \
com.sun.star.awt.XTopWindowListener \
com.sun.star.awt.XKeyListener \
com.sun.star.awt.XTopWindow \
com.sun.star.awt.XControl \
com.sun.star.awt.XControlModel \
com.sun.star.awt.XUnoControlContainer \
com.sun.star.beans.PropertyValues \
com.sun.star.beans.PropertyAttribute \
com.sun.star.beans.XPropertySet \
com.sun.star.beans.XMultiPropertySet \
com.sun.star.beans.XFastPropertySet \
com.sun.star.beans.XPropertyState \
com.sun.star.beans.XPropertyAccess \
com.sun.star.beans.XPropertyContainer \
com.sun.star.beans.XPropertyChangeListener \
com.sun.star.beans.XPropertyStateChangeListener \
com.sun.star.plugin.PluginMode \
com.sun.star.plugin.XPluginManager \
com.sun.star.io.XConnectable \
com.sun.star.io.XActiveDataSource \
com.sun.star.io.XActiveDataSink \
com.sun.star.io.XActiveDataControl \
com.sun.star.io.XDataOutputStream \
com.sun.star.io.XDataInputStream \
com.sun.star.io.XObjectInputStream \
com.sun.star.io.XMarkableStream \
com.sun.star.lang.XServiceName \
com.sun.star.lang.XServiceInfo \
com.sun.star.lang.XTypeProvider \
com.sun.star.lang.XMultiServiceFactory \
com.sun.star.lang.XSingleServiceFactory \
com.sun.star.registry.XRegistryKey \
com.sun.star.loader.XImplementationLoader \
com.sun.star.container.XSet \
com.sun.star.container.XNameAccess \
com.sun.star.container.XIndexAccess \
com.sun.star.frame.XComponentLoader \
com.sun.star.frame.FrameSearchFlag \
com.sun.star.uno.TypeClass \
com.sun.star.uno.XAggregation \
com.sun.star.uno.XWeak
# --- Files --------------------------------------------------------
SLOFILES= \
$(SLO)$/plctrl.obj \
$(SLO)$/service.obj \
$(SLO)$/xplugin.obj \
$(SLO)$/nfuncs.obj \
$(SLO)$/manager.obj \
$(SLO)$/context.obj \
$(SLO)$/evtlstnr.obj \
$(SLO)$/plcom.obj \
$(SLO)$/multiplx.obj \
$(SLO)$/plmodel.obj
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
.INCLUDE : ..$/util$/target.pmk
+316
View File
@@ -0,0 +1,316 @@
/*************************************************************************
*
* $RCSfile: manager.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#if STLPORT_VERSION>=321
#include <cstdarg>
#endif
#include <plugin/impl.hxx>
#include <osl/mutex.hxx>
#ifndef _COM_SUN_STAR_CONTAINER_XENUMERATIONACCESS_HPP_
#include <com/sun/star/container/XEnumerationAccess.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
#include <com/sun/star/container/XNameAccess.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XENUMERATION_HPP_
#include <com/sun/star/container/XEnumeration.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XELEMENTACCESS_HPP_
#include <com/sun/star/container/XElementAccess.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
#include <com/sun/star/container/XIndexAccess.hpp>
#endif
#ifndef _COM_SUN_STAR_LOADER_XIMPLEMENTATIONLOADER_HPP_
#include <com/sun/star/loader/XImplementationLoader.hpp>
#endif
#ifndef _COM_SUN_STAR_LOADER_CANNOTACTIVATEFACTORYEXCEPTION_HPP_
#include <com/sun/star/loader/CannotActivateFactoryException.hpp>
#endif
PluginManager* PluginManager::pManager = NULL;
PluginManager& PluginManager::get()
{
if( ! pManager )
pManager = new PluginManager();
return *pManager;
}
void PluginManager::setServiceFactory( const Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory )
{
PluginManager& rManager = get();
if( ! rManager.m_xSMgr.is() )
rManager.m_xSMgr = xFactory;
}
PluginManager::PluginManager()
{
}
PluginManager::~PluginManager()
{
}
const Sequence< ::rtl::OUString >& PluginManager::getAdditionalSearchPaths()
{
static Sequence< ::rtl::OUString > aPaths;
if( ! aPaths.getLength() )
{
Reference< XInterface > xInst = get().m_xSMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Settings" ) );
Reference< ::com::sun::star::container::XNameAccess > xAccess( xInst, UNO_QUERY );
if( xAccess.is() )
{
Any aValue = xAccess->getByName( ::rtl::OUString::createFromAscii( "PathSettings" ) );
Reference< ::com::sun::star::beans::XPropertySet > xProp;
if( aValue.hasValue() )
aValue >>= xProp;
if( xProp.is() )
{
aValue = xProp->getPropertyValue( ::rtl::OUString::createFromAscii( "Plugins" ) );
if( aValue.getValueType().getTypeClass() == TypeClass_STRING )
{
::rtl::OUString sValue;
aValue >>= sValue;
sal_Int32 nTokens = sValue.getTokenCount();
aPaths = Sequence< ::rtl::OUString >( nTokens );
while( nTokens-- )
aPaths.getArray()[nTokens] = sValue.getToken( nTokens );
}
else if( aValue.getValueType().equals( ::getCppuType( (Sequence< ::rtl::OUString >*)0 ) ) )
{
Sequence< ::rtl::OUString > aArr;
aValue >>= aArr;
sal_Int32 nGlobalTokens = 0;
int i = 0;
for( i = 0; i < aArr.getLength(); i++ )
nGlobalTokens += aArr.getConstArray()[i].getTokenCount();
aPaths = Sequence< ::rtl::OUString >( nGlobalTokens );
for( i = aArr.getLength()-1; i >= 0; i-- )
{
sal_Int32 nTokens = aArr.getConstArray()[i].getTokenCount();
while( nTokens-- )
aPaths.getArray()[--nGlobalTokens] =
aArr.getConstArray()[i].getToken( nTokens );
}
}
}
}
}
return aPaths;
}
//==================================================================================================
Reference< XInterface > SAL_CALL PluginManager_CreateInstance( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr ) throw( Exception )
{
Reference< XInterface > xService = *new XPluginManager_Impl( rSMgr );
return xService;
}
// ::com::sun::star::lang::XServiceInfo
::rtl::OUString XPluginManager_Impl::getImplementationName() throw( )
{
return getImplementationName_Static();
}
// ::com::sun::star::lang::XServiceInfo
sal_Bool XPluginManager_Impl::supportsService(const ::rtl::OUString& ServiceName) throw( )
{
Sequence< ::rtl::OUString > aSNL = getSupportedServiceNames();
const ::rtl::OUString * pArray = aSNL.getConstArray();
for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
if( pArray[i] == ServiceName )
return sal_True;
return sal_False;
}
// ::com::sun::star::lang::XServiceInfo
Sequence< ::rtl::OUString > XPluginManager_Impl::getSupportedServiceNames(void) throw( )
{
return getSupportedServiceNames_Static();
}
// XPluginManager_Impl
Sequence< ::rtl::OUString > XPluginManager_Impl::getSupportedServiceNames_Static(void) throw( )
{
Sequence< ::rtl::OUString > aSNS( 1 );
aSNS.getArray()[0] = ::rtl::OUString::createFromAscii( "com.sun.star.plugin.PluginManager" );
return aSNS;
}
XPluginManager_Impl::XPluginManager_Impl( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr )
: m_xSMgr( rSMgr )
{
PluginManager::setServiceFactory( rSMgr );
}
XPluginManager_Impl::~XPluginManager_Impl()
{
}
XPlugin_Impl* XPluginManager_Impl::getXPluginFromNPP( NPP instance )
{
::std::list<XPlugin_Impl*>::iterator iter;
for( iter = PluginManager::get().getPlugins().begin();
iter != PluginManager::get().getPlugins().end(); ++iter )
{
if( (*iter)->getNPPInstance() == instance )
return *iter;
}
return NULL;
}
XPlugin_Impl* XPluginManager_Impl::getPluginImplementation( const Reference< ::com::sun::star::plugin::XPlugin >& plugin )
{
::std::list<XPlugin_Impl*>::iterator iter;
for( iter = PluginManager::get().getPlugins().begin();
iter != PluginManager::get().getPlugins().end(); ++iter )
{
if( plugin == Reference< ::com::sun::star::plugin::XPlugin >((*iter)) )
return *iter;
}
return NULL;
}
XPlugin_Impl* XPluginManager_Impl::getFirstXPlugin()
{
if( PluginManager::get().getPlugins().begin() == PluginManager::get().getPlugins().end() )
return NULL;
return *PluginManager::get().getPlugins().begin();
}
Reference< ::com::sun::star::plugin::XPlugin > XPluginManager_Impl::createPlugin( const Reference< ::com::sun::star::plugin::XPluginContext >& acontext, INT16 mode, const Sequence< ::rtl::OUString >& argn, const Sequence< ::rtl::OUString >& argv, const ::com::sun::star::plugin::PluginDescription& plugintype)
throw( RuntimeException,::com::sun::star::plugin::PluginException )
{
XPlugin_Impl* pImpl = new XPlugin_Impl( m_xSMgr );
pImpl->setPluginContext( acontext );
PluginManager::get().getPlugins().push_back( pImpl );
pImpl->initInstance( plugintype,
argn,
argv,
mode );
return pImpl;
}
Reference< ::com::sun::star::plugin::XPlugin > XPluginManager_Impl::createPluginFromURL( const Reference< ::com::sun::star::plugin::XPluginContext > & acontext, sal_Int16 mode, const Sequence< ::rtl::OUString >& argn, const Sequence< ::rtl::OUString >& argv, const Reference< ::com::sun::star::awt::XToolkit > & toolkit, const Reference< ::com::sun::star::awt::XWindowPeer > & parent, const ::rtl::OUString& url )
{
XPlugin_Impl* pImpl = new XPlugin_Impl( m_xSMgr );
Reference< ::com::sun::star::plugin::XPlugin > xRef = pImpl; // festhalten...
pImpl->setPluginContext( acontext );
PluginManager::get().getPlugins().push_back( pImpl );
int nDescr = -1;
Sequence< ::com::sun::star::plugin::PluginDescription > aDescrs = getPluginDescriptions();
const ::com::sun::star::plugin::PluginDescription* pDescrs = aDescrs.getConstArray();
int nPos = url.lastIndexOf( (sal_Unicode)'.' );
if( nPos != -1 )
{
::rtl::OUString aExt = url.copy( nPos ).toLowerCase();
for( int i = 0; i < aDescrs.getLength(); i++ )
{
if( pDescrs[ i ].Extension.equalsIgnoreCase( aExt ) != STRING_NOTFOUND )
{
nDescr = i;
break;
}
}
}
pImpl->initInstance( (nDescr != -1) ? pDescrs[ nDescr ] : ::com::sun::star::plugin::PluginDescription(),
argn,
argv,
mode );
pImpl->createPeer( toolkit, parent );
Reference< ::com::sun::star::beans::XPropertySet > xProperty( pImpl->getModel(), UNO_QUERY );
if( xProperty.is() )
{
Any aAny;
aAny <<= url;
xProperty->setPropertyValue( ::rtl::OUString::createFromAscii( "URL" ), aAny );
}
if( ! pImpl->getPluginComm() )
{
pImpl->dispose();
xRef = NULL;
}
return xRef;
}
+391
View File
@@ -0,0 +1,391 @@
/*************************************************************************
*
* $RCSfile: multiplx.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning 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 <vos/diagnose.hxx>
#include <plugin/multiplx.hxx>
// ---------------------------------------------------------------------
// class MRCListenerMultiplexerHelper
// ---------------------------------------------------------------------
MRCListenerMultiplexerHelper::MRCListenerMultiplexerHelper
(
const Reference< ::com::sun::star::awt::XWindow > & rControl
, const Reference< ::com::sun::star::awt::XWindow > & rPeer
)
: aListenerHolder( aMutex )
, xPeer( rPeer )
, xControl( Reference< ::com::sun::star::awt::XControl >( rControl, UNO_QUERY ) )
{
}
void MRCListenerMultiplexerHelper::setPeer( const Reference< ::com::sun::star::awt::XWindow > & rPeer )
{
::osl::Guard< ::osl::Mutex > aGuard( aMutex );
if( xPeer != rPeer )
{
if( xPeer.is() )
{
// get all uiks from the listener added to the peer
Sequence<Type> aContainedTypes = aListenerHolder.getContainedTypes();
const Type* pArray = aContainedTypes.getConstArray();
sal_Int32 nCount = aContainedTypes.getLength();
// loop over all listener types and remove the listeners from the peer
for( sal_Int32 i = 0; i < nCount; i++ )
unadviseFromPeer( xPeer, pArray[i] );
}
xPeer = rPeer;
if( xPeer.is() )
{
// get all uiks from the listener added to the peer
Sequence<Type> aContainedTypes = aListenerHolder.getContainedTypes();
const Type * pArray = aContainedTypes.getConstArray();
sal_Int32 nCount = aContainedTypes.getLength();
// loop over all listener types and add the listeners to the peer
for( sal_Int32 i = 0; i < nCount; i++ )
adviseToPeer( xPeer, pArray[i] );
}
}
}
// MRCListenerMultiplexerHelper
void MRCListenerMultiplexerHelper::disposeAndClear()
{
::com::sun::star::lang::EventObject aEvt;
aEvt.Source = xControl;
aListenerHolder.disposeAndClear( aEvt );
}
// MRCListenerMultiplexerHelper
void MRCListenerMultiplexerHelper::adviseToPeer( const Reference< ::com::sun::star::awt::XWindow > & rPeer, const Type & type )
{
// add a listener to the source (peer)
if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XWindowListener >*)0) )
rPeer->addWindowListener( this );
else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XKeyListener >*)0) )
rPeer->addKeyListener( this );
else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XFocusListener >*)0) )
rPeer->addFocusListener( this );
else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XMouseListener >*)0) )
rPeer->addMouseListener( this );
else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XMouseMotionListener >*)0) )
rPeer->addMouseMotionListener( this );
else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XPaintListener >*)0) )
rPeer->addPaintListener( this );
else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XTopWindowListener >*)0) )
{
Reference< ::com::sun::star::awt::XTopWindow > xTop( rPeer, UNO_QUERY );
if( xTop.is() )
xTop->addTopWindowListener( this );
}
else
{
VOS_ENSHURE( sal_False, "unknown listener" );
}
}
// MRCListenerMultiplexerHelper
void MRCListenerMultiplexerHelper::unadviseFromPeer( const Reference< ::com::sun::star::awt::XWindow > & rPeer, const Type & type )
{
// the last listener is removed, remove the listener from the source (peer)
if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XWindowListener >*)0) )
rPeer->removeWindowListener( this );
else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XKeyListener >*)0) )
rPeer->removeKeyListener( this );
else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XFocusListener >*)0) )
rPeer->removeFocusListener( this );
else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XMouseListener >*)0) )
rPeer->removeMouseListener( this );
else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XMouseMotionListener >*)0) )
rPeer->removeMouseMotionListener( this );
else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XPaintListener >*)0) )
rPeer->removePaintListener( this );
else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XTopWindowListener >*)0) )
{
Reference< ::com::sun::star::awt::XTopWindow > xTop( rPeer, UNO_QUERY );
if( xTop.is() )
xTop->removeTopWindowListener( this );
}
else
{
VOS_ENSHURE( sal_False, "unknown listener" );
}
}
// MRCListenerMultiplexerHelper
void MRCListenerMultiplexerHelper::advise( const Type & type, const Reference< XInterface > & listener)
{
::osl::Guard< ::osl::Mutex > aGuard( aMutex );
if( 1 == aListenerHolder.addInterface( type, listener ) )
{
// the first listener is added
if( xPeer.is() )
adviseToPeer( xPeer, type );
}
}
// MRCListenerMultiplexerHelper
void MRCListenerMultiplexerHelper::unadvise(const Type & type, const Reference< XInterface > & listener)
{
::osl::Guard< ::osl::Mutex > aGuard( aMutex );
::cppu::OInterfaceContainerHelper * pCont = aListenerHolder.getContainer( type );
if( pCont )
{
if( 0 == pCont->removeInterface( listener ) && xPeer.is() )
// the last listener is removed
unadviseFromPeer( xPeer, type );
}
}
// ::com::sun::star::lang::XEventListener
void MRCListenerMultiplexerHelper::disposing(const ::com::sun::star::lang::EventObject& )
{
::osl::Guard< ::osl::Mutex > aGuard( aMutex );
// peer is disposed, clear the reference
xPeer = Reference< ::com::sun::star::awt::XWindow > ();
}
#define MULTIPLEX( InterfaceName, MethodName, EventName ) \
::cppu::OInterfaceContainerHelper * pCont; \
pCont = aListenerHolder.getContainer( ::getCppuType((const Reference< InterfaceName >*)0) ); \
if( pCont ) \
{ \
::cppu::OInterfaceIteratorHelper aIt( *pCont ); \
EventName aEvt = e; \
/* Remark: The control is the event source not the peer. We must change */ \
/* the source of the event */ \
aEvt.Source = xControl;\
/*.is the control not destroyed */ \
if( aEvt.Source.is() ) \
{ \
if( aIt.hasMoreElements() ) \
{ \
InterfaceName * pListener = (InterfaceName *)aIt.next(); \
try \
{ \
pListener->MethodName( aEvt ); \
} \
catch( RuntimeException& ) \
{ \
/* ignore all usr system exceptions from the listener */ \
} \
} \
} \
}
// ::com::sun::star::awt::XFocusListener
void MRCListenerMultiplexerHelper::focusGained(const ::com::sun::star::awt::FocusEvent& e)
{
/*
OInterfaceContainerHelper * pCont = aListenerHolder.getContainer( ::getCppuType((const Reference< ::com::sun::star::awt::XFocusListener >*)0) );
if( pCont )
{
OInterfaceIteratorHelper aIt( *pCont );
::com::sun::star::awt::FocusEvent aEvt = e;
// Reamark: The control is the event source not the peer. We must change
// the source of the event
xControl.queryHardRef( ((XInterface*)NULL)->getSmartUik(), aEvt.Source );
//.is the control not destroyed
if( aEvt.Source.is() )
{
if( aIt.hasMoreElements() )
{
::com::sun::star::awt::XFocusListener * pListener = (::com::sun::star::awt::XFocusListener *)aIt.next();
TRY
{
pListener->focusGained( aEvt );
}
CATCH( RuntimeException, e )
{
// ignore all usr system exceptions from the listener
}
END_CATCH;
}
}
}
*/
MULTIPLEX( ::com::sun::star::awt::XFocusListener, focusGained, ::com::sun::star::awt::FocusEvent )
}
// ::com::sun::star::awt::XFocusListener
void MRCListenerMultiplexerHelper::focusLost(const ::com::sun::star::awt::FocusEvent& e)
{
MULTIPLEX( ::com::sun::star::awt::XFocusListener, focusLost, ::com::sun::star::awt::FocusEvent )
}
// ::com::sun::star::awt::XWindowListener
void MRCListenerMultiplexerHelper::windowResized(const ::com::sun::star::awt::WindowEvent& e)
{
MULTIPLEX( ::com::sun::star::awt::XWindowListener, windowResized, ::com::sun::star::awt::WindowEvent )
}
// ::com::sun::star::awt::XWindowListener
void MRCListenerMultiplexerHelper::windowMoved(const ::com::sun::star::awt::WindowEvent& e)
{
MULTIPLEX( ::com::sun::star::awt::XWindowListener, windowMoved, ::com::sun::star::awt::WindowEvent )
}
// ::com::sun::star::awt::XWindowListener
void MRCListenerMultiplexerHelper::windowShown(const ::com::sun::star::lang::EventObject& e)
{
MULTIPLEX( ::com::sun::star::awt::XWindowListener, windowShown, ::com::sun::star::lang::EventObject )
}
// ::com::sun::star::awt::XWindowListener
void MRCListenerMultiplexerHelper::windowHidden(const ::com::sun::star::lang::EventObject& e)
{
MULTIPLEX( ::com::sun::star::awt::XWindowListener, windowHidden, ::com::sun::star::lang::EventObject )
}
// ::com::sun::star::awt::XKeyListener
void MRCListenerMultiplexerHelper::keyPressed(const ::com::sun::star::awt::KeyEvent& e)
{
MULTIPLEX( ::com::sun::star::awt::XKeyListener, keyPressed, ::com::sun::star::awt::KeyEvent )
}
// ::com::sun::star::awt::XKeyListener
void MRCListenerMultiplexerHelper::keyReleased(const ::com::sun::star::awt::KeyEvent& e)
{
MULTIPLEX( ::com::sun::star::awt::XKeyListener, keyReleased, ::com::sun::star::awt::KeyEvent )
}
// ::com::sun::star::awt::XMouseListener
void MRCListenerMultiplexerHelper::mousePressed(const ::com::sun::star::awt::MouseEvent& e)
{
MULTIPLEX( ::com::sun::star::awt::XMouseListener, mousePressed, ::com::sun::star::awt::MouseEvent )
}
// ::com::sun::star::awt::XMouseListener
void MRCListenerMultiplexerHelper::mouseReleased(const ::com::sun::star::awt::MouseEvent& e)
{
MULTIPLEX( ::com::sun::star::awt::XMouseListener, mouseReleased, ::com::sun::star::awt::MouseEvent )
}
// ::com::sun::star::awt::XMouseListener
void MRCListenerMultiplexerHelper::mouseEntered(const ::com::sun::star::awt::MouseEvent& e)
{
MULTIPLEX( ::com::sun::star::awt::XMouseListener, mouseEntered, ::com::sun::star::awt::MouseEvent )
}
// ::com::sun::star::awt::XMouseListener
void MRCListenerMultiplexerHelper::mouseExited(const ::com::sun::star::awt::MouseEvent& e)
{
MULTIPLEX( ::com::sun::star::awt::XMouseListener, mouseExited, ::com::sun::star::awt::MouseEvent )
}
// ::com::sun::star::awt::XMouseMotionListener
void MRCListenerMultiplexerHelper::mouseDragged(const ::com::sun::star::awt::MouseEvent& e)
{
MULTIPLEX( ::com::sun::star::awt::XMouseMotionListener, mouseDragged, ::com::sun::star::awt::MouseEvent )
}
// ::com::sun::star::awt::XMouseMotionListener
void MRCListenerMultiplexerHelper::mouseMoved(const ::com::sun::star::awt::MouseEvent& e)
{
MULTIPLEX( ::com::sun::star::awt::XMouseMotionListener, mouseMoved, ::com::sun::star::awt::MouseEvent )
}
// ::com::sun::star::awt::XPaintListener
void MRCListenerMultiplexerHelper::windowPaint(const ::com::sun::star::awt::PaintEvent& e)
{
MULTIPLEX( ::com::sun::star::awt::XPaintListener, windowPaint, ::com::sun::star::awt::PaintEvent )
}
// ::com::sun::star::awt::XTopWindowListener
void MRCListenerMultiplexerHelper::windowOpened(const ::com::sun::star::lang::EventObject& e)
{
MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowOpened, ::com::sun::star::lang::EventObject )
}
// ::com::sun::star::awt::XTopWindowListener
void MRCListenerMultiplexerHelper::windowClosing( const ::com::sun::star::lang::EventObject& e )
{
MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowClosing, ::com::sun::star::lang::EventObject )
}
// ::com::sun::star::awt::XTopWindowListener
void MRCListenerMultiplexerHelper::windowClosed( const ::com::sun::star::lang::EventObject& e )
{
MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowClosed, ::com::sun::star::lang::EventObject )
}
// ::com::sun::star::awt::XTopWindowListener
void MRCListenerMultiplexerHelper::windowMinimized( const ::com::sun::star::lang::EventObject& e )
{
MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowMinimized, ::com::sun::star::lang::EventObject )
}
// ::com::sun::star::awt::XTopWindowListener
void MRCListenerMultiplexerHelper::windowNormalized( const ::com::sun::star::lang::EventObject& e )
{
MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowNormalized, ::com::sun::star::lang::EventObject )
}
// ::com::sun::star::awt::XTopWindowListener
void MRCListenerMultiplexerHelper::windowActivated( const ::com::sun::star::lang::EventObject& e )
{
MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowActivated, ::com::sun::star::lang::EventObject )
}
// ::com::sun::star::awt::XTopWindowListener
void MRCListenerMultiplexerHelper::windowDeactivated( const ::com::sun::star::lang::EventObject& e )
{
MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowDeactivated, ::com::sun::star::lang::EventObject )
}
+576
View File
@@ -0,0 +1,576 @@
/*************************************************************************
*
* $RCSfile: nfuncs.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#if STLPORT_VERSION>=321
#include <cstdarg>
#endif
#include <stl/list>
#ifdef USE_NAMESPACE
using namespace std;
#endif
#include <plugin/impl.hxx>
// #define TRACE(x) DBG_ERROR( (x) )
#define TRACE(x)
NPNetscapeFuncs aNPNFuncs =
{
sizeof( NPNetscapeFuncs ),
(NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR,
NPN_GetURL,
NPN_PostURL,
NPN_RequestRead,
NPN_NewStream,
NPN_Write,
NPN_DestroyStream,
NPN_Status,
NPN_UserAgent,
NPN_MemAlloc,
NPN_MemFree,
NPN_MemFlush,
NPN_ReloadPlugins,
NPN_GetJavaEnv,
NPN_GetJavaPeer,
NPN_GetURLNotify,
NPN_PostURLNotify,
NPN_GetValue,
NPN_SetValue,
NPN_InvalidateRect,
NPN_InvalidateRegion,
NPN_ForceRedraw
};
static ::rtl::OString normalizeURL( XPlugin_Impl* plugin, const ::rtl::OString& url )
{
::rtl::OString aLoadURL;
if( url.indexOf( ":/" ) == -1 )
{
aLoadURL = ::rtl::OUStringToOString( plugin->getCreationURL(), plugin->getTextEncoding() );
int nPos;
if( ( nPos = aLoadURL.indexOf( "://" ) ) != -1 )
{
if( url.getLength() && url.getStr()[ 0 ] == '/' || url.indexOf( '/' ) != -1 )
{
// this means same server but new path
nPos = aLoadURL.indexOf( '/', nPos+3 );
if( nPos != -1 )
aLoadURL = aLoadURL.copy( 0, url.getStr()[0] == '/' ? nPos : nPos+1 );
}
else
{
// same server but new file
nPos = aLoadURL.lastIndexOf( '/' );
aLoadURL = aLoadURL.copy( 0, nPos+1 );
}
aLoadURL += url;
}
else
aLoadURL = url;
}
else
aLoadURL = url;
return aLoadURL;
}
extern "C" {
void* SAL_CALL NP_LOADDS NPN_MemAlloc( uint32 nBytes )
{
TRACE( "NPN_MemAlloc" );
void* pMem = malloc( nBytes );
return pMem;
}
void SAL_CALL NP_LOADDS NPN_MemFree( void* pMem )
{
TRACE( "NPN_MemFree" );
free( pMem );
}
uint32 SAL_CALL NP_LOADDS NPN_MemFlush( uint32 nSize )
{
TRACE( "NPN_MemFlush" );
return 0;
}
NPError SAL_CALL NP_LOADDS NPN_DestroyStream( NPP instance, NPStream* stream, NPError reason )
{
TRACE( "NPN_DestroyStream" );
XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
if( ! pImpl )
return NPERR_INVALID_INSTANCE_ERROR;
PluginStream* pStream = pImpl->getStreamFromNPStream( stream );
if( pStream )
delete pStream;
return NPERR_NO_ERROR;
}
const JRIEnvInterface** SAL_CALL NP_LOADDS NPN_GetJavaEnv()
{
TRACE( "NPN_GetJavaEnv" );
// no java in this program
return NULL;
}
void* SAL_CALL NP_LOADDS NPN_GetJavaPeer( NPP instance )
{
TRACE( "NPN_GetJavaPeer" );
return NULL;
}
NPError SAL_CALL NP_LOADDS NPN_GetURL( NPP instance, const char* url, const char* window )
{
TRACE( "NPN_GetURL" );
XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
if( ! pImpl )
return NPERR_INVALID_INSTANCE_ERROR;
::rtl::OString aLoadURL = normalizeURL( pImpl, url );
try
{
pImpl->enterPluginCallback();
pImpl->getPluginContext()->
getURL( pImpl,
::rtl::OStringToOUString( aLoadURL, pImpl->getTextEncoding() ),
::rtl::OStringToOUString( window, pImpl->getTextEncoding() )
);
pImpl->leavePluginCallback();
}
catch( ::com::sun::star::plugin::PluginException& e )
{
pImpl->leavePluginCallback();
return e.ErrorCode;
}
return NPERR_NO_ERROR;
}
NPError SAL_CALL NP_LOADDS NPN_GetURLNotify( NPP instance, const char* url, const char* target,
void* notifyData )
{
TRACE( "NPN_GetURLNotify" );
XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
if( ! pImpl )
return NPERR_INVALID_INSTANCE_ERROR;
::rtl::OString aLoadURL = normalizeURL( pImpl, url );
PluginEventListener* pListener =
new PluginEventListener( pImpl, url, aLoadURL.getStr(), notifyData );
if( ! target || ! *target )
{
// stream will be fed back to plugin,
// notify immediately after destruction of stream
pImpl->addPluginEventListener( pListener );
pListener = NULL;
}
try
{
pImpl->enterPluginCallback();
pImpl->getPluginContext()->
getURLNotify( pImpl,
::rtl::OStringToOUString( aLoadURL, pImpl->getTextEncoding() ),
::rtl::OStringToOUString( target, pImpl->getTextEncoding() ),
::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > ( pListener ) );
pImpl->leavePluginCallback();
}
catch( ::com::sun::star::plugin::PluginException& e )
{
pImpl->leavePluginCallback();
return e.ErrorCode;
}
return NPERR_NO_ERROR;
}
NPError SAL_CALL NP_LOADDS NPN_NewStream( NPP instance, NPMIMEType type, const char* target,
NPStream** stream )
// stream is a return value
{
TRACE( "NPN_NewStream" );
XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
if( ! pImpl )
return NPERR_INVALID_INSTANCE_ERROR;
PluginOutputStream* pStream = new PluginOutputStream( pImpl,
"", 0, 0 );
*stream = pStream->getStream();
try
{
pImpl->enterPluginCallback();
pImpl->getPluginContext()->
newStream(
pImpl,
::rtl::OStringToOUString( type, pImpl->getTextEncoding () ),
::rtl::OStringToOUString( target, pImpl->getTextEncoding() ),
::com::sun::star::uno::Reference< ::com::sun::star::io::XActiveDataSource > ( pStream->getOutputStream(), UNO_QUERY )
);
pImpl->leavePluginCallback();
}
catch( ::com::sun::star::plugin::PluginException& e )
{
pImpl->leavePluginCallback();
return e.ErrorCode;
}
return NPERR_NO_ERROR;
}
NPError SAL_CALL NP_LOADDS NPN_PostURLNotify( NPP instance, const char* url, const char* target, uint32 len, const char* buf, NPBool file, void* notifyData )
{
TRACE( "NPN_PostURLNotify" );
XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
if( ! pImpl )
return NPERR_INVALID_INSTANCE_ERROR;
::com::sun::star::uno::Sequence<sal_Int8> Bytes( (sal_Int8*)buf, len );
::rtl::OString aPostURL = normalizeURL( pImpl, url );
PluginEventListener* pListener =
new PluginEventListener( pImpl, url, aPostURL.getStr(), notifyData );
if( ! target || ! *target )
{
// stream will be fed back to plugin,
// notify immediately after destruction of stream
pImpl->addPluginEventListener( pListener );
pListener = NULL;
}
try
{
pImpl->enterPluginCallback();
pImpl->getPluginContext()->
postURLNotify( pImpl,
::rtl::OStringToOUString( aPostURL, pImpl->getTextEncoding() ),
::rtl::OStringToOUString( target, pImpl->getTextEncoding() ),
Bytes,
file,
::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > ( pListener ) );
pImpl->leavePluginCallback();
}
catch( ::com::sun::star::plugin::PluginException& e )
{
pImpl->leavePluginCallback();
return e.ErrorCode;
}
return NPERR_NO_ERROR;
}
NPError SAL_CALL NP_LOADDS NPN_PostURL( NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file )
{
TRACE( "NPN_PostURL" );
XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
if( ! pImpl )
return NPERR_INVALID_INSTANCE_ERROR;
::com::sun::star::uno::Sequence<sal_Int8> Bytes( (sal_Int8*)buf, len );
::rtl::OString aPostURL = normalizeURL( pImpl, url );
try
{
pImpl->enterPluginCallback();
pImpl->getPluginContext()->
postURL( pImpl,
::rtl::OStringToOUString( aPostURL, pImpl->getTextEncoding() ),
::rtl::OStringToOUString( window, pImpl->getTextEncoding () ),
Bytes,
file );
pImpl->leavePluginCallback();
}
catch( ::com::sun::star::plugin::PluginException& e )
{
pImpl->leavePluginCallback();
return e.ErrorCode;
}
return NPERR_NO_ERROR;
}
NPError SAL_CALL NP_LOADDS NPN_RequestRead( NPStream* stream, NPByteRange* rangeList )
{
TRACE( "NPN_RequestRead" );
if( ! rangeList )
return NPERR_NO_ERROR;
::std::list<XPlugin_Impl*>& rList = PluginManager::get().getPlugins();
::std::list<XPlugin_Impl*>::iterator iter;
XPlugin_Impl* pPlugin = NULL;
PluginStream* pStream = NULL;
for( iter = rList.begin(); iter!= rList.end(); ++iter )
if( ( pStream = (*iter)->getStreamFromNPStream( stream ) ) )
{
pPlugin = *iter;
break;
}
if( ! pPlugin )
return NPERR_INVALID_INSTANCE_ERROR;
if( ! pStream || pStream->getStreamType() != InputStream )
return NPERR_FILE_NOT_FOUND;
PluginInputStream* pInputStream = (PluginInputStream*)pStream;
sal_Int8* pBytes = NULL;
int nBytes = 0;
pPlugin->enterPluginCallback();
while( rangeList )
{
if( pBytes && nBytes < rangeList->length )
{
delete pBytes;
pBytes = NULL;
}
if( ! pBytes )
pBytes = new sal_Int8[ nBytes = rangeList->length ];
int nRead =
pInputStream->read( rangeList->offset, pBytes, rangeList->length );
int nPos = 0;
int nNow;
do
{
nNow = pPlugin->getPluginComm()->
NPP_WriteReady( pPlugin->getNPPInstance(),
stream );
pPlugin->getPluginComm()->
NPP_Write( pPlugin->getNPPInstance(),
stream,
rangeList->offset + nPos,
nNow,
pBytes+nPos );
nPos += nNow;
nRead -= nNow;
} while( nRead > 0 && nNow );
rangeList = rangeList->next;
}
pPlugin->leavePluginCallback();
return NPERR_NO_ERROR;
}
void SAL_CALL NP_LOADDS NPN_Status( NPP instance, const char* message )
{
TRACE( "NPN_Status" );
XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
if( ! pImpl )
return;
try
{
pImpl->enterPluginCallback();
pImpl->getPluginContext()->
displayStatusText( pImpl, ::rtl::OStringToOUString( message, pImpl->getTextEncoding() ) );
pImpl->leavePluginCallback();
}
catch( ::com::sun::star::plugin::PluginException& )
{
pImpl->leavePluginCallback();
return;
}
}
const char* SAL_CALL NP_LOADDS NPN_UserAgent( NPP instance )
{
TRACE( "NPN_UserAgent" );
static char* pAgent = strdup( "Mozilla" );
XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
if( ! pImpl )
return pAgent;
::rtl::OUString UserAgent;
try
{
pImpl->enterPluginCallback();
UserAgent = pImpl->getPluginContext()->
getUserAgent( pImpl );
pImpl->leavePluginCallback();
}
catch( ::com::sun::star::plugin::PluginException& )
{
pImpl->leavePluginCallback();
return pAgent;
}
if( pAgent )
free( pAgent );
pAgent = strdup( ::rtl::OUStringToOString( UserAgent, pImpl->getTextEncoding() ).getStr() );
return pAgent;
}
void SAL_CALL NP_LOADDS NPN_Version( int* major, int* minor, int* net_major, int* net_minor )
{
TRACE( "NPN_Version" );
*major = 4;
*minor = 0;
*net_major = 4;
*net_minor = 5;
}
int32 SAL_CALL NP_LOADDS NPN_Write( NPP instance, NPStream* stream, int32 len,
void* buffer )
{
TRACE( "NPN_Write" );
XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
if( ! pImpl )
return 0;
PluginStream* pStream = pImpl->getStreamFromNPStream( stream );
if( ! pStream || pStream->getStreamType() != OutputStream )
return 0;
pImpl->enterPluginCallback();
::com::sun::star::uno::Sequence<sal_Int8> Bytes( (sal_Int8*)buffer, len );
((PluginOutputStream*)pStream)->getOutputStream()->writeBytes( Bytes );
pImpl->leavePluginCallback();
return len;
}
NPError SAL_CALL NP_LOADDS NPN_GetValue( NPP instance, NPNVariable variable, void* value )
{
TRACE( "NPN_GetValue" );
XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
#ifdef UNX
// some special unix variables
XPlugin_Impl* pInstance = pImpl ? pImpl : XPluginManager_Impl::getFirstXPlugin();
if( ! pInstance )
return NULL;
switch( variable )
{
case NPNVxDisplay:
*((Display**)value) = pInstance->getAppDisplay();
#ifdef DEBUG
fprintf( stderr, "NPN_GetValue of display\n" );
#endif
return NPERR_NO_ERROR;
break;
case NPNVxtAppContext:
*((XtAppContext*)value) = pInstance->getAppContext();
#ifdef DEBUG
fprintf( stderr, "NPN_GetValue of application context\n" );
#endif
return NPERR_NO_ERROR;
}
#endif
if( ! pImpl )
return 0;
::rtl::OUString aValue;
try
{
pImpl->enterPluginCallback();
aValue = pImpl->getPluginContext()->
getValue( pImpl, (::com::sun::star::plugin::PluginVariable)variable );
pImpl->leavePluginCallback();
}
catch( ::com::sun::star::plugin::PluginException& e )
{
pImpl->leavePluginCallback();
return e.ErrorCode;
}
return NPERR_NO_ERROR;
}
void SAL_CALL NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages)
{
TRACE( "NPN_ReloadPlugins" );
}
NPError SAL_CALL NP_LOADDS NPN_SetValue(NPP instance, NPPVariable variable,
void *value)
{
TRACE( "NPN_SetValue" );
return 0;
}
void SAL_CALL NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect *invalidRect)
{
TRACE( "NPN_InvalidateRect" );
}
void SAL_CALL NP_LOADDS NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion)
{
TRACE( "NPN_InvalidateRegion" );
}
void SAL_CALL NP_LOADDS NPN_ForceRedraw(NPP instance)
{
TRACE( "NPN_ForceRedraw" );
}
}
+90
View File
@@ -0,0 +1,90 @@
/*************************************************************************
*
* $RCSfile: plcom.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning 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 SOLARIS
#include <limits>
#endif
#if STLPORT_VERSION>=321
#include <cstdarg>
#endif
#include <tools/fsys.hxx>
#include <plugin/impl.hxx>
PluginComm::PluginComm( const ::rtl::OString& rLibName ) :
m_nRefCount( 0 ),
m_aLibName( rLibName )
{
PluginManager::get().getPluginComms().push_back( this );
}
PluginComm::~PluginComm()
{
PluginManager::get().getPluginComms().remove( this );
while( m_aFilesToDelete.size() )
{
String aFile = m_aFilesToDelete.front();
m_aFilesToDelete.pop_front();
DirEntry aEntry( aFile );
aEntry.Kill();
}
}
+373
View File
@@ -0,0 +1,373 @@
/*************************************************************************
*
* $RCSfile: plctrl.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _COM_SUN_STAR_AWT_XADJUSTMENTLISTENER_HPP_
#include <com/sun/star/awt/XAdjustmentListener.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XACTIONLISTENER_HPP_
#include <com/sun/star/awt/XActionListener.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XTEXTLISTENER_HPP_
#include <com/sun/star/awt/XTextListener.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XSPINLISTENER_HPP_
#include <com/sun/star/awt/XSpinListener.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XITEMLISTENER_HPP_
#include <com/sun/star/awt/XItemListener.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINERLISTENER_HPP_
#include <com/sun/star/awt/XVclContainerListener.hpp>
#endif
#include <plugin/plctrl.hxx>
#include <vcl/syschild.hxx>
#include <toolkit/helper/vclunohelper.hxx>
//--------------------------------------------------------------------------------------------------
PluginControl_Impl::PluginControl_Impl() :
_pMultiplexer( NULL )
, _bVisible( sal_False )
, _bInDesignMode( sal_False )
, _bEnable( sal_True )
, _nX( 0 )
, _nY( 0 )
, _nWidth( 100 )
, _nHeight( 100 )
, _nFlags( WINDOW_POSSIZE_ALL )
{
}
//--------------------------------------------------------------------------------------------------
PluginControl_Impl::~PluginControl_Impl()
{
}
MRCListenerMultiplexerHelper* PluginControl_Impl::getMultiplexer()
{
if( ! _pMultiplexer )
_pMultiplexer = new MRCListenerMultiplexerHelper( this, _xPeerWindow );
return _pMultiplexer;
}
//==================================================================================================
Reference< XInterface > PluginControl_Impl_NewInstance()
{
return (::cppu::OWeakObject*)new PluginControl_Impl();
}
//--------------------------------------------------------------------------------------------------
void PluginControl_Impl::addEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l )
throw( RuntimeException )
{
_aDisposeListeners.push_back( l );
}
//---- ::com::sun::star::lang::XComponent ----------------------------------------------------------------------------------
void PluginControl_Impl::removeEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l )
throw( RuntimeException )
{
_aDisposeListeners.remove( l );
}
//---- ::com::sun::star::lang::XComponent ----------------------------------------------------------------------------------
void PluginControl_Impl::dispose(void)
throw( RuntimeException )
{
// send disposing events
::com::sun::star::lang::EventObject aEvt;
if( getMultiplexer() )
getMultiplexer()->disposeAndClear();
// release context
_xContext = Reference< XInterface > ();
releasePeer();
}
//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
void PluginControl_Impl::setPosSize( sal_Int32 nX_, sal_Int32 nY_, sal_Int32 nWidth_, sal_Int32 nHeight_, sal_Int16 nFlags )
throw( RuntimeException )
{
_nX = nX_ >=0 ? nX_ : 0;
_nY = nY_ >=0 ? nY_ : 0;
_nWidth = nWidth_ >=0 ? nWidth_ : 0;
_nHeight = nHeight_ >=0 ? nHeight_ : 0;
_nFlags = nFlags;
if (_xPeerWindow.is())
_xPeerWindow->setPosSize( _nX, _nY, _nWidth, _nHeight, nFlags );
}
//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
::com::sun::star::awt::Rectangle PluginControl_Impl::getPosSize(void)
throw( RuntimeException )
{
return _xPeerWindow->getPosSize();
}
//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
void PluginControl_Impl::setVisible( sal_Bool bVisible )
throw( RuntimeException )
{
_bVisible = bVisible;
if (_xPeerWindow.is())
_xPeerWindow->setVisible( _bVisible && !_bInDesignMode );
}
//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
void PluginControl_Impl::setEnable( sal_Bool bEnable )
throw( RuntimeException )
{
_bEnable = bEnable;
if (_xPeerWindow.is())
_xPeerWindow->setEnable( _bEnable );
}
//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
void PluginControl_Impl::setFocus(void) throw( RuntimeException )
{
if (_xPeerWindow.is())
_xPeerWindow->setFocus();
}
//--------------------------------------------------------------------------------------------------
void PluginControl_Impl::releasePeer()
{
if (_xPeer.is())
{
_xParentWindow->removeFocusListener( this );
_xPeerWindow->dispose();
_pSysChild = NULL;
_xPeerWindow = Reference< ::com::sun::star::awt::XWindow > ();
_xPeer = Reference< ::com::sun::star::awt::XWindowPeer > ();
getMultiplexer()->setPeer( Reference< ::com::sun::star::awt::XWindow > () );
}
}
//---- ::com::sun::star::awt::XControl ------------------------------------------------------------------------------------
void PluginControl_Impl::createPeer( const Reference< ::com::sun::star::awt::XToolkit > & xToolkit, const Reference< ::com::sun::star::awt::XWindowPeer > & xParentPeer )
throw( RuntimeException )
{
if (_xPeer.is())
{
DBG_ERROR( "### Peer is already set!" );
return;
}
_xParentPeer = xParentPeer;
_xParentWindow = Reference< ::com::sun::star::awt::XWindow > ( xParentPeer, UNO_QUERY );
DBG_ASSERT( _xParentWindow.is(), "### no parent peer window!" );
Window* pImpl = VCLUnoHelper::GetWindow( xParentPeer );
if (pImpl)
{
_pSysChild = new SystemChildWindow( pImpl, WB_CLIPCHILDREN );
// _pSysChild->Show();
if (pImpl->HasFocus())
_pSysChild->GrabFocus();
// get peer
_xPeer = Reference< ::com::sun::star::awt::XWindowPeer > ( _pSysChild->GetComponentInterface() );
_xPeerWindow = Reference< ::com::sun::star::awt::XWindow > ( _xPeer, UNO_QUERY );
// !_BOTH_ MUST BE VALID!
DBG_ASSERT( (_xPeer.is() && _xPeerWindow.is()), "### no peer!" );
_xParentWindow->addFocusListener( this );
_xPeerWindow->setPosSize( _nX, _nY, _nWidth, _nHeight, _nFlags );
_xPeerWindow->setEnable( _bEnable );
_xPeerWindow->setVisible( _bVisible && !_bInDesignMode );
}
else
{
DBG_ERROR( "### cannot get implementation of parent peer!" );
}
getMultiplexer()->setPeer( _xPeerWindow );
}
//---- ::com::sun::star::awt::XControl ------------------------------------------------------------------------------------
void PluginControl_Impl::setDesignMode( sal_Bool bOn )
throw( RuntimeException )
{
_bInDesignMode = bOn;
if (_xPeerWindow.is())
_xPeerWindow->setVisible( _bVisible && !_bInDesignMode );
}
//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
void PluginControl_Impl::addPaintListener( const Reference< ::com::sun::star::awt::XPaintListener > & l )
throw( RuntimeException )
{
getMultiplexer()->advise( ::getCppuType((const Reference< ::com::sun::star::awt::XPaintListener >*)0), l );
}
//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
void PluginControl_Impl::removePaintListener( const Reference< ::com::sun::star::awt::XPaintListener > & l )
throw( RuntimeException )
{
getMultiplexer()->unadvise( ::getCppuType((const Reference< ::com::sun::star::awt::XPaintListener >*)0), l );
}
//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
void PluginControl_Impl::addWindowListener( const Reference< ::com::sun::star::awt::XWindowListener > & l )
throw( RuntimeException )
{
getMultiplexer()->advise( ::getCppuType((const Reference< ::com::sun::star::awt::XWindowListener >*)0), l );
}
//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
void PluginControl_Impl::removeWindowListener( const Reference< ::com::sun::star::awt::XWindowListener > & l )
throw( RuntimeException )
{
getMultiplexer()->unadvise( ::getCppuType((const Reference< ::com::sun::star::awt::XWindowListener >*)0), l );
}
//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
void PluginControl_Impl::addFocusListener( const Reference< ::com::sun::star::awt::XFocusListener > & l )
throw( RuntimeException )
{
getMultiplexer()->advise( ::getCppuType((const Reference< ::com::sun::star::awt::XFocusListener >*)0), l );
}
//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
void PluginControl_Impl::removeFocusListener( const Reference< ::com::sun::star::awt::XFocusListener > & l )
throw( RuntimeException )
{
getMultiplexer()->unadvise( ::getCppuType((const Reference< ::com::sun::star::awt::XFocusListener >*)0), l );
}
//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
void PluginControl_Impl::addKeyListener( const Reference< ::com::sun::star::awt::XKeyListener > & l )
throw( RuntimeException )
{
getMultiplexer()->advise( ::getCppuType((const Reference< ::com::sun::star::awt::XKeyListener >*)0), l );
}
//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
void PluginControl_Impl::removeKeyListener( const Reference< ::com::sun::star::awt::XKeyListener > & l )
throw( RuntimeException )
{
getMultiplexer()->unadvise( ::getCppuType((const Reference< ::com::sun::star::awt::XKeyListener >*)0), l );
}
//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
void PluginControl_Impl::addMouseListener( const Reference< ::com::sun::star::awt::XMouseListener > & l )
throw( RuntimeException )
{
getMultiplexer()->advise( ::getCppuType((const Reference< ::com::sun::star::awt::XMouseListener >*)0), l );
}
//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
void PluginControl_Impl::removeMouseListener( const Reference< ::com::sun::star::awt::XMouseListener > & l )
throw( RuntimeException )
{
getMultiplexer()->unadvise( ::getCppuType((const Reference< ::com::sun::star::awt::XMouseListener >*)0), l );
}
//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
void PluginControl_Impl::addMouseMotionListener( const Reference< ::com::sun::star::awt::XMouseMotionListener > & l )
throw( RuntimeException )
{
getMultiplexer()->advise( ::getCppuType((const Reference< ::com::sun::star::awt::XMouseMotionListener >*)0), l );
}
//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
void PluginControl_Impl::removeMouseMotionListener( const Reference< ::com::sun::star::awt::XMouseMotionListener > & l )
throw( RuntimeException )
{
getMultiplexer()->unadvise( ::getCppuType((const Reference< ::com::sun::star::awt::XMouseMotionListener >*)0), l );
}
//---- ::com::sun::star::awt::XView ---------------------------------------------------------------------------------------
void PluginControl_Impl::draw( sal_Int32 x, sal_Int32 y )
throw( RuntimeException )
{
// has to be done by further implementation of control
}
//---- ::com::sun::star::awt::XView ---------------------------------------------------------------------------------------
void PluginControl_Impl::setZoom( float ZoomX, float ZoomY )
throw( RuntimeException )
{
// has to be done by further implementation of control
}
//---- ::com::sun::star::lang::XEventListener ------------------------------------------------------------------------------
void PluginControl_Impl::disposing( const ::com::sun::star::lang::EventObject & rSource )
throw( RuntimeException )
{
}
//---- ::com::sun::star::awt::XFocusListener ------------------------------------------------------------------------------
void PluginControl_Impl::focusGained( const ::com::sun::star::awt::FocusEvent & rEvt )
throw( RuntimeException )
{
if (_xPeerWindow.is())
_xPeerWindow->setFocus();
}
//---- ::com::sun::star::awt::XFocusListener ------------------------------------------------------------------------------
void PluginControl_Impl::focusLost( const ::com::sun::star::awt::FocusEvent & rEvt )
throw( RuntimeException )
{
}
+243
View File
@@ -0,0 +1,243 @@
/*************************************************************************
*
* $RCSfile: plmodel.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning 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 <plugin/model.hxx>
#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
#include <com/sun/star/beans/PropertyAttribute.hpp>
#endif
using namespace com::sun::star::uno;
//==================================================================================================
Reference< XInterface > SAL_CALL PluginModel_CreateInstance( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & ) throw( Exception )
{
Reference< XInterface > xService = *new PluginModel();
return xService;
}
Any PluginModel::queryAggregation( const Type& type )
{
Any aRet( ::cppu::queryInterface( type,
static_cast< ::com::sun::star::lang::XComponent* >(this),
static_cast< ::com::sun::star::io::XPersistObject* >(this ),
static_cast< ::com::sun::star::awt::XControlModel* >(this),
static_cast< ::com::sun::star::beans::XPropertySet* >(this),
static_cast< ::com::sun::star::beans::XMultiPropertySet* >(this),
static_cast< ::com::sun::star::beans::XFastPropertySet* >(this)
) );
return aRet.hasValue() ? aRet : OWeakAggObject::queryAggregation( type );
}
// ::com::sun::star::lang::XServiceInfo
::rtl::OUString PluginModel::getImplementationName() throw( )
{
return getImplementationName_Static();
}
// ::com::sun::star::lang::XServiceInfo
sal_Bool PluginModel::supportsService(const ::rtl::OUString& ServiceName) throw( )
{
Sequence< ::rtl::OUString > aSNL = getSupportedServiceNames();
const ::rtl::OUString * pArray = aSNL.getConstArray();
for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
if( pArray[i] == ServiceName )
return sal_True;
return sal_False;
}
// ::com::sun::star::lang::XServiceInfo
Sequence< ::rtl::OUString > PluginModel::getSupportedServiceNames(void) throw( )
{
return getSupportedServiceNames_Static();
}
// XPluginManager_Impl
Sequence< ::rtl::OUString > PluginModel::getSupportedServiceNames_Static(void) throw( )
{
Sequence< ::rtl::OUString > aSNS( 1 );
aSNS.getArray()[0] = ::rtl::OUString::createFromAscii( "com.sun.star.plugin.PluginModel" );
return aSNS;
}
static char* aCreationURL = "URL";
static ::osl::Mutex aPropertyMutex;
static ::com::sun::star::beans::Property aProps[] =
{
::com::sun::star::beans::Property(
::rtl::OUString::createFromAscii( aCreationURL ),
-1,
::getCppuType((const ::rtl::OUString*)0),
::com::sun::star::beans::PropertyAttribute::BOUND )
};
PluginModel::PluginModel() :
BroadcasterHelperHolder( aPropertyMutex ),
OPropertySetHelper( m_aHelper ),
OPropertyArrayHelper( aProps, 1 )
{
}
PluginModel::PluginModel(const ::rtl::OUString& rURL) :
BroadcasterHelperHolder( aPropertyMutex ),
OPropertySetHelper( m_aHelper ),
OPropertyArrayHelper( aProps, 1 ),
m_aCreationURL( rURL )
{
}
PluginModel::~PluginModel()
{
}
Reference< ::com::sun::star::beans::XPropertySetInfo > PluginModel::getPropertySetInfo()
{
static Reference< ::com::sun::star::beans::XPropertySetInfo > aInfo =
createPropertySetInfo( *this );
return aInfo;
}
::cppu::IPropertyArrayHelper& PluginModel::getInfoHelper()
{
return *this;
}
sal_Bool PluginModel::convertFastPropertyValue( Any & rConvertedValue,
Any & rOldValue,
sal_Int32 nHandle,
const Any& rValue )
{
if( rValue.getValueTypeClass() == typelib_TypeClass_STRING )
{
rConvertedValue = rValue;
rOldValue <<= m_aCreationURL;
return sal_True;
}
return sal_False;
}
void PluginModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle,
const Any& rValue )
throw( ::com::sun::star::lang::IllegalArgumentException )
{
if( rValue.getValueTypeClass() == typelib_TypeClass_STRING )
{
rValue >>= m_aCreationURL;
}
else
throw ::com::sun::star::lang::IllegalArgumentException();
}
void PluginModel::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
{
rValue <<= m_aCreationURL;
}
//---- ::com::sun::star::lang::XComponent ----------------------------------------------------------------------------------
void PluginModel::addEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l )
{
m_aDisposeListeners.push_back( l );
}
//---- ::com::sun::star::lang::XComponent ----------------------------------------------------------------------------------
void PluginModel::removeEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l )
{
m_aDisposeListeners.remove( l );
}
//---- ::com::sun::star::lang::XComponent ----------------------------------------------------------------------------------
void PluginModel::dispose(void)
{
// send disposing events
::com::sun::star::lang::EventObject aEvt;
aEvt.Source = (::cppu::OWeakObject*)this;
::std::list< Reference< ::com::sun::star::lang::XEventListener > > aLocalListeners = m_aDisposeListeners;
for( ::std::list< Reference< ::com::sun::star::lang::XEventListener > >::iterator it = aLocalListeners.begin();
it != aLocalListeners.end(); ++it )
(*it)->disposing( aEvt );
m_aDisposeListeners.clear();
disposing();
}
// ::com::sun::star::io::XPersistObject
::rtl::OUString PluginModel::getServiceName()
{
return ::rtl::OUString::createFromAscii( "com.sun.star.plugin.PluginModel" );
}
void PluginModel::write(const Reference< ::com::sun::star::io::XObjectOutputStream > & OutStream)
{
OutStream->writeUTF( m_aCreationURL );
}
void PluginModel::read(const Reference< ::com::sun::star::io::XObjectInputStream > & InStream)
{
m_aCreationURL = InStream->readUTF();
}
+206
View File
@@ -0,0 +1,206 @@
/*************************************************************************
*
* $RCSfile: service.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#if STLPORT_VERSION>=321
#include <cstdarg>
#endif
#include <plugin/impl.hxx>
#include <tools/debug.hxx>
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XSET_HPP_
#include <com/sun/star/container/XSet.hpp>
#endif
#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_
#include <com/sun/star/registry/XRegistryKey.hpp>
#endif
#include <uno/dispatcher.h> // declaration of generic uno interface
#include <uno/mapping.hxx> // mapping stuff
#include <cppuhelper/factory.hxx>
using namespace cppu;
//==================================================================================================
void registerPluginService( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & xMgr )
{
if (! xMgr.is())
return;
Reference< ::com::sun::star::container::XSet > xReg( xMgr, UNO_QUERY );
if(xReg.is())
{
Any aAny;
Reference< ::com::sun::star::lang::XSingleServiceFactory > xF;
xF = createSingleFactory( xMgr, PluginModel::getImplementationName_Static(),
PluginModel_CreateInstance,
PluginModel::getSupportedServiceNames_Static() );
aAny <<= xF;
xReg->insert( aAny );
xF = createSingleFactory( xMgr, XPluginManager_Impl::getImplementationName_Static(),
PluginManager_CreateInstance,
XPluginManager_Impl::getSupportedServiceNames_Static() );
aAny <<= xF;
xReg->insert( aAny );
}
}
extern "C" {
void SAL_CALL component_getImplementationEnvironment(
const sal_Char** ppEnvTypeName,
uno_Environment** ppEnv )
{
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pXUnoKey )
{
if( pXUnoKey )
{
try
{
Reference< ::com::sun::star::registry::XRegistryKey > xKey( reinterpret_cast< ::com::sun::star::registry::XRegistryKey* >( pXUnoKey ) );
::rtl::OUString aImplName = ::rtl::OUString::createFromAscii( "/" );
aImplName += XPluginManager_Impl::getImplementationName_Static();
aImplName += ::rtl::OUString::createFromAscii( "/UNO/SERVICES/com.sun.star.plugin.PluginManager" );
xKey->createKey( aImplName );
aImplName = ::rtl::OUString::createFromAscii( "/" );
aImplName += PluginModel::getImplementationName_Static();
aImplName += ::rtl::OUString::createFromAscii( "/UNO/SERVICES/com.sun.star.plugin.PluginModel" );
xKey->createKey( aImplName );
return sal_True;
}
catch( ::com::sun::star::registry::InvalidRegistryException& )
{
}
}
return sal_False;
}
void* SAL_CALL component_getFactory(
const sal_Char* pImplementationName,
void* pXUnoSMgr,
void* pXUnoKey
)
{
void* pRet = 0;
::rtl::OUString aImplName( ::rtl::OUString::createFromAscii( pImplementationName ) );
if( pXUnoSMgr )
{
Reference< ::com::sun::star::lang::XMultiServiceFactory > xMgr(
reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >( pXUnoSMgr )
);
Reference< ::com::sun::star::lang::XSingleServiceFactory > xFactory;
if( aImplName.equals( XPluginManager_Impl::getImplementationName_Static() ) )
{
xFactory = ::cppu::createSingleFactory(
xMgr, aImplName, PluginManager_CreateInstance,
XPluginManager_Impl::getSupportedServiceNames_Static() );
}
else if( aImplName.equals( PluginModel::getImplementationName_Static() ) )
{
xFactory = ::cppu::createSingleFactory(
xMgr, aImplName, PluginModel_CreateInstance,
PluginModel::getSupportedServiceNames_Static() );
}
if( xFactory.is() )
{
xFactory->acquire();
pRet = xFactory.get();
}
}
return pRet;
}
/** special registration procedure for the staroffice player */
void SAL_CALL exService_getSmartFactory( const sal_Char* implementationName, const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr, Reference< ::com::sun::star::lang::XSingleServiceFactory > & xFactory )
{
::rtl::OUString aImplementationName( ::rtl::OUString::createFromAscii(implementationName));
if (aImplementationName == PluginModel::getImplementationName_Static() )
{
xFactory = createSingleFactory( rSMgr, aImplementationName,
PluginModel_CreateInstance,
PluginModel::getSupportedServiceNames_Static() );
}
else if (aImplementationName == XPluginManager_Impl::getImplementationName_Static() )
{
xFactory = createSingleFactory( rSMgr, aImplementationName,
PluginManager_CreateInstance,
XPluginManager_Impl::getSupportedServiceNames_Static() );
}
}
} /* extern "C" */
+888
View File
@@ -0,0 +1,888 @@
/*************************************************************************
*
* $RCSfile: xplugin.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning 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 <string> // workaround for SUNPRO workshop include conflicts
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_LOADER_XIMPLEMENTATIONLOADER_HPP_
#include <com/sun/star/loader/XImplementationLoader.hpp>
#endif
#ifndef _COM_SUN_STAR_LOADER_CANNOTACTIVATEFACTORYEXCEPTION_HPP_
#include <com/sun/star/loader/CannotActivateFactoryException.hpp>
#endif
#include <plugin/impl.hxx>
#include <tools/fsys.hxx>
#include <tools/urlobj.hxx>
#include <tools/string.hxx>
#include <vcl/svapp.hxx>
#include <vos/timer.hxx>
#if STLPORT_VERSION>=321
#include <cstdarg>
#endif
class PluginDisposer : public ::vos::OTimer
{
private:
XPlugin_Impl* m_pPlugin;
virtual void SAL_CALL onShot();
public:
PluginDisposer( XPlugin_Impl* pPlugin ) :
OTimer( ::vos::TTimeValue( 2, 0 ),
::vos::TTimeValue( 2, 0 ) ),
m_pPlugin( pPlugin )
{ start(); }
~PluginDisposer() {}
};
void PluginDisposer::onShot()
{
if( m_pPlugin )
{
if( m_pPlugin->isDisposable() )
{
sal_uInt32 nEvent;
Application::PostUserEvent( nEvent, LINK( m_pPlugin, XPlugin_Impl, secondLevelDispose ), (void*)m_pPlugin );
}
}
else
release();
}
//==================================================================================================
//==================================================================================================
// const Reference< ::com::sun::star::reflection::XIdlClass > & XPlugin_Impl::staticGetIdlClass()
// {
// static Reference< ::com::sun::star::reflection::XIdlClass > aClass = createStandardClass( L"Plugin",
// OWeakAggObject::getStaticIdlClass(), 6,
// ::getCppuType((const ::com::sun::star::awt::XControl*)0),
// ::getCppuType((const ::com::sun::star::awt::XControlModel*)0),
// ::getCppuType((const ::com::sun::star::awt::XWindow*)0),
// ::getCppuType((const ::com::sun::star::lang::XComponent*)0),
// ::getCppuType((const ::com::sun::star::awt::XView*)0),
// ::getCppuType((const ::com::sun::star::plugin::XPlugin*)0) );
// return aClass;
// }
Any XPlugin_Impl::queryInterface( const Type& type )
{
return OWeakAggObject::queryInterface( type );
}
Any XPlugin_Impl::queryAggregation( const Type& type )
{
Any aRet( ::cppu::queryInterface( type, static_cast< ::com::sun::star::plugin::XPlugin* >(this) ) );
if( ! aRet.hasValue() )
aRet = PluginControl_Impl::queryAggregation( type );
return aRet;
}
XPlugin_Impl::XPlugin_Impl( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr) :
m_xSMgr( rSMgr ),
PluginControl_Impl(),
m_pPluginComm( NULL ),
m_pArgn( NULL ),
m_pArgv( NULL ),
m_nArgs( 0 ),
m_aPluginMode( NP_FULL ),
m_nProvidingState( PROVIDING_NONE ),
m_nCalledFromPlugin( 0 ),
m_pDisposer( NULL ),
m_bIsDisposed( sal_False ),
m_aEncoding( gsl_getSystemTextEncoding() )
{
memset( &m_aInstance, 0, sizeof( m_aInstance ) );
memset( &m_aNPWindow, 0, sizeof( m_aNPWindow ) );
#ifdef UNX
m_aAppContext = NULL;
m_pDisplay = NULL;
memset( &m_aWSInfo, 0, sizeof( m_aWSInfo ) );
#endif
m_xModel = new PluginModel();
Reference< ::com::sun::star::beans::XPropertySet > xPS( m_xModel, UNO_QUERY );
xPS->addPropertyChangeListener( ::rtl::OUString(), this );
::osl::Guard< ::osl::Mutex > aGuard( PluginManager::get().getPluginMutex() );
PluginManager::get().getPlugins().push_back( this );
}
void XPlugin_Impl::destroyInstance()
{
NPSavedData* pSavedData = NULL;
destroyStreams();
if( getPluginComm() )
{
getPluginComm()->NPP_Destroy( getNPPInstance(),
&pSavedData );
getPluginComm()->decRef();
m_pPluginComm = NULL;
}
if( m_nArgs > 0 )
{
for( ; m_nArgs--; )
{
free( (void*)m_pArgn[m_nArgs] );
free( (void*)m_pArgv[m_nArgs] );
}
delete m_pArgn;
delete m_pArgv;
}
while( m_aPEventListeners.size() )
{
delete *m_aPEventListeners.begin();
m_aPEventListeners.pop_front();
}
}
XPlugin_Impl::~XPlugin_Impl()
{
destroyInstance();
}
void XPlugin_Impl::checkListeners( const char* normalizedURL )
{
if( ! normalizedURL )
return;
::std::list<PluginEventListener*>::iterator iter;
for( iter = m_aPEventListeners.begin();
iter != m_aPEventListeners.end();
++iter )
{
if( ! strcmp( normalizedURL, (*iter)->getURL() ) ||
! strcmp( normalizedURL, (*iter)->getNormalizedURL() ) )
{
(*iter)->disposing( ::com::sun::star::lang::EventObject() );
delete *iter;
m_aPEventListeners.remove( *iter );
return;
}
}
}
IMPL_LINK( XPlugin_Impl, secondLevelDispose, XPlugin_Impl*, pThis )
{
// may have become undisposable between PostUserEvent and here
// or may have disposed and receive a second UserEvent
::std::list<XPlugin_Impl*>& rList = PluginManager::get().getPlugins();
::std::list<XPlugin_Impl*>::iterator iter;
{
::osl::Guard< ::osl::Mutex > aGuard( PluginManager::get().getPluginMutex() );
for( iter = rList.begin(); iter != rList.end(); ++iter )
{
if( *iter == this )
break;
}
if( iter == rList.end() || ! isDisposable() )
return 0;
}
if (m_pDisposer)
{
m_pDisposer->release();
m_pDisposer = NULL;
}
Reference< ::com::sun::star::plugin::XPlugin > xProtection( this );
Reference< ::com::sun::star::beans::XPropertySet > xPS( m_xModel, UNO_QUERY );
xPS->removePropertyChangeListener( ::rtl::OUString(), this );
{
::osl::Guard< ::osl::Mutex > aGuard( PluginManager::get().getPluginMutex() );
rList.remove( this );
}
m_aNPWindow.window = NULL;
#ifndef UNX
// acrobat does an unconditional XtParent on the windows widget
getPluginComm()->
NPP_SetWindow( getNPPInstance(), &m_aNPWindow );
#endif
destroyInstance();
PluginControl_Impl::dispose();
return 0;
}
void XPlugin_Impl::dispose()
{
if (m_bIsDisposed || !getPluginComm())
return;
m_bIsDisposed = sal_True;
if( isDisposable() )
secondLevelDispose( this );
else
{
m_pDisposer = new PluginDisposer( this );
m_pDisposer->acquire();
}
}
void XPlugin_Impl::initInstance( const ::com::sun::star::plugin::PluginDescription& rDescription,
const Sequence< ::rtl::OUString >& argn,
const Sequence< ::rtl::OUString >& argv,
sal_Int16 mode )
{
m_aDescription = rDescription;
// #69333# special for pdf
m_aPluginMode = mode;
if( m_aDescription.Mimetype.compareToAscii( "application/pdf" ) )
m_aPluginMode = ::com::sun::star::plugin::PluginMode::FULL;
m_nArgs = argn.getLength();
m_pArgn = new const char*[m_nArgs];
m_pArgv = new const char*[m_nArgs];
const ::rtl::OUString* pUArgn = argn.getConstArray();
const ::rtl::OUString* pUArgv = argv.getConstArray();
for( int i = 0; i < m_nArgs; i++ )
{
m_pArgn[i] = strdup(
::rtl::OUStringToOString( pUArgn[i], m_aEncoding ).getStr()
);
m_pArgv[i] = strdup(
::rtl::OUStringToOString( pUArgv[i], m_aEncoding ).getStr()
);
}
}
void XPlugin_Impl::modelChanged()
{
m_nProvidingState = PROVIDING_MODEL_UPDATE;
// empty description is only set when created by createPluginFromURL
if( m_aDescription.Mimetype.getLength() )
destroyInstance();
Reference< ::com::sun::star::plugin::XPluginManager > xPMgr( m_xSMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.plugin.PluginManager" ) ), UNO_QUERY );
if( !xPMgr.is() )
{
m_nProvidingState = PROVIDING_NONE;
return;
}
int nDescr = -1;
Sequence< ::com::sun::star::plugin::PluginDescription > aDescrs = xPMgr->getPluginDescriptions();
const ::com::sun::star::plugin::PluginDescription* pDescrs = aDescrs.getConstArray();
::rtl::OUString aURL = getCreationURL();
int nPos = aURL.lastIndexOf( (sal_Unicode)'.' );
::rtl::OUString aExt = aURL.copy( nPos ).toLowerCase();
if( nPos != -1 )
{
for( int i = 0; i < aDescrs.getLength(); i++ )
{
::rtl::OUString aThisExt = pDescrs[ i ].Extension.toLowerCase();
if( aThisExt.indexOf( aExt ) != -1 )
{
nDescr = i;
break;
}
}
}
if( nDescr != -1 )
{
INetURLObject aURL;
aURL.SetSmartProtocol( INET_PROT_FILE );
aURL.SetSmartURL( ::rtl::OUStringToOString( getCreationURL(), m_aEncoding ) );
Reference< ::com::sun::star::lang::XMultiServiceFactory > xFact( m_xSMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.DataSourceFactory" ) ), UNO_QUERY );
if ( xFact.is() )
{
Sequence < Any > aArgs(1);
aArgs.getArray()[0] <<= ::rtl::OUString( aURL.GetMainURL() );
::rtl::OUString aProt( INetURLObject::GetScheme( aURL.GetProtocol() ) );
Reference< ::com::sun::star::io::XActiveDataSource > xSource( xFact->createInstanceWithArguments( aProt, aArgs ), UNO_QUERY );
if ( xSource.is() )
{
m_aDescription = pDescrs[ nDescr ];
provideNewStream( m_aDescription.Mimetype,
xSource,
getRefererURL(),
0, 0, sal_False );
}
}
}
m_nProvidingState = PROVIDING_NONE;
}
::rtl::OUString XPlugin_Impl::getCreationURL()
{
::rtl::OUString aRet;
Reference< ::com::sun::star::beans::XPropertySet > xPS( m_xModel, UNO_QUERY );
if( xPS.is() )
{
Any aValue = xPS->getPropertyValue( ::rtl::OUString::createFromAscii( "URL" ) );
aValue >>= aRet;
}
return aRet;
}
sal_Bool XPlugin_Impl::setModel( const Reference< ::com::sun::star::awt::XControlModel > & Model )
throw( RuntimeException )
{
Reference< ::com::sun::star::beans::XPropertySet > xPS( Model, UNO_QUERY );
if( ! xPS.is() )
return sal_False;
if( getCreationURL().getLength() )
{
m_xModel = Model;
modelChanged();
xPS->addPropertyChangeListener( ::rtl::OUString(), this );
return sal_True;
}
return sal_False;
}
void XPlugin_Impl::createPeer( const Reference< ::com::sun::star::awt::XToolkit > & xToolkit, const Reference< ::com::sun::star::awt::XWindowPeer > & Parent )
throw( RuntimeException )
{
if( ! _xPeer.is() )
{
if( ! Parent.is() )
throw RuntimeException();
PluginControl_Impl::createPeer( xToolkit, Parent );
}
}
void XPlugin_Impl::loadPlugin()
{
::std::list<PluginComm*>::iterator iter;
for( iter = PluginManager::get().getPluginComms().begin();
iter != PluginManager::get().getPluginComms().end(); ++iter )
{
if( ::rtl::OStringToOUString( (*iter)->getLibName(), m_aEncoding ) == m_aDescription.PluginName )
{
setPluginComm( *iter );
break;
}
}
const SystemEnvData* pEnvData = getSysChildSysData();
#ifdef UNX
XSync( (Display*)pEnvData->pDisplay, False );
#endif
if( ! getPluginComm() )
{
#ifdef UNX
m_pDisplay = (Display*)pEnvData->pDisplay;
m_aAppContext = (XtAppContext)pEnvData->pAppContext;
// need a new PluginComm
PluginComm* pComm = new UnxPluginComm( ::rtl::OUStringToOString( m_aDescription.PluginName, gsl_getSystemTextEncoding() ) );
#elif (defined WNT || defined OS2)
PluginComm* pComm = new PluginComm_Impl( m_aDescription.Mimetype,
m_aDescription.PluginName,
(HWND)pEnvData->hWnd );
#endif
setPluginComm( pComm );
}
NPError aError = getPluginComm()->
NPP_New( (char*)::rtl::OUStringToOString( m_aDescription.Mimetype,
m_aEncoding).getStr(),
getNPPInstance(),
m_aPluginMode,
m_nArgs,
(char**)(m_nArgs ? m_pArgn : NULL),
(char**)(m_nArgs ? m_pArgv : NULL),
NULL );
#ifdef UNX
XSync( (Display*)pEnvData->pDisplay, False );
#endif
#ifdef UNX
m_aNPWindow.window = (void*)pEnvData->aWindow;
m_aNPWindow.ws_info = &m_aWSInfo;
m_aWSInfo.type = NP_SETWINDOW;
m_aWSInfo.display = (Display*)pEnvData->pDisplay;
m_aWSInfo.visual = (Visual*)pEnvData->pVisual;
m_aWSInfo.colormap = (Colormap)pEnvData->aColormap;
m_aWSInfo.depth = pEnvData->nDepth;
#else
m_aNPWindow.window = (void*)pEnvData->hWnd;
#endif
::com::sun::star::awt::Rectangle aPosSize = getPosSize();
m_aNPWindow.clipRect.top = 0;
m_aNPWindow.clipRect.left = 0;
m_aNPWindow.clipRect.bottom = 0;
m_aNPWindow.clipRect.right = 0;
m_aNPWindow.type = NPWindowTypeWindow;
m_aNPWindow.x = aPosSize.X;
m_aNPWindow.y = aPosSize.Y;
m_aNPWindow.width = aPosSize.Width ? aPosSize.Width : 600;
m_aNPWindow.height = aPosSize.Height ? aPosSize.Height : 600;
aError = getPluginComm()->
NPP_SetWindow( getNPPInstance(), &m_aNPWindow );
}
void XPlugin_Impl::destroyStreams()
{
// streams remove themselves from this list when deleted
while( m_aOutputStreams.size() )
delete *m_aOutputStreams.begin();
// input streams are XOutputStreams, they cannot be simply deleted
::std::list<PluginInputStream*> aLocalList( m_aInputStreams );
for( ::std::list<PluginInputStream*>::iterator it = aLocalList.begin();
it != aLocalList.end(); ++it )
(*it)->setMode( -1 );
}
PluginStream* XPlugin_Impl::getStreamFromNPStream( NPStream* stream )
{
::std::list<PluginInputStream*>::iterator iter;
for( iter = m_aInputStreams.begin(); iter != m_aInputStreams.end(); ++iter )
if( (*iter)->getStream() == stream )
return *iter;
::std::list<PluginOutputStream*>::iterator iter2;
for( iter2 = m_aOutputStreams.begin(); iter2 != m_aOutputStreams.end(); ++iter2 )
if( (*iter2)->getStream() == stream )
return *iter2;
return NULL;
}
sal_Bool XPlugin_Impl::provideNewStream(const ::rtl::OUString& mimetype,
const Reference< ::com::sun::star::io::XActiveDataSource > & stream,
const ::rtl::OUString& url, sal_Int32 length,
sal_Int32 lastmodified, sal_Bool isfile)
{
if( m_nProvidingState == PROVIDING_NONE )
{
m_nProvidingState = PROVIDING_NOW;
Any aAny;
aAny <<= url;
Reference< ::com::sun::star::beans::XPropertySet > xPS( m_xModel, UNO_QUERY );
xPS->setPropertyValue( ::rtl::OUString::createFromAscii( "URL" ), aAny );
}
m_nProvidingState = PROVIDING_NOW;
if( ! m_pPluginComm )
loadPlugin();
::rtl::OString aMIME;
if( mimetype.len() )
aMIME = ::rtl::OUStringToOString( mimetype, m_aEncoding );
else
// Notnagel
aMIME = ::rtl::OUStringToOString( m_aDescription.Mimetype, m_aEncoding );
::rtl::OString aURL = ::rtl::OUStringToOString( url, m_aEncoding );
// check wether there is a notifylistener for this stream
// this means that the strema is created from the plugin
// via NPN_GetURLNotify or NPN_PostURLNotify
::std::list<PluginEventListener*>::iterator iter;
for( iter = m_aPEventListeners.begin();
iter != m_aPEventListeners.end();
++iter )
{
if( (*iter)->getNormalizedURL() == aURL )
{
aURL = (*iter)->getURL();
break;
}
}
if( iter == m_aPEventListeners.end() )
{
// e.g. plugger.so does not like file:///
if( ! aURL.compareTo( "file://", 7 ) )
{
INetURLObject aPath( url );
aURL = ::rtl::OUStringToOString( aPath.PathToFileName(), m_aEncoding );
}
}
PluginInputStream* pStream = new PluginInputStream( this, aURL.getStr(),
length, lastmodified );
Reference< ::com::sun::star::io::XOutputStream > xNewStream( pStream );
if( iter != m_aPEventListeners.end() )
pStream->getStream()->notifyData = (*iter)->getNotifyData();
uint16 stype = 0;
// sal_False in the following statement should logically be isfile
// but e.g. the acrobat reader plugin does not WANT a file
// NP_ASFILE or NP_ASFILEONLY if the new stream is seekable
// the reason for this behaviour is unknown
#ifdef DEBUG
fprintf( stderr, "new stream \"%s\" of MIMEType \"%s\"\nfor plugin \"%s\"\n", aURL.getStr(), aMIME.getStr(), getPluginComm()->getLibName().getStr() );
#endif
if( ! m_pPluginComm->NPP_NewStream( &m_aInstance, (char*)aMIME.getStr(),
pStream->getStream(), sal_False,
&stype ) )
{
getPluginComm()->NPP_SetWindow( getNPPInstance(), &m_aNPWindow );
#ifdef DEBUG
char* pType;
switch( stype )
{
case NP_NORMAL: pType = "NP_NORMAL";break;
case NP_SEEK: pType = "NP_SEEK";break;
case NP_ASFILE: pType = "NP_ASFILE";break;
case NP_ASFILEONLY: pType = "NP_ASFILEONLY";break;
default: pType = "unknown!!!";
}
fprintf( stderr, "Plugin wants it in Mode %s\n", pType );
#endif
if( isfile && stype == NP_ASFILEONLY )
{
m_pPluginComm->
NPP_StreamAsFile( &m_aInstance,
pStream->getStream(),
pStream->getStream()->url );
m_nProvidingState = PROVIDING_NONE;
return sal_True;
}
if( ! stream.is() )
{
m_pPluginComm->
NPP_DestroyStream( &m_aInstance,
pStream->getStream(),
NPRES_NETWORK_ERR );
m_nProvidingState = PROVIDING_NONE;
throw RuntimeException();
}
pStream->setMode( stype );
Reference< ::com::sun::star::io::XConnectable > xConnectable( stream, UNO_QUERY );
pStream->setPredecessor( xConnectable );
if( xConnectable.is() )
{
xConnectable->setSuccessor( static_cast< ::com::sun::star::io::XConnectable* >(pStream) );
while( xConnectable->getPredecessor().is() )
xConnectable = xConnectable->getPredecessor();
}
stream->setOutputStream( xNewStream );
pStream->setSource( stream );
Reference< ::com::sun::star::io::XActiveDataControl > xController;
if( xConnectable.is() )
xController = Reference< ::com::sun::star::io::XActiveDataControl >( xConnectable, UNO_QUERY );
else
xController = Reference< ::com::sun::star::io::XActiveDataControl >( stream, UNO_QUERY );
if( xController.is() )
xController->start();
}
m_nProvidingState = PROVIDING_NONE;
return sal_False;
}
void XPlugin_Impl::disposing( const ::com::sun::star::lang::EventObject& rSource )
{
}
void XPlugin_Impl::propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvent )
{
if( ! rEvent.PropertyName.compareToAscii( "URL" ) )
{
::rtl::OUString aStr;
rEvent.NewValue >>= aStr;
if( m_nProvidingState == PROVIDING_NONE )
{
if( aStr != m_aURL )
{
m_aURL = aStr;
modelChanged();
}
}
}
}
void XPlugin_Impl::setPluginContext( const Reference< ::com::sun::star::plugin::XPluginContext > & rContext )
{
m_rBrowserContext = rContext;
}
void XPlugin_Impl::setPosSize( sal_Int32 nX_, sal_Int32 nY_, sal_Int32 nWidth_, sal_Int32 nHeight_, sal_Int16 nFlags )
throw( RuntimeException )
{
#ifdef DEBUG
fprintf( stderr, "XPlugin_Impl::setPosSize( %d, %d, %d, %d, %d )\n",
nX_, nY_, nWidth_, nHeight_, nFlags );
#endif
PluginControl_Impl::setPosSize(nX_, nY_, nWidth_, nHeight_, nFlags);
m_aNPWindow.x = nX_;
m_aNPWindow.y = nY_;
m_aNPWindow.width = nWidth_;
m_aNPWindow.height = nHeight_;
if(getPluginComm())
getPluginComm()->NPP_SetWindow( getNPPInstance(), &m_aNPWindow );
}
PluginStream::PluginStream( XPlugin_Impl* pPlugin,
const char* url, sal_uInt32 len, sal_uInt32 lastmod ) :
m_pPlugin( pPlugin )
{
memset( &m_aNPStream, 0, sizeof( m_aNPStream ) );
m_aNPStream.url = strdup( url );
m_aNPStream.end = len;
m_aNPStream.lastmodified = lastmod;
}
PluginStream::~PluginStream()
{
if( m_pPlugin && m_pPlugin->getPluginComm() )
{
m_pPlugin->getPluginComm()->NPP_DestroyStream( m_pPlugin->getNPPInstance(),
&m_aNPStream, NPRES_DONE );
m_pPlugin->checkListeners( m_aNPStream.url );
m_pPlugin->getPluginComm()->
NPP_SetWindow( m_pPlugin->getNPPInstance(),
m_pPlugin->getNPWindow());
}
::free( (void*)m_aNPStream.url );
}
PluginInputStream::PluginInputStream( XPlugin_Impl* pPlugin,
const char* url,
sal_uInt32 len,
sal_uInt32 lastmod ) :
PluginStream( pPlugin, url, len, lastmod ),
m_nMode( NP_NORMAL ),
m_nWritePos( 0 )
{
m_pPlugin->getInputStreams().push_back( this );
DirEntry aEntry;
aEntry = aEntry.TempName();
// set correct extension, some plugins need that
DirEntry aName( String( m_aNPStream.url, m_pPlugin->getTextEncoding() ) );
String aExtension = aName.GetExtension();
if( aExtension.Len() )
aEntry.SetExtension( aExtension );
m_aFileStream.Open( aEntry.GetFull(), STREAM_READ | STREAM_WRITE );
if( ! m_aFileStream.IsOpen() )
{
// #74808# might be that the extension scrambled the whole filename
aEntry = aEntry.TempName();
m_aFileStream.Open( aEntry.GetFull(), STREAM_READ | STREAM_WRITE );
}
}
PluginInputStream::~PluginInputStream()
{
String aFile( m_aFileStream.GetFileName() );
m_aFileStream.Close();
if( m_pPlugin )
{
ByteString aFileName( aFile, m_pPlugin->getTextEncoding() );
if( m_pPlugin->getPluginComm() && m_nMode != -1 )
// mode -1 means either an error occured,
// or the plugin is already disposing
{
m_pPlugin->getPluginComm()->addFileToDelete( aFile );
if( m_nMode == NP_ASFILE )
{
m_pPlugin->getPluginComm()->
NPP_StreamAsFile( m_pPlugin->getNPPInstance(),
&m_aNPStream,
aFileName.GetBuffer() );
}
m_pPlugin->getPluginComm()->NPP_SetWindow( m_pPlugin->getNPPInstance(), m_pPlugin->getNPWindow());
m_pPlugin->getInputStreams().remove( this );
}
else
DirEntry( m_aFileStream.GetFileName() ).Kill();
}
else
DirEntry( m_aFileStream.GetFileName() ).Kill();
}
PluginStreamType PluginInputStream::getStreamType()
{
return InputStream;
}
void PluginInputStream::setMode( sal_uInt32 nMode )
{
m_nMode = nMode;
// invalidation by plugin
if( m_nMode == -1 && m_pPlugin )
{
m_pPlugin->getInputStreams().remove( this );
m_pPlugin = NULL;
}
}
void PluginInputStream::writeBytes( const Sequence<sal_Int8>& Buffer )
{
if( m_nMode == -1 )
return;
m_aFileStream.Seek( STREAM_SEEK_TO_END );
m_aFileStream.Write( Buffer.getConstArray(), Buffer.getLength() );
int nPos = m_aFileStream.Tell();
int nBytes = 0;
while( m_nMode != NP_SEEK && m_nMode != NP_ASFILEONLY &&
( nBytes = m_pPlugin->getPluginComm()->
NPP_WriteReady( m_pPlugin->getNPPInstance(),
&m_aNPStream ) ) > 0 &&
m_nWritePos < nPos )
{
nBytes = nBytes > nPos - m_nWritePos ? nPos - m_nWritePos : nBytes;
char* pBuffer = new char[ nBytes ];
m_aFileStream.Seek( m_nWritePos );
nBytes = m_aFileStream.Read( pBuffer, nBytes );
int nBytesRead = 0;
try
{
nBytesRead = m_pPlugin->getPluginComm()->
NPP_Write( m_pPlugin->getNPPInstance(),
&m_aNPStream,
m_nWritePos,
nBytes,
pBuffer );
delete pBuffer;
}
catch( ... )
{
delete pBuffer;
return;
}
if( nBytesRead < 0 )
{
m_nMode = -1;
return;
}
m_nWritePos += nBytesRead;
}
m_pPlugin->getPluginComm()->
NPP_SetWindow( m_pPlugin->getNPPInstance(),
m_pPlugin->getNPWindow());
}
void PluginInputStream::closeOutput()
{
flush();
m_xSource = Reference< ::com::sun::star::io::XActiveDataSource >();
}
sal_uInt32 PluginInputStream::read( sal_uInt32 offset, sal_Int8* buffer, sal_uInt32 size )
{
if( m_nMode != NP_SEEK )
return 0;
m_aFileStream.Seek( offset );
int nBytes = m_aFileStream.Read( buffer, size );
return nBytes;
}
void PluginInputStream::flush(void)
{
}
PluginOutputStream::PluginOutputStream( XPlugin_Impl* pPlugin,
const char* url,
sal_uInt32 len,
sal_uInt32 lastmod ) :
PluginStream( pPlugin, url, len, lastmod ),
m_xStream( pPlugin->getServiceManager()->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.io.DataOutputStream" ) ), UNO_QUERY )
{
m_pPlugin->getOutputStreams().push_back( this );
}
PluginOutputStream::~PluginOutputStream()
{
m_pPlugin->getOutputStreams().remove( this );
}
PluginStreamType PluginOutputStream::getStreamType()
{
return OutputStream;
}
@@ -0,0 +1,478 @@
/*************************************************************************
*
* $RCSfile: impl.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef __PLUGIN_SOURCE_MGR_IMPL_HXX
#define __PLUGIN_SOURCE_MGR_IMPL_HXX
#ifdef SOLARIS
#include <limits>
#endif
#include <cppuhelper/weak.hxx>
#ifndef _COM_SUN_STAR_AWT_KEY_HPP_
#include <com/sun/star/awt/Key.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_KEYFUNCTION_HPP_
#include <com/sun/star/awt/KeyFunction.hpp>
#endif
#ifndef _COM_SUN_STAR_PLUGIN_PLUGINMODE_HPP_
#include <com/sun/star/plugin/PluginMode.hpp>
#endif
#ifndef _COM_SUN_STAR_PLUGIN_PLUGINDESCRIPTION_HPP_
#include <com/sun/star/plugin/PluginDescription.hpp>
#endif
#ifndef _COM_SUN_STAR_PLUGIN_PLUGINEXCEPTION_HPP_
#include <com/sun/star/plugin/PluginException.hpp>
#endif
#ifndef _COM_SUN_STAR_PLUGIN_PLUGINVARIABLE_HPP_
#include <com/sun/star/plugin/PluginVariable.hpp>
#endif
#ifndef _COM_SUN_STAR_PLUGIN_XPLUGIN_HPP_
#include <com/sun/star/plugin/XPlugin.hpp>
#endif
#ifndef _COM_SUN_STAR_PLUGIN_XPLUGINMANAGER_HPP_
#include <com/sun/star/plugin/XPluginManager.hpp>
#endif
#ifndef _COM_SUN_STAR_PLUGIN_XPLUGINCONTEXT_HPP_
#include <com/sun/star/plugin/XPluginContext.hpp>
#endif
#ifndef _COM_SUN_STAR_IO_XCONNECTABLE_HPP_
#include <com/sun/star/io/XConnectable.hpp>
#endif
#ifndef _COM_SUN_STAR_IO_XOUTPUTSTREAM_HPP_
#include <com/sun/star/io/XOutputStream.hpp>
#endif
#ifndef _COM_SUN_STAR_IO_XDATAOUTPUTSTREAM_HPP_
#include <com/sun/star/io/XDataOutputStream.hpp>
#endif
#ifndef _COM_SUN_STAR_IO_XACTIVEDATACONTROL_HPP_
#include <com/sun/star/io/XActiveDataControl.hpp>
#endif
#ifndef _COM_SUN_STAR_IO_XDATAINPUTSTREAM_HPP_
#include <com/sun/star/io/XDataInputStream.hpp>
#endif
#ifndef _COM_SUN_STAR_IO_XMARKABLESTREAM_HPP_
#include <com/sun/star/io/XMarkableStream.hpp>
#endif
#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_
#include <com/sun/star/io/XInputStream.hpp>
#endif
#ifndef _COM_SUN_STAR_IO_XSTREAMLISTENER_HPP_
#include <com/sun/star/io/XStreamListener.hpp>
#endif
#ifndef _COM_SUN_STAR_IO_XACTIVEDATASINK_HPP_
#include <com/sun/star/io/XActiveDataSink.hpp>
#endif
#ifndef _COM_SUN_STAR_IO_XACTIVEDATASOURCE_HPP_
#include <com/sun/star/io/XActiveDataSource.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XSERVICENAME_HPP_
#include <com/sun/star/lang/XServiceName.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
#include <com/sun/star/lang/XServiceInfo.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_GRADIENTSTYLE_HPP_
#include <com/sun/star/awt/GradientStyle.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_RASTEROPERATION_HPP_
#include <com/sun/star/awt/RasterOperation.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_GRADIENT_HPP_
#include <com/sun/star/awt/Gradient.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XGRAPHICS_HPP_
#include <com/sun/star/awt/XGraphics.hpp>
#endif
#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/implbase1.hxx>
#ifdef WNT
#include <plugin/win/sysplug.hxx>
#else
#include <list>
#endif
#ifdef OS2
#include <plugin/os2/sysplug.hxx>
#endif
#ifdef UNX
#include <plugin/unx/sysplug.hxx>
#endif
#include <vcl/sysdata.hxx>
#include <vcl/syschild.hxx>
#include <plugin/plctrl.hxx>
#include <plugin/model.hxx>
#include <tools/link.hxx>
#include <tools/stream.hxx>
using namespace com::sun::star::uno;
#define PROVIDING_NONE 0
#define PROVIDING_NOW 1
#define PROVIDING_MODEL_UPDATE 2
class PluginStream;
class PluginInputStream;
class PluginOutputStream;
class XPlugin_Impl;
class PluginDisposer;
class PluginEventListener;
class XPlugin_Impl : public ::com::sun::star::plugin::XPlugin,
public PluginControl_Impl,
public ::com::sun::star::beans::XPropertyChangeListener
{
private:
Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
Reference< ::com::sun::star::plugin::XPluginContext > m_rBrowserContext;
PluginComm* m_pPluginComm;
NPP_t m_aInstance;
NPWindow m_aNPWindow;
rtl_TextEncoding m_aEncoding;
#ifdef UNX
NPSetWindowCallbackStruct m_aWSInfo;
Display* m_pDisplay;
XtAppContext m_aAppContext;
#endif
const char** m_pArgv;
const char** m_pArgn;
int m_nArgs;
Reference< ::com::sun::star::awt::XControlModel > m_xModel;
::com::sun::star::plugin::PluginDescription m_aDescription;
sal_Int16 m_aPluginMode;
int m_nProvidingState;
int m_nCalledFromPlugin;
PluginDisposer* m_pDisposer;
::std::list<PluginInputStream*> m_aInputStreams;
::std::list<PluginOutputStream*> m_aOutputStreams;
::std::list<PluginEventListener*> m_aPEventListeners;
::rtl::OUString m_aURL;
sal_Bool m_bIsDisposed;
void init( const ::com::sun::star::plugin::PluginDescription& rDescription );
void loadPlugin();
void destroyInstance();
void modelChanged();
public:
XPlugin_Impl( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr );
virtual ~XPlugin_Impl();
void destroyStreams();
::std::list<PluginInputStream*>& getInputStreams() { return m_aInputStreams; }
::std::list<PluginOutputStream*>& getOutputStreams() { return m_aOutputStreams; }
PluginComm* getPluginComm() { return m_pPluginComm; }
void setPluginComm( PluginComm* comm )
{
if( ! m_pPluginComm )
{
m_pPluginComm = comm;
m_pPluginComm->addRef();
}
}
#ifdef UNX
Display* getAppDisplay() { return m_pDisplay; }
XtAppContext getAppContext() { return m_aAppContext; }
#endif
Reference< ::com::sun::star::lang::XMultiServiceFactory > getServiceManager() { return m_xSMgr; }
rtl_TextEncoding getTextEncoding() { return m_aEncoding; }
NPP getNPPInstance() { return &m_aInstance; }
NPWindow* getNPWindow() { return &m_aNPWindow; }
void enterPluginCallback() { m_nCalledFromPlugin++; }
void leavePluginCallback() { m_nCalledFromPlugin--; }
sal_Bool isDisposable() { return m_nCalledFromPlugin < 1 ? sal_True : sal_False; }
DECL_LINK( secondLevelDispose, XPlugin_Impl* );
void addPluginEventListener( PluginEventListener* pListener )
{ m_aPEventListeners.push_back( pListener ); }
void checkListeners( const char* normalizedURL );
void initInstance(
const ::com::sun::star::plugin::PluginDescription& rDescription,
const Sequence< ::rtl::OUString >& argn,
const Sequence< ::rtl::OUString >& argv,
sal_Int16 mode );
const ::rtl::OUString& getRefererURL() { return m_aURL; }
::rtl::OUString getCreationURL();
PluginStream* getStreamFromNPStream( NPStream* );
const SystemEnvData* getSysChildSysData()
{ return _pSysChild->GetSystemData(); }
const Reference< ::com::sun::star::plugin::XPluginContext > & getPluginContext() const
{ return m_rBrowserContext; }
void setPluginContext( const Reference< ::com::sun::star::plugin::XPluginContext > & );
void secondLevelDispose();
// static const Reference< ::com::sun::star::reflection::XIdlClass > & staticGetIdlClass();
// XInterface
virtual Any SAL_CALL queryInterface( const Type& );
virtual void SAL_CALL acquire() { OWeakAggObject::acquire(); }
virtual void SAL_CALL release() { OWeakAggObject::release(); }
// OWeakAggObject
virtual Any SAL_CALL queryAggregation( const Type& );
// PluginContol_Impl
virtual void SAL_CALL dispose();
virtual void SAL_CALL createPeer( const Reference< ::com::sun::star::awt::XToolkit > & xToolkit, const Reference< ::com::sun::star::awt::XWindowPeer > & Parent) throw( RuntimeException );
virtual sal_Bool SAL_CALL setModel( const Reference< ::com::sun::star::awt::XControlModel > & Model ) throw( RuntimeException );
virtual Reference< ::com::sun::star::awt::XControlModel > SAL_CALL getModel(void) const throw( RuntimeException )
{ return m_xModel; }
virtual void SAL_CALL setPosSize( sal_Int32 nX_, sal_Int32 nY_, sal_Int32 nWidth_, sal_Int32 nHeight_, sal_Int16 nFlags ) throw( RuntimeException );
// ::com::sun::star::plugin::XPlugin
virtual sal_Bool SAL_CALL provideNewStream(const ::rtl::OUString& mimetype, const Reference< ::com::sun::star::io::XActiveDataSource > & stream, const ::rtl::OUString& url, sal_Int32 length, sal_Int32 lastmodified, sal_Bool isfile);
// ::com::sun::star::beans::XPropertyChangeListener
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& rSource );
virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvent );
};
class PluginManager
{
private:
Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
::std::list<PluginComm*> m_aPluginComms;
::std::list<XPlugin_Impl*> m_aAllPlugins;
::osl::Mutex m_aPluginMutex;
static PluginManager* pManager;
PluginManager();
~PluginManager();
public:
static PluginManager& get();
static void setServiceFactory( const Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
static const Sequence< ::rtl::OUString >& getAdditionalSearchPaths();
::std::list<PluginComm*>& getPluginComms() { return m_aPluginComms; }
::std::list<XPlugin_Impl*>& getPlugins() { return m_aAllPlugins; }
::osl::Mutex& getPluginMutex() { return m_aPluginMutex; }
};
class XPluginManager_Impl :
public ::cppu::WeakAggImplHelper1< ::com::sun::star::plugin::XPluginManager >
{
Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
public:
XPluginManager_Impl( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & );
virtual ~XPluginManager_Impl();
static XPlugin_Impl* getXPluginFromNPP( NPP );
static XPlugin_Impl* getFirstXPlugin();
static XPlugin_Impl* getPluginImplementation( const Reference< ::com::sun::star::plugin::XPlugin >& plugin );
virtual Reference< ::com::sun::star::plugin::XPluginContext > SAL_CALL createPluginContext();
// has to be implemented per system
virtual Sequence< ::com::sun::star::plugin::PluginDescription > SAL_CALL getPluginDescriptions(void) throw( );
virtual Reference< ::com::sun::star::plugin::XPlugin > SAL_CALL createPlugin( const Reference< ::com::sun::star::plugin::XPluginContext > & acontext, sal_Int16 mode, const Sequence< ::rtl::OUString >& argn, const Sequence< ::rtl::OUString >& argv, const ::com::sun::star::plugin::PluginDescription& plugintype) throw( RuntimeException,::com::sun::star::plugin::PluginException );
virtual Reference< ::com::sun::star::plugin::XPlugin > SAL_CALL createPluginFromURL( const Reference< ::com::sun::star::plugin::XPluginContext > & acontext, sal_Int16 mode, const Sequence< ::rtl::OUString >& argn, const Sequence< ::rtl::OUString >& argv, const Reference< ::com::sun::star::awt::XToolkit > & toolkit, const Reference< ::com::sun::star::awt::XWindowPeer > & parent, const ::rtl::OUString& url );
virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw( );
virtual ::rtl::OUString SAL_CALL getImplementationName() throw();
Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( );
static Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( );
static ::rtl::OUString getImplementationName_Static() throw( )
{
/** the soplayer uses this name in its source! maybe not after 5.2 */
return ::rtl::OUString::createFromAscii( "com.sun.star.extensions.PluginManager" );
}
};
Reference< XInterface > SAL_CALL PluginManager_CreateInstance( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & ) throw( Exception );
enum PluginStreamType { InputStream, OutputStream };
class PluginStream
{
protected:
XPlugin_Impl* m_pPlugin;
NPStream m_aNPStream;
public:
PluginStream( XPlugin_Impl* pPlugin,
const char* url, sal_uInt32 len, sal_uInt32 lastmod );
virtual ~PluginStream();
NPStream* getStream() { return &m_aNPStream; }
XPlugin_Impl* getPlugin() { return m_pPlugin; }
virtual PluginStreamType getStreamType() = 0;
};
class PluginInputStream :
public PluginStream,
public ::cppu::WeakAggImplHelper2<
::com::sun::star::io::XOutputStream,
::com::sun::star::io::XConnectable
>
{
private:
UINT32 m_nMode;
UINT32 m_nWritePos;
Reference< ::com::sun::star::io::XActiveDataSource > m_xSource;
// hold a reference on input until closeOutput is called
Reference< ::com::sun::star::io::XConnectable > m_xPredecessor;
Reference< ::com::sun::star::io::XConnectable > m_xSuccessor;
SvFileStream m_aFileStream;
public:
PluginInputStream( XPlugin_Impl* pPlugin,
const char* url, UINT32 len, UINT32 lastmod );
PluginInputStream() : PluginStream( NULL, NULL, 0, 0 ) {}
virtual ~PluginInputStream();
virtual PluginStreamType getStreamType();
void setMode( UINT32 nMode );
UINT32 read( UINT32 offset, sal_Int8* buffer, UINT32 size );
void setSource( const Reference< ::com::sun::star::io::XActiveDataSource >& xSource ) { m_xSource = xSource; }
// XOutputStream
virtual void SAL_CALL writeBytes( const Sequence<sal_Int8>& );
virtual void SAL_CALL flush();
virtual void SAL_CALL closeOutput();
// XConnectable
virtual void SAL_CALL setPredecessor( const Reference< ::com::sun::star::io::XConnectable >& xPredecessor )
{ m_xPredecessor = xPredecessor; }
virtual Reference< ::com::sun::star::io::XConnectable > SAL_CALL getPredecessor()
{ return m_xPredecessor; }
virtual void SAL_CALL setSuccessor( const Reference< ::com::sun::star::io::XConnectable >& xSuccessor )
{ m_xSuccessor = xSuccessor; }
virtual Reference< ::com::sun::star::io::XConnectable > SAL_CALL getSuccessor()
{ return m_xSuccessor; }
};
class PluginOutputStream : public PluginStream
{
private:
Reference< ::com::sun::star::io::XOutputStream > m_xStream;
public:
PluginOutputStream( XPlugin_Impl* pPlugin, const char* url,
sal_uInt32 len, sal_uInt32 lastmod );
virtual ~PluginOutputStream();
virtual PluginStreamType getStreamType();
Reference< ::com::sun::star::io::XOutputStream > & getOutputStream() { return m_xStream; }
};
class PluginEventListener :
public ::cppu::WeakAggImplHelper1< ::com::sun::star::lang::XEventListener >
{
private:
XPlugin_Impl* m_pPlugin;
Reference< ::com::sun::star::plugin::XPlugin > m_xPlugin; // just to hold the plugin
char* m_pUrl;
char* m_pNormalizedUrl;
void* m_pNotifyData;
public:
PluginEventListener( XPlugin_Impl*,
const char* url,
const char* normurl,
void* notifyData );
virtual ~PluginEventListener();
const char* getURL() { return m_pUrl; }
const char* getNormalizedURL() { return m_pNormalizedUrl; }
void* getNotifyData() { return m_pNotifyData; }
// ::com::sun::star::lang::XEventListener
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source );
};
#endif
@@ -0,0 +1,187 @@
/*************************************************************************
*
* $RCSfile: model.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef __PLUGIN_MODEL_HXX
#define __PLUGIN_MODEL_HXX
#ifndef _COM_SUN_STAR_IO_XOBJECTINPUTSTREAM_HPP_
#include <com/sun/star/io/XObjectInputStream.hpp>
#endif
#ifndef _COM_SUN_STAR_IO_XPERSISTOBJECT_HPP_
#include <com/sun/star/io/XPersistObject.hpp>
#endif
#ifndef _COM_SUN_STAR_IO_XOBJECTOUTPUTSTREAM_HPP_
#include <com/sun/star/io/XObjectOutputStream.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XSERVICENAME_HPP_
#include <com/sun/star/lang/XServiceName.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
#include <com/sun/star/lang/XServiceInfo.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XCONTROLMODEL_HPP_
#include <com/sun/star/awt/XControlModel.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_
#include <com/sun/star/awt/XControl.hpp>
#endif
#include <cppuhelper/propshlp.hxx>
#include <cppuhelper/weakagg.hxx>
#include <rtl/alloc.h>
#include <stl/list>
using namespace com::sun::star::uno;
class BroadcasterHelperHolder
{
protected:
::cppu::OBroadcastHelper m_aHelper;
public:
BroadcasterHelperHolder( ::osl::Mutex& rMutex ) :
m_aHelper( rMutex ) {}
~BroadcasterHelperHolder() {}
::cppu::OBroadcastHelper& getHelper() { return m_aHelper; }
};
class PluginModel : public BroadcasterHelperHolder,
public ::cppu::OPropertySetHelper,
public ::cppu::OPropertyArrayHelper,
public ::cppu::OWeakAggObject,
public ::com::sun::star::lang::XComponent,
public ::com::sun::star::io::XPersistObject,
public ::com::sun::star::awt::XControlModel
{
private:
::rtl::OUString m_aCreationURL;
::std::list< Reference< ::com::sun::star::lang::XEventListener > >
m_aDisposeListeners;
public:
// these are here to force memory de/allocation to sal lib.
static void * SAL_CALL operator new( size_t nSize ) throw()
{ return ::rtl_allocateMemory( nSize ); }
static void SAL_CALL operator delete( void * pMem ) throw()
{ ::rtl_freeMemory( pMem ); }
PluginModel();
PluginModel( const ::rtl::OUString& );
virtual ~PluginModel();
const ::rtl::OUString& getCreationURL() { return m_aCreationURL; }
// XInterface
virtual Any SAL_CALL queryInterface( const Type& rType )
{ return OWeakAggObject::queryInterface( rType ); }
virtual void SAL_CALL acquire() { OWeakAggObject::acquire(); }
virtual void SAL_CALL release() { OWeakAggObject::release(); }
virtual Any SAL_CALL queryAggregation( const Type& );
// ::com::sun::star::lang::XTypeProvider
// ::com::sun::star::lang::XServiceInfo
::rtl::OUString SAL_CALL getImplementationName() throw( );
sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw( );
Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( );
static Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static(void) throw( );
static ::rtl::OUString SAL_CALL getImplementationName_Static() throw( )
{
/** the soplayer uses this name in its source! maybe not after 5.2 */
return ::rtl::OUString::createFromAscii( "com.sun.star.extensions.PluginModel" );
}
// OPropertySetHelper
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
virtual sal_Bool SAL_CALL convertFastPropertyValue( Any & rConvertedValue,
Any & rOldValue,
sal_Int32 nHandle,
const Any& rValue );
virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle,
const Any& rValue )
throw( ::com::sun::star::lang::IllegalArgumentException );
virtual void SAL_CALL getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const;
virtual Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo();
// ::com::sun::star::io::XPersistObject
virtual ::rtl::OUString SAL_CALL getServiceName();
virtual void SAL_CALL write(const Reference< ::com::sun::star::io::XObjectOutputStream > & OutStream);
virtual void SAL_CALL read(const Reference< ::com::sun::star::io::XObjectInputStream > & InStream);
// ::com::sun::star::lang::XComponent
virtual void SAL_CALL addEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l );
virtual void SAL_CALL removeEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l );
virtual void SAL_CALL dispose();
};
Reference< XInterface > SAL_CALL PluginModel_CreateInstance( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & ) throw( Exception );
#endif // __PLUGIN_MODEL_HXX
@@ -0,0 +1,249 @@
/*************************************************************************
*
* $RCSfile: multiplx.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _MRC_MULTIPLX_HXX
#define _MRC_MULTIPLX_HXX
#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_
#include <com/sun/star/awt/XControl.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XKEYLISTENER_HPP_
#include <com/sun/star/awt/XKeyListener.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XPAINTLISTENER_HPP_
#include <com/sun/star/awt/XPaintListener.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_KEYEVENT_HPP_
#include <com/sun/star/awt/KeyEvent.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_KEYMODIFIER_HPP_
#include <com/sun/star/awt/KeyModifier.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XMOUSEMOTIONLISTENER_HPP_
#include <com/sun/star/awt/XMouseMotionListener.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_FOCUSEVENT_HPP_
#include <com/sun/star/awt/FocusEvent.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XWINDOWLISTENER_HPP_
#include <com/sun/star/awt/XWindowListener.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XACTIVATELISTENER_HPP_
#include <com/sun/star/awt/XActivateListener.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_MOUSEEVENT_HPP_
#include <com/sun/star/awt/MouseEvent.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XTOPWINDOWLISTENER_HPP_
#include <com/sun/star/awt/XTopWindowListener.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_PAINTEVENT_HPP_
#include <com/sun/star/awt/PaintEvent.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_INPUTEVENT_HPP_
#include <com/sun/star/awt/InputEvent.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_KEYGROUP_HPP_
#include <com/sun/star/awt/KeyGroup.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_KEY_HPP_
#include <com/sun/star/awt/Key.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_WINDOWEVENT_HPP_
#include <com/sun/star/awt/WindowEvent.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XMOUSELISTENER_HPP_
#include <com/sun/star/awt/XMouseListener.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_KEYFUNCTION_HPP_
#include <com/sun/star/awt/KeyFunction.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_FOCUSCHANGEREASON_HPP_
#include <com/sun/star/awt/FocusChangeReason.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_MOUSEBUTTON_HPP_
#include <com/sun/star/awt/MouseButton.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XFOCUSLISTENER_HPP_
#include <com/sun/star/awt/XFocusListener.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XTOPWINDOW_HPP_
#include <com/sun/star/awt/XTopWindow.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
#include <com/sun/star/awt/XWindow.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_
#include <com/sun/star/awt/PosSize.hpp>
#endif
#include <cppuhelper/implbase7.hxx>
#include <cppuhelper/interfacecontainer.hxx>
using namespace com::sun::star::uno;
struct MRCListenerMultiplexerHelper_Mutex
{
::osl::Mutex aMutex;
};
class MRCListenerMultiplexerHelper :
public MRCListenerMultiplexerHelper_Mutex,
public ::cppu::WeakAggImplHelper7<
::com::sun::star::awt::XFocusListener,
::com::sun::star::awt::XWindowListener,
::com::sun::star::awt::XKeyListener,
::com::sun::star::awt::XMouseListener,
::com::sun::star::awt::XMouseMotionListener,
::com::sun::star::awt::XPaintListener,
::com::sun::star::awt::XTopWindowListener >
{
public:
/**
* Create a Multiplexer of XWindowEvents.
*
* @param rControl The control. All listeners think that this is the original
* broadcaster.
* @param rPeer The peer from which the original events are dispatched. Null is
* allowed.
*/
MRCListenerMultiplexerHelper( const Reference< ::com::sun::star::awt::XWindow > & rControl, const Reference< ::com::sun::star::awt::XWindow > & rPeer );
/**
* Remove all listeners from the previous set peer and add the needed listeners to rPeer.
* @param rPeer The peer from which the original events are dispatched. Null is
* allowed.
*/
void setPeer( const Reference< ::com::sun::star::awt::XWindow > & rPeer );
/**
* Remove all listeners and send a disposing message.
*/
void disposeAndClear();
/**
* Add the specified listener to the source.
*/
void advise( const Type& type, const Reference< XInterface > & listener);
/**
* Remove the specified listener from the source.
*/
void unadvise(const Type& type, const Reference< XInterface > & listener);
// ::com::sun::star::lang::XEventListener
void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source);
// ::com::sun::star::awt::XFocusListener
void SAL_CALL focusGained(const ::com::sun::star::awt::FocusEvent& e);
void SAL_CALL focusLost(const ::com::sun::star::awt::FocusEvent& e);
// ::com::sun::star::awt::XWindowListener
void SAL_CALL windowResized(const ::com::sun::star::awt::WindowEvent& e);
void SAL_CALL windowMoved(const ::com::sun::star::awt::WindowEvent& e);
void SAL_CALL windowShown(const ::com::sun::star::lang::EventObject& e);
void SAL_CALL windowHidden(const ::com::sun::star::lang::EventObject& e);
// ::com::sun::star::awt::XKeyListener
void SAL_CALL keyPressed( const ::com::sun::star::awt::KeyEvent& e );
void SAL_CALL keyReleased( const ::com::sun::star::awt::KeyEvent& e );
// ::com::sun::star::awt::XMouseListener
void SAL_CALL mousePressed(const ::com::sun::star::awt::MouseEvent& e);
void SAL_CALL mouseReleased(const ::com::sun::star::awt::MouseEvent& e);
void SAL_CALL mouseEntered(const ::com::sun::star::awt::MouseEvent& e);
void SAL_CALL mouseExited(const ::com::sun::star::awt::MouseEvent& e);
// ::com::sun::star::awt::XMouseMotionListener
void SAL_CALL mouseDragged(const ::com::sun::star::awt::MouseEvent& e);
void SAL_CALL mouseMoved(const ::com::sun::star::awt::MouseEvent& e);
// ::com::sun::star::awt::XPaintListener
void SAL_CALL windowPaint(const ::com::sun::star::awt::PaintEvent& e);
// ::com::sun::star::awt::XTopWindowListener
void SAL_CALL windowOpened( const ::com::sun::star::lang::EventObject& e );
void SAL_CALL windowClosing( const ::com::sun::star::lang::EventObject& e );
void SAL_CALL windowClosed( const ::com::sun::star::lang::EventObject& e );
void SAL_CALL windowMinimized( const ::com::sun::star::lang::EventObject& e );
void SAL_CALL windowNormalized( const ::com::sun::star::lang::EventObject& e );
void SAL_CALL windowActivated( const ::com::sun::star::lang::EventObject& e );
void SAL_CALL windowDeactivated( const ::com::sun::star::lang::EventObject& e );
protected:
/**
* Remove the listener with the uik rUik from the peer rPeer.
* @param rPeer the peer from which the listener is removed.
* @param rUik the listener uik, which specify the type of the listener.
*/
void adviseToPeer( const Reference< ::com::sun::star::awt::XWindow > & rPeer, const Type & type );
/**
* Add the listener with the uik rUik to the peer rPeer.
* @param rPeer the peer to which the listener is added.
* @param rUik the listener uik, which specify the type of the listener.
*/
void unadviseFromPeer( const Reference< ::com::sun::star::awt::XWindow > & rPeer, const Type & type );
private:
/** The source of the events. Normally this is the peer object.*/
Reference< ::com::sun::star::awt::XWindow > xPeer;
WeakReference< ::com::sun::star::awt::XControl > xControl;
::cppu::OMultiTypeInterfaceContainerHelper aListenerHolder;
MRCListenerMultiplexerHelper( const MRCListenerMultiplexerHelper & );
MRCListenerMultiplexerHelper & operator = ( const MRCListenerMultiplexerHelper & );
};
#endif // _MRC_MULTIPLX_HXX
@@ -0,0 +1,114 @@
/*************************************************************************
*
* $RCSfile: plcom.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef __PLUGIN_INC_PLCOM_HXX
#define __PLUGIN_INC_PLCOM_HXX
#include <tools/string.hxx>
#include <list>
class PluginComm
{
protected:
int m_nRefCount;
::rtl::OString m_aLibName;
std::list< String > m_aFilesToDelete;
public:
PluginComm( const ::rtl::OString& rLibName );
virtual ~PluginComm();
int getRefCount() { return m_nRefCount; }
void addRef() { m_nRefCount++; }
void decRef() { m_nRefCount--; if( ! m_nRefCount ) delete this; }
const ::rtl::OString& getLibName() { return m_aLibName; }
void setLibName( const ::rtl::OString& rName ) { m_aLibName = rName; }
void addFileToDelete( const String& filename )
{ m_aFilesToDelete.push_back( filename ); }
virtual NPError NPP_Destroy( NPP instance, NPSavedData** save ) = 0;
virtual NPError NPP_DestroyStream( NPP instance, NPStream* stream,
NPError reason ) = 0;
virtual void* NPP_GetJavaClass() = 0;
virtual NPError NPP_Initialize() = 0;
virtual NPError NPP_New( NPMIMEType pluginType, NPP instance,
uint16 mode, int16 argc,
char* argn[], char* argv[],
NPSavedData *saved ) = 0;
virtual NPError NPP_NewStream( NPP instance, NPMIMEType type,
NPStream* stream,
NPBool seekable, uint16* stype ) = 0;
virtual void NPP_Print( NPP instance, NPPrint* platformPrint ) = 0;
virtual NPError NPP_SetWindow( NPP instance, NPWindow* window ) = 0;
virtual void NPP_Shutdown() = 0;
virtual void NPP_StreamAsFile( NPP instance, NPStream* stream,
const char* fname ) = 0;
virtual void NPP_URLNotify( NPP instance, const char* url,
NPReason reason, void* notifyData ) = 0;
virtual int32 NPP_Write( NPP instance, NPStream* stream, int32 offset,
int32 len, void* buffer ) = 0;
virtual int32 NPP_WriteReady( NPP instance, NPStream* stream ) = 0;
virtual NPError NPP_GetValue( NPP instance, NPPVariable variable, void* value ) = 0;
virtual NPError NPP_SetValue( NPP instance, NPNVariable variable,
void *value) = 0;
};
#endif
@@ -0,0 +1,276 @@
/*************************************************************************
*
* $RCSfile: plctrl.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef __PLCTRL_HXX
#define __PLCTRL_HXX
#include <tools/debug.hxx>
#include <cppuhelper/weak.hxx>
#include <plugin/multiplx.hxx>
#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUES_HPP_
#include <com/sun/star/beans/PropertyValues.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
#include <com/sun/star/beans/PropertyValue.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_PROPERTYSTATE_HPP_
#include <com/sun/star/beans/PropertyState.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP_
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XMULTIPROPERTYSET_HPP_
#include <com/sun/star/beans/XMultiPropertySet.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XFASTPROPERTYSET_HPP_
#include <com/sun/star/beans/XFastPropertySet.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XVETOABLECHANGELISTENER_HPP_
#include <com/sun/star/beans/XVetoableChangeListener.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSTATE_HPP_
#include <com/sun/star/beans/XPropertyState.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSTATECHANGELISTENER_HPP_
#include <com/sun/star/beans/XPropertyStateChangeListener.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
#include <com/sun/star/beans/PropertyAttribute.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTIESCHANGELISTENER_HPP_
#include <com/sun/star/beans/XPropertiesChangeListener.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCHANGELISTENER_HPP_
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYACCESS_HPP_
#include <com/sun/star/beans/XPropertyAccess.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCONTAINER_HPP_
#include <com/sun/star/beans/XPropertyContainer.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_PROPERTYSTATECHANGEEVENT_HPP_
#include <com/sun/star/beans/PropertyStateChangeEvent.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_PROPERTYCHANGEEVENT_HPP_
#include <com/sun/star/beans/PropertyChangeEvent.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINERPEER_HPP_
#include <com/sun/star/awt/XVclContainerPeer.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XVCLWINDOWPEER_HPP_
#include <com/sun/star/awt/XVclWindowPeer.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XCONTROLMODEL_HPP_
#include <com/sun/star/awt/XControlModel.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XUNOCONTROLCONTAINER_HPP_
#include <com/sun/star/awt/XUnoControlContainer.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XCONTROLCONTAINER_HPP_
#include <com/sun/star/awt/XControlContainer.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_VCLWINDOWPEERATTRIBUTE_HPP_
#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINER_HPP_
#include <com/sun/star/awt/XVclContainer.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_
#include <com/sun/star/awt/XControl.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XTOPWINDOW_HPP_
#include <com/sun/star/awt/XTopWindow.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
#include <com/sun/star/awt/XWindow.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_
#include <com/sun/star/awt/PosSize.hpp>
#endif
#include <cppuhelper/implbase5.hxx>
#include <list>
using namespace com::sun::star::uno;
class SystemChildWindow;
//==================================================================================================
class PluginControl_Impl : public ::cppu::WeakAggImplHelper5<
::com::sun::star::awt::XControl,
::com::sun::star::awt::XControlModel,
::com::sun::star::awt::XWindow,
::com::sun::star::awt::XFocusListener,
::com::sun::star::awt::XView >
{
public:
// ::com::sun::star::awt::XControl
virtual void SAL_CALL setContext( const Reference< XInterface > & xContext ) throw( RuntimeException )
{ _xContext = xContext; }
virtual Reference< XInterface > SAL_CALL getContext() throw( RuntimeException )
{ return _xContext; }
virtual sal_Bool SAL_CALL setModel( const Reference< ::com::sun::star::awt::XControlModel > & Model ) throw( RuntimeException )
{ DBG_ERROR( "### setModel() illegal on plugincontrol!" ); return sal_False; }
virtual Reference< ::com::sun::star::awt::XControlModel > SAL_CALL getModel() throw( RuntimeException )
{ return (::com::sun::star::awt::XControlModel*)this; }
virtual Reference< ::com::sun::star::awt::XView > SAL_CALL getView() throw( RuntimeException )
{ return (::com::sun::star::awt::XView*)this; }
virtual sal_Bool SAL_CALL isTransparent() throw( RuntimeException )
{ return sal_False; }
virtual void SAL_CALL setDesignMode( sal_Bool bOn ) throw( RuntimeException );
virtual sal_Bool SAL_CALL isDesignMode() throw( RuntimeException )
{ return _bInDesignMode; }
virtual void SAL_CALL createPeer( const Reference< ::com::sun::star::awt::XToolkit > & xToolkit, const Reference< ::com::sun::star::awt::XWindowPeer > & Parent) throw( RuntimeException );
virtual Reference< ::com::sun::star::awt::XWindowPeer > SAL_CALL getPeer() throw( RuntimeException )
{ return _xPeer; }
// ::com::sun::star::awt::XWindow
virtual void SAL_CALL setVisible( sal_Bool bVisible ) throw( RuntimeException );
virtual void SAL_CALL setEnable( sal_Bool bEnable ) throw( RuntimeException );
virtual void SAL_CALL setFocus(void) throw( RuntimeException );
virtual void SAL_CALL setPosSize( sal_Int32 nX_, sal_Int32 nY_, sal_Int32 nWidth_, sal_Int32 nHeight_, sal_Int16 nFlags ) throw( RuntimeException );
virtual ::com::sun::star::awt::Rectangle SAL_CALL getPosSize(void) throw( RuntimeException );
virtual void SAL_CALL addWindowListener( const Reference< ::com::sun::star::awt::XWindowListener > & l ) throw( RuntimeException );
virtual void SAL_CALL removeWindowListener( const Reference< ::com::sun::star::awt::XWindowListener > & l ) throw( RuntimeException );
virtual void SAL_CALL addFocusListener( const Reference< ::com::sun::star::awt::XFocusListener > & l ) throw( RuntimeException );
virtual void SAL_CALL removeFocusListener( const Reference< ::com::sun::star::awt::XFocusListener > & l ) throw( RuntimeException );
virtual void SAL_CALL addKeyListener( const Reference< ::com::sun::star::awt::XKeyListener > & l ) throw( RuntimeException );
virtual void SAL_CALL removeKeyListener( const Reference< ::com::sun::star::awt::XKeyListener > & l ) throw( RuntimeException );
virtual void SAL_CALL addMouseListener( const Reference< ::com::sun::star::awt::XMouseListener > & l ) throw( RuntimeException );
virtual void SAL_CALL removeMouseListener( const Reference< ::com::sun::star::awt::XMouseListener > & l ) throw( RuntimeException );
virtual void SAL_CALL addMouseMotionListener( const Reference< ::com::sun::star::awt::XMouseMotionListener > & l ) throw( RuntimeException );
virtual void SAL_CALL removeMouseMotionListener( const Reference< ::com::sun::star::awt::XMouseMotionListener > & l ) throw( RuntimeException );
virtual void SAL_CALL addPaintListener( const Reference< ::com::sun::star::awt::XPaintListener > & l ) throw( RuntimeException );
virtual void SAL_CALL removePaintListener( const Reference< ::com::sun::star::awt::XPaintListener > & l ) throw( RuntimeException );
// ::com::sun::star::lang::XEventListener
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject & rSource ) throw( RuntimeException );
// ::com::sun::star::awt::XFocusListener
virtual void SAL_CALL focusGained( const ::com::sun::star::awt::FocusEvent & rEvt ) throw( RuntimeException );
virtual void SAL_CALL focusLost( const ::com::sun::star::awt::FocusEvent & rEvt ) throw( RuntimeException );
// ::com::sun::star::lang::XComponent
virtual void SAL_CALL addEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l ) throw( RuntimeException );
virtual void SAL_CALL removeEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l ) throw( RuntimeException );
virtual void SAL_CALL dispose() throw( RuntimeException );
// ::com::sun::star::awt::XView
virtual sal_Bool SAL_CALL setGraphics( const Reference< ::com::sun::star::awt::XGraphics > & aDevice ) throw( RuntimeException )
{ return sal_False; }
virtual Reference< ::com::sun::star::awt::XGraphics > SAL_CALL getGraphics(void) throw( RuntimeException )
{ return Reference< ::com::sun::star::awt::XGraphics > (); }
virtual ::com::sun::star::awt::Size SAL_CALL getSize(void) throw( RuntimeException )
{ return ::com::sun::star::awt::Size(_nWidth, _nHeight); }
virtual void SAL_CALL draw( sal_Int32 x, sal_Int32 y ) throw( RuntimeException );
virtual void SAL_CALL setZoom( float ZoomX, float ZoomY ) throw( RuntimeException );
public:
PluginControl_Impl();
virtual ~PluginControl_Impl();
MRCListenerMultiplexerHelper* getMultiplexer();
protected:
void releasePeer();
protected:
::std::list< Reference< ::com::sun::star::lang::XEventListener > > _aDisposeListeners;
MRCListenerMultiplexerHelper* _pMultiplexer;
Reference< XInterface > _xContext;
sal_Int32 _nX;
sal_Int32 _nY;
sal_Int32 _nWidth;
sal_Int32 _nHeight;
sal_Int16 _nFlags;
sal_Bool _bVisible;
sal_Bool _bInDesignMode;
sal_Bool _bEnable;
SystemChildWindow* _pSysChild;
Reference< ::com::sun::star::awt::XWindowPeer > _xPeer;
Reference< ::com::sun::star::awt::XWindow > _xPeerWindow;
Reference< ::com::sun::star::awt::XWindow > _xParentWindow;
Reference< ::com::sun::star::awt::XWindowPeer > _xParentPeer;
};
#endif
@@ -0,0 +1,111 @@
/*************************************************************************
*
* $RCSfile: sysplug.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef __PLUGIN_INC_UNXPLUG_HXX
#define __PLUGIN_INC_UNXPLUG_HXX
#include <cstdio>
#include <prex.h>
#define XP_UNIX
#include <npsdk/npupp.h>
#include <npsdk/npapi.h>
#include <postx.h>
#include <plugin/plcom.hxx>
#include <vcl/sysdata.hxx>
class UnxPluginComm : public PluginComm
{
private:
void* m_pLibrary;
NPPluginFuncs m_aFuncs;
BOOL m_bInit;
public:
UnxPluginComm( const ::rtl::OString& library );
virtual ~UnxPluginComm();
virtual NPError NPP_Destroy( NPP instance, NPSavedData** save );
virtual NPError NPP_DestroyStream( NPP instance, NPStream* stream,
NPError reason );
virtual void* NPP_GetJavaClass();
virtual NPError NPP_Initialize();
virtual NPError NPP_New( NPMIMEType pluginType, NPP instance,
uint16 mode, int16 argc,
char* argn[], char* argv[], NPSavedData *saved );
virtual NPError NPP_NewStream( NPP instance, NPMIMEType type,
NPStream* stream,
NPBool seekable, uint16* stype );
virtual void NPP_Print( NPP instance, NPPrint* platformPrint );
virtual NPError NPP_SetWindow( NPP instance, NPWindow* window );
virtual void NPP_Shutdown();
virtual void NPP_StreamAsFile( NPP instance, NPStream* stream,
const char* fname );
virtual void NPP_URLNotify( NPP instance, const char* url, NPReason reason,
void* notifyData );
virtual int32 NPP_Write( NPP instance, NPStream* stream, int32 offset,
int32 len, void* buffer );
virtual int32 NPP_WriteReady( NPP instance, NPStream* stream );
virtual NPError NPP_GetValue( NPP instance, NPPVariable variable, void* value );
virtual NPError NPP_SetValue( NPP instance, NPNVariable variable,
void *value);
};
#endif
@@ -0,0 +1,139 @@
/*************************************************************************
*
* $RCSfile: sysplug.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef __PLUGIN_INC_WINPLUG_HXX
#define __PLUGIN_INC_WINPLUG_HXX
#if _MSC_VER >= 1200
#include <tools/prewin.h>
#else
#include <tools/presys.h>
#endif
#if STLPORT_VERSION < 321
#include <list.h>
#include <map.h>
#include <algo.h>
#include <function.h>
#endif
#include <windows.h>
#include <tchar.h>
#include <winbase.h>
#if _MSC_VER >= 1200
#include <tools/postwin.h>
#else
#include <tools/postsys.h>
#endif
#if STLPORT_VERSION >= 321
#include <stl/list>
#include <stl/map>
#include <stl/algorithm>
#endif
#pragma pack( push, 8 )
#include <npsdk/npapi.h>
#include <npsdk/npupp.h>
#pragma pack( pop, 8 )
#include <plugin/plcom.hxx>
//==================================================================================================
class PluginComm_Impl
: public PluginComm
{
public:
PluginComm_Impl( const rtl::OUString& rMIME, const rtl::OUString& rName, HWND hWnd );
virtual ~PluginComm_Impl();
public:
virtual NPError NPP_Destroy( NPP instance, NPSavedData** save );
virtual NPError NPP_DestroyStream( NPP instance, NPStream* stream, NPError reason );
virtual void * NPP_GetJavaClass();
virtual NPError NPP_Initialize();
virtual NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
char* argn[], char* argv[], NPSavedData *saved );
virtual NPError NPP_NewStream( NPP instance, NPMIMEType type, NPStream* stream,
NPBool seekable, uint16* stype );
virtual void NPP_Print( NPP instance, NPPrint* platformPrint );
virtual NPError NPP_SetWindow( NPP instance, NPWindow* window );
virtual void NPP_Shutdown();
virtual void NPP_StreamAsFile( NPP instance, NPStream* stream, const char* fname );
virtual void NPP_URLNotify( NPP instance, const char* url,
NPReason reason, void* notifyData );
virtual int32 NPP_Write( NPP instance, NPStream* stream, int32 offset,
int32 len, void* buffer );
virtual int32 NPP_WriteReady( NPP instance, NPStream* stream );
virtual NPError NPP_GetValue( NPP instance, NPPVariable variable, void *ret_alue );
virtual NPError NPP_SetValue( NPP instance, NPNVariable variable, void *ret_alue );
private:
BOOL retrieveFunction( TCHAR* pName, void** ppFunc ) const;
private:
HINSTANCE _plDLL;
NPPluginFuncs _NPPfuncs;
};
#endif
+84
View File
@@ -0,0 +1,84 @@
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1.1.1 $
#
# last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
#
# - GNU Lesser General Public License Version 2.1
# - Sun Industry Standards Source License Version 1.1
#
# Sun Microsystems Inc., October, 2000
#
# GNU Lesser General Public License Version 2.1
# =============================================
# Copyright 2000 by Sun Microsystems, Inc.
# 901 San Antonio Road, Palo Alto, CA 94303, USA
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1, as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
#
# Sun Industry Standards Source License Version 1.1
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.1 (the "License"); You may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at http://www.openoffice.org/license.html.
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning 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=plugin
TARGET=plunx
TARGETTYPE=CUI
.INCLUDE : ..$/util$/makefile.pmk
# --- Files --------------------------------------------------------
SLOFILES=\
$(SLO)$/sysplug.obj \
$(SLO)$/unxmgr.obj
APP1DEF= $(MISC)$/$(TARGET).def
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
.INCLUDE : ..$/util$/target.pmk
+269
View File
@@ -0,0 +1,269 @@
/*************************************************************************
*
* $RCSfile: sysplug.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning 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 <string> // workaround for SUNPRO workshop include conflicts
#include <plugin/impl.hxx>
#include <dlfcn.h>
extern NPNetscapeFuncs aNPNFuncs;
UnxPluginComm::UnxPluginComm( const ::rtl::OString& library ) :
PluginComm( library ),
m_pLibrary( NULL ),
m_bInit( FALSE )
{
m_pLibrary = dlopen( library.getStr(), RTLD_NOW );
// initialize plugin function table
memset( &m_aFuncs, 0, sizeof( m_aFuncs ) );
m_aFuncs.size = sizeof( m_aFuncs );
m_aFuncs.version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
if( m_pLibrary )
{
NPError (*initFunc)(NPNetscapeFuncs*, NPPluginFuncs* );
NPError (*initPlugin)();
initFunc = (NPError(*)(NPNetscapeFuncs*,NPPluginFuncs*))dlsym( m_pLibrary, "NP_Initialize" );
initPlugin = (NPError(*)())dlsym( m_pLibrary, "NPP_Initialize" );
#ifdef DEBUG
if( ! initFunc )
fprintf( stderr, "could not get Symbol NP_Initialize\n" );
if( ! initPlugin )
fprintf( stderr, "could not get Symbol NPP_Initialize\n" );
#endif
if( initFunc && initPlugin )
{
NPError aErr = initFunc( &aNPNFuncs, &m_aFuncs );
#ifdef DEBUG
fprintf( stderr, "NP_Initialize returns %d\n", aErr );
#endif
if( aErr )
{
aErr = initPlugin();
#ifdef DEBUG
fprintf( stderr, "NPP_Initialize returns %d\n", aErr );
#endif
}
m_aFuncs.newp = (NPP_NewUPP)dlsym( m_pLibrary, "NPP_New" );
m_aFuncs.destroy = (NPP_DestroyUPP)dlsym( m_pLibrary, "NPP_Destroy" );
m_aFuncs.setwindow = (NPP_SetWindowUPP)dlsym( m_pLibrary, "NPP_SetWindow" );
m_aFuncs.newstream = (NPP_NewStreamUPP)dlsym( m_pLibrary, "NPP_NewStream" );
m_aFuncs.destroystream = (NPP_DestroyStreamUPP)dlsym( m_pLibrary, "NPP_DestroyStream" );
m_aFuncs.asfile = (NPP_StreamAsFileUPP)dlsym( m_pLibrary, "NPP_StreamAsFile" );
m_aFuncs.writeready = (NPP_WriteReadyUPP)dlsym( m_pLibrary, "NPP_WriteReady" );
m_aFuncs.write = (NPP_WriteUPP)dlsym( m_pLibrary, "NPP_Write" );
m_aFuncs.print = (NPP_PrintUPP)dlsym( m_pLibrary, "NPP_Print" );
m_aFuncs.event = NULL;
m_aFuncs.javaClass = NULL;
m_aFuncs.urlnotify = (NPP_URLNotifyUPP)dlsym( m_pLibrary, "NPP_URLNotify" );
m_aFuncs.getvalue =(NPP_GetValueUPP)dlsym( m_pLibrary, "NPP_GetValue" );
m_aFuncs.setvalue =(NPP_SetValueUPP)dlsym( m_pLibrary, "NPP_SetValue" );
m_bInit = TRUE;
}
}
if( ! m_bInit )
{
dlclose( m_pLibrary );
m_pLibrary = NULL;
}
}
UnxPluginComm::~UnxPluginComm()
{
if( m_bInit && m_pLibrary )
{
NPP_ShutdownUPP pFunc = (NPP_ShutdownUPP)dlsym( m_pLibrary,"NPP_Shutdown");
if( pFunc)
pFunc();
dlclose( m_pLibrary );
}
}
//--------------------------------------------------------------------------------------------------
NPError UnxPluginComm::NPP_Destroy( NPP instance, NPSavedData** save )
{
DBG_ASSERT( m_aFuncs.destroy, "### NPP_Destroy(): null pointer in NPP functions table!" );
return (m_aFuncs.destroy
? m_aFuncs.destroy( instance, save )
: NPERR_GENERIC_ERROR);
}
//--------------------------------------------------------------------------------------------------
NPError UnxPluginComm::NPP_DestroyStream( NPP instance, NPStream* stream, NPError reason )
{
DBG_ASSERT( m_aFuncs.destroystream, "### NPP_DestroyStream(): null pointer in NPP functions table!" );
return (m_aFuncs.destroystream
? m_aFuncs.destroystream( instance, stream, reason )
: NPERR_GENERIC_ERROR);
}
//--------------------------------------------------------------------------------------------------
NPError UnxPluginComm::NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
char* argn[], char* argv[], NPSavedData *saved )
{
DBG_ASSERT( m_aFuncs.newp, "### NPP_New(): null pointer in NPP functions table!" );
return (m_aFuncs.newp
? m_aFuncs.newp( pluginType, instance, mode, argc, argn, argv, saved )
: NPERR_GENERIC_ERROR);
}
//--------------------------------------------------------------------------------------------------
NPError UnxPluginComm::NPP_NewStream( NPP instance, NPMIMEType type, NPStream* stream,
NPBool seekable, uint16* stype )
{
DBG_ASSERT( m_aFuncs.newstream, "### NPP_NewStream(): null pointer in NPP functions table!" );
return (m_aFuncs.newstream
? m_aFuncs.newstream( instance, type, stream, seekable, stype )
: NPERR_GENERIC_ERROR);
}
//--------------------------------------------------------------------------------------------------
void UnxPluginComm::NPP_Print( NPP instance, NPPrint* platformPrint )
{
DBG_ASSERT( m_aFuncs.print, "### NPP_Print(): null pointer in NPP functions table!" );
if (m_aFuncs.print)
m_aFuncs.print( instance, platformPrint );
}
//--------------------------------------------------------------------------------------------------
NPError UnxPluginComm::NPP_SetWindow( NPP instance, NPWindow* window )
{
DBG_ASSERT( m_aFuncs.setwindow, "### NPP_SetWindow(): null pointer in NPP functions table!" );
return (m_aFuncs.setwindow
? m_aFuncs.setwindow( instance, window )
: NPERR_GENERIC_ERROR);
}
//--------------------------------------------------------------------------------------------------
void UnxPluginComm::NPP_StreamAsFile( NPP instance, NPStream* stream, const char* fname )
{
DBG_ASSERT( m_aFuncs.asfile, "### NPP_StreamAsFile(): null pointer in NPP functions table!" );
if (m_aFuncs.asfile)
m_aFuncs.asfile( instance, stream, fname );
}
//--------------------------------------------------------------------------------------------------
void UnxPluginComm::NPP_URLNotify( NPP instance, const char* url, NPReason reason, void* notifyData )
{
DBG_ASSERT( m_aFuncs.urlnotify, "### NPP_URLNotify(): null pointer in NPP functions table!" );
if (m_aFuncs.urlnotify)
m_aFuncs.urlnotify( instance, url, reason, notifyData );
}
//--------------------------------------------------------------------------------------------------
int32 UnxPluginComm::NPP_Write( NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer )
{
DBG_ASSERT( m_aFuncs.write, "### NPP_Write(): null pointer in NPP functions table!" );
return (m_aFuncs.write
? m_aFuncs.write( instance, stream, offset, len, buffer )
: 0);
}
//--------------------------------------------------------------------------------------------------
int32 UnxPluginComm::NPP_WriteReady( NPP instance, NPStream* stream )
{
DBG_ASSERT( m_aFuncs.writeready, "### NPP_WriteReady(): null pointer in NPP functions table!" );
return (m_aFuncs.writeready
? m_aFuncs.writeready( instance, stream )
: 0);
}
//--------------------------------------------------------------------------------------------------
NPError UnxPluginComm::NPP_GetValue( NPP instance, NPPVariable variable, void *ret_alue )
{
DBG_ASSERT( m_aFuncs.getvalue, "### NPP_GetValue(): null pointer in NPP functions table!" );
return (m_aFuncs.getvalue
? m_aFuncs.getvalue( instance, variable, ret_alue )
: NPERR_GENERIC_ERROR);
}
//--------------------------------------------------------------------------------------------------
NPError UnxPluginComm::NPP_SetValue( NPP instance, NPNVariable variable, void *ret_alue )
{
DBG_ASSERT( m_aFuncs.setvalue, "### NPP_SetValue(): null pointer in NPP functions table!" );
return (m_aFuncs.setvalue
? m_aFuncs.setvalue( instance, variable, ret_alue )
: NPERR_GENERIC_ERROR);
}
//--------------------------------------------------------------------------------------------------
void* UnxPluginComm::NPP_GetJavaClass()
{
DBG_ERROR( "no java class available!" );
return 0;
}
//--------------------------------------------------------------------------------------------------
NPError UnxPluginComm::NPP_Initialize()
{
return NPERR_NO_ERROR;
}
//--------------------------------------------------------------------------------------------------
void UnxPluginComm::NPP_Shutdown()
{
}
+197
View File
@@ -0,0 +1,197 @@
/*************************************************************************
*
* $RCSfile: unxmgr.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning 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 SOLARIS
#include <limits>
#endif
#if STLPORT_VERSION>=321
#include <cstdarg>
#endif
#include <sys/stat.h>
#include <dlfcn.h>
#include <vcl/svapp.hxx>
#include <plugin/impl.hxx>
#include <dirent.h>
// Unix specific implementation
static ::com::sun::star::plugin::PluginDescription** CheckPlugin( const ByteString& rPath, int& rDescriptions )
{
::com::sun::star::plugin::PluginDescription** pRet = NULL;
rDescriptions = 0;
struct stat aStat;
if( stat( rPath.GetBuffer(), &aStat ) )
return NULL;
void *pLib = dlopen( rPath.GetBuffer(), RTLD_LAZY );
if( ! pLib )
return NULL;
char*(*pNP_GetMIMEDescription)() = (char*(*)())
dlsym( pLib, "NP_GetMIMEDescription" );
if( pNP_GetMIMEDescription )
{
ByteString aMIME = pNP_GetMIMEDescription();
char cTok = ';';
if( aMIME.GetTokenCount( ';' ) > 2 )
cTok = ';';
if( aMIME.GetTokenCount( ':' ) > 2 )
cTok = ':';
ByteString aExtension = aMIME.GetToken( 1, cTok );
int nExtensions = aExtension.GetTokenCount( ',' );
pRet = new ::com::sun::star::plugin::PluginDescription*[ nExtensions ];
for( int i = 0; i < nExtensions; i++ )
{
pRet[i] = new ::com::sun::star::plugin::PluginDescription;
pRet[i]->PluginName = String( rPath, gsl_getSystemTextEncoding() );
pRet[i]->Mimetype = String( aMIME.GetToken( 0, cTok ), gsl_getSystemTextEncoding() );
String aExt( RTL_CONSTASCII_USTRINGPARAM( "*." ) );
aExt += String( aExtension.GetToken( i, ',' ).EraseLeadingChars().EraseTrailingChars(), gsl_getSystemTextEncoding() );
pRet[i]->Extension = aExt;
pRet[i]->Description= String( aMIME.GetToken( 2, cTok ), gsl_getSystemTextEncoding() );
}
rDescriptions = nExtensions;
}
// some libraries register atexit handlers when loaded
// (e.g. g++ made libraries register global destructors)
// not closing them does prevent them to be called when already unloaded
// dlclose( pLib );
return pRet;
}
Sequence< ::com::sun::star::plugin::PluginDescription > XPluginManager_Impl::getPluginDescriptions()
{
static Sequence< ::com::sun::star::plugin::PluginDescription > aDescriptions;
static BOOL bHavePlugins = FALSE;
if( ! bHavePlugins )
{
NAMESPACE_STD(list)< ::com::sun::star::plugin::PluginDescription* > aPlugins;
int i;
// unix: search for plugins in /usr/lib/netscape/plugins,
// ~/.netscape/plugins und NPX_PLUGIN_PATH
// additionally: search in PluginsPath
const char* pEnv = getenv( "HOME" );
String aSearchPath( RTL_CONSTASCII_USTRINGPARAM( "/usr/lib/netscape/plugins:" ) );
aSearchPath += String( pEnv ? pEnv : "", gsl_getSystemTextEncoding() );
aSearchPath += String( RTL_CONSTASCII_USTRINGPARAM( "/.netscape/plugins:" ) );
pEnv = getenv( "NPX_PLUGIN_PATH" );
aSearchPath += String( pEnv ? pEnv : "", gsl_getSystemTextEncoding() );
const Sequence< ::rtl::OUString >& rPaths = PluginManager::getAdditionalSearchPaths();
for( i = 0; i < rPaths.getLength(); i++ )
{
aSearchPath += ':';
aSearchPath += String( rPaths.getConstArray()[i] );
}
int nPaths = aSearchPath.GetTokenCount( ':' );
for( i = 0; i < nPaths; i++ )
{
ByteString aPath( aSearchPath.GetToken( i, ':' ), gsl_getSystemTextEncoding() );
if( aPath.Len() )
{
DIR* pDIR = opendir( aPath.GetBuffer() );
struct dirent aEntry;
struct dirent* pEntry;
while( pDIR && readdir_r( pDIR, &aEntry, &pEntry ) )
{
struct stat aStat;
ByteString aFile( aPath );
aFile += '/';
aFile += aEntry.d_name;
if( ! stat( aFile.GetBuffer(), &aStat ) &&
S_ISREG( aStat.st_mode ) &&
! strncmp( aEntry.d_name, "libnullplugin", 13 )
)
{
int nStructs;
::com::sun::star::plugin::PluginDescription** pStructs =
CheckPlugin( aFile, nStructs );
if( pStructs )
{
for( int i = 0; i < nStructs; i++ )
aPlugins.push_back( pStructs[i] );
delete pStructs;
}
}
}
}
}
aDescriptions = Sequence< ::com::sun::star::plugin::PluginDescription >( aPlugins.size() );
NAMESPACE_STD(list)< ::com::sun::star::plugin::PluginDescription* >::iterator iter;
for( iter = aPlugins.begin(), i=0; iter != aPlugins.end(); ++iter ,i++ )
{
aDescriptions.getArray()[ i ] = **iter;
delete *iter;
}
aPlugins.clear();
bHavePlugins = TRUE;
}
return aDescriptions;
}
+125
View File
@@ -0,0 +1,125 @@
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1.1.1 $
#
# last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
#
# - GNU Lesser General Public License Version 2.1
# - Sun Industry Standards Source License Version 1.1
#
# Sun Microsystems Inc., October, 2000
#
# GNU Lesser General Public License Version 2.1
# =============================================
# Copyright 2000 by Sun Microsystems, Inc.
# 901 San Antonio Road, Palo Alto, CA 94303, USA
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1, as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
#
# Sun Industry Standards Source License Version 1.1
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.1 (the "License"); You may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at http://www.openoffice.org/license.html.
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning 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=extensions
TARGET=pl
USE_DEFFILE=TRUE
GEN_HID=TRUE
# --- Settings -----------------------------------------------------
.INCLUDE : svpre.mk
.INCLUDE : settings.mk
.INCLUDE : sv.mk
# --- Files --------------------------------------------------------
LIB1TARGET = $(SLB)$/plall.lib
LIB1FILES = \
$(SLB)$/plbase.lib \
$(SHL1LINKLIB)
SHL1TARGET= $(TARGET)$(UPD)$(DLLPOSTFIX)
.IF "$(GUI)" == "UNX"
SHL1LINKLIB = $(SLB)$/plunx.lib
.ENDIF
.IF "$(GUI)" == "WNT"
SHL1LINKLIB = $(SLB)$/plwin.lib
SHL1OWNLIB = \
version.lib \
ole32.lib \
advapi32.lib
.ENDIF
.IF "$(GUI)" == "OS2"
SHL1LINKLIB = $(SLB)$/plos2.lib
.ENDIF
SHL1STDLIBS=\
$(SHL1OWNLIB) \
$(VCLLIB) \
$(TOOLSLIB) \
$(TKLIB) \
$(VOSLIB) \
$(CPPUHELPERLIB) \
$(CPPULIB) \
$(SALLIB)
#SHL1DEPN= $(SLB)/sfx.lib $(L)$/itools.lib $(L)$/ivcl.lib
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
SHL1IMPLIB = i$(TARGET)
SHL1LIBS = $(LIB1TARGET)
DEF1NAME =$(SHL1TARGET)
DEF1EXPORTFILE= exports.dxp
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
@@ -0,0 +1,69 @@
#*************************************************************************
#
# $RCSfile: makefile.pmk,v $
#
# $Revision: 1.1.1.1 $
#
# last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
#
# - GNU Lesser General Public License Version 2.1
# - Sun Industry Standards Source License Version 1.1
#
# Sun Microsystems Inc., October, 2000
#
# GNU Lesser General Public License Version 2.1
# =============================================
# Copyright 2000 by Sun Microsystems, Inc.
# 901 San Antonio Road, Palo Alto, CA 94303, USA
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1, as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
#
# Sun Industry Standards Source License Version 1.1
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.1 (the "License"); You may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at http://www.openoffice.org/license.html.
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning the Software.
#
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
#
# Copyright: 2000 by Sun Microsystems, Inc.
#
# All Rights Reserved.
#
# Contributor(s): _______________________________________
#
#
#
#*************************************************************************
PDBTARGET=pl
NOUNODOC=true
.INCLUDE : svpre.mk
.INCLUDE : settings.mk
.INCLUDE : sv.mk
+96
View File
@@ -0,0 +1,96 @@
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1.1.1 $
#
# last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
#
# - GNU Lesser General Public License Version 2.1
# - Sun Industry Standards Source License Version 1.1
#
# Sun Microsystems Inc., October, 2000
#
# GNU Lesser General Public License Version 2.1
# =============================================
# Copyright 2000 by Sun Microsystems, Inc.
# 901 San Antonio Road, Palo Alto, CA 94303, USA
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1, as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
#
# Sun Industry Standards Source License Version 1.1
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.1 (the "License"); You may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at http://www.openoffice.org/license.html.
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning 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=plugin
TARGET=plwin
ENABLE_EXCEPTIONS=TRUE
# --- Settings -----------------------------------------------------
.IF "$(GUI)" == "WNT"
.INCLUDE : ..$/util$/makefile.pmk
# --- Types -------------------------------------
UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
UNOUCROUT=$(OUT)$/inc$/$(PRJNAME)
INCPRE+=$(UNOUCROUT)
# --- Types -------------------------------------
SLOFILES = $(SLO)$/winmgr.obj \
$(SLO)$/sysplug.obj
#SRCFILES = app.src
.ENDIF
# ------------------------------------------------------------------
.INCLUDE : target.mk
.INCLUDE : ..$/util$/target.pmk
+300
View File
@@ -0,0 +1,300 @@
/*************************************************************************
*
* $RCSfile: sysplug.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning 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 <plugin/impl.hxx>
#ifdef WNT
#if _MSC_VER >= 1200
#include <tools/prewin.h>
#else
#include <tools/presys.h>
#endif
#endif
#if STLPORT_VERSION < 321
#include <stl/map.h>
#endif
#include <windows.h>
#include <string.h>
#include <tchar.h>
#include <winreg.h>
#include <winbase.h>
#include <objbase.h>
#ifdef WNT
#if _MSC_VER >= 1200
#include <tools/postwin.h>
#else
#include <tools/postsys.h>
#endif
#endif
#if STLPORT_VERSION >= 321
#include <stl/list>
#include <stl/map>
#include <stl/algorithm>
#endif
extern NPNetscapeFuncs aNPNFuncs;
#include <tools/debug.hxx>
using namespace rtl;
//--------------------------------------------------------------------------------------------------
PluginComm_Impl::PluginComm_Impl( const OUString& rMIME, const OUString& rName, HWND hWnd )
: PluginComm( OUStringToOString( rName, RTL_TEXTENCODING_MS_1252 ) )
{
// initialize plugin function table
memset( &_NPPfuncs, 0, sizeof( _NPPfuncs ) );
#ifdef UNICODE
_plDLL = ::LoadLibrary( rName.getStr() );
#else
OString aStr( OUStringToOString( rName, RTL_TEXTENCODING_MS_1252 ) );
_plDLL = ::LoadLibrary( aStr.getStr() );
#endif
DBG_ASSERT( _plDLL, "### loading plugin dll failed!" );
NPError nErr;
NPError (WINAPI * pEntry)( NPPluginFuncs* );
if (_plDLL && retrieveFunction( _T("NP_GetEntryPoints"), (void**)&pEntry ))
{
_NPPfuncs.size = sizeof( _NPPfuncs );
_NPPfuncs.version = 0;
nErr = (*pEntry)( &_NPPfuncs );
DBG_ASSERT( nErr == NPERR_NO_ERROR, "### NP_GetEntryPoints() failed!" );
DBG_ASSERT( (_NPPfuncs.version >> 8) >= NP_VERSION_MAJOR,
"### version failure!" );
NPError (WINAPI * pInit)( NPNetscapeFuncs* );
if (nErr == NPERR_NO_ERROR &&
(_NPPfuncs.version >> 8) >= NP_VERSION_MAJOR &&
(retrieveFunction( _T("NP_Initialize"), (void**)&pInit ) ||
retrieveFunction( _T("NP_PluginInit"), (void**)&pInit )))
{
nErr = (*pInit)( &aNPNFuncs );
DBG_ASSERT( nErr == NPERR_NO_ERROR, "### NP_Initialize() failed!" );
// WIN obsolete: called by NP_Initialize()
// nErr = NPP_Initialize();
// DBG_ASSERT( nErr == NPERR_NO_ERROR, "### NPP_Initialize() failed!" );
}
}
}
//--------------------------------------------------------------------------------------------------
PluginComm_Impl::~PluginComm_Impl()
{
if (_plDLL)
{
// NPP_Shutdown();
NPError (WINAPI * pShutdown)();
if (retrieveFunction( _T("NP_Shutdown"), (void**)&pShutdown ))
{
NPError nErr = (*pShutdown)();
DBG_ASSERT( nErr == NPERR_NO_ERROR, "### NP_Shutdown() failed!" );
}
BOOL bRet = ::FreeLibrary( _plDLL );
DBG_ASSERT( bRet, "### unloading plugin dll failed!" );
_plDLL = NULL;
}
}
//--------------------------------------------------------------------------------------------------
BOOL PluginComm_Impl::retrieveFunction( TCHAR* pName, void** ppFunc ) const
{
if( ! _plDLL )
return FALSE;
*ppFunc = (void*)::GetProcAddress( _plDLL, pName );
return (*ppFunc != NULL);
}
//--------------------------------------------------------------------------------------------------
NPError PluginComm_Impl::NPP_Destroy( NPP instance, NPSavedData** save )
{
DBG_ASSERT( _NPPfuncs.destroy, "### NPP_Destroy(): null pointer in NPP functions table!" );
return (_NPPfuncs.destroy
? (*_NPPfuncs.destroy)( instance, save )
: NPERR_GENERIC_ERROR);
}
//--------------------------------------------------------------------------------------------------
NPError PluginComm_Impl::NPP_DestroyStream( NPP instance, NPStream* stream, NPError reason )
{
DBG_ASSERT( _NPPfuncs.destroystream, "### NPP_DestroyStream(): null pointer in NPP functions table!" );
return (_NPPfuncs.destroystream
? (*_NPPfuncs.destroystream)( instance, stream, reason )
: NPERR_GENERIC_ERROR);
}
//--------------------------------------------------------------------------------------------------
NPError PluginComm_Impl::NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
char* argn[], char* argv[], NPSavedData *saved )
{
DBG_ASSERT( _NPPfuncs.newp, "### NPP_New(): null pointer in NPP functions table!" );
return (_NPPfuncs.newp
? (*_NPPfuncs.newp)( pluginType, instance, mode, argc, argn, argv, saved )
: NPERR_GENERIC_ERROR);
}
//--------------------------------------------------------------------------------------------------
NPError PluginComm_Impl::NPP_NewStream( NPP instance, NPMIMEType type, NPStream* stream,
NPBool seekable, uint16* stype )
{
DBG_ASSERT( _NPPfuncs.newstream, "### NPP_NewStream(): null pointer in NPP functions table!" );
return (_NPPfuncs.newstream
? (*_NPPfuncs.newstream)( instance, type, stream, seekable, stype )
: NPERR_GENERIC_ERROR);
}
//--------------------------------------------------------------------------------------------------
void PluginComm_Impl::NPP_Print( NPP instance, NPPrint* platformPrint )
{
DBG_ASSERT( _NPPfuncs.print, "### NPP_Print(): null pointer in NPP functions table!" );
if (_NPPfuncs.print)
(*_NPPfuncs.print)( instance, platformPrint );
}
//--------------------------------------------------------------------------------------------------
NPError PluginComm_Impl::NPP_SetWindow( NPP instance, NPWindow* window )
{
DBG_ASSERT( _NPPfuncs.setwindow, "### NPP_SetWindow(): null pointer in NPP functions table!" );
return (_NPPfuncs.setwindow
? (*_NPPfuncs.setwindow)( instance, window )
: NPERR_GENERIC_ERROR);
}
//--------------------------------------------------------------------------------------------------
void PluginComm_Impl::NPP_StreamAsFile( NPP instance, NPStream* stream, const char* fname )
{
DBG_ASSERT( _NPPfuncs.asfile, "### NPP_StreamAsFile(): null pointer in NPP functions table!" );
if (_NPPfuncs.asfile)
(*_NPPfuncs.asfile)( instance, stream, fname );
}
//--------------------------------------------------------------------------------------------------
void PluginComm_Impl::NPP_URLNotify( NPP instance, const char* url, NPReason reason, void* notifyData )
{
DBG_ASSERT( _NPPfuncs.urlnotify, "### NPP_URLNotify(): null pointer in NPP functions table!" );
if (_NPPfuncs.urlnotify)
(*_NPPfuncs.urlnotify)( instance, url, reason, notifyData );
}
//--------------------------------------------------------------------------------------------------
int32 PluginComm_Impl::NPP_Write( NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer )
{
DBG_ASSERT( _NPPfuncs.write, "### NPP_Write(): null pointer in NPP functions table!" );
return (_NPPfuncs.write
? (*_NPPfuncs.write)( instance, stream, offset, len, buffer )
: 0);
}
//--------------------------------------------------------------------------------------------------
int32 PluginComm_Impl::NPP_WriteReady( NPP instance, NPStream* stream )
{
DBG_ASSERT( _NPPfuncs.writeready, "### NPP_WriteReady(): null pointer in NPP functions table!" );
return (_NPPfuncs.writeready
? (*_NPPfuncs.writeready)( instance, stream )
: 0);
}
//--------------------------------------------------------------------------------------------------
NPError PluginComm_Impl::NPP_GetValue( NPP instance, NPPVariable variable, void *ret_alue )
{
DBG_ASSERT( _NPPfuncs.getvalue, "### NPP_GetValue(): null pointer in NPP functions table!" );
return (_NPPfuncs.getvalue
? (*_NPPfuncs.getvalue)( instance, variable, ret_alue )
: NPERR_GENERIC_ERROR);
}
//--------------------------------------------------------------------------------------------------
NPError PluginComm_Impl::NPP_SetValue( NPP instance, NPNVariable variable, void *ret_alue )
{
DBG_ASSERT( _NPPfuncs.setvalue, "### NPP_SetValue(): null pointer in NPP functions table!" );
return (_NPPfuncs.setvalue
? (*_NPPfuncs.setvalue)( instance, variable, ret_alue )
: NPERR_GENERIC_ERROR);
}
//--------------------------------------------------------------------------------------------------
void * PluginComm_Impl::NPP_GetJavaClass()
{
DBG_ERROR( "no java class available!" );
return 0;
}
//--------------------------------------------------------------------------------------------------
NPError PluginComm_Impl::NPP_Initialize()
{
return NPERR_NO_ERROR;
}
//--------------------------------------------------------------------------------------------------
void PluginComm_Impl::NPP_Shutdown()
{
NPP_ShutdownUPP pFunc;
if (retrieveFunction( _T("NPP_Shutdown"), (void**)&pFunc ))
(*pFunc)();
}

Some files were not shown because too many files have changed in this diff Show More