1*f8e2c85aSAndrew Rist /**************************************************************
2*f8e2c85aSAndrew Rist  *
3*f8e2c85aSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f8e2c85aSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f8e2c85aSAndrew Rist  * distributed with this work for additional information
6*f8e2c85aSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f8e2c85aSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f8e2c85aSAndrew Rist  * "License"); you may not use this file except in compliance
9*f8e2c85aSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*f8e2c85aSAndrew Rist  *
11*f8e2c85aSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*f8e2c85aSAndrew Rist  *
13*f8e2c85aSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f8e2c85aSAndrew Rist  * software distributed under the License is distributed on an
15*f8e2c85aSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f8e2c85aSAndrew Rist  * KIND, either express or implied.  See the License for the
17*f8e2c85aSAndrew Rist  * specific language governing permissions and limitations
18*f8e2c85aSAndrew Rist  * under the License.
19*f8e2c85aSAndrew Rist  *
20*f8e2c85aSAndrew Rist  *************************************************************/
21*f8e2c85aSAndrew Rist 
22*f8e2c85aSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include "precompiled_shell.hxx"
25cdf0e10cSrcweir #include "sal/config.h"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <string.h>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include "com/sun/star/uno/RuntimeException.hpp"
30cdf0e10cSrcweir #include "osl/file.hxx"
31cdf0e10cSrcweir #include "osl/security.hxx"
32cdf0e10cSrcweir #include "osl/thread.h"
33cdf0e10cSrcweir #include "rtl/strbuf.hxx"
34cdf0e10cSrcweir #include "rtl/ustrbuf.hxx"
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #include "gconfaccess.hxx"
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #define GCONF_PROXY_MODE_KEY "/system/proxy/mode"
39cdf0e10cSrcweir #define GCONF_AUTO_SAVE_KEY  "/apps/openoffice/auto_save"
40cdf0e10cSrcweir 
41cdf0e10cSrcweir namespace gconfaccess {
42cdf0e10cSrcweir 
43cdf0e10cSrcweir namespace {
44cdf0e10cSrcweir 
45cdf0e10cSrcweir namespace css = com::sun::star ;
46cdf0e10cSrcweir namespace uno = css::uno ;
47cdf0e10cSrcweir using namespace rtl;
48cdf0e10cSrcweir 
getGconfClient()49cdf0e10cSrcweir GConfClient* getGconfClient()
50cdf0e10cSrcweir {
51cdf0e10cSrcweir     static GConfClient* mClient= 0;
52cdf0e10cSrcweir     if (mClient == NULL)
53cdf0e10cSrcweir     {
54cdf0e10cSrcweir         /* initialize glib object type library */
55cdf0e10cSrcweir         g_type_init();
56cdf0e10cSrcweir 
57cdf0e10cSrcweir         GError* aError = NULL;
58cdf0e10cSrcweir         if (!gconf_init(0, NULL, &aError))
59cdf0e10cSrcweir         {
60cdf0e10cSrcweir             rtl::OUStringBuffer msg;
61cdf0e10cSrcweir             msg.appendAscii("GconfBackend:GconfLayer: Cannot Initialize Gconf connection - " );
62cdf0e10cSrcweir             msg.appendAscii(aError->message);
63cdf0e10cSrcweir 
64cdf0e10cSrcweir             g_error_free(aError);
65cdf0e10cSrcweir             aError = NULL;
66cdf0e10cSrcweir             throw uno::RuntimeException(msg.makeStringAndClear(),NULL);
67cdf0e10cSrcweir         }
68cdf0e10cSrcweir 
69cdf0e10cSrcweir         mClient = gconf_client_get_default();
70cdf0e10cSrcweir         if (!mClient)
71cdf0e10cSrcweir         {
72cdf0e10cSrcweir             throw uno::RuntimeException(rtl::OUString::createFromAscii
73cdf0e10cSrcweir                 ("GconfBackend:GconfLayer: Cannot Initialize Gconf connection"),NULL);
74cdf0e10cSrcweir         }
75cdf0e10cSrcweir 
76cdf0e10cSrcweir         static const char * const PreloadValuesList[] =
77cdf0e10cSrcweir         {
78cdf0e10cSrcweir             "/desktop/gnome/interface",
79cdf0e10cSrcweir             "/system/proxy",
80cdf0e10cSrcweir             "/system/http_proxy/host",
81cdf0e10cSrcweir             "/desktop/gnome/url-handlers/mailto",
82cdf0e10cSrcweir #ifdef ENABLE_LOCKDOWN
83cdf0e10cSrcweir             "/apps/openoffice",
84cdf0e10cSrcweir             "/desktop/gnome/lockdown",
85cdf0e10cSrcweir             "/apps/openoffice/lockdown",
86cdf0e10cSrcweir #endif // ENABLE_LOCKDOWN
87cdf0e10cSrcweir             NULL
88cdf0e10cSrcweir         };
89cdf0e10cSrcweir         int i = 0;
90cdf0e10cSrcweir         while( PreloadValuesList[i] != NULL )
91cdf0e10cSrcweir             gconf_client_preload( mClient, PreloadValuesList[i++], GCONF_CLIENT_PRELOAD_ONELEVEL, NULL );
92cdf0e10cSrcweir     }
93cdf0e10cSrcweir 
94cdf0e10cSrcweir     return mClient;
95cdf0e10cSrcweir }
96cdf0e10cSrcweir 
xdg_user_dir_lookup(const char * type)97cdf0e10cSrcweir static OUString xdg_user_dir_lookup (const char *type)
98cdf0e10cSrcweir {
99cdf0e10cSrcweir     char *config_home;
100cdf0e10cSrcweir     char *p;
101cdf0e10cSrcweir     int relative;
102cdf0e10cSrcweir     bool bError = false;
103cdf0e10cSrcweir 
104cdf0e10cSrcweir     osl::Security aSecurity;
105cdf0e10cSrcweir     oslFileHandle handle;
106cdf0e10cSrcweir     OUString aHomeDirURL;
107cdf0e10cSrcweir     OUString aDocumentsDirURL;
108cdf0e10cSrcweir     OUString aConfigFileURL;
109cdf0e10cSrcweir     OUStringBuffer aUserDirBuf;
110cdf0e10cSrcweir 
111cdf0e10cSrcweir     if (!aSecurity.getHomeDir( aHomeDirURL ) )
112cdf0e10cSrcweir     {
113cdf0e10cSrcweir 	osl::FileBase::getFileURLFromSystemPath(rtl::OUString::createFromAscii("/tmp"), aDocumentsDirURL);
114cdf0e10cSrcweir 	return aDocumentsDirURL;
115cdf0e10cSrcweir     }
116cdf0e10cSrcweir 
117cdf0e10cSrcweir     config_home = getenv ("XDG_CONFIG_HOME");
118cdf0e10cSrcweir     if (config_home == NULL || config_home[0] == 0)
119cdf0e10cSrcweir     {
120cdf0e10cSrcweir 	aConfigFileURL = OUString(aHomeDirURL);
121cdf0e10cSrcweir 	aConfigFileURL += OUString::createFromAscii( "/.config/user-dirs.dirs" );
122cdf0e10cSrcweir     }
123cdf0e10cSrcweir     else
124cdf0e10cSrcweir     {
125cdf0e10cSrcweir 	aConfigFileURL = OUString::createFromAscii(config_home);
126cdf0e10cSrcweir 	aConfigFileURL += OUString::createFromAscii( "/user-dirs.dirs" );
127cdf0e10cSrcweir     }
128cdf0e10cSrcweir 
129cdf0e10cSrcweir     if(osl_File_E_None == osl_openFile(aConfigFileURL.pData, &handle, osl_File_OpenFlag_Read))
130cdf0e10cSrcweir     {
131cdf0e10cSrcweir 	rtl::ByteSequence seq;
132cdf0e10cSrcweir 	while (osl_File_E_None == osl_readLine(handle , (sal_Sequence **)&seq))
133cdf0e10cSrcweir 	{
134cdf0e10cSrcweir 	    /* Remove newline at end */
135cdf0e10cSrcweir 	    int len = seq.getLength();
136cdf0e10cSrcweir 	    if(len>0 && seq[len-1] == '\n')
137cdf0e10cSrcweir 		seq[len-1] = 0;
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 	    p = (char *)seq.getArray();
140cdf0e10cSrcweir 
141cdf0e10cSrcweir 	    while (*p == ' ' || *p == '\t')
142cdf0e10cSrcweir 		p++;
143cdf0e10cSrcweir 
144cdf0e10cSrcweir 	    if (strncmp (p, "XDG_", 4) != 0)
145cdf0e10cSrcweir 		continue;
146cdf0e10cSrcweir 	    p += 4;
147cdf0e10cSrcweir 	    if (strncmp (p, type, strlen (type)) != 0)
148cdf0e10cSrcweir 		continue;
149cdf0e10cSrcweir 	    p += strlen (type);
150cdf0e10cSrcweir 	    if (strncmp (p, "_DIR", 4) != 0)
151cdf0e10cSrcweir 		continue;
152cdf0e10cSrcweir 	    p += 4;
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 	    while (*p == ' ' || *p == '\t')
155cdf0e10cSrcweir 		p++;
156cdf0e10cSrcweir 
157cdf0e10cSrcweir 	    if (*p != '=')
158cdf0e10cSrcweir 		continue;
159cdf0e10cSrcweir 	    p++;
160cdf0e10cSrcweir 
161cdf0e10cSrcweir 	    while (*p == ' ' || *p == '\t')
162cdf0e10cSrcweir 		p++;
163cdf0e10cSrcweir 
164cdf0e10cSrcweir 	    if (*p != '"')
165cdf0e10cSrcweir 		continue;
166cdf0e10cSrcweir 	    p++;
167cdf0e10cSrcweir 
168cdf0e10cSrcweir 	    relative = 0;
169cdf0e10cSrcweir 	    if (strncmp (p, "$HOME/", 6) == 0)
170cdf0e10cSrcweir 	    {
171cdf0e10cSrcweir 		p += 6;
172cdf0e10cSrcweir 		relative = 1;
173cdf0e10cSrcweir 	    }
174cdf0e10cSrcweir 	    else if (*p != '/')
175cdf0e10cSrcweir 		continue;
176cdf0e10cSrcweir 
177cdf0e10cSrcweir 	    if (relative)
178cdf0e10cSrcweir 	    {
179cdf0e10cSrcweir 		aUserDirBuf = OUStringBuffer(aHomeDirURL);
180cdf0e10cSrcweir 		aUserDirBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "/" ) );
181cdf0e10cSrcweir 	    }
182cdf0e10cSrcweir 	    else
183cdf0e10cSrcweir 	    {
184cdf0e10cSrcweir 		aUserDirBuf = OUStringBuffer();
185cdf0e10cSrcweir 	    }
186cdf0e10cSrcweir 
187cdf0e10cSrcweir 	    while (*p && *p != '"')
188cdf0e10cSrcweir 	    {
189cdf0e10cSrcweir 		if ((*p == '\\') && (*(p+1) != 0))
190cdf0e10cSrcweir 		    p++;
191cdf0e10cSrcweir 		aUserDirBuf.append((sal_Unicode)*p++);
192cdf0e10cSrcweir 	    }
193cdf0e10cSrcweir 	}
194cdf0e10cSrcweir       osl_closeFile(handle);
195cdf0e10cSrcweir     }
196cdf0e10cSrcweir     else
197cdf0e10cSrcweir 	bError = true;
198cdf0e10cSrcweir 
199cdf0e10cSrcweir     if (aUserDirBuf.getLength()>0 && !bError)
200cdf0e10cSrcweir     {
201cdf0e10cSrcweir 	aDocumentsDirURL = aUserDirBuf.makeStringAndClear();
202cdf0e10cSrcweir 	osl::Directory aDocumentsDir( aDocumentsDirURL );
203cdf0e10cSrcweir 	if( osl::FileBase::E_None == aDocumentsDir.open() )
204cdf0e10cSrcweir 	    return aDocumentsDirURL;
205cdf0e10cSrcweir     }
206cdf0e10cSrcweir 
207cdf0e10cSrcweir     /* Special case desktop for historical compatibility */
208cdf0e10cSrcweir     if (strcmp (type, "DESKTOP") == 0)
209cdf0e10cSrcweir     {
210cdf0e10cSrcweir 	aUserDirBuf = OUStringBuffer(aHomeDirURL);
211cdf0e10cSrcweir 	aUserDirBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "/Desktop" ) );
212cdf0e10cSrcweir 	return aUserDirBuf.makeStringAndClear();
213cdf0e10cSrcweir     }
214cdf0e10cSrcweir     else
215cdf0e10cSrcweir     {
216cdf0e10cSrcweir 	aUserDirBuf = OUStringBuffer(aHomeDirURL);
217cdf0e10cSrcweir 	aUserDirBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "/Documents" ) );
218cdf0e10cSrcweir 	return aUserDirBuf.makeStringAndClear();
219cdf0e10cSrcweir     }
220cdf0e10cSrcweir }
221cdf0e10cSrcweir 
222cdf0e10cSrcweir //------------------------------------------------------------------------------
223cdf0e10cSrcweir 
makeAnyOfGconfValue(GConfValue * aGconfValue)224cdf0e10cSrcweir uno::Any makeAnyOfGconfValue( GConfValue *aGconfValue )
225cdf0e10cSrcweir {
226cdf0e10cSrcweir     switch( aGconfValue->type )
227cdf0e10cSrcweir     {
228cdf0e10cSrcweir         case GCONF_VALUE_BOOL:
229cdf0e10cSrcweir             return uno::makeAny( (sal_Bool) gconf_value_get_bool( aGconfValue ) );
230cdf0e10cSrcweir 
231cdf0e10cSrcweir         case GCONF_VALUE_INT:
232cdf0e10cSrcweir             return uno::makeAny( (sal_Int32) gconf_value_get_int( aGconfValue ) );
233cdf0e10cSrcweir 
234cdf0e10cSrcweir         case GCONF_VALUE_STRING:
235cdf0e10cSrcweir             return uno::makeAny( OStringToOUString( rtl::OString(
236cdf0e10cSrcweir                 gconf_value_get_string(aGconfValue) ), RTL_TEXTENCODING_UTF8 ) );
237cdf0e10cSrcweir 
238cdf0e10cSrcweir         default:
239cdf0e10cSrcweir             fprintf( stderr, "makeAnyOfGconfValue: Type not handled.\n" );
240cdf0e10cSrcweir             break;
241cdf0e10cSrcweir     }
242cdf0e10cSrcweir 
243cdf0e10cSrcweir     return uno::Any();
244cdf0e10cSrcweir }
245cdf0e10cSrcweir 
246cdf0e10cSrcweir //------------------------------------------------------------------------------
247cdf0e10cSrcweir 
splitFontName(GConfValue * aGconfValue,rtl::OUString & rName,sal_Int16 & rHeight)248cdf0e10cSrcweir static void splitFontName( GConfValue *aGconfValue, rtl::OUString &rName, sal_Int16 &rHeight)
249cdf0e10cSrcweir {
250cdf0e10cSrcweir    rtl::OString aFont( gconf_value_get_string( aGconfValue ) );
251cdf0e10cSrcweir    aFont.trim();
252cdf0e10cSrcweir    sal_Int32 nIdx = aFont.lastIndexOf( ' ' );
253cdf0e10cSrcweir    if (nIdx < 1) { // urk
254cdf0e10cSrcweir        rHeight = 12;
255cdf0e10cSrcweir        nIdx = aFont.getLength();
256cdf0e10cSrcweir    } else {
257cdf0e10cSrcweir        rtl::OString aSize = aFont.copy( nIdx + 1 );
258cdf0e10cSrcweir        rHeight = static_cast<sal_Int16>( aSize.toInt32() );
259cdf0e10cSrcweir    }
260cdf0e10cSrcweir 
261cdf0e10cSrcweir    rName = rtl::OStringToOUString( aFont.copy( 0, nIdx ), RTL_TEXTENCODING_UTF8 );
262cdf0e10cSrcweir }
263cdf0e10cSrcweir 
264cdf0e10cSrcweir //------------------------------------------------------------------------------
265cdf0e10cSrcweir 
translateToOOo(const ConfigurationValue aValue,GConfValue * aGconfValue)266cdf0e10cSrcweir uno::Any translateToOOo( const ConfigurationValue aValue, GConfValue *aGconfValue )
267cdf0e10cSrcweir {
268cdf0e10cSrcweir 
269cdf0e10cSrcweir     switch( aValue.nSettingId )
270cdf0e10cSrcweir     {
271cdf0e10cSrcweir         case SETTING_PROXY_MODE:
272cdf0e10cSrcweir         {
273cdf0e10cSrcweir             rtl::OUString aProxyMode;
274cdf0e10cSrcweir             uno::Any aOriginalValue = makeAnyOfGconfValue( aGconfValue );
275cdf0e10cSrcweir             aOriginalValue >>= aProxyMode;
276cdf0e10cSrcweir 
277cdf0e10cSrcweir             if( aProxyMode.equals( rtl::OUString::createFromAscii( "manual" ) ) )
278cdf0e10cSrcweir                 return uno::makeAny( (sal_Int32) 1 );
279cdf0e10cSrcweir             else if( aProxyMode.equals( rtl::OUString::createFromAscii( "none" ) ) )
280cdf0e10cSrcweir                 return uno::makeAny( (sal_Int32) 0 );
281cdf0e10cSrcweir         }
282cdf0e10cSrcweir             break;
283cdf0e10cSrcweir 
284cdf0e10cSrcweir         case SETTING_NO_PROXY_FOR:
285cdf0e10cSrcweir         {
286cdf0e10cSrcweir             rtl::OStringBuffer aBuffer;
287cdf0e10cSrcweir             if( (GCONF_VALUE_LIST == aGconfValue->type) && (GCONF_VALUE_STRING == gconf_value_get_list_type(aGconfValue)) )
288cdf0e10cSrcweir             {
289cdf0e10cSrcweir                 GSList * list = gconf_value_get_list(aGconfValue);
290cdf0e10cSrcweir                 for(; list; list = g_slist_next(list))
291cdf0e10cSrcweir                 {
292cdf0e10cSrcweir                     aBuffer.append(gconf_value_get_string((GConfValue *) list->data));
293cdf0e10cSrcweir                     aBuffer.append(";");
294cdf0e10cSrcweir                 }
295cdf0e10cSrcweir                 // Remove trailing ";"
296cdf0e10cSrcweir                 aBuffer.setLength(aBuffer.getLength()-1);
297cdf0e10cSrcweir                 return uno::makeAny(rtl::OStringToOUString(aBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8));
298cdf0e10cSrcweir             }
299cdf0e10cSrcweir             else
300cdf0e10cSrcweir                 g_warning( "unexpected type for ignore_hosts" );
301cdf0e10cSrcweir         }
302cdf0e10cSrcweir             break;
303cdf0e10cSrcweir 
304cdf0e10cSrcweir         case SETTING_MAILER_PROGRAM:
305cdf0e10cSrcweir         {
306cdf0e10cSrcweir             rtl::OUString aMailer;
307cdf0e10cSrcweir             uno::Any aOriginalValue = makeAnyOfGconfValue( aGconfValue );
308cdf0e10cSrcweir             aOriginalValue >>= aMailer;
309cdf0e10cSrcweir             sal_Int32 nIndex = 0;
310cdf0e10cSrcweir             return uno::makeAny( aMailer.getToken( 0, ' ', nIndex ) );
311cdf0e10cSrcweir         }
312cdf0e10cSrcweir 
313cdf0e10cSrcweir #ifdef ENABLE_LOCKDOWN
314cdf0e10cSrcweir         // "short" values need to be returned a sal_Int16
315cdf0e10cSrcweir         case SETTING_FONT_ANTI_ALIASING_MIN_PIXEL:
316cdf0e10cSrcweir         case SETTING_SYMBOL_SET:
317cdf0e10cSrcweir         {
318cdf0e10cSrcweir             sal_Int32 nShortValue;
319cdf0e10cSrcweir             uno::Any aOriginalValue = makeAnyOfGconfValue( aGconfValue );
320cdf0e10cSrcweir             aOriginalValue >>= nShortValue;
321cdf0e10cSrcweir             return uno::makeAny( (sal_Int16) nShortValue );
322cdf0e10cSrcweir         }
323cdf0e10cSrcweir             break;
324cdf0e10cSrcweir #endif // ENABLE_LOCKDOWN
325cdf0e10cSrcweir 
326cdf0e10cSrcweir         // "boolean" values that need a string to be returned
327cdf0e10cSrcweir         case SETTING_ENABLE_ACCESSIBILITY:
328cdf0e10cSrcweir #ifdef ENABLE_LOCKDOWN
329cdf0e10cSrcweir         case SETTING_DISABLE_PRINTING:
330cdf0e10cSrcweir #endif // ENABLE_LOCKDOWN
331cdf0e10cSrcweir         {
332cdf0e10cSrcweir             sal_Bool bBooleanValue = false;
333cdf0e10cSrcweir             uno::Any aOriginalValue = makeAnyOfGconfValue( aGconfValue );
334cdf0e10cSrcweir             aOriginalValue >>= bBooleanValue;
335cdf0e10cSrcweir             return uno::makeAny( rtl::OUString::valueOf( (sal_Bool) bBooleanValue ) );
336cdf0e10cSrcweir         }
337cdf0e10cSrcweir 
338cdf0e10cSrcweir         case SETTING_WORK_DIRECTORY:
339cdf0e10cSrcweir         {
340cdf0e10cSrcweir             rtl::OUString aDocumentsDirURL = xdg_user_dir_lookup("DOCUMENTS");
341cdf0e10cSrcweir 
342cdf0e10cSrcweir             return uno::makeAny( aDocumentsDirURL );
343cdf0e10cSrcweir         }
344cdf0e10cSrcweir 
345cdf0e10cSrcweir         case SETTING_USER_GIVENNAME:
346cdf0e10cSrcweir         {
347cdf0e10cSrcweir             rtl::OUString aCompleteName( rtl::OStringToOUString(
348cdf0e10cSrcweir                 g_get_real_name(), osl_getThreadTextEncoding() ) );
349cdf0e10cSrcweir             sal_Int32 nIndex = 0;
350cdf0e10cSrcweir             rtl::OUString aGivenName;
351cdf0e10cSrcweir             do
352cdf0e10cSrcweir                 aGivenName = aCompleteName.getToken( 0, ' ', nIndex );
353cdf0e10cSrcweir             while ( nIndex == 0 );
354cdf0e10cSrcweir 
355cdf0e10cSrcweir             return uno::makeAny( aGivenName );
356cdf0e10cSrcweir 
357cdf0e10cSrcweir         }
358cdf0e10cSrcweir 
359cdf0e10cSrcweir         case SETTING_USER_SURNAME:
360cdf0e10cSrcweir         {
361cdf0e10cSrcweir             rtl::OUString aCompleteName( rtl::OStringToOUString(
362cdf0e10cSrcweir                 g_get_real_name(), osl_getThreadTextEncoding() ) );
363cdf0e10cSrcweir             sal_Int32 nIndex = 0;
364cdf0e10cSrcweir             rtl::OUString aSurname;
365cdf0e10cSrcweir             do
366cdf0e10cSrcweir                 aSurname = aCompleteName.getToken( 0, ' ', nIndex );
367cdf0e10cSrcweir             while ( nIndex >= 0 );
368cdf0e10cSrcweir 
369cdf0e10cSrcweir             return uno::makeAny( aSurname );
370cdf0e10cSrcweir         }
371cdf0e10cSrcweir 
372cdf0e10cSrcweir         case SETTING_SOURCEVIEWFONT_NAME:
373cdf0e10cSrcweir         case SETTING_SOURCEVIEWFONT_HEIGHT:
374cdf0e10cSrcweir         {
375cdf0e10cSrcweir             rtl::OUString aName;
376cdf0e10cSrcweir             sal_Int16 nHeight;
377cdf0e10cSrcweir 
378cdf0e10cSrcweir             splitFontName (aGconfValue, aName, nHeight);
379cdf0e10cSrcweir             if (aValue.nSettingId == SETTING_SOURCEVIEWFONT_NAME)
380cdf0e10cSrcweir                 return uno::makeAny( aName );
381cdf0e10cSrcweir             else
382cdf0e10cSrcweir                 return uno::makeAny( nHeight );
383cdf0e10cSrcweir         }
384cdf0e10cSrcweir 
385cdf0e10cSrcweir 
386cdf0e10cSrcweir         default:
387cdf0e10cSrcweir             fprintf( stderr, "Unhandled setting to translate.\n" );
388cdf0e10cSrcweir             break;
389cdf0e10cSrcweir     }
390cdf0e10cSrcweir 
391cdf0e10cSrcweir     return uno::Any();
392cdf0e10cSrcweir }
393cdf0e10cSrcweir 
394cdf0e10cSrcweir //------------------------------------------------------------------------------
395cdf0e10cSrcweir 
isDependencySatisfied(GConfClient * aClient,const ConfigurationValue aValue)396cdf0e10cSrcweir sal_Bool SAL_CALL isDependencySatisfied( GConfClient* aClient, const ConfigurationValue aValue )
397cdf0e10cSrcweir {
398cdf0e10cSrcweir     switch( aValue.nDependsOn )
399cdf0e10cSrcweir     {
400cdf0e10cSrcweir         case SETTING_PROXY_MODE:
401cdf0e10cSrcweir         {
402cdf0e10cSrcweir             GConfValue* aGconfValue = gconf_client_get( aClient, GCONF_PROXY_MODE_KEY, NULL );
403cdf0e10cSrcweir 
404cdf0e10cSrcweir             if ( aGconfValue != NULL )
405cdf0e10cSrcweir             {
406cdf0e10cSrcweir                 bool bOk = g_strcasecmp( "manual", gconf_value_get_string( aGconfValue ) ) == 0;
407cdf0e10cSrcweir                 gconf_value_free( aGconfValue );
408cdf0e10cSrcweir                 if (bOk) return sal_True;
409cdf0e10cSrcweir             }
410cdf0e10cSrcweir         }
411cdf0e10cSrcweir             break;
412cdf0e10cSrcweir 
413cdf0e10cSrcweir         case SETTING_WORK_DIRECTORY:
414cdf0e10cSrcweir         {
415cdf0e10cSrcweir             rtl::OUString aDocumentsDirURL = xdg_user_dir_lookup("DOCUMENTS");
416cdf0e10cSrcweir             osl::Directory aDocumentsDir( aDocumentsDirURL );
417cdf0e10cSrcweir 
418cdf0e10cSrcweir             if( osl::FileBase::E_None == aDocumentsDir.open() )
419cdf0e10cSrcweir                 return sal_True;
420cdf0e10cSrcweir         }
421cdf0e10cSrcweir             break;
422cdf0e10cSrcweir 
423cdf0e10cSrcweir         case SETTING_USER_GIVENNAME:
424cdf0e10cSrcweir         {
425cdf0e10cSrcweir             rtl::OUString aCompleteName( rtl::OStringToOUString(
426cdf0e10cSrcweir                 g_get_real_name(), osl_getThreadTextEncoding() ) );
427cdf0e10cSrcweir             if( !aCompleteName.equalsAscii( "Unknown" ) )
428cdf0e10cSrcweir                 return sal_True;
429cdf0e10cSrcweir         }
430cdf0e10cSrcweir             break;
431cdf0e10cSrcweir 
432cdf0e10cSrcweir         case SETTING_USER_SURNAME:
433cdf0e10cSrcweir         {
434cdf0e10cSrcweir             rtl::OUString aCompleteName( rtl::OStringToOUString(
435cdf0e10cSrcweir                 g_get_real_name(), osl_getThreadTextEncoding() ) );
436cdf0e10cSrcweir             if( !aCompleteName.equalsAscii( "Unknown" ) )
437cdf0e10cSrcweir             {
438cdf0e10cSrcweir                 if( aCompleteName.trim().indexOf(rtl::OUString::createFromAscii(" "), 0) != -1 )
439cdf0e10cSrcweir                     return sal_True;
440cdf0e10cSrcweir             }
441cdf0e10cSrcweir         }
442cdf0e10cSrcweir             break;
443cdf0e10cSrcweir 
444cdf0e10cSrcweir #ifdef ENABLE_LOCKDOWN
445cdf0e10cSrcweir         case SETTING_AUTO_SAVE:
446cdf0e10cSrcweir         {
447cdf0e10cSrcweir             GConfValue* aGconfValue = gconf_client_get( aClient, GCONF_AUTO_SAVE_KEY, NULL );
448cdf0e10cSrcweir 
449cdf0e10cSrcweir             if( ( aGconfValue != NULL ) )
450cdf0e10cSrcweir             {
451cdf0e10cSrcweir                 bool bOk = gconf_value_get_bool( aGconfValue );
452cdf0e10cSrcweir                 gconf_value_free( aGconfValue );
453cdf0e10cSrcweir                 if (bOk) return sal_True;
454cdf0e10cSrcweir             }
455cdf0e10cSrcweir         }
456cdf0e10cSrcweir             break;
457cdf0e10cSrcweir #endif // ENABLE_LOCKDOWN
458cdf0e10cSrcweir 
459cdf0e10cSrcweir         default:
460cdf0e10cSrcweir             fprintf( stderr, "Unhandled setting to check dependency.\n" );
461cdf0e10cSrcweir             break;
462cdf0e10cSrcweir     }
463cdf0e10cSrcweir 
464cdf0e10cSrcweir     return sal_False;
465cdf0e10cSrcweir }
466cdf0e10cSrcweir 
467cdf0e10cSrcweir }
468cdf0e10cSrcweir 
469cdf0e10cSrcweir ConfigurationValue const ConfigurationValues[] =
470cdf0e10cSrcweir {
471cdf0e10cSrcweir     {
472cdf0e10cSrcweir         SETTING_ENABLE_ACCESSIBILITY,
473cdf0e10cSrcweir         "/desktop/gnome/interface/accessibility",
474cdf0e10cSrcweir         "EnableATToolSupport",
475cdf0e10cSrcweir         sal_True,
476cdf0e10cSrcweir         SETTINGS_LAST
477cdf0e10cSrcweir     },
478cdf0e10cSrcweir 
479cdf0e10cSrcweir     {
480cdf0e10cSrcweir         SETTING_PROXY_MODE,
481cdf0e10cSrcweir         GCONF_PROXY_MODE_KEY,
482cdf0e10cSrcweir         "ooInetProxyType",
483cdf0e10cSrcweir         sal_True,
484cdf0e10cSrcweir         SETTINGS_LAST
485cdf0e10cSrcweir     },
486cdf0e10cSrcweir 
487cdf0e10cSrcweir     {
488cdf0e10cSrcweir         SETTING_PROXY_HTTP_HOST,
489cdf0e10cSrcweir         "/system/http_proxy/host",
490cdf0e10cSrcweir         "ooInetHTTPProxyName",
491cdf0e10cSrcweir         sal_False,
492cdf0e10cSrcweir         SETTING_PROXY_MODE
493cdf0e10cSrcweir     },
494cdf0e10cSrcweir 
495cdf0e10cSrcweir     {
496cdf0e10cSrcweir         SETTING_PROXY_HTTP_PORT,
497cdf0e10cSrcweir         "/system/http_proxy/port",
498cdf0e10cSrcweir         "ooInetHTTPProxyPort",
499cdf0e10cSrcweir         sal_False,
500cdf0e10cSrcweir         SETTING_PROXY_MODE
501cdf0e10cSrcweir     },
502cdf0e10cSrcweir 
503cdf0e10cSrcweir 	 {
504cdf0e10cSrcweir         SETTING_PROXY_HTTPS_HOST,
505cdf0e10cSrcweir         "/system/proxy/secure_host",
506cdf0e10cSrcweir         "ooInetHTTPSProxyName",
507cdf0e10cSrcweir         sal_False,
508cdf0e10cSrcweir         SETTING_PROXY_MODE
509cdf0e10cSrcweir     },
510cdf0e10cSrcweir 
511cdf0e10cSrcweir     {
512cdf0e10cSrcweir         SETTING_PROXY_HTTPS_PORT,
513cdf0e10cSrcweir         "/system/proxy/secure_port",
514cdf0e10cSrcweir         "ooInetHTTPSProxyPort",
515cdf0e10cSrcweir         sal_False,
516cdf0e10cSrcweir         SETTING_PROXY_MODE
517cdf0e10cSrcweir     },
518cdf0e10cSrcweir 
519cdf0e10cSrcweir     {
520cdf0e10cSrcweir         SETTING_PROXY_FTP_HOST,
521cdf0e10cSrcweir         "/system/proxy/ftp_host",
522cdf0e10cSrcweir         "ooInetFTPProxyName",
523cdf0e10cSrcweir         sal_False,
524cdf0e10cSrcweir         SETTING_PROXY_MODE
525cdf0e10cSrcweir     },
526cdf0e10cSrcweir 
527cdf0e10cSrcweir     {
528cdf0e10cSrcweir         SETTING_PROXY_FTP_PORT,
529cdf0e10cSrcweir         "/system/proxy/ftp_port",
530cdf0e10cSrcweir         "ooInetFTPProxyPort",
531cdf0e10cSrcweir         sal_False,
532cdf0e10cSrcweir         SETTING_PROXY_MODE
533cdf0e10cSrcweir     },
534cdf0e10cSrcweir 
535cdf0e10cSrcweir     {
536cdf0e10cSrcweir         SETTING_NO_PROXY_FOR,
537cdf0e10cSrcweir         "/system/http_proxy/ignore_hosts",
538cdf0e10cSrcweir         "ooInetNoProxy",
539cdf0e10cSrcweir         sal_True,
540cdf0e10cSrcweir         SETTING_PROXY_MODE
541cdf0e10cSrcweir     },
542cdf0e10cSrcweir 
543cdf0e10cSrcweir     {
544cdf0e10cSrcweir         SETTING_MAILER_PROGRAM,
545cdf0e10cSrcweir         "/desktop/gnome/url-handlers/mailto/command",
546cdf0e10cSrcweir         "ExternalMailer",
547cdf0e10cSrcweir         sal_True,
548cdf0e10cSrcweir         SETTINGS_LAST
549cdf0e10cSrcweir     },
550cdf0e10cSrcweir     {
551cdf0e10cSrcweir         SETTING_SOURCEVIEWFONT_NAME,
552cdf0e10cSrcweir         "/desktop/gnome/interface/monospace_font_name",
553cdf0e10cSrcweir         "SourceViewFontName",
554cdf0e10cSrcweir         sal_True,
555cdf0e10cSrcweir         SETTINGS_LAST
556cdf0e10cSrcweir     },
557cdf0e10cSrcweir     {
558cdf0e10cSrcweir         SETTING_SOURCEVIEWFONT_HEIGHT,
559cdf0e10cSrcweir         "/desktop/gnome/interface/monospace_font_name",
560cdf0e10cSrcweir         "SourceViewFontHeight",
561cdf0e10cSrcweir         sal_True,
562cdf0e10cSrcweir         SETTINGS_LAST
563cdf0e10cSrcweir     },
564cdf0e10cSrcweir 
565cdf0e10cSrcweir     {
566cdf0e10cSrcweir         SETTING_WORK_DIRECTORY,
567cdf0e10cSrcweir         "/desktop/gnome/url-handlers/mailto/command", // dummy
568cdf0e10cSrcweir         "WorkPathVariable",
569cdf0e10cSrcweir         sal_True,
570cdf0e10cSrcweir         SETTING_WORK_DIRECTORY, // so that the existence of the dir can be checked
571cdf0e10cSrcweir 	},
572cdf0e10cSrcweir 
573cdf0e10cSrcweir #ifdef ENABLE_LOCKDOWN
574cdf0e10cSrcweir     {
575cdf0e10cSrcweir         SETTING_WRITER_DEFAULT_DOC_FORMAT,
576cdf0e10cSrcweir         "/apps/openoffice/writer_default_document_format",
577cdf0e10cSrcweir         "TextDocumentSetupFactoryDefaultFilter",
578cdf0e10cSrcweir         sal_False,
579cdf0e10cSrcweir         SETTINGS_LAST
580cdf0e10cSrcweir     },
581cdf0e10cSrcweir 
582cdf0e10cSrcweir     {
583cdf0e10cSrcweir         SETTING_IMPRESS_DEFAULT_DOC_FORMAT,
584cdf0e10cSrcweir         "/apps/openoffice/impress_default_document_format",
585cdf0e10cSrcweir         "PresentationDocumentSetupFactoryDefaultFilter",
586cdf0e10cSrcweir         sal_False,
587cdf0e10cSrcweir         SETTINGS_LAST
588cdf0e10cSrcweir     },
589cdf0e10cSrcweir 
590cdf0e10cSrcweir     {
591cdf0e10cSrcweir         SETTING_CALC_DEFAULT_DOC_FORMAT,
592cdf0e10cSrcweir         "/apps/openoffice/calc_default_document_format",
593cdf0e10cSrcweir         "SpreadsheetDocumentSetupFactoryDefaultFilter",
594cdf0e10cSrcweir         sal_False,
595cdf0e10cSrcweir         SETTINGS_LAST
596cdf0e10cSrcweir     },
597cdf0e10cSrcweir 
598cdf0e10cSrcweir     {
599cdf0e10cSrcweir         SETTING_AUTO_SAVE,
600cdf0e10cSrcweir         GCONF_AUTO_SAVE_KEY,
601cdf0e10cSrcweir         "AutoSaveEnabled",
602cdf0e10cSrcweir         sal_False,
603cdf0e10cSrcweir         SETTINGS_LAST
604cdf0e10cSrcweir     },
605cdf0e10cSrcweir 
606cdf0e10cSrcweir     {
607cdf0e10cSrcweir         SETTING_AUTO_SAVE_INTERVAL,
608cdf0e10cSrcweir         "/apps/openoffice/auto_save_interval",
609cdf0e10cSrcweir         "AutoSaveTimeIntervall",
610cdf0e10cSrcweir         sal_False,
611cdf0e10cSrcweir         SETTING_AUTO_SAVE
612cdf0e10cSrcweir     },
613cdf0e10cSrcweir 
614cdf0e10cSrcweir     {
615cdf0e10cSrcweir         SETTING_USER_GIVENNAME,
616cdf0e10cSrcweir         "/desktop/gnome/url-handlers/mailto/command", // dummy
617cdf0e10cSrcweir         "givenname",
618cdf0e10cSrcweir         sal_True,
619cdf0e10cSrcweir         SETTING_USER_GIVENNAME
620cdf0e10cSrcweir     },
621cdf0e10cSrcweir 
622cdf0e10cSrcweir     {
623cdf0e10cSrcweir         SETTING_USER_SURNAME,
624cdf0e10cSrcweir         "/desktop/gnome/url-handlers/mailto/command", // dummy
625cdf0e10cSrcweir         "sn",
626cdf0e10cSrcweir         sal_True,
627cdf0e10cSrcweir         SETTING_USER_SURNAME
628cdf0e10cSrcweir     },
629cdf0e10cSrcweir 
630cdf0e10cSrcweir     {
631cdf0e10cSrcweir         SETTING_DISABLE_PRINTING,
632cdf0e10cSrcweir         "/desktop/gnome/lockdown/disable_printing",
633cdf0e10cSrcweir         "DisablePrinting",
634cdf0e10cSrcweir         sal_True,
635cdf0e10cSrcweir         SETTINGS_LAST
636cdf0e10cSrcweir     },
637cdf0e10cSrcweir 
638cdf0e10cSrcweir     {
639cdf0e10cSrcweir         SETTING_USE_SYSTEM_FILE_DIALOG,
640cdf0e10cSrcweir         "/apps/openoffice/use_system_file_dialog",
641cdf0e10cSrcweir         "UseSystemFileDialog",
642cdf0e10cSrcweir         sal_False,
643cdf0e10cSrcweir         SETTINGS_LAST
644cdf0e10cSrcweir     },
645cdf0e10cSrcweir 
646cdf0e10cSrcweir     {
647cdf0e10cSrcweir         SETTING_PRINTING_MODIFIES_DOCUMENT,
648cdf0e10cSrcweir         "/apps/openoffice/printing_modifies_doc",
649cdf0e10cSrcweir         "PrintingModifiesDocument",
650cdf0e10cSrcweir         sal_False,
651cdf0e10cSrcweir         SETTINGS_LAST
652cdf0e10cSrcweir     },
653cdf0e10cSrcweir 
654cdf0e10cSrcweir     {
655cdf0e10cSrcweir         SETTING_SHOW_ICONS_IN_MENUS,
656cdf0e10cSrcweir         "/apps/openoffice/show_menu_icons",
657cdf0e10cSrcweir         "ShowIconsInMenues",
658cdf0e10cSrcweir         sal_False,
659cdf0e10cSrcweir         SETTINGS_LAST
660cdf0e10cSrcweir     },
661cdf0e10cSrcweir 
662cdf0e10cSrcweir     {
663cdf0e10cSrcweir         SETTING_SHOW_INACTIVE_MENUITEMS,
664cdf0e10cSrcweir         "/apps/openoffice/show_menu_inactive_items",
665cdf0e10cSrcweir         "DontHideDisabledEntry",
666cdf0e10cSrcweir         sal_False,
667cdf0e10cSrcweir         SETTINGS_LAST
668cdf0e10cSrcweir     },
669cdf0e10cSrcweir 
670cdf0e10cSrcweir     {
671cdf0e10cSrcweir         SETTING_SHOW_FONT_PREVIEW,
672cdf0e10cSrcweir         "/apps/openoffice/show_font_preview",
673cdf0e10cSrcweir         "ShowFontBoxWYSIWYG",
674cdf0e10cSrcweir         sal_False,
675cdf0e10cSrcweir         SETTINGS_LAST
676cdf0e10cSrcweir     },
677cdf0e10cSrcweir 
678cdf0e10cSrcweir     {
679cdf0e10cSrcweir         SETTING_SHOW_FONT_HISTORY,
680cdf0e10cSrcweir         "/apps/openoffice/show_font_history",
681cdf0e10cSrcweir         "FontViewHistory",
682cdf0e10cSrcweir         sal_False,
683cdf0e10cSrcweir         SETTINGS_LAST
684cdf0e10cSrcweir     },
685cdf0e10cSrcweir 
686cdf0e10cSrcweir     {
687cdf0e10cSrcweir         SETTING_ENABLE_OPENGL,
688cdf0e10cSrcweir         "/apps/openoffice/use_opengl",
689cdf0e10cSrcweir         "OpenGL",
690cdf0e10cSrcweir         sal_False,
691cdf0e10cSrcweir         SETTINGS_LAST
692cdf0e10cSrcweir     },
693cdf0e10cSrcweir 
694cdf0e10cSrcweir     {
695cdf0e10cSrcweir         SETTING_OPTIMIZE_OPENGL,
696cdf0e10cSrcweir         "/apps/openoffice/optimize_opengl",
697cdf0e10cSrcweir         "OpenGL_Faster",
698cdf0e10cSrcweir         sal_False,
699cdf0e10cSrcweir         SETTINGS_LAST
700cdf0e10cSrcweir     },
701cdf0e10cSrcweir 
702cdf0e10cSrcweir     {
703cdf0e10cSrcweir         SETTING_USE_SYSTEM_FONT,
704cdf0e10cSrcweir         "/apps/openoffice/use_system_font",
705cdf0e10cSrcweir         "AccessibilityIsSystemFont",
706cdf0e10cSrcweir         sal_False,
707cdf0e10cSrcweir         SETTINGS_LAST
708cdf0e10cSrcweir     },
709cdf0e10cSrcweir 
710cdf0e10cSrcweir     {
711cdf0e10cSrcweir         SETTING_USE_FONT_ANTI_ALIASING,
712cdf0e10cSrcweir         "/apps/openoffice/use_font_anti_aliasing",
713cdf0e10cSrcweir         "FontAntiAliasingEnabled",
714cdf0e10cSrcweir         sal_False,
715cdf0e10cSrcweir         SETTINGS_LAST
716cdf0e10cSrcweir     },
717cdf0e10cSrcweir 
718cdf0e10cSrcweir     {
719cdf0e10cSrcweir         SETTING_FONT_ANTI_ALIASING_MIN_PIXEL,
720cdf0e10cSrcweir         "/apps/openoffice/font_anti_aliasing_min_pixel",
721cdf0e10cSrcweir         "FontAntiAliasingMinPixelHeight",
722cdf0e10cSrcweir         sal_True,
723cdf0e10cSrcweir         SETTINGS_LAST
724cdf0e10cSrcweir     },
725cdf0e10cSrcweir 
726cdf0e10cSrcweir     {
727cdf0e10cSrcweir         SETTING_WARN_CREATE_PDF,
728cdf0e10cSrcweir         "/apps/openoffice/lockdown/warn_info_create_pdf",
729cdf0e10cSrcweir         "WarnCreatePDF",
730cdf0e10cSrcweir         sal_False,
731cdf0e10cSrcweir         SETTINGS_LAST
732cdf0e10cSrcweir     },
733cdf0e10cSrcweir 
734cdf0e10cSrcweir     {
735cdf0e10cSrcweir         SETTING_WARN_PRINT_DOC,
736cdf0e10cSrcweir         "/apps/openoffice/lockdown/warn_info_printing",
737cdf0e10cSrcweir         "WarnPrintDoc",
738cdf0e10cSrcweir         sal_False,
739cdf0e10cSrcweir         SETTINGS_LAST
740cdf0e10cSrcweir     },
741cdf0e10cSrcweir 
742cdf0e10cSrcweir     {
743cdf0e10cSrcweir         SETTING_WARN_SAVEORSEND_DOC,
744cdf0e10cSrcweir         "/apps/openoffice/lockdown/warn_info_saving",
745cdf0e10cSrcweir         "WarnSaveOrSendDoc",
746cdf0e10cSrcweir         sal_False,
747cdf0e10cSrcweir         SETTINGS_LAST
748cdf0e10cSrcweir     },
749cdf0e10cSrcweir 
750cdf0e10cSrcweir     {
751cdf0e10cSrcweir         SETTING_WARN_SIGN_DOC,
752cdf0e10cSrcweir         "/apps/openoffice/lockdown/warn_info_signing",
753cdf0e10cSrcweir         "WarnSignDoc",
754cdf0e10cSrcweir         sal_False,
755cdf0e10cSrcweir         SETTINGS_LAST
756cdf0e10cSrcweir     },
757cdf0e10cSrcweir 
758cdf0e10cSrcweir     {
759cdf0e10cSrcweir         SETTING_REMOVE_PERSONAL_INFO,
760cdf0e10cSrcweir         "/apps/openoffice/lockdown/remove_personal_info_on_save",
761cdf0e10cSrcweir         "Scripting/RemovePersonalInfoOnSaving",
762cdf0e10cSrcweir         sal_False,
763cdf0e10cSrcweir         SETTINGS_LAST
764cdf0e10cSrcweir     },
765cdf0e10cSrcweir 
766cdf0e10cSrcweir     {
767cdf0e10cSrcweir         SETTING_RECOMMEND_PASSWORD,
768cdf0e10cSrcweir         "/apps/openoffice/lockdown/recommend_password_on_save",
769cdf0e10cSrcweir         "RecommendPasswordProtection",
770cdf0e10cSrcweir         sal_False,
771cdf0e10cSrcweir         SETTINGS_LAST
772cdf0e10cSrcweir     },
773cdf0e10cSrcweir 
774cdf0e10cSrcweir     {
775cdf0e10cSrcweir         SETTING_UNDO_STEPS,
776cdf0e10cSrcweir         "/apps/openoffice/undo_steps",
777cdf0e10cSrcweir         "UndoSteps",
778cdf0e10cSrcweir         sal_False,
779cdf0e10cSrcweir         SETTINGS_LAST
780cdf0e10cSrcweir     },
781cdf0e10cSrcweir 
782cdf0e10cSrcweir     {
783cdf0e10cSrcweir         SETTING_SYMBOL_SET,
784cdf0e10cSrcweir         "/apps/openoffice/icon_size",
785cdf0e10cSrcweir         "SymbolSet",
786cdf0e10cSrcweir         sal_True,
787cdf0e10cSrcweir         SETTINGS_LAST
788cdf0e10cSrcweir     },
789cdf0e10cSrcweir 
790cdf0e10cSrcweir     {
791cdf0e10cSrcweir         SETTING_MACRO_SECURITY_LEVEL,
792cdf0e10cSrcweir         "/apps/openoffice/lockdown/macro_security_level",
793cdf0e10cSrcweir         "MacroSecurityLevel",
794cdf0e10cSrcweir         sal_False,
795cdf0e10cSrcweir         SETTINGS_LAST
796cdf0e10cSrcweir     },
797cdf0e10cSrcweir 
798cdf0e10cSrcweir     {
799cdf0e10cSrcweir         SETTING_CREATE_BACKUP,
800cdf0e10cSrcweir         "/apps/openoffice/create_backup",
801cdf0e10cSrcweir         "CreateBackup",
802cdf0e10cSrcweir         sal_False,
803cdf0e10cSrcweir         SETTINGS_LAST
804cdf0e10cSrcweir     },
805cdf0e10cSrcweir 
806cdf0e10cSrcweir     {
807cdf0e10cSrcweir         SETTING_WARN_ALIEN_FORMAT,
808cdf0e10cSrcweir         "/apps/openoffice/warn_alien_format",
809cdf0e10cSrcweir         "WarnAlienFormat",
810cdf0e10cSrcweir         sal_False,
811cdf0e10cSrcweir         SETTINGS_LAST
812cdf0e10cSrcweir     },
813cdf0e10cSrcweir 
814cdf0e10cSrcweir #endif // ENABLE_LOCKDOWN
815cdf0e10cSrcweir };
816cdf0e10cSrcweir 
817cdf0e10cSrcweir std::size_t const nConfigurationValues =
818cdf0e10cSrcweir     sizeof ConfigurationValues / sizeof ConfigurationValues[0];
819cdf0e10cSrcweir 
getValue(ConfigurationValue const & data)820cdf0e10cSrcweir css::beans::Optional< css::uno::Any > getValue(ConfigurationValue const & data)
821cdf0e10cSrcweir {
822cdf0e10cSrcweir     GConfClient* aClient = getGconfClient();
823cdf0e10cSrcweir     GConfValue* aGconfValue;
824cdf0e10cSrcweir     if( ( data.nDependsOn == SETTINGS_LAST ) || isDependencySatisfied( aClient, data ) )
825cdf0e10cSrcweir     {
826cdf0e10cSrcweir         aGconfValue = gconf_client_get( aClient, data.GconfItem, NULL );
827cdf0e10cSrcweir 
828cdf0e10cSrcweir         if( aGconfValue != NULL )
829cdf0e10cSrcweir         {
830cdf0e10cSrcweir             css::uno::Any value;
831cdf0e10cSrcweir             if( data.bNeedsTranslation )
832cdf0e10cSrcweir                 value = translateToOOo( data, aGconfValue );
833cdf0e10cSrcweir             else
834cdf0e10cSrcweir                 value = makeAnyOfGconfValue( aGconfValue );
835cdf0e10cSrcweir 
836cdf0e10cSrcweir             gconf_value_free( aGconfValue );
837cdf0e10cSrcweir 
838cdf0e10cSrcweir             return css::beans::Optional< css::uno::Any >(true, value);
839cdf0e10cSrcweir         }
840cdf0e10cSrcweir     }
841cdf0e10cSrcweir     return css::beans::Optional< css::uno::Any >();
842cdf0e10cSrcweir }
843cdf0e10cSrcweir 
844cdf0e10cSrcweir }
845