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 INCLUDED_SFX2_INC_BACKINGCOMP_HXX
21 #define INCLUDED_SFX2_INC_BACKINGCOMP_HXX
23 #include <com/sun/star/lang/XTypeProvider.hpp>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/lang/XInitialization.hpp>
26 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
27 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
28 #include <com/sun/star/awt/XWindow.hpp>
29 #include <com/sun/star/awt/XKeyListener.hpp>
30 #include <com/sun/star/uno/XComponentContext.hpp>
32 #include <com/sun/star/frame/XFrame.hpp>
33 #include <com/sun/star/frame/XDispatch.hpp>
34 #include <com/sun/star/frame/XDispatchProvider.hpp>
36 #include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp>
37 #include <com/sun/star/lang/XEventListener.hpp>
38 #include <com/sun/star/lang/XComponent.hpp>
40 #include <cppuhelper/weak.hxx>
42 //__________________________________________
45 //__________________________________________
47 implements the backing component.
49 This component is a special one, which doesn't provide a controller
50 nor a model. It supports the following features:
57 class BackingComp
: public css::lang::XTypeProvider
58 , public css::lang::XServiceInfo
59 , public css::lang::XInitialization
60 , public css::frame::XController
// => XComponent
61 , public css::awt::XKeyListener
// => XEventListener
62 , public css::frame::XDispatchProvider
63 , public css::frame::XDispatch
64 , public ::cppu::OWeakObject
66 //______________________________________
70 /** the global uno service manager.
71 Must be used to create own needed services. */
72 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
74 /** reference to the component window. */
75 css::uno::Reference
< css::awt::XWindow
> m_xWindow
;
77 /** the owner frame of this component. */
78 css::uno::Reference
< css::frame::XFrame
> m_xFrame
;
80 //______________________________________
85 BackingComp( const css::uno::Reference
< css::uno::XComponentContext
>& xContext
);
86 virtual ~BackingComp( );
89 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& aType
) throw(css::uno::RuntimeException
);
90 virtual void SAL_CALL
acquire ( ) throw( );
91 virtual void SAL_CALL
release ( ) throw( );
94 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes () throw(css::uno::RuntimeException
);
95 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() throw(css::uno::RuntimeException
);
98 virtual OUString SAL_CALL
getImplementationName ( ) throw(css::uno::RuntimeException
);
99 virtual sal_Bool SAL_CALL
supportsService ( const OUString
& sServiceName
) throw(css::uno::RuntimeException
);
100 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) throw(css::uno::RuntimeException
);
103 virtual void SAL_CALL
initialize( const css::uno::Sequence
< css::uno::Any
>& lArgs
) throw(css::uno::Exception
, css::uno::RuntimeException
);
106 virtual void SAL_CALL
attachFrame ( const css::uno::Reference
< css::frame::XFrame
>& xFrame
) throw(css::uno::RuntimeException
);
107 virtual sal_Bool SAL_CALL
attachModel ( const css::uno::Reference
< css::frame::XModel
>& xModel
) throw(css::uno::RuntimeException
);
108 virtual sal_Bool SAL_CALL
suspend ( sal_Bool bSuspend
) throw(css::uno::RuntimeException
);
109 virtual css::uno::Any SAL_CALL
getViewData ( ) throw(css::uno::RuntimeException
);
110 virtual void SAL_CALL
restoreViewData( const css::uno::Any
& aData
) throw(css::uno::RuntimeException
);
111 virtual css::uno::Reference
< css::frame::XModel
> SAL_CALL
getModel ( ) throw(css::uno::RuntimeException
);
112 virtual css::uno::Reference
< css::frame::XFrame
> SAL_CALL
getFrame ( ) throw(css::uno::RuntimeException
);
115 virtual void SAL_CALL
keyPressed ( const css::awt::KeyEvent
& aEvent
) throw(css::uno::RuntimeException
);
116 virtual void SAL_CALL
keyReleased( const css::awt::KeyEvent
& aEvent
) throw(css::uno::RuntimeException
);
119 virtual void SAL_CALL
disposing( const css::lang::EventObject
& aEvent
) throw(css::uno::RuntimeException
);
122 virtual void SAL_CALL
dispose ( ) throw(css::uno::RuntimeException
);
123 virtual void SAL_CALL
addEventListener ( const css::uno::Reference
< css::lang::XEventListener
>& xListener
) throw(css::uno::RuntimeException
);
124 virtual void SAL_CALL
removeEventListener( const css::uno::Reference
< css::lang::XEventListener
>& xListener
) throw(css::uno::RuntimeException
);
127 virtual css::uno::Reference
< css::frame::XDispatch
> SAL_CALL
queryDispatch( const css::util::URL
& aURL
, const OUString
& sTargetFrameName
, sal_Int32 nSearchFlags
) throw( css::uno::RuntimeException
);
128 virtual css::uno::Sequence
< css::uno::Reference
< css::frame::XDispatch
> > SAL_CALL
queryDispatches( const css::uno::Sequence
< css::frame::DispatchDescriptor
>& lDescriptions
) throw( css::uno::RuntimeException
);
131 virtual void SAL_CALL
dispatch( const css::util::URL
& aURL
, const css::uno::Sequence
< css::beans::PropertyValue
>& lArguments
) throw( css::uno::RuntimeException
);
132 virtual void SAL_CALL
addStatusListener( const css::uno::Reference
< css::frame::XStatusListener
>& xListener
, const css::util::URL
& aURL
) throw( css::uno::RuntimeException
);
133 virtual void SAL_CALL
removeStatusListener( const css::uno::Reference
< css::frame::XStatusListener
>& xListener
, const css::util::URL
& aURL
) throw( css::uno::RuntimeException
);
135 //______________________________________
140 static css::uno::Sequence
< OUString
> SAL_CALL
impl_getStaticSupportedServiceNames( );
141 static OUString SAL_CALL
impl_getStaticImplementationName ( );
142 static css::uno::Reference
< css::uno::XInterface
> SAL_CALL
impl_createInstance ( const css::uno::Reference
< css::lang::XMultiServiceFactory
>& xSMGR
) throw( css::uno::Exception
);
143 static css::uno::Reference
< css::lang::XSingleServiceFactory
> SAL_CALL
impl_createFactory ( const css::uno::Reference
< css::lang::XMultiServiceFactory
>& xSMGR
);
146 #endif // INCLUDED_SFX2_INC_BACKINGCOMP_HXX
148 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */