diff options
author | Ariel Constenla-Haile <arielch@apache.org> | 2013-05-25 22:11:08 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-06-24 10:08:43 +0100 |
commit | a659ac906aa2d0dfd6d10e40d8a5a6d2d70cc8fc (patch) | |
tree | 1859492c7602948eca7eb474a64087aa6dec5a3c /framework/inc | |
parent | 44b2fb6164aeffcc0c5bfbf53dac12f7b53fb0d4 (diff) |
framework::PopupMenuController clean-up
Changed the name, it is not a PopupMenuController, but a ToolbarController that
shows a PopupMenu filled at runtime by a PopupMenuController
Make it a base class for other ToolbarController components, there is no sense
to make it a component by itself
Use this base class for three new pure UNO ToolbarController's
(cherry picked from commit 9d1015051c92900def3d465d2eb8bf179f19a398)
Conflicts:
framework/Library_fwk.mk
framework/inc/uielement/popupmenucontroller.hxx
framework/source/uielement/popupmenucontroller.cxx
officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
Change-Id: I2f5ec06df098d65ffaa17a8f7f6f3ea8774b43c3
Diffstat (limited to 'framework/inc')
-rw-r--r-- | framework/inc/uielement/popupmenucontroller.hxx | 74 | ||||
-rw-r--r-- | framework/inc/uielement/popuptoolbarcontroller.hxx | 96 |
2 files changed, 96 insertions, 74 deletions
diff --git a/framework/inc/uielement/popupmenucontroller.hxx b/framework/inc/uielement/popupmenucontroller.hxx deleted file mode 100644 index 7511af004611..000000000000 --- a/framework/inc/uielement/popupmenucontroller.hxx +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#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::uno::XComponentContext >& rxContext ); - ~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_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uielement/popuptoolbarcontroller.hxx b/framework/inc/uielement/popuptoolbarcontroller.hxx new file mode 100644 index 000000000000..89acb766c0e1 --- /dev/null +++ b/framework/inc/uielement/popuptoolbarcontroller.hxx @@ -0,0 +1,96 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __FRAMEWORK_UIELEMENT_POPUPMENU_TOOLBARCONTROLLER_HXX__ +#define __FRAMEWORK_UIELEMENT_POPUPMENU_TOOLBARCONTROLLER_HXX__ + +#include <com/sun/star/awt/XPopupMenu.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> +#include <com/sun/star/frame/XUIControllerFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/implbase1.hxx> +#include <macros/xserviceinfo.hxx> +#include <svtools/toolboxcontroller.hxx> + +namespace framework +{ + class PopupMenuToolbarController : public svt::ToolboxController + { + public: + virtual ~PopupMenuToolbarController(); + + // 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); + // XToolbarController + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException); + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& rEvent ) throw ( ::com::sun::star::uno::RuntimeException ); + + protected: + PopupMenuToolbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, + const OUString &rPopupCommand = OUString() ); + virtual void functionExecuted( const OUString &rCommand ); + virtual sal_uInt16 getDropDownStyle() const; + void createPopupMenuController(); + + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext; + sal_Bool m_bHasController; + com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu > m_xPopupMenu; + + private: + OUString m_aPopupCommand; + com::sun::star::uno::Reference< com::sun::star::frame::XUIControllerFactory > m_xPopupMenuFactory; + com::sun::star::uno::Reference< com::sun::star::frame::XPopupMenuController > m_xPopupMenuController; + }; + + class OpenToolbarController : public PopupMenuToolbarController + { + public: + OpenToolbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); + + // XServiceInfo + DECLARE_XSERVICEINFO + }; + + class NewToolbarController : public PopupMenuToolbarController + { + public: + NewToolbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); + + // XServiceInfo + DECLARE_XSERVICEINFO + private: + void functionExecuted( const OUString &rCommand ); + void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& rEvent ) throw ( ::com::sun::star::uno::RuntimeException ); + void setItemImage( const OUString &rCommand ); + }; + + class WizardsToolbarController : public PopupMenuToolbarController + { + public: + WizardsToolbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); + + // XServiceInfo + DECLARE_XSERVICEINFO + private: + sal_uInt16 getDropDownStyle() const; + }; +} + +#endif |