1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: backingcomp.hxx,v $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 #ifndef __FRAMEWORK_SERVICES_BACKINGCOMP_HXX_
33 #define __FRAMEWORK_SERVICES_BACKINGCOMP_HXX_
35 //__________________________________________
38 #include <threadhelp/threadhelpbase.hxx>
42 //__________________________________________
44 #include <com/sun/star/lang/XTypeProvider.hpp>
45 #include <com/sun/star/lang/XServiceInfo.hpp>
46 #include <com/sun/star/lang/XInitialization.hpp>
47 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
48 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
49 #include <com/sun/star/awt/XWindow.hpp>
50 #include <com/sun/star/awt/XKeyListener.hpp>
52 #ifndef _COM_SUN_STAR_FAME_XFRAME_HPP_
53 #include <com/sun/star/frame/XFrame.hpp>
56 #ifndef _COM_SUN_STAR_DATATRANSFER_DND_XDROPTARGETELISTENER_HPP_
57 #include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp>
59 #include <com/sun/star/lang/XEventListener.hpp>
60 #include <com/sun/star/lang/XComponent.hpp>
62 //__________________________________________
64 #include <cppuhelper/weak.hxx>
66 //__________________________________________
72 //__________________________________________
74 implements the backing component.
76 This component is a special one, which doesn't provide a controller
77 nor a model. It supports the following features:
84 class BackingComp
: public css::lang::XTypeProvider
85 , public css::lang::XServiceInfo
86 , public css::lang::XInitialization
87 , public css::frame::XController
// => XComponent
88 , public css::awt::XKeyListener
// => XEventListener
89 // attention! Must be the first base class to guarentee right initialize lock ...
90 , private ThreadHelpBase
91 , public ::cppu::OWeakObject
93 //______________________________________
98 /** the global uno service manager.
99 Must be used to create own needed services. */
100 css::uno::Reference
< css::lang::XMultiServiceFactory
> m_xSMGR
;
102 /** reference to the component window. */
103 css::uno::Reference
< css::awt::XWindow
> m_xWindow
;
105 /** the owner frame of this component. */
106 css::uno::Reference
< css::frame::XFrame
> m_xFrame
;
108 /** helper for drag&drop. */
109 css::uno::Reference
< css::datatransfer::dnd::XDropTargetListener
> m_xDropTargetListener
;
111 //______________________________________
116 BackingComp( const css::uno::Reference
< css::lang::XMultiServiceFactory
> xSMGR
);
117 virtual ~BackingComp( );
120 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& aType
) throw(css::uno::RuntimeException
);
121 virtual void SAL_CALL
acquire ( ) throw( );
122 virtual void SAL_CALL
release ( ) throw( );
125 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes () throw(css::uno::RuntimeException
);
126 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() throw(css::uno::RuntimeException
);
129 virtual ::rtl::OUString SAL_CALL
getImplementationName ( ) throw(css::uno::RuntimeException
);
130 virtual sal_Bool SAL_CALL
supportsService ( const ::rtl::OUString
& sServiceName
) throw(css::uno::RuntimeException
);
131 virtual css::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames( ) throw(css::uno::RuntimeException
);
134 virtual void SAL_CALL
initialize( const css::uno::Sequence
< css::uno::Any
>& lArgs
) throw(css::uno::Exception
, css::uno::RuntimeException
);
137 virtual void SAL_CALL
attachFrame ( const css::uno::Reference
< css::frame::XFrame
>& xFrame
) throw(css::uno::RuntimeException
);
138 virtual sal_Bool SAL_CALL
attachModel ( const css::uno::Reference
< css::frame::XModel
>& xModel
) throw(css::uno::RuntimeException
);
139 virtual sal_Bool SAL_CALL
suspend ( sal_Bool bSuspend
) throw(css::uno::RuntimeException
);
140 virtual css::uno::Any SAL_CALL
getViewData ( ) throw(css::uno::RuntimeException
);
141 virtual void SAL_CALL
restoreViewData( const css::uno::Any
& aData
) throw(css::uno::RuntimeException
);
142 virtual css::uno::Reference
< css::frame::XModel
> SAL_CALL
getModel ( ) throw(css::uno::RuntimeException
);
143 virtual css::uno::Reference
< css::frame::XFrame
> SAL_CALL
getFrame ( ) throw(css::uno::RuntimeException
);
146 virtual void SAL_CALL
keyPressed ( const css::awt::KeyEvent
& aEvent
) throw(css::uno::RuntimeException
);
147 virtual void SAL_CALL
keyReleased( const css::awt::KeyEvent
& aEvent
) throw(css::uno::RuntimeException
);
150 virtual void SAL_CALL
disposing( const css::lang::EventObject
& aEvent
) throw(css::uno::RuntimeException
);
153 virtual void SAL_CALL
dispose ( ) throw(css::uno::RuntimeException
);
154 virtual void SAL_CALL
addEventListener ( const css::uno::Reference
< css::lang::XEventListener
>& xListener
) throw(css::uno::RuntimeException
);
155 virtual void SAL_CALL
removeEventListener( const css::uno::Reference
< css::lang::XEventListener
>& xListener
) throw(css::uno::RuntimeException
);
157 //______________________________________
162 static css::uno::Sequence
< ::rtl::OUString
> SAL_CALL
impl_getStaticSupportedServiceNames( );
163 static ::rtl::OUString SAL_CALL
impl_getStaticImplementationName ( );
164 static css::uno::Reference
< css::uno::XInterface
> SAL_CALL
impl_createInstance ( const css::uno::Reference
< css::lang::XMultiServiceFactory
>& xSMGR
) throw( css::uno::Exception
);
165 static css::uno::Reference
< css::lang::XSingleServiceFactory
> SAL_CALL
impl_createFactory ( const css::uno::Reference
< css::lang::XMultiServiceFactory
>& xSMGR
);
168 } // namespace framework
170 #endif // __FRAMEWORK_SERVICES_BACKINGCOMP_HXX_