diff options
Diffstat (limited to 'framework/inc/uielement')
45 files changed, 4819 insertions, 0 deletions
diff --git a/framework/inc/uielement/addonstoolbarmanager.hxx b/framework/inc/uielement/addonstoolbarmanager.hxx new file mode 100644 index 000000000000..bf1525cf5f63 --- /dev/null +++ b/framework/inc/uielement/addonstoolbarmanager.hxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_ADDONSTOOLBARMANAGER_HXX_ +#define __FRAMEWORK_UIELEMENT_ADDONSTOOLBARMANAGER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_UILEMENT_TOOLBARMANAGER_HXX_ +#include <uielement/toolbarmanager.hxx> +#endif +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/interfacecontainer.hxx> + +#include <vcl/toolbox.hxx> + + +namespace framework +{ + +class ToolBar; +class AddonsToolBarManager : public ToolBarManager +{ + public: + AddonsToolBarManager( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServicveManager, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + const rtl::OUString& rResourceName, + ToolBar* pToolBar ); + virtual ~AddonsToolBarManager(); + + // XComponent + void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + virtual void RefreshImages(); + using ToolBarManager::FillToolbar; + void FillToolbar( const com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > >& rAddonToolbar ); + + protected: + DECL_LINK( Click, ToolBox * ); + DECL_LINK( DoubleClick, ToolBox * ); + DECL_LINK( Command, CommandEvent * ); + DECL_LINK( Select, ToolBox * ); + DECL_LINK( Highlight, ToolBox * ); + DECL_LINK( Activate, ToolBox * ); + DECL_LINK( Deactivate, ToolBox * ); + DECL_LINK( StateChanged, StateChangedType* ); + DECL_LINK( DataChanged, DataChangedEvent* ); + + virtual bool MenuItemAllowed( sal_uInt16 ) const; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_ADDONSTOOLBARMANAGER_HXX_ diff --git a/framework/inc/uielement/addonstoolbarwrapper.hxx b/framework/inc/uielement/addonstoolbarwrapper.hxx new file mode 100644 index 000000000000..e1a04acef2eb --- /dev/null +++ b/framework/inc/uielement/addonstoolbarwrapper.hxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_ADDONSTOOLBARWRAPPER_HXX_ +#define __FRAMEWORK_UIELEMENT_ADDONSTOOLBARWRAPPER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <helper/uielementwrapperbase.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +namespace framework +{ + +class AddonsToolBarManager; +class AddonsToolBarWrapper : public UIElementWrapperBase +{ + public: + AddonsToolBarWrapper( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~AddonsToolBarWrapper(); + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XUIElement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface() throw (::com::sun::star::uno::RuntimeException); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + private: + com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xToolBarManager; + com::sun::star::uno::Reference< com::sun::star::awt::XWindow > m_xToolBarWindow; + com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > m_aConfigData; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_ADDONSTOOLBARWRAPPER_HXX_ diff --git a/framework/inc/uielement/buttontoolbarcontroller.hxx b/framework/inc/uielement/buttontoolbarcontroller.hxx new file mode 100644 index 000000000000..eba7914e9430 --- /dev/null +++ b/framework/inc/uielement/buttontoolbarcontroller.hxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_BUTTONTOOLBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_BUTTONTOOLBARCONTROLLER_HXX_ + +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/util/XUpdatable.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/ControlCommand.hpp> +#include <com/sun/star/frame/XLayoutManager.hpp> +#include <com/sun/star/frame/XToolbarController.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ + +#include <comphelper/broadcasthelper.hxx> +#include <cppuhelper/weak.hxx> +#include <vcl/toolbox.hxx> + +namespace framework +{ + +class ToolBar; +class ButtonToolbarController : public ::com::sun::star::frame::XStatusListener, + public ::com::sun::star::frame::XToolbarController, + public ::com::sun::star::lang::XInitialization, + public ::com::sun::star::util::XUpdatable, + public ::com::sun::star::lang::XComponent, + public ::comphelper::OBaseMutex, + public ::cppu::OWeakObject +{ + public: + ButtonToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + ToolBox* pToolBar, + const rtl::OUString& aCommand ); + virtual ~ButtonToolbarController(); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XUpdatable + virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException); + + private: + sal_Bool m_bInitialized : 1, + m_bDisposed : 1; + rtl::OUString m_aCommandURL; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer; + ToolBox* m_pToolbar; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_BUTTONTOOLBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/comboboxtoolbarcontroller.hxx b/framework/inc/uielement/comboboxtoolbarcontroller.hxx new file mode 100644 index 000000000000..bc55ff78cd64 --- /dev/null +++ b/framework/inc/uielement/comboboxtoolbarcontroller.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_COMBOBOXTOOLBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_COMBOBOXTOOLBARCONTROLLER_HXX_ + +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/ControlCommand.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ + +//#include <vcl/toolbox.hxx> +//#include <vcl/combobox.hxx> +#include <uielement/complextoolbarcontroller.hxx> + +namespace framework +{ + +class ToolBar; +class ComboBoxControl; + +class IComboBoxListener +{ + public: + virtual void Select() = 0; + virtual void DoubleClick() = 0; + virtual void Modify() = 0; + virtual void KeyInput( const KeyEvent& rKEvt ) = 0; + virtual void GetFocus() = 0; + virtual void LoseFocus() = 0; + virtual long PreNotify( NotifyEvent& rNEvt ) = 0; +}; + +class ComboboxToolbarController : public IComboBoxListener, + public ComplexToolbarController + +{ + public: + ComboboxToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + ToolBox* pToolBar, + USHORT nID, + sal_Int32 nWidth, + const rtl::OUString& aCommand ); + virtual ~ComboboxToolbarController(); + + // XComponent + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + // IComboBoxListener + virtual void Select(); + virtual void DoubleClick(); + virtual void Modify(); + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void GetFocus(); + virtual void LoseFocus(); + virtual long PreNotify( NotifyEvent& rNEvt ); + + protected: + virtual void executeControlCommand( const ::com::sun::star::frame::ControlCommand& rControlCommand ); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const; + + private: + ComboBoxControl* m_pComboBox; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_COMBOBOXTOOLBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/commandinfo.hxx b/framework/inc/uielement/commandinfo.hxx new file mode 100644 index 000000000000..d33ab0d7baad --- /dev/null +++ b/framework/inc/uielement/commandinfo.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_COMMANDINFO_HXX_ +#define __FRAMEWORK_UIELEMENT_COMMANDINFO_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/generic.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#include <tools/solar.h> + +namespace framework +{ + +struct CommandInfo +{ + CommandInfo() : nId( 0 ), + nImageInfo( 0 ), + bMirrored( false ), + bRotated( false ) {} + + USHORT nId; + ::std::vector< USHORT > aIds; + sal_Int16 nImageInfo; + sal_Bool bMirrored : 1, + bRotated : 1; +}; + +typedef BaseHash< CommandInfo > CommandToInfoMap; + +} // namespace framework + +#endif // __FRAMEWORK_UIELEMENT_COMMANDINFO_HXX_ + diff --git a/framework/inc/uielement/complextoolbarcontroller.hxx b/framework/inc/uielement/complextoolbarcontroller.hxx new file mode 100644 index 000000000000..dfb7741a223b --- /dev/null +++ b/framework/inc/uielement/complextoolbarcontroller.hxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_COMPLEXTOOLBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_COMPLEXTOOLBARCONTROLLER_HXX_ + +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/ControlCommand.hpp> +#include <com/sun/star/frame/XControlNotificationListener.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <svtools/toolboxcontroller.hxx> + +#include <vcl/toolbox.hxx> + +namespace framework +{ + +struct ExecuteInfo +{ + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch; + ::com::sun::star::util::URL aTargetURL; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs; +}; + +struct NotifyInfo +{ + ::rtl::OUString aEventName; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XControlNotificationListener > xNotifyListener; + ::com::sun::star::util::URL aSourceURL; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > aInfoSeq; +}; + +class ToolBar; + +class ComplexToolbarController : public svt::ToolboxController + +{ + public: + ComplexToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + ToolBox* pToolBar, + USHORT nID, + const rtl::OUString& aCommand ); + virtual ~ComplexToolbarController(); + + // XComponent + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + DECL_STATIC_LINK( ComplexToolbarController, ExecuteHdl_Impl, ExecuteInfo* ); + DECL_STATIC_LINK( ComplexToolbarController, Notify_Impl, NotifyInfo* ); + + protected: + static sal_Int32 getFontSizePixel( const Window* pWindow ); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > getDispatchFromCommand( const rtl::OUString& aCommand ) const; + void addNotifyInfo( const ::rtl::OUString& aEventName, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& xDispatch, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rInfo ); + + virtual void executeControlCommand( const ::com::sun::star::frame::ControlCommand& rControlCommand ) = 0; + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const; + const ::com::sun::star::util::URL& getInitializedURL(); + void notifyFocusGet(); + void notifyFocusLost(); + void notifyTextChanged( const ::rtl::OUString& aText ); + + ToolBox* m_pToolbar; + sal_uInt16 m_nID; + sal_Bool m_bMadeInvisible; + mutable ::com::sun::star::util::URL m_aURL; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_COMPLEXTOOLBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/constitemcontainer.hxx b/framework/inc/uielement/constitemcontainer.hxx new file mode 100644 index 000000000000..c2eeea0e3c28 --- /dev/null +++ b/framework/inc/uielement/constitemcontainer.hxx @@ -0,0 +1,137 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_CONSTITEMCONTAINER_HXX_ +#define __FRAMEWORK_UIELEMENT_CONSTITEMCONTAINER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/lang/XSingleComponentFactory.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XFastPropertySet.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/propshlp.hxx> + +#include <vector> + +namespace framework +{ + +class RootItemContainer; +class ItemContainer; +class ConstItemContainer : public ::com::sun::star::lang::XTypeProvider , + public com::sun::star::container::XIndexAccess , + public ::com::sun::star::lang::XUnoTunnel , + public ::com::sun::star::beans::XFastPropertySet, + public ::com::sun::star::beans::XPropertySet , + public ::cppu::OWeakObject +{ + friend class RootItemContainer; + friend class ItemContainer; + + public: + ConstItemContainer(); + ConstItemContainer( const ItemContainer& rtemContainer ); + ConstItemContainer( const RootItemContainer& rRootItemContainer, sal_Bool bFastCopy = sal_False ); + ConstItemContainer( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rSourceContainer, sal_Bool bFastCopy = sal_False ); + virtual ~ConstItemContainer(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider + //--------------------------------------------------------------------------------------------------------- + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + // XUnoTunnel + static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw(); + static ConstItemContainer* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw(); + sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() + throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw (::com::sun::star::uno::RuntimeException) + { + return ::getCppuType((com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >*)0); + } + + virtual sal_Bool SAL_CALL hasElements() + throw (::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XFastPropertySet + virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue( sal_Int32 nHandle ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + private: + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + const com::sun::star::uno::Sequence< com::sun::star::beans::Property > impl_getStaticPropertyDescriptor(); + static ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySetInfo > SAL_CALL createPropertySetInfo( ::cppu::IPropertyArrayHelper & rProperties ) SAL_THROW( () ); + + void copyItemContainer( const std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > >& rSourceVector ); + com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > deepCopyContainer( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rSubContainer ); + + std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > m_aItemVector; + rtl::OUString m_aUIName; +}; + +} + +#endif // #ifndef __FRAMEWORK_UIELEMENT_CONSTITEMCONTAINER_HXX_ diff --git a/framework/inc/uielement/controlmenucontroller.hxx b/framework/inc/uielement/controlmenucontroller.hxx new file mode 100644 index 000000000000..6e0c9deb03c0 --- /dev/null +++ b/framework/inc/uielement/controlmenucontroller.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_CONTROLMENUCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_CONTROLMENUCONTROLLER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> +#include <com/sun/star/frame/status/Verb.hpp> +#include <com/sun/star/frame/XModel.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> +#include <toolkit/awt/vclxmenu.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> + +class PopupMenu; +namespace framework +{ + class ControlMenuController : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + public: + ControlMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~ControlMenuController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XPopupMenuController + virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XMenuListener + virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + private: + virtual void impl_setPopupMenu(); + virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL); + + class UrlToDispatchMap : public ::std::hash_map< ::rtl::OUString, + com::sun::star::uno::Reference< com::sun::star::frame::XDispatch >, + OUStringHashCode, + ::std::equal_to< ::rtl::OUString > > + { + public: + inline void free() + { + UrlToDispatchMap().swap( *this ); + } + }; + + void updateImagesPopupMenu( PopupMenu* pPopupMenu ); + void fillPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ); + + sal_Bool m_bWasHiContrast : 1, + m_bShowMenuImages : 1; + PopupMenu* m_pResPopupMenu; + UrlToDispatchMap m_aURLToDispatchMap; + }; +} + +#endif // __FRAMEWORK_UIELEMENT_CONTROLMENUCONTROLLER_HXX_ diff --git a/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx b/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx new file mode 100644 index 000000000000..4f828c35ff3e --- /dev/null +++ b/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_DROPDOWNBOXTOOLBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_DROPDOWNBOXTOOLBARCONTROLLER_HXX_ + +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/ControlCommand.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ + +#include <uielement/complextoolbarcontroller.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/lstbox.hxx> + +namespace framework +{ + +class ToolBar; +class ListBoxControl; + +class IListBoxListener +{ + public: + virtual void Select() = 0; + virtual void DoubleClick() = 0; + virtual void GetFocus() = 0; + virtual void LoseFocus() = 0; + virtual long PreNotify( NotifyEvent& rNEvt ) = 0; +}; + +class DropdownToolbarController : public IListBoxListener, + public ComplexToolbarController + +{ + public: + DropdownToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + ToolBox* pToolBar, + USHORT nID, + sal_Int32 nWidth, + const rtl::OUString& aCommand ); + virtual ~DropdownToolbarController(); + + // XComponent + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + // IComboBoxListener + virtual void Select(); + virtual void DoubleClick(); + virtual void GetFocus(); + virtual void LoseFocus(); + virtual long PreNotify( NotifyEvent& rNEvt ); + + protected: + virtual void executeControlCommand( const ::com::sun::star::frame::ControlCommand& rControlCommand ); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const; + + private: + ListBoxControl* m_pListBoxControl; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_DROPDOWNBOXTOOLBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/edittoolbarcontroller.hxx b/framework/inc/uielement/edittoolbarcontroller.hxx new file mode 100644 index 000000000000..cdb22db98997 --- /dev/null +++ b/framework/inc/uielement/edittoolbarcontroller.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_EDITTOOLBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_EDITTOOLBARCONTROLLER_HXX_ + +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/ControlCommand.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ + +#include <uielement/complextoolbarcontroller.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/edit.hxx> + +namespace framework +{ + +class ToolBar; +class EditControl; + +class IEditListener +{ + public: + virtual void Modify() = 0; + virtual void KeyInput( const KeyEvent& rKEvt ) = 0; + virtual void GetFocus() = 0; + virtual void LoseFocus() = 0; + virtual long PreNotify( NotifyEvent& rNEvt ) = 0; +}; + +class EditToolbarController : public IEditListener, + public ComplexToolbarController + +{ + public: + EditToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + ToolBox* pToolBar, + USHORT nID, + sal_Int32 nWidth, + const rtl::OUString& aCommand ); + virtual ~EditToolbarController(); + + // XComponent + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + // IEditListener + virtual void Modify(); + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void GetFocus(); + virtual void LoseFocus(); + virtual long PreNotify( NotifyEvent& rNEvt ); + + protected: + virtual void executeControlCommand( const ::com::sun::star::frame::ControlCommand& rControlCommand ); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const; + + private: + EditControl* m_pEditControl; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_EDITTOOLBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/fontmenucontroller.hxx b/framework/inc/uielement/fontmenucontroller.hxx new file mode 100644 index 000000000000..79905658839b --- /dev/null +++ b/framework/inc/uielement/fontmenucontroller.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_FONTMENUCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_FONTMENUCONTROLLER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> +#include <toolkit/awt/vclxmenu.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> + +namespace framework +{ + class FontMenuController : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + public: + FontMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~FontMenuController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XPopupMenuController + virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XMenuListener + virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + private: + virtual void impl_setPopupMenu(); + virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL); + void fillPopupMenu( const com::sun::star::uno::Sequence< ::rtl::OUString >& rFontNameSeq, com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ); + + rtl::OUString m_aFontFamilyName; + com::sun::star::uno::Reference< com::sun::star::frame::XDispatch > m_xFontListDispatch; + }; +} + +#endif // __FRAMEWORK_UIELEMENT_FONTMENUCONTROLLER_HXX_ diff --git a/framework/inc/uielement/fontsizemenucontroller.hxx b/framework/inc/uielement/fontsizemenucontroller.hxx new file mode 100644 index 000000000000..4e5623084908 --- /dev/null +++ b/framework/inc/uielement/fontsizemenucontroller.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_FONTSIZEMENUCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_FONTSIZEMENUCONTROLLER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> +#include <com/sun/star/frame/status/FontHeight.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> +#include <toolkit/awt/vclxmenu.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> + +namespace framework +{ + class FontSizeMenuController : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + public: + FontSizeMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~FontSizeMenuController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XPopupMenuController + virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + private: + virtual void impl_setPopupMenu(); + virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL); + void setCurHeight( long nHeight, com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ); + void fillPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ); + rtl::OUString retrievePrinterName( com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame ); + + long* m_pHeightArray; + sal_Bool m_bRebuildMenu; + com::sun::star::awt::FontDescriptor m_aFontDescriptor; + ::com::sun::star::frame::status::FontHeight m_aFontHeight; + com::sun::star::uno::Reference< com::sun::star::frame::XDispatch > m_xCurrentFontDispatch; + }; +} + +#endif // __FRAMEWORK_UIELEMENT_FONTSIZEMENUCONTROLLER_HXX_ diff --git a/framework/inc/uielement/footermenucontroller.hxx b/framework/inc/uielement/footermenucontroller.hxx new file mode 100644 index 000000000000..cc154e41a6c3 --- /dev/null +++ b/framework/inc/uielement/footermenucontroller.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_FOOTERMENUCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_FOOTERMENUCONTROLLER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <uielement/headermenucontroller.hxx> + +namespace framework +{ + class FooterMenuController : public HeaderMenuController + { + public: + FooterMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~FooterMenuController(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName ( ) throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService ( const ::rtl::OUString& sServiceName ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames ( ) throw( css::uno::RuntimeException ); + /* Helper for XServiceInfo */ + static css::uno::Sequence< ::rtl::OUString > SAL_CALL impl_getStaticSupportedServiceNames( ); + static ::rtl::OUString SAL_CALL impl_getStaticImplementationName ( ); + /* Helper for registry */ + static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::Exception ); + static css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + }; +} + +#endif // __FRAMEWORK_UIELEMENT_FOOTERMENUCONTROLLER_HXX_ diff --git a/framework/inc/uielement/generictoolbarcontroller.hxx b/framework/inc/uielement/generictoolbarcontroller.hxx new file mode 100644 index 000000000000..d8efaf1ad5ad --- /dev/null +++ b/framework/inc/uielement/generictoolbarcontroller.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_GENERICTOOLBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_GENERICTOOLBARCONTROLLER_HXX_ + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ + +#include <svtools/toolboxcontroller.hxx> +#include <vcl/toolbox.hxx> +#include <memory> + +class PopupMenu; + +namespace framework +{ + +struct ExecuteInfo; +class ToolBar; +class GenericToolbarController : public svt::ToolboxController +{ + public: + GenericToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + ToolBox* pToolBar, + USHORT nID, + const rtl::OUString& aCommand ); + virtual ~GenericToolbarController(); + + // XComponent + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + DECL_STATIC_LINK( GenericToolbarController, ExecuteHdl_Impl, ExecuteInfo* ); + + protected: + ToolBox* m_pToolbar; + sal_uInt16 m_nID; + sal_Bool m_bEnumCommand : 1, + m_bMadeInvisible : 1; + rtl::OUString m_aEnumCommand; +}; + +class MenuToolbarController : public GenericToolbarController +{ + com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > m_xMenuDesc; + PopupMenu* pMenu; + com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xMenuManager; + rtl::OUString m_aModuleIdentifier; + public: + MenuToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + ToolBox* pToolBar, + USHORT nID, + const rtl::OUString& aCommand, + const rtl::OUString& aModuleIdentifier, + const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& xMenuDesc ); + + ~MenuToolbarController(); + // XToolbarController + virtual void SAL_CALL click() throw ( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException); + +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_GENERICTOOLBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/headermenucontroller.hxx b/framework/inc/uielement/headermenucontroller.hxx new file mode 100644 index 000000000000..0deeb878156d --- /dev/null +++ b/framework/inc/uielement/headermenucontroller.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_HEADERMENUCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_HEADERMENUCONTROLLER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> +#include <com/sun/star/frame/status/Verb.hpp> +#include <com/sun/star/frame/XModel.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> +#include <toolkit/awt/vclxmenu.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> + +namespace framework +{ + class HeaderMenuController : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + public: + HeaderMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager,bool _bFooter = sal_False ); + virtual ~HeaderMenuController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XPopupMenuController + virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + private: + virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL); + void fillPopupMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rModel, com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ); + + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel; + bool m_bFooter; + }; +} + +#endif // __FRAMEWORK_UIELEMENT_HEADERMENUCONTROLLER_HXX_ diff --git a/framework/inc/uielement/imagebuttontoolbarcontroller.hxx b/framework/inc/uielement/imagebuttontoolbarcontroller.hxx new file mode 100644 index 000000000000..d67ee86ef569 --- /dev/null +++ b/framework/inc/uielement/imagebuttontoolbarcontroller.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_IMAGEBUTTONTOOLBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_IMAGEBUTTONTOOLBARCONTROLLER_HXX_ + +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/ControlCommand.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ + +#include <uielement/complextoolbarcontroller.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/image.hxx> + +namespace framework +{ + +class ToolBar; +class ImageButtonToolbarController : public ComplexToolbarController + +{ + public: + ImageButtonToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + ToolBox* pToolBar, + USHORT nID, + const rtl::OUString& aCommand ); + virtual ~ImageButtonToolbarController(); + + // XComponent + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + protected: + virtual void executeControlCommand( const ::com::sun::star::frame::ControlCommand& rControlCommand ); + + private: + sal_Bool ReadImageFromURL( sal_Bool bBigImage, const rtl::OUString& aImageURL, Image& aImage ); +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_IMAGEBUTTONTOOLBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/itemcontainer.hxx b/framework/inc/uielement/itemcontainer.hxx new file mode 100644 index 000000000000..ab45d039e636 --- /dev/null +++ b/framework/inc/uielement/itemcontainer.hxx @@ -0,0 +1,117 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_ITEMCONTAINER_HXX_ +#define __FRAMEWORK_UIELEMENT_ITEMCONTAINER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <helper/shareablemutex.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> +#include <cppuhelper/implbase1.hxx> + +#include <vector> + +namespace framework +{ + +class ConstItemContainer; +class ItemContainer : public ::cppu::WeakImplHelper1< ::com::sun::star::container::XIndexContainer> +{ + friend class ConstItemContainer; + + public: + ItemContainer( const ShareableMutex& ); + ItemContainer( const ConstItemContainer& rConstItemContainer, const ShareableMutex& rMutex ); + ItemContainer( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rItemAccessContainer, const ShareableMutex& rMutex ); + virtual ~ItemContainer(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider + //--------------------------------------------------------------------------------------------------------- + // XUnoTunnel + static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw(); + static ItemContainer* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw(); + sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException); + + // XIndexContainer + virtual void SAL_CALL insertByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL removeByIndex( sal_Int32 Index ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XIndexReplace + virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() + throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw (::com::sun::star::uno::RuntimeException) + { + return ::getCppuType((com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >*)0); + } + + virtual sal_Bool SAL_CALL hasElements() + throw (::com::sun::star::uno::RuntimeException); + + private: + ItemContainer(); + void copyItemContainer( const std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > >& rSourceVector, const ShareableMutex& rMutex ); + com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > deepCopyContainer( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rSubContainer, const ShareableMutex& rMutex ); + + mutable ShareableMutex m_aShareMutex; + std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > m_aItemVector; +}; + +} + +#endif // #ifndef __FRAMEWORK_UIELEMENT_ITEMCONTAINER_HXX_ diff --git a/framework/inc/uielement/langselectionmenucontroller.hxx b/framework/inc/uielement/langselectionmenucontroller.hxx new file mode 100644 index 000000000000..257638ecd77f --- /dev/null +++ b/framework/inc/uielement/langselectionmenucontroller.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_LANGUAGESELECTIONMENUCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_LANGUAGESELECTIONMENUCONTROLLER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> +#include <com/sun/star/linguistic2/XLanguageGuessing.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> +#include <toolkit/awt/vclxmenu.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> + +#include "helper/mischelper.hxx" + +namespace framework +{ + class LanguageSelectionMenuController : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + public: + LanguageSelectionMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~LanguageSelectionMenuController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XPopupMenuController + virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + private: + virtual void impl_setPopupMenu(); + virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL); + enum Mode + { + MODE_SetLanguageSelectionMenu, + MODE_SetLanguageParagraphMenu, + MODE_SetLanguageAllTextMenu + }; + + sal_Bool m_bShowMenu; + ::rtl::OUString m_aLangStatusCommandURL; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xLanguageDispatch; + ::rtl::OUString m_aMenuCommandURL_Lang; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xMenuDispatch_Lang; + ::rtl::OUString m_aMenuCommandURL_Font; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xMenuDispatch_Font; + ::rtl::OUString m_aMenuCommandURL_CharDlgForParagraph; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xMenuDispatch_CharDlgForParagraph; + ::rtl::OUString m_aCurLang; + sal_Int16 m_nScriptType; + ::rtl::OUString m_aKeyboardLang; + ::rtl::OUString m_aGuessedTextLang; + LanguageGuessingHelper m_aLangGuessHelper; + + void fillPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu, const Mode rMode ); + }; +} + +#endif // __FRAMEWORK_UIELEMENT_LANGUAGESELECTIONMENUCONTROLLER_HXX_ diff --git a/framework/inc/uielement/langselectionstatusbarcontroller.hxx b/framework/inc/uielement/langselectionstatusbarcontroller.hxx new file mode 100644 index 000000000000..4d46538eb6d6 --- /dev/null +++ b/framework/inc/uielement/langselectionstatusbarcontroller.hxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_LANGSELECTIONSTATUSBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_LANGSELECTIONSTATUSBARCONTROLLER_HXX_ + +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> +#include <com/sun/star/linguistic2/XLanguageGuessing.hpp> +#include <svtools/statusbarcontroller.hxx> +#include <rtl/ustring.hxx> + +#include "helper/mischelper.hxx" + +#include <set> + +class SvtLanguageTable; + + +// component helper namespace +namespace framework { + +class LangSelectionStatusbarController : public svt::StatusbarController +{ + public: + explicit LangSelectionStatusbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XStatusbarController + virtual ::sal_Bool SAL_CALL mouseButtonDown( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL mouseMove( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL mouseButtonUp( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL command( const ::com::sun::star::awt::Point& aPos, + ::sal_Int32 nCommand, + ::sal_Bool bMouseEvent, + const ::com::sun::star::uno::Any& aData ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL paint( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics, + const ::com::sun::star::awt::Rectangle& rOutputRectangle, + ::sal_Int32 nItemId, ::sal_Int32 nStyle ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException); + + private: + virtual ~LangSelectionStatusbarController() {} + LangSelectionStatusbarController(LangSelectionStatusbarController &); // not defined + void operator =(LangSelectionStatusbarController &); // not defined + + + sal_Bool m_bShowMenu; // if the menu is to be displayed or not (depending on the selected object/text) + sal_Int16 m_nScriptType; // the flags for the different script types available in the selection, LATIN = 0x0001, ASIAN = 0x0002, COMPLEX = 0x0004 + ::rtl::OUString m_aCurLang; // the language of the current selection, "*" if there are more than one languages + ::rtl::OUString m_aKeyboardLang; // the keyboard language + ::rtl::OUString m_aGuessedTextLang; // the 'guessed' language for the selection, "" if none could be guessed + LanguageGuessingHelper m_aLangGuessHelper; + + void LangMenu() throw (::com::sun::star::uno::RuntimeException); +}; + +} // framework namespace + +#endif // __FRAMEWORK_UIELEMENT_LANGSELECTIONSTATUSBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/logoimagestatusbarcontroller.hxx b/framework/inc/uielement/logoimagestatusbarcontroller.hxx new file mode 100644 index 000000000000..6f4a3ffb6563 --- /dev/null +++ b/framework/inc/uielement/logoimagestatusbarcontroller.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_LOGOIMAGESTATUSBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_LOGOIMAGESTATUSBARCONTROLLER_HXX_ + +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> +#include <svtools/statusbarcontroller.hxx> +#include <vcl/image.hxx> + +namespace framework +{ + +class LogoImageStatusbarController : public svt::StatusbarController +{ + public: + LogoImageStatusbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~LogoImageStatusbarController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XStatusbarController + virtual ::sal_Bool SAL_CALL mouseButtonDown( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL mouseMove( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL mouseButtonUp( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL command( const ::com::sun::star::awt::Point& aPos, + ::sal_Int32 nCommand, + ::sal_Bool bMouseEvent, + const ::com::sun::star::uno::Any& aData ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL paint( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics, + const ::com::sun::star::awt::Rectangle& rOutputRectangle, + ::sal_Int32 nItemId, ::sal_Int32 nStyle ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException); + + private: + Image m_aLogoImage; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_LOGOIMAGESTATUSBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/logotextstatusbarcontroller.hxx b/framework/inc/uielement/logotextstatusbarcontroller.hxx new file mode 100644 index 000000000000..5adba49186eb --- /dev/null +++ b/framework/inc/uielement/logotextstatusbarcontroller.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_LOGOTEXTSTATUSBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_LOGOTEXTSTATUSBARCONTROLLER_HXX_ + +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> +#include <svtools/statusbarcontroller.hxx> +#include <vcl/image.hxx> + +namespace framework +{ + +class LogoTextStatusbarController : public svt::StatusbarController +{ + public: + LogoTextStatusbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~LogoTextStatusbarController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XStatusbarController + virtual ::sal_Bool SAL_CALL mouseButtonDown( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL mouseMove( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL mouseButtonUp( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL command( const ::com::sun::star::awt::Point& aPos, + ::sal_Int32 nCommand, + ::sal_Bool bMouseEvent, + const ::com::sun::star::uno::Any& aData ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL paint( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics, + const ::com::sun::star::awt::Rectangle& rOutputRectangle, + ::sal_Int32 nItemId, ::sal_Int32 nStyle ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException); + + private: + rtl::OUString m_aLogoText; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_LOGOTEXTSTATUSBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/macrosmenucontroller.hxx b/framework/inc/uielement/macrosmenucontroller.hxx new file mode 100644 index 000000000000..1e8b9024eaca --- /dev/null +++ b/framework/inc/uielement/macrosmenucontroller.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_MACROSMENUCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_MACROSMENUCONTROLLER_HXX_ + +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> +#include <svtools/popupmenucontrollerbase.hxx> +#include <toolkit/awt/vclxmenu.hxx> +#include <cppuhelper/weak.hxx> +#include <vcl/menu.hxx> +#include <rtl/ustring.hxx> + +namespace framework +{ + class MacrosMenuController : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + struct ExecuteInfo + { + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch; + ::com::sun::star::util::URL aTargetURL; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs; + }; + DECL_STATIC_LINK( MacrosMenuController, ExecuteHdl_Impl, ExecuteInfo* ); + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xDispatchProvider; + ::rtl::OUString m_aModuleIdentifier; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xUICommandLabels; + + public: + MacrosMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~MacrosMenuController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + private: + virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL); + void fillPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ); + String RetrieveLabelFromCommand( const String& aCmdURL ); + void addScriptItems( PopupMenu* pPopupMenu, USHORT startItemId ); + }; +} + +#endif // __FRAMEWORK_UIELEMENT_MACROSMENUCONTROLLER_HXX_ diff --git a/framework/inc/uielement/menubarmanager.hxx b/framework/inc/uielement/menubarmanager.hxx new file mode 100644 index 000000000000..773efafa52fe --- /dev/null +++ b/framework/inc/uielement/menubarmanager.hxx @@ -0,0 +1,278 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_MENUBARMANAGER_HXX_ +#define __FRAMEWORK_UIELEMENT_MENUBARMANAGER_HXX_ + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <threadhelp/threadhelpbase.hxx> +#include <macros/debug.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/FeatureStateEvent.hpp> +#include <com/sun/star/frame/XFrameActionListener.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> +#include <com/sun/star/awt/XSystemDependentMenuPeer.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMultiComponentFactory.hpp> +#include <com/sun/star/frame/XUIControllerRegistration.hpp> +#include <com/sun/star/ui/XUIConfigurationListener.hpp> +#include <com/sun/star/ui/XImageManager.hpp> +#include <com/sun/star/ui/XAcceleratorConfiguration.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> +#include <vcl/menu.hxx> +#include <vcl/accel.hxx> +#include <vcl/timer.hxx> +#include <toolkit/awt/vclxmenu.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <classes/addonsoptions.hxx> + +namespace framework +{ + +struct PopupControllerEntry +{ + ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XDispatchProvider > m_xDispatchProvider; +}; + +typedef std::hash_map< rtl::OUString, PopupControllerEntry, OUStringHashCode, ::std::equal_to< rtl::OUString > > PopupControllerCache; + +class BmkMenu; +class AddonMenu; +class AddonPopupMenu; +class MenuBarManager : public com::sun::star::frame::XStatusListener , + public com::sun::star::frame::XFrameActionListener , + public com::sun::star::ui::XUIConfigurationListener , + public com::sun::star::lang::XComponent , + public com::sun::star::awt::XSystemDependentMenuPeer , + public ThreadHelpBase , + public ::cppu::OWeakObject +{ + protected: + // #110897# + MenuBarManager( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer >& _xURLTransformer, + AddonMenu* pAddonMenu, + sal_Bool bDelete, + sal_Bool bDeleteChildren ); + + // #110897# + MenuBarManager( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer >& _xURLTransformer, + AddonPopupMenu* pAddonMenu, + sal_Bool bDelete, + sal_Bool bDeleteChildren ); + + public: + // #110897# + MenuBarManager( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer >& _xURLTransformer, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider, + const rtl::OUString& aModuleIdentifier, + Menu* pMenu, + sal_Bool bDelete, + sal_Bool bDeleteChildren ); + + // #110897# + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getServiceFactory(); + + virtual ~MenuBarManager(); + + // XInterface + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw( ::com::sun::star::uno::RuntimeException ); + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XFrameActionListener + virtual void SAL_CALL frameAction( const com::sun::star::frame::FrameActionEvent& Action ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XUIConfigurationListener + virtual void SAL_CALL elementInserted( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementRemoved( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementReplaced( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + + // XSystemDependentMenuPeer + virtual ::com::sun::star::uno::Any SAL_CALL getMenuHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& ProcessId, sal_Int16 SystemType ) throw (::com::sun::star::uno::RuntimeException); + + DECL_LINK( Select, Menu * ); + + Menu* GetMenuBar() const { return m_pVCLMenu; } + + // Configuration methods + static void FillMenuWithConfiguration( USHORT& nId, Menu* pMenu, + const ::rtl::OUString& rModuleIdentifier, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rItemContainer, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer >& rTransformer ); + static void FillMenu( USHORT& nId, + Menu* pMenu, + const ::rtl::OUString& rModuleIdentifier, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rItemContainer, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider ); + + void FillMenuManager( Menu* pMenu, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider, + const rtl::OUString& rModuleIdentifier, + sal_Bool bDelete, + sal_Bool bDeleteChildren ); + void SetItemContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rItemContainer ); + void GetPopupController( PopupControllerCache& rPopupController ); + + protected: + DECL_LINK( Highlight, Menu * ); + DECL_LINK( Activate, Menu * ); + DECL_LINK( Deactivate, Menu * ); + DECL_LINK( AsyncSettingsHdl, Timer * ); + + void RemoveListener(); + void RequestImages(); + void RetrieveImageManagers(); + static sal_Bool MustBeHidden( PopupMenu* pPopupMenu, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer >& rTransformer ); + String RetrieveLabelFromCommand( const String& aCmdURL ); + + private: + + + + void Destroy(); + + struct MenuItemHandler + { + MenuItemHandler( USHORT aItemId, + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xManager, + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& rDispatch ) : + nItemId( aItemId ), + bCheckHide( sal_True ), + xSubMenuManager( xManager ), + xMenuItemDispatch( rDispatch ) {} + + USHORT nItemId; + sal_Bool bCheckHide; + ::rtl::OUString aTargetFrame; + ::rtl::OUString aMenuItemURL; + ::rtl::OUString aFilter; + ::rtl::OUString aPassword; + ::rtl::OUString aTitle; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > xSubMenuManager; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xMenuItemDispatch; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XPopupMenuController > xPopupMenuController; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > xPopupMenu; + KeyCode aKeyCode; + }; + + void RetrieveShortcuts( std::vector< MenuItemHandler* >& aMenuShortCuts ); + void CreatePicklistArguments( + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgsList, + const MenuItemHandler* ); + void CheckAndAddMenuExtension( Menu* pMenu ); + static void impl_RetrieveShortcutsFromConfiguration( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration >& rAccelCfg, + const ::com::sun::star::uno::Sequence< rtl::OUString >& rCommands, + std::vector< MenuItemHandler* >& aMenuShortCuts ); + static void MergeAddonMenus( Menu* pMenuBar, const MergeMenuInstructionContainer&, const ::rtl::OUString& aModuleIdentifier ); + + MenuItemHandler* GetMenuItemHandler( USHORT nItemId ); + sal_Bool CreatePopupMenuController( MenuItemHandler* pMenuItemHandler ); + void AddMenu(MenuBarManager* pSubMenuManager,const ::rtl::OUString& _sItemCommand,USHORT _nItemId); + USHORT FillItemCommand(::rtl::OUString& _rItemCommand,Menu* _pMenu,USHORT _nIndex) const; + void Init(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,AddonMenu* pAddonMenu,sal_Bool bDelete,sal_Bool bDeleteChildren,bool _bHandlePopUp = false); + void SetHdl(); + + sal_Bool m_bDisposed : 1, + m_bInitialized : 1, + m_bDeleteMenu : 1, + m_bDeleteChildren : 1, + m_bActive : 1, + m_bIsBookmarkMenu : 1, + m_bWasHiContrast : 1, + m_bShowMenuImages : 1; + sal_Bool m_bRetrieveImages : 1, + m_bAcceleratorCfg : 1; + sal_Bool m_bModuleIdentified; + ::rtl::OUString m_aMenuItemCommand; + ::rtl::OUString m_aModuleIdentifier; + Menu* m_pVCLMenu; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xUICommandLabels; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XUIControllerRegistration > m_xPopupMenuControllerRegistration; + ::std::vector< MenuItemHandler* > m_aMenuItemHandlerVector; + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xDispatchProvider; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XImageManager > m_xDocImageManager; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XImageManager > m_xModuleImageManager; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xDocAcceleratorManager; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xModuleAcceleratorManager; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xGlobalAcceleratorManager; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceFactory; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > m_xDeferedItemContainer; + sal_Int16 m_nSymbolsStyle; + Timer m_aAsyncSettingsTimer; +}; + +} // namespace + +#endif diff --git a/framework/inc/uielement/menubarmerger.hxx b/framework/inc/uielement/menubarmerger.hxx new file mode 100644 index 000000000000..e4e930faafe2 --- /dev/null +++ b/framework/inc/uielement/menubarmerger.hxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_MENUBARMERGER_HXX_ +#define __FRAMEWORK_UIELEMENT_MENUBARMERGER_HXX_ + +#include <com/sun/star/beans/PropertyValue.hpp> + +#include <rtl/ustring.hxx> +#include <vcl/menu.hxx> + +namespace framework +{ + +struct AddonMenuItem; +typedef ::std::vector< AddonMenuItem > AddonMenuContainer; + +struct AddonMenuItem +{ + ::rtl::OUString aTitle; + ::rtl::OUString aURL; + ::rtl::OUString aTarget; + ::rtl::OUString aImageId; + ::rtl::OUString aContext; + AddonMenuContainer aSubMenu; +}; + +enum RPResultInfo +{ + RP_OK, + RP_POPUPMENU_NOT_FOUND, + RP_MENUITEM_NOT_FOUND, + RP_MENUITEM_INSTEAD_OF_POPUPMENU_FOUND +}; + +struct ReferencePathInfo +{ + Menu* pPopupMenu; + sal_uInt16 nPos; + sal_Int32 nLevel; + RPResultInfo eResult; +}; + +class MenuBarMerger +{ + public: + static bool IsCorrectContext( const ::rtl::OUString& aContext, const ::rtl::OUString& aModuleIdentifier ); + + static void RetrieveReferencePath( const ::rtl::OUString&, + std::vector< ::rtl::OUString >& aReferencePath ); + static ReferencePathInfo FindReferencePath( const std::vector< ::rtl::OUString >& aReferencePath, Menu* pMenu ); + static sal_uInt16 FindMenuItem( const ::rtl::OUString& rCmd, + Menu* pMenu ); + static void GetMenuEntry( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rAddonMenuEntry, + AddonMenuItem& aAddonMenu ); + static void GetSubMenu( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& rSubMenuEntries, + AddonMenuContainer& rSubMenu ); + static bool ProcessMergeOperation( Menu* pMenu, + sal_uInt16 nPos, + sal_uInt16& rItemId, + const ::rtl::OUString& rMergeCommand, + const ::rtl::OUString& rMergeCommandParameter, + const ::rtl::OUString& rModuleIdentifier, + const AddonMenuContainer& rAddonMenuItems ); + static bool ProcessFallbackOperation( const ReferencePathInfo& aRefPathInfo, + sal_uInt16& rItemId, + const ::rtl::OUString& rMergeCommand, + const ::rtl::OUString& rMergeFallback, + const ::std::vector< ::rtl::OUString >& rReferencePath, + const ::rtl::OUString& rModuleIdentifier, + const AddonMenuContainer& rAddonMenuItems ); + static bool ProcessFallbackOperation(); + static bool MergeMenuItems( Menu* pMenu, + sal_uInt16 nPos, + sal_uInt16 nModIndex, + sal_uInt16& rItemId, + const ::rtl::OUString& rModuleIdentifier, + const AddonMenuContainer& rAddonMenuItems ); + static bool ReplaceMenuItem( Menu* pMenu, + sal_uInt16 nPos, + sal_uInt16& rItemId, + const ::rtl::OUString& rModuleIdentifier, + const AddonMenuContainer& rAddonMenuItems ); + static bool RemoveMenuItems( Menu* pMenu, + sal_uInt16 nPos, + const ::rtl::OUString& rMergeCommandParameter ); + static bool CreateSubMenu( Menu* pSubMenu, + sal_uInt16& nItemId, + const ::rtl::OUString& rModuleIdentifier, + const AddonMenuContainer& rAddonSubMenu ); + + private: + MenuBarMerger(); + MenuBarMerger( const MenuBarMerger& ); + MenuBarMerger& operator=( const MenuBarMerger& ); +}; + +} // namespace framework + +#endif // __FRAMEWORK_UIELEMENT_MENUBARMERGER_HXX_ diff --git a/framework/inc/uielement/menubarwrapper.hxx b/framework/inc/uielement/menubarwrapper.hxx new file mode 100644 index 000000000000..e5ccacd28c8f --- /dev/null +++ b/framework/inc/uielement/menubarwrapper.hxx @@ -0,0 +1,109 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_MENUBARWRAPPER_HXX_ +#define __FRAMEWORK_UIELEMENT_MENUBARWRAPPER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <helper/uiconfigelementwrapperbase.hxx> +#include <uielement/menubarmanager.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#ifndef __COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ +#include <com/sun/star/container/XNameAccess.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#include <hash_map> + +namespace framework +{ + +class MenuBarWrapper : public UIConfigElementWrapperBase, + public ::com::sun::star::container::XNameAccess + +{ + public: + // #110897# + MenuBarWrapper( + const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~MenuBarWrapper(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider + //--------------------------------------------------------------------------------------------------------- + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + MenuBarManager* GetMenuBarManager() const { return static_cast< MenuBarManager* >( m_xMenuBarManager.get() ); } + void InvalidatePopupControllerCache() { m_bRefreshPopupControllerCache = sal_True; } + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XUIElement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface() throw (::com::sun::star::uno::RuntimeException); + + // XUIElementSettings + virtual void SAL_CALL updateSettings( ) throw (::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasElements() throw (::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + + private: + virtual void impl_fillNewData(); + void fillPopupControllerCache(); + + sal_Bool m_bRefreshPopupControllerCache : 1; + com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xMenuBarManager; + PopupControllerCache m_aPopupControllerCache; +}; + +} // namespace framework + +#endif // __FRAMEWORK_UIELEMENT_MENUBARWRAPPER_HXX_ diff --git a/framework/inc/uielement/newmenucontroller.hxx b/framework/inc/uielement/newmenucontroller.hxx new file mode 100644 index 000000000000..5e14b70f0044 --- /dev/null +++ b/framework/inc/uielement/newmenucontroller.hxx @@ -0,0 +1,136 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_NEWMENUCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_NEWMENUCONTROLLER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/ui/XAcceleratorConfiguration.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> +#include <toolkit/awt/vclxmenu.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> +#include <vcl/accel.hxx> +#ifndef _VCL_MENU_HXX_ +#include <vcl/menu.hxx> +#endif +#include <hash_map> + +namespace framework +{ + struct NewDocument + { + ::com::sun::star::util::URL aTargetURL; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgSeq; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch; + }; + + class NewMenuController : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + public: + NewMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~NewMenuController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XMenuListener + virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + DECL_STATIC_LINK( NewMenuController, ExecuteHdl_Impl, NewDocument* ); + + private: + virtual void impl_setPopupMenu(); + struct AddInfo + { + rtl::OUString aTargetFrame; + rtl::OUString aImageId; + }; + + typedef ::std::hash_map< int, AddInfo > AddInfoForId; + + void fillPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ); + void retrieveShortcutsFromConfiguration( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration >& rAccelCfg, + const ::com::sun::star::uno::Sequence< rtl::OUString >& rCommands, + std::vector< KeyCode >& aMenuShortCuts ); + void setAccelerators( PopupMenu* pPopupMenu ); + void determineAndSetNewDocAccel( PopupMenu* pPopupMenu, const KeyCode& rKeyCode ); + void setMenuImages( PopupMenu* pPopupMenu, sal_Bool bSetImages, sal_Bool bHiContrast ); + + private: + // members + sal_Bool m_bShowImages : 1, + m_bHiContrast : 1, + m_bNewMenu : 1, + m_bModuleIdentified : 1, + m_bAcceleratorCfg : 1; + AddInfoForId m_aAddInfoForItem; + rtl::OUString m_aTargetFrame; + rtl::OUString m_aModuleIdentifier; + rtl::OUString m_aEmptyDocURL; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xDocAcceleratorManager; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xModuleAcceleratorManager; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xGlobalAcceleratorManager; + }; +} + +#endif // __FRAMEWORK_UIELEMENT_NEWMENUCONTROLLER_HXX_ diff --git a/framework/inc/uielement/objectmenucontroller.hxx b/framework/inc/uielement/objectmenucontroller.hxx new file mode 100644 index 000000000000..7a03dfd1458e --- /dev/null +++ b/framework/inc/uielement/objectmenucontroller.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_OBJECTMENUCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_OBJECTMENUCONTROLLER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> +#include <com/sun/star/embed/VerbDescriptor.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> +#include <toolkit/awt/vclxmenu.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> + +namespace framework +{ + class ObjectMenuController : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + public: + ObjectMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~ObjectMenuController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + private: + void fillPopupMenu( const com::sun::star::uno::Sequence< com::sun::star::embed::VerbDescriptor >& rVerbCommandSeq, com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ); + virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL); + + com::sun::star::uno::Reference< com::sun::star::frame::XDispatch > m_xObjectUpdateDispatch; + }; +} + +#endif // __FRAMEWORK_UIELEMENT_OBJECTMENUCONTROLLER_HXX_ diff --git a/framework/inc/uielement/popupmenucontroller.hxx b/framework/inc/uielement/popupmenucontroller.hxx new file mode 100644 index 000000000000..ef44a4703ca2 --- /dev/null +++ b/framework/inc/uielement/popupmenucontroller.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_POPUPMENUCONTROLLER_HXX_ +#define __FRAMEWORK_POPUPMENUCONTROLLER_HXX_ + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> + +#include "svtools/toolboxcontroller.hxx" +#include "boost/scoped_ptr.hpp" + +#include <macros/xserviceinfo.hxx> + +class Window; + +namespace framework +{ +class PopupMenuControllerImpl; + +class PopupMenuController : public svt::ToolboxController, public ::com::sun::star::lang::XServiceInfo +{ +public: + PopupMenuController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + ~PopupMenuController(); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException); + + bool CreatePopupMenuController() throw (::com::sun::star::uno::Exception); + + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XPopupMenuController > mxPopupMenuController; + ::com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu > mxPopupMenu; +}; + +} // namespace framework + +#endif // __FRAMEWORK_POPUPMENUCONTROLLER_HXX_ diff --git a/framework/inc/uielement/progressbarwrapper.hxx b/framework/inc/uielement/progressbarwrapper.hxx new file mode 100644 index 000000000000..e16d050e7d42 --- /dev/null +++ b/framework/inc/uielement/progressbarwrapper.hxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _FRAMEWORK_UIELEMENT_PROGRESSBARWRAPPER_HXX_ +#define _FRAMEWORK_UIELEMENT_PROGRESSBARWRAPPER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <helper/uielementwrapperbase.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/debug.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/task/XStatusIndicator.hpp> +#include <com/sun/star/awt/XWindow.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/weak.hxx> +#include <cppuhelper/weakref.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +class ProgressBarWrapper : public UIElementWrapperBase +{ + public: + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + ProgressBarWrapper(); + virtual ~ProgressBarWrapper(); + + // public interfaces + void setStatusBar( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& rStatusBar, sal_Bool bOwnsInstance = sal_False ); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > getStatusBar() const; + + // wrapped methods of ::com::sun::star::task::XStatusIndicator + void start( const ::rtl::OUString& Text, ::sal_Int32 Range ) throw (::com::sun::star::uno::RuntimeException); + void end() throw (::com::sun::star::uno::RuntimeException); + void setText( const ::rtl::OUString& Text ) throw (::com::sun::star::uno::RuntimeException); + void setValue( ::sal_Int32 Value ) throw (::com::sun::star::uno::RuntimeException); + void reset() throw (::com::sun::star::uno::RuntimeException); + + // UNO interfaces + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XUpdatable + virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException); + + // XUIElement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface() throw (::com::sun::star::uno::RuntimeException); + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + private: + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xStatusBar; // Reference to our status bar XWindow + ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface > m_xProgressBarIfacWrapper; + sal_Bool m_bOwnsInstance; // Indicator that we are owner of the XWindow + sal_Int32 m_nRange; + sal_Int32 m_nValue; + rtl::OUString m_aText; +}; // class ProgressBarWrapper + +} // namespace framework + +#endif // _FRAMEWORK_UIELEMENT_PROGRESSBARWRAPPER_HXX_ diff --git a/framework/inc/uielement/recentfilesmenucontroller.hxx b/framework/inc/uielement/recentfilesmenucontroller.hxx new file mode 100644 index 000000000000..26a8e38dd49c --- /dev/null +++ b/framework/inc/uielement/recentfilesmenucontroller.hxx @@ -0,0 +1,121 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_RECENTFILESMENUCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_RECENTFILESMENUCONTROLLER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> +#include <toolkit/awt/vclxmenu.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> + +namespace framework +{ + struct LoadRecentFile + { + ::com::sun::star::util::URL aTargetURL; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgSeq; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch; + }; + + class RecentFilesMenuController : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + public: + RecentFilesMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~RecentFilesMenuController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XPopupMenuController + virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XMenuListener + virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + + // XDispatchProvider + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& sTarget, sal_Int32 nFlags ) throw( ::com::sun::star::uno::RuntimeException ); + + // XDispatch + virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& seqProperties ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + DECL_STATIC_LINK( RecentFilesMenuController, ExecuteHdl_Impl, LoadRecentFile* ); + + private: + virtual void impl_setPopupMenu(); + struct RecentFile + { + rtl::OUString aURL; + rtl::OUString aFilter; + rtl::OUString aTitle; + rtl::OUString aPassword; + }; + + void fillPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ); + void executeEntry( sal_Int32 nIndex ); + + std::vector< RecentFile > m_aRecentFilesItems; + sal_Bool m_bDisabled : 1; + }; +} + +#endif // __FRAMEWORK_UIELEMENT_RECENTFILESMENUCONTROLLER_HXX_ diff --git a/framework/inc/uielement/rootitemcontainer.hxx b/framework/inc/uielement/rootitemcontainer.hxx new file mode 100644 index 000000000000..9ec0955c3ffe --- /dev/null +++ b/framework/inc/uielement/rootitemcontainer.hxx @@ -0,0 +1,156 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_ROOTITEMCONTAINER_HXX_ +#define __FRAMEWORK_UIELEMENT_ROOTITEMCONTAINER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <helper/shareablemutex.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/lang/XSingleComponentFactory.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/interfacecontainer.hxx> + +#include <vector> + +namespace framework +{ + +class ConstItemContainer; +class ItemContainer; +class RootItemContainer : public ::com::sun::star::lang::XTypeProvider , + public ::com::sun::star::container::XIndexContainer , + public ::com::sun::star::lang::XSingleComponentFactory , + public ::com::sun::star::lang::XUnoTunnel , + protected ThreadHelpBase , + public ::cppu::OBroadcastHelper , + public ::cppu::OPropertySetHelper , + public ::cppu::OWeakObject +{ + friend class ConstItemContainer; + + public: + RootItemContainer(); + RootItemContainer( const ConstItemContainer& rConstItemContainer ); + RootItemContainer( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rItemAccessContainer ); + virtual ~RootItemContainer(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider + //--------------------------------------------------------------------------------------------------------- + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + // XUnoTunnel + static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw(); + static RootItemContainer* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw(); + sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException); + + // XIndexContainer + virtual void SAL_CALL insertByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL removeByIndex( sal_Int32 Index ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XIndexReplace + virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() + throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw (::com::sun::star::uno::RuntimeException) + { + return ::getCppuType((com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >*)0); + } + + virtual sal_Bool SAL_CALL hasElements() + throw (::com::sun::star::uno::RuntimeException); + + // XSingleComponentFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithContext( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArgumentsAndContext( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + protected: + // OPropertySetHelper + virtual sal_Bool SAL_CALL convertFastPropertyValue ( com::sun::star::uno::Any& aConvertedValue , + com::sun::star::uno::Any& aOldValue , + sal_Int32 nHandle , + const com::sun::star::uno::Any& aValue ) throw( com::sun::star::lang::IllegalArgumentException ); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , + const com::sun::star::uno::Any& aValue ) throw( com::sun::star::uno::Exception ); + using cppu::OPropertySetHelper::getFastPropertyValue; + virtual void SAL_CALL getFastPropertyValue( com::sun::star::uno::Any& aValue , + sal_Int32 nHandle ) const; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + virtual ::com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException); + + static const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > impl_getStaticPropertyDescriptor(); + + private: + RootItemContainer& operator=( const RootItemContainer& ); + RootItemContainer( const RootItemContainer& ); + + void copyItemContainer( const std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > >& rSourceVector ); + com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > deepCopyContainer( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rSubContainer ); + + mutable ShareableMutex m_aShareMutex; + std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > m_aItemVector; + rtl::OUString m_aUIName; +}; + +} + +#endif // #ifndef __FRAMEWORK_UIELEMENT_ROOTITEMCONTAINER_HXX_ diff --git a/framework/inc/uielement/simpletextstatusbarcontroller.hxx b/framework/inc/uielement/simpletextstatusbarcontroller.hxx new file mode 100644 index 000000000000..6c13b2f6ced9 --- /dev/null +++ b/framework/inc/uielement/simpletextstatusbarcontroller.hxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_SIMPLETEXTSTATUSBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_SIMPLETEXTSTATUSBARCONTROLLER_HXX_ + +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +#include <hash_map> +#include <svtools/statusbarcontroller.hxx> +#include <vcl/image.hxx> + +namespace framework +{ + +class SimpleTextStatusbarController : public svt::StatusbarController +{ + public: + SimpleTextStatusbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~SimpleTextStatusbarController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XStatusbarController + virtual ::sal_Bool SAL_CALL mouseButtonDown( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL mouseMove( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL mouseButtonUp( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL command( const ::com::sun::star::awt::Point& aPos, + ::sal_Int32 nCommand, + ::sal_Bool bMouseEvent, + const ::com::sun::star::uno::Any& aData ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL paint( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics, + const ::com::sun::star::awt::Rectangle& rOutputRectangle, + ::sal_Int32 nItemId, ::sal_Int32 nStyle ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException); + + private: + rtl::OUString m_aText; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_SIMPLETEXTSTATUSBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/spinfieldtoolbarcontroller.hxx b/framework/inc/uielement/spinfieldtoolbarcontroller.hxx new file mode 100644 index 000000000000..17a9e1611ffa --- /dev/null +++ b/framework/inc/uielement/spinfieldtoolbarcontroller.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_SPINFIELDTOOLBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_SPINFIELDTOOLBARCONTROLLER_HXX_ + +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/ControlCommand.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ + +#include <uielement/complextoolbarcontroller.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/spinfld.hxx> + +namespace framework +{ + +class ToolBar; +class SpinfieldControl; + +class ISpinfieldListener +{ + public: + virtual void Up() = 0; + virtual void Down() = 0; + virtual void First() = 0; + virtual void Last() = 0; + virtual void KeyInput( const KeyEvent& rKEvt ) = 0; + virtual void Modify() = 0; + virtual void GetFocus() = 0; + virtual void LoseFocus() = 0; + virtual void StateChanged( StateChangedType nType ) = 0; + virtual void DataChanged( const DataChangedEvent& rDCEvt ) = 0; + virtual long PreNotify( NotifyEvent& rNEvt ) = 0; + }; + +class SpinfieldToolbarController : public ISpinfieldListener, + public ComplexToolbarController + +{ + public: + SpinfieldToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + ToolBox* pToolBar, + USHORT nID, + sal_Int32 nWidth, + const rtl::OUString& aCommand ); + virtual ~SpinfieldToolbarController(); + + // XComponent + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + // ISpinfieldListener + virtual void Up(); + virtual void Down(); + virtual void First(); + virtual void Last(); + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void Modify(); + virtual void GetFocus(); + virtual void LoseFocus(); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + virtual long PreNotify( NotifyEvent& rNEvt ); + + protected: + virtual void executeControlCommand( const ::com::sun::star::frame::ControlCommand& rControlCommand ); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const; + + private: + bool impl_getValue( const ::com::sun::star::uno::Any& rAny, sal_Int32& nValue, double& fValue, bool& bFloat ); + rtl::OUString impl_formatOutputString( double fValue ); + + bool m_bFloat, + m_bMaxSet, + m_bMinSet; + double m_nMax; + double m_nMin; + double m_nValue; + double m_nStep; + SpinfieldControl* m_pSpinfieldControl; + rtl::OUString m_aOutFormat; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_SPINFIELDTOOLBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/statusbar.hxx b/framework/inc/uielement/statusbar.hxx new file mode 100644 index 000000000000..70ea373917eb --- /dev/null +++ b/framework/inc/uielement/statusbar.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_STATUSBAR_HXX_ +#define __FRAMEWORK_UIELEMENT_STATUSBAR_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <uielement/statusbarmanager.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#include <vcl/status.hxx> + +namespace framework +{ + +class FrameworkStatusBar : public StatusBar +{ + public: + + FrameworkStatusBar( Window* pParent, + WinBits nWinBits ); + virtual ~FrameworkStatusBar(); + + void SetStatusBarManager( StatusBarManager* pStatusBarManager ); + + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + virtual void UserDraw(const UserDrawEvent& rUDEvt); + virtual void Command( const CommandEvent &rEvt ); + virtual void MouseMove( const MouseEvent& rMEvt ); + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void MouseButtonUp( const MouseEvent& rMEvt ); + + private: + StatusBarManager* m_pMgr; + sal_Bool m_bShow : 1, + m_bLock : 1; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_STATUSBAR_HXX_ diff --git a/framework/inc/uielement/statusbarmanager.hxx b/framework/inc/uielement/statusbarmanager.hxx new file mode 100644 index 000000000000..cfcb71960304 --- /dev/null +++ b/framework/inc/uielement/statusbarmanager.hxx @@ -0,0 +1,143 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_STATUSBARMANAGER_HXX_ +#define __FRAMEWORK_UIELEMENT_STATUSBARMANAGER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XStatusbarController.hpp> +#include <com/sun/star/frame/XUIControllerRegistration.hpp> +#include <com/sun/star/ui/XUIConfiguration.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/container/XNameAccess.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <vcl/status.hxx> + +namespace framework +{ + +class FrameworkStatusBar; +class StatusBarManager : public ::com::sun::star::frame::XFrameActionListener , + public ::com::sun::star::lang::XComponent , + public ::com::sun::star::lang::XTypeProvider , + public ::com::sun::star::ui::XUIConfigurationListener, + public ThreadHelpBase , + public ::cppu::OWeakObject +{ + friend class FrameworkStatusBar; + + public: + StatusBarManager( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServicveManager, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + const rtl::OUString& rResourceName, + StatusBar* pStatusBar ); + virtual ~StatusBarManager(); + + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + StatusBar* GetStatusBar() const; + + // XFrameActionListener + virtual void SAL_CALL frameAction( const com::sun::star::frame::FrameActionEvent& Action ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XUIConfigurationListener + virtual void SAL_CALL elementInserted( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementRemoved( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementReplaced( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + + // XComponent + void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + void SAL_CALL addEventListener( const com::sun::star::uno::Reference< XEventListener >& xListener ) throw( com::sun::star::uno::RuntimeException ); + void SAL_CALL removeEventListener( const com::sun::star::uno::Reference< XEventListener >& xListener ) throw( com::sun::star::uno::RuntimeException ); + + void FillStatusBar( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rStatusBarData ); + + protected: + void StateChanged( StateChangedType nType ); + void DataChanged( const DataChangedEvent& rDCEvt ); + void UserDraw( const UserDrawEvent& rUDEvt ); + void Command( const CommandEvent& rEvt ); + void MouseMove( const MouseEvent& rMEvt ); + void MouseButtonDown( const MouseEvent& rMEvt ); + void MouseButtonUp( const MouseEvent& rMEvt ); + DECL_LINK( Click, StatusBar* ); + DECL_LINK( DoubleClick, StatusBar* ); + + void RemoveControllers(); + rtl::OUString RetrieveLabelFromCommand( const rtl::OUString& aCmdURL ); + void CreateControllers(); + void UpdateControllers(); + void AddFrameActionListener(); + void MouseButton( const MouseEvent& rMEvt ,sal_Bool ( SAL_CALL ::com::sun::star::frame::XStatusbarController::*_pMethod )(const ::com::sun::star::awt::MouseEvent&)); + + protected: + typedef std::vector< ::com::sun::star::uno::Reference< com::sun::star::frame::XStatusListener > > StatusBarControllerVector; + + sal_Bool m_bDisposed : 1, + m_bFrameActionRegistered : 1, + m_bUpdateControllers : 1; + sal_Bool m_bModuleIdentified; + StatusBar* m_pStatusBar; + rtl::OUString m_aModuleIdentifier; + rtl::OUString m_aResourceName; + com::sun::star::uno::Reference< com::sun::star::frame::XFrame > m_xFrame; + com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_xUICommandLabels; + StatusBarControllerVector m_aControllerVector; + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XUIControllerRegistration > m_xStatusbarControllerRegistration; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_STATUSBARMANAGER_HXX_ diff --git a/framework/inc/uielement/statusbarwrapper.hxx b/framework/inc/uielement/statusbarwrapper.hxx new file mode 100644 index 000000000000..7bb1a0bee352 --- /dev/null +++ b/framework/inc/uielement/statusbarwrapper.hxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_STATUSBARWRAPPER_HXX_ +#define __FRAMEWORK_UIELEMENT_STATUSBARWRAPPER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <helper/uiconfigelementwrapperbase.hxx> +#include <uielement/statusbarmanager.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +namespace framework +{ + +class StatusBarWrapper : public UIConfigElementWrapperBase +{ + public: + StatusBarWrapper( + const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~StatusBarWrapper(); + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XUIElement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface() throw (::com::sun::star::uno::RuntimeException); + + // XUIElementSettings + virtual void SAL_CALL updateSettings() throw (::com::sun::star::uno::RuntimeException); + + private: + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xStatusBarManager; +}; + +} // namespace framework + +#endif // __FRAMEWORK_UIELEMENT_STATUSBARWRAPPER_HXX_ diff --git a/framework/inc/uielement/statusindicatorinterfacewrapper.hxx b/framework/inc/uielement/statusindicatorinterfacewrapper.hxx new file mode 100644 index 000000000000..085d2d58ffa9 --- /dev/null +++ b/framework/inc/uielement/statusindicatorinterfacewrapper.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_STATUSINDICATORINTERFACEWRAPPER_HXX_ +#define __FRAMEWORK_UIELEMENT_STATUSINDICATORINTERFACEWRAPPER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/task/XStatusIndicator.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/lang/XComponent.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> +#include <cppuhelper/implbase1.hxx> + +#include <vector> + +namespace framework +{ + +class StatusIndicatorInterfaceWrapper : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XStatusIndicator> +{ + public: + StatusIndicatorInterfaceWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rStatusIndicatorImpl ); + virtual ~StatusIndicatorInterfaceWrapper(); + + //--------------------------------------------------------------------------------------------------------- + // XStatusIndicator + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL start ( const ::rtl::OUString& sText , + sal_Int32 nRange ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL end ( ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL reset ( ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setText ( const ::rtl::OUString& sText ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setValue( sal_Int32 nValue ) throw( ::com::sun::star::uno::RuntimeException ); + + private: + StatusIndicatorInterfaceWrapper(); + + ::com::sun::star::uno::WeakReference< ::com::sun::star::lang::XComponent > m_xStatusIndicatorImpl; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_STATUSINDICATORINTERFACEWRAPPER_HXX_ diff --git a/framework/inc/uielement/togglebuttontoolbarcontroller.hxx b/framework/inc/uielement/togglebuttontoolbarcontroller.hxx new file mode 100644 index 000000000000..1261b96c769e --- /dev/null +++ b/framework/inc/uielement/togglebuttontoolbarcontroller.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_TOGGLEBUTTONTOOLBARCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_TOGGLEBUTTONTOOLBARCONTROLLER_HXX_ + +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/ControlCommand.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ + +#include <uielement/complextoolbarcontroller.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/image.hxx> + +namespace framework +{ + +class ToolBar; +class ToggleButtonToolbarController : public ComplexToolbarController + +{ + public: + enum Style + { + STYLE_TOGGLEBUTTON, + STYLE_DROPDOWNBUTTON, + STYLE_TOGGLE_DROPDOWNBUTTON + }; + + ToggleButtonToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + ToolBox* pToolBar, + USHORT nID, + Style eStyle, + const rtl::OUString& aCommand ); + virtual ~ToggleButtonToolbarController(); + + // XComponent + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + // XToolbarController + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException); + + protected: + virtual void executeControlCommand( const ::com::sun::star::frame::ControlCommand& rControlCommand ); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const; + + private: + DECL_LINK( MenuSelectHdl, Menu *); + + Style m_eStyle; + rtl::OUString m_aCurrentSelection; + std::vector< rtl::OUString > m_aDropdownMenuList; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_TOGGLEBUTTONTOOLBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/toolbar.hxx b/framework/inc/uielement/toolbar.hxx new file mode 100644 index 000000000000..a5329bab3f75 --- /dev/null +++ b/framework/inc/uielement/toolbar.hxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + + +#ifndef __FRAMEWORK_UIELEMENT_TOOLBAR_HXX_ +#define __FRAMEWORK_UIELEMENT_TOOLBAR_HXX_ + +#include <vcl/toolbox.hxx> + +namespace framework +{ + +class ToolBarManager; +class ToolBar : public ToolBox +{ + public: + ToolBar( Window* pParent, WinBits nWinBits ); + virtual ~ToolBar(); + + virtual void Command ( const CommandEvent& rCEvt ); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + // Toolbar manager + void SetToolBarManager( ToolBarManager* pTbMgr ); + ToolBarManager* GetToolBarManager() const { return m_pToolBarManager; } + + // Provide additional handlers to support external implementations + void SetCommandHdl( const Link& aLink ) { m_aCommandHandler = aLink; } + const Link& GetCommandHdl() const { return m_aCommandHandler; } + void SetStateChangedHdl( const Link& aLink ) { m_aStateChangedHandler = aLink; } + const Link& GetStateChangedHdl() const { return m_aStateChangedHandler; } + void SetDataChangedHdl( const Link& aLink ) { m_aDataChangedHandler = aLink; } + const Link& GetDataChangedHdl() { return m_aDataChangedHandler; } + + private: + Link m_aCommandHandler; + Link m_aStateChangedHandler; + Link m_aDataChangedHandler; + ToolBarManager* m_pToolBarManager; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_TOOLBAR_HXX_ diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx new file mode 100644 index 000000000000..5e780edb366b --- /dev/null +++ b/framework/inc/uielement/toolbarmanager.hxx @@ -0,0 +1,257 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_TOOLBARMANAGER_HXX_ +#define __FRAMEWORK_UIELEMENT_TOOLBARMANAGER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <stdtypes.h> +#include <uielement/commandinfo.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XUIControllerRegistration.hpp> +#include <com/sun/star/ui/XImageManager.hpp> +#include <com/sun/star/ui/XUIConfigurationManager.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XSubToolbarController.hpp> +#include <com/sun/star/frame/XToolbarController.hpp> +#include <com/sun/star/ui/ItemStyle.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/ui/XAcceleratorConfiguration.hpp> + +//shizhoubo +#include <com/sun/star/frame/XToolbarController.hpp> +//end +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/interfacecontainer.hxx> + +#include <vcl/toolbox.hxx> +#include <vcl/accel.hxx> + +namespace com +{ + namespace sun + { + namespace star + { + namespace frame + { + class XLayoutManager; + } + } + } +} + +namespace framework +{ + +class ToolBar; +class ToolBarManager : public ::com::sun::star::frame::XFrameActionListener , + public ::com::sun::star::frame::XStatusListener , + public ::com::sun::star::lang::XComponent , + public ::com::sun::star::lang::XTypeProvider , + public ::com::sun::star::ui::XUIConfigurationListener, + public ThreadHelpBase , + public ::cppu::OWeakObject +{ + public: + ToolBarManager( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServicveManager, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + const rtl::OUString& rResourceName, + ToolBar* pToolBar ); + virtual ~ToolBarManager(); + + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + ToolBox* GetToolBar() const; + + // XFrameActionListener + virtual void SAL_CALL frameAction( const com::sun::star::frame::FrameActionEvent& Action ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XUIConfigurationListener + virtual void SAL_CALL elementInserted( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementRemoved( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementReplaced( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + + // XComponent + void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + void SAL_CALL addEventListener( const com::sun::star::uno::Reference< XEventListener >& xListener ) throw( com::sun::star::uno::RuntimeException ); + void SAL_CALL removeEventListener( const com::sun::star::uno::Reference< XEventListener >& xListener ) throw( com::sun::star::uno::RuntimeException ); + + void CheckAndUpdateImages(); + virtual void RefreshImages(); + void FillToolbar( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rToolBarData ); + void notifyRegisteredControllers( const rtl::OUString& aUIElementName, const rtl::OUString& aCommand ); + void Destroy(); + + enum ExecuteCommand + { + EXEC_CMD_CLOSETOOLBAR, + EXEC_CMD_DOCKTOOLBAR, + EXEC_CMD_DOCKALLTOOLBARS, + EXEC_CMD_NONE, + EXEC_CMD_COUNT + }; + + struct ExecuteInfo + { + rtl::OUString aToolbarResName; + ExecuteCommand nCmd; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xWindow; + }; + struct ControllerParams + { + sal_Int16 nWidth; + }; + typedef std::vector< ControllerParams > ControllerParamsVector; + + protected: + //added for 33668 by shizhoubo : 2008:04 + DECL_LINK( Command, CommandEvent * ); + PopupMenu * GetToolBarCustomMeun(ToolBox* pToolBar); + //end + DECL_LINK( Click, ToolBox * ); + DECL_LINK( DropdownClick, ToolBox * ); + DECL_LINK( DoubleClick, ToolBox * ); + DECL_LINK( Select, ToolBox * ); + DECL_LINK( Highlight, ToolBox * ); + DECL_LINK( Activate, ToolBox * ); + DECL_LINK( Deactivate, ToolBox * ); + DECL_LINK( StateChanged, StateChangedType* ); + DECL_LINK( DataChanged, DataChangedEvent* ); + + DECL_LINK( MenuButton, ToolBox * ); + DECL_LINK( MenuSelect, Menu * ); + DECL_LINK( MenuDeactivate, Menu * ); + DECL_LINK( AsyncUpdateControllersHdl, Timer * ); + DECL_STATIC_LINK( ToolBarManager, ExecuteHdl_Impl, ExecuteInfo* ); + + virtual bool MenuItemAllowed( sal_uInt16 ) const; + + void RemoveControllers(); + rtl::OUString RetrieveLabelFromCommand( const rtl::OUString& aCmdURL ); + sal_Int32 RetrievePropertiesFromCommand( const rtl::OUString& aCmdURL ); + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetPropsForCommand( const ::rtl::OUString& rCmdURL ); + void CreateControllers(); + void UpdateControllers(); + //for update controller via Support Visiable by shizhoubo + void UpdateController( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XToolbarController > xController); + //end + void AddFrameActionListener(); + void AddImageOrientationListener(); + void UpdateImageOrientation(); + void ImplClearPopupMenu( ToolBox *pToolBar ); + void RequestImages(); + sal_uInt16 ConvertStyleToToolboxItemBits( sal_Int32 nStyle ); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetModelFromFrame() const; + sal_Bool IsPluginMode() const; + Image QueryAddonsImage( const ::rtl::OUString& aCommandURL, bool bBigImages, bool bHiContrast ); + long HandleClick(void ( SAL_CALL ::com::sun::star::frame::XToolbarController::*_pClick )( )); + void setToolBarImage(const Image& _aImage,const CommandToInfoMap::const_iterator& _pIter); + void impl_elementChanged(bool _bRemove,const ::com::sun::star::ui::ConfigurationEvent& Event ); + + static bool impl_RetrieveShortcutsFromConfiguration( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration >& rAccelCfg, const rtl::OUString& rCommand, rtl::OUString& rShortCut ); + bool RetrieveShortcut( const rtl::OUString& rCommandURL, rtl::OUString& rShortCut ); + + protected: + typedef ::std::hash_map< sal_uInt16, ::com::sun::star::uno::Reference< com::sun::star::frame::XStatusListener > > ToolBarControllerMap; + typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XSubToolbarController > > SubToolBarControllerVector; + typedef BaseHash< SubToolBarControllerVector > SubToolBarToSubToolBarControllerMap; + + typedef ::std::hash_map< sal_uInt16, ::com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > > MenuDescriptionMap; + sal_Bool m_bDisposed : 1, + m_bIsHiContrast : 1, + m_bSmallSymbols : 1, + m_bModuleIdentified : 1, + m_bAddedToTaskPaneList : 1, + m_bVerticalTextEnabled : 1, + m_bFrameActionRegistered : 1, + m_bUpdateControllers : 1; + sal_Bool m_bImageOrientationRegistered : 1, + m_bImageMirrored : 1, + m_bCanBeCustomized : 1; + long m_lImageRotation; + ToolBar* m_pToolBar; + rtl::OUString m_aModuleIdentifier; + rtl::OUString m_aResourceName; + com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer; + com::sun::star::uno::Reference< com::sun::star::frame::XFrame > m_xFrame; + com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_xUICommandLabels; + ToolBarControllerMap m_aControllerMap; + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XUIControllerRegistration > m_xToolbarControllerRegistration; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XImageManager > m_xModuleImageManager; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XImageManager > m_xDocImageManager; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xImageOrientationListener; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xUICfgMgr; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xDocUICfgMgr; + + CommandToInfoMap m_aCommandMap; + SubToolBarToSubToolBarControllerMap m_aSubToolBarControllerMap; + Timer m_aAsyncUpdateControllersTimer; + sal_Int16 m_nSymbolsStyle; + MenuDescriptionMap m_aMenuMap; + sal_Bool m_bAcceleratorCfg; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xDocAcceleratorManager; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xModuleAcceleratorManager; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xGlobalAcceleratorManager; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_TOOLBARMANAGER_HXX_ diff --git a/framework/inc/uielement/toolbarmerger.hxx b/framework/inc/uielement/toolbarmerger.hxx new file mode 100644 index 000000000000..8016bbb620b8 --- /dev/null +++ b/framework/inc/uielement/toolbarmerger.hxx @@ -0,0 +1,160 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_TOOLBARMERGER_HXX_ +#define __FRAMEWORK_UIELEMENT_TOOLBARMERGER_HXX_ + +#include <uielement/comboboxtoolbarcontroller.hxx> +#include <uielement/imagebuttontoolbarcontroller.hxx> +#include <uielement/togglebuttontoolbarcontroller.hxx> +#include <uielement/buttontoolbarcontroller.hxx> +#include <uielement/spinfieldtoolbarcontroller.hxx> +#include <uielement/edittoolbarcontroller.hxx> +#include <uielement/dropdownboxtoolbarcontroller.hxx> +#include <uielement/commandinfo.hxx> + +#include <com/sun/star/beans/PropertyValue.hpp> + +#include <svtools/toolboxcontroller.hxx> + +#include <rtl/ustring.hxx> +#include <vcl/toolbox.hxx> + +namespace framework +{ + +struct AddonsParams +{ + ::rtl::OUString aImageId; + ::rtl::OUString aTarget; + ::rtl::OUString aControlType; +}; + +struct AddonToolbarItem +{ + ::rtl::OUString aCommandURL; + ::rtl::OUString aLabel; + ::rtl::OUString aImageIdentifier; + ::rtl::OUString aTarget; + ::rtl::OUString aContext; + ::rtl::OUString aControlType; + sal_uInt16 nWidth; +}; + +typedef ::std::vector< AddonToolbarItem > AddonToolbarItemContainer; + +struct ReferenceToolbarPathInfo +{ + ToolBox* pToolbar; + sal_uInt16 nPos; + bool bResult; +}; + +class ToolBarMerger +{ + public: + static bool IsCorrectContext( const ::rtl::OUString& aContext, const ::rtl::OUString& aModuleIdentifier ); + + static bool ConvertSeqSeqToVector( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > rSequence, + AddonToolbarItemContainer& rContainer ); + + static void ConvertSequenceToValues( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > rSequence, + ::rtl::OUString& rCommandURL, + ::rtl::OUString& rLabel, + ::rtl::OUString& rImageIdentifier, + ::rtl::OUString& rTarget, + ::rtl::OUString& rContext, + ::rtl::OUString& rControlType, + sal_uInt16& rWidth ); + + static ReferenceToolbarPathInfo FindReferencePoint( ToolBox* pToolbar, + const ::rtl::OUString& rReferencePoint ); + + static bool ProcessMergeOperation( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, + ToolBox* pToolbar, + sal_uInt16 nPos, + sal_uInt16& rItemId, + CommandToInfoMap& rCommandMap, + const ::rtl::OUString& rModuleIdentifier, + const ::rtl::OUString& rMergeCommand, + const ::rtl::OUString& rMergeCommandParameter, + const AddonToolbarItemContainer& rItems ); + + static bool ProcessMergeFallback( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, + ToolBox* pToolbar, + sal_uInt16 nPos, + sal_uInt16& rItemId, + CommandToInfoMap& rCommandMap, + const ::rtl::OUString& rModuleIdentifier, + const ::rtl::OUString& rMergeCommand, + const ::rtl::OUString& rMergeFallback, + const AddonToolbarItemContainer& rItems ); + + static bool MergeItems( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, + ToolBox* pToolbar, + sal_uInt16 nPos, + sal_uInt16 nModIndex, + sal_uInt16& rItemId, + CommandToInfoMap& rCommandMap, + const ::rtl::OUString& rModuleIdentifier, + const AddonToolbarItemContainer& rAddonToolbarItems ); + + static bool ReplaceItem( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, + ToolBox* pToolbar, + sal_uInt16 nPos, + sal_uInt16& rItemId, + CommandToInfoMap& rCommandMap, + const ::rtl::OUString& rModuleIdentifier, + const AddonToolbarItemContainer& rAddonToolbarItems ); + + static bool RemoveItems( ToolBox* pToolbar, + sal_uInt16 nPos, + const ::rtl::OUString& rMergeCommandParameter ); + + static ::cppu::OWeakObject* CreateController( + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMGR, + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame, + ToolBox* pToolbar, + const ::rtl::OUString& rCommandURL, + sal_uInt16 nId, + sal_uInt16 nWidth, + const ::rtl::OUString& rControlType ); + + static void CreateToolbarItem( ToolBox* pToolbox, + sal_uInt16 nPos, + sal_uInt16 nItemId, + const AddonToolbarItem& rAddonToolbarItem ); + + private: + ToolBarMerger(); + ToolBarMerger( const ToolBarMerger& ); + ToolBarMerger& operator=( const ToolBarMerger& ); +}; + +} // namespace framework + +#endif // __FRAMEWORK_UIELEMENT_TOOLBARMERGER_HXX_ diff --git a/framework/inc/uielement/toolbarsmenucontroller.hxx b/framework/inc/uielement/toolbarsmenucontroller.hxx new file mode 100644 index 000000000000..35f517d33e80 --- /dev/null +++ b/framework/inc/uielement/toolbarsmenucontroller.hxx @@ -0,0 +1,125 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_TOOLBARSMENUCONTROLLER_HXX_ +#define __FRAMEWORK_UIELEMENT_TOOLBARSMENUCONTROLLER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> +#include <com/sun/star/frame/XLayoutManager.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/ui/XUIConfigurationManager.hpp> + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> +#include <toolkit/awt/vclxmenu.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/ustring.hxx> +#include <unotools/intlwrapper.hxx> + +#include <vector> + +namespace framework +{ + class ToolbarsMenuController : public svt::PopupMenuControllerBase + { + using svt::PopupMenuControllerBase::disposing; + + public: + ToolbarsMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~ToolbarsMenuController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XPopupMenuController + virtual void SAL_CALL setPopupMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& PopupMenu ) throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XMenuListener + virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + struct ExecuteInfo + { + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch; + ::com::sun::star::util::URL aTargetURL; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs; + }; + + DECL_STATIC_LINK( ToolbarsMenuController, ExecuteHdl_Impl, ExecuteInfo* ); + + private: + void fillPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ); + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > getLayoutManagerToolbars( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& rLayoutManager ); + rtl::OUString getUINameFromCommand( const rtl::OUString& rCommandURL ); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > getDispatchFromCommandURL( const rtl::OUString& rCommandURL ); + void addCommand( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu, const rtl::OUString& rCommandURL, USHORT nHelpId, const rtl::OUString& aLabel ); + sal_Bool isContextSensitiveToolbarNonVisible(); + + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xPersistentWindowState; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xUICommandDescription; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xModuleCfgMgr; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xDocCfgMgr; + rtl::OUString m_aModuleIdentifier; + rtl::OUString m_aPropUIName; + rtl::OUString m_aPropResourceURL; + sal_Bool m_bModuleIdentified; + sal_Bool m_bResetActive; + std::vector< rtl::OUString > m_aCommandVector; + IntlWrapper m_aIntlWrapper; + }; +} + +#endif // __FRAMEWORK_UIELEMENT_TOOLBARSMENUCONTROLLER_HXX_ diff --git a/framework/inc/uielement/toolbarwrapper.hxx b/framework/inc/uielement/toolbarwrapper.hxx new file mode 100644 index 000000000000..06e99d2017b4 --- /dev/null +++ b/framework/inc/uielement/toolbarwrapper.hxx @@ -0,0 +1,101 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_TOOLBARWRAPPER_HXX_ +#define __FRAMEWORK_UIELEMENT_TOOLBARWRAPPER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <helper/uiconfigelementwrapperbase.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/ui/XUIFunctionListener.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +namespace framework +{ + +class ToolBarManager; +class ToolBarWrapper : public ::com::sun::star::ui::XUIFunctionListener, + public UIConfigElementWrapperBase +{ + public: + ToolBarWrapper( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~ToolBarWrapper(); + + // XInterface + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw( ::com::sun::star::uno::RuntimeException ); + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XUIElement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface() throw (::com::sun::star::uno::RuntimeException); + + // XUpdatable + virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException); + + // XUIElementSettings + virtual void SAL_CALL updateSettings() throw (::com::sun::star::uno::RuntimeException); + + // XUIFunctionListener + virtual void SAL_CALL functionExecute( const ::rtl::OUString& aUIElementName, const ::rtl::OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException); + + // XEventListener + using cppu::OPropertySetHelper::disposing; + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + protected: + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const com::sun::star::uno::Any& aValue ) throw( com::sun::star::uno::Exception ); + virtual void impl_fillNewData(); + + private: + com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xToolBarManager; + com::sun::star::uno::Reference< com::sun::star::awt::XWindow > m_xToolBarWindow; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_TOOLBARWRAPPER_HXX_ diff --git a/framework/inc/uielement/uicommanddescription.hxx b/framework/inc/uielement/uicommanddescription.hxx new file mode 100644 index 000000000000..dd95981bba90 --- /dev/null +++ b/framework/inc/uielement/uicommanddescription.hxx @@ -0,0 +1,117 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_UIELEMENT_UICOMMANDDESCRPTION_HXX_ +#define __FRAMEWORK_UIELEMENT_UICOMMANDDESCRPTION_HXX_ + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> +#include <list> +#include <hash_map> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase2.hxx> +#include <rtl/ustring.hxx> + +namespace framework +{ +class UICommandDescription : private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::WeakImplHelper2< com::sun::star::lang::XServiceInfo , + com::sun::star::container::XNameAccess > +{ + public: + UICommandDescription( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~UICommandDescription(); + + // XInterface, XTypeProvider, XServiceInfo + DECLARE_XSERVICEINFO +private: + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw (::com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw (::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() + throw (::com::sun::star::uno::RuntimeException); + +public: + typedef ::std::hash_map< ::rtl::OUString, + ::rtl::OUString, + OUStringHashCode, + ::std::equal_to< ::rtl::OUString > > ModuleToCommandFileMap; + + typedef ::std::hash_map< ::rtl::OUString, + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >, + OUStringHashCode, + ::std::equal_to< ::rtl::OUString > > UICommandsHashMap; + + protected: + UICommandDescription( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager,bool ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > impl_createConfigAccess(const ::rtl::OUString& _sName); + void impl_fillElements(const sal_Char* _pName); + sal_Bool m_bConfigRead; + rtl::OUString m_aPrivateResourceURL; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ModuleToCommandFileMap m_aModuleToCommandFileMap; + UICommandsHashMap m_aUICommandsHashMap; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xGenericUICommands; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; +}; + +} // namespace framework + +#endif // __FRAMEWORK_SERVICES_UICOMMANDDESCRPTION_HXX_ diff --git a/framework/inc/uielement/uielementtypenames.hxx b/framework/inc/uielement/uielementtypenames.hxx new file mode 100644 index 000000000000..ca7815f90af7 --- /dev/null +++ b/framework/inc/uielement/uielementtypenames.hxx @@ -0,0 +1,12 @@ +#ifndef __FRAMEWORK_UIELEMENT_UIELEMENTTYPENAMES_HXX_ +#define __FRAMEWORK_UIELEMENT_UIELEMENTTYPENAMES_HXX_ + +#define UIELEMENTTYPE_MENUBAR_NAME "menubar" +#define UIELEMENTTYPE_POPUPMENU_NAME "popupmenu" +#define UIELEMENTTYPE_TOOLBAR_NAME "toolbar" +#define UIELEMENTTYPE_STATUSBAR_NAME "statusbar" +#define UIELEMENTTYPE_FLOATINGWINDOW_NAME "floater" +#define UIELEMENTTYPE_PROGRESSBAR_NAME "progressbar" +#define UIELEMENTTYPE_TOOLPANEL_NAME "toolpanel" + +#endif // __FRAMEWORK_UIELEMENT_UIELEMENTTYPENAMES_HXX_ |