1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_vcl.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <string.h> 32*cdf0e10cSrcweir #include <stdio.h> 33*cdf0e10cSrcweir #include <stdlib.h> 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #include "osl/module.hxx" 36*cdf0e10cSrcweir #include "tools/solarmutex.hxx" 37*cdf0e10cSrcweir #include "vos/mutex.hxx" 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir #include "unx/salunx.h" 41*cdf0e10cSrcweir #include "unx/saldata.hxx" 42*cdf0e10cSrcweir #include "unx/saldisp.hxx" 43*cdf0e10cSrcweir #include "unx/salinst.h" 44*cdf0e10cSrcweir #include "unx/salframe.h" 45*cdf0e10cSrcweir #include "unx/dtint.hxx" 46*cdf0e10cSrcweir #include "unx/salprn.h" 47*cdf0e10cSrcweir #include "unx/sm.hxx" 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir #include "vcl/apptypes.hxx" 50*cdf0e10cSrcweir #include "vcl/helper.hxx" 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir #include "salwtype.hxx" 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir // ------------------------------------------------------------------------- 55*cdf0e10cSrcweir // 56*cdf0e10cSrcweir // SalYieldMutex 57*cdf0e10cSrcweir // 58*cdf0e10cSrcweir // ------------------------------------------------------------------------- 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir SalYieldMutex::SalYieldMutex() 61*cdf0e10cSrcweir { 62*cdf0e10cSrcweir mnCount = 0; 63*cdf0e10cSrcweir mnThreadId = 0; 64*cdf0e10cSrcweir ::tools::SolarMutex::SetSolarMutex( this ); 65*cdf0e10cSrcweir } 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir void SalYieldMutex::acquire() 68*cdf0e10cSrcweir { 69*cdf0e10cSrcweir OMutex::acquire(); 70*cdf0e10cSrcweir mnThreadId = vos::OThread::getCurrentIdentifier(); 71*cdf0e10cSrcweir mnCount++; 72*cdf0e10cSrcweir } 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir void SalYieldMutex::release() 75*cdf0e10cSrcweir { 76*cdf0e10cSrcweir if ( mnThreadId == vos::OThread::getCurrentIdentifier() ) 77*cdf0e10cSrcweir { 78*cdf0e10cSrcweir if ( mnCount == 1 ) 79*cdf0e10cSrcweir mnThreadId = 0; 80*cdf0e10cSrcweir mnCount--; 81*cdf0e10cSrcweir } 82*cdf0e10cSrcweir OMutex::release(); 83*cdf0e10cSrcweir } 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir sal_Bool SalYieldMutex::tryToAcquire() 86*cdf0e10cSrcweir { 87*cdf0e10cSrcweir if ( OMutex::tryToAcquire() ) 88*cdf0e10cSrcweir { 89*cdf0e10cSrcweir mnThreadId = vos::OThread::getCurrentIdentifier(); 90*cdf0e10cSrcweir mnCount++; 91*cdf0e10cSrcweir return True; 92*cdf0e10cSrcweir } 93*cdf0e10cSrcweir else 94*cdf0e10cSrcweir return False; 95*cdf0e10cSrcweir } 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir //---------------------------------------------------------------------------- 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir // -=-= SalInstance =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 100*cdf0e10cSrcweir // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir // plugin factory function 103*cdf0e10cSrcweir extern "C" 104*cdf0e10cSrcweir { 105*cdf0e10cSrcweir VCLPLUG_GEN_PUBLIC SalInstance* create_SalInstance() 106*cdf0e10cSrcweir { 107*cdf0e10cSrcweir /* #i92121# workaround deadlocks in the X11 implementation 108*cdf0e10cSrcweir */ 109*cdf0e10cSrcweir static const char* pNoXInitThreads = getenv( "SAL_NO_XINITTHREADS" ); 110*cdf0e10cSrcweir /* #i90094# 111*cdf0e10cSrcweir from now on we know that an X connection will be 112*cdf0e10cSrcweir established, so protect X against itself 113*cdf0e10cSrcweir */ 114*cdf0e10cSrcweir if( ! ( pNoXInitThreads && *pNoXInitThreads ) ) 115*cdf0e10cSrcweir XInitThreads(); 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir X11SalInstance* pInstance = new X11SalInstance( new SalYieldMutex() ); 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir // initialize SalData 120*cdf0e10cSrcweir X11SalData *pSalData = new X11SalData; 121*cdf0e10cSrcweir SetSalData( pSalData ); 122*cdf0e10cSrcweir pSalData->m_pInstance = pInstance; 123*cdf0e10cSrcweir pSalData->Init(); 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir return pInstance; 126*cdf0e10cSrcweir } 127*cdf0e10cSrcweir } 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir X11SalInstance::~X11SalInstance() 130*cdf0e10cSrcweir { 131*cdf0e10cSrcweir // close session management 132*cdf0e10cSrcweir SessionManagerClient::close(); 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir // dispose SalDisplay list from SalData 135*cdf0e10cSrcweir // would be done in a static destructor else which is 136*cdf0e10cSrcweir // a little late 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir X11SalData *pSalData = GetX11SalData(); 139*cdf0e10cSrcweir pSalData->deInitNWF(); 140*cdf0e10cSrcweir delete pSalData; 141*cdf0e10cSrcweir SetSalData( NULL ); 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir ::tools::SolarMutex::SetSolarMutex( 0 ); 144*cdf0e10cSrcweir delete mpSalYieldMutex; 145*cdf0e10cSrcweir } 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir // -------------------------------------------------------- 149*cdf0e10cSrcweir // AnyInput from sv/mow/source/app/svapp.cxx 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir struct PredicateReturn 152*cdf0e10cSrcweir { 153*cdf0e10cSrcweir sal_uInt16 nType; 154*cdf0e10cSrcweir sal_Bool bRet; 155*cdf0e10cSrcweir }; 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir extern "C" { 158*cdf0e10cSrcweir Bool ImplPredicateEvent( Display *, XEvent *pEvent, char *pData ) 159*cdf0e10cSrcweir { 160*cdf0e10cSrcweir PredicateReturn *pPre = (PredicateReturn *)pData; 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir if ( pPre->bRet ) 163*cdf0e10cSrcweir return False; 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir sal_uInt16 nType; 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir switch( pEvent->type ) 168*cdf0e10cSrcweir { 169*cdf0e10cSrcweir case ButtonPress: 170*cdf0e10cSrcweir case ButtonRelease: 171*cdf0e10cSrcweir case MotionNotify: 172*cdf0e10cSrcweir case EnterNotify: 173*cdf0e10cSrcweir case LeaveNotify: 174*cdf0e10cSrcweir nType = INPUT_MOUSE; 175*cdf0e10cSrcweir break; 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir case XLIB_KeyPress: 178*cdf0e10cSrcweir //case KeyRelease: 179*cdf0e10cSrcweir nType = INPUT_KEYBOARD; 180*cdf0e10cSrcweir break; 181*cdf0e10cSrcweir case Expose: 182*cdf0e10cSrcweir case GraphicsExpose: 183*cdf0e10cSrcweir case NoExpose: 184*cdf0e10cSrcweir nType = INPUT_PAINT; 185*cdf0e10cSrcweir break; 186*cdf0e10cSrcweir default: 187*cdf0e10cSrcweir nType = 0; 188*cdf0e10cSrcweir } 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir if ( (nType & pPre->nType) || ( ! nType && (pPre->nType & INPUT_OTHER) ) ) 191*cdf0e10cSrcweir pPre->bRet = sal_True; 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir return False; 194*cdf0e10cSrcweir } 195*cdf0e10cSrcweir } 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir bool X11SalInstance::AnyInput(sal_uInt16 nType) 198*cdf0e10cSrcweir { 199*cdf0e10cSrcweir X11SalData *pSalData = GetX11SalData(); 200*cdf0e10cSrcweir Display *pDisplay = pSalData->GetDisplay()->GetDisplay(); 201*cdf0e10cSrcweir sal_Bool bRet = sal_False; 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir if( (nType & INPUT_TIMER) && 204*cdf0e10cSrcweir pSalData->GetDisplay()->GetXLib()->CheckTimeout( false ) ) 205*cdf0e10cSrcweir { 206*cdf0e10cSrcweir bRet = sal_True; 207*cdf0e10cSrcweir } 208*cdf0e10cSrcweir else if (XPending(pDisplay) ) 209*cdf0e10cSrcweir { 210*cdf0e10cSrcweir PredicateReturn aInput; 211*cdf0e10cSrcweir XEvent aEvent; 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir aInput.bRet = sal_False; 214*cdf0e10cSrcweir aInput.nType = nType; 215*cdf0e10cSrcweir 216*cdf0e10cSrcweir XCheckIfEvent(pDisplay, &aEvent, ImplPredicateEvent, 217*cdf0e10cSrcweir (char *)&aInput ); 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir bRet = aInput.bRet; 220*cdf0e10cSrcweir } 221*cdf0e10cSrcweir return bRet; 222*cdf0e10cSrcweir } 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir vos::IMutex* X11SalInstance::GetYieldMutex() 225*cdf0e10cSrcweir { 226*cdf0e10cSrcweir return mpSalYieldMutex; 227*cdf0e10cSrcweir } 228*cdf0e10cSrcweir 229*cdf0e10cSrcweir // ----------------------------------------------------------------------- 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir sal_uLong X11SalInstance::ReleaseYieldMutex() 232*cdf0e10cSrcweir { 233*cdf0e10cSrcweir SalYieldMutex* pYieldMutex = mpSalYieldMutex; 234*cdf0e10cSrcweir if ( pYieldMutex->GetThreadId() == 235*cdf0e10cSrcweir vos::OThread::getCurrentIdentifier() ) 236*cdf0e10cSrcweir { 237*cdf0e10cSrcweir sal_uLong nCount = pYieldMutex->GetAcquireCount(); 238*cdf0e10cSrcweir sal_uLong n = nCount; 239*cdf0e10cSrcweir while ( n ) 240*cdf0e10cSrcweir { 241*cdf0e10cSrcweir pYieldMutex->release(); 242*cdf0e10cSrcweir n--; 243*cdf0e10cSrcweir } 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir return nCount; 246*cdf0e10cSrcweir } 247*cdf0e10cSrcweir else 248*cdf0e10cSrcweir return 0; 249*cdf0e10cSrcweir } 250*cdf0e10cSrcweir 251*cdf0e10cSrcweir // ----------------------------------------------------------------------- 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir void X11SalInstance::AcquireYieldMutex( sal_uLong nCount ) 254*cdf0e10cSrcweir { 255*cdf0e10cSrcweir SalYieldMutex* pYieldMutex = mpSalYieldMutex; 256*cdf0e10cSrcweir while ( nCount ) 257*cdf0e10cSrcweir { 258*cdf0e10cSrcweir pYieldMutex->acquire(); 259*cdf0e10cSrcweir nCount--; 260*cdf0e10cSrcweir } 261*cdf0e10cSrcweir } 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir // ----------------------------------------------------------------------- 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir bool X11SalInstance::CheckYieldMutex() 266*cdf0e10cSrcweir { 267*cdf0e10cSrcweir bool bRet = true; 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir SalYieldMutex* pYieldMutex = mpSalYieldMutex; 270*cdf0e10cSrcweir if ( pYieldMutex->GetThreadId() != 271*cdf0e10cSrcweir vos::OThread::getCurrentIdentifier() ) 272*cdf0e10cSrcweir { 273*cdf0e10cSrcweir bRet = false; 274*cdf0e10cSrcweir } 275*cdf0e10cSrcweir 276*cdf0e10cSrcweir return bRet; 277*cdf0e10cSrcweir } 278*cdf0e10cSrcweir 279*cdf0e10cSrcweir // ----------------------------------------------------------------------- 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir void X11SalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) 282*cdf0e10cSrcweir { GetX11SalData()->GetLib()->Yield( bWait, bHandleAllCurrentEvents ); } 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir void* X11SalInstance::GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) 285*cdf0e10cSrcweir { 286*cdf0e10cSrcweir static const char* pDisplay = getenv( "DISPLAY" ); 287*cdf0e10cSrcweir rReturnedType = AsciiCString; 288*cdf0e10cSrcweir rReturnedBytes = pDisplay ? strlen( pDisplay )+1 : 1; 289*cdf0e10cSrcweir return pDisplay ? (void*)pDisplay : (void*)""; 290*cdf0e10cSrcweir } 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir SalFrame *X11SalInstance::CreateFrame( SalFrame *pParent, sal_uLong nSalFrameStyle ) 293*cdf0e10cSrcweir { 294*cdf0e10cSrcweir SalFrame *pFrame = new X11SalFrame( pParent, nSalFrameStyle ); 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir return pFrame; 297*cdf0e10cSrcweir } 298*cdf0e10cSrcweir 299*cdf0e10cSrcweir SalFrame* X11SalInstance::CreateChildFrame( SystemParentData* pParentData, sal_uLong nStyle ) 300*cdf0e10cSrcweir { 301*cdf0e10cSrcweir SalFrame* pFrame = new X11SalFrame( NULL, nStyle, pParentData ); 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir return pFrame; 304*cdf0e10cSrcweir } 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir void X11SalInstance::DestroyFrame( SalFrame* pFrame ) 307*cdf0e10cSrcweir { 308*cdf0e10cSrcweir delete pFrame; 309*cdf0e10cSrcweir } 310*cdf0e10cSrcweir 311*cdf0e10cSrcweir static void getServerDirectories( std::list< rtl::OString >& o_rFontPaths ) 312*cdf0e10cSrcweir { 313*cdf0e10cSrcweir #ifdef LINUX 314*cdf0e10cSrcweir /* 315*cdf0e10cSrcweir * chkfontpath exists on some (RH derived) Linux distributions 316*cdf0e10cSrcweir */ 317*cdf0e10cSrcweir static const char* pCommands[] = { 318*cdf0e10cSrcweir "/usr/sbin/chkfontpath 2>/dev/null", "chkfontpath 2>/dev/null" 319*cdf0e10cSrcweir }; 320*cdf0e10cSrcweir ::std::list< ByteString > aLines; 321*cdf0e10cSrcweir 322*cdf0e10cSrcweir for( unsigned int i = 0; i < sizeof(pCommands)/sizeof(pCommands[0]); i++ ) 323*cdf0e10cSrcweir { 324*cdf0e10cSrcweir FILE* pPipe = popen( pCommands[i], "r" ); 325*cdf0e10cSrcweir aLines.clear(); 326*cdf0e10cSrcweir if( pPipe ) 327*cdf0e10cSrcweir { 328*cdf0e10cSrcweir char line[1024]; 329*cdf0e10cSrcweir char* pSearch; 330*cdf0e10cSrcweir while( fgets( line, sizeof(line), pPipe ) ) 331*cdf0e10cSrcweir { 332*cdf0e10cSrcweir int nLen = strlen( line ); 333*cdf0e10cSrcweir if( line[nLen-1] == '\n' ) 334*cdf0e10cSrcweir line[nLen-1] = 0; 335*cdf0e10cSrcweir pSearch = strstr( line, ": " ); 336*cdf0e10cSrcweir if( pSearch ) 337*cdf0e10cSrcweir aLines.push_back( pSearch+2 ); 338*cdf0e10cSrcweir } 339*cdf0e10cSrcweir if( ! pclose( pPipe ) ) 340*cdf0e10cSrcweir break; 341*cdf0e10cSrcweir } 342*cdf0e10cSrcweir } 343*cdf0e10cSrcweir 344*cdf0e10cSrcweir for( ::std::list< ByteString >::iterator it = aLines.begin(); it != aLines.end(); ++it ) 345*cdf0e10cSrcweir { 346*cdf0e10cSrcweir if( ! access( it->GetBuffer(), F_OK ) ) 347*cdf0e10cSrcweir { 348*cdf0e10cSrcweir o_rFontPaths.push_back( *it ); 349*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 350*cdf0e10cSrcweir fprintf( stderr, "adding fs dir %s\n", it->GetBuffer() ); 351*cdf0e10cSrcweir #endif 352*cdf0e10cSrcweir } 353*cdf0e10cSrcweir } 354*cdf0e10cSrcweir #else 355*cdf0e10cSrcweir (void)o_rFontPaths; 356*cdf0e10cSrcweir #endif 357*cdf0e10cSrcweir } 358*cdf0e10cSrcweir 359*cdf0e10cSrcweir 360*cdf0e10cSrcweir 361*cdf0e10cSrcweir void X11SalInstance::FillFontPathList( std::list< rtl::OString >& o_rFontPaths ) 362*cdf0e10cSrcweir { 363*cdf0e10cSrcweir Display *pDisplay = GetX11SalData()->GetDisplay()->GetDisplay(); 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir DBG_ASSERT( pDisplay, "No Display !" ); 366*cdf0e10cSrcweir if( pDisplay ) 367*cdf0e10cSrcweir { 368*cdf0e10cSrcweir // get font paths to look for fonts 369*cdf0e10cSrcweir int nPaths = 0, i; 370*cdf0e10cSrcweir char** pPaths = XGetFontPath( pDisplay, &nPaths ); 371*cdf0e10cSrcweir 372*cdf0e10cSrcweir bool bServerDirs = false; 373*cdf0e10cSrcweir for( i = 0; i < nPaths; i++ ) 374*cdf0e10cSrcweir { 375*cdf0e10cSrcweir OString aPath( pPaths[i] ); 376*cdf0e10cSrcweir sal_Int32 nPos = 0; 377*cdf0e10cSrcweir if( ! bServerDirs 378*cdf0e10cSrcweir && ( nPos = aPath.indexOf( ':' ) ) > 0 379*cdf0e10cSrcweir && ( !aPath.copy(nPos).equals( ":unscaled" ) ) ) 380*cdf0e10cSrcweir { 381*cdf0e10cSrcweir bServerDirs = true; 382*cdf0e10cSrcweir getServerDirectories( o_rFontPaths ); 383*cdf0e10cSrcweir } 384*cdf0e10cSrcweir else 385*cdf0e10cSrcweir { 386*cdf0e10cSrcweir psp::normPath( aPath ); 387*cdf0e10cSrcweir o_rFontPaths.push_back( aPath ); 388*cdf0e10cSrcweir } 389*cdf0e10cSrcweir } 390*cdf0e10cSrcweir 391*cdf0e10cSrcweir if( nPaths ) 392*cdf0e10cSrcweir XFreeFontPath( pPaths ); 393*cdf0e10cSrcweir } 394*cdf0e10cSrcweir 395*cdf0e10cSrcweir // insert some standard directories 396*cdf0e10cSrcweir o_rFontPaths.push_back( "/usr/openwin/lib/X11/fonts/TrueType" ); 397*cdf0e10cSrcweir o_rFontPaths.push_back( "/usr/openwin/lib/X11/fonts/Type1" ); 398*cdf0e10cSrcweir o_rFontPaths.push_back( "/usr/openwin/lib/X11/fonts/Type1/sun" ); 399*cdf0e10cSrcweir o_rFontPaths.push_back( "/usr/X11R6/lib/X11/fonts/truetype" ); 400*cdf0e10cSrcweir o_rFontPaths.push_back( "/usr/X11R6/lib/X11/fonts/Type1" ); 401*cdf0e10cSrcweir 402*cdf0e10cSrcweir #ifdef SOLARIS 403*cdf0e10cSrcweir /* cde specials, from /usr/dt/bin/Xsession: here are the good fonts, 404*cdf0e10cSrcweir the OWfontpath file may contain as well multiple lines as a comma 405*cdf0e10cSrcweir separated list of fonts in each line. to make it even more weird 406*cdf0e10cSrcweir environment variables are allowed as well */ 407*cdf0e10cSrcweir 408*cdf0e10cSrcweir const char* lang = getenv("LANG"); 409*cdf0e10cSrcweir if ( lang != NULL ) 410*cdf0e10cSrcweir { 411*cdf0e10cSrcweir String aOpenWinDir( String::CreateFromAscii( "/usr/openwin/lib/locale/" ) ); 412*cdf0e10cSrcweir aOpenWinDir.AppendAscii( lang ); 413*cdf0e10cSrcweir aOpenWinDir.AppendAscii( "/OWfontpath" ); 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir SvFileStream aStream( aOpenWinDir, STREAM_READ ); 416*cdf0e10cSrcweir 417*cdf0e10cSrcweir // TODO: replace environment variables 418*cdf0e10cSrcweir while( aStream.IsOpen() && ! aStream.IsEof() ) 419*cdf0e10cSrcweir { 420*cdf0e10cSrcweir ByteString aLine; 421*cdf0e10cSrcweir aStream.ReadLine( aLine ); 422*cdf0e10cSrcweir // need an OString for normpath 423*cdf0e10cSrcweir OString aNLine( aLine ); 424*cdf0e10cSrcweir psp::normPath( aNLine ); 425*cdf0e10cSrcweir aLine = aNLine; 426*cdf0e10cSrcweir // try to avoid bad fonts in some cases 427*cdf0e10cSrcweir static bool bAvoid = (strncasecmp( lang, "ar", 2 ) == 0) || (strncasecmp( lang, "he", 2 ) == 0) || strncasecmp( lang, "iw", 2 ) == 0 || (strncasecmp( lang, "hi", 2 ) == 0); 428*cdf0e10cSrcweir if( bAvoid && aLine.Search( "iso_8859" ) != STRING_NOTFOUND ) 429*cdf0e10cSrcweir continue; 430*cdf0e10cSrcweir o_rFontPaths.push_back( aLine ); 431*cdf0e10cSrcweir } 432*cdf0e10cSrcweir } 433*cdf0e10cSrcweir #endif /* SOLARIS */ 434*cdf0e10cSrcweir } 435*cdf0e10cSrcweir 436*cdf0e10cSrcweir extern "C" { static void SAL_CALL thisModule() {} } 437*cdf0e10cSrcweir 438*cdf0e10cSrcweir void X11SalInstance::AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType) 439*cdf0e10cSrcweir { 440*cdf0e10cSrcweir const rtl::OUString SYM_ADD_TO_RECENTLY_USED_FILE_LIST(RTL_CONSTASCII_USTRINGPARAM("add_to_recently_used_file_list")); 441*cdf0e10cSrcweir const rtl::OUString LIB_RECENT_FILE(RTL_CONSTASCII_USTRINGPARAM("librecentfile.so")); 442*cdf0e10cSrcweir typedef void (*PFUNC_ADD_TO_RECENTLY_USED_LIST)(const rtl::OUString&, const rtl::OUString&); 443*cdf0e10cSrcweir 444*cdf0e10cSrcweir PFUNC_ADD_TO_RECENTLY_USED_LIST add_to_recently_used_file_list = 0; 445*cdf0e10cSrcweir 446*cdf0e10cSrcweir osl::Module module; 447*cdf0e10cSrcweir module.loadRelative( &thisModule, LIB_RECENT_FILE ); 448*cdf0e10cSrcweir if (module.is()) 449*cdf0e10cSrcweir add_to_recently_used_file_list = (PFUNC_ADD_TO_RECENTLY_USED_LIST)module.getFunctionSymbol(SYM_ADD_TO_RECENTLY_USED_FILE_LIST); 450*cdf0e10cSrcweir if (add_to_recently_used_file_list) 451*cdf0e10cSrcweir add_to_recently_used_file_list(rFileUrl, rMimeType); 452*cdf0e10cSrcweir } 453