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_SD_SOURCE_UI_INC_FRAMEWORK_VIEWSHELLWRAPPER_HXX
21 #define INCLUDED_SD_SOURCE_UI_INC_FRAMEWORK_VIEWSHELLWRAPPER_HXX
23 #include <MutexOwner.hxx>
24 #include <com/sun/star/drawing/framework/XView.hpp>
25 #include <com/sun/star/drawing/framework/XRelocatableResource.hpp>
26 #include <com/sun/star/view/XSelectionSupplier.hpp>
27 #include <com/sun/star/awt/XWindowListener.hpp>
28 #include <com/sun/star/lang/XUnoTunnel.hpp>
29 #include <cppuhelper/compbase.hxx>
33 namespace sd
{ class ViewShell
; }
34 namespace sd
{ namespace slidesorter
{ class SlideSorterViewShell
; } }
35 namespace com
{ namespace sun
{ namespace star
{ namespace awt
{ class XWindow
; } } } }
37 namespace sd
{ namespace framework
{
39 typedef ::cppu::WeakComponentImplHelper
< css::lang::XUnoTunnel
40 , css::awt::XWindowListener
41 , css::view::XSelectionSupplier
42 , css::drawing::framework::XRelocatableResource
43 , css::drawing::framework::XView
44 > ViewShellWrapperInterfaceBase
;
46 /** This class wraps ViewShell objects and makes them look like an XView.
47 Most importantly it provides a tunnel to the ViewShell implementation.
48 Then it forwards size changes of the pane window to the view shell.
50 class ViewShellWrapper
:private sd::MutexOwner
51 ,public ViewShellWrapperInterfaceBase
54 /** Create a new ViewShellWrapper object that wraps the given ViewShell
57 The ViewShell object to wrap.
59 URL of the view type of the wrapped view shell.
61 This window reference is optional. When a valid reference is
62 given then size changes of the referenced window are forwarded
63 to the ViewShell object.
66 const ::std::shared_ptr
<ViewShell
>& pViewShell
,
67 const css::uno::Reference
<css::drawing::framework::XResourceId
>& rxViewId
,
68 const css::uno::Reference
<css::awt::XWindow
>& rxWindow
);
69 virtual ~ViewShellWrapper() override
;
71 virtual void SAL_CALL
disposing() override
;
72 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& rType
) override
;
74 static const css::uno::Sequence
<sal_Int8
>& getUnoTunnelId();
76 /** This method is typically used together with the XUnoTunnel interface
77 to obtain a pointer to the wrapped ViewShell object for a given
80 const ::std::shared_ptr
<ViewShell
>& GetViewShell() { return mpViewShell
;}
84 virtual sal_Int64 SAL_CALL
getSomething (const css::uno::Sequence
<sal_Int8
>& rId
) override
;
88 virtual css::uno::Reference
<css::drawing::framework::XResourceId
>
89 SAL_CALL
getResourceId() override
;
91 virtual sal_Bool SAL_CALL
isAnchorOnly() override
;
95 virtual sal_Bool SAL_CALL
select( const css::uno::Any
& aSelection
) override
;
96 virtual css::uno::Any SAL_CALL
getSelection() override
;
97 virtual void SAL_CALL
addSelectionChangeListener( const css::uno::Reference
< css::view::XSelectionChangeListener
>& xListener
) override
;
98 virtual void SAL_CALL
removeSelectionChangeListener( const css::uno::Reference
< css::view::XSelectionChangeListener
>& xListener
) override
;
100 // XRelocatableResource
102 virtual sal_Bool SAL_CALL
relocateToAnchor (
103 const css::uno::Reference
<
104 css::drawing::framework::XResource
>& xResource
) override
;
108 virtual void SAL_CALL
windowResized(
109 const css::awt::WindowEvent
& rEvent
) override
;
111 virtual void SAL_CALL
windowMoved(
112 const css::awt::WindowEvent
& rEvent
) override
;
114 virtual void SAL_CALL
windowShown(
115 const css::lang::EventObject
& rEvent
) override
;
117 virtual void SAL_CALL
windowHidden(
118 const css::lang::EventObject
& rEvent
) override
;
122 virtual void SAL_CALL
disposing(
123 const css::lang::EventObject
& rEvent
) override
;
126 ::std::shared_ptr
< ViewShell
> mpViewShell
;
127 ::std::shared_ptr
< ::sd::slidesorter::SlideSorterViewShell
> mpSlideSorterViewShell
;
128 const css::uno::Reference
< css::drawing::framework::XResourceId
> mxViewId
;
129 css::uno::Reference
<css::awt::XWindow
> mxWindow
;
132 } } // end of namespace sd::framework
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */