xref: /trunk/main/fpicker/source/win32/misc/WinImplHelper.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
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.
14  *
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).
20  *
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.
25  *
26  ************************************************************************/
27 
28 
29 #ifndef _WINIMPLHELPER_HXX_
30 #define _WINIMPLHELPER_HXX_
31 
32 //------------------------------------------------------------------------
33 // includes
34 //------------------------------------------------------------------------
35 
36 #include <sal/types.h>
37 #include <rtl/ustring.hxx>
38 
39 #if defined _MSC_VER
40 #pragma warning(push, 1)
41 #endif
42 #include <windows.h>
43 #if defined _MSC_VER
44 #pragma warning(pop)
45 #endif
46 #include <com/sun/star/uno/Any.hxx>
47 #include <com/sun/star/lang/IllegalArgumentException.hpp>
48 
49 //------------------------------------------------------------------------
50 // deklarations
51 //------------------------------------------------------------------------
52 
53 bool SAL_CALL IsWindowsVistaOrNewer();
54 bool SAL_CALL IsWindows7();
55 bool SAL_CALL IsWindowsVista();
56 bool SAL_CALL IsWindows2000();
57 bool SAL_CALL IsWindowsXP();
58 bool SAL_CALL IsWindows98();
59 bool SAL_CALL IsWindowsME();
60 
61 // returns true if the platform is
62 // Windows 2000 or above
63 bool SAL_CALL IsWindows2000Platform();
64 
65 #define IsWin2000 IsWindows2000
66 
67 // set actions
68 void SAL_CALL ListboxAddItem(
69     HWND hwnd, const ::com::sun::star::uno::Any& aItem, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rXInterface, sal_Int16 aArgPos )
70     throw( ::com::sun::star::lang::IllegalArgumentException );
71 
72 void SAL_CALL ListboxAddItems(
73     HWND hwnd, const ::com::sun::star::uno::Any& aItemList, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rXInterface, sal_Int16 aArgPos )
74     throw( ::com::sun::star::lang:: IllegalArgumentException );
75 
76 void SAL_CALL ListboxDeleteItem(
77     HWND hwnd, const ::com::sun::star::uno::Any& aPosition, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rXInterface, sal_Int16 aArgPos )
78     throw( ::com::sun::star::lang::IllegalArgumentException );
79 
80 void SAL_CALL ListboxDeleteItems(
81     HWND hwnd, const ::com::sun::star::uno::Any& aUnused, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rXInterface, sal_Int16 aArgPos )
82     throw( ::com::sun::star::lang::IllegalArgumentException );
83 
84 void SAL_CALL ListboxSetSelectedItem(
85     HWND hwnd, const ::com::sun::star::uno::Any& aPosition, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rXInterface, sal_Int16 aArgPos )
86     throw( ::com::sun::star::lang::IllegalArgumentException );
87 
88 // get actions
89 ::com::sun::star::uno::Any SAL_CALL ListboxGetItems( HWND hwnd );
90 ::com::sun::star::uno::Any SAL_CALL ListboxGetSelectedItem( HWND hwnd );
91 ::com::sun::star::uno::Any SAL_CALL ListboxGetSelectedItemIndex( HWND hwnd );
92 
93 // checkbox helper functions
94 ::com::sun::star::uno::Any SAL_CALL CheckboxGetState( HWND hwnd );
95 
96 void SAL_CALL CheckboxSetState(
97     HWND hwnd, const ::com::sun::star::uno::Any& aState, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rXInterface, sal_Int16 aArgPos )
98     throw( ::com::sun::star::lang::IllegalArgumentException );
99 
100 // calculates the length of '\0' separated and '\0\0'
101 // ending strings used in some Win32 functions
102 // e.g. Filter\0*.txt\0\0
103 // the returned length excludes the last '\0'
104 sal_uInt32 SAL_CALL _wcslenex( const sal_Unicode* pStr );
105 
106 
107 // converts a soffice label to a windows label
108 // the following rules for character replacements
109 // will be done:
110 // '~'  -> '&'
111 // '~~' -> '~'
112 // '&'  -> '&&'
113 rtl::OUString SOfficeToWindowsLabel( const rtl::OUString& aSOLabel );
114 
115 // converts a windows label to a soffice label
116 // the following rules for character replacements
117 // will be done:
118 // '&'  -> '~'
119 // '&&' -> '&'
120 // '~'  -> '~~'
121 rtl::OUString WindowsToSOfficeLabel( const rtl::OUString& aWinLabel );
122 
123 #endif
124