update dev300-m58
[ooovba.git] / vcl / unx / kde4 / main.cxx
blobdfcddbf3562a229c06059ea8f7f3390e787c4a84
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2009 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_vcl.hxx"
31 #define Region QtXRegion
32 #include <QApplication>
33 #undef Region
35 #include "KDEData.hxx"
36 #include "KDESalInstance.hxx"
38 #if OSL_DEBUG_LEVEL > 1
39 #include <stdio.h>
40 #endif
42 #include <rtl/string.hxx>
44 /// entry point for the KDE4 VCL plugin
45 extern "C" {
46 VCL_DLLPUBLIC SalInstance* create_SalInstance( oslModule )
48 #if QT_VERSION < 0x050000
49 // Qt 4.x support needs >= 4.1.0
50 rtl::OString aVersion( qVersion() );
51 #if OSL_DEBUG_LEVEL > 1
52 fprintf( stderr, "qt version string is \"%s\"\n", aVersion.getStr() );
53 #endif
54 sal_Int32 nIndex = 0, nMajor = 0, nMinor = 0, nMicro = 0;
55 nMajor = aVersion.getToken( 0, '.', nIndex ).toInt32();
56 if( nIndex > 0 )
57 nMinor = aVersion.getToken( 0, '.', nIndex ).toInt32();
58 if( nIndex > 0 )
59 nMicro = aVersion.getToken( 0, '.', nIndex ).toInt32();
60 if( nMajor != 4 || nMinor < 1 )
62 #if OSL_DEBUG_LEVEL > 1
63 fprintf( stderr, "unsuitable qt version %d.%d.%d\n", nMajor, nMinor, nMicro );
64 #endif
65 return NULL;
67 #endif
69 KDESalInstance* pInstance = new KDESalInstance( new SalYieldMutex() );
70 #if OSL_DEBUG_LEVEL > 1
71 fprintf( stderr, "created KDESalInstance 0x%p\n", pInstance );
72 #endif
74 // initialize SalData
75 KDEData *salData = new KDEData();
76 SetSalData(salData);
77 salData->m_pInstance = pInstance;
78 salData->Init();
79 salData->initNWF();
81 return pInstance;