LCOV - code coverage report
Current view: top level - svtools/source/hatchwindow - hatchwindow.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 86 0.0 %
Date: 2014-04-14 Functions: 0 20 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 <com/sun/star/embed/XHatchWindowController.hpp>
      21             : 
      22             : #include "hatchwindow.hxx"
      23             : #include "ipwin.hxx"
      24             : 
      25             : #include <toolkit/helper/convert.hxx>
      26             : #include <osl/mutex.hxx>
      27             : #include <vcl/svapp.hxx>
      28             : 
      29             : using namespace ::com::sun::star;
      30             : 
      31           0 : VCLXHatchWindow::VCLXHatchWindow()
      32             : : VCLXWindow()
      33           0 : , pHatchWindow(0)
      34             : {
      35           0 : }
      36             : 
      37           0 : VCLXHatchWindow::~VCLXHatchWindow()
      38             : {
      39           0 : }
      40             : 
      41           0 : void VCLXHatchWindow::initializeWindow( const uno::Reference< awt::XWindowPeer >& xParent,
      42             :                 const awt::Rectangle& aBounds,
      43             :                 const awt::Size& aSize )
      44             : {
      45           0 :     SolarMutexGuard aGuard;
      46             : 
      47           0 :     Window* pParent = NULL;
      48           0 :     VCLXWindow* pParentComponent = VCLXWindow::GetImplementation( xParent );
      49             : 
      50           0 :     if ( pParentComponent )
      51           0 :         pParent = pParentComponent->GetWindow();
      52             : 
      53             :     OSL_ENSURE( pParent, "No parent window is provided!\n" );
      54           0 :     if ( !pParent )
      55           0 :         throw lang::IllegalArgumentException(); // TODO
      56             : 
      57           0 :     pHatchWindow = new SvResizeWindow( pParent, this );
      58           0 :     pHatchWindow->setPosSizePixel( aBounds.X, aBounds.Y, aBounds.Width, aBounds.Height );
      59           0 :     aHatchBorderSize = aSize;
      60           0 :     pHatchWindow->SetHatchBorderPixel( Size( aSize.Width, aSize.Height ) );
      61             : 
      62           0 :     SetWindow( pHatchWindow );
      63           0 :     pHatchWindow->SetComponentInterface( this );
      64             : 
      65             :     //pHatchWindow->Show();
      66           0 : }
      67             : 
      68           0 : void VCLXHatchWindow::QueryObjAreaPixel( Rectangle & aRect )
      69             : {
      70           0 :     if ( m_xController.is() )
      71             :     {
      72           0 :         awt::Rectangle aUnoRequestRect = AWTRectangle( aRect );
      73             : 
      74             :         try {
      75           0 :             awt::Rectangle aUnoResultRect = m_xController->calcAdjustedRectangle( aUnoRequestRect );
      76           0 :             aRect = VCLRectangle( aUnoResultRect );
      77             :         }
      78           0 :         catch( uno::Exception& )
      79             :         {
      80             :             OSL_FAIL( "Can't adjust rectangle size!\n" );
      81             :         }
      82             :     }
      83           0 : }
      84             : 
      85           0 : void VCLXHatchWindow::RequestObjAreaPixel( const Rectangle & aRect )
      86             : {
      87           0 :     if ( m_xController.is() )
      88             :     {
      89           0 :         awt::Rectangle aUnoRequestRect = AWTRectangle( aRect );
      90             : 
      91             :         try {
      92           0 :             m_xController->requestPositioning( aUnoRequestRect );
      93             :         }
      94           0 :         catch( uno::Exception& )
      95             :         {
      96             :             OSL_FAIL( "Can't request resizing!\n" );
      97             :         }
      98             :     }
      99           0 : }
     100             : 
     101           0 : void VCLXHatchWindow::InplaceDeactivate()
     102             : {
     103           0 :     if ( m_xController.is() )
     104             :     {
     105             :         // TODO: communicate with controller
     106             :     }
     107           0 : }
     108             : 
     109             : 
     110           0 : uno::Any SAL_CALL VCLXHatchWindow::queryInterface( const uno::Type & rType )
     111             :     throw( uno::RuntimeException, std::exception )
     112             : {
     113             :     // Attention:
     114             :     //    Don't use mutex or guard in this method!!! Is a method of XInterface.
     115             : 
     116             :     uno::Any aReturn( ::cppu::queryInterface( rType,
     117           0 :                                            static_cast< embed::XHatchWindow* >( this ) ) );
     118             : 
     119           0 :     if ( aReturn.hasValue() )
     120             :     {
     121           0 :         return aReturn ;
     122             :     }
     123             : 
     124           0 :     return VCLXWindow::queryInterface( rType ) ;
     125             : }
     126             : 
     127           0 : void SAL_CALL VCLXHatchWindow::acquire()
     128             :     throw()
     129             : {
     130           0 :     VCLXWindow::acquire();
     131           0 : }
     132             : 
     133           0 : void SAL_CALL VCLXHatchWindow::release()
     134             :     throw()
     135             : {
     136           0 :     VCLXWindow::release();
     137           0 : }
     138             : 
     139           0 : uno::Sequence< uno::Type > SAL_CALL VCLXHatchWindow::getTypes()
     140             :     throw( uno::RuntimeException, std::exception )
     141             : {
     142             :     static ::cppu::OTypeCollection* pTypeCollection = NULL ;
     143             : 
     144           0 :     if ( pTypeCollection == NULL )
     145             :     {
     146           0 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ) ;
     147             : 
     148           0 :         if ( pTypeCollection == NULL )
     149             :         {
     150             :             static ::cppu::OTypeCollection aTypeCollection(
     151           0 :                     ::getCppuType(( const uno::Reference< embed::XHatchWindow >* )NULL ),
     152           0 :                     VCLXHatchWindow::getTypes() );
     153             : 
     154           0 :             pTypeCollection = &aTypeCollection ;
     155           0 :         }
     156             :     }
     157             : 
     158           0 :     return pTypeCollection->getTypes() ;
     159             : }
     160             : 
     161           0 : uno::Sequence< sal_Int8 > SAL_CALL VCLXHatchWindow::getImplementationId()
     162             :     throw( uno::RuntimeException, std::exception )
     163             : {
     164           0 :     return css::uno::Sequence<sal_Int8>();
     165             : }
     166             : 
     167           0 : ::com::sun::star::awt::Size SAL_CALL VCLXHatchWindow::getHatchBorderSize() throw (::com::sun::star::uno::RuntimeException, std::exception)
     168             : {
     169           0 :     return aHatchBorderSize;
     170             : }
     171             : 
     172           0 : void SAL_CALL VCLXHatchWindow::setHatchBorderSize( const ::com::sun::star::awt::Size& _hatchbordersize ) throw (::com::sun::star::uno::RuntimeException, std::exception)
     173             : {
     174           0 :     if ( pHatchWindow )
     175             :     {
     176           0 :         aHatchBorderSize = _hatchbordersize;
     177           0 :         pHatchWindow->SetHatchBorderPixel( Size( aHatchBorderSize.Width, aHatchBorderSize.Height ) );
     178             :     }
     179           0 : }
     180             : 
     181           0 : void SAL_CALL VCLXHatchWindow::setController( const uno::Reference< embed::XHatchWindowController >& xController )
     182             :     throw (uno::RuntimeException, std::exception)
     183             : {
     184           0 :     m_xController = xController;
     185           0 : }
     186             : 
     187           0 : void SAL_CALL VCLXHatchWindow::dispose()
     188             :     throw (uno::RuntimeException, std::exception)
     189             : {
     190           0 :     pHatchWindow = 0;
     191           0 :     VCLXWindow::dispose();
     192           0 : }
     193             : 
     194           0 : void SAL_CALL VCLXHatchWindow::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
     195             :     throw (uno::RuntimeException, std::exception)
     196             : {
     197           0 :     VCLXWindow::addEventListener( xListener );
     198           0 : }
     199             : 
     200           0 : void SAL_CALL VCLXHatchWindow::removeEventListener( const uno::Reference< lang::XEventListener >& xListener )
     201             :     throw (uno::RuntimeException, std::exception)
     202             : {
     203           0 :     VCLXWindow::removeEventListener( xListener );
     204           0 : }
     205             : 
     206           0 : void VCLXHatchWindow::Activated()
     207             : {
     208           0 :     if ( m_xController.is() )
     209           0 :         m_xController->activated();
     210           0 : }
     211             : 
     212           0 : void VCLXHatchWindow::Deactivated()
     213             : {
     214           0 :     if ( m_xController.is() )
     215           0 :         m_xController->deactivated();
     216           0 : }
     217             : 
     218             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10