1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef FORMS_NAVBARCONTROL_HXX
29 #define FORMS_NAVBARCONTROL_HXX
30 
31 #include "formnavigation.hxx"
32 
33 /** === begin UNO includes === **/
34 #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
35 #include <com/sun/star/frame/XStatusListener.hpp>
36 /** === end UNO includes === **/
37 
38 #include <toolkit/controls/unocontrol.hxx>
39 #include <toolkit/awt/vclxwindow.hxx>
40 #include <comphelper/uno3.hxx>
41 #include <cppuhelper/implbase1.hxx>
42 #include <tools/wintypes.hxx>
43 
44 //.........................................................................
45 namespace frm
46 {
47 //.........................................................................
48 
49     //==================================================================
50     // ONavigationBarControl
51     //==================================================================
52     typedef ::cppu::ImplHelper1 <   ::com::sun::star::frame::XDispatchProviderInterception
53                                 >   ONavigationBarControl_Base;
54 
55     class ONavigationBarControl
56                             :public UnoControl
57                             ,public ONavigationBarControl_Base
58     {
59     public:
60         ONavigationBarControl(
61             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
62         );
63 
64     protected:
65         ~ONavigationBarControl();
66 
67     public:
68         // XServiceInfo - static version
69         static	::rtl::OUString	SAL_CALL getImplementationName_Static();
70         static	::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static();
71         static	::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory );
72 
73     protected:
74         // UNO
75         DECLARE_UNO3_AGG_DEFAULTS( ONavigationBarControl, UnoControl );
76         virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw ( ::com::sun::star::uno::RuntimeException );
77 
78         // XControl
79         virtual void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& _rToolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& _rParent ) throw( ::com::sun::star::uno::RuntimeException );
80 
81         // XServiceInfo
82         virtual ::rtl::OUString	SAL_CALL getImplementationName()  throw(::com::sun::star::uno::RuntimeException);
83         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()  throw(::com::sun::star::uno::RuntimeException);
84 
85         // XTypeProvider
86         DECLARE_XTYPEPROVIDER()
87 
88         // XVclWindowPeer
89         virtual void SAL_CALL setDesignMode( sal_Bool _bOn ) throw( ::com::sun::star::uno::RuntimeException );
90 
91         // XDispatchProviderInterception
92         virtual void SAL_CALL registerDispatchProviderInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException);
93         virtual void SAL_CALL releaseDispatchProviderInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException);
94     };
95 
96     //==================================================================
97     // ONavigationBarPeer
98     //==================================================================
99     class ONavigationBarPeer
100                         :public VCLXWindow
101                         ,public OFormNavigationHelper
102     {
103     public:
104         /** factory method
105             @return
106                 a new ONavigationBarPeer instance, which has been aquired once!
107         */
108         static ONavigationBarPeer* Create(
109             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
110             Window* _pParentWindow,
111             const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxModel
112         );
113 
114     protected:
115         ONavigationBarPeer(
116             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
117         );
118         ~ONavigationBarPeer();
119 
120     public:
121         // XInterface
122         DECLARE_XINTERFACE( )
123 
124         // XVclWindowPeer
125         virtual void SAL_CALL setDesignMode( sal_Bool _bOn ) throw( ::com::sun::star::uno::RuntimeException );
126 
127         // XWindow2
128         using VCLXWindow::isEnabled;
129 
130     protected:
131         // XTypeProvider
132         DECLARE_XTYPEPROVIDER( )
133 
134 	    // XComponent
135         void SAL_CALL dispose(  ) throw( ::com::sun::star::uno::RuntimeException );
136 
137 	    // XVclWindowPeer
138         void SAL_CALL setProperty( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw( ::com::sun::star::uno::RuntimeException );
139         ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& _rPropertyName ) throw(::com::sun::star::uno::RuntimeException);
140 
141         // XEventListener
142         virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
143 
144         // OFormNavigationHelper overriables
145         virtual void    interceptorsChanged( );
146         virtual void    featureStateChanged( sal_Int16 _nFeatureId, sal_Bool _bEnabled );
147         virtual void    allFeatureStatesChanged( );
148         virtual void    getSupportedFeatures( ::std::vector< sal_Int16 >& /* [out] */ _rFeatureIds );
149 
150         // IFeatureDispatcher overriables
151         virtual bool    isEnabled( sal_Int16 _nFeatureId ) const;
152     };
153 
154 //.........................................................................
155 }   // namespace frm
156 //.........................................................................
157 
158 #endif // FORMS_NAVBARCONTROL_HXX
159