1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: salshl.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 #define _SV_SALSHL_CXX
34 #include <saldata.hxx>
35 #include <tools/debug.hxx>
37 // =======================================================================
39 SalShlData aSalShlData
;
41 HMODULE
ImplGetModule(void);
42 static HMODULE mhMod
= ImplGetModule();
44 // =======================================================================
46 APIRET APIENTRY
DosQueryModFromEIP (HMODULE
*phMod
, ULONG
*pObjNum
,
47 ULONG BuffLen
, PCHAR pBuff
, ULONG
*pOffset
, ULONG Address
);
49 HMODULE
ImplGetModule(void)
53 CHAR Buff
[2*_MAX_PATH
];
57 // get module handle (and name)
58 rc
= DosQueryModFromEIP( &hMod
, &ObjNum
, sizeof( Buff
), Buff
, &Offset
, (ULONG
)ImplGetModule
);
61 // return module handle
62 aSalShlData
.mhMod
= hMod
;
66 // =======================================================================
68 HPOINTER
ImplLoadSalCursor( int nId
)
70 DBG_ASSERT( aSalShlData
.mhMod
, "no DLL instance handle" );
72 HPOINTER hPointer
= WinLoadPointer( HWND_DESKTOP
, aSalShlData
.mhMod
, nId
);
74 DBG_ASSERT( hPointer
, "pointer not found in sal resource" );
77 debug_printf( "ImplLoadSalCursor: pointer %d not found in sal resource\n", nId
);
82 // -----------------------------------------------------------------------
84 BOOL
ImplLoadSalIcon( int nId
, HPOINTER
& rIcon
)
86 DBG_ASSERT( aSalShlData
.mhMod
, "no DLL instance handle" );
88 SalData
* pSalData
= GetSalData();
90 // check the cache first
91 SalIcon
*pSalIcon
= pSalData
->mpFirstIcon
;
94 if( pSalIcon
->nId
!= nId
)
95 pSalIcon
= pSalIcon
->pNext
;
98 rIcon
= pSalIcon
->hIcon
;
103 // Try at first to load the icons from the application exe file
104 rIcon
= WinLoadPointer( HWND_DESKTOP
, NULL
, nId
);
107 // If the application don't provide these icons, then we try
108 // to load the icon from the VCL resource
109 rIcon
= WinLoadPointer( HWND_DESKTOP
, aSalShlData
.mhMod
, nId
);
115 pSalIcon
= new SalIcon();
117 pSalIcon
->hIcon
= rIcon
;
118 pSalIcon
->pNext
= pSalData
->mpFirstIcon
;
119 pSalData
->mpFirstIcon
= pSalIcon
;
125 // =======================================================================