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