1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: inidef.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svtools.hxx"
35 #include <tools/string.hxx>
36 #include "inetdef.hxx"
39 //========================================================================
41 class SfxStdIniDef_Impl
: public SfxIniDefaulter
44 SfxStdIniDef_Impl( SfxIniDefaultManager
*pDefMgr
)
45 : SfxIniDefaulter( pDefMgr
)
47 virtual BOOL
QueryDefault( String
&rValue
, const SfxIniEntry
&rEntry
);
50 //-------------------------------------------------------------------------
52 BOOL
SfxStdIniDef_Impl::QueryDefault( String
&rValue
, const SfxIniEntry
&rEntry
)
54 switch ( rEntry
.GetKey() )
56 case SFX_KEY_BROWSERRESTORE
:
62 case SFX_KEY_INET_HOME
:
64 if ( System::GetLanguage() == LANGUAGE_GERMAN
)
65 rValue
= "http://www.stardivision.de";
67 rValue
= "http://www.stardivision.com";
71 case SFX_KEY_INET_MEMCACHE
:
75 case SFX_KEY_INET_DISKCACHE
:
79 case SFX_KEY_INET_CACHEEXPIRATION
:
83 case SFX_KEY_INET_MAXHTTPCONS
:
87 case SFX_KEY_INET_MAXFTPCONS
:
91 // case SFX_KEY_INET_JAVAMINHEAP:
95 // case SFX_KEY_INET_JAVAMAXHEAP:
99 case SFX_KEY_INET_USERAGENT
:
100 rValue
= INET_DEF_CALLERNAME
;
103 case SFX_KEY_INET_EXE_JAVASCRIPT
:
105 rValue
= "0"; // noch "0", solange es noch soviel Bugs gibt
107 rValue
= "0"; // immer "0"
111 case SFX_KEY_INET_EXE_PLUGIN
:
115 /* case SFX_KEY_INET_JAVA_ENABLE:
123 // case SFX_KEY_INET_NETACCESS:
127 case SFX_KEY_INET_CHANNELS
:
131 case SFX_KEY_BASIC_ENABLE
:
135 case SFX_KEY_INET_COOKIES
:
139 case SFX_KEY_ICONGRID
:
143 case SFX_KEY_METAFILEPRINT
:
148 return SfxIniDefaulter::QueryDefault( rValue
, rEntry
);
151 //=========================================================================
153 SfxIniDefaultManager::SfxIniDefaultManager()
154 : _pList( new SfxIniDefaulterList
)
156 new SfxStdIniDef_Impl( this );
159 //-------------------------------------------------------------------------
161 SfxIniDefaultManager::~SfxIniDefaultManager()
165 for ( USHORT n
= _pList
->Count(); n
--; )
166 delete _pList
->GetObject(n
);
171 //-------------------------------------------------------------------------
173 BOOL
SfxIniDefaultManager::QueryDefault
175 String
& rValue
, /* out: Default-Wert f"ur 'rEntry'
176 (Default ist Leerstring) */
177 const SfxIniEntry
& rEntry
// in: Beschreibung des Eintrags
182 "Uber diese interne Methode besorgt sich der <SfxIniManager> den
183 Default f"ur einen in 'rEntry' beschriebenen Eintrag.
187 for ( USHORT n
= _pList
->Count(); n
--; )
188 if ( _pList
->GetObject(n
)->QueryDefault( rValue
, rEntry
) )
193 //=========================================================================
195 SfxIniDefaulter::SfxIniDefaulter( SfxIniDefaultManager
*pManager
)
199 Der Ctor dieser Klasse meldet die neue Instanz automatisch am
200 <SfxiniDefaultManager> 'pManager' an.
203 : _pManager( pManager
)
206 pManager
->Insert( this );
209 //-------------------------------------------------------------------------
211 SfxIniDefaulter::~SfxIniDefaulter()
215 Der Dtor dieser Klasse meldet die neue Instanz automatisch am
216 <SfxiniDefaultManager> ab, der im Ctor angegeben wurde.
220 _pManager
->Remove( this );
223 //-------------------------------------------------------------------------
225 BOOL
SfxIniDefaulter::QueryDefault
227 String
& rValue
, /* out: Default-Wert f"ur 'rEntry'
228 (Default ist Leerstring) */
229 const SfxIniEntry
& rEntry
// in: Beschreibung des Eintrags
234 Diese virtuelle Methode mu\s "uberladen werden. Sie soll dann in
235 'rValue' einen Default-Wert f"ur den in 'rEntry' beschriebenen
236 ini-Eintrag setzen, falls ihr dieser bekannt ist.
241 TRUE In 'rValue' befindet sich der Default-Wert.
243 FALSE F"ur diesen Eintrag ist kein Default-Wert bekannt.
251 //========================================================================
253 SfxIniEntry::SfxIniEntry
255 const String
& aGroup
,