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