fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / shell / source / backends / gconfbe / gconfaccess.cxx
blobec2c0cadb8287a7fe92435865f83258c792e6afc
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 "com/sun/star/uno/Sequence.hxx"
27 #include "osl/file.hxx"
28 #include "osl/security.hxx"
29 #include "osl/thread.h"
30 #include "rtl/strbuf.hxx"
31 #include "rtl/ustrbuf.hxx"
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);
70 mClient = gconf_client_get_default();
71 if (!mClient)
73 throw uno::RuntimeException("GconfBackend:GconfLayer: Cannot Initialize Gconf connection");
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 , reinterpret_cast<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 = reinterpret_cast<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 /* Use fallbacks historical compatibility if nothing else exists */
193 return aHomeDirURL + "/" + OUString::createFromAscii(type);
196 uno::Any makeAnyOfGconfValue( GConfValue *pGconfValue )
198 switch( pGconfValue->type )
200 case GCONF_VALUE_BOOL:
201 return uno::makeAny( (bool) gconf_value_get_bool( pGconfValue ) );
203 case GCONF_VALUE_INT:
204 return uno::makeAny( (sal_Int32) gconf_value_get_int( pGconfValue ) );
206 case GCONF_VALUE_STRING:
207 return uno::makeAny( OStringToOUString( OString(
208 gconf_value_get_string(pGconfValue) ), RTL_TEXTENCODING_UTF8 ) );
210 default:
211 fprintf( stderr, "makeAnyOfGconfValue: Type not handled.\n" );
212 break;
215 return uno::Any();
220 static void splitFontName( GConfValue *pGconfValue, OUString &rName, sal_Int16 &rHeight)
222 OString aFont( gconf_value_get_string( pGconfValue ) );
223 aFont = aFont.trim();
224 sal_Int32 nIdx = aFont.lastIndexOf( ' ' );
225 if (nIdx < 1) { // urk
226 rHeight = 12;
227 nIdx = aFont.getLength();
228 } else {
229 OString aSize = aFont.copy( nIdx + 1 );
230 rHeight = static_cast<sal_Int16>( aSize.toInt32() );
233 rName = OStringToOUString( aFont.copy( 0, nIdx ), RTL_TEXTENCODING_UTF8 );
238 uno::Any translateToOOo( const ConfigurationValue &rValue, GConfValue *pGconfValue )
241 switch( rValue.nSettingId )
243 case SETTING_PROXY_MODE:
245 OUString aProxyMode;
246 uno::Any aOriginalValue = makeAnyOfGconfValue( pGconfValue );
247 aOriginalValue >>= aProxyMode;
249 if( aProxyMode == "manual" )
250 return uno::makeAny( (sal_Int32) 1 );
251 else if( aProxyMode == "none" )
252 return uno::makeAny( (sal_Int32) 0 );
254 break;
256 case SETTING_NO_PROXY_FOR:
258 OStringBuffer aBuffer;
259 if( (GCONF_VALUE_LIST == pGconfValue->type) && (GCONF_VALUE_STRING == gconf_value_get_list_type(pGconfValue)) )
261 GSList * list = gconf_value_get_list(pGconfValue);
262 for(; list; list = g_slist_next(list))
264 aBuffer.append(gconf_value_get_string(static_cast<GConfValue *>(list->data)) + OString(";"));
266 // Remove trailing ";"
267 aBuffer.setLength(aBuffer.getLength()-1);
268 return uno::makeAny(OStringToOUString(aBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8));
270 else
271 g_warning( "unexpected type for ignore_hosts" );
273 break;
275 case SETTING_MAILER_PROGRAM:
277 OUString aMailer;
278 uno::Any aOriginalValue = makeAnyOfGconfValue( pGconfValue );
279 aOriginalValue >>= aMailer;
280 sal_Int32 nIndex = 0;
281 return uno::makeAny( aMailer.getToken( 0, ' ', nIndex ) );
284 #ifdef ENABLE_LOCKDOWN
285 // "short" values need to be returned a sal_Int16
286 case SETTING_FONT_ANTI_ALIASING_MIN_PIXEL:
287 case SETTING_SYMBOL_SET:
289 sal_Int32 nShortValue(0);
290 uno::Any aOriginalValue = makeAnyOfGconfValue( pGconfValue );
291 aOriginalValue >>= nShortValue;
292 return uno::makeAny( (sal_Int16) nShortValue );
294 break;
295 #endif // ENABLE_LOCKDOWN
297 // "boolean" values that need a string to be returned
298 case SETTING_ENABLE_ACCESSIBILITY:
299 #ifdef ENABLE_LOCKDOWN
300 case SETTING_DISABLE_PRINTING:
301 #endif // ENABLE_LOCKDOWN
303 bool bBooleanValue = false;
304 uno::Any aOriginalValue = makeAnyOfGconfValue( pGconfValue );
305 aOriginalValue >>= bBooleanValue;
306 return uno::makeAny( OUString::boolean( bBooleanValue ) );
309 case SETTING_WORK_DIRECTORY:
311 OUString aDocumentsDirURL = xdg_user_dir_lookup("Documents");
313 return uno::makeAny( aDocumentsDirURL );
316 case SETTING_TEMPLATE_DIRECTORY:
318 OUString aTemplatesDirURL = xdg_user_dir_lookup("Templates");
320 return uno::makeAny( aTemplatesDirURL );
323 case SETTING_USER_GIVENNAME:
325 OUString aCompleteName( OStringToOUString(
326 g_get_real_name(), osl_getThreadTextEncoding() ) );
327 sal_Int32 nIndex = 0;
328 OUString aGivenName;
330 aGivenName = aCompleteName.getToken( 0, ' ', nIndex );
331 while ( nIndex == 0 );
333 return uno::makeAny( aGivenName );
337 case SETTING_USER_SURNAME:
339 OUString aCompleteName( OStringToOUString(
340 g_get_real_name(), osl_getThreadTextEncoding() ) );
341 sal_Int32 nIndex = 0;
342 OUString aSurname;
344 aSurname = aCompleteName.getToken( 0, ' ', nIndex );
345 while ( nIndex >= 0 );
347 return uno::makeAny( aSurname );
350 case SETTING_SOURCEVIEWFONT_NAME:
351 case SETTING_SOURCEVIEWFONT_HEIGHT:
353 OUString aName;
354 sal_Int16 nHeight;
356 splitFontName (pGconfValue, aName, nHeight);
357 if (rValue.nSettingId == SETTING_SOURCEVIEWFONT_NAME)
358 return uno::makeAny( aName );
359 else
360 return uno::makeAny( nHeight );
364 default:
365 fprintf( stderr, "Unhandled setting to translate.\n" );
366 break;
369 return uno::Any();
374 bool SAL_CALL isDependencySatisfied( GConfClient* pClient, const ConfigurationValue &rValue )
376 switch( rValue.nDependsOn )
378 case SETTING_PROXY_MODE:
380 GConfValue* pGconfValue = gconf_client_get( pClient, GCONF_PROXY_MODE_KEY, NULL );
382 if ( pGconfValue != NULL )
384 bool bOk = g_ascii_strcasecmp( "manual", gconf_value_get_string( pGconfValue ) ) == 0;
385 gconf_value_free( pGconfValue );
386 if (bOk) return true;
389 break;
391 case SETTING_WORK_DIRECTORY:
393 OUString aDocumentsDirURL = xdg_user_dir_lookup("Documents");
394 osl::Directory aDocumentsDir( aDocumentsDirURL );
396 if( osl::FileBase::E_None == aDocumentsDir.open() )
397 return true;
399 break;
401 case SETTING_TEMPLATE_DIRECTORY:
403 OUString aTemplatesDirURL = xdg_user_dir_lookup("Templates");
404 osl::Directory aTemplatesDir( aTemplatesDirURL );
406 if( osl::FileBase::E_None == aTemplatesDir.open() )
407 return true;
409 break;
411 case SETTING_USER_GIVENNAME:
413 OUString aCompleteName( OStringToOUString(
414 g_get_real_name(), osl_getThreadTextEncoding() ) );
415 if( aCompleteName != "Unknown" )
416 return true;
418 break;
420 case SETTING_USER_SURNAME:
422 OUString aCompleteName( OStringToOUString(
423 g_get_real_name(), osl_getThreadTextEncoding() ) );
424 if( aCompleteName != "Unknown" )
426 if( aCompleteName.trim().indexOf( ' ' ) != -1 )
427 return true;
430 break;
432 #ifdef ENABLE_LOCKDOWN
433 case SETTING_AUTO_SAVE:
435 GConfValue* pGconfValue = gconf_client_get( pClient, GCONF_AUTO_SAVE_KEY, NULL );
437 if( ( pGconfValue != NULL ) )
439 bool bOk = gconf_value_get_bool( pGconfValue );
440 gconf_value_free( pGconfValue );
441 if (bOk) return true;
444 break;
445 case SETTING_USER_AUTO_SAVE:
447 GConfValue* pGconfValue = gconf_client_get( pClient, GCONF_USER_AUTO_SAVE_KEY, NULL );
449 if( ( pGconfValue != NULL ) )
451 bool bOk = gconf_value_get_bool( pGconfValue );
452 gconf_value_free( pGconfValue );
453 if (bOk) return true;
456 break;
457 #endif // ENABLE_LOCKDOWN
459 default:
460 fprintf( stderr, "Unhandled setting to check dependency.\n" );
461 break;
464 return false;
469 ConfigurationValue const ConfigurationValues[] =
472 SETTING_ENABLE_ACCESSIBILITY,
473 "/desktop/gnome/interface/accessibility",
474 RTL_CONSTASCII_STRINGPARAM("EnableATToolSupport"),
475 true,
476 SETTINGS_LAST
480 SETTING_PROXY_MODE,
481 GCONF_PROXY_MODE_KEY,
482 RTL_CONSTASCII_STRINGPARAM("ooInetProxyType"),
483 true,
484 SETTINGS_LAST
488 SETTING_PROXY_HTTP_HOST,
489 "/system/http_proxy/host",
490 RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyName"),
491 false,
492 SETTING_PROXY_MODE
496 SETTING_PROXY_HTTP_PORT,
497 "/system/http_proxy/port",
498 RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyPort"),
499 false,
500 SETTING_PROXY_MODE
504 SETTING_PROXY_HTTPS_HOST,
505 "/system/proxy/secure_host",
506 RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyName"),
507 false,
508 SETTING_PROXY_MODE
512 SETTING_PROXY_HTTPS_PORT,
513 "/system/proxy/secure_port",
514 RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyPort"),
515 false,
516 SETTING_PROXY_MODE
520 SETTING_PROXY_FTP_HOST,
521 "/system/proxy/ftp_host",
522 RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName"),
523 false,
524 SETTING_PROXY_MODE
528 SETTING_PROXY_FTP_PORT,
529 "/system/proxy/ftp_port",
530 RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyPort"),
531 false,
532 SETTING_PROXY_MODE
536 SETTING_NO_PROXY_FOR,
537 "/system/http_proxy/ignore_hosts",
538 RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy"),
539 true,
540 SETTING_PROXY_MODE
544 SETTING_MAILER_PROGRAM,
545 "/desktop/gnome/url-handlers/mailto/command",
546 RTL_CONSTASCII_STRINGPARAM("ExternalMailer"),
547 true,
548 SETTINGS_LAST
551 SETTING_SOURCEVIEWFONT_NAME,
552 "/desktop/gnome/interface/monospace_font_name",
553 RTL_CONSTASCII_STRINGPARAM("SourceViewFontName"),
554 true,
555 SETTINGS_LAST
558 SETTING_SOURCEVIEWFONT_HEIGHT,
559 "/desktop/gnome/interface/monospace_font_name",
560 RTL_CONSTASCII_STRINGPARAM("SourceViewFontHeight"),
561 true,
562 SETTINGS_LAST
566 SETTING_WORK_DIRECTORY,
567 "/desktop/gnome/url-handlers/mailto/command", // dummy
568 RTL_CONSTASCII_STRINGPARAM("WorkPathVariable"),
569 true,
570 SETTING_WORK_DIRECTORY, // so that the existence of the dir can be checked
574 SETTING_TEMPLATE_DIRECTORY,
575 "/desktop/gnome/url-handlers/mailto/command", // dummy
576 RTL_CONSTASCII_STRINGPARAM("TemplatePathVariable"),
577 true,
578 SETTING_TEMPLATE_DIRECTORY, // so that the existence of the dir can be checked
582 SETTING_USER_GIVENNAME,
583 "/desktop/gnome/url-handlers/mailto/command", // dummy
584 RTL_CONSTASCII_STRINGPARAM("givenname"),
585 true,
586 SETTING_USER_GIVENNAME
590 SETTING_USER_SURNAME,
591 "/desktop/gnome/url-handlers/mailto/command", // dummy
592 RTL_CONSTASCII_STRINGPARAM("sn"),
593 true,
594 SETTING_USER_SURNAME
597 #ifdef ENABLE_LOCKDOWN
599 SETTING_WRITER_DEFAULT_DOC_FORMAT,
600 "/apps/openoffice/writer_default_document_format",
601 RTL_CONSTASCII_STRINGPARAM("TextDocumentSetupFactoryDefaultFilter"),
602 false,
603 SETTINGS_LAST
607 SETTING_IMPRESS_DEFAULT_DOC_FORMAT,
608 "/apps/openoffice/impress_default_document_format",
609 RTL_CONSTASCII_STRINGPARAM("PresentationDocumentSetupFactoryDefaultFilter"),
610 false,
611 SETTINGS_LAST
615 SETTING_CALC_DEFAULT_DOC_FORMAT,
616 "/apps/openoffice/calc_default_document_format",
617 RTL_CONSTASCII_STRINGPARAM("SpreadsheetDocumentSetupFactoryDefaultFilter"),
618 false,
619 SETTINGS_LAST
623 SETTING_AUTO_SAVE,
624 GCONF_AUTO_SAVE_KEY,
625 RTL_CONSTASCII_STRINGPARAM("AutoSaveEnabled"),
626 false,
627 SETTINGS_LAST
631 SETTING_USER_AUTO_SAVE,
632 GCONF_USER_AUTO_SAVE_KEY,
633 RTL_CONSTASCII_STRINGPARAM("UserAutoSaveEnabled"),
634 false,
635 SETTINGS_LAST
639 SETTING_AUTO_SAVE_INTERVAL,
640 "/apps/openoffice/auto_save_interval",
641 RTL_CONSTASCII_STRINGPARAM("AutoSaveTimeIntervall"),
642 false,
643 SETTING_AUTO_SAVE
647 SETTING_DISABLE_PRINTING,
648 "/desktop/gnome/lockdown/disable_printing",
649 RTL_CONSTASCII_STRINGPARAM("DisablePrinting"),
650 true,
651 SETTINGS_LAST
655 SETTING_USE_SYSTEM_FILE_DIALOG,
656 "/apps/openoffice/use_system_file_dialog",
657 RTL_CONSTASCII_STRINGPARAM("UseSystemFileDialog"),
658 false,
659 SETTINGS_LAST
663 SETTING_PRINTING_MODIFIES_DOCUMENT,
664 "/apps/openoffice/printing_modifies_doc",
665 RTL_CONSTASCII_STRINGPARAM("PrintingModifiesDocument"),
666 false,
667 SETTINGS_LAST
671 SETTING_SHOW_ICONS_IN_MENUS,
672 "/apps/openoffice/show_menu_icons",
673 RTL_CONSTASCII_STRINGPARAM("ShowIconsInMenues"),
674 false,
675 SETTINGS_LAST
679 SETTING_SHOW_INACTIVE_MENUITEMS,
680 "/apps/openoffice/show_menu_inactive_items",
681 RTL_CONSTASCII_STRINGPARAM("DontHideDisabledEntry"),
682 false,
683 SETTINGS_LAST
687 SETTING_SHOW_FONT_PREVIEW,
688 "/apps/openoffice/show_font_preview",
689 RTL_CONSTASCII_STRINGPARAM("ShowFontBoxWYSIWYG"),
690 false,
691 SETTINGS_LAST
695 SETTING_SHOW_FONT_HISTORY,
696 "/apps/openoffice/show_font_history",
697 RTL_CONSTASCII_STRINGPARAM("FontViewHistory"),
698 false,
699 SETTINGS_LAST
703 SETTING_USE_SYSTEM_FONT,
704 "/apps/openoffice/use_system_font",
705 RTL_CONSTASCII_STRINGPARAM("AccessibilityIsSystemFont"),
706 false,
707 SETTINGS_LAST
711 SETTING_USE_FONT_ANTI_ALIASING,
712 "/apps/openoffice/use_font_anti_aliasing",
713 RTL_CONSTASCII_STRINGPARAM("FontAntiAliasingEnabled"),
714 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 true,
723 SETTINGS_LAST
727 SETTING_WARN_CREATE_PDF,
728 "/apps/openoffice/lockdown/warn_info_create_pdf",
729 RTL_CONSTASCII_STRINGPARAM("WarnCreatePDF"),
730 false,
731 SETTINGS_LAST
735 SETTING_WARN_PRINT_DOC,
736 "/apps/openoffice/lockdown/warn_info_printing",
737 RTL_CONSTASCII_STRINGPARAM("WarnPrintDoc"),
738 false,
739 SETTINGS_LAST
743 SETTING_WARN_SAVEORSEND_DOC,
744 "/apps/openoffice/lockdown/warn_info_saving",
745 RTL_CONSTASCII_STRINGPARAM("WarnSaveOrSendDoc"),
746 false,
747 SETTINGS_LAST
751 SETTING_WARN_SIGN_DOC,
752 "/apps/openoffice/lockdown/warn_info_signing",
753 RTL_CONSTASCII_STRINGPARAM("WarnSignDoc"),
754 false,
755 SETTINGS_LAST
759 SETTING_REMOVE_PERSONAL_INFO,
760 "/apps/openoffice/lockdown/remove_personal_info_on_save",
761 RTL_CONSTASCII_STRINGPARAM("RemovePersonalInfoOnSaving"),
762 false,
763 SETTINGS_LAST
767 SETTING_RECOMMEND_PASSWORD,
768 "/apps/openoffice/lockdown/recommend_password_on_save",
769 RTL_CONSTASCII_STRINGPARAM("RecommendPasswordProtection"),
770 false,
771 SETTINGS_LAST
775 SETTING_UNDO_STEPS,
776 "/apps/openoffice/undo_steps",
777 RTL_CONSTASCII_STRINGPARAM("UndoSteps"),
778 false,
779 SETTINGS_LAST
783 SETTING_SYMBOL_SET,
784 "/apps/openoffice/icon_size",
785 RTL_CONSTASCII_STRINGPARAM("SymbolSet"),
786 true,
787 SETTINGS_LAST
791 SETTING_MACRO_SECURITY_LEVEL,
792 "/apps/openoffice/lockdown/macro_security_level",
793 RTL_CONSTASCII_STRINGPARAM("MacroSecurityLevel"),
794 false,
795 SETTINGS_LAST
799 SETTING_CREATE_BACKUP,
800 "/apps/openoffice/create_backup",
801 RTL_CONSTASCII_STRINGPARAM("CreateBackup"),
802 false,
803 SETTINGS_LAST
807 SETTING_WARN_ALIEN_FORMAT,
808 "/apps/openoffice/warn_alien_format",
809 RTL_CONSTASCII_STRINGPARAM("WarnAlienFormat"),
810 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 if( ( data.nDependsOn == SETTINGS_LAST ) || isDependencySatisfied( pClient, data ) )
825 GConfValue* pGconfValue = gconf_client_get( pClient, data.GconfItem, NULL );
827 if( pGconfValue != NULL )
829 css::uno::Any value;
830 if( data.bNeedsTranslation )
831 value = translateToOOo( data, pGconfValue );
832 else
833 value = makeAnyOfGconfValue( pGconfValue );
835 gconf_value_free( pGconfValue );
837 return css::beans::Optional< css::uno::Any >(true, value);
840 return css::beans::Optional< css::uno::Any >();
845 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */