bump product version to 4.1.6.2
[LibreOffice.git] / shell / source / backends / gconfbe / gconfaccess.cxx
blobd1b4b0deb542ec3ce229e63496c93fc1353bef23
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sal/macros.h>
21 #include <sal/config.h>
23 #include <string.h>
25 #include "com/sun/star/uno/RuntimeException.hpp"
26 #include "osl/file.hxx"
27 #include "osl/security.hxx"
28 #include "osl/thread.h"
29 #include "rtl/strbuf.hxx"
30 #include "rtl/ustrbuf.hxx"
31 #include "sal/macros.h"
33 #include "gconfaccess.hxx"
35 #define GCONF_PROXY_MODE_KEY "/system/proxy/mode"
37 #ifdef ENABLE_LOCKDOWN
38 #define GCONF_AUTO_SAVE_KEY "/apps/openoffice/auto_save"
39 #define GCONF_USER_AUTO_SAVE_KEY "/apps/openoffice/user_auto_save"
40 #endif
42 namespace gconfaccess {
44 namespace {
46 namespace uno = css::uno ;
49 GConfClient* getGconfClient()
51 static GConfClient* mClient= 0;
52 if (mClient == NULL)
54 #if !GLIB_CHECK_VERSION(2,36,0)
55 /* initialize glib object type library */
56 g_type_init();
57 #endif
59 GError* aError = NULL;
60 if (!gconf_init(0, NULL, &aError))
62 OUString msg("GconfBackend:GconfLayer: Cannot Initialize Gconf connection - " +
63 OUString::createFromAscii(aError->message));
65 g_error_free(aError);
66 aError = NULL;
67 throw uno::RuntimeException(msg, NULL);
70 mClient = gconf_client_get_default();
71 if (!mClient)
73 throw uno::RuntimeException(OUString("GconfBackend:GconfLayer: Cannot Initialize Gconf connection"),NULL);
76 static const char * const PreloadValuesList[] =
78 "/desktop/gnome/interface",
79 "/system/proxy",
80 "/system/http_proxy/host",
81 "/desktop/gnome/url-handlers/mailto",
82 #ifdef ENABLE_LOCKDOWN
83 "/apps/openoffice",
84 "/desktop/gnome/lockdown",
85 "/apps/openoffice/lockdown",
86 #endif // ENABLE_LOCKDOWN
87 NULL
89 int i = 0;
90 while( PreloadValuesList[i] != NULL )
91 gconf_client_preload( mClient, PreloadValuesList[i++], GCONF_CLIENT_PRELOAD_ONELEVEL, NULL );
94 return mClient;
97 static OUString xdg_user_dir_lookup (const char *type)
99 char *config_home;
100 char *p;
101 bool bError = false;
103 osl::Security aSecurity;
104 oslFileHandle handle;
105 OUString aHomeDirURL;
106 OUString aDocumentsDirURL;
107 OUString aConfigFileURL;
108 OUStringBuffer aUserDirBuf;
110 if (!aSecurity.getHomeDir( aHomeDirURL ) )
112 osl::FileBase::getFileURLFromSystemPath(OUString("/tmp"), aDocumentsDirURL);
113 return aDocumentsDirURL;
116 config_home = getenv ("XDG_CONFIG_HOME");
117 if (config_home == NULL || config_home[0] == 0)
119 aConfigFileURL = aHomeDirURL + "/.config/user-dirs.dirs";
121 else
123 aConfigFileURL = OUString::createFromAscii(config_home) + "/user-dirs.dirs";
126 if(osl_File_E_None == osl_openFile(aConfigFileURL.pData, &handle, osl_File_OpenFlag_Read))
128 rtl::ByteSequence seq;
129 while (osl_File_E_None == osl_readLine(handle , (sal_Sequence **)&seq))
131 /* Remove newline at end */
132 int relative = 0;
133 int len = seq.getLength();
134 if(len>0 && seq[len-1] == '\n')
135 seq[len-1] = 0;
137 p = (char *)seq.getArray();
138 while (*p == ' ' || *p == '\t')
139 p++;
140 if (strncmp (p, "XDG_", 4) != 0)
141 continue;
142 p += 4;
143 if (strncmp (p, type, strlen (type)) != 0)
144 continue;
145 p += strlen (type);
146 if (strncmp (p, "_DIR", 4) != 0)
147 continue;
148 p += 4;
149 while (*p == ' ' || *p == '\t')
150 p++;
151 if (*p != '=')
152 continue;
153 p++;
154 while (*p == ' ' || *p == '\t')
155 p++;
156 if (*p != '"')
157 continue;
158 p++;
159 if (strncmp (p, "$HOME/", 6) == 0)
161 p += 6;
162 relative = 1;
164 else if (*p != '/')
165 continue;
166 if (relative)
168 aUserDirBuf = OUStringBuffer(aHomeDirURL + "/");
170 else
172 aUserDirBuf = OUStringBuffer();
174 while (*p && *p != '"')
176 if ((*p == '\\') && (*(p+1) != 0))
177 p++;
178 aUserDirBuf.append((sal_Unicode)*p++);
180 }//end of while
181 osl_closeFile(handle);
183 else
184 bError = true;
185 if (aUserDirBuf.getLength()>0 && !bError)
187 aDocumentsDirURL = aUserDirBuf.makeStringAndClear();
188 osl::Directory aDocumentsDir( aDocumentsDirURL );
189 if( osl::FileBase::E_None == aDocumentsDir.open() )
190 return aDocumentsDirURL;
192 /* Special case desktop for historical compatibility */
193 if (strcmp (type, "DESKTOP") == 0)
195 return aHomeDirURL + "/Desktop";
197 else
199 return aHomeDirURL + "/Documents";
203 //------------------------------------------------------------------------------
205 uno::Any makeAnyOfGconfValue( GConfValue *pGconfValue )
207 switch( pGconfValue->type )
209 case GCONF_VALUE_BOOL:
210 return uno::makeAny( (sal_Bool) gconf_value_get_bool( pGconfValue ) );
212 case GCONF_VALUE_INT:
213 return uno::makeAny( (sal_Int32) gconf_value_get_int( pGconfValue ) );
215 case GCONF_VALUE_STRING:
216 return uno::makeAny( OStringToOUString( OString(
217 gconf_value_get_string(pGconfValue) ), RTL_TEXTENCODING_UTF8 ) );
219 default:
220 fprintf( stderr, "makeAnyOfGconfValue: Type not handled.\n" );
221 break;
224 return uno::Any();
227 //------------------------------------------------------------------------------
229 static void splitFontName( GConfValue *pGconfValue, OUString &rName, sal_Int16 &rHeight)
231 OString aFont( gconf_value_get_string( pGconfValue ) );
232 aFont = aFont.trim();
233 sal_Int32 nIdx = aFont.lastIndexOf( ' ' );
234 if (nIdx < 1) { // urk
235 rHeight = 12;
236 nIdx = aFont.getLength();
237 } else {
238 OString aSize = aFont.copy( nIdx + 1 );
239 rHeight = static_cast<sal_Int16>( aSize.toInt32() );
242 rName = OStringToOUString( aFont.copy( 0, nIdx ), RTL_TEXTENCODING_UTF8 );
245 //------------------------------------------------------------------------------
247 uno::Any translateToOOo( const ConfigurationValue &rValue, GConfValue *pGconfValue )
250 switch( rValue.nSettingId )
252 case SETTING_PROXY_MODE:
254 OUString aProxyMode;
255 uno::Any aOriginalValue = makeAnyOfGconfValue( pGconfValue );
256 aOriginalValue >>= aProxyMode;
258 if( aProxyMode == "manual" )
259 return uno::makeAny( (sal_Int32) 1 );
260 else if( aProxyMode == "none" )
261 return uno::makeAny( (sal_Int32) 0 );
263 break;
265 case SETTING_NO_PROXY_FOR:
267 OStringBuffer aBuffer;
268 if( (GCONF_VALUE_LIST == pGconfValue->type) && (GCONF_VALUE_STRING == gconf_value_get_list_type(pGconfValue)) )
270 GSList * list = gconf_value_get_list(pGconfValue);
271 for(; list; list = g_slist_next(list))
273 aBuffer.append(gconf_value_get_string((GConfValue *) list->data) + OString(";"));
275 // Remove trailing ";"
276 aBuffer.setLength(aBuffer.getLength()-1);
277 return uno::makeAny(OStringToOUString(aBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8));
279 else
280 g_warning( "unexpected type for ignore_hosts" );
282 break;
284 case SETTING_MAILER_PROGRAM:
286 OUString aMailer;
287 uno::Any aOriginalValue = makeAnyOfGconfValue( pGconfValue );
288 aOriginalValue >>= aMailer;
289 sal_Int32 nIndex = 0;
290 return uno::makeAny( aMailer.getToken( 0, ' ', nIndex ) );
293 #ifdef ENABLE_LOCKDOWN
294 // "short" values need to be returned a sal_Int16
295 case SETTING_FONT_ANTI_ALIASING_MIN_PIXEL:
296 case SETTING_SYMBOL_SET:
298 sal_Int32 nShortValue(0);
299 uno::Any aOriginalValue = makeAnyOfGconfValue( pGconfValue );
300 aOriginalValue >>= nShortValue;
301 return uno::makeAny( (sal_Int16) nShortValue );
303 break;
304 #endif // ENABLE_LOCKDOWN
306 // "boolean" values that need a string to be returned
307 case SETTING_ENABLE_ACCESSIBILITY:
308 #ifdef ENABLE_LOCKDOWN
309 case SETTING_DISABLE_PRINTING:
310 #endif // ENABLE_LOCKDOWN
312 sal_Bool bBooleanValue = false;
313 uno::Any aOriginalValue = makeAnyOfGconfValue( pGconfValue );
314 aOriginalValue >>= bBooleanValue;
315 return uno::makeAny( OUString::valueOf( (sal_Bool) bBooleanValue ) );
318 case SETTING_WORK_DIRECTORY:
320 OUString aDocumentsDirURL = xdg_user_dir_lookup("DOCUMENTS");
322 return uno::makeAny( aDocumentsDirURL );
325 case SETTING_USER_GIVENNAME:
327 OUString aCompleteName( OStringToOUString(
328 g_get_real_name(), osl_getThreadTextEncoding() ) );
329 sal_Int32 nIndex = 0;
330 OUString aGivenName;
332 aGivenName = aCompleteName.getToken( 0, ' ', nIndex );
333 while ( nIndex == 0 );
335 return uno::makeAny( aGivenName );
339 case SETTING_USER_SURNAME:
341 OUString aCompleteName( OStringToOUString(
342 g_get_real_name(), osl_getThreadTextEncoding() ) );
343 sal_Int32 nIndex = 0;
344 OUString aSurname;
346 aSurname = aCompleteName.getToken( 0, ' ', nIndex );
347 while ( nIndex >= 0 );
349 return uno::makeAny( aSurname );
352 case SETTING_SOURCEVIEWFONT_NAME:
353 case SETTING_SOURCEVIEWFONT_HEIGHT:
355 OUString aName;
356 sal_Int16 nHeight;
358 splitFontName (pGconfValue, aName, nHeight);
359 if (rValue.nSettingId == SETTING_SOURCEVIEWFONT_NAME)
360 return uno::makeAny( aName );
361 else
362 return uno::makeAny( nHeight );
366 default:
367 fprintf( stderr, "Unhandled setting to translate.\n" );
368 break;
371 return uno::Any();
374 //------------------------------------------------------------------------------
376 sal_Bool SAL_CALL isDependencySatisfied( GConfClient* pClient, const ConfigurationValue &rValue )
378 switch( rValue.nDependsOn )
380 case SETTING_PROXY_MODE:
382 GConfValue* pGconfValue = gconf_client_get( pClient, GCONF_PROXY_MODE_KEY, NULL );
384 if ( pGconfValue != NULL )
386 bool bOk = g_ascii_strcasecmp( "manual", gconf_value_get_string( pGconfValue ) ) == 0;
387 gconf_value_free( pGconfValue );
388 if (bOk) return sal_True;
391 break;
393 case SETTING_WORK_DIRECTORY:
395 OUString aDocumentsDirURL = xdg_user_dir_lookup("DOCUMENTS");
396 osl::Directory aDocumentsDir( aDocumentsDirURL );
398 if( osl::FileBase::E_None == aDocumentsDir.open() )
399 return sal_True;
401 break;
403 case SETTING_USER_GIVENNAME:
405 OUString aCompleteName( OStringToOUString(
406 g_get_real_name(), osl_getThreadTextEncoding() ) );
407 if( aCompleteName != "Unknown" )
408 return sal_True;
410 break;
412 case SETTING_USER_SURNAME:
414 OUString aCompleteName( OStringToOUString(
415 g_get_real_name(), osl_getThreadTextEncoding() ) );
416 if( aCompleteName != "Unknown" )
418 if( aCompleteName.trim().indexOf( ' ' ) != -1 )
419 return sal_True;
422 break;
424 #ifdef ENABLE_LOCKDOWN
425 case SETTING_AUTO_SAVE:
427 GConfValue* pGconfValue = gconf_client_get( pClient, GCONF_AUTO_SAVE_KEY, NULL );
429 if( ( pGconfValue != NULL ) )
431 bool bOk = gconf_value_get_bool( pGconfValue );
432 gconf_value_free( pGconfValue );
433 if (bOk) return sal_True;
436 break;
437 case SETTING_USER_AUTO_SAVE:
439 GConfValue* pGconfValue = gconf_client_get( pClient, GCONF_USER_AUTO_SAVE_KEY, NULL );
441 if( ( pGconfValue != NULL ) )
443 bool bOk = gconf_value_get_bool( pGconfValue );
444 gconf_value_free( pGconfValue );
445 if (bOk) return sal_True;
448 break;
449 #endif // ENABLE_LOCKDOWN
451 default:
452 fprintf( stderr, "Unhandled setting to check dependency.\n" );
453 break;
456 return sal_False;
461 ConfigurationValue const ConfigurationValues[] =
464 SETTING_ENABLE_ACCESSIBILITY,
465 "/desktop/gnome/interface/accessibility",
466 RTL_CONSTASCII_STRINGPARAM("EnableATToolSupport"),
467 sal_True,
468 SETTINGS_LAST
472 SETTING_PROXY_MODE,
473 GCONF_PROXY_MODE_KEY,
474 RTL_CONSTASCII_STRINGPARAM("ooInetProxyType"),
475 sal_True,
476 SETTINGS_LAST
480 SETTING_PROXY_HTTP_HOST,
481 "/system/http_proxy/host",
482 RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyName"),
483 sal_False,
484 SETTING_PROXY_MODE
488 SETTING_PROXY_HTTP_PORT,
489 "/system/http_proxy/port",
490 RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyPort"),
491 sal_False,
492 SETTING_PROXY_MODE
496 SETTING_PROXY_HTTPS_HOST,
497 "/system/proxy/secure_host",
498 RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyName"),
499 sal_False,
500 SETTING_PROXY_MODE
504 SETTING_PROXY_HTTPS_PORT,
505 "/system/proxy/secure_port",
506 RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyPort"),
507 sal_False,
508 SETTING_PROXY_MODE
512 SETTING_PROXY_FTP_HOST,
513 "/system/proxy/ftp_host",
514 RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName"),
515 sal_False,
516 SETTING_PROXY_MODE
520 SETTING_PROXY_FTP_PORT,
521 "/system/proxy/ftp_port",
522 RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyPort"),
523 sal_False,
524 SETTING_PROXY_MODE
528 SETTING_NO_PROXY_FOR,
529 "/system/http_proxy/ignore_hosts",
530 RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy"),
531 sal_True,
532 SETTING_PROXY_MODE
536 SETTING_MAILER_PROGRAM,
537 "/desktop/gnome/url-handlers/mailto/command",
538 RTL_CONSTASCII_STRINGPARAM("ExternalMailer"),
539 sal_True,
540 SETTINGS_LAST
543 SETTING_SOURCEVIEWFONT_NAME,
544 "/desktop/gnome/interface/monospace_font_name",
545 RTL_CONSTASCII_STRINGPARAM("SourceViewFontName"),
546 sal_True,
547 SETTINGS_LAST
550 SETTING_SOURCEVIEWFONT_HEIGHT,
551 "/desktop/gnome/interface/monospace_font_name",
552 RTL_CONSTASCII_STRINGPARAM("SourceViewFontHeight"),
553 sal_True,
554 SETTINGS_LAST
558 SETTING_WORK_DIRECTORY,
559 "/desktop/gnome/url-handlers/mailto/command", // dummy
560 RTL_CONSTASCII_STRINGPARAM("WorkPathVariable"),
561 sal_True,
562 SETTING_WORK_DIRECTORY, // so that the existence of the dir can be checked
566 SETTING_USER_GIVENNAME,
567 "/desktop/gnome/url-handlers/mailto/command", // dummy
568 RTL_CONSTASCII_STRINGPARAM("givenname"),
569 sal_True,
570 SETTING_USER_GIVENNAME
574 SETTING_USER_SURNAME,
575 "/desktop/gnome/url-handlers/mailto/command", // dummy
576 RTL_CONSTASCII_STRINGPARAM("sn"),
577 sal_True,
578 SETTING_USER_SURNAME
581 #ifdef ENABLE_LOCKDOWN
583 SETTING_WRITER_DEFAULT_DOC_FORMAT,
584 "/apps/openoffice/writer_default_document_format",
585 RTL_CONSTASCII_STRINGPARAM("TextDocumentSetupFactoryDefaultFilter"),
586 sal_False,
587 SETTINGS_LAST
591 SETTING_IMPRESS_DEFAULT_DOC_FORMAT,
592 "/apps/openoffice/impress_default_document_format",
593 RTL_CONSTASCII_STRINGPARAM("PresentationDocumentSetupFactoryDefaultFilter"),
594 sal_False,
595 SETTINGS_LAST
599 SETTING_CALC_DEFAULT_DOC_FORMAT,
600 "/apps/openoffice/calc_default_document_format",
601 RTL_CONSTASCII_STRINGPARAM("SpreadsheetDocumentSetupFactoryDefaultFilter"),
602 sal_False,
603 SETTINGS_LAST
607 SETTING_AUTO_SAVE,
608 GCONF_AUTO_SAVE_KEY,
609 RTL_CONSTASCII_STRINGPARAM("AutoSaveEnabled"),
610 sal_False,
611 SETTINGS_LAST
615 SETTING_USER_AUTO_SAVE,
616 GCONF_USER_AUTO_SAVE_KEY,
617 RTL_CONSTASCII_STRINGPARAM("UserAutoSaveEnabled"),
618 sal_False,
619 SETTINGS_LAST
623 SETTING_AUTO_SAVE_INTERVAL,
624 "/apps/openoffice/auto_save_interval",
625 RTL_CONSTASCII_STRINGPARAM("AutoSaveTimeIntervall"),
626 sal_False,
627 SETTING_AUTO_SAVE
631 SETTING_DISABLE_PRINTING,
632 "/desktop/gnome/lockdown/disable_printing",
633 RTL_CONSTASCII_STRINGPARAM("DisablePrinting"),
634 sal_True,
635 SETTINGS_LAST
639 SETTING_USE_SYSTEM_FILE_DIALOG,
640 "/apps/openoffice/use_system_file_dialog",
641 RTL_CONSTASCII_STRINGPARAM("UseSystemFileDialog"),
642 sal_False,
643 SETTINGS_LAST
647 SETTING_PRINTING_MODIFIES_DOCUMENT,
648 "/apps/openoffice/printing_modifies_doc",
649 RTL_CONSTASCII_STRINGPARAM("PrintingModifiesDocument"),
650 sal_False,
651 SETTINGS_LAST
655 SETTING_SHOW_ICONS_IN_MENUS,
656 "/apps/openoffice/show_menu_icons",
657 RTL_CONSTASCII_STRINGPARAM("ShowIconsInMenues"),
658 sal_False,
659 SETTINGS_LAST
663 SETTING_SHOW_INACTIVE_MENUITEMS,
664 "/apps/openoffice/show_menu_inactive_items",
665 RTL_CONSTASCII_STRINGPARAM("DontHideDisabledEntry"),
666 sal_False,
667 SETTINGS_LAST
671 SETTING_SHOW_FONT_PREVIEW,
672 "/apps/openoffice/show_font_preview",
673 RTL_CONSTASCII_STRINGPARAM("ShowFontBoxWYSIWYG"),
674 sal_False,
675 SETTINGS_LAST
679 SETTING_SHOW_FONT_HISTORY,
680 "/apps/openoffice/show_font_history",
681 RTL_CONSTASCII_STRINGPARAM("FontViewHistory"),
682 sal_False,
683 SETTINGS_LAST
687 SETTING_ENABLE_OPENGL,
688 "/apps/openoffice/use_opengl",
689 RTL_CONSTASCII_STRINGPARAM("OpenGL"),
690 sal_False,
691 SETTINGS_LAST
695 SETTING_OPTIMIZE_OPENGL,
696 "/apps/openoffice/optimize_opengl",
697 RTL_CONSTASCII_STRINGPARAM("OpenGL_Faster"),
698 sal_False,
699 SETTINGS_LAST
703 SETTING_USE_SYSTEM_FONT,
704 "/apps/openoffice/use_system_font",
705 RTL_CONSTASCII_STRINGPARAM("AccessibilityIsSystemFont"),
706 sal_False,
707 SETTINGS_LAST
711 SETTING_USE_FONT_ANTI_ALIASING,
712 "/apps/openoffice/use_font_anti_aliasing",
713 RTL_CONSTASCII_STRINGPARAM("FontAntiAliasingEnabled"),
714 sal_False,
715 SETTINGS_LAST
719 SETTING_FONT_ANTI_ALIASING_MIN_PIXEL,
720 "/apps/openoffice/font_anti_aliasing_min_pixel",
721 RTL_CONSTASCII_STRINGPARAM("FontAntiAliasingMinPixelHeight"),
722 sal_True,
723 SETTINGS_LAST
727 SETTING_WARN_CREATE_PDF,
728 "/apps/openoffice/lockdown/warn_info_create_pdf",
729 RTL_CONSTASCII_STRINGPARAM("WarnCreatePDF"),
730 sal_False,
731 SETTINGS_LAST
735 SETTING_WARN_PRINT_DOC,
736 "/apps/openoffice/lockdown/warn_info_printing",
737 RTL_CONSTASCII_STRINGPARAM("WarnPrintDoc"),
738 sal_False,
739 SETTINGS_LAST
743 SETTING_WARN_SAVEORSEND_DOC,
744 "/apps/openoffice/lockdown/warn_info_saving",
745 RTL_CONSTASCII_STRINGPARAM("WarnSaveOrSendDoc"),
746 sal_False,
747 SETTINGS_LAST
751 SETTING_WARN_SIGN_DOC,
752 "/apps/openoffice/lockdown/warn_info_signing",
753 RTL_CONSTASCII_STRINGPARAM("WarnSignDoc"),
754 sal_False,
755 SETTINGS_LAST
759 SETTING_REMOVE_PERSONAL_INFO,
760 "/apps/openoffice/lockdown/remove_personal_info_on_save",
761 RTL_CONSTASCII_STRINGPARAM("RemovePersonalInfoOnSaving"),
762 sal_False,
763 SETTINGS_LAST
767 SETTING_RECOMMEND_PASSWORD,
768 "/apps/openoffice/lockdown/recommend_password_on_save",
769 RTL_CONSTASCII_STRINGPARAM("RecommendPasswordProtection"),
770 sal_False,
771 SETTINGS_LAST
775 SETTING_UNDO_STEPS,
776 "/apps/openoffice/undo_steps",
777 RTL_CONSTASCII_STRINGPARAM("UndoSteps"),
778 sal_False,
779 SETTINGS_LAST
783 SETTING_SYMBOL_SET,
784 "/apps/openoffice/icon_size",
785 RTL_CONSTASCII_STRINGPARAM("SymbolSet"),
786 sal_True,
787 SETTINGS_LAST
791 SETTING_MACRO_SECURITY_LEVEL,
792 "/apps/openoffice/lockdown/macro_security_level",
793 RTL_CONSTASCII_STRINGPARAM("MacroSecurityLevel"),
794 sal_False,
795 SETTINGS_LAST
799 SETTING_CREATE_BACKUP,
800 "/apps/openoffice/create_backup",
801 RTL_CONSTASCII_STRINGPARAM("CreateBackup"),
802 sal_False,
803 SETTINGS_LAST
807 SETTING_WARN_ALIEN_FORMAT,
808 "/apps/openoffice/warn_alien_format",
809 RTL_CONSTASCII_STRINGPARAM("WarnAlienFormat"),
810 sal_False,
811 SETTINGS_LAST
814 #endif // ENABLE_LOCKDOWN
817 std::size_t const nConfigurationValues =
818 sizeof ConfigurationValues / sizeof ConfigurationValues[0];
820 css::beans::Optional< css::uno::Any > getValue(ConfigurationValue const & data)
822 GConfClient* pClient = getGconfClient();
823 GConfValue* pGconfValue;
824 if( ( data.nDependsOn == SETTINGS_LAST ) || isDependencySatisfied( pClient, data ) )
826 pGconfValue = gconf_client_get( pClient, data.GconfItem, NULL );
828 if( pGconfValue != NULL )
830 css::uno::Any value;
831 if( data.bNeedsTranslation )
832 value = translateToOOo( data, pGconfValue );
833 else
834 value = makeAnyOfGconfValue( pGconfValue );
836 gconf_value_free( pGconfValue );
838 return css::beans::Optional< css::uno::Any >(true, value);
841 return css::beans::Optional< css::uno::Any >();
846 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */