LCOV - code coverage report
Current view: top level - toolkit/source/helper - vclunohelper.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 151 365 41.4 %
Date: 2012-08-25 Functions: 20 35 57.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 134 414 32.4 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <tools/stream.hxx>
      31                 :            : #include <vcl/bitmap.hxx>
      32                 :            : #include <vcl/window.hxx>
      33                 :            : #include <sal/macros.h>
      34                 :            : #include <com/sun/star/util/MeasureUnit.hpp>
      35                 :            : #include <com/sun/star/awt/XBitmap.hpp>
      36                 :            : #include <com/sun/star/awt/XWindow.hpp>
      37                 :            : #include <com/sun/star/awt/XDevice.hpp>
      38                 :            : #include <com/sun/star/awt/XPointer.hpp>
      39                 :            : #include <com/sun/star/awt/SimpleFontMetric.hpp>
      40                 :            : #include <com/sun/star/awt/FontDescriptor.hpp>
      41                 :            : #include <com/sun/star/awt/XControlContainer.hpp>
      42                 :            : #include <com/sun/star/awt/FontWeight.hpp>
      43                 :            : #include <com/sun/star/awt/FontWidth.hpp>
      44                 :            : #include <com/sun/star/awt/KeyModifier.hpp>
      45                 :            : #include <com/sun/star/awt/MouseButton.hpp>
      46                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      47                 :            : #include <com/sun/star/embed/EmbedMapUnits.hpp>
      48                 :            : 
      49                 :            : #include <com/sun/star/graphic/XGraphic.hpp>
      50                 :            : 
      51                 :            : #include <toolkit/helper/vclunohelper.hxx>
      52                 :            : #include <toolkit/helper/convert.hxx>
      53                 :            : #include <toolkit/awt/vclxbitmap.hxx>
      54                 :            : #include <toolkit/awt/vclxregion.hxx>
      55                 :            : #include <toolkit/awt/vclxwindow.hxx>
      56                 :            : #include <toolkit/awt/vclxgraphics.hxx>
      57                 :            : #include <toolkit/awt/vclxpointer.hxx>
      58                 :            : #include <toolkit/awt/vclxfont.hxx>
      59                 :            : #include <toolkit/controls/unocontrolcontainer.hxx>
      60                 :            : #include <toolkit/controls/unocontrolcontainermodel.hxx>
      61                 :            : 
      62                 :            : #include <vcl/graph.hxx>
      63                 :            : #include <comphelper/processfactory.hxx>
      64                 :            : 
      65                 :            : #include <com/sun/star/awt/Size.hpp>
      66                 :            : #include <com/sun/star/awt/Point.hpp>
      67                 :            : 
      68                 :            : using namespace ::com::sun::star;
      69                 :            : 
      70                 :            : //  ----------------------------------------------------
      71                 :            : //  class VCLUnoHelper
      72                 :            : //  ----------------------------------------------------
      73                 :            : 
      74                 :         27 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> VCLUnoHelper::CreateToolkit()
      75                 :            : {
      76         [ +  - ]:         27 :     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
      77 [ +  - ][ +  - ]:         27 :     ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface > xI = xMSF->createInstance( ::rtl::OUString::createFromAscii( szServiceName2_Toolkit ) );
      78                 :            : 
      79                 :         27 :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> xToolkit;
      80         [ +  - ]:         27 :     if ( xI.is() )
      81 [ +  - ][ +  - ]:         27 :         xToolkit = ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit>( xI, ::com::sun::star::uno::UNO_QUERY );
      82                 :            : 
      83                 :         27 :     return xToolkit;
      84                 :            : }
      85                 :            : 
      86                 :        150 : BitmapEx VCLUnoHelper::GetBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap>& rxBitmap )
      87                 :            : {
      88         [ +  - ]:        150 :     BitmapEx aBmp;
      89                 :            : 
      90         [ +  - ]:        150 :     ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > xGraphic( rxBitmap, ::com::sun::star::uno::UNO_QUERY );
      91         [ +  - ]:        150 :     if( xGraphic.is() )
      92                 :            :     {
      93         [ +  - ]:        150 :         Graphic aGraphic( xGraphic );
      94 [ +  - ][ +  - ]:        150 :         aBmp = aGraphic.GetBitmapEx();
         [ +  - ][ +  - ]
      95                 :            :     }
      96         [ #  # ]:          0 :     else if ( rxBitmap.is() )
      97                 :            :     {
      98                 :          0 :         VCLXBitmap* pVCLBitmap = VCLXBitmap::GetImplementation( rxBitmap );
      99         [ #  # ]:          0 :         if ( pVCLBitmap )
     100         [ #  # ]:          0 :             aBmp = pVCLBitmap->GetBitmap();
     101                 :            :         else
     102                 :            :         {
     103 [ #  # ][ #  # ]:          0 :             Bitmap aDIB, aMask;
     104                 :            :             {
     105 [ #  # ][ #  # ]:          0 :                 ::com::sun::star::uno::Sequence<sal_Int8> aBytes = rxBitmap->getDIB();
     106 [ #  # ][ #  # ]:          0 :                 SvMemoryStream aMem( (char*) aBytes.getArray(), aBytes.getLength(), STREAM_READ );
     107 [ #  # ][ #  # ]:          0 :                 aMem >> aDIB;
                 [ #  # ]
     108                 :            :             }
     109                 :            :             {
     110 [ #  # ][ #  # ]:          0 :                 ::com::sun::star::uno::Sequence<sal_Int8> aBytes = rxBitmap->getMaskDIB();
     111 [ #  # ][ #  # ]:          0 :                 SvMemoryStream aMem( (char*) aBytes.getArray(), aBytes.getLength(), STREAM_READ );
     112 [ #  # ][ #  # ]:          0 :                 aMem >> aMask;
                 [ #  # ]
     113                 :            :             }
     114 [ #  # ][ #  # ]:          0 :             aBmp = BitmapEx( aDIB, aMask );
         [ #  # ][ #  # ]
                 [ #  # ]
     115                 :            :         }
     116                 :            :     }
     117                 :        150 :     return aBmp;
     118                 :            : }
     119                 :            : 
     120                 :        366 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap> VCLUnoHelper::CreateBitmap( const BitmapEx& rBitmap )
     121                 :            : {
     122         [ +  - ]:        366 :     Graphic aGraphic( rBitmap );
     123 [ +  - ][ +  - ]:        366 :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap> xBmp( aGraphic.GetXGraphic(), ::com::sun::star::uno::UNO_QUERY );
     124         [ +  - ]:        366 :     return xBmp;
     125                 :            : }
     126                 :            : 
     127                 :     309014 : Window* VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& rxWindow )
     128                 :            : {
     129                 :     309014 :     VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( rxWindow );
     130         [ +  + ]:     309014 :     return pVCLXWindow ? pVCLXWindow->GetWindow() : NULL;
     131                 :            : }
     132                 :            : 
     133                 :       7229 : Window* VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2>& rxWindow )
     134                 :            : {
     135                 :       7229 :     VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( rxWindow );
     136         [ +  - ]:       7229 :     return pVCLXWindow ? pVCLXWindow->GetWindow() : NULL;
     137                 :            : }
     138                 :            : 
     139                 :       9628 : Window* VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& rxWindow )
     140                 :            : {
     141                 :       9628 :     VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( rxWindow );
     142         [ +  - ]:       9628 :     return pVCLXWindow ? pVCLXWindow->GetWindow() : NULL;
     143                 :            : }
     144                 :            : 
     145                 :          0 : Region VCLUnoHelper::GetRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion )
     146                 :            : {
     147                 :          0 :     Region aRegion;
     148                 :          0 :     VCLXRegion* pVCLRegion = VCLXRegion::GetImplementation( rxRegion );
     149         [ #  # ]:          0 :     if ( pVCLRegion )
     150         [ #  # ]:          0 :         aRegion = pVCLRegion->GetRegion();
     151                 :            :     else
     152                 :            :     {
     153 [ #  # ][ #  # ]:          0 :         ::com::sun::star::uno::Sequence< ::com::sun::star::awt::Rectangle > aRects = rxRegion->getRectangles();
     154                 :          0 :         sal_Int32 nRects = aRects.getLength();
     155         [ #  # ]:          0 :         for ( sal_Int32 n = 0; n < nRects; n++ )
     156 [ #  # ][ #  # ]:          0 :             aRegion.Union( VCLRectangle( aRects.getArray()[n] ) );
         [ #  # ][ #  # ]
     157                 :            :     }
     158                 :          0 :     return aRegion;
     159                 :            : }
     160                 :            : 
     161                 :     120191 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> VCLUnoHelper::GetInterface( Window* pWindow )
     162                 :            : {
     163                 :     120191 :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xWin;
     164         [ +  + ]:     120191 :     if ( pWindow )
     165                 :            :     {
     166         [ +  - ]:     104657 :         ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xPeer = pWindow->GetComponentInterface();
     167 [ +  - ][ +  - ]:     104657 :         xWin = xWin.query( xPeer );
     168                 :            :     }
     169                 :     120191 :     return xWin;
     170                 :            : }
     171                 :            : 
     172                 :       5149 : OutputDevice* VCLUnoHelper::GetOutputDevice( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice>& rxDevice )
     173                 :            : {
     174                 :       5149 :     OutputDevice* pOutDev = NULL;
     175                 :       5149 :     VCLXDevice* pDev = VCLXDevice::GetImplementation( rxDevice );
     176         [ +  + ]:       5149 :     if ( pDev )
     177                 :       5137 :         pOutDev = pDev->GetOutputDevice();
     178                 :       5149 :     return pOutDev;
     179                 :            : }
     180                 :            : 
     181                 :      29451 : OutputDevice* VCLUnoHelper::GetOutputDevice( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics>& rxGraphics )
     182                 :            : {
     183                 :      29451 :     OutputDevice* pOutDev = NULL;
     184                 :      29451 :     VCLXGraphics* pGrf = VCLXGraphics::GetImplementation( rxGraphics );
     185         [ +  + ]:      29451 :     if ( pGrf )
     186                 :      24530 :         pOutDev = pGrf->GetOutputDevice();
     187                 :      29451 :     return pOutDev;
     188                 :            : }
     189                 :            : 
     190                 :          0 : Polygon VCLUnoHelper::CreatePolygon( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY )
     191                 :            : {
     192                 :          0 :     sal_uInt32 nLen = DataX.getLength();
     193                 :          0 :     const sal_Int32* pDataX = DataX.getConstArray();
     194                 :          0 :     const sal_Int32* pDataY = DataY.getConstArray();
     195                 :          0 :     Polygon aPoly( (sal_uInt16) nLen );
     196         [ #  # ]:          0 :     for ( sal_uInt16 n = 0; n < nLen; n++ )
     197                 :            :     {
     198                 :          0 :         Point aPnt;
     199                 :          0 :         aPnt.X() = pDataX[n];
     200                 :          0 :         aPnt.Y() = pDataY[n];
     201         [ #  # ]:          0 :         aPoly[n] = aPnt;
     202                 :            :     }
     203                 :          0 :     return aPoly;
     204                 :            : }
     205                 :            : 
     206                 :        638 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer> VCLUnoHelper::CreateControlContainer( Window* pWindow )
     207                 :            : {
     208         [ +  - ]:        638 :     const uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
     209 [ +  - ][ +  - ]:        638 :     UnoControlContainer* pContainer = new UnoControlContainer( xFactory, pWindow->GetComponentInterface( sal_True ) );
     210 [ +  - ][ +  - ]:        638 :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > x = pContainer;
     211                 :            : 
     212         [ +  - ]:        638 :     UnoControlModel* pContainerModel = new UnoControlContainerModel( xFactory );
     213 [ +  - ][ +  - ]:        638 :     pContainer->setModel( (::com::sun::star::awt::XControlModel*)pContainerModel );
                 [ +  - ]
     214                 :            : 
     215                 :        638 :     return x;
     216                 :            : }
     217                 :            : 
     218                 :          0 : float VCLUnoHelper::ConvertFontWidth( FontWidth eWidth )
     219                 :            : {
     220         [ #  # ]:          0 :     if( eWidth == WIDTH_DONTKNOW )
     221                 :          0 :         return ::com::sun::star::awt::FontWidth::DONTKNOW;
     222         [ #  # ]:          0 :     else if( eWidth == WIDTH_ULTRA_CONDENSED )
     223                 :          0 :         return ::com::sun::star::awt::FontWidth::ULTRACONDENSED;
     224         [ #  # ]:          0 :     else if( eWidth == WIDTH_EXTRA_CONDENSED )
     225                 :          0 :         return ::com::sun::star::awt::FontWidth::EXTRACONDENSED;
     226         [ #  # ]:          0 :     else if( eWidth == WIDTH_CONDENSED )
     227                 :          0 :         return ::com::sun::star::awt::FontWidth::CONDENSED;
     228         [ #  # ]:          0 :     else if( eWidth == WIDTH_SEMI_CONDENSED )
     229                 :          0 :         return ::com::sun::star::awt::FontWidth::SEMICONDENSED;
     230         [ #  # ]:          0 :     else if( eWidth == WIDTH_NORMAL )
     231                 :          0 :         return ::com::sun::star::awt::FontWidth::NORMAL;
     232         [ #  # ]:          0 :     else if( eWidth == WIDTH_SEMI_EXPANDED )
     233                 :          0 :         return ::com::sun::star::awt::FontWidth::SEMIEXPANDED;
     234         [ #  # ]:          0 :     else if( eWidth == WIDTH_EXPANDED )
     235                 :          0 :         return ::com::sun::star::awt::FontWidth::EXPANDED;
     236         [ #  # ]:          0 :     else if( eWidth == WIDTH_EXTRA_EXPANDED )
     237                 :          0 :         return ::com::sun::star::awt::FontWidth::EXTRAEXPANDED;
     238         [ #  # ]:          0 :     else if( eWidth == WIDTH_ULTRA_EXPANDED )
     239                 :          0 :         return ::com::sun::star::awt::FontWidth::ULTRAEXPANDED;
     240                 :            : 
     241                 :            :     OSL_FAIL( "Unknown FontWidth" );
     242                 :          0 :     return ::com::sun::star::awt::FontWidth::DONTKNOW;
     243                 :            : }
     244                 :            : 
     245                 :       2585 : FontWidth VCLUnoHelper::ConvertFontWidth( float f )
     246                 :            : {
     247         [ +  + ]:       2585 :     if( f <= ::com::sun::star::awt::FontWidth::DONTKNOW )
     248                 :         44 :         return WIDTH_DONTKNOW;
     249         [ +  + ]:       2541 :     else if( f <= ::com::sun::star::awt::FontWidth::ULTRACONDENSED )
     250                 :       1922 :         return WIDTH_ULTRA_CONDENSED;
     251         [ +  + ]:        619 :     else if( f <= ::com::sun::star::awt::FontWidth::EXTRACONDENSED )
     252                 :        185 :         return WIDTH_EXTRA_CONDENSED;
     253         [ +  + ]:        434 :     else if( f <= ::com::sun::star::awt::FontWidth::CONDENSED )
     254                 :         37 :         return WIDTH_CONDENSED;
     255         [ +  + ]:        397 :     else if( f <= ::com::sun::star::awt::FontWidth::SEMICONDENSED )
     256                 :        160 :         return WIDTH_SEMI_CONDENSED;
     257         [ +  - ]:        237 :     else if( f <= ::com::sun::star::awt::FontWidth::NORMAL )
     258                 :        237 :         return WIDTH_NORMAL;
     259         [ #  # ]:          0 :     else if( f <= ::com::sun::star::awt::FontWidth::SEMIEXPANDED )
     260                 :          0 :         return WIDTH_SEMI_EXPANDED;
     261         [ #  # ]:          0 :     else if( f <= ::com::sun::star::awt::FontWidth::EXPANDED )
     262                 :          0 :         return WIDTH_EXPANDED;
     263         [ #  # ]:          0 :     else if( f <= ::com::sun::star::awt::FontWidth::EXTRAEXPANDED )
     264                 :          0 :         return WIDTH_EXTRA_EXPANDED;
     265         [ #  # ]:          0 :     else if( f <= ::com::sun::star::awt::FontWidth::ULTRAEXPANDED )
     266                 :          0 :         return WIDTH_ULTRA_EXPANDED;
     267                 :            : 
     268                 :            :     OSL_FAIL( "Unknown FontWidth" );
     269                 :       2585 :     return WIDTH_DONTKNOW;
     270                 :            : }
     271                 :            : 
     272                 :       1543 : float VCLUnoHelper::ConvertFontWeight( FontWeight eWeight )
     273                 :            : {
     274         [ -  + ]:       1543 :     if( eWeight == WEIGHT_DONTKNOW )
     275                 :          0 :         return ::com::sun::star::awt::FontWeight::DONTKNOW;
     276         [ +  + ]:       1543 :     else if( eWeight == WEIGHT_THIN )
     277                 :          8 :         return ::com::sun::star::awt::FontWeight::THIN;
     278         [ -  + ]:       1535 :     else if( eWeight == WEIGHT_ULTRALIGHT )
     279                 :          0 :         return ::com::sun::star::awt::FontWeight::ULTRALIGHT;
     280         [ +  + ]:       1535 :     else if( eWeight == WEIGHT_LIGHT )
     281                 :          4 :         return ::com::sun::star::awt::FontWeight::LIGHT;
     282         [ -  + ]:       1531 :     else if( eWeight == WEIGHT_SEMILIGHT )
     283                 :          0 :         return ::com::sun::star::awt::FontWeight::SEMILIGHT;
     284 [ +  + ][ -  + ]:       1531 :     else if( ( eWeight == WEIGHT_NORMAL ) || ( eWeight == WEIGHT_MEDIUM ) )
     285                 :       1153 :         return ::com::sun::star::awt::FontWeight::NORMAL;
     286         [ -  + ]:        378 :     else if( eWeight == WEIGHT_SEMIBOLD )
     287                 :          0 :         return ::com::sun::star::awt::FontWeight::SEMIBOLD;
     288         [ +  + ]:        378 :     else if( eWeight == WEIGHT_BOLD )
     289                 :        302 :         return ::com::sun::star::awt::FontWeight::BOLD;
     290         [ +  + ]:         76 :     else if( eWeight == WEIGHT_ULTRABOLD )
     291                 :         54 :         return ::com::sun::star::awt::FontWeight::ULTRABOLD;
     292         [ +  - ]:         22 :     else if( eWeight == WEIGHT_BLACK )
     293                 :         22 :         return ::com::sun::star::awt::FontWeight::BLACK;
     294                 :            : 
     295                 :            :     OSL_FAIL( "Unknown FontWeigth" );
     296                 :       1543 :     return ::com::sun::star::awt::FontWeight::DONTKNOW;
     297                 :            : }
     298                 :            : 
     299                 :      72820 : FontWeight VCLUnoHelper::ConvertFontWeight( float f )
     300                 :            : {
     301         [ +  + ]:      72820 :     if( f <= ::com::sun::star::awt::FontWeight::DONTKNOW )
     302                 :        444 :         return WEIGHT_DONTKNOW;
     303         [ +  + ]:      72376 :     else if( f <= ::com::sun::star::awt::FontWeight::THIN )
     304                 :       2064 :         return WEIGHT_THIN;
     305         [ +  + ]:      70312 :     else if( f <= ::com::sun::star::awt::FontWeight::ULTRALIGHT )
     306                 :         59 :         return WEIGHT_ULTRALIGHT;
     307         [ +  + ]:      70253 :     else if( f <= ::com::sun::star::awt::FontWeight::LIGHT )
     308                 :        133 :         return WEIGHT_LIGHT;
     309         [ +  + ]:      70120 :     else if( f <= ::com::sun::star::awt::FontWeight::SEMILIGHT )
     310                 :         36 :         return WEIGHT_SEMILIGHT;
     311         [ +  + ]:      70084 :     else if( f <= ::com::sun::star::awt::FontWeight::NORMAL )
     312                 :      67470 :         return WEIGHT_NORMAL;
     313         [ -  + ]:       2614 :     else if( f <= ::com::sun::star::awt::FontWeight::SEMIBOLD )
     314                 :          0 :         return WEIGHT_SEMIBOLD;
     315         [ +  + ]:       2614 :     else if( f <= ::com::sun::star::awt::FontWeight::BOLD )
     316                 :       1859 :         return WEIGHT_BOLD;
     317         [ +  + ]:        755 :     else if( f <= ::com::sun::star::awt::FontWeight::ULTRABOLD )
     318                 :        511 :         return WEIGHT_ULTRABOLD;
     319         [ +  + ]:        244 :     else if( f <= ::com::sun::star::awt::FontWeight::BLACK )
     320                 :        102 :         return WEIGHT_BLACK;
     321                 :            : 
     322                 :            :     OSL_FAIL( "Unknown FontWeigth" );
     323                 :      72820 :     return WEIGHT_DONTKNOW;
     324                 :            : }
     325                 :            : 
     326                 :            : 
     327                 :          0 : ::com::sun::star::awt::FontDescriptor VCLUnoHelper::CreateFontDescriptor( const Font& rFont )
     328                 :            : {
     329                 :          0 :     ::com::sun::star::awt::FontDescriptor aFD;
     330 [ #  # ][ #  # ]:          0 :     aFD.Name = rFont.GetName();
     331 [ #  # ][ #  # ]:          0 :     aFD.StyleName = rFont.GetStyleName();
     332         [ #  # ]:          0 :     aFD.Height = (sal_Int16)rFont.GetSize().Height();
     333         [ #  # ]:          0 :     aFD.Width = (sal_Int16)rFont.GetSize().Width();
     334         [ #  # ]:          0 :     aFD.Family = sal::static_int_cast< sal_Int16 >(rFont.GetFamily());
     335         [ #  # ]:          0 :     aFD.CharSet = rFont.GetCharSet();
     336         [ #  # ]:          0 :     aFD.Pitch = sal::static_int_cast< sal_Int16 >(rFont.GetPitch());
     337 [ #  # ][ #  # ]:          0 :     aFD.CharacterWidth = VCLUnoHelper::ConvertFontWidth( rFont.GetWidthType() );
     338 [ #  # ][ #  # ]:          0 :     aFD.Weight= VCLUnoHelper::ConvertFontWeight( rFont.GetWeight() );
     339         [ #  # ]:          0 :     aFD.Slant = (::com::sun::star::awt::FontSlant)rFont.GetItalic();
     340         [ #  # ]:          0 :     aFD.Underline = sal::static_int_cast< sal_Int16 >(rFont.GetUnderline());
     341         [ #  # ]:          0 :     aFD.Strikeout = sal::static_int_cast< sal_Int16 >(rFont.GetStrikeout());
     342         [ #  # ]:          0 :     aFD.Orientation = rFont.GetOrientation();
     343         [ #  # ]:          0 :     aFD.Kerning = rFont.IsKerning();
     344         [ #  # ]:          0 :     aFD.WordLineMode = rFont.IsWordLineMode();
     345                 :          0 :     aFD.Type = 0;   // ??? => Nur an Metric...
     346                 :          0 :     return aFD;
     347                 :            : }
     348                 :            : 
     349                 :       2912 : Font VCLUnoHelper::CreateFont( const ::com::sun::star::awt::FontDescriptor& rDescr, const Font& rInitFont )
     350                 :            : {
     351                 :       2912 :     Font aFont( rInitFont );
     352         [ +  + ]:       2912 :     if ( !rDescr.Name.isEmpty() )
     353         [ +  - ]:       2475 :         aFont.SetName( rDescr.Name );
     354         [ +  + ]:       2912 :     if ( !rDescr.StyleName.isEmpty() )
     355 [ +  - ][ +  - ]:       2230 :         aFont.SetStyleName( rDescr.StyleName );
                 [ +  - ]
     356         [ +  + ]:       2912 :     if ( rDescr.Height )
     357         [ +  - ]:       2475 :         aFont.SetSize( Size( rDescr.Width, rDescr.Height ) );
     358         [ +  + ]:       2912 :     if ( (FontFamily)rDescr.Family != FAMILY_DONTKNOW )
     359         [ +  - ]:       2419 :         aFont.SetFamily( (FontFamily)rDescr.Family );
     360         [ +  + ]:       2912 :     if ( (CharSet)rDescr.CharSet != RTL_TEXTENCODING_DONTKNOW )
     361         [ +  - ]:       2248 :         aFont.SetCharSet( (CharSet)rDescr.CharSet );
     362         [ +  + ]:       2912 :     if ( (FontPitch)rDescr.Pitch != PITCH_DONTKNOW )
     363         [ +  - ]:       2236 :         aFont.SetPitch( (FontPitch)rDescr.Pitch );
     364         [ +  + ]:       2912 :     if ( rDescr.CharacterWidth )
     365 [ +  - ][ +  - ]:       2487 :         aFont.SetWidthType( VCLUnoHelper::ConvertFontWidth( rDescr.CharacterWidth ) );
     366         [ +  + ]:       2912 :     if ( rDescr.Weight )
     367 [ +  - ][ +  - ]:       2475 :         aFont.SetWeight( VCLUnoHelper::ConvertFontWeight( rDescr.Weight ) );
     368         [ +  + ]:       2912 :     if ( (FontItalic)rDescr.Slant != ITALIC_DONTKNOW )
     369         [ +  - ]:       2596 :         aFont.SetItalic( (FontItalic)rDescr.Slant );
     370         [ +  + ]:       2912 :     if ( (FontUnderline)rDescr.Underline != UNDERLINE_DONTKNOW )
     371         [ +  - ]:       2596 :         aFont.SetUnderline( (FontUnderline)rDescr.Underline );
     372         [ +  + ]:       2912 :     if ( (FontStrikeout)rDescr.Strikeout != STRIKEOUT_DONTKNOW )
     373         [ +  - ]:       2596 :         aFont.SetStrikeout( (FontStrikeout)rDescr.Strikeout );
     374                 :            : 
     375                 :            :     // Kein DONTKNOW
     376         [ +  - ]:       2912 :     aFont.SetOrientation( (short)rDescr.Orientation );
     377         [ +  - ]:       2912 :     aFont.SetKerning( rDescr.Kerning );
     378         [ +  - ]:       2912 :     aFont.SetWordLineMode( rDescr.WordLineMode );
     379                 :            : 
     380                 :       2912 :     return aFont;
     381                 :            : }
     382                 :            : 
     383                 :          0 : Font VCLUnoHelper::CreateFont( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont >& rxFont )
     384                 :            : {
     385                 :          0 :     Font aFont;
     386                 :          0 :     VCLXFont* pVCLXFont = VCLXFont::GetImplementation( rxFont );
     387         [ #  # ]:          0 :     if ( pVCLXFont )
     388         [ #  # ]:          0 :         aFont = pVCLXFont->GetFont();
     389                 :          0 :     return aFont;
     390                 :            : }
     391                 :            : 
     392                 :            : 
     393                 :          0 : ::com::sun::star::awt::SimpleFontMetric VCLUnoHelper::CreateFontMetric( const FontMetric& rFontMetric )
     394                 :            : {
     395                 :          0 :     ::com::sun::star::awt::SimpleFontMetric aFM;
     396                 :          0 :     aFM.Ascent = (sal_Int16)rFontMetric.GetAscent();
     397                 :          0 :     aFM.Descent = (sal_Int16)rFontMetric.GetDescent();
     398                 :          0 :     aFM.Leading = (sal_Int16)rFontMetric.GetIntLeading();
     399                 :          0 :     aFM.Slant = (sal_Int16)rFontMetric.GetSlant();
     400                 :          0 :     aFM.FirstChar = 0x0020;
     401                 :          0 :     aFM.LastChar = 0xFFFD;
     402                 :          0 :     return aFM;
     403                 :            : }
     404                 :            : 
     405                 :      16392 : sal_Bool VCLUnoHelper::IsZero( ::com::sun::star::awt::Rectangle rRect )
     406                 :            : {
     407 [ +  + ][ +  - ]:      16392 :     return ( !rRect.X && !rRect.Y && !rRect.Width && !rRect.Height );
         [ +  + ][ +  - ]
     408                 :            : }
     409                 :            : 
     410                 :        339 : MapUnit VCLUnoHelper::UnoEmbed2VCLMapUnit( sal_Int32 nUnoEmbedMapUnit )
     411                 :            : {
     412   [ +  -  -  -  :        339 :     switch( nUnoEmbedMapUnit )
          -  -  -  -  -  
                -  -  - ]
     413                 :            :     {
     414                 :            :         case ::com::sun::star::embed::EmbedMapUnits::ONE_100TH_MM:
     415                 :        339 :             return MAP_100TH_MM;
     416                 :            :         case ::com::sun::star::embed::EmbedMapUnits::ONE_10TH_MM:
     417                 :          0 :             return MAP_10TH_MM;
     418                 :            :         case ::com::sun::star::embed::EmbedMapUnits::ONE_MM:
     419                 :          0 :             return MAP_MM;
     420                 :            :         case ::com::sun::star::embed::EmbedMapUnits::ONE_CM:
     421                 :          0 :             return MAP_CM;
     422                 :            :         case ::com::sun::star::embed::EmbedMapUnits::ONE_1000TH_INCH:
     423                 :          0 :             return MAP_1000TH_INCH;
     424                 :            :         case ::com::sun::star::embed::EmbedMapUnits::ONE_100TH_INCH:
     425                 :          0 :             return MAP_100TH_INCH;
     426                 :            :         case ::com::sun::star::embed::EmbedMapUnits::ONE_10TH_INCH:
     427                 :          0 :             return MAP_10TH_INCH;
     428                 :            :         case ::com::sun::star::embed::EmbedMapUnits::ONE_INCH:
     429                 :          0 :             return MAP_INCH;
     430                 :            :         case ::com::sun::star::embed::EmbedMapUnits::POINT:
     431                 :          0 :             return MAP_POINT;
     432                 :            :         case ::com::sun::star::embed::EmbedMapUnits::TWIP:
     433                 :          0 :             return MAP_TWIP;
     434                 :            :         case ::com::sun::star::embed::EmbedMapUnits::PIXEL:
     435                 :          0 :             return MAP_PIXEL;
     436                 :            :     }
     437                 :            : 
     438                 :            :     OSL_FAIL( "Unexpected UNO map mode is provided!\n" );
     439                 :        339 :     return MAP_LASTENUMDUMMY;
     440                 :            : }
     441                 :            : 
     442                 :        675 : sal_Int32 VCLUnoHelper::VCL2UnoEmbedMapUnit( MapUnit nVCLMapUnit )
     443                 :            : {
     444   [ +  -  -  -  :        675 :     switch( nVCLMapUnit )
          -  -  -  -  -  
                -  -  - ]
     445                 :            :     {
     446                 :            :         case MAP_100TH_MM:
     447                 :        675 :             return ::com::sun::star::embed::EmbedMapUnits::ONE_100TH_MM;
     448                 :            :         case MAP_10TH_MM:
     449                 :          0 :             return ::com::sun::star::embed::EmbedMapUnits::ONE_10TH_MM;
     450                 :            :         case MAP_MM:
     451                 :          0 :             return ::com::sun::star::embed::EmbedMapUnits::ONE_MM;
     452                 :            :         case MAP_CM:
     453                 :          0 :             return ::com::sun::star::embed::EmbedMapUnits::ONE_CM;
     454                 :            :         case MAP_1000TH_INCH:
     455                 :          0 :             return ::com::sun::star::embed::EmbedMapUnits::ONE_1000TH_INCH;
     456                 :            :         case MAP_100TH_INCH:
     457                 :          0 :             return ::com::sun::star::embed::EmbedMapUnits::ONE_100TH_INCH;
     458                 :            :         case MAP_10TH_INCH:
     459                 :          0 :             return ::com::sun::star::embed::EmbedMapUnits::ONE_10TH_INCH;
     460                 :            :         case MAP_INCH:
     461                 :          0 :             return ::com::sun::star::embed::EmbedMapUnits::ONE_INCH;
     462                 :            :         case MAP_POINT:
     463                 :          0 :             return ::com::sun::star::embed::EmbedMapUnits::POINT;
     464                 :            :         case MAP_TWIP:
     465                 :          0 :             return ::com::sun::star::embed::EmbedMapUnits::TWIP;
     466                 :            :         case MAP_PIXEL:
     467                 :          0 :             return ::com::sun::star::embed::EmbedMapUnits::PIXEL;
     468                 :            :         default: ; // avoid compiler warning
     469                 :            :     }
     470                 :            : 
     471                 :            :     OSL_FAIL( "Unexpected VCL map mode is provided!\n" );
     472                 :        675 :     return -1;
     473                 :            : }
     474                 :            : 
     475                 :            : using namespace ::com::sun::star::util;
     476                 :            : 
     477                 :            : //====================================================================
     478                 :            : //= file-local helpers
     479                 :            : //====================================================================
     480                 :            : namespace
     481                 :            : {
     482                 :            :     enum UnitConversionDirection
     483                 :            :     {
     484                 :            :         FieldUnitToMeasurementUnit,
     485                 :            :         MeasurementUnitToFieldUnit
     486                 :            :     };
     487                 :            : 
     488                 :          0 :     sal_Int16 convertMeasurementUnit( sal_Int16 _nUnit, UnitConversionDirection eDirection, sal_Int16& _rFieldToUNOValueFactor )
     489                 :            :     {
     490                 :            :         static struct _unit_table
     491                 :            :         {
     492                 :            :             FieldUnit eFieldUnit;
     493                 :            :             sal_Int16 nMeasurementUnit;
     494                 :            :             sal_Int16 nFieldToMeasureFactor;
     495                 :            :         } aUnits[] = {
     496                 :            :             { FUNIT_NONE,       -1 , -1},
     497                 :            :             { FUNIT_MM,         MeasureUnit::MM,            1 },    // must precede MM_10TH
     498                 :            :             { FUNIT_MM,         MeasureUnit::MM_10TH,       10 },
     499                 :            :             { FUNIT_100TH_MM,   MeasureUnit::MM_100TH,      1 },
     500                 :            :             { FUNIT_CM,         MeasureUnit::CM,            1 },
     501                 :            :             { FUNIT_M,          MeasureUnit::M,             1 },
     502                 :            :             { FUNIT_KM,         MeasureUnit::KM,            1 },
     503                 :            :             { FUNIT_TWIP,       MeasureUnit::TWIP,          1 },
     504                 :            :             { FUNIT_POINT,      MeasureUnit::POINT,         1 },
     505                 :            :             { FUNIT_PICA,       MeasureUnit::PICA,          1 },
     506                 :            :             { FUNIT_INCH,       MeasureUnit::INCH,          1 },    // must precede INCH_*TH
     507                 :            :             { FUNIT_INCH,       MeasureUnit::INCH_10TH,     10 },
     508                 :            :             { FUNIT_INCH,       MeasureUnit::INCH_100TH,    100 },
     509                 :            :             { FUNIT_INCH,       MeasureUnit::INCH_1000TH,   1000 },
     510                 :            :             { FUNIT_FOOT,       MeasureUnit::FOOT,          1 },
     511                 :            :             { FUNIT_MILE,       MeasureUnit::MILE,          1 },
     512                 :            :         };
     513         [ #  # ]:          0 :         for ( size_t i = 0; i < SAL_N_ELEMENTS( aUnits ); ++i )
     514                 :            :         {
     515         [ #  # ]:          0 :             if ( eDirection == FieldUnitToMeasurementUnit )
     516                 :            :             {
     517 [ #  # ][ #  # ]:          0 :                 if ( ( aUnits[ i ].eFieldUnit == (FieldUnit)_nUnit ) && ( aUnits[ i ].nFieldToMeasureFactor == _rFieldToUNOValueFactor ) )
     518                 :          0 :                     return aUnits[ i ].nMeasurementUnit;
     519                 :            :             }
     520                 :            :             else
     521                 :            :             {
     522         [ #  # ]:          0 :                 if ( aUnits[ i ].nMeasurementUnit == _nUnit )
     523                 :            :                 {
     524                 :          0 :                     _rFieldToUNOValueFactor = aUnits[ i ].nFieldToMeasureFactor;
     525                 :          0 :                     return (sal_Int16)aUnits[ i ].eFieldUnit;
     526                 :            :                 }
     527                 :            :             }
     528                 :            :         }
     529         [ #  # ]:          0 :         if ( eDirection == FieldUnitToMeasurementUnit )
     530                 :          0 :             return -1;
     531                 :            : 
     532                 :          0 :         _rFieldToUNOValueFactor = 1;
     533                 :          0 :         return (sal_Int16)FUNIT_NONE;
     534                 :            :     }
     535                 :            : }
     536                 :            : //========================================================================
     537                 :            : //= MeasurementUnitConversion
     538                 :            : //========================================================================
     539                 :            : //------------------------------------------------------------------------
     540                 :          0 : sal_Int16 VCLUnoHelper::ConvertToMeasurementUnit( FieldUnit _nFieldUnit, sal_Int16 _nUNOToFieldValueFactor )
     541                 :            : {
     542                 :          0 :     return convertMeasurementUnit( (sal_Int16)_nFieldUnit, FieldUnitToMeasurementUnit, _nUNOToFieldValueFactor );
     543                 :            : }
     544                 :            : 
     545                 :            : //------------------------------------------------------------------------
     546                 :          0 : FieldUnit VCLUnoHelper::ConvertToFieldUnit( sal_Int16 _nMeasurementUnit, sal_Int16& _rFieldToUNOValueFactor )
     547                 :            : {
     548                 :          0 :     return (FieldUnit)convertMeasurementUnit( _nMeasurementUnit, MeasurementUnitToFieldUnit, _rFieldToUNOValueFactor );
     549                 :            : }
     550                 :            : 
     551                 :            : 
     552                 :          0 : MapUnit /* MapModeUnit */ VCLUnoHelper::ConvertToMapModeUnit(sal_Int16 /* com.sun.star.util.MeasureUnit.* */ _nMeasureUnit) throw (::com::sun::star::lang::IllegalArgumentException)
     553                 :            : {
     554                 :            :     MapUnit eMode;
     555   [ #  #  #  #  :          0 :     switch(_nMeasureUnit)
          #  #  #  #  #  
             #  #  #  #  
                      # ]
     556                 :            :     {
     557                 :            :     case com::sun::star::util::MeasureUnit::MM_100TH:
     558                 :          0 :         eMode = MAP_100TH_MM;
     559                 :          0 :         break;
     560                 :            : 
     561                 :            : 
     562                 :            :     case com::sun::star::util::MeasureUnit::MM_10TH:
     563                 :          0 :         eMode = MAP_10TH_MM;
     564                 :          0 :         break;
     565                 :            : 
     566                 :            :     case com::sun::star::util::MeasureUnit::MM:
     567                 :          0 :         eMode = MAP_MM;
     568                 :          0 :         break;
     569                 :            : 
     570                 :            :     case com::sun::star::util::MeasureUnit::CM:
     571                 :          0 :         eMode = MAP_CM;
     572                 :          0 :         break;
     573                 :            : 
     574                 :            :     case com::sun::star::util::MeasureUnit::INCH_1000TH:
     575                 :          0 :         eMode = MAP_1000TH_INCH;
     576                 :          0 :         break;
     577                 :            : 
     578                 :            :     case com::sun::star::util::MeasureUnit::INCH_100TH:
     579                 :          0 :         eMode = MAP_100TH_INCH;
     580                 :          0 :         break;
     581                 :            : 
     582                 :            :     case com::sun::star::util::MeasureUnit::INCH_10TH:
     583                 :          0 :         eMode = MAP_10TH_INCH;
     584                 :          0 :         break;
     585                 :            : 
     586                 :            :     case com::sun::star::util::MeasureUnit::INCH:
     587                 :          0 :         eMode = MAP_INCH;
     588                 :          0 :         break;
     589                 :            : 
     590                 :            :     case com::sun::star::util::MeasureUnit::POINT:
     591                 :          0 :         eMode = MAP_POINT;
     592                 :          0 :         break;
     593                 :            : 
     594                 :            :     case com::sun::star::util::MeasureUnit::TWIP:
     595                 :          0 :         eMode = MAP_TWIP;
     596                 :          0 :         break;
     597                 :            : 
     598                 :            :     case com::sun::star::util::MeasureUnit::PIXEL:
     599                 :          0 :         eMode = MAP_PIXEL;
     600                 :          0 :         break;
     601                 :            : 
     602                 :            : /*
     603                 :            :     case com::sun::star::util::MeasureUnit::M:
     604                 :            :         break;
     605                 :            :     case com::sun::star::util::MeasureUnit::KM:
     606                 :            :         break;
     607                 :            :     case com::sun::star::util::MeasureUnit::PICA:
     608                 :            :         break;
     609                 :            :     case com::sun::star::util::MeasureUnit::FOOT:
     610                 :            :         break;
     611                 :            :     case com::sun::star::util::MeasureUnit::MILE:
     612                 :            :         break;
     613                 :            :     case com::sun::star::util::MeasureUnit::PERCENT:
     614                 :            :         break;
     615                 :            : */
     616                 :            :     case com::sun::star::util::MeasureUnit::APPFONT:
     617                 :          0 :         eMode = MAP_APPFONT;
     618                 :          0 :         break;
     619                 :            : 
     620                 :            :     case com::sun::star::util::MeasureUnit::SYSFONT:
     621                 :          0 :         eMode = MAP_SYSFONT;
     622                 :          0 :         break;
     623                 :            : 
     624                 :            : /*
     625                 :            :     case com::sun::star::util::MeasureUnit::RELATIVE:
     626                 :            :         eMode = MAP_RELATIVE;
     627                 :            :         break;
     628                 :            :     case com::sun::star::util::MeasureUnit::REALAPPFONT:
     629                 :            :         eMode = MAP_REALAPPFONT;
     630                 :            :         break;
     631                 :            : */
     632                 :            : 
     633                 :            :     default:
     634 [ #  # ][ #  # ]:          0 :         throw ::com::sun::star::lang::IllegalArgumentException("Unsupported measure unit.", NULL, 1 );
     635                 :            :     }
     636                 :          0 :     return eMode;
     637                 :            : }
     638                 :            : 
     639                 :          2 : ::Size VCLUnoHelper::ConvertToVCLSize(com::sun::star::awt::Size const& _aSize)
     640                 :            : {
     641                 :          2 :     ::Size aVCLSize(_aSize.Width, _aSize.Height);
     642                 :          2 :     return aVCLSize;
     643                 :            : }
     644                 :            : 
     645                 :          2 : com::sun::star::awt::Size VCLUnoHelper::ConvertToAWTSize(::Size /* VCLSize */ const& _aSize)
     646                 :            : {
     647                 :          2 :     com::sun::star::awt::Size aAWTSize(_aSize.Width(), _aSize.Height());
     648                 :          2 :     return aAWTSize;
     649                 :            : }
     650                 :            : 
     651                 :            : 
     652                 :          0 : ::Point VCLUnoHelper::ConvertToVCLPoint(com::sun::star::awt::Point const& _aPoint)
     653                 :            : {
     654                 :          0 :     ::Point aVCLPoint(_aPoint.X, _aPoint.Y);
     655                 :          0 :     return aVCLPoint;
     656                 :            : }
     657                 :            : 
     658                 :          0 : com::sun::star::awt::Point VCLUnoHelper::ConvertToAWTPoint(::Point /* VCLPoint */ const& _aPoint)
     659                 :            : {
     660                 :          0 :     com::sun::star::awt::Point aAWTPoint(_aPoint.X(), _aPoint.Y());
     661                 :          0 :     return aAWTPoint;
     662                 :            : }
     663                 :            : 
     664                 :      19938 : ::Rectangle VCLUnoHelper::ConvertToVCLRect( ::com::sun::star::awt::Rectangle const & _rRect )
     665                 :            : {
     666                 :      19938 :     return ::Rectangle( _rRect.X, _rRect.Y, _rRect.X + _rRect.Width - 1, _rRect.Y + _rRect.Height - 1 );
     667                 :            : }
     668                 :            : 
     669                 :          0 : ::com::sun::star::awt::Rectangle VCLUnoHelper::ConvertToAWTRect( ::Rectangle const & _rRect )
     670                 :            : {
     671         [ #  # ]:          0 :     return ::com::sun::star::awt::Rectangle( _rRect.Left(), _rRect.Top(), _rRect.GetWidth(), _rRect.GetHeight() );
     672                 :            : }
     673                 :            : 
     674                 :          0 : awt::MouseEvent VCLUnoHelper::createMouseEvent( const ::MouseEvent& _rVclEvent, const uno::Reference< uno::XInterface >& _rxContext )
     675                 :            : {
     676                 :          0 :     awt::MouseEvent aMouseEvent;
     677         [ #  # ]:          0 :     aMouseEvent.Source = _rxContext;
     678                 :            : 
     679                 :          0 :     aMouseEvent.Modifiers = 0;
     680         [ #  # ]:          0 :     if ( _rVclEvent.IsShift() )
     681                 :          0 :         aMouseEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::SHIFT;
     682         [ #  # ]:          0 :     if ( _rVclEvent.IsMod1() )
     683                 :          0 :     aMouseEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD1;
     684         [ #  # ]:          0 :     if ( _rVclEvent.IsMod2() )
     685                 :          0 :         aMouseEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD2;
     686                 :            : 
     687                 :          0 :     aMouseEvent.Buttons = 0;
     688         [ #  # ]:          0 :     if ( _rVclEvent.IsLeft() )
     689                 :          0 :         aMouseEvent.Buttons |= ::com::sun::star::awt::MouseButton::LEFT;
     690         [ #  # ]:          0 :     if ( _rVclEvent.IsRight() )
     691                 :          0 :         aMouseEvent.Buttons |= ::com::sun::star::awt::MouseButton::RIGHT;
     692         [ #  # ]:          0 :     if ( _rVclEvent.IsMiddle() )
     693                 :          0 :         aMouseEvent.Buttons |= ::com::sun::star::awt::MouseButton::MIDDLE;
     694                 :            : 
     695                 :          0 :     aMouseEvent.X = _rVclEvent.GetPosPixel().X();
     696                 :          0 :     aMouseEvent.Y = _rVclEvent.GetPosPixel().Y();
     697                 :          0 :     aMouseEvent.ClickCount = _rVclEvent.GetClicks();
     698                 :          0 :     aMouseEvent.PopupTrigger = sal_False;
     699                 :            : 
     700                 :          0 :     return aMouseEvent;
     701                 :            : }
     702                 :            : 
     703                 :          0 : awt::KeyEvent VCLUnoHelper::createKeyEvent( const ::KeyEvent& _rVclEvent, const uno::Reference< uno::XInterface >& _rxContext )
     704                 :            : {
     705                 :          0 :     awt::KeyEvent aKeyEvent;
     706         [ #  # ]:          0 :     aKeyEvent.Source = _rxContext;
     707                 :            : 
     708                 :          0 :     aKeyEvent.Modifiers = 0;
     709         [ #  # ]:          0 :     if ( _rVclEvent.GetKeyCode().IsShift() )
     710                 :          0 :         aKeyEvent.Modifiers |= awt::KeyModifier::SHIFT;
     711         [ #  # ]:          0 :     if ( _rVclEvent.GetKeyCode().IsMod1() )
     712                 :          0 :         aKeyEvent.Modifiers |= awt::KeyModifier::MOD1;
     713         [ #  # ]:          0 :     if ( _rVclEvent.GetKeyCode().IsMod2() )
     714                 :          0 :         aKeyEvent.Modifiers |= awt::KeyModifier::MOD2;
     715         [ #  # ]:          0 :     if ( _rVclEvent.GetKeyCode().IsMod3() )
     716                 :          0 :             aKeyEvent.Modifiers |= awt::KeyModifier::MOD3;
     717                 :            : 
     718                 :          0 :     aKeyEvent.KeyCode = _rVclEvent.GetKeyCode().GetCode();
     719                 :          0 :     aKeyEvent.KeyChar = _rVclEvent.GetCharCode();
     720         [ #  # ]:          0 :     aKeyEvent.KeyFunc = ::sal::static_int_cast< sal_Int16 >( _rVclEvent.GetKeyCode().GetFunction());
     721                 :            : 
     722                 :          0 :     return aKeyEvent;
     723                 :            : }
     724                 :            : 
     725                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10