diff options
218 files changed, 72880 insertions, 0 deletions
diff --git a/UnoControls/inc/basecontainercontrol.hxx b/UnoControls/inc/basecontainercontrol.hxx new file mode 100644 index 000000000000..8bb2375d742b --- /dev/null +++ b/UnoControls/inc/basecontainercontrol.hxx @@ -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 diff --git a/UnoControls/inc/basecontrol.hxx b/UnoControls/inc/basecontrol.hxx new file mode 100644 index 000000000000..9de65478c810 --- /dev/null +++ b/UnoControls/inc/basecontrol.hxx @@ -0,0 +1,1427 @@ +/************************************************************************* + * + * $RCSfile: basecontrol.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_BASECONTROL_CTRL_HXX +#define _UNOCONTROLS_BASECONTROL_CTRL_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_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 + +#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_AWT_XVIEW_HPP_ +#include <com/sun/star/awt/XView.hpp> +#endif + +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +#ifndef _CPPUHELPER_COMPONENT_HXX_ +#include <cppuhelper/component.hxx> +#endif + +//____________________________________________________________________________________________________________ +// includes of my project +//____________________________________________________________________________________________________________ + +#ifndef _UNOCONTROLS_MULTIPLEXER_HXX +#include "multiplexer.hxx" +#endif + +//____________________________________________________________________________________________________________ +// "namespaces" +//____________________________________________________________________________________________________________ + +namespace unocontrols{ + +#define UNO3_ANY ::com::sun::star::uno::Any +#define UNO3_EVENTOBJECT ::com::sun::star::lang::EventObject +#define UNO3_MUTEX ::osl::Mutex +#define UNO3_OCOMPONENTHELPER ::cppu::OComponentHelper +#define UNO3_OUSTRING ::rtl::OUString +#define UNO3_PAINTEVENT ::com::sun::star::awt::PaintEvent +#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_WINDOWDESCRIPTOR ::com::sun::star::awt::WindowDescriptor +#define UNO3_XCONTROL ::com::sun::star::awt::XControl +#define UNO3_XCONTROLMODEL ::com::sun::star::awt::XControlModel +#define UNO3_XEVENTLISTENER ::com::sun::star::lang::XEventListener +#define UNO3_XFOCUSLISTENER ::com::sun::star::awt::XFocusListener +#define UNO3_XGRAPHICS ::com::sun::star::awt::XGraphics +#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_XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory +#define UNO3_XPAINTLISTENER ::com::sun::star::awt::XPaintListener +#define UNO3_XSERVICEINFO ::com::sun::star::lang::XServiceInfo +#define UNO3_XTOOLKIT ::com::sun::star::awt::XToolkit +#define UNO3_XVIEW ::com::sun::star::awt::XView +#define UNO3_XWINDOW ::com::sun::star::awt::XWindow +#define UNO3_XWINDOWLISTENER ::com::sun::star::awt::XWindowListener +#define UNO3_XWINDOWPEER ::com::sun::star::awt::XWindowPeer +#define UNO3_XINTERFACE ::com::sun::star::uno::XInterface + +//____________________________________________________________________________________________________________ +// macros +//____________________________________________________________________________________________________________ + +#define TRGB_COLORDATA(TRANSPARENCE,RED,GREEN,BLUE) \ + ((sal_Int32)(((sal_uInt32)((sal_uInt8)(BLUE##))))|(((sal_uInt32)((sal_uInt8)(GREEN##)))<<8)|(((sal_uInt32)((sal_uInt8)(RED##)))<<16)|(((sal_uInt32)((sal_uInt8)(TRANSPARENCE##)))<<24)) + +//____________________________________________________________________________________________________________ +// structs +//____________________________________________________________________________________________________________ + +struct IMPL_MutexContainer +{ + // Is necassery to initialize "BaseControl" and make this class thread-safe. + UNO3_MUTEX m_aMutex ; +}; + +//____________________________________________________________________________________________________________ +// classes +//____________________________________________________________________________________________________________ + +class BaseControl : public UNO3_XSERVICEINFO + , public UNO3_XPAINTLISTENER + , public UNO3_XVIEW + , public UNO3_XWINDOW + , public UNO3_XCONTROL + , public IMPL_MutexContainer + , public UNO3_OCOMPONENTHELPER +{ + +//____________________________________________________________________________________________________________ +// public methods +//____________________________________________________________________________________________________________ + +public: + + //________________________________________________________________________________________________________ + // construct/destruct + //________________________________________________________________________________________________________ + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + BaseControl( const UNO3_REFERENCE< UNO3_XMULTISERVICEFACTORY >& xFactory ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual ~BaseControl(); + + //________________________________________________________________________________________________________ + // 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 ); + + /**_______________________________________________________________________________________________________ + @short get implementation id + @descr This ID is neccessary for UNO-caching. If there no ID, cache is disabled. + Another way, cache is enabled. + + @seealso XTypeProvider + + @param - + + @return ID as Sequence of byte + + @onerror A RuntimeException is thrown. + */ + + virtual UNO3_SEQUENCE< sal_Int8 > SAL_CALL getImplementationId() throw( UNO3_RUNTIMEEXCEPTION ); + + //________________________________________________________________________________________________________ + // XAggregation + //________________________________________________________________________________________________________ + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL setDelegator( const UNO3_REFERENCE< UNO3_XINTERFACE >& xDelegator ) throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual UNO3_ANY SAL_CALL queryAggregation( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION ); + + //________________________________________________________________________________________________________ + // XServiceInfo + //________________________________________________________________________________________________________ + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual sal_Bool SAL_CALL supportsService( const UNO3_OUSTRING& sServiceName ) throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual UNO3_OUSTRING SAL_CALL getImplementationName() throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual UNO3_SEQUENCE< UNO3_OUSTRING > SAL_CALL getSupportedServiceNames() throw( UNO3_RUNTIMEEXCEPTION ); + + //________________________________________________________________________________________________________ + // XComponent + //________________________________________________________________________________________________________ + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL dispose() throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL addEventListener( const UNO3_REFERENCE< UNO3_XEVENTLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL removeEventListener( const UNO3_REFERENCE< UNO3_XEVENTLISTENER >& xListener ) 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 void SAL_CALL setContext( const UNO3_REFERENCE< UNO3_XINTERFACE >& xContext ) throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual sal_Bool SAL_CALL setModel( const UNO3_REFERENCE< UNO3_XCONTROLMODEL >& xModel ) throw( UNO3_RUNTIMEEXCEPTION ) = 0 ; + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL setDesignMode( sal_Bool bOn ) throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual UNO3_REFERENCE< UNO3_XINTERFACE > SAL_CALL getContext() throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual UNO3_REFERENCE< UNO3_XCONTROLMODEL > SAL_CALL getModel() throw( UNO3_RUNTIMEEXCEPTION ) = 0; + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual UNO3_REFERENCE< UNO3_XWINDOWPEER > SAL_CALL getPeer() throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual UNO3_REFERENCE< UNO3_XVIEW > SAL_CALL getView() throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual sal_Bool SAL_CALL isDesignMode() throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual sal_Bool SAL_CALL isTransparent() 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 ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL setVisible( sal_Bool bVisible ) throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL setEnable( sal_Bool bEnable ) throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL setFocus() throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual UNO3_RECTANGLE SAL_CALL getPosSize() throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL addWindowListener( const UNO3_REFERENCE< UNO3_XWINDOWLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL addFocusListener( const UNO3_REFERENCE< UNO3_XFOCUSLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL addKeyListener( const UNO3_REFERENCE< UNO3_XKEYLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL addMouseListener( const UNO3_REFERENCE< UNO3_XMOUSELISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL addMouseMotionListener( const UNO3_REFERENCE< UNO3_XMOUSEMOTIONLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL addPaintListener( const UNO3_REFERENCE< UNO3_XPAINTLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL removeWindowListener( const UNO3_REFERENCE< UNO3_XWINDOWLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL removeFocusListener( const UNO3_REFERENCE< UNO3_XFOCUSLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL removeKeyListener( const UNO3_REFERENCE< UNO3_XKEYLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL removeMouseListener( const UNO3_REFERENCE< UNO3_XMOUSELISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL removeMouseMotionListener( const UNO3_REFERENCE< UNO3_XMOUSEMOTIONLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL removePaintListener( const UNO3_REFERENCE< UNO3_XPAINTLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION ); + + //________________________________________________________________________________________________________ + // XView + //________________________________________________________________________________________________________ + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL draw( sal_Int32 nX , + sal_Int32 nY ) throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @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 void SAL_CALL setZoom( float fZoomX , + float fZoomY ) throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual UNO3_REFERENCE< UNO3_XGRAPHICS > SAL_CALL getGraphics() throw( UNO3_RUNTIMEEXCEPTION ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual UNO3_SIZE SAL_CALL getSize() throw( UNO3_RUNTIMEEXCEPTION ); + + //________________________________________________________________________________________________________ + // UNO3_XEVENTLISTENER + //________________________________________________________________________________________________________ + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL disposing( const UNO3_EVENTOBJECT& rSource ) throw( UNO3_RUNTIMEEXCEPTION ); + + //________________________________________________________________________________________________________ + // XPaintListener + //________________________________________________________________________________________________________ + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + virtual void SAL_CALL windowPaint( const UNO3_PAINTEVENT& rEvent ) throw( UNO3_RUNTIMEEXCEPTION ); + + //________________________________________________________________________________________________________ + // impl but public method 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: + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + const UNO3_REFERENCE< UNO3_XMULTISERVICEFACTORY > impl_getMultiServiceFactory(); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + const UNO3_REFERENCE< UNO3_XWINDOW > impl_getPeerWindow(); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + const UNO3_REFERENCE< UNO3_XGRAPHICS > impl_getGraphicsPeer(); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + const sal_Int32& impl_getWidth(); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + const sal_Int32& impl_getHeight(); + + /**_______________________________________________________________________________________________________ + @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 ); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + UNO3_REFERENCE< UNO3_XINTERFACE > impl_getDelegator(); + +//____________________________________________________________________________________________________________ +// private methods +//____________________________________________________________________________________________________________ + +private: + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + void impl_releasePeer(); + + /**_______________________________________________________________________________________________________ + @short - + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + */ + + OMRCListenerMultiplexerHelper* impl_getMultiplexer(); + +//____________________________________________________________________________________________________________ +// private variables +//____________________________________________________________________________________________________________ + +private: + + UNO3_REFERENCE< UNO3_XMULTISERVICEFACTORY > m_xFactory ; + UNO3_REFERENCE< UNO3_XINTERFACE > m_xDelegator ; + OMRCListenerMultiplexerHelper* m_pMultiplexer ; // multiplex events + UNO3_REFERENCE< UNO3_XINTERFACE > m_xMultiplexer ; + UNO3_REFERENCE< UNO3_XINTERFACE > m_xContext ; + UNO3_REFERENCE< UNO3_XWINDOWPEER > m_xPeer ; + UNO3_REFERENCE< UNO3_XWINDOW > m_xPeerWindow ; + UNO3_REFERENCE< UNO3_XGRAPHICS > m_xGraphicsView ; // graphics for ::com::sun::star::awt::XView-operations + UNO3_REFERENCE< UNO3_XGRAPHICS > m_xGraphicsPeer ; // graphics for painting on a peer + sal_Int32 m_nX ; // Position ... + sal_Int32 m_nY ; + sal_Int32 m_nWidth ; // ... and size of window + sal_Int32 m_nHeight ; + sal_Bool m_bVisible ; // Some state flags + sal_Bool m_bInDesignMode ; + sal_Bool m_bEnable ; + +}; // class BaseControl + +} // namespace unocontrols + +#endif // ifndef _UNOCONTROLS_BASECONTROL_CTRL_HXX diff --git a/UnoControls/inc/definesunocontrols.hxx b/UnoControls/inc/definesunocontrols.hxx new file mode 100644 index 000000000000..cd01036b6b61 --- /dev/null +++ b/UnoControls/inc/definesunocontrols.hxx @@ -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 diff --git a/UnoControls/inc/multiplexer.hxx b/UnoControls/inc/multiplexer.hxx new file mode 100644 index 000000000000..3bfa97917389 --- /dev/null +++ b/UnoControls/inc/multiplexer.hxx @@ -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 diff --git a/UnoControls/prj/d.lst b/UnoControls/prj/d.lst new file mode 100644 index 000000000000..5422546ecf2e --- /dev/null +++ b/UnoControls/prj/d.lst @@ -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 diff --git a/UnoControls/source/base/basecontainercontrol.cxx b/UnoControls/source/base/basecontainercontrol.cxx new file mode 100644 index 000000000000..81733b3eecba --- /dev/null +++ b/UnoControls/source/base/basecontainercontrol.cxx @@ -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 diff --git a/UnoControls/source/base/basecontrol.cxx b/UnoControls/source/base/basecontrol.cxx new file mode 100644 index 000000000000..1587bebac74d --- /dev/null +++ b/UnoControls/source/base/basecontrol.cxx @@ -0,0 +1,1008 @@ +/************************************************************************* + * + * $RCSfile: basecontrol.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_BASECONTROL_CTRL_HXX +#include "basecontrol.hxx" +#endif + +//____________________________________________________________________________________________________________ +// includes of other projects +//____________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_AWT_XDEVICE_HPP_ +#include <com/sun/star/awt/XDevice.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_XDISPLAYBITMAP_HPP_ +#include <com/sun/star/awt/XDisplayBitmap.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_DEVICEINFO_HPP_ +#include <com/sun/star/awt/DeviceInfo.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_WINDOWATTRIBUTE_HPP_ +#include <com/sun/star/awt/WindowAttribute.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_ +#include <com/sun/star/awt/PosSize.hpp> +#endif + +#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 ; + +namespace unocontrols{ + +//____________________________________________________________________________________________________________ +// defines +//____________________________________________________________________________________________________________ + +#define DEFAULT_PMULTIPLEXER NULL +#define DEFAULT_X 0 +#define DEFAULT_Y 0 +#define DEFAULT_WIDTH 100 +#define DEFAULT_HEIGHT 100 +#define DEFAULT_VISIBLE sal_False +#define DEFAULT_INDESIGNMODE sal_False +#define DEFAULT_ENABLE sal_True +#define SERVICE_VCLTOOLKIT "com.sun.star.awt.Toolkit" + +//____________________________________________________________________________________________________________ +// construct/destruct +//____________________________________________________________________________________________________________ + +BaseControl::BaseControl( const Reference< XMultiServiceFactory >& xFactory ) + : IMPL_MutexContainer ( ) + , OComponentHelper ( m_aMutex ) + , m_xFactory ( xFactory ) + , m_pMultiplexer ( DEFAULT_PMULTIPLEXER ) + , m_nX ( DEFAULT_X ) + , m_nY ( DEFAULT_Y ) + , m_nWidth ( DEFAULT_WIDTH ) + , m_nHeight ( DEFAULT_HEIGHT ) + , m_bVisible ( DEFAULT_VISIBLE ) + , m_bInDesignMode ( DEFAULT_INDESIGNMODE ) + , m_bEnable ( DEFAULT_ENABLE ) +{ +} + +BaseControl::~BaseControl() +{ +} + +//____________________________________________________________________________________________________________ +// XInterface +//____________________________________________________________________________________________________________ + +Any SAL_CALL BaseControl::queryInterface( const Type& rType ) throw( RuntimeException ) +{ + Any aReturn ; + if ( m_xDelegator.is() == sal_True ) + { + // If an delegator exist, forward question to his queryInterface. + // Delegator will ask his own queryAggregation! + aReturn = m_xDelegator->queryInterface( rType ); + } + else + { + // If an delegator unknown, forward question to own queryAggregation. + aReturn = queryAggregation( rType ); + } + + return aReturn ; +} + +//____________________________________________________________________________________________________________ +// XInterface +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::acquire() throw( RuntimeException ) +{ + // Attention: + // Don't use mutex or guard in this method!!! Is a method of XInterface. + + // Forward to baseclass + OComponentHelper::acquire(); +} + +//____________________________________________________________________________________________________________ +// XInterface +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::release() throw( RuntimeException ) +{ + // Attention: + // Don't use mutex or guard in this method!!! Is a method of XInterface. + + // Forward to baseclass + OComponentHelper::release(); +} + +//____________________________________________________________________________________________________________ +// XTypeProvider +//____________________________________________________________________________________________________________ + +Sequence< Type > SAL_CALL BaseControl::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< XPaintListener >*)NULL ) , + ::getCppuType(( const Reference< XView >*)NULL ) , + ::getCppuType(( const Reference< XWindow >*)NULL ) , + ::getCppuType(( const Reference< XServiceInfo >*)NULL ) , + ::getCppuType(( const Reference< XControl >*)NULL ) , + OComponentHelper::getTypes() + ); + + // ... and set his address to static pointer! + pTypeCollection = &aTypeCollection ; + } + } + + return pTypeCollection->getTypes(); +} + +//____________________________________________________________________________________________________________ +// XTypeProvider +//____________________________________________________________________________________________________________ + +Sequence< sal_Int8 > SAL_CALL BaseControl::getImplementationId() throw( RuntimeException ) +{ + // Create one Id for all instances of this class. + // Use ethernet address to do this! (sal_True) + + // Optimize this method + // We initialize a static variable only one time. And we don't must use a mutex at every call! + // For the first call; pID is NULL - for the second call pID is different from NULL! + static OImplementationId* pID = NULL ; + + if ( pID == 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 ( pID == NULL ) + { + // Create a new static ID ... + static OImplementationId aID( sal_False ); + // ... and set his address to static pointer! + pID = &aID ; + } + } + + return pID->getImplementationId(); +} + +//____________________________________________________________________________________________________________ +// XAggregation +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::setDelegator( const Reference< XInterface >& xDelegator ) throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard( m_aMutex ); + m_xDelegator = xDelegator ; +} + +//____________________________________________________________________________________________________________ +// XAggregation +//____________________________________________________________________________________________________________ + +Any SAL_CALL BaseControl::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< XPaintListener*> ( this ) , + static_cast< XView* > ( this ) , + static_cast< XWindow* > ( this ) , + static_cast< XServiceInfo* > ( this ) , + static_cast< XControl* > ( 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 OComponentHelper::queryAggregation( aType ); + } +} + +//____________________________________________________________________________________________________________ +// XServiceInfo +//____________________________________________________________________________________________________________ + +OUString SAL_CALL BaseControl::getImplementationName() throw( RuntimeException ) +{ + return impl_getStaticImplementationName(); +} + +//____________________________________________________________________________________________________________ +// XServiceInfo +//____________________________________________________________________________________________________________ + +sal_Bool SAL_CALL BaseControl::supportsService( const OUString& sServiceName ) throw( RuntimeException ) +{ + Sequence< OUString > seqServiceNames = getSupportedServiceNames(); + const OUString* pArray = seqServiceNames.getConstArray(); + for ( sal_Int32 nCounter=0; nCounter<seqServiceNames.getLength(); nCounter++ ) + { + if ( pArray[nCounter] == sServiceName ) + { + return sal_True ; + } + } + return sal_False ; +} + +//____________________________________________________________________________________________________________ +// XServiceInfo +//____________________________________________________________________________________________________________ + +Sequence< OUString > SAL_CALL BaseControl::getSupportedServiceNames() throw( RuntimeException ) +{ + return impl_getStaticSupportedServiceNames(); +} + +//____________________________________________________________________________________________________________ +// XComponent +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::dispose() throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard( m_aMutex ); + + if ( m_pMultiplexer != NULL ) + { + // to all other paint, focus, etc. + m_pMultiplexer->disposeAndClear(); + } + + // set the service manager to disposed + OComponentHelper::dispose(); + + // release context and peer + m_xContext = Reference< XInterface >(); + impl_releasePeer(); + + // release view + if ( m_xGraphicsView.is() == sal_True ) + { + m_xGraphicsView = Reference< XGraphics >(); + } +} + +//____________________________________________________________________________________________________________ +// XComponent +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::addEventListener( const Reference< XEventListener >& xListener ) throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard( m_aMutex ); + OComponentHelper::addEventListener( xListener ); +} + +//____________________________________________________________________________________________________________ +// XComponent +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::removeEventListener( const Reference< XEventListener >& xListener ) throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard( m_aMutex ); + OComponentHelper::removeEventListener( xListener ); +} + +//____________________________________________________________________________________________________________ +// XControl +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::createPeer( const Reference< XToolkit >& xToolkit , + const Reference< XWindowPeer >& xParentPeer ) throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard( m_aMutex ); + + if ( m_xPeer.is() == sal_False ) + { + // use method "BaseControl::getWindowDescriptor()" fot change window attributes !!! + WindowDescriptor* pDescriptor = impl_getWindowDescriptor( xParentPeer ); + + if ( m_bVisible == sal_True ) + { + pDescriptor->WindowAttributes |= WindowAttribute::SHOW ; + } + + // very slow under remote conditions! + // create the window on the server + Reference< XToolkit > xLocalToolkit = xToolkit ; + if ( xLocalToolkit.is() == sal_False ) + { + // but first create wellknown toolkit, if it not exist + xLocalToolkit = Reference< XToolkit > ( m_xFactory->createInstance( OUString::createFromAscii( SERVICE_VCLTOOLKIT ) ), UNO_QUERY ); + } + m_xPeer = xLocalToolkit->createWindow( *pDescriptor ); + m_xPeerWindow = Reference< XWindow >( m_xPeer, UNO_QUERY ); + + // don't forget to release the memory! + delete pDescriptor ; + + if ( m_xPeerWindow.is() == sal_True ) + { + if ( m_pMultiplexer != NULL ) + { + m_pMultiplexer->setPeer( m_xPeerWindow ); + } + + // create new referenz to xgraphics for painting on a peer + // and add a paint listener + Reference< XDevice > xDevice( m_xPeerWindow, UNO_QUERY ); + + if ( xDevice.is() == sal_True ) + { + m_xGraphicsPeer = xDevice->createGraphics(); + } + + if ( m_xGraphicsPeer.is() == sal_True ) + { + addPaintListener( this ); + } + + // PosSize_POSSIZE defined in <stardiv/uno/awt/window.hxx> + m_xPeerWindow->setPosSize( m_nX, m_nY, m_nWidth, m_nHeight, PosSize::POSSIZE ); + m_xPeerWindow->setEnable( m_bEnable ); + m_xPeerWindow->setVisible( m_bVisible && !m_bInDesignMode ); + } + } +} + +//____________________________________________________________________________________________________________ +// XControl +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::setContext( const Reference< XInterface >& xContext ) throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard( m_aMutex ); + m_xContext = xContext ; +} + +//____________________________________________________________________________________________________________ +// XControl +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::setDesignMode( sal_Bool bOn ) throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard( m_aMutex ); + m_bInDesignMode = bOn ; +} + +//____________________________________________________________________________________________________________ +// XControl +//____________________________________________________________________________________________________________ + +Reference< XInterface > SAL_CALL BaseControl::getContext() throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard( m_aMutex ); + return m_xContext ; +} + +//____________________________________________________________________________________________________________ +// XControl +//____________________________________________________________________________________________________________ + +Reference< XWindowPeer > SAL_CALL BaseControl::getPeer() throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard( m_aMutex ); + return m_xPeer ; +} + +//____________________________________________________________________________________________________________ +// XControl +//____________________________________________________________________________________________________________ + +Reference< XView > SAL_CALL BaseControl::getView() throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard( m_aMutex ); + return Reference< XView >( (OWeakObject*)this, UNO_QUERY ); +} + +//____________________________________________________________________________________________________________ +// XControl +//____________________________________________________________________________________________________________ + +sal_Bool SAL_CALL BaseControl::isDesignMode() throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard( m_aMutex ); + return m_bInDesignMode ; +} + +//____________________________________________________________________________________________________________ +// XControl +//____________________________________________________________________________________________________________ + +sal_Bool SAL_CALL BaseControl::isTransparent() throw( RuntimeException ) +{ + return sal_False ; +} + +//____________________________________________________________________________________________________________ +// XWindow +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::setPosSize( sal_Int32 nX , + sal_Int32 nY , + sal_Int32 nWidth , + sal_Int32 nHeight , + sal_Int16 nFlags ) throw( RuntimeException ) +{ + // - change size and position of window and save the values + // - "nFlags" declared in <stardiv/uno/awt/window.hxx> ("#define PosSize_X .....") + + // Ready for multithreading + MutexGuard aGuard( m_aMutex ); + + sal_Bool bChanged = sal_False ; + + if ( nFlags & PosSize::X ) + { + bChanged |= m_nX != nX, m_nX = nX ; + } + + if ( nFlags & PosSize::Y ) + { + bChanged |= m_nY != nY, m_nY = nY ; + } + + if ( nFlags & PosSize::WIDTH ) + { + bChanged |= m_nWidth != nWidth, m_nWidth = nWidth ; + } + + if ( nFlags & PosSize::HEIGHT ) + { + bChanged |= m_nHeight != nHeight, m_nHeight = nHeight ; + } + + if ( bChanged && m_xPeerWindow.is() ) + { + m_xPeerWindow->setPosSize( m_nX, m_nY, m_nWidth, m_nHeight, nFlags ); + } +} + +//____________________________________________________________________________________________________________ +// XWindow +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::setVisible( sal_Bool bVisible ) throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard( m_aMutex ); + + // Set new state of flag + m_bVisible = bVisible ; + + if ( m_xPeerWindow.is() == sal_True ) + { + // Set it also on peerwindow + m_xPeerWindow->setVisible( m_bVisible ); + } +} + +//____________________________________________________________________________________________________________ +// XWindow +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::setEnable( sal_Bool bEnable ) throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard( m_aMutex ); + + // Set new state of flag + m_bEnable = bEnable ; + + if ( m_xPeerWindow.is() == sal_True ) + { + // Set it also on peerwindow + m_xPeerWindow->setEnable( m_bEnable ); + } +} + +//____________________________________________________________________________________________________________ +// XWindow +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::setFocus() throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard( m_aMutex ); + + if ( m_xPeerWindow.is() == sal_True ) + { + m_xPeerWindow->setFocus(); + } +} + +//____________________________________________________________________________________________________________ +// XWindow +//____________________________________________________________________________________________________________ + +Rectangle SAL_CALL BaseControl::getPosSize() throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard( m_aMutex ); + return Rectangle( m_nX, m_nY , m_nWidth, m_nHeight ); +} + +//____________________________________________________________________________________________________________ +// XWindow +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::addWindowListener( const Reference< XWindowListener >& xListener ) throw( RuntimeException ) +{ + impl_getMultiplexer()->advise( ::getCppuType(( const Reference< XWindowListener >*)0), xListener ); +} + +//____________________________________________________________________________________________________________ +// XWindow +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::addFocusListener( const Reference< XFocusListener >& xListener ) throw( RuntimeException ) +{ + impl_getMultiplexer()->advise( ::getCppuType(( const Reference< XFocusListener >*)0), xListener ); +} + +//____________________________________________________________________________________________________________ +// XWindow +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::addKeyListener( const Reference< XKeyListener >& xListener ) throw( RuntimeException ) +{ + impl_getMultiplexer()->advise( ::getCppuType(( const Reference< XKeyListener >*)0), xListener ); +} + +//____________________________________________________________________________________________________________ +// XWindow +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::addMouseListener( const Reference< XMouseListener >& xListener ) throw( RuntimeException ) +{ + impl_getMultiplexer()->advise( ::getCppuType(( const Reference< XMouseListener >*)0), xListener ); +} + +//____________________________________________________________________________________________________________ +// XWindow +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::addMouseMotionListener( const Reference< XMouseMotionListener >& xListener ) throw( RuntimeException ) +{ + impl_getMultiplexer()->advise( ::getCppuType(( const Reference< XMouseMotionListener >*)0), xListener ); +} + +//____________________________________________________________________________________________________________ +// XWindow +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::addPaintListener( const Reference< XPaintListener >& xListener ) throw( RuntimeException ) +{ + impl_getMultiplexer()->advise( ::getCppuType(( const Reference< XPaintListener >*)0), xListener ); +} + +//____________________________________________________________________________________________________________ +// XWindow +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::removeWindowListener( const Reference< XWindowListener >& xListener ) throw( RuntimeException ) +{ + impl_getMultiplexer()->unadvise( ::getCppuType(( const Reference< XWindowListener >*)0), xListener ); +} + +//____________________________________________________________________________________________________________ +// XWindow +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::removeFocusListener( const Reference< XFocusListener >& xListener ) throw( RuntimeException ) +{ + impl_getMultiplexer()->unadvise( ::getCppuType(( const Reference< XFocusListener >*)0), xListener ); +} + +//____________________________________________________________________________________________________________ +// XWindow +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::removeKeyListener( const Reference< XKeyListener >& xListener ) throw( RuntimeException ) +{ + impl_getMultiplexer()->unadvise( ::getCppuType(( const Reference< XKeyListener >*)0), xListener ); +} + +//____________________________________________________________________________________________________________ +// XWindow +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::removeMouseListener( const Reference< XMouseListener >& xListener ) throw( RuntimeException ) +{ + impl_getMultiplexer()->unadvise( ::getCppuType(( const Reference< XMouseListener >*)0), xListener ); +} + +//____________________________________________________________________________________________________________ +// XWindow +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::removeMouseMotionListener( const Reference< XMouseMotionListener >& xListener ) throw( RuntimeException ) +{ + impl_getMultiplexer()->unadvise( ::getCppuType(( const Reference< XMouseMotionListener >*)0), xListener ); +} + +//____________________________________________________________________________________________________________ +// XWindow +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::removePaintListener( const Reference< XPaintListener >& xListener ) throw( RuntimeException ) +{ + impl_getMultiplexer()->unadvise( ::getCppuType(( const Reference< XPaintListener >*)0), xListener ); +} + +//____________________________________________________________________________________________________________ +// XView +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::draw( sal_Int32 nX , + sal_Int32 nY ) throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard( m_aMutex ); + + // - paint to an view + // - use the method "paint()" + // - see also "windowPaint()" + impl_paint( nX, nY, m_xGraphicsView ); +} + +//____________________________________________________________________________________________________________ +// XView +//____________________________________________________________________________________________________________ + +sal_Bool SAL_CALL BaseControl::setGraphics( const Reference< XGraphics >& xDevice ) throw( RuntimeException ) +{ + // - set the graphics for an view + // - in this class exist 2 graphics-member ... one for peer[_xGraphicsPeer] and one for view[_xGraphicsView] + // - they are used by "windowPaint() and draw()", forwarded to "paint ()" + sal_Bool bReturn = sal_False ; + if ( xDevice.is() == sal_True ) + { + // Ready for multithreading + MutexGuard aGuard( m_aMutex ); + + m_xGraphicsView = xDevice ; + bReturn = sal_True ; + } + + return bReturn ; +} + +//____________________________________________________________________________________________________________ +// XView +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::setZoom( float fZoomX , + float fZoomY ) throw( RuntimeException ) +{ + // Not implemented yet +} + +//____________________________________________________________________________________________________________ +// XView +//____________________________________________________________________________________________________________ + +Reference< XGraphics > SAL_CALL BaseControl::getGraphics() throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard( m_aMutex ); + return m_xGraphicsView ; +} + +//____________________________________________________________________________________________________________ +// XView +//____________________________________________________________________________________________________________ + +Size SAL_CALL BaseControl::getSize() throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard( m_aMutex ); + return Size( m_nWidth, m_nHeight ); +} + +//____________________________________________________________________________________________________________ +// XEventListener +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::disposing( const EventObject& aSource ) throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard( m_aMutex ); + + // - release ALL references + // - it must be !!! + if ( m_xGraphicsPeer.is() == sal_True ) + { + removePaintListener( this ); + m_xGraphicsPeer = Reference< XGraphics >(); + } + + if ( m_xGraphicsView.is() == sal_True ) + { + m_xGraphicsView = Reference< XGraphics >(); + } +} + +//____________________________________________________________________________________________________________ +// XPaintListener +//____________________________________________________________________________________________________________ + +void SAL_CALL BaseControl::windowPaint( const PaintEvent& aEvent ) throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard( m_aMutex ); + + // - repaint the peer + // - use the method "paint ()" for painting on a peer and a print device !!! + // - see also "draw ()" + impl_paint( 0, 0, m_xGraphicsPeer ); +} + +//____________________________________________________________________________________________________________ +// impl but public method to register service in DLL +// (In this BASE-implementation not implemented! Overwrite it in derived classes.) +//____________________________________________________________________________________________________________ + +const Sequence< OUString > BaseControl::impl_getStaticSupportedServiceNames() +{ + return Sequence< OUString >(); +} + +//____________________________________________________________________________________________________________ +// impl but public method to register service in DLL +// (In this BASE-implementation not implemented! Overwrite it in derived classes.) +//____________________________________________________________________________________________________________ + +const OUString BaseControl::impl_getStaticImplementationName() +{ + return OUString(); +} + +//____________________________________________________________________________________________________________ +// protected method +//____________________________________________________________________________________________________________ + +const Reference< XMultiServiceFactory > BaseControl::impl_getMultiServiceFactory() +{ + return m_xFactory ; +} + +//____________________________________________________________________________________________________________ +// protected method +//____________________________________________________________________________________________________________ + +const Reference< XWindow > BaseControl::impl_getPeerWindow() +{ + return m_xPeerWindow ; +} + +//____________________________________________________________________________________________________________ +// protected method +//____________________________________________________________________________________________________________ + +const Reference< XGraphics > BaseControl::impl_getGraphicsPeer() +{ + return m_xGraphicsPeer ; +} + +//____________________________________________________________________________________________________________ +// protected method +//____________________________________________________________________________________________________________ + +const sal_Int32& BaseControl::impl_getWidth() +{ + return m_nWidth ; +} + +//____________________________________________________________________________________________________________ +// protected method +//____________________________________________________________________________________________________________ + +const sal_Int32& BaseControl::impl_getHeight() +{ + return m_nHeight ; +} + +//____________________________________________________________________________________________________________ +// protected method +//____________________________________________________________________________________________________________ + +WindowDescriptor* BaseControl::impl_getWindowDescriptor( const Reference< XWindowPeer >& xParentPeer ) +{ + // - used from "createPeer()" to set the values of an ::com::sun::star::awt::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* pDescriptor = new WindowDescriptor ; + + pDescriptor->Type = WindowClass_SIMPLE ; + pDescriptor->WindowServiceName = OUString::createFromAscii( "window" ) ; + pDescriptor->ParentIndex = -1 ; + pDescriptor->Parent = xParentPeer ; + pDescriptor->Bounds = getPosSize () ; + pDescriptor->WindowAttributes = 0 ; + + return pDescriptor ; +} + +//____________________________________________________________________________________________________________ +// protected method +//____________________________________________________________________________________________________________ + +void BaseControl::impl_paint( sal_Int32 nX , + sal_Int32 nY , + const Reference< XGraphics >& xGraphics ) +{ + // - one paint method for peer AND view !!! + // (see also => "windowPaint()" and "draw()") + // - not used in this implementation, but its not necessary to make it pure virtual !!! +} + +//____________________________________________________________________________________________________________ +// protected method +//____________________________________________________________________________________________________________ + +Reference< XInterface > BaseControl::impl_getDelegator() +{ + return m_xDelegator ; +} + +//____________________________________________________________________________________________________________ +// private method +//____________________________________________________________________________________________________________ + +void BaseControl::impl_releasePeer() +{ + if ( m_xPeer.is() == sal_True ) + { + if ( m_xGraphicsPeer.is() == sal_True ) + { + removePaintListener( this ); + m_xGraphicsPeer = Reference< XGraphics >(); + } + + m_xPeer->dispose(); + m_xPeerWindow = Reference< XWindow >(); + m_xPeer = Reference< XWindowPeer >(); + + if ( m_pMultiplexer != NULL ) + { + // take changes on multiplexer + m_pMultiplexer->setPeer( Reference< XWindow >() ); + } + } +} + +//____________________________________________________________________________________________________________ +// private method +//____________________________________________________________________________________________________________ + +OMRCListenerMultiplexerHelper* BaseControl::impl_getMultiplexer() +{ + if ( m_pMultiplexer == NULL ) + { + m_pMultiplexer = new OMRCListenerMultiplexerHelper( (XWindow*)this, m_xPeerWindow ); + m_xMultiplexer = Reference< XInterface >( (OWeakObject*)m_pMultiplexer, UNO_QUERY ); + } + + return m_pMultiplexer ; +} + +} // namespace unocontrols diff --git a/UnoControls/source/base/makefile.mk b/UnoControls/source/base/makefile.mk new file mode 100644 index 000000000000..584aefb810ec --- /dev/null +++ b/UnoControls/source/base/makefile.mk @@ -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 diff --git a/UnoControls/source/base/multiplexer.cxx b/UnoControls/source/base/multiplexer.cxx new file mode 100644 index 000000000000..38c1d7297423 --- /dev/null +++ b/UnoControls/source/base/multiplexer.cxx @@ -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 diff --git a/UnoControls/source/base/registercontrols.cxx b/UnoControls/source/base/registercontrols.cxx new file mode 100644 index 000000000000..3357e1fc7765 --- /dev/null +++ b/UnoControls/source/base/registercontrols.cxx @@ -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 ; +} diff --git a/UnoControls/source/controls/OConnectionPointContainerHelper.cxx b/UnoControls/source/controls/OConnectionPointContainerHelper.cxx new file mode 100644 index 000000000000..224345df668f --- /dev/null +++ b/UnoControls/source/controls/OConnectionPointContainerHelper.cxx @@ -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 diff --git a/UnoControls/source/controls/OConnectionPointHelper.cxx b/UnoControls/source/controls/OConnectionPointHelper.cxx new file mode 100644 index 000000000000..2e76697c5d1c --- /dev/null +++ b/UnoControls/source/controls/OConnectionPointHelper.cxx @@ -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 diff --git a/UnoControls/source/controls/framecontrol.cxx b/UnoControls/source/controls/framecontrol.cxx new file mode 100644 index 000000000000..44411c14226d --- /dev/null +++ b/UnoControls/source/controls/framecontrol.cxx @@ -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 diff --git a/UnoControls/source/controls/makefile.mk b/UnoControls/source/controls/makefile.mk new file mode 100644 index 000000000000..2de3bb05b4ca --- /dev/null +++ b/UnoControls/source/controls/makefile.mk @@ -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 diff --git a/UnoControls/source/controls/progressbar.cxx b/UnoControls/source/controls/progressbar.cxx new file mode 100644 index 000000000000..170fd0df6a2e --- /dev/null +++ b/UnoControls/source/controls/progressbar.cxx @@ -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 diff --git a/UnoControls/source/controls/progressmonitor.cxx b/UnoControls/source/controls/progressmonitor.cxx new file mode 100644 index 000000000000..1699a1438868 --- /dev/null +++ b/UnoControls/source/controls/progressmonitor.cxx @@ -0,0 +1,1129 @@ +/************************************************************************* + * + * $RCSfile: progressmonitor.cxx,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): _______________________________________ + * + * + ************************************************************************/ + +//____________________________________________________________________________________________________________ +// my own includes +//____________________________________________________________________________________________________________ + +#ifndef _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX +#include "progressmonitor.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 _COM_SUN_STAR_AWT_POSSIZE_HPP_ +#include <com/sun/star/awt/PosSize.hpp> +#endif + +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif + +#ifndef _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif + +#ifndef _SOLAR_H +#include <tools/solar.h> +#endif + +//____________________________________________________________________________________________________________ +// includes of my project +//____________________________________________________________________________________________________________ + +#ifndef _UNOCONTROLS_PROGRESSBAR_CTRL_HXX +#include "progressbar.hxx" +#endif + +//____________________________________________________________________________________________________________ +// 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 +//____________________________________________________________________________________________________________ + +ProgressMonitor::ProgressMonitor( const Reference< XMultiServiceFactory >& xFactory ) + : BaseContainerControl ( xFactory ) +{ + // Its not allowed to work with member in this method (refcounter !!!) + // But with a HACK (++refcount) its "OK" :-( + ++m_refCount ; + + // Create instances for fixedtext, button and progress ... + m_xTopic_Top = Reference< XFixedText > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_SERVICENAME ) ), UNO_QUERY ) ; + m_xText_Top = Reference< XFixedText > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_SERVICENAME ) ), UNO_QUERY ) ; + m_xTopic_Bottom = Reference< XFixedText > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_SERVICENAME ) ), UNO_QUERY ) ; + m_xText_Bottom = Reference< XFixedText > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_SERVICENAME ) ), UNO_QUERY ) ; + m_xButton = Reference< XButton > ( xFactory->createInstance ( OUString::createFromAscii( BUTTON_SERVICENAME ) ), UNO_QUERY ) ; + m_xProgressBar = Reference< XProgressBar > ( xFactory->createInstance ( OUString::createFromAscii( SERVICENAME_PROGRESSBAR ) ), UNO_QUERY ) ; + + // ... cast controls to Reference< XControl > (for "setModel"!) ... + Reference< XControl > xRef_Topic_Top ( m_xTopic_Top , UNO_QUERY ) ; + Reference< XControl > xRef_Text_Top ( m_xText_Top , UNO_QUERY ) ; + Reference< XControl > xRef_Topic_Bottom ( m_xTopic_Bottom , UNO_QUERY ) ; + Reference< XControl > xRef_Text_Bottom ( m_xText_Bottom , UNO_QUERY ) ; + Reference< XControl > xRef_Button ( m_xButton , UNO_QUERY ) ; + Reference< XControl > xRef_ProgressBar ( m_xProgressBar , UNO_QUERY ) ; + + // ... set models ... + xRef_Topic_Top->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_MODELNAME ) ), UNO_QUERY ) ) ; + xRef_Text_Top->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_MODELNAME ) ), UNO_QUERY ) ) ; + xRef_Topic_Bottom->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_MODELNAME ) ), UNO_QUERY ) ) ; + xRef_Text_Bottom->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_MODELNAME ) ), UNO_QUERY ) ) ; + xRef_Button->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString::createFromAscii( BUTTON_MODELNAME ) ), UNO_QUERY ) ) ; + // ProgressBar has no model !!! + + // ... and add controls to basecontainercontrol! + addControl ( OUString::createFromAscii( CONTROLNAME_TEXT ) , xRef_Topic_Top ) ; + addControl ( OUString::createFromAscii( CONTROLNAME_TEXT ) , xRef_Text_Top ) ; + addControl ( OUString::createFromAscii( CONTROLNAME_TEXT ) , xRef_Topic_Bottom ) ; + addControl ( OUString::createFromAscii( CONTROLNAME_TEXT ) , xRef_Text_Bottom ) ; + addControl ( OUString::createFromAscii( CONTROLNAME_BUTTON ) , xRef_Button ) ; + addControl ( OUString::createFromAscii( CONTROLNAME_PROGRESSBAR ) , xRef_ProgressBar ) ; + + // FixedText make it automaticly visible by himself ... but not the progressbar !!! + // it must be set explicitly + Reference< XWindow > xWindowRef_ProgressBar( m_xProgressBar, UNO_QUERY ); + xWindowRef_ProgressBar->setVisible( sal_True ); + + // Reset to defaults !!! + // (progressbar take automaticly its own defaults) + m_xButton->setLabel ( OUString::createFromAscii( DEFAULT_BUTTONLABEL ) ) ; + m_xTopic_Top->setText ( OUString::createFromAscii( DEFAULT_TOPIC ) ) ; + m_xText_Top->setText ( OUString::createFromAscii( DEFAULT_TEXT ) ) ; + m_xTopic_Bottom->setText ( OUString::createFromAscii( DEFAULT_TOPIC ) ) ; + m_xText_Bottom->setText ( OUString::createFromAscii( DEFAULT_TEXT ) ) ; + + --m_refCount ; + + // Initialize info lists for fixedtext's + m_pTextlist_Top = new IMPL_Textlist ; + m_pTextlist_Bottom = new IMPL_Textlist ; +} + +ProgressMonitor::~ProgressMonitor() +{ + impl_cleanMemory () ; +} + +//____________________________________________________________________________________________________________ +// XInterface +//____________________________________________________________________________________________________________ + +Any SAL_CALL ProgressMonitor::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 = BaseContainerControl::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 ProgressMonitor::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 ProgressMonitor::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 ProgressMonitor::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< XLayoutConstrains >*)NULL ) , + ::getCppuType(( const Reference< XButton >*)NULL ) , + ::getCppuType(( const Reference< XProgressMonitor >*)NULL ) , + BaseContainerControl::getTypes() + ); + // ... and set his address to static pointer! + pTypeCollection = &aTypeCollection ; + } + } + + return pTypeCollection->getTypes(); +} + +//____________________________________________________________________________________________________________ +// XAggregation +//____________________________________________________________________________________________________________ + +Any SAL_CALL ProgressMonitor::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< XLayoutConstrains* > ( this ) , + static_cast< XButton* > ( this ) , + static_cast< XProgressMonitor* > ( this ) + ) + ); + + // If searched interface not supported by this class ... + if ( aReturn.hasValue() == sal_False ) + { + // ... ask baseclasses. + aReturn = BaseControl::queryAggregation( aType ); + } + + return aReturn ; +} + +//____________________________________________________________________________________________________________ +// XProgressMonitor +//____________________________________________________________________________________________________________ + +void SAL_CALL ProgressMonitor::addText( const OUString& rTopic, const OUString& rText, sal_Bool bbeforeProgress ) throw( RuntimeException ) +{ + // Safe impossible cases + // Check valid call of this method. + DBG_ASSERT ( impl_debug_checkParameter ( rTopic, rText, bbeforeProgress ) , "ProgressMonitor::addText()\nCall without valid parameters!\n") ; + DBG_ASSERT ( !(impl_searchTopic ( rTopic, bbeforeProgress ) != NULL ) , "ProgresMonitor::addText()\nThe text already exist.\n" ) ; + + // Do nothing (in Release), if topic already exist. + if ( impl_searchTopic ( rTopic, bbeforeProgress ) != NULL ) + { + return ; + } + + // Else ... take memory for new item ... + IMPL_TextlistItem* pTextItem = new IMPL_TextlistItem ; + + if ( pTextItem != NULL ) + { + // Set values ... + pTextItem->sTopic = rTopic ; + pTextItem->sText = rText ; + + // Ready for multithreading + MutexGuard aGuard ( m_aMutex ) ; + + // ... and insert it in right list. + if ( bbeforeProgress == sal_True ) + { + m_pTextlist_Top->Insert ( pTextItem, LIST_APPEND ) ; + } + else + { + m_pTextlist_Bottom->Insert ( pTextItem, LIST_APPEND ) ; + } + } + + // ... update window + impl_rebuildFixedText () ; + impl_recalcLayout () ; +} + +//____________________________________________________________________________________________________________ +// XProgressMonitor +//____________________________________________________________________________________________________________ + +void SAL_CALL ProgressMonitor::removeText ( const OUString& rTopic, sal_Bool bbeforeProgress ) throw( RuntimeException ) +{ + // Safe impossible cases + // Check valid call of this method. + DBG_ASSERT ( impl_debug_checkParameter ( rTopic, bbeforeProgress ), "ProgressMonitor::removeText()\nCall without valid parameters!\n" ) ; + + // Search the topic ... + IMPL_TextlistItem* pSearchItem = impl_searchTopic ( rTopic, bbeforeProgress ) ; + + if ( pSearchItem != NULL ) + { + // Ready for multithreading + MutexGuard aGuard ( m_aMutex ) ; + + // ... delete item from right list ... + if ( bbeforeProgress == sal_True ) + { + m_pTextlist_Top->Remove ( pSearchItem ) ; + } + else + { + m_pTextlist_Bottom->Remove ( pSearchItem ) ; + } + + delete pSearchItem ; + + // ... and update window. + impl_rebuildFixedText () ; + impl_recalcLayout () ; + } +} + +//____________________________________________________________________________________________________________ +// XProgressMonitor +//____________________________________________________________________________________________________________ + +void SAL_CALL ProgressMonitor::updateText ( const OUString& rTopic, const OUString& rText, sal_Bool bbeforeProgress ) throw( RuntimeException ) +{ + // Safe impossible cases + // Check valid call of this method. + DBG_ASSERT ( impl_debug_checkParameter ( rTopic, rText, bbeforeProgress ), "ProgressMonitor::updateText()\nCall without valid parameters!\n" ) ; + + // Search topic ... + IMPL_TextlistItem* pSearchItem = impl_searchTopic ( rTopic, bbeforeProgress ) ; + + if ( pSearchItem != NULL ) + { + // Ready for multithreading + MutexGuard aGuard ( m_aMutex ) ; + + // ... update text ... + pSearchItem->sText = rText ; + + // ... and update window. + impl_rebuildFixedText () ; + impl_recalcLayout () ; + } +} + +//____________________________________________________________________________________________________________ +// XProgressBar +//____________________________________________________________________________________________________________ + +void SAL_CALL ProgressMonitor::setForegroundColor ( sal_Int32 nColor ) throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard ( m_aMutex ) ; + + if ( m_xProgressBar.is () ) + { + m_xProgressBar->setForegroundColor ( nColor ) ; + } +} + +//____________________________________________________________________________________________________________ +// XProgressBar +//____________________________________________________________________________________________________________ + +void SAL_CALL ProgressMonitor::setBackgroundColor ( sal_Int32 nColor ) throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard ( m_aMutex ) ; + + if ( m_xProgressBar.is () ) + { + m_xProgressBar->setBackgroundColor ( nColor ) ; + } +} + +//____________________________________________________________________________________________________________ +// XProgressBar +//____________________________________________________________________________________________________________ + +void SAL_CALL ProgressMonitor::setValue ( sal_Int32 nValue ) throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard ( m_aMutex ) ; + + if ( m_xProgressBar.is () ) + { + m_xProgressBar->setValue ( nValue ) ; + } +} + +//____________________________________________________________________________________________________________ +// XProgressBar +//____________________________________________________________________________________________________________ + +void SAL_CALL ProgressMonitor::setRange ( sal_Int32 nMin, sal_Int32 nMax ) throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard ( m_aMutex ) ; + + if ( m_xProgressBar.is () ) + { + m_xProgressBar->setRange ( nMin, nMax ) ; + } +} + +//____________________________________________________________________________________________________________ +// XProgressBar +//____________________________________________________________________________________________________________ + +sal_Int32 SAL_CALL ProgressMonitor::getValue () throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard ( m_aMutex ) ; + + if (m_xProgressBar.is()) + { + return m_xProgressBar->getValue () ; + } + + return 0 ; +} + +//____________________________________________________________________________________________________________ +// XButton +//____________________________________________________________________________________________________________ + +void SAL_CALL ProgressMonitor::addActionListener ( const Reference< XActionListener > & rListener ) throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard ( m_aMutex ) ; + + if ( m_xButton.is () ) + { + m_xButton->addActionListener ( rListener ) ; + } +} + +//____________________________________________________________________________________________________________ +// XButton +//____________________________________________________________________________________________________________ + +void SAL_CALL ProgressMonitor::removeActionListener ( const Reference< XActionListener > & rListener ) throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard ( m_aMutex ) ; + + if ( m_xButton.is () ) + { + m_xButton->removeActionListener ( rListener ) ; + } +} + +//____________________________________________________________________________________________________________ +// XButton +//____________________________________________________________________________________________________________ + +void SAL_CALL ProgressMonitor::setLabel ( const OUString& rLabel ) throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard ( m_aMutex ) ; + + if ( m_xButton.is () ) + { + m_xButton->setLabel ( rLabel ) ; + } +} + +//____________________________________________________________________________________________________________ +// XButton +//____________________________________________________________________________________________________________ + +void SAL_CALL ProgressMonitor::setActionCommand ( const OUString& rCommand ) throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard ( m_aMutex ) ; + + if ( m_xButton.is () ) + { + m_xButton->setActionCommand ( rCommand ) ; + } +} + +//____________________________________________________________________________________________________________ +// XLayoutConstrains +//____________________________________________________________________________________________________________ + +Size SAL_CALL ProgressMonitor::getMinimumSize () throw( RuntimeException ) +{ + return Size (DEFAULT_WIDTH, DEFAULT_HEIGHT) ; +} + +//____________________________________________________________________________________________________________ +// XLayoutConstrains +//____________________________________________________________________________________________________________ + +Size SAL_CALL ProgressMonitor::getPreferredSize () throw( RuntimeException ) +{ + // Ready for multithreading + ClearableMutexGuard aGuard ( m_aMutex ) ; + + // get information about required place of child controls + Reference< XLayoutConstrains > xTopicLayout_Top ( m_xTopic_Top , UNO_QUERY ) ; + Reference< XLayoutConstrains > xTopicLayout_Bottom ( m_xTopic_Bottom , UNO_QUERY ) ; + Reference< XLayoutConstrains > xButtonLayout ( m_xButton , UNO_QUERY ) ; + Reference< XWindow > xProgressBarWindow ( m_xProgressBar , UNO_QUERY ) ; + + Size aTopicSize_Top = xTopicLayout_Top->getPreferredSize (); + Size aTopicSize_Bottom = xTopicLayout_Bottom->getPreferredSize (); + Size aButtonSize = xButtonLayout->getPreferredSize (); + Rectangle aTempRectangle = xProgressBarWindow->getPosSize (); + Size aProgressBarSize = Size( aTempRectangle.Width, aTempRectangle.Height ); + + aGuard.clear () ; + + // calc preferred size of progressmonitor + sal_Int32 nWidth = 0 ; + sal_Int32 nHeight = 0 ; + + nWidth = 3 * FREEBORDER ; + nWidth += aProgressBarSize.Width ; + + nHeight = 6 * FREEBORDER ; + nHeight += aTopicSize_Top.Height ; + nHeight += aProgressBarSize.Height ; + nHeight += aTopicSize_Bottom.Height; + nHeight += 2 ; // 1 for black line, 1 for white line = 3D-Line! + nHeight += aButtonSize.Height ; + + // norm to minimum + if ( nWidth<DEFAULT_WIDTH ) + { + nWidth = DEFAULT_WIDTH ; + } + if ( nHeight<DEFAULT_HEIGHT ) + { + nHeight = DEFAULT_HEIGHT ; + } + + // return to caller + return Size ( nWidth, nHeight ) ; +} + +//____________________________________________________________________________________________________________ +// XLayoutConstrains +//____________________________________________________________________________________________________________ + +Size SAL_CALL ProgressMonitor::calcAdjustedSize ( const Size& rNewSize ) throw( RuntimeException ) +{ + return getPreferredSize () ; +} + +//____________________________________________________________________________________________________________ +// XControl +//____________________________________________________________________________________________________________ + +void SAL_CALL ProgressMonitor::createPeer ( const Reference< XToolkit > & rToolkit, const Reference< XWindowPeer > & rParent ) throw( RuntimeException ) +{ + if (!getPeer().is()) + { + BaseContainerControl::createPeer ( rToolkit, rParent ) ; + + // If user forget to call "setPosSize()", we have still a correct size. + // And a "MinimumSize" IS A "MinimumSize"! + // We change not the position of control at this point. + Size aDefaultSize = getMinimumSize () ; + setPosSize ( 0, 0, aDefaultSize.Width, aDefaultSize.Height, PosSize::SIZE ) ; + } +} + +//____________________________________________________________________________________________________________ +// XControl +//____________________________________________________________________________________________________________ + +sal_Bool SAL_CALL ProgressMonitor::setModel ( const Reference< XControlModel > & rModel ) throw( RuntimeException ) +{ + // We have no model. + return sal_False ; +} + +//____________________________________________________________________________________________________________ +// XControl +//____________________________________________________________________________________________________________ + +Reference< XControlModel > SAL_CALL ProgressMonitor::getModel () throw( RuntimeException ) +{ + // We have no model. + // return (XControlModel*)this ; + return Reference< XControlModel > () ; +} + +//____________________________________________________________________________________________________________ +// XComponent +//____________________________________________________________________________________________________________ + +void SAL_CALL ProgressMonitor::dispose () throw( RuntimeException ) +{ + // Ready for multithreading + MutexGuard aGuard ( m_aMutex ) ; + + // "removeControl()" control the state of a reference + Reference< XControl > xRef_Topic_Top ( m_xTopic_Top , UNO_QUERY ) ; + Reference< XControl > xRef_Text_Top ( m_xText_Top , UNO_QUERY ) ; + Reference< XControl > xRef_Topic_Bottom ( m_xTopic_Bottom , UNO_QUERY ) ; + Reference< XControl > xRef_Text_Bottom ( m_xText_Bottom , UNO_QUERY ) ; + Reference< XControl > xRef_Button ( m_xButton , UNO_QUERY ) ; + Reference< XControl > xRef_ProgressBar ( m_xProgressBar , UNO_QUERY ) ; + + removeControl ( xRef_Topic_Top ) ; + removeControl ( xRef_Text_Top ) ; + removeControl ( xRef_Topic_Bottom ) ; + removeControl ( xRef_Text_Bottom ) ; + removeControl ( xRef_Button ) ; + removeControl ( xRef_ProgressBar ) ; + + // do'nt use "...->clear ()" or "... = XFixedText ()" + // when other hold a reference at this object !!! + xRef_Topic_Top->dispose () ; + xRef_Text_Top->dispose () ; + xRef_Topic_Bottom->dispose () ; + xRef_Text_Bottom->dispose () ; + xRef_Button->dispose () ; + xRef_ProgressBar->dispose () ; + + BaseContainerControl::dispose () ; +} + +//____________________________________________________________________________________________________________ +// XWindow +//____________________________________________________________________________________________________________ + +void SAL_CALL ProgressMonitor::setPosSize ( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nFlags ) throw( RuntimeException ) +{ + Rectangle aBasePosSize = getPosSize () ; + BaseContainerControl::setPosSize (nX, nY, nWidth, nHeight, nFlags) ; + + // if position or size changed + if ( + ( nWidth != aBasePosSize.Width ) || + ( nHeight != aBasePosSize.Height) + ) + { + // calc new layout for controls + impl_recalcLayout () ; + // clear background (!) + // [Childs was repainted in "recalcLayout" by setPosSize() automaticly!] + getPeer()->invalidate(2); + // and repaint the control + impl_paint ( 0, 0, impl_getGraphicsPeer() ) ; + } +} + +//____________________________________________________________________________________________________________ +// impl but public method to register service +//____________________________________________________________________________________________________________ + +const Sequence< OUString > ProgressMonitor::impl_getStaticSupportedServiceNames() +{ + MutexGuard aGuard( Mutex::getGlobalMutex() ); + Sequence< OUString > seqServiceNames( 1 ); + seqServiceNames.getArray() [0] = OUString::createFromAscii( SERVICENAME_PROGRESSMONITOR ); + return seqServiceNames ; +} + +//____________________________________________________________________________________________________________ +// impl but public method to register service +//____________________________________________________________________________________________________________ + +const OUString ProgressMonitor::impl_getStaticImplementationName() +{ + return OUString::createFromAscii( IMPLEMENTATIONNAME_PROGRESSMONITOR ); +} + +//____________________________________________________________________________________________________________ +// protected method +//____________________________________________________________________________________________________________ + +void ProgressMonitor::impl_paint ( sal_Int32 nX, sal_Int32 nY, const Reference< XGraphics > & rGraphics ) +{ + if (rGraphics.is()) + { + // Ready for multithreading + MutexGuard aGuard ( m_aMutex ) ; + + // paint shadowed border around the progressmonitor + rGraphics->setLineColor ( LINECOLOR_SHADOW ) ; + rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, impl_getWidth()-1, nY ) ; + rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, nX , impl_getHeight()-1 ) ; + + rGraphics->setLineColor ( LINECOLOR_BRIGHT ) ; + rGraphics->drawLine ( nX, nY, impl_getWidth(), nY ) ; + rGraphics->drawLine ( nX, nY, nX , impl_getHeight() ) ; + + // Paint 3D-line + rGraphics->setLineColor ( LINECOLOR_SHADOW ) ; + rGraphics->drawLine ( m_a3DLine.X, m_a3DLine.Y, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y ) ; + + rGraphics->setLineColor ( LINECOLOR_BRIGHT ) ; + rGraphics->drawLine ( m_a3DLine.X, m_a3DLine.Y+1, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y+1 ) ; + } +} + +//____________________________________________________________________________________________________________ +// private method +//____________________________________________________________________________________________________________ + +void ProgressMonitor::impl_recalcLayout () +{ + sal_Int32 nX_Button ; + sal_Int32 nY_Button ; + sal_Int32 nWidth_Button ; + sal_Int32 nHeight_Button ; + + sal_Int32 nX_ProgressBar ; + sal_Int32 nY_ProgressBar ; + sal_Int32 nWidth_ProgressBar ; + sal_Int32 nHeight_ProgressBar ; + + sal_Int32 nX_3DLine ; + sal_Int32 nY_3DLine ; + sal_Int32 nWidth_3DLine ; + sal_Int32 nHeight_3DLine ; + + sal_Int32 nX_Text_Top ; + sal_Int32 nY_Text_Top ; + sal_Int32 nWidth_Text_Top ; + sal_Int32 nHeight_Text_Top ; + + sal_Int32 nX_Topic_Top ; + sal_Int32 nY_Topic_Top ; + sal_Int32 nWidth_Topic_Top ; + sal_Int32 nHeight_Topic_Top ; + + sal_Int32 nX_Text_Bottom ; + sal_Int32 nY_Text_Bottom ; + sal_Int32 nWidth_Text_Bottom ; + sal_Int32 nHeight_Text_Bottom ; + + sal_Int32 nX_Topic_Bottom ; + sal_Int32 nY_Topic_Bottom ; + sal_Int32 nWidth_Topic_Bottom ; + sal_Int32 nHeight_Topic_Bottom ; + + // Ready for multithreading + MutexGuard aGuard ( m_aMutex ) ; + + // get information about required place of child controls + Reference< XLayoutConstrains > xTopicLayout_Top ( m_xTopic_Top , UNO_QUERY ) ; + Reference< XLayoutConstrains > xTextLayout_Top ( m_xText_Top , UNO_QUERY ) ; + Reference< XLayoutConstrains > xTopicLayout_Bottom ( m_xTopic_Bottom , UNO_QUERY ) ; + Reference< XLayoutConstrains > xTextLayout_Bottom ( m_xText_Bottom , UNO_QUERY ) ; + Reference< XLayoutConstrains > xButtonLayout ( m_xButton , UNO_QUERY ) ; + + Size aTopicSize_Top = xTopicLayout_Top->getPreferredSize () ; + Size aTextSize_Top = xTextLayout_Top->getPreferredSize () ; + Size aTopicSize_Bottom = xTopicLayout_Bottom->getPreferredSize () ; + Size aTextSize_Bottom = xTextLayout_Bottom->getPreferredSize () ; + Size aButtonSize = xButtonLayout->getPreferredSize () ; + + // calc position and size of child controls + // Button has preferred size! + nWidth_Button = aButtonSize.Width ; + nHeight_Button = aButtonSize.Height ; + + // Left column before progressbar has preferred size and fixed position. + // But "Width" is oriented on left column below progressbar to!!! "max(...)" + nX_Topic_Top = FREEBORDER ; + nY_Topic_Top = FREEBORDER ; + nWidth_Topic_Top = Max ( aTopicSize_Top.Width, aTopicSize_Bottom.Width ) ; + nHeight_Topic_Top = aTopicSize_Top.Height ; + + // Right column before progressbar has relativ position to left column ... + // ... and a size as rest of dialog size! + nX_Text_Top = nX_Topic_Top+nWidth_Topic_Top+FREEBORDER ; + nY_Text_Top = nY_Topic_Top ; + nWidth_Text_Top = Max ( aTextSize_Top.Width, aTextSize_Bottom.Width ) ; + // Fix size of this column to minimum! + sal_Int32 nSummaryWidth = nWidth_Text_Top+nWidth_Topic_Top+(3*FREEBORDER) ; + if ( nSummaryWidth < DEFAULT_WIDTH ) + nWidth_Text_Top = DEFAULT_WIDTH-nWidth_Topic_Top-(3*FREEBORDER); + // Fix size of column to maximum! + if ( nSummaryWidth > impl_getWidth() ) + nWidth_Text_Top = impl_getWidth()-nWidth_Topic_Top-(3*FREEBORDER) ; + nHeight_Text_Top = nHeight_Topic_Top ; + + // Position of progressbar is relativ to columns before. + // Progressbar.Width = Dialog.Width !!! + // Progressbar.Height = Button.Height + nX_ProgressBar = nX_Topic_Top ; + nY_ProgressBar = nY_Topic_Top+nHeight_Topic_Top+FREEBORDER ; + nWidth_ProgressBar = FREEBORDER+nWidth_Topic_Top+nWidth_Text_Top ; + nHeight_ProgressBar = nHeight_Button ; + + // Oriented by left column before progressbar. + nX_Topic_Bottom = nX_Topic_Top ; + nY_Topic_Bottom = nY_ProgressBar+nHeight_ProgressBar+FREEBORDER ; + nWidth_Topic_Bottom = nWidth_Topic_Top ; + nHeight_Topic_Bottom = aTopicSize_Bottom.Height ; + + // Oriented by right column before progressbar. + nX_Text_Bottom = nX_Topic_Bottom+nWidth_Topic_Bottom+FREEBORDER ; + nY_Text_Bottom = nY_Topic_Bottom ; + nWidth_Text_Bottom = nWidth_Text_Top ; + nHeight_Text_Bottom = nHeight_Topic_Bottom ; + + // Oriented by progressbar. + nX_3DLine = nX_Topic_Top ; + nY_3DLine = nY_Topic_Bottom+nHeight_Topic_Bottom+(FREEBORDER/2) ; + nWidth_3DLine = nWidth_ProgressBar ; + nHeight_3DLine = 1 ; // Height for ONE line ! (But we paint two lines!) + + // Oriented by progressbar. + nX_Button = nX_ProgressBar+nWidth_ProgressBar-nWidth_Button ; + nY_Button = nY_Topic_Bottom+nHeight_Topic_Bottom+FREEBORDER ; + + // Calc offsets to center controls + sal_Int32 nDx ; + sal_Int32 nDy ; + + nDx = ( (2*FREEBORDER)+nWidth_ProgressBar ) ; + nDy = ( (6*FREEBORDER)+nHeight_Topic_Top+nHeight_ProgressBar+nHeight_Topic_Bottom+2+nHeight_Button ) ; + + // At this point use original dialog size to center controls! + nDx = (impl_getWidth ()/2)-(nDx/2) ; + nDy = (impl_getHeight()/2)-(nDy/2) ; + + if ( nDx<0 ) + { + nDx=0 ; + } + if ( nDy<0 ) + { + nDy=0 ; + } + + // Set new position and size on all controls + Reference< XWindow > xRef_Topic_Top ( m_xTopic_Top , UNO_QUERY ) ; + Reference< XWindow > xRef_Text_Top ( m_xText_Top , UNO_QUERY ) ; + Reference< XWindow > xRef_Topic_Bottom ( m_xTopic_Bottom , UNO_QUERY ) ; + Reference< XWindow > xRef_Text_Bottom ( m_xText_Bottom , UNO_QUERY ) ; + Reference< XWindow > xRef_Button ( m_xButton , UNO_QUERY ) ; + Reference< XWindow > xRef_ProgressBar ( m_xProgressBar , UNO_QUERY ) ; + + xRef_Topic_Top->setPosSize ( nDx+nX_Topic_Top , nDy+nY_Topic_Top , nWidth_Topic_Top , nHeight_Topic_Top , 15 ) ; + xRef_Text_Top->setPosSize ( nDx+nX_Text_Top , nDy+nY_Text_Top , nWidth_Text_Top , nHeight_Text_Top , 15 ) ; + xRef_Topic_Bottom->setPosSize ( nDx+nX_Topic_Bottom , nDy+nY_Topic_Bottom , nWidth_Topic_Bottom , nHeight_Topic_Bottom , 15 ) ; + xRef_Text_Bottom->setPosSize ( nDx+nX_Text_Bottom , nDy+nY_Text_Bottom , nWidth_Text_Bottom , nHeight_Text_Bottom , 15 ) ; + xRef_Button->setPosSize ( nDx+nX_Button , nDy+nY_Button , nWidth_Button , nHeight_Button , 15 ) ; + xRef_ProgressBar->setPosSize ( nDx+nX_ProgressBar , nDy+nY_ProgressBar , nWidth_ProgressBar , nHeight_ProgressBar , 15 ) ; + + m_a3DLine.X = nDx+nX_Topic_Top ; + m_a3DLine.Y = nDy+nY_Topic_Bottom+nHeight_Topic_Bottom+(FREEBORDER/2) ; + m_a3DLine.Width = nWidth_ProgressBar ; + m_a3DLine.Height = nHeight_ProgressBar ; + + // All childcontrols make an implicit repaint in setPosSize()! + // Make it also for this 3D-line ... + Reference< XGraphics > xGraphics = impl_getGraphicsPeer () ; + + xGraphics->setLineColor ( LINECOLOR_SHADOW ) ; + xGraphics->drawLine ( m_a3DLine.X, m_a3DLine.Y, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y ) ; + + xGraphics->setLineColor ( LINECOLOR_BRIGHT ) ; + xGraphics->drawLine ( m_a3DLine.X, m_a3DLine.Y+1, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y+1 ) ; +} + +//____________________________________________________________________________________________________________ +// private method +//____________________________________________________________________________________________________________ + +void ProgressMonitor::impl_rebuildFixedText () +{ + // Ready for multithreading + MutexGuard aGuard ( m_aMutex ) ; + + // Rebuild fixedtext before progress + + // Rebuild left site of text + if (m_xTopic_Top.is()) + { + OUString aCollectString ; + + // Collect all topics from list and format text. + // "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!! + for ( sal_uInt32 n=0; n<m_pTextlist_Top->Count(); ++n ) + { + IMPL_TextlistItem* pSearchItem = m_pTextlist_Top->GetObject (n) ; + aCollectString += pSearchItem->sTopic ; + aCollectString += OUString::createFromAscii("\n") ; + } + aCollectString += OUString::createFromAscii("\0") ; // It's better :-) + + m_xTopic_Top->setText ( aCollectString ) ; + } + + // Rebuild right site of text + if (m_xText_Top.is()) + { + OUString aCollectString ; + + // Collect all topics from list and format text. + // "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!! + for ( sal_uInt32 n=0; n<m_pTextlist_Top->Count(); ++n ) + { + IMPL_TextlistItem* pSearchItem = m_pTextlist_Top->GetObject (n) ; + aCollectString += pSearchItem->sText ; + aCollectString += OUString::createFromAscii("\n") ; + } + aCollectString += OUString::createFromAscii("\0") ; // It's better :-) + + m_xText_Top->setText ( aCollectString ) ; + } + + // Rebuild fixedtext below progress + + // Rebuild left site of text + if (m_xTopic_Bottom.is()) + { + OUString aCollectString ; + + // Collect all topics from list and format text. + // "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!! + for ( sal_uInt32 n=0; n<m_pTextlist_Bottom->Count(); ++n ) + { + IMPL_TextlistItem* pSearchItem = m_pTextlist_Bottom->GetObject (n) ; + aCollectString += pSearchItem->sTopic ; + aCollectString += OUString::createFromAscii("\n") ; + } + aCollectString += OUString::createFromAscii("\0") ; // It's better :-) + + m_xTopic_Bottom->setText ( aCollectString ) ; + } + + // Rebuild right site of text + if (m_xText_Bottom.is()) + { + OUString aCollectString ; + + // Collect all topics from list and format text. + // "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!! + for ( sal_uInt32 n=0; n<m_pTextlist_Bottom->Count(); ++n ) + { + IMPL_TextlistItem* pSearchItem = m_pTextlist_Bottom->GetObject (n) ; + aCollectString += pSearchItem->sText ; + aCollectString += OUString::createFromAscii("\n") ; + } + aCollectString += OUString::createFromAscii("\0") ; // It's better :-) + + m_xText_Bottom->setText ( aCollectString ) ; + } +} + +//____________________________________________________________________________________________________________ +// private method +//____________________________________________________________________________________________________________ + +void ProgressMonitor::impl_cleanMemory () +{ + // Ready for multithreading + MutexGuard aGuard ( m_aMutex ) ; + + // Delete all of lists. + + sal_uInt32 nPosition ; + + for ( nPosition = 0; nPosition < m_pTextlist_Top->Count () ; ++nPosition ) + { + IMPL_TextlistItem* pSearchItem = m_pTextlist_Top->GetObject ( nPosition ) ; + delete pSearchItem ; + } + m_pTextlist_Top->Clear () ; + delete m_pTextlist_Top ; + + for ( nPosition = 0; nPosition < m_pTextlist_Bottom->Count () ; ++nPosition ) + { + IMPL_TextlistItem* pSearchItem = m_pTextlist_Bottom->GetObject ( nPosition ) ; + delete pSearchItem ; + } + m_pTextlist_Bottom->Clear () ; + delete m_pTextlist_Bottom ; +} + +//____________________________________________________________________________________________________________ +// private method +//____________________________________________________________________________________________________________ + +IMPL_TextlistItem* ProgressMonitor::impl_searchTopic ( const OUString& rTopic, sal_Bool bbeforeProgress ) +{ + // Get right textlist for following operations. + IMPL_Textlist* pTextList ; + + // Ready for multithreading + ClearableMutexGuard aGuard ( m_aMutex ) ; + + if ( bbeforeProgress == sal_True ) + { + pTextList = m_pTextlist_Top ; + } + else + { + pTextList = m_pTextlist_Bottom ; + } + + // Switch off guard. + aGuard.clear () ; + + // Search the topic in textlist. + sal_uInt32 nPosition = 0 ; + sal_uInt32 nCount = pTextList->Count () ; + + for ( nPosition = 0; nPosition < nCount ; ++nPosition ) + { + IMPL_TextlistItem* pSearchItem = pTextList->GetObject ( nPosition ) ; + + if ( pSearchItem->sTopic == rTopic ) + { + // We have found this topic ... return a valid pointer. + return pSearchItem ; + } + } + + // We have'nt found this topic ... return a nonvalid pointer. + return NULL ; +} + +//____________________________________________________________________________________________________________ +// debug methods +//____________________________________________________________________________________________________________ + +#ifdef DBG_UTIL + +// addText, updateText +sal_Bool ProgressMonitor::impl_debug_checkParameter ( const OUString& rTopic, const OUString& rText, sal_Bool bbeforeProgress ) +{ + // Check "rTopic" + if ( &rTopic == NULL ) return sal_False ; // NULL-pointer for reference ???!!! + if ( rTopic.len () < 1 ) return sal_False ; // "" + + // Check "rText" + if ( &rText == NULL ) return sal_False ; // NULL-pointer for reference ???!!! + if ( rText.len () < 1 ) return sal_False ; // "" + + // "bbeforeProgress" is valid in everyway! + + // Parameter OK ... return sal_True. + return sal_True ; +} + +// removeText +sal_Bool ProgressMonitor::impl_debug_checkParameter ( const OUString& rTopic, sal_Bool bbeforeProgress ) +{ + // Check "rTopic" + if ( &rTopic == NULL ) return sal_False ; // NULL-pointer for reference ???!!! + if ( rTopic.len () < 1 ) return sal_False ; // "" + + // "bbeforeProgress" is valid in everyway! + + // Parameter OK ... return sal_True. + return sal_True ; +} + +#endif // #ifdef DBG_UTIL + +} // namespace unocontrols diff --git a/UnoControls/source/inc/OConnectionPointContainerHelper.hxx b/UnoControls/source/inc/OConnectionPointContainerHelper.hxx new file mode 100644 index 000000000000..1db9378edf99 --- /dev/null +++ b/UnoControls/source/inc/OConnectionPointContainerHelper.hxx @@ -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 diff --git a/UnoControls/source/inc/OConnectionPointHelper.hxx b/UnoControls/source/inc/OConnectionPointHelper.hxx new file mode 100644 index 000000000000..e10aa8689a73 --- /dev/null +++ b/UnoControls/source/inc/OConnectionPointHelper.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 diff --git a/UnoControls/source/inc/framecontrol.hxx b/UnoControls/source/inc/framecontrol.hxx new file mode 100644 index 000000000000..5dd53707720c --- /dev/null +++ b/UnoControls/source/inc/framecontrol.hxx @@ -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 diff --git a/UnoControls/source/inc/progressbar.hxx b/UnoControls/source/inc/progressbar.hxx new file mode 100644 index 000000000000..aafeffdf07b9 --- /dev/null +++ b/UnoControls/source/inc/progressbar.hxx @@ -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 diff --git a/UnoControls/source/inc/progressmonitor.hxx b/UnoControls/source/inc/progressmonitor.hxx new file mode 100644 index 000000000000..ef5cf793cf23 --- /dev/null +++ b/UnoControls/source/inc/progressmonitor.hxx @@ -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 diff --git a/UnoControls/util/makefile.mk b/UnoControls/util/makefile.mk new file mode 100644 index 000000000000..e892c7811fc1 --- /dev/null +++ b/UnoControls/util/makefile.mk @@ -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 diff --git a/UnoControls/util/makefile.pmk b/UnoControls/util/makefile.pmk new file mode 100644 index 000000000000..81bb5a88ea8d --- /dev/null +++ b/UnoControls/util/makefile.pmk @@ -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 diff --git a/UnoControls/util/target.pmk b/UnoControls/util/target.pmk new file mode 100644 index 000000000000..a0b7f8adb878 --- /dev/null +++ b/UnoControls/util/target.pmk @@ -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" + diff --git a/automation/prj/d.lst b/automation/prj/d.lst new file mode 100644 index 000000000000..15414c3563ad --- /dev/null +++ b/automation/prj/d.lst @@ -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 + diff --git a/automation/util/makefile.mk b/automation/util/makefile.mk new file mode 100644 index 000000000000..006eceec4f7e --- /dev/null +++ b/automation/util/makefile.mk @@ -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 + diff --git a/extensions/inc/appsettings.hxx b/extensions/inc/appsettings.hxx new file mode 100644 index 000000000000..66c421327f3d --- /dev/null +++ b/extensions/inc/appsettings.hxx @@ -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 + diff --git a/extensions/inc/extensio.hrc b/extensions/inc/extensio.hrc new file mode 100644 index 000000000000..7a25a4893cee --- /dev/null +++ b/extensions/inc/extensio.hrc @@ -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 diff --git a/extensions/inc/ucbhelper/ext_content.hxx b/extensions/inc/ucbhelper/ext_content.hxx new file mode 100644 index 000000000000..ccd20d621862 --- /dev/null +++ b/extensions/inc/ucbhelper/ext_content.hxx @@ -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_ + + diff --git a/extensions/prj/d.lst b/extensions/prj/d.lst new file mode 100644 index 000000000000..23be9a44ac42 --- /dev/null +++ b/extensions/prj/d.lst @@ -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 diff --git a/extensions/source/bibliography/bib.hrc b/extensions/source/bibliography/bib.hrc new file mode 100644 index 000000000000..b2af8523b10e --- /dev/null +++ b/extensions/source/bibliography/bib.hrc @@ -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 diff --git a/extensions/source/bibliography/bib.src b/extensions/source/bibliography/bib.src new file mode 100644 index 000000000000..ed37b2ad2f0f --- /dev/null +++ b/extensions/source/bibliography/bib.src @@ -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 ] = "±zn½s±ÆÄæ¡H"; + Text[ arabic ] = "åá ÊÑíÏ ÊÍÑíÑ ÊÚííä ÇáÚãæÏ¿"; + Text[ turkish ] = "Sütunlarý düzenlemek istiyor musunuz?"; +}; diff --git a/extensions/source/bibliography/bibbeam.cxx b/extensions/source/bibliography/bibbeam.cxx new file mode 100644 index 000000000000..7848eab220b1 --- /dev/null +++ b/extensions/source/bibliography/bibbeam.cxx @@ -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); + } + +} + + diff --git a/extensions/source/bibliography/bibbeam.hxx b/extensions/source/bibliography/bibbeam.hxx new file mode 100644 index 000000000000..8fd7f4b81174 --- /dev/null +++ b/extensions/source/bibliography/bibbeam.hxx @@ -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 diff --git a/extensions/source/bibliography/bibcont.cxx b/extensions/source/bibliography/bibcont.cxx new file mode 100644 index 000000000000..49dca576f05b --- /dev/null +++ b/extensions/source/bibliography/bibcont.cxx @@ -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 ); + +} + diff --git a/extensions/source/bibliography/bibcont.hxx b/extensions/source/bibliography/bibcont.hxx new file mode 100644 index 000000000000..4c10b15941c3 --- /dev/null +++ b/extensions/source/bibliography/bibcont.hxx @@ -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 diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx new file mode 100644 index 000000000000..d5f246c97bc9 --- /dev/null +++ b/extensions/source/bibliography/bibload.cxx @@ -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 ) + { + *ppEnvTypeNam |