1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 
25 #ifndef _WINIMPLHELPER_HXX_
26 #define _WINIMPLHELPER_HXX_
27 
28 //------------------------------------------------------------------------
29 // includes
30 //------------------------------------------------------------------------
31 
32 #include <sal/types.h>
33 #include <rtl/ustring.hxx>
34 
35 #if defined _MSC_VER
36 #pragma warning(push, 1)
37 #endif
38 #include <windows.h>
39 #if defined _MSC_VER
40 #pragma warning(pop)
41 #endif
42 #include <com/sun/star/uno/Any.hxx>
43 #include <com/sun/star/lang/IllegalArgumentException.hpp>
44 
45 //------------------------------------------------------------------------
46 // deklarations
47 //------------------------------------------------------------------------
48 
49 bool SAL_CALL IsWindowsVistaOrNewer();
50 bool SAL_CALL IsWindows7();
51 bool SAL_CALL IsWindowsVista();
52 bool SAL_CALL IsWindows2000();
53 bool SAL_CALL IsWindowsXP();
54 bool SAL_CALL IsWindows98();
55 bool SAL_CALL IsWindowsME();
56 
57 // returns true if the platform is
58 // Windows 2000 or above
59 bool SAL_CALL IsWindows2000Platform();
60 
61 #define IsWin2000 IsWindows2000
62 
63 // set actions
64 void SAL_CALL ListboxAddItem(
65     HWND hwnd, const ::com::sun::star::uno::Any& aItem, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rXInterface, sal_Int16 aArgPos )
66     throw( ::com::sun::star::lang::IllegalArgumentException );
67 
68 void SAL_CALL ListboxAddItems(
69     HWND hwnd, const ::com::sun::star::uno::Any& aItemList, 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 ListboxDeleteItem(
73     HWND hwnd, const ::com::sun::star::uno::Any& aPosition, 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 ListboxDeleteItems(
77     HWND hwnd, const ::com::sun::star::uno::Any& aUnused, 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 ListboxSetSelectedItem(
81     HWND hwnd, const ::com::sun::star::uno::Any& aPosition, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rXInterface, sal_Int16 aArgPos )
82     throw( ::com::sun::star::lang::IllegalArgumentException );
83 
84 // get actions
85 ::com::sun::star::uno::Any SAL_CALL ListboxGetItems( HWND hwnd );
86 ::com::sun::star::uno::Any SAL_CALL ListboxGetSelectedItem( HWND hwnd );
87 ::com::sun::star::uno::Any SAL_CALL ListboxGetSelectedItemIndex( HWND hwnd );
88 
89 // checkbox helper functions
90 ::com::sun::star::uno::Any SAL_CALL CheckboxGetState( HWND hwnd );
91 
92 void SAL_CALL CheckboxSetState(
93     HWND hwnd, const ::com::sun::star::uno::Any& aState, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rXInterface, sal_Int16 aArgPos )
94     throw( ::com::sun::star::lang::IllegalArgumentException );
95 
96 // calculates the length of '\0' separated and '\0\0'
97 // ending strings used in some Win32 functions
98 // e.g. Filter\0*.txt\0\0
99 // the returned length excludes the last '\0'
100 sal_uInt32 SAL_CALL _wcslenex( const sal_Unicode* pStr );
101 
102 
103 // converts a soffice label to a windows label
104 // the following rules for character replacements
105 // will be done:
106 // '~'  -> '&'
107 // '~~' -> '~'
108 // '&'  -> '&&'
109 rtl::OUString SOfficeToWindowsLabel( const rtl::OUString& aSOLabel );
110 
111 // converts a windows label to a soffice label
112 // the following rules for character replacements
113 // will be done:
114 // '&'  -> '~'
115 // '&&' -> '&'
116 // '~'  -> '~~'
117 rtl::OUString WindowsToSOfficeLabel( const rtl::OUString& aWinLabel );
118 
119 #endif
120