LCOV - code coverage report
Current view: top level - libreoffice/toolkit/source/awt - vclxtoolkit.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 171 772 22.2 %
Date: 2012-12-27 Functions: 14 48 29.2 %
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 <boost/ptr_container/ptr_vector.hpp>
      22             : 
      23             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      24             : 
      25             : #include <stdio.h>
      26             : #ifdef WNT
      27             : #include <prewin.h>
      28             : #include <postwin.h>
      29             : #endif
      30             : #include <com/sun/star/awt/ImageScaleMode.hpp>
      31             : #include <com/sun/star/awt/WindowAttribute.hpp>
      32             : #include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
      33             : #include <com/sun/star/awt/WindowClass.hpp>
      34             : #include <com/sun/star/awt/MessageBoxButtons.hpp>
      35             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      36             : #include <com/sun/star/lang/SystemDependent.hpp>
      37             : #include <com/sun/star/awt/FocusEvent.hpp>
      38             : #include <com/sun/star/awt/KeyEvent.hpp>
      39             : #include <com/sun/star/awt/KeyModifier.hpp>
      40             : #include <com/sun/star/lang/EventObject.hpp>
      41             : #include <com/sun/star/uno/Reference.hxx>
      42             : #include <com/sun/star/uno/Sequence.hxx>
      43             : #include <com/sun/star/uno/XInterface.hpp>
      44             : #include <com/sun/star/beans/NamedValue.hpp>
      45             : #include <cppuhelper/typeprovider.hxx>
      46             : #include <osl/conditn.hxx>
      47             : #include <rtl/uuid.h>
      48             : #include <rtl/process.h>
      49             : 
      50             : #ifdef QUARTZ
      51             : #include "premac.h"
      52             : #include <Cocoa/Cocoa.h>
      53             : #include "postmac.h"
      54             : #endif
      55             : 
      56             : #ifdef ANDROID
      57             : #include <sal/ByteBufferWrapper.hxx>
      58             : using org::libreoffice::touch::ByteBufferWrapper;
      59             : #endif
      60             : 
      61             : #ifdef IOS
      62             : #include "premac.h"
      63             : #include <UIKit/UIKit.h>
      64             : #include "postmac.h"
      65             : #endif
      66             : 
      67             : #include <vcl/sysdata.hxx>
      68             : 
      69             : #include <toolkit/awt/vclxwindows.hxx>
      70             : #include <toolkit/awt/vclxsystemdependentwindow.hxx>
      71             : #include <toolkit/awt/vclxregion.hxx>
      72             : #include <toolkit/awt/vclxtoolkit.hxx>
      73             : #include <toolkit/awt/vclxtabpagecontainer.hxx>
      74             : #include <toolkit/awt/vclxtabpagemodel.hxx>
      75             : 
      76             : #include <toolkit/awt/xsimpleanimation.hxx>
      77             : #include <toolkit/awt/xthrobber.hxx>
      78             : #include <toolkit/awt/animatedimagespeer.hxx>
      79             : #include <toolkit/awt/vclxtopwindow.hxx>
      80             : #include <toolkit/awt/vclxwindow.hxx>
      81             : #include <toolkit/helper/vclunohelper.hxx>
      82             : #include <toolkit/helper/unowrapper.hxx>
      83             : #include <toolkit/helper/servicenames.hxx>
      84             : 
      85             : #include <toolkit/helper/macros.hxx>
      86             : #include <toolkit/helper/convert.hxx>
      87             : #include <vcl/unohelp.hxx>
      88             : #include <vcl/btndlg.hxx>
      89             : #include <vcl/button.hxx>
      90             : #include <vcl/combobox.hxx>
      91             : #include <vcl/ctrl.hxx>
      92             : #include <vcl/dialog.hxx>
      93             : #include <vcl/dockingarea.hxx>
      94             : #include <vcl/dockwin.hxx>
      95             : #include <vcl/edit.hxx>
      96             : #include <vcl/field.hxx>
      97             : #include <vcl/fixed.hxx>
      98             : #include <vcl/floatwin.hxx>
      99             : #include <vcl/group.hxx>
     100             : #include <vcl/imgctrl.hxx>
     101             : #include <vcl/longcurr.hxx>
     102             : #include <vcl/lstbox.hxx>
     103             : #include <vcl/menubtn.hxx>
     104             : #include <vcl/morebtn.hxx>
     105             : #include <vcl/msgbox.hxx>
     106             : #include <vcl/scrbar.hxx>
     107             : #include <vcl/spin.hxx>
     108             : #include <vcl/split.hxx>
     109             : #include <vcl/splitwin.hxx>
     110             : #include <vcl/status.hxx>
     111             : #include <vcl/svapp.hxx>
     112             : #include <vcl/syschild.hxx>
     113             : #include <vcl/tabctrl.hxx>
     114             : #include <vcl/tabdlg.hxx>
     115             : #include <vcl/tabpage.hxx>
     116             : #include <vcl/toolbox.hxx>
     117             : #include <vcl/virdev.hxx>
     118             : #include <vcl/window.hxx>
     119             : #include <vcl/wrkwin.hxx>
     120             : #include <vcl/throbber.hxx>
     121             : #include "toolkit/awt/vclxspinbutton.hxx"
     122             : #include "toolkit/awt/scrollabledialog.hxx"
     123             : #include <tools/debug.hxx>
     124             : #include <comphelper/processfactory.hxx>
     125             : #include <toolkit/awt/scrollabledialog.hxx>
     126             : 
     127             : #define VCLWINDOW_FRAMEWINDOW               0x1000
     128             : #define VCLWINDOW_SYSTEMCHILDWINDOW         0x1001
     129             : 
     130             : #if (defined WNT)
     131             : #define SYSTEM_DEPENDENT_TYPE ::com::sun::star::lang::SystemDependent::SYSTEM_WIN32
     132             : #elif (defined QUARTZ)
     133             : #define SYSTEM_DEPENDENT_TYPE ::com::sun::star::lang::SystemDependent::SYSTEM_MAC
     134             : #elif (defined UNX)
     135             : #define SYSTEM_DEPENDENT_TYPE ::com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW
     136             : #endif
     137             : 
     138        2160 : TOOLKIT_DLLPUBLIC WinBits ImplGetWinBits( sal_uInt32 nComponentAttribs, sal_uInt16 nCompType )
     139             : {
     140        2160 :     WinBits nWinBits = 0;
     141             : 
     142        2160 :     sal_Bool bMessBox = sal_False;
     143        2160 :     if ( ( nCompType == WINDOW_INFOBOX ) ||
     144             :          ( nCompType == WINDOW_MESSBOX ) ||
     145             :          ( nCompType == WINDOW_QUERYBOX ) ||
     146             :          ( nCompType == WINDOW_WARNINGBOX ) ||
     147             :          ( nCompType == WINDOW_ERRORBOX ) )
     148             :     {
     149           0 :         bMessBox = sal_True;
     150             :     }
     151             : 
     152        2160 :     bool bDecoratedWindow = false;
     153        2160 :     if  (   bMessBox
     154             :         ||  ( nCompType == WINDOW_DIALOG )
     155             :         ||  ( nCompType == WINDOW_MODELESSDIALOG )
     156             :         ||  ( nCompType == WINDOW_MODALDIALOG )
     157             :         ||  ( nCompType == WINDOW_SYSTEMDIALOG )
     158             :         ||  ( nCompType == WINDOW_PATHDIALOG )
     159             :         ||  ( nCompType == WINDOW_FILEDIALOG )
     160             :         ||  ( nCompType == WINDOW_PRINTERSETUPDIALOG )
     161             :         ||  ( nCompType == WINDOW_PRINTDIALOG )
     162             :         ||  ( nCompType == WINDOW_COLORDIALOG )
     163             :         ||  ( nCompType == WINDOW_FONTDIALOG )
     164             :         ||  ( nCompType == WINDOW_DOCKINGWINDOW )
     165             :         ||  ( nCompType == WINDOW_TABDIALOG )
     166             :         ||  ( nCompType == WINDOW_BUTTONDIALOG )
     167             :         ||  ( nCompType == WINDOW_SYSTEMCHILDWINDOW )
     168             :         )
     169             :     {
     170           0 :         bDecoratedWindow = true;
     171             :     }
     172             : 
     173        2160 :     if( nComponentAttribs & ::com::sun::star::awt::WindowAttribute::BORDER )
     174         240 :         nWinBits |= WB_BORDER;
     175        2160 :     if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::NOBORDER )
     176           0 :         nWinBits |= WB_NOBORDER;
     177        2160 :     if( nComponentAttribs & ::com::sun::star::awt::WindowAttribute::SIZEABLE )
     178         240 :         nWinBits |= WB_SIZEABLE;
     179        2160 :     if( nComponentAttribs & ::com::sun::star::awt::WindowAttribute::MOVEABLE )
     180         240 :         nWinBits |= WB_MOVEABLE;
     181        2160 :     if( nComponentAttribs & ::com::sun::star::awt::WindowAttribute::CLOSEABLE )
     182         240 :         nWinBits |= WB_CLOSEABLE;
     183        2160 :     if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::HSCROLL )
     184           0 :         nWinBits |= WB_HSCROLL;
     185        2160 :     if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::VSCROLL )
     186           0 :         nWinBits |= WB_VSCROLL;
     187        2160 :     if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::LEFT )
     188           0 :         nWinBits |= WB_LEFT;
     189        2160 :     if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::CENTER )
     190           0 :         nWinBits |= WB_CENTER;
     191        2160 :     if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::RIGHT )
     192           0 :         nWinBits |= WB_RIGHT;
     193        2160 :     if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::SPIN )
     194           0 :         nWinBits |= WB_SPIN;
     195        2160 :     if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::SORT )
     196           0 :         nWinBits |= WB_SORT;
     197        2160 :     if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DROPDOWN )
     198           0 :         nWinBits |= WB_DROPDOWN;
     199        2160 :     if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEFBUTTON )
     200           0 :         nWinBits |= WB_DEFBUTTON;
     201        2160 :     if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::READONLY )
     202           0 :         nWinBits |= WB_READONLY;
     203        2160 :     if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::CLIPCHILDREN )
     204         240 :         nWinBits |= WB_CLIPCHILDREN;
     205        2160 :     if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::GROUP )
     206           0 :         nWinBits |= WB_GROUP;
     207        2160 :     if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::NOLABEL ) //added for issue79712
     208           0 :         nWinBits |= WB_NOLABEL;
     209             : 
     210             :     // These bits are not uniqe
     211        2160 :     if ( bMessBox )
     212             :     {
     213           0 :         if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::OK )
     214           0 :             nWinBits |= WB_OK;
     215           0 :         if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::OK_CANCEL )
     216           0 :             nWinBits |= WB_OK_CANCEL;
     217           0 :         if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::YES_NO )
     218           0 :             nWinBits |= WB_YES_NO;
     219           0 :         if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::YES_NO_CANCEL )
     220           0 :             nWinBits |= WB_YES_NO_CANCEL;
     221           0 :         if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::RETRY_CANCEL )
     222           0 :             nWinBits |= WB_RETRY_CANCEL;
     223           0 :         if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEF_OK )
     224           0 :             nWinBits |= WB_DEF_OK;
     225           0 :         if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEF_CANCEL )
     226           0 :             nWinBits |= WB_DEF_CANCEL;
     227           0 :         if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEF_RETRY )
     228           0 :             nWinBits |= WB_DEF_RETRY;
     229           0 :         if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEF_YES )
     230           0 :             nWinBits |= WB_DEF_YES;
     231           0 :         if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEF_NO )
     232           0 :             nWinBits |= WB_DEF_NO;
     233             :     }
     234             :     if ( nCompType == WINDOW_MULTILINEEDIT || nCompType == WINDOW_DIALOG || WINDOW_GROUPBOX )
     235             :     {
     236        2160 :         if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::AUTOHSCROLL )
     237           0 :             nWinBits |= WB_AUTOHSCROLL;
     238        2160 :         if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::AUTOVSCROLL )
     239           0 :             nWinBits |= WB_AUTOVSCROLL;
     240             :     }
     241             : 
     242             : 
     243        2160 :     if ( bDecoratedWindow )
     244             :     {
     245           0 :         if( nComponentAttribs & ::com::sun::star::awt::WindowAttribute::NODECORATION )
     246             :         {
     247             :             // No decoration removes several window attributes and must
     248             :             // set WB_NOBORDER!
     249           0 :             nWinBits &= ~WB_BORDER;
     250           0 :             nWinBits &= ~WB_SIZEABLE;
     251           0 :             nWinBits &= ~WB_MOVEABLE;
     252           0 :             nWinBits &= ~WB_CLOSEABLE;
     253           0 :             nWinBits |= WB_NOBORDER;
     254             :         }
     255             :     }
     256             : 
     257        2160 :     return nWinBits;
     258             : }
     259             : 
     260             : struct ComponentInfo
     261             : {
     262             :     const char*     pName;
     263             :     WindowType      nWinType;
     264             : };
     265             : 
     266             : static ComponentInfo aComponentInfos [] =
     267             : {
     268             :     { "buttondialog",       WINDOW_BUTTONDIALOG },
     269             :     { "cancelbutton",       WINDOW_CANCELBUTTON },
     270             :     { "checkbox",           WINDOW_CHECKBOX },
     271             :     { "combobox",           WINDOW_COMBOBOX },
     272             :     { "control",            WINDOW_CONTROL },
     273             :     { "currencybox",        WINDOW_CURRENCYBOX },
     274             :     { "currencyfield",      WINDOW_CURRENCYFIELD },
     275             :     { "datebox",            WINDOW_DATEBOX },
     276             :     { "datefield",          WINDOW_DATEFIELD },
     277             :     { "dialog",             WINDOW_DIALOG },
     278             :     { "dockingarea",        WINDOW_DOCKINGAREA },
     279             :     { "dockingwindow",      WINDOW_DOCKINGWINDOW },
     280             :     { "edit",               WINDOW_EDIT },
     281             :     { "errorbox",           WINDOW_ERRORBOX },
     282             :     { "fixedbitmap",        WINDOW_FIXEDBITMAP },
     283             :     { "fixedimage",         WINDOW_FIXEDIMAGE },
     284             :     { "fixedline",          WINDOW_FIXEDLINE },
     285             :     { "fixedtext",          WINDOW_FIXEDTEXT },
     286             :     { "floatingwindow",     WINDOW_FLOATINGWINDOW },
     287             :     { "framewindow",        VCLWINDOW_FRAMEWINDOW },
     288             :     { "groupbox",           WINDOW_GROUPBOX },
     289             :     { "frame",          WINDOW_GROUPBOX },
     290             :     { "helpbutton",         WINDOW_HELPBUTTON },
     291             :     { "imagebutton",        WINDOW_IMAGEBUTTON },
     292             :     { "imageradiobutton",   WINDOW_IMAGERADIOBUTTON },
     293             :     { "infobox",            WINDOW_INFOBOX },
     294             :     { "listbox",            WINDOW_LISTBOX },
     295             :     { "longcurrencybox",    WINDOW_LONGCURRENCYBOX },
     296             :     { "longcurrencyfield",  WINDOW_LONGCURRENCYFIELD },
     297             :     { "menubutton",         WINDOW_MENUBUTTON },
     298             :     { "messbox",            WINDOW_MESSBOX },
     299             :     { "metricbox",          WINDOW_METRICBOX },
     300             :     { "metricfield",        WINDOW_METRICFIELD },
     301             :     { "modaldialog",        WINDOW_MODALDIALOG },
     302             :     { "modelessdialog",     WINDOW_MODELESSDIALOG },
     303             :     { "morebutton",         WINDOW_MOREBUTTON },
     304             :     { "multilineedit",      WINDOW_MULTILINEEDIT },
     305             :     { "multilistbox",       WINDOW_MULTILISTBOX },
     306             :     { "numericbox",         WINDOW_NUMERICBOX },
     307             :     { "numericfield",       WINDOW_NUMERICFIELD },
     308             :     { "okbutton",           WINDOW_OKBUTTON },
     309             :     { "patternbox",         WINDOW_PATTERNBOX },
     310             :     { "patternfield",       WINDOW_PATTERNFIELD },
     311             :     { "pushbutton",         WINDOW_PUSHBUTTON },
     312             :     { "querybox",           WINDOW_QUERYBOX },
     313             :     { "radiobutton",        WINDOW_RADIOBUTTON },
     314             :     { "scrollbar",          WINDOW_SCROLLBAR },
     315             :     { "scrollbarbox",       WINDOW_SCROLLBARBOX },
     316             :     { "simpleanimation",    WINDOW_CONTROL },
     317             :     { "animatedimages",     WINDOW_CONTROL },
     318             :     { "spinbutton",         WINDOW_SPINBUTTON },
     319             :     { "spinfield",          WINDOW_SPINFIELD },
     320             :     { "throbber",           WINDOW_CONTROL },
     321             :     { "splitter",           WINDOW_SPLITTER },
     322             :     { "splitwindow",        WINDOW_SPLITWINDOW },
     323             :     { "statusbar",          WINDOW_STATUSBAR },
     324             :     { "systemchildwindow",  VCLWINDOW_SYSTEMCHILDWINDOW },
     325             :     { "tabcontrol",         WINDOW_TABCONTROL },
     326             :     { "tabdialog",          WINDOW_TABDIALOG },
     327             :     { "tabpage",            WINDOW_TABPAGE },
     328             :     { "timebox",            WINDOW_TIMEBOX },
     329             :     { "timefield",          WINDOW_TIMEFIELD },
     330             :     { "toolbox",            WINDOW_TOOLBOX },
     331             :     { "tristatebox",        WINDOW_TRISTATEBOX },
     332             :     { "warningbox",         WINDOW_WARNINGBOX },
     333             :     { "window",             WINDOW_WINDOW },
     334             :     { "workwindow",         WINDOW_WORKWINDOW },
     335             :     { "tabpagecontainer",   WINDOW_CONTROL },
     336             :     { "tabpagemodel",       WINDOW_TABPAGE }
     337             : };
     338             : 
     339             : extern "C"
     340             : {
     341       23580 : static int SAL_CALL ComponentInfoCompare( const void* pFirst, const void* pSecond)
     342             : {
     343             :     return( strcmp( ((ComponentInfo*)pFirst)->pName,
     344       23580 :                     ((ComponentInfo*)pSecond)->pName ) );
     345             : }
     346             : }
     347             : 
     348        4320 : sal_uInt16 ImplGetComponentType( const String& rServiceName )
     349             : {
     350             :     static sal_Bool bSorted = sal_False;
     351        4320 :     if( !bSorted )
     352             :     {
     353             :         qsort(  (void*) aComponentInfos,
     354             :                 sizeof( aComponentInfos ) / sizeof( ComponentInfo ),
     355             :                 sizeof( ComponentInfo ),
     356           9 :                 ComponentInfoCompare );
     357           9 :         bSorted = sal_True;
     358             :     }
     359             : 
     360             : 
     361             :     ComponentInfo aSearch;
     362        4320 :     rtl::OString aServiceName(rtl::OUStringToOString(rServiceName, osl_getThreadTextEncoding()).toAsciiLowerCase());
     363        4320 :     if ( !aServiceName.isEmpty() )
     364        4320 :         aSearch.pName = aServiceName.getStr();
     365             :     else
     366           0 :         aSearch.pName = "window";
     367             : 
     368             :     ComponentInfo* pInf = (ComponentInfo*) bsearch( &aSearch,
     369             :                         (void*) aComponentInfos,
     370             :                         sizeof( aComponentInfos ) / sizeof( ComponentInfo ),
     371             :                         sizeof( ComponentInfo ),
     372        4320 :                         ComponentInfoCompare );
     373             : 
     374        4320 :     return pInf ? pInf->nWinType : 0;
     375             : }
     376             : 
     377             : 
     378             : //  ----------------------------------------------------
     379             : //  class VCLXToolkit
     380             : //  ----------------------------------------------------
     381             : 
     382             : static sal_Int32                            nVCLToolkitInstanceCount = 0;
     383             : static sal_Bool                                 bInitedByVCLToolkit = sal_False;
     384             : 
     385        6441 : static osl::Mutex & getInitMutex()
     386             : {
     387             :     static osl::Mutex * pM;
     388        6441 :     if( !pM )
     389             :     {
     390           9 :         osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
     391           9 :         if( !pM )
     392             :         {
     393           9 :             static osl::Mutex aMutex;
     394           9 :             pM = &aMutex;
     395           9 :         }
     396             :     }
     397        6441 :     return *pM;
     398             : }
     399             : 
     400          48 : static osl::Condition & getInitCondition()
     401             : {
     402             :     static osl::Condition * pC = 0;
     403          48 :     if( !pC )
     404             :     {
     405          11 :         osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
     406          11 :         if( !pC )
     407             :         {
     408           9 :             static osl::Condition aCondition;
     409           9 :             pC = &aCondition;
     410          11 :         }
     411             :     }
     412          48 :     return *pC;
     413             : }
     414             : 
     415             : extern "C"
     416             : {
     417          24 : static void SAL_CALL ToolkitWorkerFunction( void* pArgs )
     418             : {
     419          24 :     VCLXToolkit * pTk = (VCLXToolkit *)pArgs;
     420          24 :     bInitedByVCLToolkit = InitVCL();
     421          24 :     if( bInitedByVCLToolkit )
     422             :     {
     423           0 :         UnoWrapper* pUnoWrapper = new UnoWrapper( pTk );
     424           0 :         Application::SetUnoWrapper( pUnoWrapper );
     425             :     }
     426          24 :     getInitCondition().set();
     427          24 :     if( bInitedByVCLToolkit )
     428             :     {
     429             :         {
     430           0 :             SolarMutexGuard aGuard;
     431           0 :             Application::Execute();
     432             :         }
     433             :         try
     434             :         {
     435           0 :             pTk->dispose();
     436             :         }
     437           0 :         catch( com::sun::star::uno::Exception & )
     438             :         {
     439             :         }
     440           0 :         DeInitVCL();
     441             :     }
     442             :     else
     443             :     {
     444          24 :         JoinMainLoopThread();
     445             :     }
     446          24 : }
     447             : }
     448             : 
     449             : // contructor, which might initialize VCL
     450        3309 : VCLXToolkit::VCLXToolkit():
     451             :     cppu::WeakComponentImplHelper2<
     452             :     ::com::sun::star::awt::XToolkitExperimental,
     453        3309 :     ::com::sun::star::lang::XServiceInfo>( GetMutex() ),
     454             :     m_aTopWindowListeners(rBHelper.rMutex),
     455             :     m_aKeyHandlers(rBHelper.rMutex),
     456             :     m_aFocusListeners(rBHelper.rMutex),
     457             :     m_aEventListenerLink(LINK(this, VCLXToolkit, eventListenerHandler)),
     458             :     m_aKeyListenerLink(LINK(this, VCLXToolkit, keyListenerHandler)),
     459             :     m_bEventListener(false),
     460        6618 :     m_bKeyListener(false)
     461             : {
     462        3309 :     hSvToolsLib = NULL;
     463        3309 :     fnSvtCreateWindow = NULL;
     464             : 
     465        3309 :     osl::Guard< osl::Mutex > aGuard( getInitMutex() );
     466        3309 :     nVCLToolkitInstanceCount++;
     467        3309 :     if( ( nVCLToolkitInstanceCount == 1 ) && ( !Application::IsInMain() ) )
     468             :     {
     469             :         // setup execute thread
     470          24 :         CreateMainLoopThread( ToolkitWorkerFunction, this );
     471          24 :         getInitCondition().wait();
     472        3309 :     }
     473        3309 : }
     474             : 
     475        6264 : VCLXToolkit::~VCLXToolkit()
     476             : {
     477        6264 : }
     478             : 
     479             : 
     480        3132 : void SAL_CALL VCLXToolkit::disposing()
     481             : {
     482             : #ifndef DISABLE_DYNLOADING
     483        3132 :     if ( hSvToolsLib )
     484             :     {
     485        2160 :         osl_unloadModule( hSvToolsLib );
     486        2160 :         hSvToolsLib = NULL;
     487        2160 :         fnSvtCreateWindow = NULL;
     488             :     }
     489             : #endif
     490             : 
     491             :     {
     492        3132 :         osl::Guard< osl::Mutex > aGuard( getInitMutex() );
     493        3132 :         if( --nVCLToolkitInstanceCount == 0 )
     494             :         {
     495          16 :             if( bInitedByVCLToolkit )
     496             :             {
     497           0 :                 Application::Quit();
     498           0 :                 JoinMainLoopThread();
     499           0 :                 bInitedByVCLToolkit = sal_False;
     500             :             }
     501        3132 :         }
     502             :     }
     503             : 
     504        3132 :     if (m_bEventListener)
     505             :     {
     506           0 :         ::Application::RemoveEventListener(m_aEventListenerLink);
     507           0 :         m_bEventListener = false;
     508             :     }
     509        3132 :     if (m_bKeyListener)
     510             :     {
     511           0 :         ::Application::RemoveKeyListener(m_aKeyListenerLink);
     512           0 :         m_bKeyListener = false;
     513             :     }
     514             :     ::css::lang::EventObject aEvent(
     515        3132 :         static_cast< ::cppu::OWeakObject * >(this));
     516        3132 :     m_aTopWindowListeners.disposeAndClear(aEvent);
     517        3132 :     m_aKeyHandlers.disposeAndClear(aEvent);
     518        3132 :     m_aFocusListeners.disposeAndClear(aEvent);
     519        3132 : }
     520             : 
     521             : 
     522           0 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > VCLXToolkit::getDesktopWindow(  ) throw(::com::sun::star::uno::RuntimeException)
     523             : {
     524           0 :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xRef;
     525             :     // 07/00: AppWindow doesn't exist anymore...
     526           0 :     return xRef;
     527             : }
     528             : 
     529           0 : ::com::sun::star::awt::Rectangle VCLXToolkit::getWorkArea(  ) throw(::com::sun::star::uno::RuntimeException)
     530             : {
     531           0 :     ::com::sun::star::awt::Rectangle aRect;
     532             :     // 07/00: AppWindow doesn't exist anymore...
     533           0 :     return aRect;
     534             : }
     535             : 
     536        2160 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > VCLXToolkit::createWindow( const ::com::sun::star::awt::WindowDescriptor& rDescriptor ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
     537             : {
     538        2160 :     return ImplCreateWindow( rDescriptor, WinBits(0) );
     539             : }
     540             : 
     541           0 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXToolkit::createScreenCompatibleDevice( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException)
     542             : {
     543           0 :     return createScreenCompatibleDeviceUsingBuffer( Width, Height, 1, 1, 0, 0, 0 );
     544             : }
     545             : 
     546           0 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXToolkit::createScreenCompatibleDeviceUsingBuffer( sal_Int32 Width, sal_Int32 Height, sal_Int32 ScaleNumerator, sal_Int32 ScaleDenominator, sal_Int32 XOffset, sal_Int32 YOffset, sal_Int64 addressOfMemoryBufferForSharedArrayWrapper ) throw(::com::sun::star::uno::RuntimeException)
     547             : {
     548           0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     549             : 
     550           0 :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > xRef;
     551           0 :     VCLXVirtualDevice* pVDev = new VCLXVirtualDevice;
     552             : 
     553           0 :     SolarMutexGuard aSolarGuard;
     554             : 
     555           0 :     VirtualDevice* pV = new VirtualDevice;
     556           0 :     if ( addressOfMemoryBufferForSharedArrayWrapper != 0 ) {
     557             : #if defined(ANDROID)
     558             :         ByteBufferWrapper *bbw = (ByteBufferWrapper *) (intptr_t) addressOfMemoryBufferForSharedArrayWrapper;
     559             :         pV->SetOutputSizePixelScaleOffsetAndBuffer( Size( Width, Height ), Fraction(ScaleNumerator, ScaleDenominator), Point( XOffset, YOffset), basebmp::RawMemorySharedArray( bbw->pointer(), *bbw ));
     560             : #else
     561             :         (void) ScaleNumerator;
     562             :         (void) ScaleDenominator;
     563             :         (void) XOffset;
     564             :         (void) YOffset;
     565             :         OSL_FAIL( "rendering to a pre-allocated buffer not done yet for this OS" );
     566           0 :         pV->SetOutputSizePixel( Size( Width, Height ) );
     567             : #endif
     568             :     } else {
     569           0 :         pV->SetOutputSizePixel( Size( Width, Height ) );
     570             :     }
     571           0 :     pVDev->SetVirtualDevice( pV );
     572             : 
     573           0 :     xRef = pVDev;
     574           0 :     return xRef;
     575             : }
     576             : 
     577           0 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion > VCLXToolkit::createRegion(  ) throw(::com::sun::star::uno::RuntimeException)
     578             : {
     579           0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
     580             : 
     581           0 :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >  xRef = new VCLXRegion;
     582           0 :     return xRef;
     583             : }
     584             : 
     585        2160 : Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
     586             :     const ::com::sun::star::awt::WindowDescriptor& rDescriptor,
     587             :     Window* pParent, WinBits nWinBits )
     588             : {
     589        2160 :     String aServiceName( rDescriptor.WindowServiceName );
     590        2160 :     aServiceName.ToLowerAscii();
     591             : 
     592        2160 :     Window* pNewWindow = NULL;
     593        2160 :     sal_uInt16 nType = ImplGetComponentType( aServiceName );
     594        2160 :     bool bFrameControl = false;
     595        2160 :     if ( aServiceName == String( RTL_CONSTASCII_USTRINGPARAM("frame") ) )
     596           0 :         bFrameControl = true;
     597        2160 :     if ( aServiceName == String( RTL_CONSTASCII_USTRINGPARAM("tabcontrolnotabs") ) )
     598             :     {
     599           0 :         nWinBits |= WB_NOBORDER;
     600           0 :         nType = ImplGetComponentType( String( RTL_CONSTASCII_USTRINGPARAM("tabcontrol") ) );
     601             :     }
     602        2160 :     if ( !pParent )
     603             :     {
     604             :         // Wenn die Component einen Parent braucht, dann NULL zurueckgeben,
     605             :         // spaeter mal ::com::sun::star::uno::Exception...
     606         240 :         sal_Bool bException = sal_True;
     607         240 :         if  (   ( nType == WINDOW_DIALOG )
     608             :             ||  ( nType == WINDOW_MODALDIALOG )
     609             :             ||  ( nType == WINDOW_MODELESSDIALOG )
     610             :             ||  ( nType == WINDOW_MESSBOX )
     611             :             ||  ( nType == WINDOW_INFOBOX )
     612             :             ||  ( nType == WINDOW_WARNINGBOX )
     613             :             ||  ( nType == WINDOW_ERRORBOX )
     614             :             ||  ( nType == WINDOW_QUERYBOX )
     615             :             )
     616           0 :             bException = sal_False;
     617         240 :         else if ( ( nType == WINDOW_WINDOW ) ||
     618             :                   ( nType == WINDOW_WORKWINDOW ) ||
     619             :                   ( nType == VCLWINDOW_FRAMEWINDOW ) )
     620             :         {
     621         240 :             if ( rDescriptor.Type == ::com::sun::star::awt::WindowClass_TOP )
     622         240 :                 bException = sal_False;
     623             :         }
     624             : 
     625         240 :         if ( bException )
     626             :         {
     627           0 :             *ppNewComp = NULL;
     628           0 :             return NULL;
     629             :         }
     630             :     }
     631             : 
     632        2160 :     if ( nType )
     633             :     {
     634        2160 :         SolarMutexGuard aVclGuard;
     635        2160 :         switch ( (WindowType)nType )
     636             :         {
     637             :             case WINDOW_CANCELBUTTON:
     638           0 :                 pNewWindow = new CancelButton( pParent, nWinBits );
     639           0 :                 *ppNewComp = new VCLXButton;
     640           0 :             break;
     641             :             case WINDOW_CHECKBOX:
     642           0 :                  pNewWindow = new CheckBox( pParent, nWinBits );
     643           0 :                 *ppNewComp = new VCLXCheckBox;
     644           0 :             break;
     645             :             case WINDOW_COMBOBOX:
     646           0 :                 pNewWindow = new ComboBox( pParent, nWinBits|WB_AUTOHSCROLL );
     647           0 :                 ((ComboBox*)pNewWindow)->EnableAutoSize( sal_False );
     648           0 :                 *ppNewComp = new VCLXComboBox;
     649           0 :             break;
     650             :             case WINDOW_CURRENCYBOX:
     651           0 :                 pNewWindow = new CurrencyBox( pParent, nWinBits );
     652           0 :             break;
     653             :             case WINDOW_CURRENCYFIELD:
     654           0 :                 pNewWindow = new CurrencyField( pParent, nWinBits );
     655           0 :                 static_cast<CurrencyField*>(pNewWindow)->EnableEmptyFieldValue( sal_True );
     656           0 :                 *ppNewComp = new VCLXNumericField;
     657           0 :                 ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(CurrencyField*)pNewWindow );
     658           0 :             break;
     659             :             case WINDOW_DATEBOX:
     660           0 :                 pNewWindow = new DateBox( pParent, nWinBits );
     661           0 :             break;
     662             :             case WINDOW_DATEFIELD:
     663           0 :                 pNewWindow = new DateField( pParent, nWinBits );
     664           0 :                 static_cast<DateField*>(pNewWindow)->EnableEmptyFieldValue( sal_True );
     665           0 :                 *ppNewComp = new VCLXDateField;
     666           0 :                 ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(DateField*)pNewWindow );
     667           0 :             break;
     668             :             case WINDOW_DOCKINGAREA:
     669        1920 :                 pNewWindow = new DockingAreaWindow( pParent );
     670        1920 :             break;
     671             :             case WINDOW_MULTILINEEDIT:
     672             :             case WINDOW_EDIT:
     673           0 :                 pNewWindow = new Edit( pParent, nWinBits );
     674           0 :                 *ppNewComp = new VCLXEdit;
     675           0 :             break;
     676             :             case WINDOW_ERRORBOX:
     677           0 :                 pNewWindow = new ErrorBox( pParent, nWinBits, String() );
     678           0 :                 *ppNewComp = new VCLXMessageBox;
     679           0 :             break;
     680             :             case WINDOW_FIXEDBITMAP:
     681           0 :                 pNewWindow = new FixedBitmap( pParent, nWinBits );
     682           0 :             break;
     683             :             case WINDOW_FIXEDIMAGE:
     684           0 :                 pNewWindow = new ImageControl( pParent, nWinBits );
     685           0 :                 *ppNewComp = new VCLXImageControl;
     686           0 :             break;
     687             :             case WINDOW_FIXEDLINE:
     688           0 :                 pNewWindow = new FixedLine( pParent, nWinBits );
     689           0 :             break;
     690             :             case WINDOW_FIXEDTEXT:
     691           0 :                 pNewWindow = new FixedText( pParent, nWinBits );
     692           0 :                 *ppNewComp = new VCLXFixedText;
     693           0 :             break;
     694             :             case WINDOW_FLOATINGWINDOW:
     695           0 :                 pNewWindow = new FloatingWindow( pParent, nWinBits );
     696           0 :             break;
     697             :             case WINDOW_GROUPBOX:
     698             :                         {
     699             : #if SCROLLABLEFRAME
     700             :                 if ( bFrameControl )
     701             :                 {
     702             :                     pNewWindow = new toolkit::ScrollableWrapper< GroupBox >( pParent, nWinBits | WB_VSCROLL );
     703             :                 }
     704             :                 else
     705             : #endif
     706           0 :                     pNewWindow = new GroupBox( pParent, nWinBits );
     707           0 :                                 if ( bFrameControl )
     708             :                                 {
     709           0 :                                     GroupBox* pGroupBox =  static_cast< GroupBox* >( pNewWindow );
     710           0 :                                     *ppNewComp = new VCLXFrame;
     711             :                                     // Frame control needs to recieve
     712             :                                     // Mouse events
     713           0 :                                     pGroupBox->SetMouseTransparent( sal_False );
     714             :                                 }
     715             :                         }
     716           0 :             break;
     717             :             case WINDOW_HELPBUTTON:
     718           0 :                 pNewWindow = new HelpButton( pParent, nWinBits );
     719           0 :                 *ppNewComp = new VCLXButton;
     720           0 :             break;
     721             :             case WINDOW_IMAGEBUTTON:
     722           0 :                  pNewWindow = new ImageButton( pParent, nWinBits );
     723           0 :                 *ppNewComp = new VCLXButton;
     724           0 :             break;
     725             :             case WINDOW_IMAGERADIOBUTTON:
     726           0 :                 pNewWindow = new ImageRadioButton( pParent, nWinBits );
     727           0 :                 *ppNewComp = new VCLXButton;
     728           0 :             break;
     729             :             case WINDOW_INFOBOX:
     730           0 :                 pNewWindow = new InfoBox( pParent, String() );
     731           0 :                 *ppNewComp = new VCLXMessageBox;
     732           0 :             break;
     733             :             case WINDOW_LISTBOX:
     734           0 :                 pNewWindow = new ListBox( pParent, nWinBits|WB_SIMPLEMODE|WB_AUTOHSCROLL );
     735           0 :                 ((ListBox*)pNewWindow)->EnableAutoSize( sal_False );
     736           0 :                 *ppNewComp = new VCLXListBox;
     737           0 :             break;
     738             :             case WINDOW_LONGCURRENCYBOX:
     739           0 :                 pNewWindow = new LongCurrencyBox( pParent, nWinBits );
     740           0 :             break;
     741             :             case WINDOW_LONGCURRENCYFIELD:
     742           0 :                 pNewWindow = new LongCurrencyField( pParent, nWinBits );
     743           0 :                 *ppNewComp = new VCLXCurrencyField;
     744           0 :                 ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(LongCurrencyField*)pNewWindow );
     745           0 :             break;
     746             :             case WINDOW_MENUBUTTON:
     747           0 :                 pNewWindow = new MenuButton( pParent, nWinBits );
     748           0 :                 *ppNewComp = new VCLXButton;
     749           0 :             break;
     750             :             case WINDOW_MESSBOX:
     751           0 :                 pNewWindow = new MessBox( pParent, nWinBits, String(), String() );
     752           0 :                 *ppNewComp = new VCLXMessageBox;
     753           0 :             break;
     754             :             case WINDOW_METRICBOX:
     755           0 :                 pNewWindow = new MetricBox( pParent, nWinBits );
     756           0 :             break;
     757             :             case WINDOW_METRICFIELD:
     758           0 :                 pNewWindow = new MetricField( pParent, nWinBits );
     759           0 :                 *ppNewComp = new VCLXMetricField;
     760           0 :                 ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(MetricField*)pNewWindow );
     761           0 :             break;
     762             :             case WINDOW_DIALOG:
     763             :             case WINDOW_MODALDIALOG:
     764             :             case WINDOW_MODELESSDIALOG:
     765             :             {
     766             :                 // Modal/Modeless nur durch Show/Execute
     767           0 :                 if ( (pParent == NULL ) && ( rDescriptor.ParentIndex == -1 ) )
     768           0 :                     pParent = DIALOG_NO_PARENT;
     769           0 :                 pNewWindow = new toolkit::ScrollableWrapper<Dialog>( pParent, nWinBits );
     770             :                 // #i70217# Don't always create a new component object. It's possible that VCL has called
     771             :                 // GetComponentInterface( sal_True ) in the Dialog ctor itself (see Window::IsTopWindow() )
     772             :                 // which creates a component object.
     773           0 :                 css::uno::Reference< css::awt::XWindowPeer > xWinPeer = pNewWindow->GetComponentInterface( sal_False );
     774           0 :                 if ( xWinPeer.is() )
     775           0 :                     *ppNewComp = dynamic_cast< VCLXDialog* >( xWinPeer.get() );
     776             :                 else
     777           0 :                     *ppNewComp = new VCLXDialog;
     778             :             }
     779           0 :             break;
     780             :             case WINDOW_MOREBUTTON:
     781           0 :                 pNewWindow = new MoreButton( pParent, nWinBits );
     782           0 :                 *ppNewComp = new VCLXButton;
     783           0 :             break;
     784             :             case WINDOW_MULTILISTBOX:
     785           0 :                 pNewWindow = new MultiListBox( pParent, nWinBits );
     786           0 :                 *ppNewComp = new VCLXListBox;
     787           0 :             break;
     788             :             case WINDOW_NUMERICBOX:
     789           0 :                 pNewWindow = new NumericBox( pParent, nWinBits );
     790           0 :             break;
     791             :             case WINDOW_NUMERICFIELD:
     792           0 :                 pNewWindow = new NumericField( pParent, nWinBits );
     793           0 :                 static_cast<NumericField*>(pNewWindow)->EnableEmptyFieldValue( sal_True );
     794           0 :                 *ppNewComp = new VCLXNumericField;
     795           0 :                 ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(NumericField*)pNewWindow );
     796           0 :             break;
     797             :             case WINDOW_OKBUTTON:
     798           0 :                 pNewWindow = new OKButton( pParent, nWinBits );
     799           0 :                 *ppNewComp = new VCLXButton;
     800           0 :             break;
     801             :             case WINDOW_PATTERNBOX:
     802           0 :                 pNewWindow = new PatternBox( pParent, nWinBits );
     803           0 :             break;
     804             :             case WINDOW_PATTERNFIELD:
     805           0 :                 pNewWindow = new PatternField( pParent, nWinBits );
     806           0 :                 *ppNewComp = new VCLXPatternField;
     807           0 :                 ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(PatternField*)pNewWindow );
     808           0 :             break;
     809             :             case WINDOW_PUSHBUTTON:
     810           0 :                 pNewWindow = new PushButton( pParent, nWinBits );
     811           0 :                 *ppNewComp = new VCLXButton;
     812           0 :             break;
     813             :             case WINDOW_QUERYBOX:
     814           0 :                 pNewWindow = new QueryBox( pParent, nWinBits, String() );
     815           0 :                 *ppNewComp = new VCLXMessageBox;
     816           0 :             break;
     817             :             case WINDOW_RADIOBUTTON:
     818           0 :                 pNewWindow = new RadioButton( pParent, nWinBits );
     819           0 :                 *ppNewComp = new VCLXRadioButton;
     820             : 
     821             :                 // by default, disable RadioCheck
     822             :                 // Since the VCLXRadioButton really cares for it's RadioCheck settings, this is important:
     823             :                 // if we enable it, the VCLXRadioButton will use RadioButton::Check instead of RadioButton::SetState
     824             :                 // This leads to a strange behaviour if the control is newly created: when settings the initial
     825             :                 // state to "checked", the RadioButton::Check (called because RadioCheck=sal_True) will uncheck
     826             :                 // _all_other_ radio buttons in the same group. However, at this moment the grouping of the controls
     827             :                 // is not really valid: the controls are grouped after they have been created, but we're still in
     828             :                 // the creation process, so the RadioButton::Check relies on invalid grouping information.
     829             :                 // 07.08.2001 - #87254# - frank.schoenheit@sun.com
     830           0 :                 static_cast<RadioButton*>(pNewWindow)->EnableRadioCheck( sal_False );
     831           0 :             break;
     832             :             case WINDOW_SCROLLBAR:
     833           0 :                 pNewWindow = new ScrollBar( pParent, nWinBits );
     834           0 :                 *ppNewComp = new VCLXScrollBar;
     835           0 :             break;
     836             :             case WINDOW_SCROLLBARBOX:
     837           0 :                 pNewWindow = new ScrollBarBox( pParent, nWinBits );
     838           0 :             break;
     839             :             case WINDOW_SPINBUTTON:
     840           0 :                 pNewWindow = new SpinButton( pParent, nWinBits );
     841           0 :                 *ppNewComp = new ::toolkit::VCLXSpinButton;
     842           0 :             break;
     843             :             case WINDOW_SPINFIELD:
     844           0 :                 pNewWindow = new SpinField( pParent, nWinBits );
     845           0 :                 *ppNewComp = new VCLXNumericField;
     846           0 :             break;
     847             :             case WINDOW_SPLITTER:
     848           0 :                 pNewWindow = new Splitter( pParent, nWinBits );
     849           0 :             break;
     850             :             case WINDOW_SPLITWINDOW:
     851           0 :                 pNewWindow = new SplitWindow( pParent, nWinBits );
     852           0 :             break;
     853             :             case WINDOW_STATUSBAR:
     854           0 :                 pNewWindow = new StatusBar( pParent, nWinBits );
     855           0 :             break;
     856             :             case VCLWINDOW_SYSTEMCHILDWINDOW:
     857           0 :                 pNewWindow = new SystemChildWindow( pParent, nWinBits );
     858           0 :                 *ppNewComp = new VCLXSystemDependentWindow();
     859           0 :             break;
     860             :             case WINDOW_TABCONTROL:
     861           0 :                 pNewWindow = new TabControl( pParent, nWinBits );
     862           0 :                 *ppNewComp = new VCLXMultiPage;
     863           0 :             break;
     864             :             case WINDOW_TABDIALOG:
     865           0 :                 pNewWindow = new TabDialog( pParent, nWinBits );
     866           0 :             break;
     867             :             case WINDOW_TABPAGE:
     868             :                 {
     869           0 :                     pNewWindow = new TabPage( pParent, nWinBits );
     870           0 :                     *ppNewComp = new VCLXTabPage;
     871             :                 }
     872           0 :             break;
     873             :             case WINDOW_TIMEBOX:
     874           0 :                 pNewWindow = new TimeBox( pParent, nWinBits );
     875           0 :             break;
     876             :             case WINDOW_TIMEFIELD:
     877           0 :                 pNewWindow = new TimeField( pParent, nWinBits );
     878           0 :                 static_cast<TimeField*>(pNewWindow)->EnableEmptyFieldValue( sal_True );
     879           0 :                 *ppNewComp = new VCLXTimeField;
     880           0 :                 ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(TimeField*)pNewWindow );
     881           0 :             break;
     882             :             case WINDOW_TOOLBOX:
     883           0 :                 pNewWindow = new ToolBox( pParent, nWinBits );
     884           0 :                 *ppNewComp = new VCLXToolBox;
     885           0 :             break;
     886             :             case WINDOW_TRISTATEBOX:
     887           0 :                 pNewWindow = new TriStateBox( pParent, nWinBits );
     888           0 :             break;
     889             :             case WINDOW_WARNINGBOX:
     890           0 :                 pNewWindow = new WarningBox( pParent, nWinBits, String() );
     891           0 :                 *ppNewComp = new VCLXMessageBox;
     892           0 :             break;
     893             :             case WINDOW_WORKWINDOW:
     894             :             case WINDOW_WINDOW:
     895             :             case VCLWINDOW_FRAMEWINDOW:
     896             :             case WINDOW_DOCKINGWINDOW:
     897         240 :                 if ( rDescriptor.Type == ::com::sun::star::awt::WindowClass_TOP )
     898             :                 {
     899         240 :                     if (nType == WINDOW_DOCKINGWINDOW )
     900           0 :                         pNewWindow = new DockingWindow( pParent, nWinBits );
     901             :                     else
     902             :                     {
     903         240 :                         if ((pParent == NULL) && rDescriptor.Parent.is())
     904             :                         {
     905             :                             // try to get a system dependent window handle
     906           0 :                             ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSystemDependentWindowPeer > xSystemDepParent(rDescriptor.Parent, ::com::sun::star::uno::UNO_QUERY);
     907             : 
     908           0 :                             if (xSystemDepParent.is())
     909             :                             {
     910             :                                 sal_Int8 processID[16];
     911             : 
     912           0 :                                 rtl_getGlobalProcessId( (sal_uInt8*)processID );
     913             : 
     914           0 :                                 ::com::sun::star::uno::Sequence<sal_Int8> processIdSeq(processID, 16);
     915             : 
     916           0 :                                 ::com::sun::star::uno::Any anyHandle = xSystemDepParent->getWindowHandle(processIdSeq, SYSTEM_DEPENDENT_TYPE);
     917             : 
     918             :                                 // use sal_Int64 here to accomodate all int types
     919             :                                 // uno::Any shift operator whill upcast if necessary
     920           0 :                                 sal_Int64 nWindowHandle = 0;
     921           0 :                                 sal_Bool bXEmbed = sal_False;
     922             : 
     923           0 :                                 bool bUseParentData = true;
     924           0 :                                 if( ! (anyHandle >>= nWindowHandle) )
     925             :                                 {
     926           0 :                                     css::uno::Sequence< css::beans::NamedValue > aProps;
     927           0 :                                     if( anyHandle >>= aProps )
     928             :                                     {
     929           0 :                                         const int nProps = aProps.getLength();
     930           0 :                                         const css::beans::NamedValue* pProps = aProps.getConstArray();
     931           0 :                                         for( int i = 0; i < nProps; i++ )
     932             :                                         {
     933           0 :                                             if ( pProps[i].Name == "WINDOW" )
     934           0 :                                                 pProps[i].Value >>= nWindowHandle;
     935           0 :                                             else if ( pProps[i].Name == "XEMBED" )
     936           0 :                                                 pProps[i].Value >>= bXEmbed;
     937             :                                         }
     938             :                                     }
     939             :                                     else
     940           0 :                                         bUseParentData = false;
     941             :                                 }
     942             : 
     943           0 :                                 if( bUseParentData )
     944             :                                 {
     945             :                                     SystemParentData aParentData;
     946           0 :                                     aParentData.nSize   = sizeof( aParentData );
     947             :                                     #if defined QUARTZ
     948             :                                     aParentData.pView   = reinterpret_cast<NSView*>(nWindowHandle);
     949             :                                     #elif defined IOS
     950             :                                     aParentData.pView   = reinterpret_cast<UIView*>(nWindowHandle);
     951             :                                     #elif defined UNX
     952           0 :                                     aParentData.aWindow = nWindowHandle;
     953           0 :                                     aParentData.bXEmbedSupport = bXEmbed;
     954             :                                     #elif defined WNT
     955             :                                     aParentData.hWnd = reinterpret_cast<HWND>(nWindowHandle);
     956             :                                     #endif
     957           0 :                                     pNewWindow = new WorkWindow( &aParentData );
     958           0 :                                 }
     959           0 :                             }
     960             :                         }
     961             : 
     962         240 :                         if (!pNewWindow)
     963         240 :                             pNewWindow = new WorkWindow( pParent, nWinBits );
     964             :                     }
     965             : 
     966         240 :                     *ppNewComp = new VCLXTopWindow( pNewWindow->GetType() == WINDOW_WORKWINDOW );
     967             :                 }
     968           0 :                 else if ( rDescriptor.Type == ::com::sun::star::awt::WindowClass_CONTAINER )
     969             :                 {
     970           0 :                     if (nType == WINDOW_DOCKINGWINDOW )
     971           0 :                         pNewWindow = new DockingWindow( pParent, nWinBits );
     972             :                     else
     973           0 :                         pNewWindow = new Window( pParent, nWinBits );
     974           0 :                     *ppNewComp = new VCLXContainer;
     975             :                 }
     976             :                 else
     977             :                 {
     978           0 :                     if (nType == WINDOW_DOCKINGWINDOW )
     979           0 :                         pNewWindow = new DockingWindow( pParent, nWinBits );
     980             :                     else
     981           0 :                         pNewWindow = new Window( pParent, nWinBits );
     982           0 :                     *ppNewComp = new VCLXWindow;
     983             :                 }
     984         240 :             break;
     985             :             case WINDOW_CONTROL:
     986           0 :                 if  ( aServiceName.EqualsAscii( "simpleanimation" ) )
     987             :                 {
     988           0 :                     pNewWindow = new Throbber( pParent, nWinBits, Throbber::IMAGES_NONE );
     989           0 :                     ((Throbber*)pNewWindow)->SetScaleMode( css::awt::ImageScaleMode::Anisotropic );
     990             :                         // (compatibility)
     991           0 :                     *ppNewComp = new ::toolkit::XSimpleAnimation;
     992             :                 }
     993           0 :                 else if ( aServiceName.EqualsAscii( "throbber" ) )
     994             :                 {
     995           0 :                     pNewWindow = new Throbber( pParent, nWinBits, Throbber::IMAGES_NONE );
     996           0 :                     ((Throbber*)pNewWindow)->SetScaleMode( css::awt::ImageScaleMode::Anisotropic );
     997             :                         // (compatibility)
     998           0 :                     *ppNewComp = new ::toolkit::XThrobber;
     999             :                 }
    1000           0 :                 else if ( rDescriptor.WindowServiceName.equalsIgnoreAsciiCaseAsciiL(
    1001           0 :                         RTL_CONSTASCII_STRINGPARAM("tabpagecontainer") ) )
    1002             :                 {
    1003           0 :                     pNewWindow = new TabControl( pParent, nWinBits );
    1004           0 :                     *ppNewComp = new VCLXTabPageContainer;
    1005             :                 }
    1006           0 :                 else if ( aServiceName.EqualsAscii( "animatedimages" ) )
    1007             :                 {
    1008           0 :                     pNewWindow = new Throbber( pParent, nWinBits );
    1009           0 :                     *ppNewComp = new ::toolkit::AnimatedImagesPeer;
    1010             :                 }
    1011           0 :             break;
    1012             :             default:
    1013             :                 OSL_ENSURE( false, "VCLXToolkit::ImplCreateWindow: unknown window type!" );
    1014           0 :                 break;
    1015        2160 :         }
    1016             :     }
    1017             : 
    1018        2160 :     return pNewWindow;
    1019             : }
    1020             : 
    1021             : #ifndef DISABLE_DYNLOADING
    1022             : 
    1023           0 : extern "C" { static void SAL_CALL thisModule() {} }
    1024             : 
    1025             : #else
    1026             : 
    1027             : extern "C" Window* SAL_CALL CreateWindow( VCLXWindow** ppNewComp, const ::com::sun::star::awt::WindowDescriptor* pDescriptor, Window* pParent, WinBits nWinBits );
    1028             : 
    1029             : #endif
    1030             : 
    1031        2160 : css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow(
    1032             :     const css::awt::WindowDescriptor& rDescriptor,
    1033             :     WinBits nForceWinBits )
    1034             : {
    1035        2160 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
    1036             : 
    1037        2160 :     SolarMutexGuard aSolarGuard;
    1038             : 
    1039        2160 :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xRef;
    1040             : 
    1041        2160 :     Window* pParent = NULL;
    1042        2160 :     if ( rDescriptor.Parent.is() )
    1043             :     {
    1044        1920 :         VCLXWindow* pParentComponent = VCLXWindow::GetImplementation( rDescriptor.Parent );
    1045             : 
    1046             :         // #103939# Don't throw assertion, may be it's a system dependend window, used in ImplCreateWindow.
    1047             :         // DBG_ASSERT( pParentComponent, "ParentComponent not valid" );
    1048             : 
    1049        1920 :         if ( pParentComponent )
    1050        1920 :             pParent = pParentComponent->GetWindow();
    1051             :     }
    1052             :     WinBits nWinBits = ImplGetWinBits( rDescriptor.WindowAttributes,
    1053        2160 :         ImplGetComponentType( rDescriptor.WindowServiceName ) );
    1054        2160 :     nWinBits |= nForceWinBits;
    1055             : 
    1056        2160 :     VCLXWindow* pNewComp = NULL;
    1057             : 
    1058        2160 :     Window* pNewWindow = NULL;
    1059             :     // Try to create the window with SvTools
    1060             :     // (do this _before_ creating it on our own: The old mechanism (extended toolkit in SvTools) did it this way,
    1061             :     // and we need to stay compatible)
    1062             :     // try to load the lib
    1063        4320 :     if ( !fnSvtCreateWindow
    1064             : #ifndef DISABLE_DYNLOADING
    1065        2160 :          && !hSvToolsLib
    1066             : #endif
    1067             :          )
    1068             :     {
    1069             : #ifndef DISABLE_DYNLOADING
    1070             :         ::rtl::OUString aLibName = ::vcl::unohelper::CreateLibraryName(
    1071             : #ifdef LIBO_MERGELIBS
    1072             :                                                                        "merged",
    1073             : #else
    1074             :                                                                        "svt",
    1075             : #endif
    1076        2160 :                                                                        sal_True );
    1077             :         hSvToolsLib = osl_loadModuleRelative(
    1078        2160 :             &thisModule, aLibName.pData, SAL_LOADMODULE_DEFAULT );
    1079        2160 :         if ( hSvToolsLib )
    1080             :         {
    1081        2160 :             ::rtl::OUString aFunctionName( "CreateWindow" );
    1082        2160 :             fnSvtCreateWindow = (FN_SvtCreateWindow)osl_getFunctionSymbol( hSvToolsLib, aFunctionName.pData );
    1083        2160 :         }
    1084             : #else
    1085             :         fnSvtCreateWindow = CreateWindow;
    1086             : #endif
    1087             :     }
    1088             :     // ask the SvTool creation function
    1089        2160 :     if ( fnSvtCreateWindow )
    1090        2160 :         pNewWindow = fnSvtCreateWindow( &pNewComp, &rDescriptor, pParent, nWinBits );
    1091             : 
    1092             :     // if SvTools could not provide a window, create it ourself
    1093        2160 :     if ( !pNewWindow )
    1094        2160 :         pNewWindow = ImplCreateWindow( &pNewComp, rDescriptor, pParent, nWinBits );
    1095             : 
    1096             :     DBG_ASSERT( pNewWindow, "createWindow: Unknown Component!" );
    1097             :     DBG_ASSERTWARNING( pNewComp, "createWindow: No special Interface!" );
    1098             : 
    1099        2160 :     if ( pNewWindow )
    1100             :     {
    1101        2160 :         pNewWindow->SetCreatedWithToolkit( sal_True );
    1102             :         //pNewWindow->SetPosPixel( Point() ); // do not force (0,0) position, keep default pos instead
    1103             : 
    1104        2160 :         if ( rDescriptor.WindowAttributes & ::com::sun::star::awt::WindowAttribute::MINSIZE )
    1105             :         {
    1106           0 :             pNewWindow->SetSizePixel( Size() );
    1107             :         }
    1108        2160 :         else if ( rDescriptor.WindowAttributes & ::com::sun::star::awt::WindowAttribute::FULLSIZE )
    1109             :         {
    1110           0 :             if ( pParent )
    1111           0 :                 pNewWindow->SetSizePixel( pParent->GetOutputSizePixel() );
    1112             :         }
    1113        2160 :         else if ( !VCLUnoHelper::IsZero( rDescriptor.Bounds ) )
    1114             :         {
    1115           0 :             Rectangle aRect = VCLRectangle( rDescriptor.Bounds );
    1116           0 :             pNewWindow->SetPosSizePixel( aRect.TopLeft(), aRect.GetSize() );
    1117             :         }
    1118             : 
    1119        2160 :         if ( !pNewComp )
    1120             :         {
    1121             :             // Default-Interface
    1122        1920 :             xRef = pNewWindow->GetComponentInterface( sal_True );
    1123             :         }
    1124             :         else
    1125             :         {
    1126         240 :             pNewComp->SetCreatedWithToolkit( sal_True );
    1127         240 :             xRef = pNewComp;
    1128         240 :             pNewWindow->SetComponentInterface( xRef );
    1129             :         }
    1130             :         DBG_ASSERT( pNewWindow->GetComponentInterface( sal_False ) == xRef,
    1131             :             "VCLXToolkit::createWindow: did #133706# resurge?" );
    1132             : 
    1133        2160 :         if ( rDescriptor.WindowAttributes & ::com::sun::star::awt::WindowAttribute::SHOW )
    1134           0 :             pNewWindow->Show();
    1135             :     }
    1136             : 
    1137        2160 :     return xRef;
    1138             : }
    1139             : 
    1140           0 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > > VCLXToolkit::createWindows( const ::com::sun::star::uno::Sequence< ::com::sun::star::awt::WindowDescriptor >& rDescriptors ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
    1141             : {
    1142           0 :     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
    1143             : 
    1144           0 :     sal_uInt32 nComponents = rDescriptors.getLength();
    1145           0 :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > > aSeq( nComponents );
    1146           0 :     for ( sal_uInt32 n = 0; n < nComponents; n++ )
    1147             :     {
    1148           0 :         ::com::sun::star::awt::WindowDescriptor aDescr = rDescriptors.getConstArray()[n];
    1149             : 
    1150           0 :         if ( aDescr.ParentIndex == (-1) )
    1151           0 :             aDescr.Parent = NULL;
    1152           0 :         else if ( ( aDescr.ParentIndex >= 0 ) && ( aDescr.ParentIndex < (short)n ) )
    1153           0 :             aDescr.Parent = aSeq.getConstArray()[aDescr.ParentIndex];
    1154           0 :         aSeq.getArray()[n] = createWindow( aDescr );
    1155           0 :     }
    1156           0 :     return aSeq;
    1157             : }
    1158             : 
    1159             : // ::com::sun::star::awt::XSystemChildFactory
    1160           0 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > VCLXToolkit::createSystemChild( const ::com::sun::star::uno::Any& Parent, const ::com::sun::star::uno::Sequence< sal_Int8 >& /*ProcessId*/, sal_Int16 nSystemType ) throw(::com::sun::star::uno::RuntimeException)
    1161             : {
    1162           0 :     Window* pChildWindow = NULL;
    1163           0 :     if ( nSystemType == SYSTEM_DEPENDENT_TYPE )
    1164             :     {
    1165             :         // use sal_Int64 here to accomodate all int types
    1166             :         // uno::Any shift operator whill upcast if necessary
    1167           0 :         sal_Int64 nWindowHandle = 0;
    1168           0 :         sal_Bool bXEmbed = sal_False;
    1169             : 
    1170           0 :         bool bUseParentData = true;
    1171           0 :         if( ! (Parent >>= nWindowHandle) )
    1172             :         {
    1173           0 :             css::uno::Sequence< css::beans::NamedValue > aProps;
    1174           0 :             if( Parent >>= aProps )
    1175             :             {
    1176           0 :                 const int nProps = aProps.getLength();
    1177           0 :                 const css::beans::NamedValue* pProps = aProps.getConstArray();
    1178           0 :                 for( int i = 0; i < nProps; i++ )
    1179             :                 {
    1180           0 :                     if ( pProps[i].Name == "WINDOW" )
    1181           0 :                         pProps[i].Value >>= nWindowHandle;
    1182           0 :                     else if ( pProps[i].Name == "XEMBED" )
    1183           0 :                         pProps[i].Value >>= bXEmbed;
    1184             :                 }
    1185             :             }
    1186             :             else
    1187           0 :                 bUseParentData = false;
    1188             :         }
    1189             : 
    1190           0 :         if( bUseParentData )
    1191             :         {
    1192             :             SystemParentData aParentData;
    1193           0 :             aParentData.nSize   = sizeof( aParentData );
    1194             :             #if defined QUARTZ
    1195             :             aParentData.pView   = reinterpret_cast<NSView*>(nWindowHandle);
    1196             :             #elif defined IOS
    1197             :             aParentData.pView   = reinterpret_cast<UIView*>(nWindowHandle);
    1198             :             #elif defined UNX
    1199           0 :             aParentData.aWindow = nWindowHandle;
    1200           0 :             aParentData.bXEmbedSupport = bXEmbed;
    1201             :             #elif defined WNT
    1202             :             aParentData.hWnd = reinterpret_cast<HWND>(nWindowHandle);
    1203             :             #endif
    1204           0 :             SolarMutexGuard aGuard;
    1205             :             try
    1206             :             {
    1207           0 :                 pChildWindow = new WorkWindow( &aParentData );
    1208             :             }
    1209           0 :             catch ( const ::com::sun::star::uno::RuntimeException & rEx )
    1210             :             {
    1211             :                 // system child window could not be created
    1212             :                 OSL_TRACE(
    1213             :                     "VCLXToolkit::createSystemChild: caught %s\n",
    1214             :                     ::rtl::OUStringToOString(
    1215             :                         rEx.Message, RTL_TEXTENCODING_UTF8).getStr());
    1216           0 :                 pChildWindow = NULL;
    1217           0 :             }
    1218             :         }
    1219             :     }
    1220           0 :     else if (nSystemType == com::sun::star::lang::SystemDependent::SYSTEM_JAVA)
    1221             :     {
    1222           0 :         SolarMutexGuard aGuard;
    1223           0 :         pChildWindow = new WorkWindow(0, Parent);
    1224             :     }
    1225             : 
    1226           0 :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xPeer;
    1227           0 :     if ( pChildWindow )
    1228             :     {
    1229           0 :         VCLXTopWindow* pPeer = new VCLXTopWindow(true);
    1230           0 :         SolarMutexGuard aGuard;
    1231           0 :         pPeer->SetWindow( pChildWindow );
    1232           0 :         xPeer = pPeer;
    1233             :     }
    1234             : 
    1235           0 :     return xPeer;
    1236             : }
    1237             : 
    1238             : // ::com::sun::star::awt::XMessageBoxFactory
    1239           0 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMessageBox > SAL_CALL VCLXToolkit::createMessageBox(
    1240             :     const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& aParent,
    1241             :     const ::com::sun::star::awt::Rectangle& aPosSize,
    1242             :     const ::rtl::OUString& aType,
    1243             :     ::sal_Int32 aButtons,
    1244             :     const ::rtl::OUString& aTitle,
    1245             :     const ::rtl::OUString& aMessage ) throw (::com::sun::star::uno::RuntimeException)
    1246             : {
    1247           0 :     ::com::sun::star::awt::WindowDescriptor aDescriptor;
    1248             : 
    1249           0 :     sal_Int32 nWindowAttributes = css::awt::WindowAttribute::BORDER|css::awt::WindowAttribute::MOVEABLE|css::awt::WindowAttribute::CLOSEABLE;
    1250             : 
    1251             :     // Map button definitions to window attributes
    1252           0 :     if (( aButtons & 0x0000ffffL ) == css::awt::MessageBoxButtons::BUTTONS_OK )
    1253           0 :         nWindowAttributes |= css::awt::VclWindowPeerAttribute::OK;
    1254           0 :     else if (( aButtons & 0x0000ffffL ) == css::awt::MessageBoxButtons::BUTTONS_OK_CANCEL )
    1255           0 :         nWindowAttributes |= css::awt::VclWindowPeerAttribute::OK_CANCEL;
    1256           0 :     else if (( aButtons & 0x0000ffffL ) == css::awt::MessageBoxButtons::BUTTONS_YES_NO )
    1257           0 :         nWindowAttributes |= css::awt::VclWindowPeerAttribute::YES_NO;
    1258           0 :     else if (( aButtons & 0x0000ffffL ) == css::awt::MessageBoxButtons::BUTTONS_YES_NO_CANCEL )
    1259           0 :         nWindowAttributes |= css::awt::VclWindowPeerAttribute::YES_NO_CANCEL;
    1260           0 :     else if (( aButtons & 0x0000ffffL ) == css::awt::MessageBoxButtons::BUTTONS_RETRY_CANCEL )
    1261           0 :         nWindowAttributes |= css::awt::VclWindowPeerAttribute::RETRY_CANCEL;
    1262             : 
    1263             :     // Map default button definitions to window attributes
    1264           0 :     if (sal_Int32( aButtons & 0xffff0000L ) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_OK )
    1265           0 :         nWindowAttributes |= css::awt::VclWindowPeerAttribute::DEF_OK;
    1266           0 :     else if (sal_Int32( aButtons & 0xffff0000L ) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_CANCEL )
    1267           0 :         nWindowAttributes |= css::awt::VclWindowPeerAttribute::DEF_CANCEL;
    1268           0 :     else if (sal_Int32( aButtons & 0xffff0000L ) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_YES )
    1269           0 :         nWindowAttributes |= css::awt::VclWindowPeerAttribute::DEF_YES;
    1270           0 :     else if (sal_Int32( aButtons & 0xffff0000L ) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_NO )
    1271           0 :         nWindowAttributes |= css::awt::VclWindowPeerAttribute::DEF_NO;
    1272           0 :     else if (sal_Int32( aButtons & 0xffff0000L ) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_RETRY )
    1273           0 :         nWindowAttributes |= css::awt::VclWindowPeerAttribute::DEF_RETRY;
    1274             : 
    1275             :     // No more bits for VclWindowPeerAttribute possible. Mapping must be
    1276             :     // done explicitly using VCL methods
    1277           0 :     WinBits nAddWinBits( 0 );
    1278           0 :     if (( aButtons & 0x0000ffffL ) == css::awt::MessageBoxButtons::BUTTONS_ABORT_IGNORE_RETRY )
    1279           0 :         nAddWinBits |= WB_ABORT_RETRY_IGNORE;
    1280           0 :     if ( sal_Int32( aButtons & 0xffff0000L ) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_IGNORE )
    1281           0 :         nAddWinBits |= WB_DEF_IGNORE;
    1282             : 
    1283           0 :     aDescriptor.Type              = css::awt::WindowClass_MODALTOP;
    1284           0 :     aDescriptor.WindowServiceName = aType;
    1285           0 :     aDescriptor.ParentIndex       = -1;
    1286           0 :     aDescriptor.Parent            = aParent;
    1287           0 :     aDescriptor.Bounds            = aPosSize;
    1288           0 :     aDescriptor.WindowAttributes  = nWindowAttributes;
    1289             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMessageBox > xMsgBox(
    1290           0 :         ImplCreateWindow( aDescriptor, nAddWinBits ), css::uno::UNO_QUERY );
    1291           0 :     css::uno::Reference< css::awt::XWindow > xWindow( xMsgBox, css::uno::UNO_QUERY );
    1292           0 :     if ( xMsgBox.is() && xWindow.is() )
    1293             :     {
    1294           0 :         Window * pWindow = VCLUnoHelper::GetWindow( xWindow );
    1295           0 :         if ( pWindow )
    1296             :         {
    1297           0 :             SolarMutexGuard aGuard;
    1298           0 :             xMsgBox->setCaptionText( aTitle );
    1299           0 :             xMsgBox->setMessageText( aMessage );
    1300             :         }
    1301             :     }
    1302             : 
    1303           0 :     return xMsgBox;
    1304             : }
    1305             : 
    1306           0 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureRecognizer > SAL_CALL VCLXToolkit::getDragGestureRecognizer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& window ) throw(::com::sun::star::uno::RuntimeException)
    1307             : {
    1308           0 :     Window * pWindow = VCLUnoHelper::GetWindow( window );
    1309             : 
    1310           0 :     if( pWindow )
    1311           0 :         return pWindow->GetDragGestureRecognizer();
    1312             : 
    1313           0 :     return ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureRecognizer >();
    1314             : }
    1315             : 
    1316           0 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource > SAL_CALL VCLXToolkit::getDragSource( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& window ) throw(::com::sun::star::uno::RuntimeException)
    1317             : {
    1318           0 :     Window * pWindow = VCLUnoHelper::GetWindow( window );
    1319             : 
    1320           0 :     if( pWindow )
    1321           0 :         return pWindow->GetDragSource();
    1322             : 
    1323           0 :     return ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource >();
    1324             : }
    1325             : 
    1326         909 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget > SAL_CALL VCLXToolkit::getDropTarget( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& window ) throw(::com::sun::star::uno::RuntimeException)
    1327             : {
    1328         909 :     Window * pWindow = VCLUnoHelper::GetWindow( window );
    1329             : 
    1330         909 :     if( pWindow )
    1331         909 :         return pWindow->GetDropTarget();
    1332             : 
    1333           0 :     return ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget >();
    1334             : }
    1335             : 
    1336           0 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > SAL_CALL VCLXToolkit::getClipboard( const ::rtl::OUString& clipboardName ) throw(::com::sun::star::uno::RuntimeException)
    1337             : {
    1338           0 :     if( clipboardName.isEmpty() )
    1339             :     {
    1340           0 :         if( !mxClipboard.is() )
    1341             :         {
    1342           0 :             ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
    1343           0 :             if ( xFactory.is() )
    1344             :             {
    1345             :                 // remember clipboard here
    1346             :                 mxClipboard = ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > (
    1347           0 :                     xFactory->createInstance( ::rtl::OUString("com.sun.star.datatransfer.clipboard.SystemClipboard") ), ::com::sun::star::uno::UNO_QUERY );
    1348           0 :             }
    1349             :         }
    1350             : 
    1351           0 :         return mxClipboard;
    1352             :     }
    1353             : 
    1354           0 :     else if( clipboardName == "Selection" )
    1355             :     {
    1356           0 :         return mxSelection;
    1357             :     }
    1358             : 
    1359           0 :     return ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >();
    1360             : }
    1361             : 
    1362             : // XServiceInfo
    1363           0 : ::rtl::OUString VCLXToolkit::getImplementationName() throw(::com::sun::star::uno::RuntimeException)
    1364             : {
    1365           0 :     return rtl::OUString("stardiv.Toolkit.VCLXToolkit");
    1366             : }
    1367             : 
    1368           0 : sal_Bool VCLXToolkit::supportsService( const ::rtl::OUString& rServiceName ) throw(::com::sun::star::uno::RuntimeException)
    1369             : {
    1370           0 :     ::osl::MutexGuard aGuard( GetMutex() );
    1371             : 
    1372           0 :     ::com::sun::star::uno::Sequence< ::rtl::OUString > aSNL = getSupportedServiceNames();
    1373           0 :     const ::rtl::OUString* pArray = aSNL.getConstArray();
    1374           0 :     const ::rtl::OUString* pArrayEnd = aSNL.getConstArray();
    1375           0 :     for (; pArray != pArrayEnd; ++pArray )
    1376           0 :         if( *pArray == rServiceName )
    1377           0 :             break;
    1378             : 
    1379           0 :     return pArray != pArrayEnd;
    1380             : }
    1381             : 
    1382           0 : ::com::sun::star::uno::Sequence< ::rtl::OUString > VCLXToolkit::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException)
    1383             : {
    1384           0 :     ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( szServiceName2_Toolkit ) );
    1385           0 :     return ::com::sun::star::uno::Sequence< ::rtl::OUString >( &aServiceName, 1);
    1386             : }
    1387             : 
    1388             : // css::awt::XExtendedToolkit:
    1389             : 
    1390             : // virtual
    1391           0 : ::sal_Int32 SAL_CALL VCLXToolkit::getTopWindowCount()
    1392             :     throw (::css::uno::RuntimeException)
    1393             : {
    1394           0 :     return static_cast< ::sal_Int32 >(::Application::GetTopWindowCount());
    1395             :         // XXX  numeric overflow
    1396             : }
    1397             : 
    1398             : // virtual
    1399             : ::css::uno::Reference< ::css::awt::XTopWindow > SAL_CALL
    1400           0 : VCLXToolkit::getTopWindow(::sal_Int32 nIndex)
    1401             :     throw (::css::uno::RuntimeException)
    1402             : {
    1403           0 :     ::Window * p = ::Application::GetTopWindow(static_cast< long >(nIndex));
    1404             :         // XXX  numeric overflow
    1405             :     return ::css::uno::Reference< ::css::awt::XTopWindow >(
    1406           0 :         p == 0 ? 0 : static_cast< ::css::awt::XWindow * >(p->GetWindowPeer()),
    1407           0 :         ::css::uno::UNO_QUERY);
    1408             : }
    1409             : 
    1410             : // virtual
    1411             : ::css::uno::Reference< ::css::awt::XTopWindow > SAL_CALL
    1412           0 : VCLXToolkit::getActiveTopWindow() throw (::css::uno::RuntimeException)
    1413             : {
    1414           0 :     ::Window * p = ::Application::GetActiveTopWindow();
    1415             :     return ::css::uno::Reference< ::css::awt::XTopWindow >(
    1416           0 :         p == 0 ? 0 : static_cast< ::css::awt::XWindow * >(p->GetWindowPeer()),
    1417           0 :         ::css::uno::UNO_QUERY);
    1418             : }
    1419             : 
    1420             : // virtual
    1421           0 : void SAL_CALL VCLXToolkit::addTopWindowListener(
    1422             :     ::css::uno::Reference< ::css::awt::XTopWindowListener > const & rListener)
    1423             :     throw (::css::uno::RuntimeException)
    1424             : {
    1425             :     OSL_ENSURE(rListener.is(), "Null rListener");
    1426           0 :     ::osl::ClearableMutexGuard aGuard(rBHelper.rMutex);
    1427           0 :     if (rBHelper.bDisposed || rBHelper.bInDispose)
    1428             :     {
    1429           0 :         aGuard.clear();
    1430           0 :         rListener->disposing(
    1431             :             ::css::lang::EventObject(
    1432           0 :                 static_cast< ::cppu::OWeakObject * >(this)));
    1433             :     }
    1434           0 :     else if (m_aTopWindowListeners.addInterface(rListener) == 1
    1435           0 :              && !m_bEventListener)
    1436             :     {
    1437           0 :         m_bEventListener = true;
    1438           0 :         ::Application::AddEventListener(m_aEventListenerLink);
    1439           0 :     }
    1440           0 : }
    1441             : 
    1442             : // virtual
    1443           0 : void SAL_CALL VCLXToolkit::removeTopWindowListener(
    1444             :     ::css::uno::Reference< ::css::awt::XTopWindowListener > const & rListener)
    1445             :     throw (::css::uno::RuntimeException)
    1446             : {
    1447           0 :     ::osl::MutexGuard aGuard(rBHelper.rMutex);
    1448           0 :     if (!(rBHelper.bDisposed || rBHelper.bInDispose)
    1449           0 :         && m_aTopWindowListeners.removeInterface(rListener) == 0
    1450           0 :         && m_aFocusListeners.getLength() == 0 && m_bEventListener)
    1451             :     {
    1452           0 :         ::Application::RemoveEventListener(m_aEventListenerLink);
    1453           0 :         m_bEventListener = false;
    1454           0 :     }
    1455           0 : }
    1456             : 
    1457             : // virtual
    1458           0 : void SAL_CALL VCLXToolkit::addKeyHandler(
    1459             :     ::css::uno::Reference< ::css::awt::XKeyHandler > const & rHandler)
    1460             :     throw (::css::uno::RuntimeException)
    1461             : {
    1462             :     OSL_ENSURE(rHandler.is(), "Null rHandler");
    1463           0 :     ::osl::ClearableMutexGuard aGuard(rBHelper.rMutex);
    1464           0 :     if (rBHelper.bDisposed || rBHelper.bInDispose)
    1465             :     {
    1466           0 :         aGuard.clear();
    1467           0 :         rHandler->disposing(
    1468             :             ::css::lang::EventObject(
    1469           0 :                 static_cast< ::cppu::OWeakObject * >(this)));
    1470             :     }
    1471           0 :     else if (m_aKeyHandlers.addInterface(rHandler) == 1 && !m_bKeyListener)
    1472             :     {
    1473           0 :         m_bKeyListener = true;
    1474           0 :         ::Application::AddKeyListener(m_aKeyListenerLink);
    1475           0 :     }
    1476           0 : }
    1477             : 
    1478             : // virtual
    1479           0 : void SAL_CALL VCLXToolkit::removeKeyHandler(
    1480             :     ::css::uno::Reference< ::css::awt::XKeyHandler > const & rHandler)
    1481             :     throw (::css::uno::RuntimeException)
    1482             : {
    1483           0 :     ::osl::MutexGuard aGuard(rBHelper.rMutex);
    1484           0 :     if (!(rBHelper.bDisposed || rBHelper.bInDispose)
    1485           0 :         && m_aKeyHandlers.removeInterface(rHandler) == 0 && m_bKeyListener)
    1486             :     {
    1487           0 :         ::Application::RemoveKeyListener(m_aKeyListenerLink);
    1488           0 :         m_bKeyListener = false;
    1489           0 :     }
    1490           0 : }
    1491             : 
    1492             : // virtual
    1493           0 : void SAL_CALL VCLXToolkit::addFocusListener(
    1494             :     ::css::uno::Reference< ::css::awt::XFocusListener > const & rListener)
    1495             :     throw (::css::uno::RuntimeException)
    1496             : {
    1497             :     OSL_ENSURE(rListener.is(), "Null rListener");
    1498           0 :     ::osl::ClearableMutexGuard aGuard(rBHelper.rMutex);
    1499           0 :     if (rBHelper.bDisposed || rBHelper.bInDispose)
    1500             :     {
    1501           0 :         aGuard.clear();
    1502           0 :         rListener->disposing(
    1503             :             ::css::lang::EventObject(
    1504           0 :                 static_cast< ::cppu::OWeakObject * >(this)));
    1505             :     }
    1506           0 :     else if (m_aFocusListeners.addInterface(rListener) == 1
    1507           0 :              && !m_bEventListener)
    1508             :     {
    1509           0 :         m_bEventListener = true;
    1510           0 :         ::Application::AddEventListener(m_aEventListenerLink);
    1511           0 :     }
    1512           0 : }
    1513             : 
    1514             : // virtual
    1515           0 : void SAL_CALL VCLXToolkit::removeFocusListener(
    1516             :     ::css::uno::Reference< ::css::awt::XFocusListener > const & rListener)
    1517             :     throw (::css::uno::RuntimeException)
    1518             : {
    1519           0 :     ::osl::MutexGuard aGuard(rBHelper.rMutex);
    1520           0 :     if (!(rBHelper.bDisposed || rBHelper.bInDispose)
    1521           0 :         && m_aFocusListeners.removeInterface(rListener) == 0
    1522           0 :         && m_aTopWindowListeners.getLength() == 0 && m_bEventListener)
    1523             :     {
    1524           0 :         ::Application::RemoveEventListener(m_aEventListenerLink);
    1525           0 :         m_bEventListener = false;
    1526           0 :     }
    1527           0 : }
    1528             : 
    1529             : // virtual
    1530           0 : void SAL_CALL VCLXToolkit::fireFocusGained(
    1531             :     ::com::sun::star::uno::Reference<
    1532             :     ::com::sun::star::uno::XInterface > const &)
    1533             :     throw (::com::sun::star::uno::RuntimeException)
    1534             : {
    1535           0 : }
    1536             : 
    1537             : // virtual
    1538           0 : void SAL_CALL VCLXToolkit::fireFocusLost(
    1539             :     ::com::sun::star::uno::Reference<
    1540             :     ::com::sun::star::uno::XInterface > const &)
    1541             :     throw (::com::sun::star::uno::RuntimeException)
    1542             : {
    1543           0 : }
    1544             : 
    1545             : 
    1546           0 : IMPL_LINK(VCLXToolkit, eventListenerHandler, ::VclSimpleEvent const *, pEvent)
    1547             : {
    1548           0 :     switch (pEvent->GetId())
    1549             :     {
    1550             :     case VCLEVENT_WINDOW_SHOW:
    1551             :         callTopWindowListeners(
    1552           0 :             pEvent, &::css::awt::XTopWindowListener::windowOpened);
    1553           0 :         break;
    1554             :     case VCLEVENT_WINDOW_HIDE:
    1555             :         callTopWindowListeners(
    1556           0 :             pEvent, &::css::awt::XTopWindowListener::windowClosed);
    1557           0 :         break;
    1558             :     case VCLEVENT_WINDOW_ACTIVATE:
    1559             :         callTopWindowListeners(
    1560           0 :             pEvent, &::css::awt::XTopWindowListener::windowActivated);
    1561           0 :         break;
    1562             :     case VCLEVENT_WINDOW_DEACTIVATE:
    1563             :         callTopWindowListeners(
    1564           0 :             pEvent, &::css::awt::XTopWindowListener::windowDeactivated);
    1565           0 :         break;
    1566             :     case VCLEVENT_WINDOW_CLOSE:
    1567             :         callTopWindowListeners(
    1568           0 :             pEvent, &::css::awt::XTopWindowListener::windowClosing);
    1569           0 :         break;
    1570             :     case VCLEVENT_WINDOW_GETFOCUS:
    1571           0 :         callFocusListeners(pEvent, true);
    1572           0 :         break;
    1573             :     case VCLEVENT_WINDOW_LOSEFOCUS:
    1574           0 :         callFocusListeners(pEvent, false);
    1575           0 :         break;
    1576             :     case VCLEVENT_WINDOW_MINIMIZE:
    1577             :         callTopWindowListeners(
    1578           0 :             pEvent, &::css::awt::XTopWindowListener::windowMinimized);
    1579           0 :         break;
    1580             :     case VCLEVENT_WINDOW_NORMALIZE:
    1581             :         callTopWindowListeners(
    1582           0 :             pEvent, &::css::awt::XTopWindowListener::windowNormalized);
    1583           0 :         break;
    1584             :     }
    1585           0 :     return 0;
    1586             : }
    1587             : 
    1588           0 : IMPL_LINK(VCLXToolkit, keyListenerHandler, ::VclSimpleEvent const *, pEvent)
    1589             : {
    1590           0 :     switch (pEvent->GetId())
    1591             :     {
    1592             :     case VCLEVENT_WINDOW_KEYINPUT:
    1593           0 :         return callKeyHandlers(pEvent, true);
    1594             :     case VCLEVENT_WINDOW_KEYUP:
    1595           0 :         return callKeyHandlers(pEvent, false);
    1596             :     }
    1597           0 :     return 0;
    1598             : }
    1599             : 
    1600           0 : void VCLXToolkit::callTopWindowListeners(
    1601             :     ::VclSimpleEvent const * pEvent,
    1602             :     void (SAL_CALL ::css::awt::XTopWindowListener::* pFn)(
    1603             :         ::css::lang::EventObject const &))
    1604             : {
    1605             :     ::Window * pWindow
    1606           0 :           = static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow();
    1607           0 :     if (pWindow->IsTopWindow())
    1608             :     {
    1609             :         ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > >
    1610           0 :               aListeners(m_aTopWindowListeners.getElements());
    1611           0 :         if (aListeners.hasElements())
    1612             :         {
    1613             :             ::css::lang::EventObject aAwtEvent(
    1614           0 :                 static_cast< ::css::awt::XWindow * >(pWindow->GetWindowPeer()));
    1615           0 :             for (::sal_Int32 i = 0; i < aListeners.getLength(); ++i)
    1616             :             {
    1617             :                 ::css::uno::Reference< ::css::awt::XTopWindowListener >
    1618           0 :                       xListener(aListeners[i], ::css::uno::UNO_QUERY);
    1619             :                 try
    1620             :                 {
    1621           0 :                     (xListener.get()->*pFn)(aAwtEvent);
    1622             :                 }
    1623           0 :                 catch (const ::css::uno::RuntimeException & rEx)
    1624             :                 {
    1625             :                     OSL_TRACE(
    1626             :                         "VCLXToolkit::callTopWindowListeners: caught %s\n",
    1627             :                         ::rtl::OUStringToOString(
    1628             :                             rEx.Message, RTL_TEXTENCODING_UTF8).getStr());
    1629             :                 }
    1630           0 :             }
    1631           0 :         }
    1632             :     }
    1633           0 : }
    1634             : 
    1635           0 : long VCLXToolkit::callKeyHandlers(::VclSimpleEvent const * pEvent,
    1636             :                                   bool bPressed)
    1637             : {
    1638             :     ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > >
    1639           0 :           aHandlers(m_aKeyHandlers.getElements());
    1640             : 
    1641           0 :     if (aHandlers.hasElements())
    1642             :     {
    1643           0 :         ::Window * pWindow = static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow();
    1644             : 
    1645             :         // See implementation in vclxwindow.cxx for mapping between VCL and UNO AWT event
    1646             :         ::KeyEvent * pKeyEvent = static_cast< ::KeyEvent * >(
    1647           0 :             static_cast< ::VclWindowEvent const * >(pEvent)->GetData());
    1648             :         ::css::awt::KeyEvent aAwtEvent(
    1649           0 :             static_cast< ::css::awt::XWindow * >(pWindow->GetWindowPeer()),
    1650           0 :             (pKeyEvent->GetKeyCode().IsShift()
    1651             :              ? ::css::awt::KeyModifier::SHIFT : 0)
    1652           0 :             | (pKeyEvent->GetKeyCode().IsMod1()
    1653             :                ? ::css::awt::KeyModifier::MOD1 : 0)
    1654           0 :             | (pKeyEvent->GetKeyCode().IsMod2()
    1655             :                ? ::css::awt::KeyModifier::MOD2 : 0)
    1656           0 :             | (pKeyEvent->GetKeyCode().IsMod3()
    1657             :                ? ::css::awt::KeyModifier::MOD3 : 0),
    1658           0 :             pKeyEvent->GetKeyCode().GetCode(), pKeyEvent->GetCharCode(),
    1659             :             sal::static_int_cast< sal_Int16 >(
    1660           0 :                 pKeyEvent->GetKeyCode().GetFunction()));
    1661           0 :         for (::sal_Int32 i = 0; i < aHandlers.getLength(); ++i)
    1662             :         {
    1663             :             ::css::uno::Reference< ::css::awt::XKeyHandler > xHandler(
    1664           0 :                 aHandlers[i], ::css::uno::UNO_QUERY);
    1665             :             try
    1666             :             {
    1667           0 :                 if ((bPressed ? xHandler->keyPressed(aAwtEvent)
    1668           0 :                       : xHandler->keyReleased(aAwtEvent)))
    1669           0 :                     return 1;
    1670             :             }
    1671           0 :             catch (const ::css::uno::RuntimeException & rEx)
    1672             :             {
    1673             :                 OSL_TRACE(
    1674             :                     "VCLXToolkit::callKeyHandlers: caught %s\n",
    1675             :                     ::rtl::OUStringToOString(
    1676             :                        rEx.Message, RTL_TEXTENCODING_UTF8).getStr());
    1677             :             }
    1678           0 :         }
    1679             :     }
    1680           0 :     return 0;
    1681             : }
    1682             : 
    1683           0 : void VCLXToolkit::callFocusListeners(::VclSimpleEvent const * pEvent,
    1684             :                                      bool bGained)
    1685             : {
    1686             :     ::Window * pWindow
    1687           0 :           = static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow();
    1688           0 :     if (pWindow->IsTopWindow())
    1689             :     {
    1690             :         ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > >
    1691           0 :               aListeners(m_aFocusListeners.getElements());
    1692           0 :         if (aListeners.hasElements())
    1693             :         {
    1694             :             // Ignore the interior of compound controls when determining the
    1695             :             // window that gets the focus next (see implementation in
    1696             :             // vclxwindow.cxx for mapping between VCL and UNO AWT event):
    1697           0 :             ::css::uno::Reference< css::uno::XInterface > xNext;
    1698           0 :             ::Window * pFocus = ::Application::GetFocusWindow();
    1699           0 :             for (::Window * p = pFocus; p != 0; p = p->GetParent())
    1700           0 :                 if (!p->IsCompoundControl())
    1701             :                 {
    1702           0 :                     pFocus = p;
    1703           0 :                     break;
    1704             :                 }
    1705           0 :             if (pFocus != 0)
    1706           0 :                 xNext = pFocus->GetComponentInterface(true);
    1707             :             ::css::awt::FocusEvent aAwtEvent(
    1708           0 :                 static_cast< ::css::awt::XWindow * >(pWindow->GetWindowPeer()),
    1709           0 :                 pWindow->GetGetFocusFlags(), xNext, false);
    1710           0 :             for (::sal_Int32 i = 0; i < aListeners.getLength(); ++i)
    1711             :             {
    1712             :                 ::css::uno::Reference< ::css::awt::XFocusListener > xListener(
    1713           0 :                     aListeners[i], ::css::uno::UNO_QUERY);
    1714             :                 try
    1715             :                 {
    1716           0 :                     bGained ? xListener->focusGained(aAwtEvent)
    1717           0 :                         : xListener->focusLost(aAwtEvent);
    1718             :                 }
    1719           0 :                 catch (const ::css::uno::RuntimeException & rEx)
    1720             :                 {
    1721             :                     OSL_TRACE(
    1722             :                         "VCLXToolkit::callFocusListeners: caught %s\n",
    1723             :                         ::rtl::OUStringToOString(
    1724             :                             rEx.Message, RTL_TEXTENCODING_UTF8).getStr());
    1725             :                 }
    1726           0 :             }
    1727           0 :         }
    1728             :     }
    1729           0 : }
    1730             : 
    1731             : // css::awt::XReschedule:
    1732             : 
    1733           0 : void SAL_CALL VCLXToolkit::reschedule()
    1734             :     throw (::com::sun::star::uno::RuntimeException)
    1735             : {
    1736           0 :     Application::Reschedule(true);
    1737           0 : }
    1738             : 
    1739             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10