LCOV - code coverage report
Current view: top level - libreoffice/canvas/source/null - null_spritecanvas.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 39 0.0 %
Date: 2012-12-27 Functions: 0 11 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             : 
      21             : #include <canvas/debug.hxx>
      22             : #include <tools/diagnose_ex.h>
      23             : #include <canvas/verbosetrace.hxx>
      24             : #include <canvas/canvastools.hxx>
      25             : 
      26             : #include <osl/mutex.hxx>
      27             : 
      28             : #include <com/sun/star/registry/XRegistryKey.hpp>
      29             : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
      30             : #include <com/sun/star/uno/XComponentContext.hpp>
      31             : 
      32             : #include <cppuhelper/factory.hxx>
      33             : #include <cppuhelper/implementationentry.hxx>
      34             : #include <comphelper/servicedecl.hxx>
      35             : 
      36             : #include <basegfx/matrix/b2dhommatrix.hxx>
      37             : #include <basegfx/point/b2dpoint.hxx>
      38             : #include <basegfx/tools/canvastools.hxx>
      39             : #include <basegfx/numeric/ftools.hxx>
      40             : 
      41             : #include "null_spritecanvas.hxx"
      42             : 
      43             : 
      44             : using namespace ::com::sun::star;
      45             : 
      46             : #define SERVICE_NAME "com.sun.star.rendering.NullCanvas"
      47             : 
      48             : namespace nullcanvas
      49             : {
      50           0 :     SpriteCanvas::SpriteCanvas( const uno::Sequence< uno::Any >&                aArguments,
      51             :                                 const uno::Reference< uno::XComponentContext >& rxContext ) :
      52             :         maArguments(aArguments),
      53           0 :         mxComponentContext( rxContext )
      54             :     {
      55           0 :     }
      56             : 
      57           0 :     void SpriteCanvas::initialize()
      58             :     {
      59             :         // #i64742# Only call initialize when not in probe mode
      60           0 :         if( maArguments.getLength() == 0 )
      61           0 :             return;
      62             : 
      63             :         VERBOSE_TRACE( "SpriteCanvas::initialize called" );
      64             : 
      65             :         // At index 1, we expect a system window handle here,
      66             :         // containing a pointer to a valid window, on which to output
      67             :         // At index 2, we expect the current window bound rect
      68           0 :         ENSURE_ARG_OR_THROW( maArguments.getLength() >= 4 &&
      69             :                              maArguments[1].getValueTypeClass() == uno::TypeClass_LONG,
      70             :                              "SpriteCanvas::initialize: wrong number of arguments, or wrong types" );
      71             : 
      72           0 :         awt::Rectangle aRect;
      73           0 :         maArguments[2] >>= aRect;
      74             :         const ::basegfx::B2ISize aSize(aRect.Width,
      75           0 :                                        aRect.Height);
      76             : 
      77           0 :         sal_Bool bIsFullscreen( sal_False );
      78           0 :         maArguments[3] >>= bIsFullscreen;
      79             : 
      80             :         // setup helper
      81             :         maDeviceHelper.init( *this,
      82             :                              aSize,
      83           0 :                              bIsFullscreen );
      84             :         maCanvasHelper.init( maRedrawManager,
      85             :                              *this,
      86             :                              aSize,
      87           0 :                              false );
      88             : 
      89           0 :         maArguments.realloc(0);
      90             :     }
      91             : 
      92           0 :     void SpriteCanvas::disposeThis()
      93             :     {
      94           0 :         ::osl::MutexGuard aGuard( m_aMutex );
      95             : 
      96           0 :         mxComponentContext.clear();
      97             : 
      98             :         // forward to parent
      99           0 :         SpriteCanvasBaseT::disposeThis();
     100           0 :     }
     101             : 
     102           0 :     ::sal_Bool SAL_CALL SpriteCanvas::showBuffer( ::sal_Bool bUpdateAll ) throw (uno::RuntimeException)
     103             :     {
     104           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     105             : 
     106             :         // avoid repaints on hidden window (hidden: not mapped to
     107             :         // screen). Return failure, since the screen really has _not_
     108             :         // been updated (caller should try again later)
     109           0 :         return !mbIsVisible ? false : SpriteCanvasBaseT::showBuffer( bUpdateAll );
     110             :     }
     111             : 
     112           0 :     ::sal_Bool SAL_CALL SpriteCanvas::switchBuffer( ::sal_Bool bUpdateAll ) throw (uno::RuntimeException)
     113             :     {
     114           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     115             : 
     116             :         // avoid repaints on hidden window (hidden: not mapped to
     117             :         // screen). Return failure, since the screen really has _not_
     118             :         // been updated (caller should try again later)
     119           0 :         return !mbIsVisible ? false : SpriteCanvasBaseT::switchBuffer( bUpdateAll );
     120             :     }
     121             : 
     122           0 :     sal_Bool SAL_CALL SpriteCanvas::updateScreen( sal_Bool bUpdateAll ) throw (uno::RuntimeException)
     123             :     {
     124           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     125             : 
     126             :         // avoid repaints on hidden window (hidden: not mapped to
     127             :         // screen). Return failure, since the screen really has _not_
     128             :         // been updated (caller should try again later)
     129             :         return !mbIsVisible ? false : maCanvasHelper.updateScreen(
     130           0 :             ::basegfx::unotools::b2IRectangleFromAwtRectangle(maBounds),
     131             :             bUpdateAll,
     132           0 :             mbSurfaceDirty );
     133             :     }
     134             : 
     135           0 :     ::rtl::OUString SAL_CALL SpriteCanvas::getServiceName(  ) throw (uno::RuntimeException)
     136             :     {
     137           0 :         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICE_NAME ) );
     138             :     }
     139             : 
     140           0 :     static uno::Reference<uno::XInterface> initCanvas( SpriteCanvas* pCanvas )
     141             :     {
     142           0 :         uno::Reference<uno::XInterface> xRet(static_cast<cppu::OWeakObject*>(pCanvas));
     143           0 :         pCanvas->initialize();
     144           0 :         return xRet;
     145             :     }
     146             : 
     147             :     namespace sdecl = comphelper::service_decl;
     148           0 :     sdecl::class_<SpriteCanvas, sdecl::with_args<true> > serviceImpl(&initCanvas);
     149           0 :     const sdecl::ServiceDecl nullCanvasDecl(
     150             :         serviceImpl,
     151             :         "com.sun.star.comp.rendering.NullCanvas",
     152             :         SERVICE_NAME );
     153             : }
     154             : 
     155             : // The C shared lib entry points
     156           0 : COMPHELPER_SERVICEDECL_EXPORTS1(nullcanvas, nullcanvas::nullCanvasDecl)
     157             : 
     158             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10