bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / inc / framework / ViewShellWrapper.hxx
blob5b384485c13fa72aae2ab1a48f169d34086474d4
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/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>
35 namespace {
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
58 public:
59 /** Create a new ViewShellWrapper object that wraps the given ViewShell
60 object.
61 @param pViewShell
62 The ViewShell object to wrap.
63 @param rsViewURL
64 URL of the view type of the wrapped view shell.
65 @param rxWindow
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.
70 ViewShellWrapper (
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();
77 virtual void SAL_CALL disposing() SAL_OVERRIDE;
78 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
80 static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
82 /** This method is typically used together with the XUnoTunnel interface
83 to obtain a pointer to the wrapped ViewShell object for a given
84 XView object.
86 ::boost::shared_ptr<ViewShell> GetViewShell() { return mpViewShell;}
88 // XUnoTunnel
90 virtual sal_Int64 SAL_CALL getSomething (const com::sun::star::uno::Sequence<sal_Int8>& rId)
91 throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
93 // XResource
95 virtual ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId>
96 SAL_CALL getResourceId()
97 throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
99 virtual sal_Bool SAL_CALL isAnchorOnly()
100 throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
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, std::exception) SAL_OVERRIDE;
105 virtual ::com::sun::star::uno::Any SAL_CALL getSelection()
106 throw (::com::sun::star::uno::RuntimeException,
107 std::exception) SAL_OVERRIDE;
108 virtual void SAL_CALL addSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
109 virtual void SAL_CALL removeSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
111 // XRelocatableResource
113 virtual sal_Bool SAL_CALL relocateToAnchor (
114 const ::com::sun::star::uno::Reference<
115 com::sun::star::drawing::framework::XResource>& xResource)
116 throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
118 // XWindowListener
120 virtual void SAL_CALL windowResized(
121 const ::com::sun::star::awt::WindowEvent& rEvent)
122 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
124 virtual void SAL_CALL windowMoved(
125 const ::com::sun::star::awt::WindowEvent& rEvent)
126 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
128 virtual void SAL_CALL windowShown(
129 const ::com::sun::star::lang::EventObject& rEvent)
130 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
132 virtual void SAL_CALL windowHidden(
133 const ::com::sun::star::lang::EventObject& rEvent)
134 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
136 // XEventListener
138 virtual void SAL_CALL disposing(
139 const com::sun::star::lang::EventObject& rEvent)
140 throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
142 private:
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
151 #endif
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */