xref: /trunk/main/svtools/source/config/miscopt.cxx (revision cf6516809c57e1bb0a940545cca99cdad54d4ce2)
15900e8ecSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
35900e8ecSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
45900e8ecSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
55900e8ecSAndrew Rist  * distributed with this work for additional information
65900e8ecSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
75900e8ecSAndrew Rist  * to you under the Apache License, Version 2.0 (the
85900e8ecSAndrew Rist  * "License"); you may not use this file except in compliance
95900e8ecSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
115900e8ecSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
135900e8ecSAndrew Rist  * Unless required by applicable law or agreed to in writing,
145900e8ecSAndrew Rist  * software distributed under the License is distributed on an
155900e8ecSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165900e8ecSAndrew Rist  * KIND, either express or implied.  See the License for the
175900e8ecSAndrew Rist  * specific language governing permissions and limitations
185900e8ecSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
205900e8ecSAndrew Rist  *************************************************************/
215900e8ecSAndrew Rist 
225900e8ecSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svtools.hxx"
26cdf0e10cSrcweir //_________________________________________________________________________________________________________________
27cdf0e10cSrcweir //  includes
28cdf0e10cSrcweir //_________________________________________________________________________________________________________________
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <svtools/miscopt.hxx>
31cdf0e10cSrcweir #include <unotools/configmgr.hxx>
32cdf0e10cSrcweir #include <unotools/configitem.hxx>
33cdf0e10cSrcweir #include <tools/debug.hxx>
34cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx>
35cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx>
36cdf0e10cSrcweir #include <tools/link.hxx>
37cdf0e10cSrcweir #include <tools/list.hxx>
38cdf0e10cSrcweir #include <tools/wldcrd.hxx>
39cdf0e10cSrcweir #include <tools/urlobj.hxx>
40cdf0e10cSrcweir 
41cdf0e10cSrcweir #include <rtl/logfile.hxx>
42cdf0e10cSrcweir #include "itemholder2.hxx"
43cdf0e10cSrcweir 
44cdf0e10cSrcweir #include <svtools/imgdef.hxx>
45cdf0e10cSrcweir #include <vcl/svapp.hxx>
46cdf0e10cSrcweir 
47cdf0e10cSrcweir //_________________________________________________________________________________________________________________
48cdf0e10cSrcweir //  namespaces
49cdf0e10cSrcweir //_________________________________________________________________________________________________________________
50cdf0e10cSrcweir 
51cdf0e10cSrcweir using namespace ::utl                   ;
52cdf0e10cSrcweir using namespace ::rtl                   ;
53cdf0e10cSrcweir using namespace ::osl                   ;
54cdf0e10cSrcweir using namespace ::com::sun::star::uno   ;
55cdf0e10cSrcweir using namespace ::com::sun::star;
56cdf0e10cSrcweir 
57cdf0e10cSrcweir //_________________________________________________________________________________________________________________
58cdf0e10cSrcweir //  const
59cdf0e10cSrcweir //_________________________________________________________________________________________________________________
60cdf0e10cSrcweir 
61cdf0e10cSrcweir #define ASCII_STR(s)                        OUString( RTL_CONSTASCII_USTRINGPARAM(s) )
62cdf0e10cSrcweir #define ROOTNODE_MISC                       ASCII_STR("Office.Common/Misc")
63cdf0e10cSrcweir #define DEFAULT_PLUGINSENABLED              sal_True;
64cdf0e10cSrcweir 
65cdf0e10cSrcweir #define PROPERTYNAME_PLUGINSENABLED         ASCII_STR("PluginsEnabled")
66cdf0e10cSrcweir #define PROPERTYHANDLE_PLUGINSENABLED       0
67cdf0e10cSrcweir #define PROPERTYNAME_SYMBOLSET              ASCII_STR("SymbolSet")
68cdf0e10cSrcweir #define PROPERTYHANDLE_SYMBOLSET            1
69cdf0e10cSrcweir #define PROPERTYNAME_TOOLBOXSTYLE           ASCII_STR("ToolboxStyle")
70cdf0e10cSrcweir #define PROPERTYHANDLE_TOOLBOXSTYLE         2
71cdf0e10cSrcweir #define PROPERTYNAME_USESYSTEMFILEDIALOG    ASCII_STR("UseSystemFileDialog")
72cdf0e10cSrcweir #define PROPERTYHANDLE_USESYSTEMFILEDIALOG  3
73cdf0e10cSrcweir #define PROPERTYNAME_SYMBOLSTYLE            ASCII_STR("SymbolStyle")
74cdf0e10cSrcweir #define PROPERTYHANDLE_SYMBOLSTYLE          4
75cdf0e10cSrcweir #define PROPERTYNAME_USESYSTEMPRINTDIALOG   ASCII_STR("UseSystemPrintDialog")
76cdf0e10cSrcweir #define PROPERTYHANDLE_USESYSTEMPRINTDIALOG 5
77cdf0e10cSrcweir 
78cdf0e10cSrcweir #define PROPERTYCOUNT                       6
79cdf0e10cSrcweir 
80cdf0e10cSrcweir #define VCL_TOOLBOX_STYLE_FLAT              ((sal_uInt16)0x0004) // from <vcl/toolbox.hxx>
81cdf0e10cSrcweir 
82cdf0e10cSrcweir DECLARE_LIST( LinkList, Link * )
83cdf0e10cSrcweir 
84cdf0e10cSrcweir //_________________________________________________________________________________________________________________
85cdf0e10cSrcweir //  private declarations!
86cdf0e10cSrcweir //_________________________________________________________________________________________________________________
87cdf0e10cSrcweir 
88cdf0e10cSrcweir class SvtMiscOptions_Impl : public ConfigItem
89cdf0e10cSrcweir {
90cdf0e10cSrcweir     //-------------------------------------------------------------------------------------------------------------
91cdf0e10cSrcweir     //  private member
92cdf0e10cSrcweir     //-------------------------------------------------------------------------------------------------------------
93cdf0e10cSrcweir 
94cdf0e10cSrcweir     private:
95cdf0e10cSrcweir     LinkList    aList;
96cdf0e10cSrcweir     sal_Bool    m_bUseSystemFileDialog;
97cdf0e10cSrcweir     sal_Bool    m_bIsUseSystemFileDialogRO;
98cdf0e10cSrcweir     sal_Bool    m_bPluginsEnabled;
99cdf0e10cSrcweir     sal_Bool    m_bIsPluginsEnabledRO;
100cdf0e10cSrcweir     sal_Int16   m_nSymbolsSize;
101cdf0e10cSrcweir     sal_Bool    m_bIsSymbolsSizeRO;
102cdf0e10cSrcweir     sal_Bool    m_bIsSymbolsStyleRO;
103cdf0e10cSrcweir     sal_Int16   m_nToolboxStyle;
104cdf0e10cSrcweir     sal_Bool    m_bIsToolboxStyleRO;
105cdf0e10cSrcweir     sal_Bool    m_bUseSystemPrintDialog;
106cdf0e10cSrcweir     sal_Bool    m_bIsUseSystemPrintDialogRO;
107cdf0e10cSrcweir 
108cdf0e10cSrcweir     //-------------------------------------------------------------------------------------------------------------
109cdf0e10cSrcweir     //  public methods
110cdf0e10cSrcweir     //-------------------------------------------------------------------------------------------------------------
111cdf0e10cSrcweir 
112cdf0e10cSrcweir     public:
113cdf0e10cSrcweir 
114cdf0e10cSrcweir         //---------------------------------------------------------------------------------------------------------
115cdf0e10cSrcweir         //  constructor / destructor
116cdf0e10cSrcweir         //---------------------------------------------------------------------------------------------------------
117cdf0e10cSrcweir 
118cdf0e10cSrcweir          SvtMiscOptions_Impl();
119cdf0e10cSrcweir         ~SvtMiscOptions_Impl();
120cdf0e10cSrcweir 
121cdf0e10cSrcweir         //---------------------------------------------------------------------------------------------------------
122cdf0e10cSrcweir         //  overloaded methods of baseclass
123cdf0e10cSrcweir         //---------------------------------------------------------------------------------------------------------
124cdf0e10cSrcweir 
125cdf0e10cSrcweir         /*-****************************************************************************************************//**
126cdf0e10cSrcweir             @short      called for notify of configmanager
127cdf0e10cSrcweir             @descr      These method is called from the ConfigManager before application ends or from the
128cdf0e10cSrcweir                         PropertyChangeListener if the sub tree broadcasts changes. You must update your
129cdf0e10cSrcweir                         internal values.
130cdf0e10cSrcweir 
131cdf0e10cSrcweir             @seealso    baseclass ConfigItem
132cdf0e10cSrcweir 
133cdf0e10cSrcweir             @param      "seqPropertyNames" is the list of properties which should be updated.
134cdf0e10cSrcweir             @return     -
135cdf0e10cSrcweir 
136cdf0e10cSrcweir             @onerror    -
137cdf0e10cSrcweir         *//*-*****************************************************************************************************/
138cdf0e10cSrcweir 
139cdf0e10cSrcweir         virtual void Notify( const Sequence< OUString >& seqPropertyNames );
140cdf0e10cSrcweir 
141cdf0e10cSrcweir         /** loads required data from the configuration. It's called in the constructor to
142cdf0e10cSrcweir          read all entries and form ::Notify to re-read changed settings
143cdf0e10cSrcweir 
144cdf0e10cSrcweir          */
145cdf0e10cSrcweir         void Load( const Sequence< OUString >& rPropertyNames );
146cdf0e10cSrcweir 
147cdf0e10cSrcweir         /*-****************************************************************************************************//**
148cdf0e10cSrcweir             @short      write changes to configuration
149cdf0e10cSrcweir             @descr      These method writes the changed values into the sub tree
150cdf0e10cSrcweir                         and should always called in our destructor to guarantee consistency of config data.
151cdf0e10cSrcweir 
152cdf0e10cSrcweir             @seealso    baseclass ConfigItem
153cdf0e10cSrcweir 
154cdf0e10cSrcweir             @param      -
155cdf0e10cSrcweir             @return     -
156cdf0e10cSrcweir 
157cdf0e10cSrcweir             @onerror    -
158cdf0e10cSrcweir         *//*-*****************************************************************************************************/
159cdf0e10cSrcweir 
160cdf0e10cSrcweir         virtual void Commit();
161cdf0e10cSrcweir 
162cdf0e10cSrcweir         //---------------------------------------------------------------------------------------------------------
163cdf0e10cSrcweir         //  public interface
164cdf0e10cSrcweir         //---------------------------------------------------------------------------------------------------------
165cdf0e10cSrcweir 
UseSystemFileDialog() const166cdf0e10cSrcweir         inline sal_Bool UseSystemFileDialog() const
167cdf0e10cSrcweir         { return m_bUseSystemFileDialog; }
168cdf0e10cSrcweir 
SetUseSystemFileDialog(sal_Bool bSet)169cdf0e10cSrcweir         inline void SetUseSystemFileDialog( sal_Bool bSet )
170cdf0e10cSrcweir         {  m_bUseSystemFileDialog = bSet; SetModified(); }
171cdf0e10cSrcweir 
IsUseSystemFileDialogReadOnly() const172cdf0e10cSrcweir         inline sal_Bool IsUseSystemFileDialogReadOnly() const
173cdf0e10cSrcweir         { return m_bIsUseSystemFileDialogRO; }
174cdf0e10cSrcweir 
IsPluginsEnabled() const175cdf0e10cSrcweir         inline sal_Bool IsPluginsEnabled() const
176cdf0e10cSrcweir         { return m_bPluginsEnabled; }
177cdf0e10cSrcweir 
178cdf0e10cSrcweir         void SetPluginsEnabled( sal_Bool bEnable );
179cdf0e10cSrcweir 
IsPluginsEnabledReadOnly() const180cdf0e10cSrcweir         inline sal_Bool IsPluginsEnabledReadOnly() const
181cdf0e10cSrcweir         { return m_bIsPluginsEnabledRO; }
182cdf0e10cSrcweir 
GetSymbolsSize()183cdf0e10cSrcweir         inline sal_Int16 GetSymbolsSize()
184cdf0e10cSrcweir         { return m_nSymbolsSize; }
185cdf0e10cSrcweir 
186cdf0e10cSrcweir         void SetSymbolsSize( sal_Int16 nSet );
187cdf0e10cSrcweir 
IsGetSymbolsSizeReadOnly()188cdf0e10cSrcweir         inline sal_Bool IsGetSymbolsSizeReadOnly()
189cdf0e10cSrcweir         { return m_bIsSymbolsSizeRO; }
190cdf0e10cSrcweir 
191cdf0e10cSrcweir         sal_Int16 GetSymbolsStyle() const;
192cdf0e10cSrcweir         ::rtl::OUString GetSymbolsStyleName() const;
193cdf0e10cSrcweir         sal_Int16 GetCurrentSymbolsStyle() const;
194cdf0e10cSrcweir 
SetSymbolsStyle(sal_Int16 nSet)195cdf0e10cSrcweir         inline void SetSymbolsStyle( sal_Int16 nSet )
196cdf0e10cSrcweir         { ImplSetSymbolsStyle( true, nSet, ::rtl::OUString() ); }
197cdf0e10cSrcweir 
SetSymbolsStyleName(::rtl::OUString & rName)198cdf0e10cSrcweir         inline void SetSymbolsStyleName( ::rtl::OUString &rName )
199cdf0e10cSrcweir         { ImplSetSymbolsStyle( false, 0, rName ); }
200cdf0e10cSrcweir 
IsGetSymbolsStyleReadOnly()201cdf0e10cSrcweir         inline sal_Bool IsGetSymbolsStyleReadOnly()
202cdf0e10cSrcweir         { return m_bIsSymbolsStyleRO; }
203cdf0e10cSrcweir 
204cdf0e10cSrcweir         // translate to VCL settings ( "0" = 3D, "1" = FLAT )
GetToolboxStyle()205cdf0e10cSrcweir         inline sal_Int16 GetToolboxStyle()
206cdf0e10cSrcweir         { return m_nToolboxStyle ? VCL_TOOLBOX_STYLE_FLAT : 0; }
207cdf0e10cSrcweir 
208cdf0e10cSrcweir         // translate from VCL settings
209cdf0e10cSrcweir         void SetToolboxStyle( sal_Int16 nStyle, bool _bSetModified );
210cdf0e10cSrcweir 
IsGetToolboxStyleReadOnly()211cdf0e10cSrcweir         inline sal_Bool IsGetToolboxStyleReadOnly()
212cdf0e10cSrcweir         { return m_bIsToolboxStyleRO; }
213cdf0e10cSrcweir 
UseSystemPrintDialog() const214cdf0e10cSrcweir         inline sal_Bool UseSystemPrintDialog() const
215cdf0e10cSrcweir         { return m_bUseSystemPrintDialog; }
216cdf0e10cSrcweir 
SetUseSystemPrintDialog(sal_Bool bSet)217cdf0e10cSrcweir         inline void SetUseSystemPrintDialog( sal_Bool bSet )
218cdf0e10cSrcweir         {  m_bUseSystemPrintDialog = bSet; SetModified(); }
219cdf0e10cSrcweir 
IsUseSystemPrintDialogReadOnly() const220cdf0e10cSrcweir         inline sal_Bool IsUseSystemPrintDialogReadOnly() const
221cdf0e10cSrcweir         { return m_bIsUseSystemPrintDialogRO; }
222cdf0e10cSrcweir 
223cdf0e10cSrcweir         void AddListenerLink( const Link& rLink );
224cdf0e10cSrcweir         void RemoveListenerLink( const Link& rLink );
225cdf0e10cSrcweir         void CallListeners();
226cdf0e10cSrcweir 
227cdf0e10cSrcweir     //-------------------------------------------------------------------------------------------------------------
228cdf0e10cSrcweir     //  private methods
229cdf0e10cSrcweir     //-------------------------------------------------------------------------------------------------------------
230cdf0e10cSrcweir 
231cdf0e10cSrcweir     private:
232cdf0e10cSrcweir 
233cdf0e10cSrcweir         /*-****************************************************************************************************//**
234*b12a77c9Smseidel             @short      return list of key names of our configuration management which represent our module tree
235cdf0e10cSrcweir             @descr      These methods return a static const list of key names. We need it to get needed values from our
236cdf0e10cSrcweir                         configuration management.
237cdf0e10cSrcweir 
238cdf0e10cSrcweir             @seealso    -
239cdf0e10cSrcweir 
240cdf0e10cSrcweir             @param      -
241cdf0e10cSrcweir             @return     A list of needed configuration keys is returned.
242cdf0e10cSrcweir 
243cdf0e10cSrcweir             @onerror    -
244cdf0e10cSrcweir         *//*-*****************************************************************************************************/
245cdf0e10cSrcweir 
246cdf0e10cSrcweir         static Sequence< OUString > GetPropertyNames();
247cdf0e10cSrcweir 
248cdf0e10cSrcweir     protected:
249cdf0e10cSrcweir         void ImplSetSymbolsStyle( bool bValue, sal_Int16 nSet, const ::rtl::OUString &rName );
250cdf0e10cSrcweir };
251cdf0e10cSrcweir 
252cdf0e10cSrcweir //*****************************************************************************************************************
253cdf0e10cSrcweir //  constructor
254cdf0e10cSrcweir //*****************************************************************************************************************
SvtMiscOptions_Impl()255cdf0e10cSrcweir SvtMiscOptions_Impl::SvtMiscOptions_Impl()
256cdf0e10cSrcweir     // Init baseclasses first
257cdf0e10cSrcweir     : ConfigItem( ROOTNODE_MISC )
258cdf0e10cSrcweir 
259cdf0e10cSrcweir     , m_bUseSystemFileDialog( sal_False )
260cdf0e10cSrcweir     , m_bIsUseSystemFileDialogRO( sal_False )
261cdf0e10cSrcweir     , m_bPluginsEnabled( sal_False )
262cdf0e10cSrcweir     , m_bIsPluginsEnabledRO( sal_False )
263cdf0e10cSrcweir     , m_nSymbolsSize( 0 )
264cdf0e10cSrcweir     , m_bIsSymbolsSizeRO( sal_False )
265cdf0e10cSrcweir     , m_bIsSymbolsStyleRO( sal_False )
266cdf0e10cSrcweir     , m_nToolboxStyle( 1 )
267cdf0e10cSrcweir     , m_bIsToolboxStyleRO( sal_False )
268cdf0e10cSrcweir     , m_bUseSystemPrintDialog( sal_False )
269cdf0e10cSrcweir     , m_bIsUseSystemPrintDialogRO( sal_False )
270cdf0e10cSrcweir 
271cdf0e10cSrcweir {
272cdf0e10cSrcweir     // Use our static list of configuration keys to get his values.
273cdf0e10cSrcweir     Sequence< OUString >    seqNames    = GetPropertyNames  (           );
274cdf0e10cSrcweir     Load( seqNames );
275cdf0e10cSrcweir     Sequence< Any >         seqValues   = GetProperties     ( seqNames  );
276cdf0e10cSrcweir     Sequence< sal_Bool >    seqRO       = GetReadOnlyStates ( seqNames  );
277cdf0e10cSrcweir 
278cdf0e10cSrcweir     // Safe impossible cases.
279cdf0e10cSrcweir     // We need values from ALL configuration keys.
280cdf0e10cSrcweir     // Follow assignment use order of values in relation to our list of key names!
281cdf0e10cSrcweir     DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtMiscOptions_Impl::SvtMiscOptions_Impl()\nI miss some values of configuration keys!\n" );
282cdf0e10cSrcweir 
283*b12a77c9Smseidel     // Copy values from list in right order to our internal member.
284cdf0e10cSrcweir     sal_Int32 nPropertyCount = seqValues.getLength();
285cdf0e10cSrcweir     for( sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty )
286cdf0e10cSrcweir     {
287cdf0e10cSrcweir         // Safe impossible cases.
288cdf0e10cSrcweir         // Check any for valid value.
289cdf0e10cSrcweir         DBG_ASSERT( !(seqValues[nProperty].hasValue()==sal_False), "SvtSecurityOptions_Impl::SvtSecurityOptions_Impl()\nInvalid property value detected!\n" );
290cdf0e10cSrcweir         switch( nProperty )
291cdf0e10cSrcweir         {
292cdf0e10cSrcweir             case PROPERTYHANDLE_PLUGINSENABLED :
293cdf0e10cSrcweir             {
294cdf0e10cSrcweir                 if( !(seqValues[nProperty] >>= m_bPluginsEnabled) )
295cdf0e10cSrcweir                 {
296cdf0e10cSrcweir                     DBG_ERROR("Wrong type of \"Misc\\PluginsEnabled\"!" );
297cdf0e10cSrcweir                 }
298cdf0e10cSrcweir                 m_bIsPluginsEnabledRO = seqRO[nProperty];
299cdf0e10cSrcweir                 break;
300cdf0e10cSrcweir             }
301cdf0e10cSrcweir 
302cdf0e10cSrcweir             case PROPERTYHANDLE_SYMBOLSET :
303cdf0e10cSrcweir             {
304cdf0e10cSrcweir                 if( !(seqValues[nProperty] >>= m_nSymbolsSize) )
305cdf0e10cSrcweir                 {
306cdf0e10cSrcweir                     DBG_ERROR("Wrong type of \"Misc\\SymbolSet\"!" );
307cdf0e10cSrcweir                 }
308cdf0e10cSrcweir                 m_bIsSymbolsSizeRO = seqRO[nProperty];
309cdf0e10cSrcweir                 break;
310cdf0e10cSrcweir             }
311cdf0e10cSrcweir 
312cdf0e10cSrcweir             case PROPERTYHANDLE_TOOLBOXSTYLE :
313cdf0e10cSrcweir             {
314cdf0e10cSrcweir                 if( !(seqValues[nProperty] >>= m_nToolboxStyle) )
315cdf0e10cSrcweir                 {
316cdf0e10cSrcweir                     DBG_ERROR("Wrong type of \"Misc\\ToolboxStyle\"!" );
317cdf0e10cSrcweir                 }
318cdf0e10cSrcweir                 m_bIsToolboxStyleRO = seqRO[nProperty];
319cdf0e10cSrcweir                 break;
320cdf0e10cSrcweir             }
321cdf0e10cSrcweir 
322cdf0e10cSrcweir             case PROPERTYHANDLE_USESYSTEMFILEDIALOG :
323cdf0e10cSrcweir             {
324cdf0e10cSrcweir                 if( !(seqValues[nProperty] >>= m_bUseSystemFileDialog) )
325cdf0e10cSrcweir                 {
326cdf0e10cSrcweir                     DBG_ERROR("Wrong type of \"Misc\\UseSystemFileDialog\"!" );
327cdf0e10cSrcweir                 }
328cdf0e10cSrcweir                 m_bIsUseSystemFileDialogRO = seqRO[nProperty];
329cdf0e10cSrcweir                 break;
330cdf0e10cSrcweir             }
331cdf0e10cSrcweir 
332cdf0e10cSrcweir             case PROPERTYHANDLE_USESYSTEMPRINTDIALOG :
333cdf0e10cSrcweir             {
334cdf0e10cSrcweir                 if( !(seqValues[nProperty] >>= m_bUseSystemPrintDialog) )
335cdf0e10cSrcweir                 {
336cdf0e10cSrcweir                     DBG_ERROR("Wrong type of \"Misc\\UseSystemPrintDialog\"!" );
337cdf0e10cSrcweir                 }
338cdf0e10cSrcweir                 m_bIsUseSystemPrintDialogRO = seqRO[nProperty];
339cdf0e10cSrcweir                 break;
340cdf0e10cSrcweir             }
341cdf0e10cSrcweir 
342cdf0e10cSrcweir             case PROPERTYHANDLE_SYMBOLSTYLE :
343cdf0e10cSrcweir             {
344cdf0e10cSrcweir                 ::rtl::OUString aSymbolsStyle;
345cdf0e10cSrcweir                 if( seqValues[nProperty] >>= aSymbolsStyle )
346cdf0e10cSrcweir                     SetSymbolsStyleName( aSymbolsStyle );
347cdf0e10cSrcweir                 else
348cdf0e10cSrcweir                 {
349cdf0e10cSrcweir                     DBG_ERROR("Wrong type of \"Misc\\SymbolStyle\"!" );
350cdf0e10cSrcweir                 }
351cdf0e10cSrcweir                 m_bIsSymbolsStyleRO = seqRO[nProperty];
352cdf0e10cSrcweir                 break;
353cdf0e10cSrcweir             }
354cdf0e10cSrcweir         }
355cdf0e10cSrcweir     }
356cdf0e10cSrcweir 
357*b12a77c9Smseidel     // Enable notification mechanism of our baseclass.
358*b12a77c9Smseidel     // We need it to get information about changes outside these class on our used configuration keys!
359cdf0e10cSrcweir     EnableNotification( seqNames );
360cdf0e10cSrcweir }
361cdf0e10cSrcweir 
362cdf0e10cSrcweir //*****************************************************************************************************************
363cdf0e10cSrcweir //  destructor
364cdf0e10cSrcweir //*****************************************************************************************************************
~SvtMiscOptions_Impl()365cdf0e10cSrcweir SvtMiscOptions_Impl::~SvtMiscOptions_Impl()
366cdf0e10cSrcweir {
367cdf0e10cSrcweir     // We must save our current values .. if user forget it!
368cdf0e10cSrcweir     if( IsModified() == sal_True )
369cdf0e10cSrcweir     {
370cdf0e10cSrcweir         Commit();
371cdf0e10cSrcweir     }
372cdf0e10cSrcweir 
373cdf0e10cSrcweir     for ( sal_uInt16 n=0; n<aList.Count(); )
374cdf0e10cSrcweir         delete aList.Remove(n);
375cdf0e10cSrcweir }
376cdf0e10cSrcweir 
377cdf0e10cSrcweir /*-- 25.02.2005 13:22:04---------------------------------------------------
378cdf0e10cSrcweir 
379cdf0e10cSrcweir   -----------------------------------------------------------------------*/
lcl_MapPropertyName(const::rtl::OUString rCompare,const uno::Sequence<::rtl::OUString> & aInternalPropertyNames)380cdf0e10cSrcweir static int lcl_MapPropertyName( const ::rtl::OUString rCompare,
381cdf0e10cSrcweir                 const uno::Sequence< ::rtl::OUString>& aInternalPropertyNames)
382cdf0e10cSrcweir {
383cdf0e10cSrcweir     for(int nProp = 0; nProp < aInternalPropertyNames.getLength(); ++nProp)
384cdf0e10cSrcweir     {
385cdf0e10cSrcweir         if( aInternalPropertyNames[nProp] == rCompare )
386cdf0e10cSrcweir             return nProp;
387cdf0e10cSrcweir     }
388cdf0e10cSrcweir     return -1;
389cdf0e10cSrcweir }
390cdf0e10cSrcweir 
Load(const Sequence<OUString> & rPropertyNames)391cdf0e10cSrcweir void SvtMiscOptions_Impl::Load( const Sequence< OUString >& rPropertyNames )
392cdf0e10cSrcweir {
393cdf0e10cSrcweir     const uno::Sequence< ::rtl::OUString> aInternalPropertyNames( GetPropertyNames());
394cdf0e10cSrcweir     Sequence< Any > seqValues = GetProperties( rPropertyNames  );
395cdf0e10cSrcweir 
396cdf0e10cSrcweir     // Safe impossible cases.
397cdf0e10cSrcweir     // We need values from ALL configuration keys.
398cdf0e10cSrcweir     // Follow assignment use order of values in relation to our list of key names!
399cdf0e10cSrcweir     DBG_ASSERT( !(rPropertyNames.getLength()!=seqValues.getLength()), "SvtSecurityOptions_Impl::SvtSecurityOptions_Impl()\nI miss some values of configuration keys!\n" );
400cdf0e10cSrcweir 
401*b12a77c9Smseidel     // Copy values from list in right order to our internal member.
402cdf0e10cSrcweir     sal_Int32 nPropertyCount = seqValues.getLength();
403cdf0e10cSrcweir     for( sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty )
404cdf0e10cSrcweir     {
405cdf0e10cSrcweir         // Safe impossible cases.
406cdf0e10cSrcweir         // Check any for valid value.
407cdf0e10cSrcweir         DBG_ASSERT( !(seqValues[nProperty].hasValue()==sal_False), "SvtSecurityOptions_Impl::SvtSecurityOptions_Impl()\nInvalid property value detected!\n" );
408cdf0e10cSrcweir         switch( lcl_MapPropertyName(rPropertyNames[nProperty], aInternalPropertyNames) )
409cdf0e10cSrcweir         {
410cdf0e10cSrcweir             case PROPERTYHANDLE_PLUGINSENABLED      :   {
411cdf0e10cSrcweir                                                             if( !(seqValues[nProperty] >>= m_bPluginsEnabled) )
412cdf0e10cSrcweir                                                             {
413cdf0e10cSrcweir                                                                 DBG_ERROR("Wrong type of \"Misc\\PluginsEnabled\"!" );
414cdf0e10cSrcweir                                                             }
415cdf0e10cSrcweir                                                         }
416cdf0e10cSrcweir                                                     break;
417cdf0e10cSrcweir             case PROPERTYHANDLE_SYMBOLSET           :   {
418cdf0e10cSrcweir                                                             if( !(seqValues[nProperty] >>= m_nSymbolsSize) )
419cdf0e10cSrcweir                                                             {
420cdf0e10cSrcweir                                                                 DBG_ERROR("Wrong type of \"Misc\\SymbolSet\"!" );
421cdf0e10cSrcweir                                                             }
422cdf0e10cSrcweir                                                         }
423cdf0e10cSrcweir                                                     break;
424cdf0e10cSrcweir             case PROPERTYHANDLE_TOOLBOXSTYLE        :   {
425cdf0e10cSrcweir                                                             if( !(seqValues[nProperty] >>= m_nToolboxStyle) )
426cdf0e10cSrcweir                                                             {
427cdf0e10cSrcweir                                                                 DBG_ERROR("Wrong type of \"Misc\\ToolboxStyle\"!" );
428cdf0e10cSrcweir                                                             }
429cdf0e10cSrcweir                                                         }
430cdf0e10cSrcweir                                                     break;
431cdf0e10cSrcweir             case PROPERTYHANDLE_USESYSTEMFILEDIALOG      :   {
432cdf0e10cSrcweir                                                             if( !(seqValues[nProperty] >>= m_bUseSystemFileDialog) )
433cdf0e10cSrcweir                                                             {
434cdf0e10cSrcweir                                                                 DBG_ERROR("Wrong type of \"Misc\\UseSystemFileDialog\"!" );
435cdf0e10cSrcweir                                                             }
436cdf0e10cSrcweir                                                         }
437cdf0e10cSrcweir                                                     break;
438cdf0e10cSrcweir             case PROPERTYHANDLE_USESYSTEMPRINTDIALOG     :   {
439cdf0e10cSrcweir                                                             if( !(seqValues[nProperty] >>= m_bUseSystemPrintDialog) )
440cdf0e10cSrcweir                                                             {
441cdf0e10cSrcweir                                                                 DBG_ERROR("Wrong type of \"Misc\\UseSystemPrintDialog\"!" );
442cdf0e10cSrcweir                                                             }
443cdf0e10cSrcweir                                                         }
444cdf0e10cSrcweir                                                     break;
445cdf0e10cSrcweir             case PROPERTYHANDLE_SYMBOLSTYLE         :   {
446cdf0e10cSrcweir                                                             ::rtl::OUString aSymbolsStyle;
447cdf0e10cSrcweir                                                             if( seqValues[nProperty] >>= aSymbolsStyle )
448cdf0e10cSrcweir                                                                 SetSymbolsStyleName( aSymbolsStyle );
449cdf0e10cSrcweir                                                             else
450cdf0e10cSrcweir                                                             {
451cdf0e10cSrcweir                                                                 DBG_ERROR("Wrong type of \"Misc\\SymbolStyle\"!" );
452cdf0e10cSrcweir                                                             }
453cdf0e10cSrcweir                                                         }
454cdf0e10cSrcweir                                                     break;
455cdf0e10cSrcweir         }
456cdf0e10cSrcweir     }
457cdf0e10cSrcweir }
458cdf0e10cSrcweir 
AddListenerLink(const Link & rLink)459cdf0e10cSrcweir void SvtMiscOptions_Impl::AddListenerLink( const Link& rLink )
460cdf0e10cSrcweir {
461cdf0e10cSrcweir     aList.Insert( new Link( rLink ) );
462cdf0e10cSrcweir }
463cdf0e10cSrcweir 
RemoveListenerLink(const Link & rLink)464cdf0e10cSrcweir void SvtMiscOptions_Impl::RemoveListenerLink( const Link& rLink )
465cdf0e10cSrcweir {
466cdf0e10cSrcweir     for ( sal_uInt16 n=0; n<aList.Count(); n++ )
467cdf0e10cSrcweir     {
468cdf0e10cSrcweir         if ( (*aList.GetObject(n) ) == rLink )
469cdf0e10cSrcweir         {
470cdf0e10cSrcweir             delete aList.Remove(n);
471cdf0e10cSrcweir             break;
472cdf0e10cSrcweir         }
473cdf0e10cSrcweir     }
474cdf0e10cSrcweir }
475cdf0e10cSrcweir 
CallListeners()476cdf0e10cSrcweir void SvtMiscOptions_Impl::CallListeners()
477cdf0e10cSrcweir {
478cdf0e10cSrcweir     for ( sal_uInt16 n = 0; n < aList.Count(); ++n )
479cdf0e10cSrcweir         aList.GetObject(n)->Call( this );
480cdf0e10cSrcweir }
481cdf0e10cSrcweir 
SetToolboxStyle(sal_Int16 nStyle,bool _bSetModified)482cdf0e10cSrcweir void SvtMiscOptions_Impl::SetToolboxStyle( sal_Int16 nStyle, bool _bSetModified )
483cdf0e10cSrcweir {
484cdf0e10cSrcweir     m_nToolboxStyle = nStyle ? 1 : 0;
485cdf0e10cSrcweir     if ( _bSetModified )
486cdf0e10cSrcweir         SetModified();
487cdf0e10cSrcweir     CallListeners();
488cdf0e10cSrcweir }
489cdf0e10cSrcweir 
SetSymbolsSize(sal_Int16 nSet)490cdf0e10cSrcweir void SvtMiscOptions_Impl::SetSymbolsSize( sal_Int16 nSet )
491cdf0e10cSrcweir {
492cdf0e10cSrcweir     m_nSymbolsSize = nSet;
493cdf0e10cSrcweir     SetModified();
494cdf0e10cSrcweir     CallListeners();
495cdf0e10cSrcweir }
496cdf0e10cSrcweir 
GetSymbolsStyle() const497cdf0e10cSrcweir sal_Int16 SvtMiscOptions_Impl::GetSymbolsStyle() const
498cdf0e10cSrcweir {
499cdf0e10cSrcweir     return (sal_Int16)Application::GetSettings().GetStyleSettings().GetSymbolsStyle();
500cdf0e10cSrcweir }
501cdf0e10cSrcweir 
GetSymbolsStyleName() const502cdf0e10cSrcweir ::rtl::OUString SvtMiscOptions_Impl::GetSymbolsStyleName() const
503cdf0e10cSrcweir {
504cdf0e10cSrcweir     return Application::GetSettings().GetStyleSettings().GetSymbolsStyleName();
505cdf0e10cSrcweir }
506cdf0e10cSrcweir 
GetCurrentSymbolsStyle() const507cdf0e10cSrcweir sal_Int16 SvtMiscOptions_Impl::GetCurrentSymbolsStyle() const
508cdf0e10cSrcweir {
509cdf0e10cSrcweir     return (sal_Int16)Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyle();
510cdf0e10cSrcweir }
511cdf0e10cSrcweir 
ImplSetSymbolsStyle(bool bValue,sal_Int16 nSet,const::rtl::OUString & rName)512cdf0e10cSrcweir void SvtMiscOptions_Impl::ImplSetSymbolsStyle( bool bValue, sal_Int16 nSet, const ::rtl::OUString &rName )
513cdf0e10cSrcweir {
514cdf0e10cSrcweir     if ( ( bValue && ( nSet != GetSymbolsStyle() ) ) ||
515cdf0e10cSrcweir          ( !bValue && ( rName != GetSymbolsStyleName() ) ) )
516cdf0e10cSrcweir     {
517cdf0e10cSrcweir         AllSettings aAllSettings = Application::GetSettings();
518cdf0e10cSrcweir         StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
519cdf0e10cSrcweir 
520cdf0e10cSrcweir         if ( bValue )
521cdf0e10cSrcweir             aStyleSettings.SetSymbolsStyle( nSet );
522cdf0e10cSrcweir         else
523cdf0e10cSrcweir             aStyleSettings.SetSymbolsStyleName( rName );
524cdf0e10cSrcweir 
525cdf0e10cSrcweir         aAllSettings.SetStyleSettings(aStyleSettings);
526cdf0e10cSrcweir         Application::MergeSystemSettings( aAllSettings );
527cdf0e10cSrcweir         Application::SetSettings(aAllSettings);
528cdf0e10cSrcweir 
529cdf0e10cSrcweir         SetModified();
530cdf0e10cSrcweir         CallListeners();
531cdf0e10cSrcweir     }
532cdf0e10cSrcweir }
533cdf0e10cSrcweir 
SetPluginsEnabled(sal_Bool bEnable)534cdf0e10cSrcweir void SvtMiscOptions_Impl::SetPluginsEnabled( sal_Bool bEnable )
535cdf0e10cSrcweir {
536cdf0e10cSrcweir     m_bPluginsEnabled = bEnable;
537cdf0e10cSrcweir     SetModified();
538cdf0e10cSrcweir     CallListeners();
539cdf0e10cSrcweir }
540cdf0e10cSrcweir 
541cdf0e10cSrcweir //*****************************************************************************************************************
542cdf0e10cSrcweir //  public method
543cdf0e10cSrcweir //*****************************************************************************************************************
Notify(const Sequence<OUString> & rPropertyNames)544cdf0e10cSrcweir void SvtMiscOptions_Impl::Notify( const Sequence< OUString >& rPropertyNames )
545cdf0e10cSrcweir {
546cdf0e10cSrcweir     Load( rPropertyNames );
547cdf0e10cSrcweir     CallListeners();
548cdf0e10cSrcweir }
549cdf0e10cSrcweir 
550cdf0e10cSrcweir //*****************************************************************************************************************
551cdf0e10cSrcweir //  public method
552cdf0e10cSrcweir //*****************************************************************************************************************
Commit()553cdf0e10cSrcweir void SvtMiscOptions_Impl::Commit()
554cdf0e10cSrcweir {
555cdf0e10cSrcweir     // Get names of supported properties, create a list for values and copy current values to it.
556cdf0e10cSrcweir     Sequence< OUString >    seqNames    = GetPropertyNames  ();
557cdf0e10cSrcweir     sal_Int32               nCount      = seqNames.getLength();
558cdf0e10cSrcweir     Sequence< Any >         seqValues   ( nCount );
559cdf0e10cSrcweir     for( sal_Int32 nProperty=0; nProperty<nCount; ++nProperty )
560cdf0e10cSrcweir     {
561cdf0e10cSrcweir         switch( nProperty )
562cdf0e10cSrcweir         {
563cdf0e10cSrcweir             case PROPERTYHANDLE_PLUGINSENABLED :
564cdf0e10cSrcweir             {
565cdf0e10cSrcweir                 if ( !m_bIsPluginsEnabledRO )
566cdf0e10cSrcweir                     seqValues[nProperty] <<= m_bPluginsEnabled;
567cdf0e10cSrcweir                 break;
568cdf0e10cSrcweir             }
569cdf0e10cSrcweir 
570cdf0e10cSrcweir             case PROPERTYHANDLE_SYMBOLSET :
571cdf0e10cSrcweir             {
572cdf0e10cSrcweir                 if ( !m_bIsSymbolsSizeRO )
573cdf0e10cSrcweir                    seqValues[nProperty] <<= m_nSymbolsSize;
574cdf0e10cSrcweir                 break;
575cdf0e10cSrcweir             }
576cdf0e10cSrcweir 
577cdf0e10cSrcweir             case PROPERTYHANDLE_TOOLBOXSTYLE :
578cdf0e10cSrcweir             {
579cdf0e10cSrcweir                 if ( !m_bIsToolboxStyleRO )
580cdf0e10cSrcweir                     seqValues[nProperty] <<= m_nToolboxStyle;
581cdf0e10cSrcweir                 break;
582cdf0e10cSrcweir             }
583cdf0e10cSrcweir 
584cdf0e10cSrcweir             case PROPERTYHANDLE_USESYSTEMFILEDIALOG :
585cdf0e10cSrcweir             {
586cdf0e10cSrcweir                 if ( !m_bIsUseSystemFileDialogRO )
587cdf0e10cSrcweir                     seqValues[nProperty] <<= m_bUseSystemFileDialog;
588cdf0e10cSrcweir                 break;
589cdf0e10cSrcweir             }
590cdf0e10cSrcweir 
591cdf0e10cSrcweir             case PROPERTYHANDLE_SYMBOLSTYLE :
592cdf0e10cSrcweir             {
593cdf0e10cSrcweir                 if ( !m_bIsSymbolsStyleRO )
594cdf0e10cSrcweir                     seqValues[nProperty] <<= GetSymbolsStyleName();
595cdf0e10cSrcweir                 break;
596cdf0e10cSrcweir             }
597cdf0e10cSrcweir 
598cdf0e10cSrcweir             case PROPERTYHANDLE_USESYSTEMPRINTDIALOG :
599cdf0e10cSrcweir             {
600cdf0e10cSrcweir                 if ( !m_bIsUseSystemPrintDialogRO )
601cdf0e10cSrcweir                     seqValues[nProperty] <<= m_bUseSystemPrintDialog;
602cdf0e10cSrcweir                 break;
603cdf0e10cSrcweir             }
604cdf0e10cSrcweir         }
605cdf0e10cSrcweir     }
606cdf0e10cSrcweir     // Set properties in configuration.
607cdf0e10cSrcweir     PutProperties( seqNames, seqValues );
608cdf0e10cSrcweir }
609cdf0e10cSrcweir 
610cdf0e10cSrcweir //*****************************************************************************************************************
611cdf0e10cSrcweir //  private method
612cdf0e10cSrcweir //*****************************************************************************************************************
GetPropertyNames()613cdf0e10cSrcweir Sequence< OUString > SvtMiscOptions_Impl::GetPropertyNames()
614cdf0e10cSrcweir {
615cdf0e10cSrcweir     // Build static list of configuration key names.
616cdf0e10cSrcweir     static const OUString pProperties[] =
617cdf0e10cSrcweir     {
618cdf0e10cSrcweir         PROPERTYNAME_PLUGINSENABLED,
619cdf0e10cSrcweir         PROPERTYNAME_SYMBOLSET,
620cdf0e10cSrcweir         PROPERTYNAME_TOOLBOXSTYLE,
621cdf0e10cSrcweir         PROPERTYNAME_USESYSTEMFILEDIALOG,
622cdf0e10cSrcweir         PROPERTYNAME_SYMBOLSTYLE,
623cdf0e10cSrcweir         PROPERTYNAME_USESYSTEMPRINTDIALOG
624cdf0e10cSrcweir     };
625cdf0e10cSrcweir 
626cdf0e10cSrcweir     // Initialize return sequence with these list ...
627cdf0e10cSrcweir     static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
628cdf0e10cSrcweir     // ... and return it.
629cdf0e10cSrcweir     return seqPropertyNames;
630cdf0e10cSrcweir }
631cdf0e10cSrcweir 
632cdf0e10cSrcweir //*****************************************************************************************************************
633cdf0e10cSrcweir //  initialize static member
634cdf0e10cSrcweir //  DON'T DO IT IN YOUR HEADER!
635cdf0e10cSrcweir //  see definition for further informations
636cdf0e10cSrcweir //*****************************************************************************************************************
637cdf0e10cSrcweir SvtMiscOptions_Impl*    SvtMiscOptions::m_pDataContainer    = NULL  ;
638cdf0e10cSrcweir sal_Int32               SvtMiscOptions::m_nRefCount = 0     ;
639cdf0e10cSrcweir 
640cdf0e10cSrcweir //*****************************************************************************************************************
641cdf0e10cSrcweir //  constructor
642cdf0e10cSrcweir //*****************************************************************************************************************
SvtMiscOptions()643cdf0e10cSrcweir SvtMiscOptions::SvtMiscOptions()
644cdf0e10cSrcweir {
645cdf0e10cSrcweir     // Global access, must be guarded (multithreading!).
646cdf0e10cSrcweir     MutexGuard aGuard( GetInitMutex() );
647*b12a77c9Smseidel     // Increase our refcount ...
648cdf0e10cSrcweir     ++m_nRefCount;
649*b12a77c9Smseidel     // ... and initialize our data container only if it not already exist!
650cdf0e10cSrcweir     if( m_pDataContainer == NULL )
651cdf0e10cSrcweir     {
652cdf0e10cSrcweir        RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtMiscOptions_Impl::ctor()");
653cdf0e10cSrcweir        m_pDataContainer = new SvtMiscOptions_Impl;
654cdf0e10cSrcweir        ItemHolder2::holdConfigItem(E_MISCOPTIONS);
655cdf0e10cSrcweir     }
656cdf0e10cSrcweir }
657cdf0e10cSrcweir 
658cdf0e10cSrcweir //*****************************************************************************************************************
659cdf0e10cSrcweir //  destructor
660cdf0e10cSrcweir //*****************************************************************************************************************
~SvtMiscOptions()661cdf0e10cSrcweir SvtMiscOptions::~SvtMiscOptions()
662cdf0e10cSrcweir {
663cdf0e10cSrcweir     // Global access, must be guarded (multithreading!)
664cdf0e10cSrcweir     MutexGuard aGuard( GetInitMutex() );
665*b12a77c9Smseidel     // Decrease our refcount.
666cdf0e10cSrcweir     --m_nRefCount;
667cdf0e10cSrcweir     // If last instance was deleted ...
668*b12a77c9Smseidel     // we must destroy our static data container!
669cdf0e10cSrcweir     if( m_nRefCount <= 0 )
670cdf0e10cSrcweir     {
671cdf0e10cSrcweir         delete m_pDataContainer;
672cdf0e10cSrcweir         m_pDataContainer = NULL;
673cdf0e10cSrcweir     }
674cdf0e10cSrcweir }
675cdf0e10cSrcweir 
UseSystemFileDialog() const676cdf0e10cSrcweir sal_Bool SvtMiscOptions::UseSystemFileDialog() const
677cdf0e10cSrcweir {
678cdf0e10cSrcweir     return m_pDataContainer->UseSystemFileDialog();
679cdf0e10cSrcweir }
680cdf0e10cSrcweir 
SetUseSystemFileDialog(sal_Bool bEnable)681cdf0e10cSrcweir void SvtMiscOptions::SetUseSystemFileDialog( sal_Bool bEnable )
682cdf0e10cSrcweir {
683cdf0e10cSrcweir     m_pDataContainer->SetUseSystemFileDialog( bEnable );
684cdf0e10cSrcweir }
685cdf0e10cSrcweir 
IsUseSystemFileDialogReadOnly() const686cdf0e10cSrcweir sal_Bool SvtMiscOptions::IsUseSystemFileDialogReadOnly() const
687cdf0e10cSrcweir {
688cdf0e10cSrcweir     return m_pDataContainer->IsUseSystemFileDialogReadOnly();
689cdf0e10cSrcweir }
690cdf0e10cSrcweir 
IsPluginsEnabled() const691cdf0e10cSrcweir sal_Bool SvtMiscOptions::IsPluginsEnabled() const
692cdf0e10cSrcweir {
693cdf0e10cSrcweir     return m_pDataContainer->IsPluginsEnabled();
694cdf0e10cSrcweir }
695cdf0e10cSrcweir 
SetPluginsEnabled(sal_Bool bEnable)696cdf0e10cSrcweir void SvtMiscOptions::SetPluginsEnabled( sal_Bool bEnable )
697cdf0e10cSrcweir {
698cdf0e10cSrcweir     m_pDataContainer->SetPluginsEnabled( bEnable );
699cdf0e10cSrcweir }
700cdf0e10cSrcweir 
IsPluginsEnabledReadOnly() const701cdf0e10cSrcweir sal_Bool SvtMiscOptions::IsPluginsEnabledReadOnly() const
702cdf0e10cSrcweir {
703cdf0e10cSrcweir     return m_pDataContainer->IsPluginsEnabledReadOnly();
704cdf0e10cSrcweir }
705cdf0e10cSrcweir 
GetSymbolsSize() const706cdf0e10cSrcweir sal_Int16 SvtMiscOptions::GetSymbolsSize() const
707cdf0e10cSrcweir {
708cdf0e10cSrcweir     return m_pDataContainer->GetSymbolsSize();
709cdf0e10cSrcweir }
710cdf0e10cSrcweir 
SetSymbolsSize(sal_Int16 nSet)711cdf0e10cSrcweir void SvtMiscOptions::SetSymbolsSize( sal_Int16 nSet )
712cdf0e10cSrcweir {
713cdf0e10cSrcweir     m_pDataContainer->SetSymbolsSize( nSet );
714cdf0e10cSrcweir }
715cdf0e10cSrcweir 
GetCurrentSymbolsSize() const716cdf0e10cSrcweir sal_Int16 SvtMiscOptions::GetCurrentSymbolsSize() const
717cdf0e10cSrcweir {
718cdf0e10cSrcweir     sal_Int16 eOptSymbolsSize = m_pDataContainer->GetSymbolsSize();
719cdf0e10cSrcweir 
720cdf0e10cSrcweir     if ( eOptSymbolsSize == SFX_SYMBOLS_SIZE_AUTO )
721cdf0e10cSrcweir     {
722cdf0e10cSrcweir         // Use system settings, we have to retrieve the toolbar icon size from the
723cdf0e10cSrcweir         // Application class
724cdf0e10cSrcweir         sal_uLong nStyleIconSize = Application::GetSettings().GetStyleSettings().GetToolbarIconSize();
725cdf0e10cSrcweir         if ( nStyleIconSize == STYLE_TOOLBAR_ICONSIZE_LARGE )
726cdf0e10cSrcweir             eOptSymbolsSize = SFX_SYMBOLS_SIZE_LARGE;
727cdf0e10cSrcweir         else
728cdf0e10cSrcweir             eOptSymbolsSize = SFX_SYMBOLS_SIZE_SMALL;
729cdf0e10cSrcweir     }
730cdf0e10cSrcweir 
731cdf0e10cSrcweir     return eOptSymbolsSize;
732cdf0e10cSrcweir }
733cdf0e10cSrcweir 
AreCurrentSymbolsLarge() const734cdf0e10cSrcweir bool SvtMiscOptions::AreCurrentSymbolsLarge() const
735cdf0e10cSrcweir {
736cdf0e10cSrcweir     return ( GetCurrentSymbolsSize() == SFX_SYMBOLS_SIZE_LARGE );
737cdf0e10cSrcweir }
738cdf0e10cSrcweir 
IsGetSymbolsSizeReadOnly() const739cdf0e10cSrcweir sal_Bool SvtMiscOptions::IsGetSymbolsSizeReadOnly() const
740cdf0e10cSrcweir {
741cdf0e10cSrcweir     return m_pDataContainer->IsGetSymbolsSizeReadOnly();
742cdf0e10cSrcweir }
743cdf0e10cSrcweir 
GetSymbolsStyle() const744cdf0e10cSrcweir sal_Int16 SvtMiscOptions::GetSymbolsStyle() const
745cdf0e10cSrcweir {
746cdf0e10cSrcweir     return m_pDataContainer->GetSymbolsStyle();
747cdf0e10cSrcweir }
748cdf0e10cSrcweir 
GetCurrentSymbolsStyle() const749cdf0e10cSrcweir sal_Int16 SvtMiscOptions::GetCurrentSymbolsStyle() const
750cdf0e10cSrcweir {
751cdf0e10cSrcweir     return m_pDataContainer->GetCurrentSymbolsStyle();
752cdf0e10cSrcweir }
753cdf0e10cSrcweir 
GetCurrentSymbolsStyleName() const754cdf0e10cSrcweir OUString SvtMiscOptions::GetCurrentSymbolsStyleName() const
755cdf0e10cSrcweir {
756cdf0e10cSrcweir     return Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyleName();
757cdf0e10cSrcweir }
758cdf0e10cSrcweir 
SetSymbolsStyle(sal_Int16 nSet)759cdf0e10cSrcweir void SvtMiscOptions::SetSymbolsStyle( sal_Int16 nSet )
760cdf0e10cSrcweir {
761cdf0e10cSrcweir     m_pDataContainer->SetSymbolsStyle( nSet );
762cdf0e10cSrcweir }
763cdf0e10cSrcweir 
IsGetSymbolsStyleReadOnly() const764cdf0e10cSrcweir sal_Bool SvtMiscOptions::IsGetSymbolsStyleReadOnly() const
765cdf0e10cSrcweir {
766cdf0e10cSrcweir     return m_pDataContainer->IsGetSymbolsStyleReadOnly();
767cdf0e10cSrcweir }
768cdf0e10cSrcweir 
GetToolboxStyle() const769cdf0e10cSrcweir sal_Int16 SvtMiscOptions::GetToolboxStyle() const
770cdf0e10cSrcweir {
771cdf0e10cSrcweir     return m_pDataContainer->GetToolboxStyle();
772cdf0e10cSrcweir }
773cdf0e10cSrcweir 
SetToolboxStyle(sal_Int16 nStyle)774cdf0e10cSrcweir void SvtMiscOptions::SetToolboxStyle( sal_Int16 nStyle )
775cdf0e10cSrcweir {
776cdf0e10cSrcweir     m_pDataContainer->SetToolboxStyle( nStyle, true );
777cdf0e10cSrcweir }
778cdf0e10cSrcweir 
IsGetToolboxStyleReadOnly() const779cdf0e10cSrcweir sal_Bool SvtMiscOptions::IsGetToolboxStyleReadOnly() const
780cdf0e10cSrcweir {
781cdf0e10cSrcweir     return m_pDataContainer->IsGetToolboxStyleReadOnly();
782cdf0e10cSrcweir }
783cdf0e10cSrcweir 
UseSystemPrintDialog() const784cdf0e10cSrcweir sal_Bool SvtMiscOptions::UseSystemPrintDialog() const
785cdf0e10cSrcweir {
786cdf0e10cSrcweir     return m_pDataContainer->UseSystemPrintDialog();
787cdf0e10cSrcweir }
788cdf0e10cSrcweir 
SetUseSystemPrintDialog(sal_Bool bEnable)789cdf0e10cSrcweir void SvtMiscOptions::SetUseSystemPrintDialog( sal_Bool bEnable )
790cdf0e10cSrcweir {
791cdf0e10cSrcweir     m_pDataContainer->SetUseSystemPrintDialog( bEnable );
792cdf0e10cSrcweir }
793cdf0e10cSrcweir 
794cdf0e10cSrcweir //*****************************************************************************************************************
795cdf0e10cSrcweir //  private method
796cdf0e10cSrcweir //*****************************************************************************************************************
GetInitMutex()797cdf0e10cSrcweir Mutex & SvtMiscOptions::GetInitMutex()
798cdf0e10cSrcweir {
799cdf0e10cSrcweir     // Initialize static mutex only for one time!
800cdf0e10cSrcweir     static Mutex* pMutex = NULL;
801cdf0e10cSrcweir     // If these method first called (Mutex not already exist!) ...
802cdf0e10cSrcweir     if( pMutex == NULL )
803cdf0e10cSrcweir     {
804cdf0e10cSrcweir         // ... we must create a new one. Protect follow code with the global mutex -
805cdf0e10cSrcweir         // It must be - we create a static variable!
806cdf0e10cSrcweir         MutexGuard aGuard( Mutex::getGlobalMutex() );
807*b12a77c9Smseidel         // We must check our pointer again - because it can be that another instance of our class will be faster than these!
808cdf0e10cSrcweir         if( pMutex == NULL )
809cdf0e10cSrcweir         {
810cdf0e10cSrcweir             // Create the new mutex and set it for return on static variable.
811cdf0e10cSrcweir             static Mutex aMutex;
812cdf0e10cSrcweir             pMutex = &aMutex;
813cdf0e10cSrcweir         }
814cdf0e10cSrcweir     }
815cdf0e10cSrcweir     // Return new created or already existing mutex object.
816cdf0e10cSrcweir     return *pMutex;
817cdf0e10cSrcweir }
818cdf0e10cSrcweir 
AddListenerLink(const Link & rLink)819cdf0e10cSrcweir void SvtMiscOptions::AddListenerLink( const Link& rLink )
820cdf0e10cSrcweir {
821cdf0e10cSrcweir     m_pDataContainer->AddListenerLink( rLink );
822cdf0e10cSrcweir }
823cdf0e10cSrcweir 
RemoveListenerLink(const Link & rLink)824cdf0e10cSrcweir void SvtMiscOptions::RemoveListenerLink( const Link& rLink )
825cdf0e10cSrcweir {
826cdf0e10cSrcweir     m_pDataContainer->RemoveListenerLink( rLink );
827cdf0e10cSrcweir }
828