LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/toolkit/source/awt - vclxwindow1.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 29 3.4 %
Date: 2013-07-09 Functions: 2 3 66.7 %
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 <toolkit/awt/vclxwindow.hxx>
      22             : #include <com/sun/star/beans/NamedValue.hpp>
      23             : #ifndef _SV_WORKWIN
      24             : #include <vcl/wrkwin.hxx>
      25             : #endif
      26             : #include <vcl/window.hxx>
      27             : 
      28             : #ifdef WNT
      29             : #include <prewin.h>
      30             : #include <postwin.h>
      31             : #elif defined ( MACOSX )
      32             : #include "premac.h"
      33             : #include <Cocoa/Cocoa.h>
      34             : #include "postmac.h"
      35             : #endif
      36             : #include <vcl/sysdata.hxx>
      37             : 
      38             : /// helper method to set a window handle into a SystemParentData struct
      39           0 : void VCLXWindow::SetSystemParent_Impl( const com::sun::star::uno::Any& rHandle )
      40             : {
      41             :     // does only work for WorkWindows
      42           0 :     Window *pWindow = GetWindow();
      43           0 :     if ( pWindow->GetType() != WINDOW_WORKWINDOW )
      44             :     {
      45           0 :         com::sun::star::uno::Exception aException;
      46           0 :         aException.Message = OUString("not a work window");
      47           0 :         throw aException;
      48             :     }
      49             : 
      50             :     // use sal_Int64 here to accommodate all int types
      51             :     // uno::Any shift operator whill upcast if necessary
      52           0 :     sal_Int64 nHandle = 0;
      53           0 :     sal_Bool  bXEmbed = sal_False;
      54           0 :     bool bThrow = false;
      55           0 :     if( ! (rHandle >>= nHandle) )
      56             :     {
      57           0 :         com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue > aProps;
      58           0 :         if( rHandle >>= aProps )
      59             :         {
      60           0 :             const int nProps = aProps.getLength();
      61           0 :             const com::sun::star::beans::NamedValue* pProps = aProps.getConstArray();
      62           0 :             for( int i = 0; i < nProps; i++ )
      63             :             {
      64           0 :                 if ( pProps[i].Name == "WINDOW" )
      65           0 :                     pProps[i].Value >>= nHandle;
      66           0 :                 else if ( pProps[i].Name == "XEMBED" )
      67           0 :                     pProps[i].Value >>= bXEmbed;
      68             :             }
      69             :         }
      70             :         else
      71           0 :             bThrow = true;
      72             :     }
      73           0 :     if( bThrow )
      74             :     {
      75           0 :         com::sun::star::uno::Exception aException;
      76           0 :         aException.Message = OUString("incorrect window handle type");
      77           0 :         throw aException;
      78             :     }
      79             :     // create system parent data
      80             :     SystemParentData aSysParentData;
      81           0 :     aSysParentData.nSize = sizeof ( SystemParentData );
      82             : #if defined( WNT )
      83             :     aSysParentData.hWnd = (HWND) nHandle;
      84             : #elif defined( MACOSX )
      85             :     aSysParentData.pView = reinterpret_cast<NSView*>(nHandle);
      86             : #elif defined( ANDROID )
      87             :     // Nothing
      88             : #elif defined( IOS )
      89             :     // Nothing
      90             : #elif defined( UNX )
      91           0 :     aSysParentData.aWindow = (long)nHandle;
      92           0 :     aSysParentData.bXEmbedSupport = bXEmbed;
      93             : #endif
      94             : 
      95             :     // set system parent
      96           0 :     ((WorkWindow*)pWindow)->SetPluginParent( &aSysParentData );
      97         465 : }
      98             : 
      99             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10