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 SD_FRAMEWORK_VIEW_SHELL_WRAPPER_HXX
21 #define SD_FRAMEWORK_VIEW_SHELL_WRAPPER_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/XWindow.hpp>
28 #include <com/sun/star/lang/XUnoTunnel.hpp>
29 #include <osl/mutex.hxx>
30 #include <cppuhelper/compbase5.hxx>
31 #include <cppuhelper/implbase1.hxx>
33 #include <boost/shared_ptr.hpp>
37 typedef ::cppu::WeakComponentImplHelper5
< ::com::sun::star::lang::XUnoTunnel
38 , ::com::sun::star::awt::XWindowListener
39 , ::com::sun::star::view::XSelectionSupplier
40 , ::com::sun::star::drawing::framework::XRelocatableResource
41 , ::com::sun::star::drawing::framework::XView
42 > ViewShellWrapperInterfaceBase
;
44 } // end of anonymous namespace.
46 namespace sd
{ class ViewShell
; }
47 namespace sd
{ namespace slidesorter
{ class SlideSorterViewShell
; } }
49 namespace sd
{ namespace framework
{
51 /** This class wraps ViewShell objects and makes them look like an XView.
52 Most importantly it provides a tunnel to the ViewShell implementation.
53 Then it forwards size changes of the pane window to the view shell.
55 class ViewShellWrapper
:private sd::MutexOwner
56 ,public ViewShellWrapperInterfaceBase
59 /** Create a new ViewShellWrapper object that wraps the given ViewShell
62 The ViewShell object to wrap.
64 URL of the view type of the wrapped view shell.
66 This window reference is optional. When a valid reference is
67 given then size changes of the referenced window are forwarded
68 to the ViewShell object.
71 ::boost::shared_ptr
<ViewShell
> pViewShell
,
72 const ::com::sun::star::uno::Reference
<
73 ::com::sun::star::drawing::framework::XResourceId
>& rxViewId
,
74 const ::com::sun::star::uno::Reference
<com::sun::star::awt::XWindow
>& rxWindow
);
75 virtual ~ViewShellWrapper (void);
77 virtual void SAL_CALL
disposing (void);
78 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
);
80 static const ::com::sun::star::uno::Sequence
<sal_Int8
>& getUnoTunnelId (void);
82 /** This method is typically used together with the XUnoTunnel interface
83 to obtain a pointer to the wrapped ViewShell object for a given
86 ::boost::shared_ptr
<ViewShell
> GetViewShell (void);
90 virtual sal_Int64 SAL_CALL
getSomething (const com::sun::star::uno::Sequence
<sal_Int8
>& rId
)
91 throw (com::sun::star::uno::RuntimeException
);
95 virtual ::com::sun::star::uno::Reference
<com::sun::star::drawing::framework::XResourceId
>
96 SAL_CALL
getResourceId (void)
97 throw (com::sun::star::uno::RuntimeException
);
99 virtual sal_Bool SAL_CALL
isAnchorOnly (void)
100 throw (com::sun::star::uno::RuntimeException
);
102 // XSelectionSupplier
104 virtual sal_Bool SAL_CALL
select( const ::com::sun::star::uno::Any
& aSelection
) throw(::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
105 virtual ::com::sun::star::uno::Any SAL_CALL
getSelection( ) throw(::com::sun::star::uno::RuntimeException
);
106 virtual void SAL_CALL
addSelectionChangeListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::view::XSelectionChangeListener
>& xListener
) throw(::com::sun::star::uno::RuntimeException
);
107 virtual void SAL_CALL
removeSelectionChangeListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::view::XSelectionChangeListener
>& xListener
) throw(::com::sun::star::uno::RuntimeException
);
109 // XRelocatableResource
111 virtual sal_Bool SAL_CALL
relocateToAnchor (
112 const ::com::sun::star::uno::Reference
<
113 com::sun::star::drawing::framework::XResource
>& xResource
)
114 throw (com::sun::star::uno::RuntimeException
);
119 virtual void SAL_CALL
windowResized(
120 const ::com::sun::star::awt::WindowEvent
& rEvent
)
121 throw (::com::sun::star::uno::RuntimeException
);
123 virtual void SAL_CALL
windowMoved(
124 const ::com::sun::star::awt::WindowEvent
& rEvent
)
125 throw (::com::sun::star::uno::RuntimeException
);
127 virtual void SAL_CALL
windowShown(
128 const ::com::sun::star::lang::EventObject
& rEvent
)
129 throw (::com::sun::star::uno::RuntimeException
);
131 virtual void SAL_CALL
windowHidden(
132 const ::com::sun::star::lang::EventObject
& rEvent
)
133 throw (::com::sun::star::uno::RuntimeException
);
138 virtual void SAL_CALL
disposing(
139 const com::sun::star::lang::EventObject
& rEvent
)
140 throw (com::sun::star::uno::RuntimeException
);
143 ::boost::shared_ptr
< ViewShell
> mpViewShell
;
144 ::boost::shared_ptr
< ::sd::slidesorter::SlideSorterViewShell
> mpSlideSorterViewShell
;
145 const ::com::sun::star::uno::Reference
< com::sun::star::drawing::framework::XResourceId
> mxViewId
;
146 ::com::sun::star::uno::Reference
<com::sun::star::awt::XWindow
> mxWindow
;
149 } } // end of namespace sd::framework
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */