1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef __FRAMEWORK_SERVICES_BACKINGCOMP_HXX_
29*cdf0e10cSrcweir #define __FRAMEWORK_SERVICES_BACKINGCOMP_HXX_
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir //__________________________________________
32*cdf0e10cSrcweir // own includes
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir #include <threadhelp/threadhelpbase.hxx>
35*cdf0e10cSrcweir #include <general.h>
36*cdf0e10cSrcweir #include <stdtypes.h>
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir //__________________________________________
39*cdf0e10cSrcweir // interface includes
40*cdf0e10cSrcweir #include <com/sun/star/lang/XTypeProvider.hpp>
41*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
42*cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp>
43*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
44*cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp>
45*cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp>
46*cdf0e10cSrcweir #include <com/sun/star/awt/XKeyListener.hpp>
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_FAME_XFRAME_HPP_
49*cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp>
50*cdf0e10cSrcweir #endif
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_DATATRANSFER_DND_XDROPTARGETELISTENER_HPP_
53*cdf0e10cSrcweir #include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp>
54*cdf0e10cSrcweir #endif
55*cdf0e10cSrcweir #include <com/sun/star/lang/XEventListener.hpp>
56*cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp>
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir //__________________________________________
59*cdf0e10cSrcweir // other includes
60*cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir //__________________________________________
63*cdf0e10cSrcweir // definition
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir namespace framework
66*cdf0e10cSrcweir {
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir //__________________________________________
69*cdf0e10cSrcweir /**
70*cdf0e10cSrcweir     implements the backing component.
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir     This component is a special one, which doesn't provide a controller
73*cdf0e10cSrcweir     nor a model. It supports the following features:
74*cdf0e10cSrcweir         - Drag & Drop
75*cdf0e10cSrcweir         - Key Accelerators
76*cdf0e10cSrcweir         - Simple Menu
77*cdf0e10cSrcweir         - Progress Bar
78*cdf0e10cSrcweir         - Background
79*cdf0e10cSrcweir  */
80*cdf0e10cSrcweir class BackingComp : public  css::lang::XTypeProvider
81*cdf0e10cSrcweir                   , public  css::lang::XServiceInfo
82*cdf0e10cSrcweir                   , public  css::lang::XInitialization
83*cdf0e10cSrcweir                   , public  css::frame::XController  // => XComponent
84*cdf0e10cSrcweir                   , public  css::awt::XKeyListener // => XEventListener
85*cdf0e10cSrcweir                   // attention! Must be the first base class to guarentee right initialize lock ...
86*cdf0e10cSrcweir                   , private ThreadHelpBase
87*cdf0e10cSrcweir                   , public  ::cppu::OWeakObject
88*cdf0e10cSrcweir {
89*cdf0e10cSrcweir     //______________________________________
90*cdf0e10cSrcweir     // member
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir     private:
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir         /** the global uno service manager.
95*cdf0e10cSrcweir             Must be used to create own needed services. */
96*cdf0e10cSrcweir         css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir         /** reference to the component window. */
99*cdf0e10cSrcweir         css::uno::Reference< css::awt::XWindow > m_xWindow;
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir         /** the owner frame of this component. */
102*cdf0e10cSrcweir         css::uno::Reference< css::frame::XFrame > m_xFrame;
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir         /** helper for drag&drop. */
105*cdf0e10cSrcweir         css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > m_xDropTargetListener;
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir     //______________________________________
108*cdf0e10cSrcweir     // interface
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir     public:
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir                  BackingComp( const css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR );
113*cdf0e10cSrcweir         virtual ~BackingComp(                                                                    );
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir         // XInterface
116*cdf0e10cSrcweir         virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw(css::uno::RuntimeException);
117*cdf0e10cSrcweir         virtual void          SAL_CALL acquire       (                             ) throw(                          );
118*cdf0e10cSrcweir         virtual void          SAL_CALL release       (                             ) throw(                          );
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir         // XTypeProvide
121*cdf0e10cSrcweir         virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes           () throw(css::uno::RuntimeException);
122*cdf0e10cSrcweir         virtual css::uno::Sequence< sal_Int8 >       SAL_CALL getImplementationId() throw(css::uno::RuntimeException);
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir         // XServiceInfo
125*cdf0e10cSrcweir         virtual ::rtl::OUString                       SAL_CALL getImplementationName   (                                     ) throw(css::uno::RuntimeException);
126*cdf0e10cSrcweir         virtual sal_Bool                              SAL_CALL supportsService         ( const ::rtl::OUString& sServiceName ) throw(css::uno::RuntimeException);
127*cdf0e10cSrcweir         virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(                                     ) throw(css::uno::RuntimeException);
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir         // XInitialization
130*cdf0e10cSrcweir         virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& lArgs ) throw(css::uno::Exception, css::uno::RuntimeException);
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir         // XController
133*cdf0e10cSrcweir         virtual void                                      SAL_CALL attachFrame    ( const css::uno::Reference< css::frame::XFrame >& xFrame   ) throw(css::uno::RuntimeException);
134*cdf0e10cSrcweir         virtual sal_Bool                                  SAL_CALL attachModel    ( const css::uno::Reference< css::frame::XModel >& xModel   ) throw(css::uno::RuntimeException);
135*cdf0e10cSrcweir         virtual sal_Bool                                  SAL_CALL suspend        (       sal_Bool                                   bSuspend ) throw(css::uno::RuntimeException);
136*cdf0e10cSrcweir         virtual css::uno::Any                             SAL_CALL getViewData    (                                                           ) throw(css::uno::RuntimeException);
137*cdf0e10cSrcweir         virtual void                                      SAL_CALL restoreViewData( const css::uno::Any&                             aData    ) throw(css::uno::RuntimeException);
138*cdf0e10cSrcweir         virtual css::uno::Reference< css::frame::XModel > SAL_CALL getModel       (                                                           ) throw(css::uno::RuntimeException);
139*cdf0e10cSrcweir         virtual css::uno::Reference< css::frame::XFrame > SAL_CALL getFrame       (                                                           ) throw(css::uno::RuntimeException);
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir         // XKeyListener
142*cdf0e10cSrcweir         virtual void SAL_CALL keyPressed ( const css::awt::KeyEvent& aEvent ) throw(css::uno::RuntimeException);
143*cdf0e10cSrcweir         virtual void SAL_CALL keyReleased( const css::awt::KeyEvent& aEvent ) throw(css::uno::RuntimeException);
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir         // XEventListener
146*cdf0e10cSrcweir         virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw(css::uno::RuntimeException);
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir         // XComponent
149*cdf0e10cSrcweir         virtual void SAL_CALL dispose            (                                                                   ) throw(css::uno::RuntimeException);
150*cdf0e10cSrcweir         virtual void SAL_CALL addEventListener   ( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw(css::uno::RuntimeException);
151*cdf0e10cSrcweir         virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw(css::uno::RuntimeException);
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir     //______________________________________
154*cdf0e10cSrcweir     // helper
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir     public:
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir         static css::uno::Sequence< ::rtl::OUString >                   SAL_CALL impl_getStaticSupportedServiceNames(                                                                     );
159*cdf0e10cSrcweir         static ::rtl::OUString                                         SAL_CALL impl_getStaticImplementationName   (                                                                     );
160*cdf0e10cSrcweir         static css::uno::Reference< css::uno::XInterface >             SAL_CALL impl_createInstance                ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ) throw( css::uno::Exception );
161*cdf0e10cSrcweir         static css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL impl_createFactory                 ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR );
162*cdf0e10cSrcweir };
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir } // namespace framework
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir #endif // __FRAMEWORK_SERVICES_BACKINGCOMP_HXX_
167