1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef FORMS_NAVBARCONTROL_HXX
25 #define FORMS_NAVBARCONTROL_HXX
26 
27 #include "formnavigation.hxx"
28 
29 /** === begin UNO includes === **/
30 #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
31 #include <com/sun/star/frame/XStatusListener.hpp>
32 /** === end UNO includes === **/
33 
34 #include <toolkit/controls/unocontrol.hxx>
35 #include <toolkit/awt/vclxwindow.hxx>
36 #include <comphelper/uno3.hxx>
37 #include <cppuhelper/implbase1.hxx>
38 #include <tools/wintypes.hxx>
39 
40 //.........................................................................
41 namespace frm
42 {
43 //.........................................................................
44 
45     //==================================================================
46     // ONavigationBarControl
47     //==================================================================
48     typedef ::cppu::ImplHelper1 <   ::com::sun::star::frame::XDispatchProviderInterception
49                                 >   ONavigationBarControl_Base;
50 
51     class ONavigationBarControl
52                             :public UnoControl
53                             ,public ONavigationBarControl_Base
54     {
55     public:
56         ONavigationBarControl(
57             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
58         );
59 
60     protected:
61         ~ONavigationBarControl();
62 
63     public:
64         // XServiceInfo - static version
65         static	::rtl::OUString	SAL_CALL getImplementationName_Static();
66         static	::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static();
67         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 );
68 
69     protected:
70         // UNO
71         DECLARE_UNO3_AGG_DEFAULTS( ONavigationBarControl, UnoControl );
72         virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw ( ::com::sun::star::uno::RuntimeException );
73 
74         // XControl
75         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 );
76 
77         // XServiceInfo
78         virtual ::rtl::OUString	SAL_CALL getImplementationName()  throw(::com::sun::star::uno::RuntimeException);
79         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()  throw(::com::sun::star::uno::RuntimeException);
80 
81         // XTypeProvider
82         DECLARE_XTYPEPROVIDER()
83 
84         // XVclWindowPeer
85         virtual void SAL_CALL setDesignMode( sal_Bool _bOn ) throw( ::com::sun::star::uno::RuntimeException );
86 
87         // XDispatchProviderInterception
88         virtual void SAL_CALL registerDispatchProviderInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException);
89         virtual void SAL_CALL releaseDispatchProviderInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException);
90     };
91 
92     //==================================================================
93     // ONavigationBarPeer
94     //==================================================================
95     class ONavigationBarPeer
96                         :public VCLXWindow
97                         ,public OFormNavigationHelper
98     {
99     public:
100         /** factory method
101             @return
102                 a new ONavigationBarPeer instance, which has been aquired once!
103         */
104         static ONavigationBarPeer* Create(
105             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
106             Window* _pParentWindow,
107             const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxModel
108         );
109 
110     protected:
111         ONavigationBarPeer(
112             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
113         );
114         ~ONavigationBarPeer();
115 
116     public:
117         // XInterface
118         DECLARE_XINTERFACE( )
119 
120         // XVclWindowPeer
121         virtual void SAL_CALL setDesignMode( sal_Bool _bOn ) throw( ::com::sun::star::uno::RuntimeException );
122 
123         // XWindow2
124         using VCLXWindow::isEnabled;
125 
126     protected:
127         // XTypeProvider
128         DECLARE_XTYPEPROVIDER( )
129 
130 	    // XComponent
131         void SAL_CALL dispose(  ) throw( ::com::sun::star::uno::RuntimeException );
132 
133 	    // XVclWindowPeer
134         void SAL_CALL setProperty( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw( ::com::sun::star::uno::RuntimeException );
135         ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& _rPropertyName ) throw(::com::sun::star::uno::RuntimeException);
136 
137         // XEventListener
138         virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
139 
140         // OFormNavigationHelper overriables
141         virtual void    interceptorsChanged( );
142         virtual void    featureStateChanged( sal_Int16 _nFeatureId, sal_Bool _bEnabled );
143         virtual void    allFeatureStatesChanged( );
144         virtual void    getSupportedFeatures( ::std::vector< sal_Int16 >& /* [out] */ _rFeatureIds );
145 
146         // IFeatureDispatcher overriables
147         virtual bool    isEnabled( sal_Int16 _nFeatureId ) const;
148     };
149 
150 //.........................................................................
151 }   // namespace frm
152 //.........................................................................
153 
154 #endif // FORMS_NAVBARCONTROL_HXX
155