summaryrefslogtreecommitdiff
path: root/vcl/os2/source/app
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/os2/source/app')
-rw-r--r--vcl/os2/source/app/makefile.mk96
-rw-r--r--vcl/os2/source/app/salinst.cxx754
-rw-r--r--vcl/os2/source/app/sallang.cxx406
-rw-r--r--vcl/os2/source/app/salshl.cxx84
-rw-r--r--vcl/os2/source/app/salsound.cxx421
-rw-r--r--vcl/os2/source/app/salsys.cxx287
-rw-r--r--vcl/os2/source/app/saltimer.cxx122
7 files changed, 2170 insertions, 0 deletions
diff --git a/vcl/os2/source/app/makefile.mk b/vcl/os2/source/app/makefile.mk
new file mode 100644
index 000000000000..e83b8f3a4f11
--- /dev/null
+++ b/vcl/os2/source/app/makefile.mk
@@ -0,0 +1,96 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=SV
+TARGET=salapp
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= salmain.cxx \
+ salshl.cxx \
+ salinst.cxx \
+ sallang.cxx \
+ saltimer.cxx \
+ salsound.cxx \
+ salsys.cxx
+
+OBJFILES= $(OBJ)$/salmain.obj
+
+SLOFILES= $(SLO)$/salshl.obj \
+ $(SLO)$/salinst.obj \
+ $(SLO)$/sallang.obj \
+ $(SLO)$/saltimer.obj \
+ $(SLO)$/salsound.obj \
+ $(SLO)$/salsys.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/vcl/os2/source/app/salinst.cxx b/vcl/os2/source/app/salinst.cxx
new file mode 100644
index 000000000000..8a3ef0d1315f
--- /dev/null
+++ b/vcl/os2/source/app/salinst.cxx
@@ -0,0 +1,754 @@
+/*************************************************************************
+ *
+ * $RCSfile: salinst.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define INCL_DOSMISC
+#define INCL_DOSMODULEMGR
+#define INCL_DOSPROCESS
+
+#include <string.h>
+#include <tools/svpm.h>
+#include <process.h>
+
+#define _SV_SALINST_CXX
+
+#ifndef _VOS_MUTEX_HXX
+#include <vos/mutex.hxx>
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_SALIDS_HRC
+#include <salids.hrc>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_SALTIMER_HXX
+#include <saltimer.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+
+#ifndef _SV_TIMER_HXX
+#include <timer.hxx>
+#endif
+
+#define SVMODULENAME "VCL" MAKE_NUMSTR( SUPD ) __DLLEXTENSION
+
+// =======================================================================
+
+void SalSetExceptionHandler( SALEXCEPTIONPROC pProc )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SalAbort( const XubString& rErrorText )
+{
+}
+
+// -----------------------------------------------------------------------
+
+ULONG ImplSalGetCurrentThreadId()
+{
+ PTIB pptib = NULL;
+ PPIB pppib = NULL;
+
+ DosGetInfoBlocks( &pptib, &pppib );
+ return pptib->tib_ptib2->tib2_ultid;
+}
+
+// =======================================================================
+
+class SalYieldMutex : public NAMESPACE_VOS(OMutex)
+{
+public:
+ SalInstanceData* mpInstData;
+ ULONG mnCount;
+ ULONG mnWaitCount;
+ ULONG mnThreadId;
+
+public:
+ SalYieldMutex( SalInstanceData* pInstData );
+
+ virtual void acquire();
+ virtual void release();
+ virtual Boolean tryToAcquire();
+
+ ULONG GetAcquireCount( ULONG nThreadId );
+};
+
+// -----------------------------------------------------------------------
+
+SalYieldMutex::SalYieldMutex( SalInstanceData* pInstData )
+{
+ mpInstData = pInstData;
+ mnCount = 0;
+ mnThreadId = 0;
+ mnWaitCount = 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SalYieldMutex::acquire()
+{
+ OMutex::acquire();
+ mnCount++;
+ mnThreadId = ImplSalGetCurrentThreadId();
+}
+
+// -----------------------------------------------------------------------
+
+void SalYieldMutex::release()
+{
+ ULONG nThreadId = ImplSalGetCurrentThreadId();
+ if ( mnThreadId != nThreadId )
+ OMutex::release();
+ else
+ {
+ SalData* pSalData = GetSalData();
+ if ( pSalData->mnAppThreadId != nThreadId )
+ {
+ NAMESPACE_VOS(OGuard) aGuard( mpInstData->mpSalWaitMutex );
+ if ( mnCount == 1 )
+ {
+ if ( mnWaitCount && WinPostMsg( mpInstData->mhComWnd, SAL_MSG_RELEASEWAITYIELD, 0, 0 ) )
+ mnWaitCount--;
+ mnThreadId = 0;
+ }
+ mnCount--;
+ OMutex::release();
+ }
+ else
+ {
+ if ( mnCount == 1 )
+ mnThreadId = 0;
+ mnCount--;
+ OMutex::release();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Boolean SalYieldMutex::tryToAcquire()
+{
+ if ( OMutex::tryToAcquire() )
+ {
+ mnCount++;
+ mnThreadId = ImplSalGetCurrentThreadId();
+ return True;
+ }
+ else
+ return False;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG SalYieldMutex::GetAcquireCount( ULONG nThreadId )
+{
+ if ( nThreadId == mnThreadId )
+ return mnCount;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplSalYieldMutexTryToAcquire()
+{
+ SalData* pSalData = GetSalData();
+ if ( pSalData->mpFirstInstance )
+ return pSalData->mpFirstInstance->maInstData.mpSalYieldMutex->tryToAcquire();
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSalYieldMutexAcquire()
+{
+ SalData* pSalData = GetSalData();
+ if ( pSalData->mpFirstInstance )
+ pSalData->mpFirstInstance->maInstData.mpSalYieldMutex->acquire();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSalYieldMutexRelease()
+{
+ SalData* pSalData = GetSalData();
+ if ( pSalData->mpFirstInstance )
+ pSalData->mpFirstInstance->maInstData.mpSalYieldMutex->release();
+}
+
+// -----------------------------------------------------------------------
+
+#ifdef DBG_UTIL
+
+void ImplDbgTestSolarMutex()
+{
+ SalData* pSalData = GetSalData();
+ ULONG nCurThreadId = ImplSalGetCurrentThreadId();
+ if ( pSalData->mnAppThreadId != nCurThreadId )
+ {
+ if ( pSalData->mpFirstInstance )
+ {
+ SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->maInstData.mpSalYieldMutex;
+ if ( pYieldMutex->mnThreadId != nCurThreadId )
+ {
+ DBG_ERROR( "SolarMutex not locked, and not thread save code in VCL is called from outside of the main thread" );
+ }
+ }
+ }
+ else
+ {
+ if ( pSalData->mpFirstInstance )
+ {
+ SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->maInstData.mpSalYieldMutex;
+ if ( pYieldMutex->mnThreadId != nCurThreadId )
+ {
+ DBG_ERROR( "SolarMutex not locked in the main thread" );
+ }
+ }
+ }
+}
+
+#endif
+
+// =======================================================================
+
+void InitSalSystemData()
+{
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplSalYield( BOOL bWait, BOOL bMainThread, SalYieldMutex* pYieldMutex )
+{
+ QMSG aMsg;
+ QMSG aTmpMsg;
+ BOOL bDispatch = FALSE;
+ USHORT nPostReleaseWait = 0;
+ static QMSG* pMsg = NULL;
+ SalData* pSalData = GetSalData();
+
+ do
+ {
+ if ( !pMsg )
+ {
+ BOOL bQuit = FALSE;
+ if ( bWait )
+ {
+ if ( WinGetMsg( pSalData->mhAB, &aMsg, 0, 0, 0 ) )
+ pMsg = &aMsg;
+ else
+ bQuit = TRUE;
+ }
+ else
+ {
+ if ( WinPeekMsg( pSalData->mhAB, &aMsg, 0, 0, 0, PM_REMOVE ) )
+ {
+ if ( aMsg.msg == WM_QUIT )
+ bQuit = TRUE;
+ else
+ pMsg = &aMsg;
+ }
+ }
+
+ // ShutDown-Event ausloesen (ist immer dann der Fall,
+ // wenn wir eine Quit-Message bekommen)
+ if ( bQuit && pSalData->mpDefaultFrame )
+ {
+ SalFrame* pDefaultFrame = pSalData->mpDefaultFrame;
+ if ( pDefaultFrame->maFrameData.mpProc( pDefaultFrame->maFrameData.mpInst, pDefaultFrame,
+ SALEVENT_SHUTDOWN, 0 ) )
+ WinCancelShutdown( pSalData->mhAB, FALSE );
+ }
+
+ // ReleaseWaitYield ignorieren wir, da diese fuer andere
+ // Yield-Aufrufe gedacht sind
+ if ( pMsg )
+ {
+ if ( pMsg->msg == SAL_MSG_RELEASEWAITYIELD )
+ {
+ nPostReleaseWait++;
+ pMsg = NULL;
+ continue;
+ }
+ }
+ }
+
+ if ( pMsg )
+ {
+ // Darf ich die Message dispatchen
+ pYieldMutex->mpInstData->mpSalWaitMutex->acquire();
+ if ( pYieldMutex->tryToAcquire() )
+ {
+ pYieldMutex->mpInstData->mpSalWaitMutex->release();
+ bDispatch = TRUE;
+ }
+ else
+ {
+ pYieldMutex->mnWaitCount++;
+ pYieldMutex->mpInstData->mpSalWaitMutex->release();
+ WinGetMsg( pSalData->mhAB, &aTmpMsg, pYieldMutex->mpInstData->mhComWnd, SAL_MSG_RELEASEWAITYIELD, SAL_MSG_RELEASEWAITYIELD );
+ if ( !pMsg )
+ bDispatch = TRUE;
+ }
+ }
+ else
+ bDispatch = TRUE;
+ }
+ while( !bDispatch );
+
+ if ( pMsg )
+ {
+ // acquire ist nicht notwendig, da dies schon in der oberen
+ // Schleife bei tryToAcquire() gemacht wurde
+ QMSG* pTmpMsg = pMsg;
+ pMsg = NULL;
+ WinDispatchMsg( pSalData->mhAB, pTmpMsg );
+ pYieldMutex->release();
+ }
+
+ while ( nPostReleaseWait )
+ {
+ WinPostMsg( pYieldMutex->mpInstData->mhComWnd, SAL_MSG_RELEASEWAITYIELD, 0, 0 );
+ nPostReleaseWait--;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+MRESULT EXPENTRY SalComWndProc( HWND hWnd, PM_ULONG nMsg,
+ MPARAM nMP1, MPARAM nMP2 )
+{
+ switch ( nMsg )
+ {
+ case SAL_MSG_STARTTIMER:
+ ImplSalStartTimer();
+ return 0;
+ case SAL_MSG_CREATEFRAME:
+ return (MRESULT)ImplSalCreateFrame( GetSalData()->mpFirstInstance, (SalFrame*)(ULONG)nMP2, (ULONG)nMP1 );
+ case SAL_MSG_CREATEOBJECT:
+ return (MRESULT)ImplSalCreateObject( GetSalData()->mpFirstInstance, (SalFrame*)(ULONG)nMP2 );
+ case SAL_MSG_THREADYIELD:
+ ImplSalYield( (BOOL)(LONG)nMP1, FALSE, (SalYieldMutex*)(LONG)nMP2 );
+ return 0;
+ }
+
+ return WinDefWindowProc( hWnd, nMsg, nMP1, nMP2 );
+}
+
+// =======================================================================
+
+void InitSalData()
+{
+ SalData* pSalData = new SalData;
+ memset( pSalData, 0, sizeof( SalData ) );
+ SetSalData( pSalData );
+}
+
+// -----------------------------------------------------------------------
+
+void DeInitSalData()
+{
+ SalData* pSalData = GetSalData();
+ if ( pSalData->mpFontMetrics )
+ delete pSalData->mpFontMetrics;
+ delete pSalData;
+ SetSalData( NULL );
+}
+
+// -----------------------------------------------------------------------
+
+void SetFilterCallback( void* pCallback, void* pInst )
+{
+ SalData* pSalData = GetSalData();
+ pSalData->mpFirstInstance->maInstData.mpFilterCallback = pCallback;
+ pSalData->mpFirstInstance->maInstData.mpFilterInst = pInst;
+}
+
+// -----------------------------------------------------------------------
+
+SalInstance* CreateSalInstance()
+{
+ SalData* pSalData = GetSalData();
+ SalInstance* pInst = new SalInstance;
+
+ // determine Module-Handle for SVDLL
+ DosQueryModuleHandle( (PSZ)SVMODULENAME, &aSalShlData.mhMod );
+
+ // determine the os2 version
+ PM_ULONG nMayor;
+ PM_ULONG nMinor;
+ DosQuerySysInfo( QSV_VERSION_MAJOR, QSV_VERSION_MAJOR, &nMayor, sizeof( nMayor ) );
+ DosQuerySysInfo( QSV_VERSION_MINOR, QSV_VERSION_MINOR, &nMinor, sizeof( nMinor ) );
+ aSalShlData.mnVersion = (USHORT)(nMayor*10 + nMinor);
+
+ pSalData->mnAppThreadId = ImplSalGetCurrentThreadId();
+
+ // register frame class
+ if ( !WinRegisterClass( pSalData->mhAB, (PSZ)SAL_FRAME_CLASSNAME,
+ (PFNWP)SalFrameWndProc, CS_HITTEST | CS_MOVENOTIFY,
+ SAL_FRAME_WNDEXTRA ) )
+ {
+ delete pInst;
+ return NULL;
+ }
+
+ // register frame class
+ if ( !WinRegisterClass( pSalData->mhAB, (PSZ)SAL_COM_CLASSNAME,
+ (PFNWP)SalComWndProc, 0, 0 ))
+ {
+ delete pInst;
+ return NULL;
+ }
+
+ HWND hComWnd = WinCreateWindow( HWND_OBJECT, (PSZ)SAL_COM_CLASSNAME,
+ "", 0, 0, 0, 0, 0,
+ HWND_OBJECT, HWND_TOP,
+ 222, NULL, NULL);
+
+ // init system data
+ InitSalSystemData();
+
+ // init instance (only one instance in this version !!!)
+ pSalData->mpFirstInstance = pInst;
+ pInst->maInstData.mhAB = pSalData->mhAB;
+ pInst->maInstData.mhMQ = pSalData->mhMQ;
+ pInst->maInstData.mnArgc = pSalData->mnArgc;
+ pInst->maInstData.mpArgv = pSalData->mpArgv;
+ pInst->maInstData.mhComWnd = hComWnd;
+
+ // AppIcon ermitteln
+ pInst->maInstData.mhAppIcon = WinLoadPointer( HWND_DESKTOP, pSalData->mhAB, 1 );
+ if ( !pInst->maInstData.mhAppIcon )
+ pInst->maInstData.mhAppIcon = ImplLoadPointer( SAL_RESID_ICON_SD );
+
+ return pInst;
+}
+
+// -----------------------------------------------------------------------
+
+void DestroySalInstance( SalInstance* pInst )
+{
+ SalData* pSalData = GetSalData();
+
+ // (only one instance in this version !!!)
+
+#ifdef ENABLE_IME
+ // IME-Daten freigeben
+ if ( pSalData->mpIMEData )
+ ImplReleaseSALIMEData();
+#endif
+
+ // Destroy Dummy Frame
+ if ( pSalData->mpDummyFrame )
+ pInst->DestroyFrame( pSalData->mpDummyFrame );
+
+ // reset instance
+ if ( pSalData->mpFirstInstance == pInst )
+ pSalData->mpFirstInstance = NULL;
+
+ delete pInst;
+}
+
+// -----------------------------------------------------------------------
+
+SalInstance::SalInstance()
+{
+ maInstData.mpFilterCallback = NULL;
+ maInstData.mpFilterInst = NULL;
+
+ maInstData.mpSalWaitMutex = new NAMESPACE_VOS(OMutex);
+ maInstData.mpSalYieldMutex = new SalYieldMutex( &maInstData );
+ maInstData.mpSalYieldMutex->acquire();
+}
+
+// -----------------------------------------------------------------------
+
+SalInstance::~SalInstance()
+{
+ maInstData.mpSalYieldMutex->release();
+ delete maInstData.mpSalYieldMutex;
+ delete maInstData.mpSalWaitMutex;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalInstance::AnyInput( USHORT nType )
+{
+ SalData* pSalData = GetSalData();
+ QMSG aQMSG;
+
+ if ( (nType & (INPUT_ANY)) == INPUT_ANY )
+ {
+ // Any Input
+ if ( WinPeekMsg( pSalData->mhAB, &aQMSG, 0, 0, 0, PM_NOREMOVE ) )
+ return TRUE;
+ }
+ else
+ {
+ if ( nType & INPUT_MOUSE )
+ {
+ // Test auf Mouseinput
+ if ( WinPeekMsg( pSalData->mhAB, &aQMSG, 0,
+ WM_MOUSEFIRST, WM_MOUSELAST, PM_NOREMOVE ) )
+ return TRUE;
+ }
+
+ if ( nType & INPUT_KEYBOARD )
+ {
+ // Test auf Keyinput
+ if ( WinPeekMsg( pSalData->mhAB, &aQMSG, 0,
+ WM_CHAR, WM_CHAR, PM_NOREMOVE ) )
+ return !(SHORT1FROMMP( aQMSG.mp1 ) & KC_KEYUP);
+ }
+
+ if ( nType & INPUT_PAINT )
+ {
+ // Test auf Paintinput
+ if ( WinPeekMsg( pSalData->mhAB, &aQMSG, 0,
+ WM_PAINT, WM_PAINT, PM_NOREMOVE ) )
+ return TRUE;
+ }
+
+ if ( nType & INPUT_TIMER )
+ {
+ // Test auf Timerinput
+ if ( WinPeekMsg( pSalData->mhAB, &aQMSG, 0,
+ WM_TIMER, WM_TIMER, PM_NOREMOVE ) )
+ return TRUE;
+ }
+
+ if ( nType & INPUT_OTHER )
+ {
+ // Test auf sonstigen Input
+ if ( WinPeekMsg( pSalData->mhAB, &aQMSG, 0, 0, 0, PM_NOREMOVE ) )
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::Yield( BOOL bWait )
+{
+ SalYieldMutex* pYieldMutex = maInstData.mpSalYieldMutex;
+ SalData* pSalData = GetSalData();
+ ULONG nCurThreadId = ImplSalGetCurrentThreadId();
+ ULONG nCount = pYieldMutex->GetAcquireCount( nCurThreadId );
+ ULONG n = nCount;
+ while ( n )
+ {
+ pYieldMutex->release();
+ n--;
+ }
+ if ( pSalData->mnAppThreadId != nCurThreadId )
+ {
+ WinSendMsg( maInstData.mhComWnd, SAL_MSG_THREADYIELD,
+ (MPARAM)bWait, (MPARAM)(void*)pYieldMutex );
+
+ n = nCount;
+ while ( n )
+ {
+ pYieldMutex->acquire();
+ n--;
+ }
+ }
+ else
+ {
+ ImplSalYield( bWait, TRUE, pYieldMutex );
+
+ n = nCount;
+ while ( n )
+ {
+ // Wenn wir den Mutex nicht bekommen, muessen wir solange
+ // warten, bis wir Ihn bekommen
+ pYieldMutex->mpInstData->mpSalWaitMutex->acquire();
+ if ( pYieldMutex->tryToAcquire() )
+ {
+ pYieldMutex->mpInstData->mpSalWaitMutex->release();
+ n--;
+ }
+ else
+ {
+ pYieldMutex->mnWaitCount++;
+ pYieldMutex->mpInstData->mpSalWaitMutex->release();
+ QMSG aTmpMsg;
+ WinGetMsg( pSalData->mhAB, &aTmpMsg, maInstData.mhComWnd, SAL_MSG_RELEASEWAITYIELD, SAL_MSG_RELEASEWAITYIELD );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+XubString SalInstance::GetFileName()
+{
+ String aFileName( maInstData.mpArgv[0] );
+ return aFileName;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT SalInstance::GetCommandLineParamCount()
+{
+ return maInstData.mnArgc-1;
+}
+
+// -----------------------------------------------------------------------
+
+XubString SalInstance::GetCommandLineParam( USHORT nParam )
+{
+ if ( nParam < maInstData.mnArgc-1 )
+ {
+ String aParam( maInstData.mpArgv[nParam+1] );
+ return aParam;
+ }
+ else
+ return ImplGetSVEmptyStr();
+}
+
+// -----------------------------------------------------------------------
+
+#ifdef _VOS_NO_NAMESPACE
+IMutex* SalInstance::GetYieldMutex()
+#else
+vos::IMutex* SalInstance::GetYieldMutex()
+#endif
+{
+ return maInstData.mpSalYieldMutex;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG SalInstance::ReleaseYieldMutex()
+{
+ SalYieldMutex* pYieldMutex = maInstData.mpSalYieldMutex;
+ ULONG nCount = pYieldMutex->GetAcquireCount( ImplSalGetCurrentThreadId() );
+ ULONG n = nCount;
+ while ( n )
+ {
+ pYieldMutex->release();
+ n--;
+ }
+
+ return nCount;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::AcquireYieldMutex( ULONG nCount )
+{
+ SalYieldMutex* pYieldMutex = maInstData.mpSalYieldMutex;
+ while ( nCount )
+ {
+ pYieldMutex->acquire();
+ nCount--;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SalFrame* SalInstance::CreateFrame( SalFrame* pParent, USHORT nSalFrameStyle )
+{
+ // Um auf Main-Thread umzuschalten
+ return (SalFrame*)WinSendMsg( maInstData.mhComWnd, SAL_MSG_CREATEFRAME, (MPARAM)nSalFrameStyle, (MPARAM)pParent );
+}
+
+// -----------------------------------------------------------------------
+
+SalObject* SalInstance::CreateObject( SalFrame* pParent )
+{
+ // Um auf Main-Thread umzuschalten
+ return (SalObject*)WinSendMsg( maInstData.mhComWnd, SAL_MSG_CREATEOBJECT, 0, (MPARAM)pParent );
+}
+
+// -----------------------------------------------------------------------
+
+void SalTimer::Start( ULONG nMS )
+{
+ // Um auf Main-Thread umzuschalten
+ SalData* pSalData = GetSalData();
+ pSalData->mnNewTimerMS = nMS;
+ if ( pSalData->mpFirstInstance )
+ {
+ if ( pSalData->mnAppThreadId != ImplSalGetCurrentThreadId() )
+ WinPostMsg( pSalData->mpFirstInstance->maInstData.mhComWnd, SAL_MSG_STARTTIMER, 0, 0 );
+ else
+ WinSendMsg( pSalData->mpFirstInstance->maInstData.mhComWnd, SAL_MSG_STARTTIMER, 0, 0 );
+ }
+ else
+ ImplSalStartTimer();
+}
diff --git a/vcl/os2/source/app/sallang.cxx b/vcl/os2/source/app/sallang.cxx
new file mode 100644
index 000000000000..ba8be275ec4b
--- /dev/null
+++ b/vcl/os2/source/app/sallang.cxx
@@ -0,0 +1,406 @@
+/*************************************************************************
+ *
+ * $RCSfile: sallang.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLS_INTN_HXX
+#include <tools/intn.hxx>
+#endif
+
+#ifndef _SALLANG_HXX
+#include <sallang.hxx>
+#endif
+
+// =======================================================================
+
+// -----------------------------------------------------------------------
+// Danish
+
+static const char* aImplLangDanishTab[LSTR_COUNT] =
+{
+ "Skift", // LSTR_KEY_SHIFT
+ "Ctrl", // LSTR_KEY_CTRL
+ "Alt", // LSTR_KEY_ALT
+ "Op", // LSTR_KEY_UP
+ "Ned", // LSTR_KEY_DOWN
+ "Venstre", // LSTR_KEY_LEFT
+ "H›jre", // LSTR_KEY_RIGHT
+ "Home", // LSTR_KEY_HOME
+ "End", // LSTR_KEY_END
+ "PageUp", // LSTR_KEY_PAGEUP
+ "PageDown", // LSTR_KEY_PAGEDOWN
+ "Enter", // LSTR_KEY_RETURN
+ "Esc", // LSTR_KEY_ESC
+ "Tab", // LSTR_KEY_TAB
+ "Tilbage", // LSTR_KEY_BACKSPACE
+ "Mellemrum", // LSTR_KEY_SPACE
+ "Insert", // LSTR_KEY_INSERT
+ "Delete", // LSTR_KEY_DELETE
+};
+
+// -----------------------------------------------------------------------
+// Dutch (Netherland/Belgian)
+
+static const char* aImplLangDutchTab[LSTR_COUNT] =
+{
+ "Shift", // LSTR_KEY_SHIFT
+ "Ctrl", // LSTR_KEY_CTRL
+ "Alt", // LSTR_KEY_ALT
+ "Boven", // LSTR_KEY_UP
+ "Onder", // LSTR_KEY_DOWN
+ "Links", // LSTR_KEY_LEFT
+ "Links", // LSTR_KEY_RIGHT
+ "Pos1", // LSTR_KEY_HOME
+ "Einde", // LSTR_KEY_END
+ "PageUp", // LSTR_KEY_PAGEUP
+ "PageDown", // LSTR_KEY_PAGEDOWN
+ "Return", // LSTR_KEY_RETURN
+ "Esc", // LSTR_KEY_ESC
+ "Tab", // LSTR_KEY_TAB
+ "Backspace", // LSTR_KEY_BACKSPACE
+ "Spatiebalk", // LSTR_KEY_SPACE
+ "Ins", // LSTR_KEY_INSERT
+ "Verwijderen", // LSTR_KEY_DELETE
+};
+
+// -----------------------------------------------------------------------
+// English (US/UK/AUS/CAN/NZ/EIRE/SAFRICA/JAMAICA/CARRIBEAN)
+
+static const char* aImplLangEnglishTab[LSTR_COUNT] =
+{
+ "Shift", // LSTR_KEY_SHIFT
+ "Ctrl", // LSTR_KEY_CTRL
+ "Alt", // LSTR_KEY_ALT
+ "Up", // LSTR_KEY_UP
+ "Down", // LSTR_KEY_DOWN
+ "Left", // LSTR_KEY_LEFT
+ "Right", // LSTR_KEY_RIGHT
+ "Home", // LSTR_KEY_HOME
+ "End", // LSTR_KEY_END
+ "PageUp", // LSTR_KEY_PAGEUP
+ "PageDown", // LSTR_KEY_PAGEDOWN
+ "Enter", // LSTR_KEY_RETURN
+ "Esc", // LSTR_KEY_ESC
+ "Tab", // LSTR_KEY_TAB
+ "Backspace", // LSTR_KEY_BACKSPACE
+ "Space", // LSTR_KEY_SPACE
+ "Insert", // LSTR_KEY_INSERT
+ "Del", // LSTR_KEY_DELETE
+};
+
+// -----------------------------------------------------------------------
+// Finnish
+
+static const char* aImplLangFinnishTab[LSTR_COUNT] =
+{
+ "Vaihton„ppain", // LSTR_KEY_SHIFT
+ "Ctrl", // LSTR_KEY_CTRL
+ "Alt", // LSTR_KEY_ALT
+ "Yl„", // LSTR_KEY_UP
+ "Ala", // LSTR_KEY_DOWN
+ "Vasen", // LSTR_KEY_LEFT
+ "Oikea", // LSTR_KEY_RIGHT
+ "Home", // LSTR_KEY_HOME
+ "End", // LSTR_KEY_END
+ "PageUp", // LSTR_KEY_PAGEUP
+ "PageDown", // LSTR_KEY_PAGEDOWN
+ "Enter", // LSTR_KEY_RETURN
+ "Esc", // LSTR_KEY_ESC
+ "Sarkain", // LSTR_KEY_TAB
+ "Askelpalautin", // LSTR_KEY_BACKSPACE
+ "V„lin„pp„in", // LSTR_KEY_SPACE
+ "Insert", // LSTR_KEY_INSERT
+ "Delete", // LSTR_KEY_DELETE
+};
+
+// -----------------------------------------------------------------------
+// French (French/Belgian/Canadian/Swiss/Luxenbourg)
+
+static const char* aImplLangFrenchTab[LSTR_COUNT] =
+{
+ "Maj", // LSTR_KEY_SHIFT
+ "Ctrl", // LSTR_KEY_CTRL
+ "Alt", // LSTR_KEY_ALT
+ "Haut", // LSTR_KEY_UP
+ "Bas", // LSTR_KEY_DOWN
+ "Gauche", // LSTR_KEY_LEFT
+ "Droite", // LSTR_KEY_RIGHT
+ "Origine", // LSTR_KEY_HOME
+ "Fin", // LSTR_KEY_END
+ "Pg. Pr‚c", // LSTR_KEY_PAGEUP
+ "Pg. Suiv", // LSTR_KEY_PAGEDOWN
+ "Entr‚e", // LSTR_KEY_RETURN
+ "Esc", // LSTR_KEY_ESC
+ "Tab", // LSTR_KEY_TAB
+ "Ret. Arr", // LSTR_KEY_BACKSPACE
+ "Espace", // LSTR_KEY_SPACE
+ "Ins‚rer", // LSTR_KEY_INSERT
+ "Suppr", // LSTR_KEY_DELETE
+};
+
+// -----------------------------------------------------------------------
+// German (German/Swiss/Austrian/Luxembourg/Liechtenstein)
+
+static const char* aImplLangGermanTab[LSTR_COUNT] =
+{
+ "Umschalt", // LSTR_KEY_SHIFT
+ "Strg", // LSTR_KEY_CTRL
+ "Alt", // LSTR_KEY_ALT
+ "Nach-Oben", // LSTR_KEY_UP
+ "Nach-Unten", // LSTR_KEY_DOWN
+ "Nach-Links", // LSTR_KEY_LEFT
+ "Nach-Rechts", // LSTR_KEY_RIGHT
+ "Pos1", // LSTR_KEY_HOME
+ "Ende", // LSTR_KEY_END
+ "Bild-Nach-Oben", // LSTR_KEY_PAGEUP
+ "Bild-Nach-Unten", // LSTR_KEY_PAGEDOWN
+ "Eingabe", // LSTR_KEY_RETURN
+ "Esc", // LSTR_KEY_ESC
+ "Tab", // LSTR_KEY_TAB
+ "Rck", // LSTR_KEY_BACKSPACE
+ "Leer", // LSTR_KEY_SPACE
+ "Einfg", // LSTR_KEY_INSERT
+ "Entf", // LSTR_KEY_DELETE
+};
+
+// -----------------------------------------------------------------------
+// Italian (Italian/Swiss)
+
+static const char* aImplLangItalianTab[LSTR_COUNT] =
+{
+ "Maiusc", // LSTR_KEY_SHIFT
+ "Ctrl", // LSTR_KEY_CTRL
+ "Alt", // LSTR_KEY_ALT
+ "Sposta verso l'alto", // LSTR_KEY_UP
+ "Sposta verso il basso", // LSTR_KEY_DOWN
+ "A sinistra", // LSTR_KEY_LEFT
+ "A destra", // LSTR_KEY_RIGHT
+ "Home", // LSTR_KEY_HOME
+ "Fine", // LSTR_KEY_END
+ "PgSu", // LSTR_KEY_PAGEUP
+ "PgGi—", // LSTR_KEY_PAGEDOWN
+ "Invio", // LSTR_KEY_RETURN
+ "Esc", // LSTR_KEY_ESC
+ "Tab", // LSTR_KEY_TAB
+ "Backspace", // LSTR_KEY_BACKSPACE
+ "Spaziatrice", // LSTR_KEY_SPACE
+ "Ins", // LSTR_KEY_INSERT
+ "Canc", // LSTR_KEY_DELETE
+};
+
+// -----------------------------------------------------------------------
+// Norwegian (Bokmal)
+
+static const char* aImplLangNorwegianTab[LSTR_COUNT] =
+{
+ "Skift", // LSTR_KEY_SHIFT
+ "Ctrl", // LSTR_KEY_CTRL
+ "Alt", // LSTR_KEY_ALT
+ "Opp", // LSTR_KEY_UP
+ "Ned", // LSTR_KEY_DOWN
+ "Venstre", // LSTR_KEY_LEFT
+ "H›yre", // LSTR_KEY_RIGHT
+ "Home", // LSTR_KEY_HOME
+ "End", // LSTR_KEY_END
+ "PageUp", // LSTR_KEY_PAGEUP
+ "PageDown", // LSTR_KEY_PAGEDOWN
+ "Enter", // LSTR_KEY_RETURN
+ "Esc", // LSTR_KEY_ESC
+ "Tab", // LSTR_KEY_TAB
+ "Tilbake", // LSTR_KEY_BACKSPACE
+ "Mellomrom", // LSTR_KEY_SPACE
+ "Insert", // LSTR_KEY_INSERT
+ "Delete", // LSTR_KEY_DELETE
+};
+
+// -----------------------------------------------------------------------
+// Portuguse (Portuguse/Brazilian)
+
+static const char* aImplLangPortugueseTab[LSTR_COUNT] =
+{
+ "Shift", // LSTR_KEY_SHIFT
+ "Ctrl", // LSTR_KEY_CTRL
+ "Alt", // LSTR_KEY_ALT
+ "Acima", // LSTR_KEY_UP
+ "Abaixo", // LSTR_KEY_DOWN
+ "Esquerda", // LSTR_KEY_LEFT
+ "Direita", // LSTR_KEY_RIGHT
+ "Home", // LSTR_KEY_HOME
+ "End", // LSTR_KEY_END
+ "PageUp", // LSTR_KEY_PAGEUP
+ "PageDown", // LSTR_KEY_PAGEDOWN
+ "Enter", // LSTR_KEY_RETURN
+ "Esc", // LSTR_KEY_ESC
+ "Tab", // LSTR_KEY_TAB
+ "Backspace", // LSTR_KEY_BACKSPACE
+ "Space", // LSTR_KEY_SPACE
+ "Insert", // LSTR_KEY_INSERT
+ "Delete", // LSTR_KEY_DELETE
+};
+
+// -----------------------------------------------------------------------
+// Spanish (Spanish/Mexican/Modern/Guatemala/Costarica/Panama/Dominican/
+// Venezuela/Colombia/Peru/Argentina/Ecuador/Chile/Uruguay/
+// Paraguay/Bolivia)
+
+static const char* aImplLangSpanishTab[LSTR_COUNT] =
+{
+ "May—s", // LSTR_KEY_SHIFT
+ "Control", // LSTR_KEY_CTRL
+ "Alt", // LSTR_KEY_ALT
+ "Hacia arriba", // LSTR_KEY_UP
+ "Hacia abajo", // LSTR_KEY_DOWN
+ "Hacia la izquierda", // LSTR_KEY_LEFT
+ "Hacia la derecha", // LSTR_KEY_RIGHT
+ "Home", // LSTR_KEY_HOME
+ "Fin", // LSTR_KEY_END
+ "ReP g", // LSTR_KEY_PAGEUP
+ "AvP g", // LSTR_KEY_PAGEDOWN
+ "Entrada", // LSTR_KEY_RETURN
+ "Esc", // LSTR_KEY_ESC
+ "Tab", // LSTR_KEY_TAB
+ "Ret", // LSTR_KEY_BACKSPACE
+ "Espacio", // LSTR_KEY_SPACE
+ "Insert", // LSTR_KEY_INSERT
+ "Supr", // LSTR_KEY_DELETE
+};
+
+// -----------------------------------------------------------------------
+// Swedish
+
+static const char* aImplLangSwedishTab[LSTR_COUNT] =
+{
+ "Skift", // LSTR_KEY_SHIFT
+ "Ctrl", // LSTR_KEY_CTRL
+ "Alt", // LSTR_KEY_ALT
+ "Up", // LSTR_KEY_UP
+ "Ned", // LSTR_KEY_DOWN
+ "V„nster", // LSTR_KEY_LEFT
+ "H”ger", // LSTR_KEY_RIGHT
+ "Home", // LSTR_KEY_HOME
+ "End", // LSTR_KEY_END
+ "PageUp", // LSTR_KEY_PAGEUP
+ "PageDown", // LSTR_KEY_PAGEDOWN
+ "Retur", // LSTR_KEY_RETURN
+ "Esc", // LSTR_KEY_ESC
+ "Tab", // LSTR_KEY_TAB
+ "Backsteg", // LSTR_KEY_BACKSPACE
+ "Blank", // LSTR_KEY_SPACE
+ "Insert", // LSTR_KEY_INSERT
+ "Delete", // LSTR_KEY_DELETE
+};
+
+// =======================================================================
+
+const char** ImplGetLangTab( LanguageType eLang )
+{
+ // Sprachtabelle ermitteln
+ const char** pLangTab;
+ switch ( International::GetNeutralLanguage( eLang ) )
+ {
+ case LANGUAGE_DANISH:
+ pLangTab = aImplLangDanishTab;
+ break;
+
+ case LANGUAGE_DUTCH:
+ case LANGUAGE_DUTCH_BELGIAN:
+ pLangTab = aImplLangDutchTab;
+ break;
+
+ case LANGUAGE_FINNISH:
+ pLangTab = aImplLangFinnishTab;
+ break;
+
+ case LANGUAGE_FRENCH:
+ pLangTab = aImplLangFrenchTab;
+ break;
+
+ case LANGUAGE_GERMAN:
+ pLangTab = aImplLangGermanTab;
+ break;
+
+ case LANGUAGE_ITALIAN:
+ pLangTab = aImplLangItalianTab;
+ break;
+
+ case LANGUAGE_NORWEGIAN:
+ case LANGUAGE_NORWEGIAN_BOKMAL:
+ pLangTab = aImplLangNorwegianTab;
+ break;
+
+ case LANGUAGE_PORTUGUESE:
+ case LANGUAGE_PORTUGUESE_BRAZILIAN:
+ pLangTab = aImplLangPortugueseTab;
+ break;
+
+ case LANGUAGE_SPANISH:
+ pLangTab = aImplLangSpanishTab;
+ break;
+
+ case LANGUAGE_SWEDISH:
+ pLangTab = aImplLangSwedishTab;
+ break;
+
+ default:
+ pLangTab = aImplLangEnglishTab;
+ break;
+ }
+
+ return pLangTab;
+}
diff --git a/vcl/os2/source/app/salshl.cxx b/vcl/os2/source/app/salshl.cxx
new file mode 100644
index 000000000000..c81cee1c67f1
--- /dev/null
+++ b/vcl/os2/source/app/salshl.cxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * $RCSfile: salshl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <tools/svpm.h>
+
+#define _SV_SALSHL_CXX
+
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+// =======================================================================
+
+SalShlData aSalShlData;
+
+// =======================================================================
+
+HPOINTER ImplLoadPointer( ULONG nId )
+{
+ return WinLoadPointer( HWND_DESKTOP, aSalShlData.mhMod, nId );
+}
+
diff --git a/vcl/os2/source/app/salsound.cxx b/vcl/os2/source/app/salsound.cxx
new file mode 100644
index 000000000000..45bf1ee67153
--- /dev/null
+++ b/vcl/os2/source/app/salsound.cxx
@@ -0,0 +1,421 @@
+/*************************************************************************
+ *
+ * $RCSfile: salsound.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SALSOUND_CXX
+
+// ------------
+// - Includes -
+// ------------
+
+#include <string.h>
+
+#define INCL_DOSMODULEMGR
+#include <tools/svpm.h>
+
+#ifndef _SV_SALSOUND_HXX
+#include <salsound.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+
+#define INCL_MCIOS2
+#include <os2me.h>
+
+// ---------
+// - Names -
+// ---------
+
+#define SOUND_LIBNAME "MDM"
+#define SOUND_PROCNAME "mciSendCommand"
+
+// ------------
+// - Fnc cast -
+// ------------
+
+typedef ULONG (_cdecl *SALMCIPROC)( USHORT nDeviceId, USHORT nMessage, ULONG nFlags, void* pParam, USHORT );
+#define MCIFNC ( (SALMCIPROC) SalSound::mpMCIFnc )
+
+// -----------------
+// - Statics init. -
+// -----------------
+
+HMODULE SalSound::mhMCILib = 0;
+ULONG SalSound::mnSoundState = SOUND_STATE_UNLOADED;
+void* SalSound::mpMCIFnc = NULL;
+
+// -------------------
+// - Window-Callback -
+// -------------------
+
+MRESULT EXPENTRY SoundWndProc( HWND hWnd, ULONG nMsg, MPARAM nPar1, MPARAM nPar2 )
+{
+ if( MM_MCINOTIFY == nMsg )
+ {
+ USHORT nNotify = (USHORT)(ULONG) nPar1;
+ SoundNotification eNotification;
+ BOOL bNotify = TRUE;
+
+ switch( nNotify )
+ {
+ case( MCI_NOTIFY_SUCCESSFUL ):
+ eNotification = SOUND_NOTIFY_SUCCESS;
+ break;
+
+ case( MCI_NOTIFY_ABORTED ):
+ eNotification = SOUND_NOTIFY_ABORTED;
+ break;
+
+ case( MCI_NOTIFY_SUPERSEDED ):
+ bNotify = FALSE;
+ break;
+
+ default:
+ eNotification = SOUND_NOTIFY_ERROR;
+ break;
+ }
+
+ if( bNotify )
+ ( (SalSound*) WinQueryWindowULong( hWnd, 0 ) )->ImplNotify( eNotification, 0 );
+ }
+
+ return WinDefWindowProc( hWnd, nMsg, nPar1, nPar2 );
+}
+
+// ------------
+// - SalSound -
+// ------------
+
+SalSound::SalSound() :
+ mpProc ( NULL ),
+ mhSoundWnd ( 0 ),
+ mnDeviceId ( 0 ),
+ mbLoop ( FALSE ),
+ mbPaused ( FALSE )
+{
+}
+
+// ------------------------------------------------------------------------
+
+SalSound::~SalSound()
+{
+ Stop();
+
+ if( mnDeviceId )
+ {
+ MCI_GENERIC_PARMS aGenericParams;
+ memset( &aGenericParams, 0, sizeof( aGenericParams ) );
+ aGenericParams.hwndCallback = mhSoundWnd;
+ MCIFNC( mnDeviceId, MCI_CLOSE, MCI_WAIT, &aGenericParams, 0 );
+ }
+
+ if( mhSoundWnd )
+ WinDestroyWindow( mhSoundWnd );
+}
+
+// ------------------------------------------------------------------------
+
+void SalSound::ImplSetError( ULONG nMciErr )
+{
+ struct aMapper { DWORD nMci; ULONG nSv; };
+
+ ULONG nError = SOUNDERR_GENERAL_ERROR;
+ static aMapper aErrArr[] =
+ {
+ { 0, SOUNDERR_SUCCESS },
+ { MCIERR_CANNOT_LOAD_DRIVER, SOUNDERR_CANNOT_LOAD_DRIVER },
+ { MCIERR_DEVICE_LOCKED, SOUNDERR_DEVICE_LOCKED },
+ { MCIERR_DEVICE_NOT_READY, SOUNDERR_DEVICE_NOT_READY },
+ { MCIERR_DEVICE_TYPE_REQUIRED, SOUNDERR_DEVICE_NOT_FOUND },
+ { MCIERR_DRIVER, SOUNDERR_CANNOT_LOAD_DRIVER },
+ { MCIERR_DRIVER_INTERNAL, SOUNDERR_CANNOT_LOAD_DRIVER },
+ { MCIERR_EXTENSION_NOT_FOUND, SOUNDERR_SOUND_NOT_FOUND },
+ { MCIERR_FILE_NOT_FOUND, SOUNDERR_SOUND_NOT_FOUND },
+ { MCIERR_HARDWARE, SOUNDERR_HARDWARE_ERROR },
+ { MCIERR_INVALID_DEVICE_NAME, SOUNDERR_DEVICE_NOT_FOUND },
+ { MCIERR_OUT_OF_MEMORY, SOUNDERR_OUT_OF_MEMORY },
+ { MCIERR_UNSUPPORTED_FUNCTION, SOUNDERR_UNSUPPORTED_FUNCTION }
+ };
+
+ for( USHORT n=0; n < (sizeof( aErrArr ) / sizeof( aMapper ) ); n++ )
+ {
+ if( aErrArr[ n ].nMci == nMciErr )
+ {
+ nError = aErrArr[ n ].nSv;
+ break;
+ }
+ }
+
+ if( nError )
+ ImplNotify( SOUND_NOTIFY_ERROR, nError );
+}
+
+// ------------------------------------------------------------------------
+
+void SalSound::ImplNotify( SoundNotification eNotification, ULONG nError )
+{
+ if( mbLoop && ( SOUND_NOTIFY_SUCCESS == eNotification ) && !nError )
+ Play( mnStartTime, mnPlayLen, TRUE );
+
+ if( mpProc && mpInst )
+ mpProc( mpInst, eNotification, nError );
+}
+
+// ------------------------------------------------------------------------
+
+BOOL SalSound::Create()
+{
+ SalData* pData = GetSalData();
+ BOOL bRet = FALSE;
+
+ if( SOUND_STATE_UNLOADED == SalSound::mnSoundState )
+ {
+ if( DosLoadModule( 0, 0, SOUND_LIBNAME, &SalSound::mhMCILib ) == 0 &&
+ DosQueryProcAddr( SalSound::mhMCILib, 0, SOUND_PROCNAME, (PFN*) &SalSound::mpMCIFnc ) == 0 )
+ {
+ char* pszClassName = "SoundWin";
+ PFNWP pWindowProc = SoundWndProc;
+
+ WinRegisterClass( pData->mhAB, pszClassName, pWindowProc, 0L, 4 );
+ SalSound::mnSoundState = SOUND_STATE_VALID;
+ bRet = TRUE;
+ }
+ else
+ {
+ if( SalSound::mhMCILib )
+ DosFreeModule( SalSound::mhMCILib );
+
+ SalSound::mnSoundState = SOUND_STATE_INVALID;
+ ImplNotify( SOUND_NOTIFY_ERROR, SOUNDERR_CANNOT_LOAD_DRIVER );
+ }
+ }
+ else if( SOUND_STATE_VALID == SalSound::mnSoundState )
+ bRet = TRUE;
+
+ if( bRet )
+ {
+ mhSoundWnd = WinCreateWindow( HWND_OBJECT, "SoundWin", "Sound", 0, 0, 0, 0, 0, HWND_DESKTOP, HWND_BOTTOM, 0, 0, 0 );
+ WinSetWindowULong( mhSoundWnd, 0, (ULONG) this );
+ }
+ else
+ mhSoundWnd = 0;
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+void SalSound::Release()
+{
+ if( SalSound::mhMCILib )
+ DosFreeModule( SalSound::mhMCILib );
+
+ SalSound::mnSoundState = SOUND_STATE_UNLOADED;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL SalSound::Init( SalFrame* pFrame, const String& rSoundName, ULONG& rSoundLen )
+{
+ MCI_OPEN_PARMS aOpenParams;
+ ULONG nMciErr = 0;
+
+ rSoundLen = 0;
+
+ // clear old device
+ if( mnDeviceId )
+ {
+ Stop();
+
+ MCI_GENERIC_PARMS aGenericParams;
+ memset( &aGenericParams, 0, sizeof( aGenericParams ) );
+ aGenericParams.hwndCallback = mhSoundWnd;
+ nMciErr = MCIFNC( mnDeviceId, MCI_CLOSE, MCI_WAIT, &aGenericParams, 0 );
+ mnDeviceId = 0;
+ }
+
+ if( rSoundName.Len() )
+ {
+ // init new device with sound name
+ memset( &aOpenParams, 0, sizeof( aOpenParams ) );
+ aOpenParams.pszElementName = (char*) rSoundName.GetStr();
+ aOpenParams.hwndCallback = mhSoundWnd;
+ nMciErr = MCIFNC( 0, MCI_OPEN, MCI_WAIT | MCI_OPEN_ELEMENT, &aOpenParams, 0 );
+
+ if( !nMciErr )
+ {
+ // set time format
+ MCI_SET_PARMS aSetParams;
+ memset( &aSetParams, 0, sizeof( aSetParams ) );
+ mnDeviceId = aOpenParams.usDeviceID;
+ aSetParams.ulTimeFormat = MCI_FORMAT_MILLISECONDS;
+ nMciErr = MCIFNC( mnDeviceId, MCI_SET, MCI_WAIT | MCI_SET_TIME_FORMAT, &aSetParams, 0 );
+
+ if( !nMciErr )
+ {
+ // get length of sound
+ MCI_STATUS_PARMS aStatus;
+ memset( &aStatus, 0, sizeof( aStatus ) );
+ aStatus.ulItem = MCI_STATUS_LENGTH;
+ MCIFNC( mnDeviceId, MCI_STATUS, MCI_WAIT | MCI_STATUS_ITEM, &aStatus, 0 );
+ rSoundLen = (ULONG) aStatus.ulReturn;
+ }
+ }
+ }
+
+ if( nMciErr )
+ ImplSetError( nMciErr );
+
+ return( nMciErr ? FALSE : TRUE );
+}
+
+// ------------------------------------------------------------------------
+
+BOOL SalSound::Init( SalFrame* pFrame, const BYTE* pSound, ULONG nDataLen, ULONG& rSoundLen )
+{
+ rSoundLen = 0UL;
+ ImplSetError( MCIERR_FILE_NOT_FOUND );
+
+ return FALSE;
+}
+
+// ------------------------------------------------------------------------
+
+void SalSound::Play( ULONG nStartTime, ULONG nPlayLen, BOOL bLoop )
+{
+ if( mnDeviceId )
+ {
+ ULONG nMciErr = 0;
+
+ if( !mbPaused )
+ {
+ MCI_SEEK_PARMS aSeekParams;
+ memset( &aSeekParams, 0, sizeof( aSeekParams ) );
+ aSeekParams.hwndCallback = mhSoundWnd;
+ aSeekParams.ulTo = 0;
+ nMciErr = MCIFNC( mnDeviceId, MCI_SEEK,MCI_WAIT | MCI_TO, &aSeekParams, 0 );
+ }
+
+ mnStartTime = nStartTime;
+ mnPlayLen = nPlayLen;
+ mbLoop = bLoop;
+ mbPaused = FALSE;
+
+ if( !nMciErr )
+ {
+ MCI_PLAY_PARMS aPlayParams;
+ DWORD nFlags = MCI_NOTIFY;
+
+ memset( &aPlayParams, 0, sizeof( aPlayParams ) );
+ aPlayParams.hwndCallback = mhSoundWnd;
+
+ if( nStartTime )
+ {
+ aPlayParams.ulFrom = nStartTime;
+ nFlags |= MCI_FROM;
+ }
+
+ if( nPlayLen != SOUND_PLAYALL )
+ {
+ aPlayParams.ulTo = nStartTime + nPlayLen;
+ nFlags |= MCI_TO;
+ }
+
+ nMciErr = MCIFNC( mnDeviceId, MCI_PLAY, nFlags, &aPlayParams, 0 );
+
+ if( !nMciErr )
+ mbPaused = FALSE;
+ }
+
+ if( nMciErr )
+ ImplSetError( nMciErr );
+ }
+ else
+ ImplSetError( MCIERR_EXTENSION_NOT_FOUND );
+}
+
+// ------------------------------------------------------------------------
+
+void SalSound::Stop()
+{
+ if( mnDeviceId )
+ {
+ MCI_GENERIC_PARMS aGenericParams;
+ memset( &aGenericParams, 0, sizeof( aGenericParams ) );
+ aGenericParams.hwndCallback = mhSoundWnd;
+ mbLoop = mbPaused = FALSE;
+ MCIFNC( mnDeviceId, MCI_STOP, MCI_WAIT, &aGenericParams, 0 );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void SalSound::Pause()
+{
+ if( mnDeviceId )
+ {
+ MCI_GENERIC_PARMS aGenericParams;
+ memset( &aGenericParams, 0, sizeof( aGenericParams ) );
+ aGenericParams.hwndCallback = mhSoundWnd;
+ mbPaused = TRUE;
+ MCIFNC( mnDeviceId, MCI_PAUSE, MCI_WAIT, &aGenericParams, 0 );
+ }
+}
diff --git a/vcl/os2/source/app/salsys.cxx b/vcl/os2/source/app/salsys.cxx
new file mode 100644
index 000000000000..54244723be33
--- /dev/null
+++ b/vcl/os2/source/app/salsys.cxx
@@ -0,0 +1,287 @@
+/*************************************************************************
+ *
+ * $RCSfile: salsys.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SALSYS_CXX
+
+#include <string.h>
+
+#define INCL_DOS
+#define INCL_DOSERRORS
+#ifndef _SVPM_H
+#include <tools/svpm.h>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_SALBMP_HXX
+#include <salbmp.hxx>
+#endif
+#ifndef _SV_SALSYS_HXX
+#include <salsys.hxx>
+#endif
+#ifndef _VOS_PROCESS_HXX
+#include <vos/process.hxx>
+#endif
+#ifndef _TOOLS_FASTFSYS_HXX
+#include <tools/fastfsys.hxx>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+// =======================================================================
+
+SalSystem* SalInstance::CreateSystem()
+{
+ return new SalSystem();
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::DestroySystem( SalSystem* pSystem )
+{
+ delete pSystem;
+}
+
+// -----------------------------------------------------------------------
+
+SalSystem::SalSystem()
+{
+}
+
+// -----------------------------------------------------------------------
+
+SalSystem::~SalSystem()
+{
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalSystem::StartProcess( SalFrame* pFrame, const XubString& rFileName,
+ const XubString& rParam,
+ const XubString& rWorkingDirectory )
+{
+ ItemIDPath aFile(rFileName);
+
+ //
+ // first check if item has a context menu with open command
+ //
+
+ ItemIDPath aParent, aChild;
+
+ if(aFile.Split(aParent, aChild))
+ {
+ IfcContextMenu *pConMenu = Folder(aParent).GetContextMenu(1, &aChild);
+
+ if(pConMenu)
+ {
+ UINT32 nCount = pConMenu->GetItemCount();
+
+ for(UINT32 n = 0; n < nCount; n++)
+ {
+ MenuItem aMenuItem;
+
+ if(pConMenu->GetMenuItem(n, aMenuItem) &&
+ aMenuItem.aVerb.Compare("open") == COMPARE_EQUAL)
+ {
+ return pConMenu->ExecuteCommand(aMenuItem.aCommand);
+ }
+ }
+ }
+ }
+
+ // Dateinamen mit Wildcards lehnen wir ab
+ if ( (rFileName.Search( '*' ) != STRING_NOTFOUND) ||
+ (rFileName.Search( '?' ) != STRING_NOTFOUND) )
+ return FALSE;
+
+ XubString aFileName = aFile.GetHostNotationPath();
+ char* aStdExtAry[] = { "exe", "com", "cmd", "bat" };
+ const char* pStdExt;
+ const xub_Unicode* pFileName = aFileName.GetStr();
+ const xub_Unicode* pParam = rParam.GetStr();
+ XubString aSearchFileName;
+ XubString aExt;
+ BOOL bExe = FALSE;
+ BOOL bProcess = FALSE;
+ BOOL bRet = FALSE;
+ BOOL bExtension;
+ int i;
+
+ // Parameter und Extension ermitteln
+ if ( !rParam.Len() )
+ pParam = NULL;
+ // Wenn keine Extension, dann versuchen wir eine zu ermitteln,
+ // indem wir nach EXE-, COM-, CMD- oder BAT-Dateien suchen.
+ bExtension = ImplSalGetExtension( aFileName, aExt );
+ if ( !bExtension )
+ {
+ i = 0;
+ do
+ {
+ pStdExt = aStdExtAry[i];
+ aSearchFileName = aFileName;
+ aSearchFileName += '.';
+ aSearchFileName += pStdExt;
+ if ( ImplSalFindFile( aSearchFileName.GetStr(), aSearchFileName ) )
+ {
+ pFileName = aSearchFileName.GetStr();
+ bExtension = ImplSalGetExtension( aSearchFileName, aExt );
+ break;
+ }
+ i++;
+ }
+ while ( i < 4 );
+ }
+ else
+ {
+ // Ansonsten Filename im Pfad suchen
+ if ( ImplSalFindFile( pFileName, aSearchFileName ) )
+ {
+ pFileName = aSearchFileName.GetStr();
+ bExtension = ImplSalGetExtension( aSearchFileName, aExt );
+ }
+ }
+ // Wenn wir eine Extension haben, testen wir, ob es eine
+ // Standard-Extension ist, womit wir einen Process starten koennen
+ if ( bExtension )
+ {
+ aExt.ToLower();
+ i = 0;
+ do
+ {
+ if ( aExt == aStdExtAry[i] )
+ {
+ bExe = TRUE;
+ break;
+ }
+ i++;
+ }
+ while ( i < 4 );
+ }
+
+ // change to path of executable if no working dir set
+ XubString aWorkingDir(rWorkingDirectory);
+
+ if(aWorkingDir.Len() == 0)
+ {
+ USHORT nIndex;
+
+ aWorkingDir = pFileName;
+ nIndex = aWorkingDir.SearchCharBackward("\\/:");
+
+ if(nIndex == STRING_NOTFOUND)
+ nIndex = 0;
+ else if(aWorkingDir.GetChar(nIndex) == ':')
+ aWorkingDir[nIndex++] = '\\';
+
+ aWorkingDir.Erase(nIndex);
+ }
+
+ // start executables with process execute
+ if ( bExe )
+ {
+ NAMESPACE_VOS( OProcess )::TProcessError nProcessError;
+ NAMESPACE_VOS( OProcess ) aProcess( pFileName, pParam );
+
+ aProcess.setDirectory(aWorkingDir.GetStr());
+
+ nProcessError = aProcess.execute( (NAMESPACE_VOS(OProcess)::TProcessOption)
+ (NAMESPACE_VOS(OProcess)::TOption_Detached) );
+ bRet = nProcessError == NAMESPACE_VOS( OProcess )::E_None;
+ }
+
+ // when not startet, start programm with WPS
+ if ( !bRet )
+ {
+ HOBJECT hObject = WinQueryObject( pFileName );
+ if ( hObject )
+ {
+ if ( WinOpenObject( hObject, 0, FALSE ) )
+ bRet = TRUE;
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalSystem::AddRecentDoc( SalFrame* pFrame, const XubString& rFileName )
+{
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+String SalSystem::GetSummarySystemInfos( ULONG nFlags )
+{
+ return String();
+}
+
diff --git a/vcl/os2/source/app/saltimer.cxx b/vcl/os2/source/app/saltimer.cxx
new file mode 100644
index 000000000000..284c987c4250
--- /dev/null
+++ b/vcl/os2/source/app/saltimer.cxx
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * $RCSfile: saltimer.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <tools/svpm.h>
+
+#define _SV_SALTIMER_CXX
+
+#ifndef _SV_SALINST_H
+#include <salinst.h>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_SALTIMER_HXX
+#include <saltimer.hxx>
+#endif
+
+// =======================================================================
+
+// Maximale Periode
+#define MAX_SYSPERIOD 65533
+
+// =======================================================================
+
+void ImplSalStartTimer()
+{
+ SalData* pSalData = GetSalData();
+ SalFrame* pSalFrame = GetSalDefaultFrame();
+
+ // Periode darf nicht zu gross sein, da OS2 2.11 mit USHORT arbeitet
+ ULONG nMS = pSalData->mnNewTimerMS;
+ if ( nMS > MAX_SYSPERIOD )
+ nMS = MAX_SYSPERIOD;
+
+ // Gibt es einen Timer, dann zerstoren
+ if ( pSalData->mnTimerId )
+ WinStopTimer( pSalData->mhAB, pSalFrame->maFrameData.mhWndClient, pSalData->mnTimerId );
+
+ // Make a new timer with new period
+ pSalData->mnTimerId = WinStartTimer( pSalData->mhAB, pSalFrame->maFrameData.mhWndClient, 10, nMS );
+}
+
+// -----------------------------------------------------------------------
+
+void SalTimer::Stop()
+{
+ SalData* pSalData = GetSalData();
+ SalFrame* pSalFrame = GetSalDefaultFrame();
+
+ // Exitstiert ein Timer, dann diesen zerstoeren
+ if ( pSalData->mnTimerId )
+ WinStopTimer( pSalData->mhAB, pSalFrame->maFrameData.mhWndClient, pSalData->mnTimerId );
+}
+
+// -----------------------------------------------------------------------
+
+void SalTimer::SetCallback( SALTIMERPROC pProc )
+{
+ SalData* pSalData = GetSalData();
+ pSalData->mpTimerProc = pProc;
+}