LCOV - code coverage report
Current view: top level - sd/source/ui/inc/framework - ViewShellWrapper.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 1 100.0 %
Date: 2014-11-03 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_SD_SOURCE_UI_INC_FRAMEWORK_VIEWSHELLWRAPPER_HXX
      21             : #define INCLUDED_SD_SOURCE_UI_INC_FRAMEWORK_VIEWSHELLWRAPPER_HXX
      22             : 
      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>
      32             : 
      33             : #include <boost/shared_ptr.hpp>
      34             : 
      35             : namespace {
      36             : 
      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;
      43             : 
      44             : } // end of anonymous namespace.
      45             : 
      46             : namespace sd { class ViewShell; }
      47             : namespace sd { namespace slidesorter { class SlideSorterViewShell; } }
      48             : 
      49             : namespace sd { namespace framework {
      50             : 
      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.
      54             : */
      55             : class ViewShellWrapper  :private sd::MutexOwner
      56             :                         ,public ViewShellWrapperInterfaceBase
      57             : {
      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.
      69             :     */
      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 (void);
      76             : 
      77             :     virtual void SAL_CALL disposing (void) 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;
      79             : 
      80             :     static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId (void);
      81             : 
      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.
      85             :     */
      86        9118 :     ::boost::shared_ptr<ViewShell> GetViewShell (void) { return mpViewShell;}
      87             : 
      88             :     // XUnoTunnel
      89             : 
      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;
      92             : 
      93             :     // XResource
      94             : 
      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, std::exception) SAL_OVERRIDE;
      98             : 
      99             :     virtual sal_Bool SAL_CALL isAnchorOnly (void)
     100             :         throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     101             : 
     102             :     // XSelectionSupplier
     103             : 
     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;
     110             : 
     111             :     // XRelocatableResource
     112             : 
     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;
     117             : 
     118             :     // XWindowListener
     119             : 
     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;
     123             : 
     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;
     127             : 
     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;
     131             : 
     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;
     135             : 
     136             :     // XEventListener
     137             : 
     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;
     141             : 
     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;
     147             : };
     148             : 
     149             : } } // end of namespace sd::framework
     150             : 
     151             : #endif
     152             : 
     153             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10