1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef __FRAMEWORK_SERVICES_BACKINGCOMP_HXX_
21 #define __FRAMEWORK_SERVICES_BACKINGCOMP_HXX_
23 #include <threadhelp/threadhelpbase.hxx>
27 #include <com/sun/star/lang/XTypeProvider.hpp>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <com/sun/star/lang/XInitialization.hpp>
30 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
31 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
32 #include <com/sun/star/awt/XWindow.hpp>
33 #include <com/sun/star/awt/XKeyListener.hpp>
35 #include <com/sun/star/frame/XFrame.hpp>
37 #include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp>
38 #include <com/sun/star/lang/XEventListener.hpp>
39 #include <com/sun/star/lang/XComponent.hpp>
41 #include <cppuhelper/weak.hxx>
43 //__________________________________________
49 //__________________________________________
51 implements the backing component.
53 This component is a special one, which doesn't provide a controller
54 nor a model. It supports the following features:
61 class BackingComp
: public css::lang::XTypeProvider
62 , public css::lang::XServiceInfo
63 , public css::lang::XInitialization
64 , public css::frame::XController
// => XComponent
65 , public css::awt::XKeyListener
// => XEventListener
66 // attention! Must be the first base class to guarantee right initialize lock ...
67 , private ThreadHelpBase
68 , public ::cppu::OWeakObject
70 //______________________________________
75 /** the global uno service manager.
76 Must be used to create own needed services. */
77 css::uno::Reference
< css::lang::XMultiServiceFactory
> m_xSMGR
;
79 /** reference to the component window. */
80 css::uno::Reference
< css::awt::XWindow
> m_xWindow
;
82 /** the owner frame of this component. */
83 css::uno::Reference
< css::frame::XFrame
> m_xFrame
;
85 /** helper for drag&drop. */
86 css::uno::Reference
< css::datatransfer::dnd::XDropTargetListener
> m_xDropTargetListener
;
88 //______________________________________
93 BackingComp( const css::uno::Reference
< css::lang::XMultiServiceFactory
> xSMGR
);
94 virtual ~BackingComp( );
97 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& aType
) throw(css::uno::RuntimeException
);
98 virtual void SAL_CALL
acquire ( ) throw( );
99 virtual void SAL_CALL
release ( ) throw( );
102 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes () throw(css::uno::RuntimeException
);
103 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() throw(css::uno::RuntimeException
);
106 virtual OUString SAL_CALL
getImplementationName ( ) throw(css::uno::RuntimeException
);
107 virtual sal_Bool SAL_CALL
supportsService ( const OUString
& sServiceName
) throw(css::uno::RuntimeException
);
108 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) throw(css::uno::RuntimeException
);
111 virtual void SAL_CALL
initialize( const css::uno::Sequence
< css::uno::Any
>& lArgs
) throw(css::uno::Exception
, css::uno::RuntimeException
);
114 virtual void SAL_CALL
attachFrame ( const css::uno::Reference
< css::frame::XFrame
>& xFrame
) throw(css::uno::RuntimeException
);
115 virtual sal_Bool SAL_CALL
attachModel ( const css::uno::Reference
< css::frame::XModel
>& xModel
) throw(css::uno::RuntimeException
);
116 virtual sal_Bool SAL_CALL
suspend ( sal_Bool bSuspend
) throw(css::uno::RuntimeException
);
117 virtual css::uno::Any SAL_CALL
getViewData ( ) throw(css::uno::RuntimeException
);
118 virtual void SAL_CALL
restoreViewData( const css::uno::Any
& aData
) throw(css::uno::RuntimeException
);
119 virtual css::uno::Reference
< css::frame::XModel
> SAL_CALL
getModel ( ) throw(css::uno::RuntimeException
);
120 virtual css::uno::Reference
< css::frame::XFrame
> SAL_CALL
getFrame ( ) throw(css::uno::RuntimeException
);
123 virtual void SAL_CALL
keyPressed ( const css::awt::KeyEvent
& aEvent
) throw(css::uno::RuntimeException
);
124 virtual void SAL_CALL
keyReleased( const css::awt::KeyEvent
& aEvent
) throw(css::uno::RuntimeException
);
127 virtual void SAL_CALL
disposing( const css::lang::EventObject
& aEvent
) throw(css::uno::RuntimeException
);
130 virtual void SAL_CALL
dispose ( ) throw(css::uno::RuntimeException
);
131 virtual void SAL_CALL
addEventListener ( const css::uno::Reference
< css::lang::XEventListener
>& xListener
) throw(css::uno::RuntimeException
);
132 virtual void SAL_CALL
removeEventListener( const css::uno::Reference
< css::lang::XEventListener
>& xListener
) throw(css::uno::RuntimeException
);
134 //______________________________________
139 static css::uno::Sequence
< OUString
> SAL_CALL
impl_getStaticSupportedServiceNames( );
140 static OUString SAL_CALL
impl_getStaticImplementationName ( );
141 static css::uno::Reference
< css::uno::XInterface
> SAL_CALL
impl_createInstance ( const css::uno::Reference
< css::lang::XMultiServiceFactory
>& xSMGR
) throw( css::uno::Exception
);
142 static css::uno::Reference
< css::lang::XSingleServiceFactory
> SAL_CALL
impl_createFactory ( const css::uno::Reference
< css::lang::XMultiServiceFactory
>& xSMGR
);
145 } // namespace framework
147 #endif // __FRAMEWORK_SERVICES_BACKINGCOMP_HXX_
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */