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