LCOV - code coverage report
Current view: top level - toolkit/source/awt - vclxregion.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 7 67 10.4 %
Date: 2015-06-13 12:38:46 Functions: 4 21 19.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 <toolkit/awt/vclxregion.hxx>
      21             : #include <toolkit/helper/macros.hxx>
      22             : #include <toolkit/helper/vclunohelper.hxx>
      23             : #include <toolkit/helper/convert.hxx>
      24             : #include <cppuhelper/typeprovider.hxx>
      25             : #include <cppuhelper/queryinterface.hxx>
      26             : #include <rtl/uuid.h>
      27             : #include <vcl/svapp.hxx>
      28             : 
      29             : 
      30             : //  class VCLXRegion
      31             : 
      32           1 : VCLXRegion::VCLXRegion()
      33             : {
      34           1 : }
      35             : 
      36           2 : VCLXRegion::~VCLXRegion()
      37             : {
      38           2 : }
      39             : 
      40             : // ::com::sun::star::uno::XInterface
      41           1 : ::com::sun::star::uno::Any VCLXRegion::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException, std::exception)
      42             : {
      43             :     ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
      44             :                                         (static_cast< ::com::sun::star::awt::XRegion* >(this)),
      45             :                                         (static_cast< ::com::sun::star::lang::XUnoTunnel* >(this)),
      46           1 :                                         (static_cast< ::com::sun::star::lang::XTypeProvider* >(this)) );
      47           1 :     return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
      48             : }
      49             : 
      50             : // ::com::sun::star::lang::XUnoTunnel
      51           0 : IMPL_XUNOTUNNEL( VCLXRegion )
      52             : 
      53             : // ::com::sun::star::lang::XTypeProvider
      54           0 : IMPL_XTYPEPROVIDER_START( VCLXRegion )
      55           0 :     cppu::UnoType<com::sun::star::awt::XRegion>::get()
      56           0 : IMPL_XTYPEPROVIDER_END
      57             : 
      58             : 
      59             : 
      60           0 : ::com::sun::star::awt::Rectangle VCLXRegion::getBounds() throw(::com::sun::star::uno::RuntimeException, std::exception)
      61             : {
      62           0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
      63             : 
      64           0 :     return AWTRectangle( maRegion.GetBoundRect() );
      65             : }
      66             : 
      67           0 : void VCLXRegion::clear() throw(::com::sun::star::uno::RuntimeException, std::exception)
      68             : {
      69           0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
      70             : 
      71           0 :     maRegion.SetEmpty();
      72           0 : }
      73             : 
      74           0 : void VCLXRegion::move( sal_Int32 nHorzMove, sal_Int32 nVertMove ) throw(::com::sun::star::uno::RuntimeException, std::exception)
      75             : {
      76           0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
      77             : 
      78           0 :     maRegion.Move( nHorzMove, nVertMove );
      79           0 : }
      80             : 
      81           0 : void VCLXRegion::unionRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException, std::exception)
      82             : {
      83           0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
      84             : 
      85           0 :     maRegion.Union( VCLRectangle( rRect ) );
      86           0 : }
      87             : 
      88           0 : void VCLXRegion::intersectRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException, std::exception)
      89             : {
      90           0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
      91             : 
      92           0 :     maRegion.Intersect( VCLRectangle( rRect ) );
      93           0 : }
      94             : 
      95           0 : void VCLXRegion::excludeRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException, std::exception)
      96             : {
      97           0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
      98             : 
      99           0 :     maRegion.Exclude( VCLRectangle( rRect ) );
     100           0 : }
     101             : 
     102           0 : void VCLXRegion::xOrRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException, std::exception)
     103             : {
     104           0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     105             : 
     106           0 :     maRegion.XOr( VCLRectangle( rRect ) );
     107           0 : }
     108             : 
     109           0 : void VCLXRegion::unionRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException, std::exception)
     110             : {
     111           0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     112             : 
     113           0 :     if ( rxRegion.is() )
     114           0 :         maRegion.Union( VCLUnoHelper::GetRegion( rxRegion ) );
     115           0 : }
     116             : 
     117           0 : void VCLXRegion::intersectRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException, std::exception)
     118             : {
     119           0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     120             : 
     121           0 :     if ( rxRegion.is() )
     122           0 :         maRegion.Intersect( VCLUnoHelper::GetRegion( rxRegion ) );
     123           0 : }
     124             : 
     125           0 : void VCLXRegion::excludeRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException, std::exception)
     126             : {
     127           0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     128             : 
     129           0 :     if ( rxRegion.is() )
     130           0 :         maRegion.Exclude( VCLUnoHelper::GetRegion( rxRegion ) );
     131           0 : }
     132             : 
     133           0 : void VCLXRegion::xOrRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException, std::exception)
     134             : {
     135           0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     136             : 
     137           0 :     if ( rxRegion.is() )
     138           0 :         maRegion.XOr( VCLUnoHelper::GetRegion( rxRegion ) );
     139           0 : }
     140             : 
     141           0 : ::com::sun::star::uno::Sequence< ::com::sun::star::awt::Rectangle > VCLXRegion::getRectangles() throw(::com::sun::star::uno::RuntimeException, std::exception)
     142             : {
     143           0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     144             : 
     145           0 :     RectangleVector aRectangles;
     146           0 :     maRegion.GetRegionRectangles(aRectangles);
     147             : 
     148             : //    sal_uLong nRects = maRegion.GetRectCount();
     149           0 :     ::com::sun::star::uno::Sequence< ::com::sun::star::awt::Rectangle > aRects(aRectangles.size());
     150           0 :     sal_uInt32 a(0);
     151             : 
     152           0 :     for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); ++aRectIter)
     153             :     {
     154           0 :         aRects.getArray()[a++] = AWTRectangle(*aRectIter);
     155             :     }
     156             : 
     157             :     //Rectangle aRect;
     158             :     //sal_uInt32 nR = 0;
     159             :     //RegionHandle h = maRegion.BeginEnumRects();
     160             :     //while ( maRegion.GetEnumRects( h, aRect ) )
     161             :     //  aRects.getArray()[nR++] = AWTRectangle( aRect );
     162             :     //maRegion.EndEnumRects( h );
     163             : 
     164           0 :     return aRects;
     165             : }
     166             : 
     167             : 
     168             : 
     169             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11