LCOV - code coverage report
Current view: top level - sdext/source/presenter - PresenterPane.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 69 0.0 %
Date: 2014-11-03 Functions: 0 13 0.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             : #include "PresenterPane.hxx"
      21             : #include "PresenterController.hxx"
      22             : #include "PresenterPaintManager.hxx"
      23             : #include <com/sun/star/awt/XWindowPeer.hpp>
      24             : #include <com/sun/star/lang/XMultiComponentFactory.hpp>
      25             : #include <com/sun/star/drawing/CanvasFeature.hpp>
      26             : #include <com/sun/star/rendering/CompositeOperation.hpp>
      27             : #include <osl/mutex.hxx>
      28             : 
      29             : using namespace ::com::sun::star;
      30             : using namespace ::com::sun::star::uno;
      31             : using namespace ::com::sun::star::drawing::framework;
      32             : 
      33             : namespace sdext { namespace presenter {
      34             : 
      35             : //===== PresenterPane =========================================================
      36             : 
      37           0 : PresenterPane::PresenterPane (
      38             :     const Reference<XComponentContext>& rxContext,
      39             :         const ::rtl::Reference<PresenterController>& rpPresenterController)
      40             :     : PresenterPaneBase(rxContext, rpPresenterController),
      41           0 :       maBoundingBox()
      42             : {
      43             :     Reference<lang::XMultiComponentFactory> xFactory (
      44           0 :         mxComponentContext->getServiceManager(), UNO_QUERY_THROW);
      45           0 :     mxPresenterHelper = Reference<drawing::XPresenterHelper>(
      46           0 :         xFactory->createInstanceWithContext(
      47             :             OUString("com.sun.star.comp.Draw.PresenterHelper"),
      48           0 :             mxComponentContext),
      49           0 :         UNO_QUERY_THROW);
      50           0 : }
      51             : 
      52           0 : PresenterPane::~PresenterPane (void)
      53             : {
      54           0 : }
      55             : 
      56             : //----- XPane -----------------------------------------------------------------
      57             : 
      58           0 : Reference<awt::XWindow> SAL_CALL PresenterPane::getWindow (void)
      59             :     throw (RuntimeException, std::exception)
      60             : {
      61           0 :     ThrowIfDisposed();
      62           0 :     return mxContentWindow;
      63             : }
      64             : 
      65           0 : Reference<rendering::XCanvas> SAL_CALL PresenterPane::getCanvas (void)
      66             :     throw (RuntimeException, std::exception)
      67             : {
      68           0 :     ThrowIfDisposed();
      69           0 :     return mxContentCanvas;
      70             : }
      71             : 
      72             : //----- XWindowListener -------------------------------------------------------
      73             : 
      74           0 : void SAL_CALL PresenterPane::windowResized (const awt::WindowEvent& rEvent)
      75             :     throw (RuntimeException, std::exception)
      76             : {
      77             :     (void)rEvent;
      78           0 :     PresenterPaneBase::windowResized(rEvent);
      79             : 
      80           0 :     Invalidate(maBoundingBox);
      81             : 
      82           0 :     LayoutContextWindow();
      83           0 :     ToTop();
      84             : 
      85           0 :     UpdateBoundingBox();
      86           0 :     Invalidate(maBoundingBox);
      87           0 : }
      88             : 
      89           0 : void SAL_CALL PresenterPane::windowMoved (const awt::WindowEvent& rEvent)
      90             :     throw (RuntimeException, std::exception)
      91             : {
      92             :     (void)rEvent;
      93           0 :     PresenterPaneBase::windowMoved(rEvent);
      94             : 
      95           0 :     Invalidate(maBoundingBox);
      96             : 
      97           0 :     ToTop();
      98             : 
      99           0 :     UpdateBoundingBox();
     100           0 :     Invalidate(maBoundingBox);
     101           0 : }
     102             : 
     103           0 : void SAL_CALL PresenterPane::windowShown (const lang::EventObject& rEvent)
     104             :     throw (RuntimeException, std::exception)
     105             : {
     106             :     (void)rEvent;
     107           0 :     PresenterPaneBase::windowShown(rEvent);
     108             : 
     109           0 :     ToTop();
     110             : 
     111           0 :     if (mxContentWindow.is())
     112             :     {
     113           0 :         LayoutContextWindow();
     114           0 :         mxContentWindow->setVisible(sal_True);
     115             :     }
     116             : 
     117           0 :     UpdateBoundingBox();
     118           0 :     Invalidate(maBoundingBox);
     119           0 : }
     120             : 
     121           0 : void SAL_CALL PresenterPane::windowHidden (const lang::EventObject& rEvent)
     122             :     throw (RuntimeException, std::exception)
     123             : {
     124             :     (void)rEvent;
     125           0 :     PresenterPaneBase::windowHidden(rEvent);
     126             : 
     127           0 :     if (mxContentWindow.is())
     128           0 :         mxContentWindow->setVisible(sal_False);
     129           0 : }
     130             : 
     131             : //----- XPaintListener --------------------------------------------------------
     132             : 
     133           0 : void SAL_CALL PresenterPane::windowPaint (const awt::PaintEvent& rEvent)
     134             :     throw (RuntimeException, std::exception)
     135             : {
     136             :     (void)rEvent;
     137           0 :     ThrowIfDisposed();
     138             : 
     139           0 :     PaintBorder(rEvent.UpdateRect);
     140           0 : }
     141             : 
     142             : 
     143             : 
     144           0 : void PresenterPane::CreateCanvases (
     145             :     const Reference<awt::XWindow>& rxParentWindow,
     146             :     const Reference<rendering::XSpriteCanvas>& rxParentCanvas)
     147             : {
     148           0 :     if ( ! mxPresenterHelper.is())
     149           0 :         return;
     150           0 :     if ( ! rxParentWindow.is())
     151           0 :         return;
     152           0 :     if ( ! rxParentCanvas.is())
     153           0 :         return;
     154             : 
     155           0 :     mxBorderCanvas = mxPresenterHelper->createSharedCanvas(
     156             :         rxParentCanvas,
     157             :         rxParentWindow,
     158             :         Reference<rendering::XCanvas>(rxParentCanvas, UNO_QUERY),
     159             :         rxParentWindow,
     160           0 :         mxBorderWindow);
     161           0 :     mxContentCanvas = mxPresenterHelper->createSharedCanvas(
     162             :         rxParentCanvas,
     163             :         rxParentWindow,
     164             :         Reference<rendering::XCanvas>(rxParentCanvas, UNO_QUERY),
     165             :         rxParentWindow,
     166           0 :         mxContentWindow);
     167             : 
     168           0 :     PaintBorder(mxBorderWindow->getPosSize());
     169             : }
     170             : 
     171           0 : void PresenterPane::Invalidate (const css::awt::Rectangle& rRepaintBox)
     172             : {
     173             :     // Invalidate the parent window to be able to invalidate an area outside
     174             :     // the current window area.
     175           0 :     mpPresenterController->GetPaintManager()->Invalidate(mxParentWindow, rRepaintBox);
     176           0 : }
     177             : 
     178           0 : void PresenterPane::UpdateBoundingBox (void)
     179             : {
     180           0 :     if (mxBorderWindow.is() && IsVisible())
     181           0 :         maBoundingBox = mxBorderWindow->getPosSize();
     182             :     else
     183           0 :         maBoundingBox = awt::Rectangle();
     184           0 : }
     185             : 
     186             : } } // end of namespace ::sd::presenter
     187             : 
     188             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10