Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <svl/zforlist.hxx>
30 : : #include <svtools/grfmgr.hxx>
31 : : #include <svl/flagitem.hxx>
32 : : #include <sfx2/dispatch.hxx>
33 : : #include <unotools/lingucfg.hxx>
34 : : #include <svl/szitem.hxx>
35 : : #include <sfx2/viewsh.hxx>
36 : : #include <sfx2/viewfrm.hxx>
37 : : #include <sfx2/imgmgr.hxx>
38 : : #include <vcl/configsettings.hxx>
39 : : #include <vcl/msgbox.hxx>
40 : : #include <vcl/mnemonic.hxx>
41 : : #include <i18npool/mslangid.hxx>
42 : : #include <unotools/compatibility.hxx>
43 : : #include <unotools/useroptions.hxx>
44 : : #include <unotools/fontoptions.hxx>
45 : : #include <svtools/menuoptions.hxx>
46 : : #include <unotools/startoptions.hxx>
47 : : #include <svl/languageoptions.hxx>
48 : : #include <svtools/miscopt.hxx>
49 : : #include <unotools/printwarningoptions.hxx>
50 : : #include <unotools/syslocaleoptions.hxx>
51 : : #include <svtools/accessibilityoptions.hxx>
52 : : #include <unotools/configitem.hxx>
53 : : #include <sfx2/objsh.hxx>
54 : : #include <comphelper/string.hxx>
55 : : #include <comphelper/types.hxx>
56 : : #include <svtools/langtab.hxx>
57 : : #include <unotools/localfilehelper.hxx>
58 : : #include <unotools/configmgr.hxx>
59 : : #include "cuioptgenrl.hxx"
60 : : #include "optpath.hxx"
61 : : #include "optsave.hxx"
62 : : #include "optlingu.hxx"
63 : : #include <svx/xpool.hxx>
64 : : #include <svx/dlgutil.hxx>
65 : : #include "cuitabarea.hxx"
66 : : #include <cuires.hrc>
67 : : #include <editeng/unolingu.hxx>
68 : : #include <editeng/langitem.hxx>
69 : : #include <comphelper/processfactory.hxx>
70 : : #include <rtl/ustrbuf.hxx>
71 : : #include <editeng/editids.hrc>
72 : : #include <svx/svxids.hrc>
73 : : #include <svl/intitem.hxx>
74 : : #include <dialmgr.hxx>
75 : : #include <svtools/helpopt.hxx>
76 : : #include <unotools/saveopt.hxx>
77 : : #include <sal/macros.h>
78 : :
79 : : #include <com/sun/star/configuration/theDefaultProvider.hpp>
80 : : #include <com/sun/star/container/XNameAccess.hpp>
81 : : #include <com/sun/star/container/XNameReplace.hpp>
82 : : #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
83 : : #include <com/sun/star/lang/XComponent.hpp>
84 : : #include <com/sun/star/lang/XInitialization.hpp>
85 : : #include <com/sun/star/beans/NamedValue.hpp>
86 : : #include <com/sun/star/beans/XPropertySet.hpp>
87 : : #include <com/sun/star/util/XChangesBatch.hpp>
88 : : #include <com/sun/star/uno/Any.hxx>
89 : : #include <com/sun/star/container/XContentEnumerationAccess.hpp>
90 : : #include <com/sun/star/container/XSet.hpp>
91 : : #include <com/sun/star/i18n/ScriptType.hpp>
92 : :
93 : : #include <vcl/svapp.hxx>
94 : :
95 : : #include "optgdlg.hrc"
96 : : #include "optgdlg.hxx"
97 : : #include <svx/ofaitem.hxx>
98 : : #include <svtools/apearcfg.hxx>
99 : : #include <svtools/optionsdrawinglayer.hxx>
100 : :
101 : : using namespace ::com::sun::star::uno;
102 : : using namespace ::com::sun::star::lang;
103 : : using namespace ::com::sun::star::beans;
104 : : using namespace ::com::sun::star::container;
105 : : using namespace ::com::sun::star::util;
106 : : using namespace ::utl;
107 : : using ::rtl::OString;
108 : : using ::rtl::OUString;
109 : :
110 : : #define C2U(cChar) OUString::createFromAscii(cChar)
111 : :
112 : : // class OfaMiscTabPage --------------------------------------------------
113 : :
114 : 0 : int OfaMiscTabPage::DeactivatePage( SfxItemSet* pSet_ )
115 : : {
116 [ # # ]: 0 : if ( pSet_ )
117 : 0 : FillItemSet( *pSet_ );
118 : 0 : return LEAVE_PAGE;
119 : : }
120 : :
121 : : namespace
122 : : {
123 : 0 : static ::rtl::OUString impl_SystemFileOpenServiceName()
124 : : {
125 : 0 : const ::rtl::OUString &rDesktopEnvironment = Application::GetDesktopEnvironment();
126 : :
127 [ # # ]: 0 : if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("kde4")) )
128 : : {
129 : : #ifdef ENABLE_KDE4
130 : : return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.KDE4FilePicker") );
131 : : #else
132 : 0 : return rtl::OUString();
133 : : #endif
134 : : }
135 [ # # ]: 0 : else if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("kde")) )
136 : : {
137 : : #ifdef ENABLE_KDE
138 : : return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.KDEFilePicker") );
139 : : #else
140 : 0 : return rtl::OUString();
141 : : #endif
142 : : }
143 [ # # ]: 0 : else if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("tde")) )
144 : : {
145 : : #ifdef ENABLE_TDE
146 : : return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.TDEFilePicker") );
147 : : #else
148 : 0 : return rtl::OUString();
149 : : #endif
150 : : }
151 : : #if defined WNT
152 : : return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.SystemFilePicker") );
153 : : #elif (defined MACOSX && defined QUARTZ)
154 : : return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.AquaFilePicker") );
155 : : #else
156 : 0 : return rtl::OUString();
157 : : #endif
158 : : }
159 : :
160 : 0 : static bool lcl_HasSystemFilePicker()
161 : : {
162 [ # # ][ # # ]: 0 : if( Application::hasNativeFileSelection() )
163 : 0 : return true;
164 : :
165 : : // Otherwise fall-back on querying services
166 : 0 : bool bRet = false;
167 [ # # ]: 0 : Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
168 : :
169 [ # # ]: 0 : Reference< XContentEnumerationAccess > xEnumAccess( xFactory, UNO_QUERY );
170 [ # # ]: 0 : Reference< XSet > xSet( xFactory, UNO_QUERY );
171 : :
172 [ # # ][ # # ]: 0 : if ( ! xEnumAccess.is() || ! xSet.is() )
[ # # ]
173 : 0 : return bRet;
174 : :
175 : : try
176 : : {
177 [ # # ]: 0 : ::rtl::OUString aFileService = impl_SystemFileOpenServiceName();
178 [ # # ][ # # ]: 0 : Reference< XEnumeration > xEnum = xEnumAccess->createContentEnumeration( aFileService );
179 [ # # ][ # # ]: 0 : if ( xEnum.is() && xEnum->hasMoreElements() )
[ # # ][ # # ]
[ # # ]
180 [ # # # ]: 0 : bRet = true;
181 : : }
182 [ # # ]: 0 : catch (const IllegalArgumentException&)
183 : : {
184 : : }
185 [ # # ]: 0 : catch (const ElementExistException&)
186 : : {
187 : : }
188 : 0 : return bRet;
189 : : }
190 : : }
191 : :
192 : : // -----------------------------------------------------------------------
193 : :
194 : 0 : OfaMiscTabPage::OfaMiscTabPage(Window* pParent, const SfxItemSet& rSet ) :
195 : :
196 : 0 : SfxTabPage( pParent, CUI_RES( OFA_TP_MISC ), rSet ),
197 : :
198 [ # # ]: 0 : aHelpFL ( this, CUI_RES( FL_HELP ) ),
199 [ # # ]: 0 : aToolTipsCB ( this, CUI_RES( CB_TOOLTIP ) ),
200 [ # # ]: 0 : aExtHelpCB ( this, CUI_RES( CB_EXTHELP ) ),
201 [ # # ]: 0 : aHelpAgentCB ( this, CUI_RES( CB_HELPAGENT ) ),
202 [ # # ]: 0 : aHelpAgentResetBtn ( this, CUI_RES( PB_HELPAGENT_RESET ) ),
203 [ # # ]: 0 : aFileDlgFL ( this, CUI_RES( FL_FILEDLG ) ),
204 [ # # ]: 0 : aFileDlgROImage ( this, CUI_RES( FI_FILEDLG_RO ) ),
205 [ # # ]: 0 : aFileDlgCB ( this, CUI_RES( CB_FILEDLG ) ),
206 [ # # ]: 0 : aODMADlgCB ( this, CUI_RES( CB_ODMADLG ) ),
207 [ # # ]: 0 : aPrintDlgFL ( this, CUI_RES( FL_PRINTDLG ) ),
208 [ # # ]: 0 : aPrintDlgCB ( this, CUI_RES( CB_PRINTDLG ) ),
209 [ # # ]: 0 : aDocStatusFL ( this, CUI_RES( FL_DOCSTATUS ) ),
210 [ # # ]: 0 : aDocStatusCB ( this, CUI_RES( CB_DOCSTATUS ) ),
211 [ # # ]: 0 : aSaveAlwaysCB ( this, CUI_RES( CB_SAVE_ALWAYS ) ),
212 [ # # ]: 0 : aTwoFigureFL ( this, CUI_RES( FL_TWOFIGURE ) ),
213 [ # # ]: 0 : aInterpretFT ( this, CUI_RES( FT_INTERPRET ) ),
214 [ # # ]: 0 : aYearValueField ( this, CUI_RES( NF_YEARVALUE ) ),
215 [ # # ]: 0 : aToYearFT ( this, CUI_RES( FT_TOYEAR ) ),
216 [ # # ]: 0 : aExperimentalFL ( this, CUI_RES( FL_EXPERIMENTAL ) ),
217 [ # # ]: 0 : aExperimentalCB ( this, CUI_RES( CB_EXPERIMENTAL ) ),
218 [ # # ][ # # ]: 0 : aMacroRecorderCB ( this, CUI_RES( CB_MACRORECORDER ) )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
219 : : {
220 [ # # ]: 0 : FreeResource();
221 : :
222 [ # # ][ # # ]: 0 : if (!lcl_HasSystemFilePicker())
223 : : {
224 [ # # ]: 0 : aFileDlgFL.Hide();
225 [ # # ]: 0 : aFileDlgCB.Hide();
226 : : }
227 : :
228 : : #if !defined(QUARTZ) && !defined(ENABLE_GTK)
229 : : aPrintDlgFL.Hide();
230 : : aPrintDlgCB.Hide();
231 : : #endif
232 : :
233 : : #ifdef WNT
234 : : aFileDlgCB.SetToggleHdl( LINK( this, OfaMiscTabPage, OnFileDlgToggled ) );
235 : : #else
236 [ # # ]: 0 : aODMADlgCB.Hide();
237 : : #endif
238 : :
239 [ # # ][ # # ]: 0 : if (!aODMADlgCB.IsVisible())
240 : : {
241 : : // rearrange the following controls
242 [ # # ]: 0 : Point aNewPos = aPrintDlgFL.GetPosPixel();
243 [ # # ]: 0 : long nDelta = aNewPos.Y() - aODMADlgCB.GetPosPixel().Y();
244 : :
245 : : Window* pWins[] =
246 : : {
247 : : &aPrintDlgFL, &aPrintDlgCB, &aDocStatusFL, &aDocStatusCB, &aSaveAlwaysCB,
248 : : &aTwoFigureFL, &aInterpretFT, &aYearValueField, &aToYearFT, &aExperimentalFL, &aExperimentalCB, &aMacroRecorderCB
249 : 0 : };
250 : 0 : Window** pCurrent = pWins;
251 : 0 : const sal_Int32 nCount = SAL_N_ELEMENTS( pWins );
252 [ # # ]: 0 : for ( sal_Int32 i = 0; i < nCount; ++i, ++pCurrent )
253 : : {
254 [ # # ]: 0 : aNewPos = (*pCurrent)->GetPosPixel();
255 : 0 : aNewPos.Y() -= nDelta;
256 [ # # ]: 0 : (*pCurrent)->SetPosPixel( aNewPos );
257 : : }
258 : : }
259 : :
260 [ # # ][ # # ]: 0 : if ( !aFileDlgCB.IsVisible() )
261 : : {
262 : : // rearrange the following controls
263 [ # # ]: 0 : Point aNewPos = aPrintDlgFL.GetPosPixel();
264 [ # # ]: 0 : long nDelta = aNewPos.Y() - aFileDlgFL.GetPosPixel().Y();
265 : :
266 : : Window* pWins[] =
267 : : {
268 : : &aPrintDlgFL, &aPrintDlgCB, &aDocStatusFL, &aDocStatusCB, &aSaveAlwaysCB,
269 : : &aTwoFigureFL, &aInterpretFT, &aYearValueField, &aToYearFT, &aExperimentalFL, &aExperimentalCB, &aMacroRecorderCB
270 : 0 : };
271 : 0 : Window** pCurrent = pWins;
272 : 0 : const sal_Int32 nCount = SAL_N_ELEMENTS( pWins );
273 [ # # ]: 0 : for ( sal_Int32 i = 0; i < nCount; ++i, ++pCurrent )
274 : : {
275 [ # # ]: 0 : aNewPos = (*pCurrent)->GetPosPixel();
276 : 0 : aNewPos.Y() -= nDelta;
277 [ # # ]: 0 : (*pCurrent)->SetPosPixel( aNewPos );
278 : : }
279 : : }
280 [ # # ][ # # ]: 0 : else if ( SvtMiscOptions().IsUseSystemFileDialogReadOnly() )
[ # # ][ # # ]
281 : : {
282 [ # # ]: 0 : aFileDlgROImage.Show();
283 [ # # ]: 0 : aFileDlgCB.Disable();
284 : : }
285 : :
286 [ # # ][ # # ]: 0 : if ( !aPrintDlgCB.IsVisible() )
287 : : {
288 : : // rearrange the following controls
289 [ # # ]: 0 : Point aNewPos = aDocStatusFL.GetPosPixel();
290 [ # # ]: 0 : long nDelta = aNewPos.Y() - aPrintDlgFL.GetPosPixel().Y();
291 : :
292 : : Window* pWins[] =
293 : : {
294 : : &aDocStatusFL, &aDocStatusCB, &aSaveAlwaysCB, &aTwoFigureFL,
295 : : &aInterpretFT, &aYearValueField, &aToYearFT, &aExperimentalFL, &aExperimentalCB, &aMacroRecorderCB
296 : 0 : };
297 : 0 : Window** pCurrent = pWins;
298 : 0 : const sal_Int32 nCount = SAL_N_ELEMENTS( pWins );
299 [ # # ]: 0 : for ( sal_Int32 i = 0; i < nCount; ++i, ++pCurrent )
300 : : {
301 [ # # ]: 0 : aNewPos = (*pCurrent)->GetPosPixel();
302 : 0 : aNewPos.Y() -= nDelta;
303 [ # # ]: 0 : (*pCurrent)->SetPosPixel( aNewPos );
304 : : }
305 : : }
306 : :
307 : : // at least the button is as wide as its text
308 [ # # ][ # # ]: 0 : long nTxtWidth = aHelpAgentResetBtn.GetTextWidth( aHelpAgentResetBtn.GetText() );
[ # # ]
309 [ # # ]: 0 : Size aBtnSz = aHelpAgentResetBtn.GetSizePixel();
310 [ # # ]: 0 : if ( aBtnSz.Width() < nTxtWidth )
311 : : {
312 : 0 : aBtnSz.Width() = nTxtWidth;
313 [ # # ]: 0 : aHelpAgentResetBtn.SetSizePixel( aBtnSz );
314 : : }
315 : :
316 [ # # ][ # # ]: 0 : aStrDateInfo = aToYearFT.GetText();
[ # # ]
317 [ # # ]: 0 : aYearValueField.SetModifyHdl( LINK( this, OfaMiscTabPage, TwoFigureHdl ) );
318 [ # # ]: 0 : Link aLink = LINK( this, OfaMiscTabPage, TwoFigureConfigHdl );
319 : 0 : aYearValueField.SetDownHdl( aLink );
320 : 0 : aYearValueField.SetUpHdl( aLink );
321 : 0 : aYearValueField.SetLoseFocusHdl( aLink );
322 : 0 : aYearValueField.SetFirstHdl( aLink );
323 [ # # ]: 0 : TwoFigureConfigHdl( &aYearValueField );
324 : :
325 : 0 : SetExchangeSupport();
326 : :
327 [ # # ]: 0 : aLink = LINK( this, OfaMiscTabPage, HelpCheckHdl_Impl );
328 : 0 : aToolTipsCB.SetClickHdl( aLink );
329 : 0 : aHelpAgentCB.SetClickHdl( aLink );
330 [ # # ]: 0 : aHelpAgentResetBtn.SetClickHdl( LINK( this, OfaMiscTabPage, HelpAgentResetHdl_Impl ) );
331 : 0 : }
332 : :
333 : : #ifdef WNT
334 : : IMPL_LINK_NOARG(OfaMiscTabPage, OnFileDlgToggled)
335 : : {
336 : : aODMADlgCB.Enable( !aFileDlgCB.IsChecked() );
337 : : return 0;
338 : : }
339 : : #endif
340 : :
341 : : // -----------------------------------------------------------------------
342 : :
343 [ # # ][ # # ]: 0 : OfaMiscTabPage::~OfaMiscTabPage()
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
344 : : {
345 [ # # ]: 0 : }
346 : :
347 : : // -----------------------------------------------------------------------
348 : :
349 : 0 : SfxTabPage* OfaMiscTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
350 : : {
351 [ # # ]: 0 : return new OfaMiscTabPage( pParent, rAttrSet );
352 : : }
353 : :
354 : : // -----------------------------------------------------------------------
355 : :
356 : 0 : sal_Bool OfaMiscTabPage::FillItemSet( SfxItemSet& rSet )
357 : : {
358 : 0 : sal_Bool bModified = sal_False;
359 : :
360 [ # # ]: 0 : SvtHelpOptions aHelpOptions;
361 [ # # ]: 0 : sal_Bool bChecked = aToolTipsCB.IsChecked();
362 [ # # ]: 0 : if ( bChecked != aToolTipsCB.GetSavedValue() )
363 [ # # ]: 0 : aHelpOptions.SetHelpTips( bChecked );
364 [ # # ][ # # ]: 0 : bChecked = ( aExtHelpCB.IsChecked() && aToolTipsCB.IsChecked() );
[ # # ][ # # ]
365 [ # # ]: 0 : if ( bChecked != aExtHelpCB.GetSavedValue() )
366 [ # # ]: 0 : aHelpOptions.SetExtendedHelp( bChecked );
367 [ # # ]: 0 : bChecked = aHelpAgentCB.IsChecked();
368 [ # # ]: 0 : if ( bChecked != aHelpAgentCB.GetSavedValue() )
369 [ # # ]: 0 : aHelpOptions.SetHelpAgentAutoStartMode( bChecked );
370 : :
371 [ # # ][ # # ]: 0 : if ( aFileDlgCB.IsChecked() != aFileDlgCB.GetSavedValue() )
372 : : {
373 [ # # ]: 0 : SvtMiscOptions aMiscOpt;
374 [ # # ][ # # ]: 0 : aMiscOpt.SetUseSystemFileDialog( !aFileDlgCB.IsChecked() );
375 [ # # ]: 0 : bModified = sal_True;
376 : : }
377 : :
378 [ # # ][ # # ]: 0 : if ( aPrintDlgCB.IsChecked() != aPrintDlgCB.GetSavedValue() )
379 : : {
380 [ # # ]: 0 : SvtMiscOptions aMiscOpt;
381 [ # # ][ # # ]: 0 : aMiscOpt.SetUseSystemPrintDialog( !aPrintDlgCB.IsChecked() );
382 [ # # ]: 0 : bModified = sal_True;
383 : : }
384 : :
385 [ # # ][ # # ]: 0 : if ( aODMADlgCB.IsChecked() != aODMADlgCB.GetSavedValue() )
386 : : {
387 [ # # ]: 0 : SvtMiscOptions aMiscOpt;
388 [ # # ][ # # ]: 0 : aMiscOpt.SetTryODMADialog( aODMADlgCB.IsChecked() );
389 [ # # ]: 0 : bModified = sal_True;
390 : : }
391 : :
392 [ # # ][ # # ]: 0 : if ( aDocStatusCB.IsChecked() != aDocStatusCB.GetSavedValue() )
393 : : {
394 [ # # ]: 0 : SvtPrintWarningOptions aPrintOptions;
395 [ # # ][ # # ]: 0 : aPrintOptions.SetModifyDocumentOnPrintingAllowed( aDocStatusCB.IsChecked() );
396 [ # # ]: 0 : bModified = sal_True;
397 : : }
398 : :
399 [ # # ][ # # ]: 0 : if ( aSaveAlwaysCB.IsChecked() != aSaveAlwaysCB.GetSavedValue() )
400 : : {
401 [ # # ]: 0 : SvtMiscOptions aMiscOpt;
402 [ # # ][ # # ]: 0 : aMiscOpt.SetSaveAlwaysAllowed( aSaveAlwaysCB.IsChecked() );
403 [ # # ]: 0 : bModified = sal_True;
404 : : }
405 : :
406 [ # # ][ # # ]: 0 : if ( aExperimentalCB.IsChecked() != aExperimentalCB.GetSavedValue() )
407 : : {
408 [ # # ]: 0 : SvtMiscOptions aMiscOpt;
409 [ # # ][ # # ]: 0 : aMiscOpt.SetExperimentalMode( aExperimentalCB.IsChecked() );
410 [ # # ]: 0 : bModified = sal_True;
411 : : }
412 : :
413 [ # # ][ # # ]: 0 : if ( aMacroRecorderCB.IsChecked() != aMacroRecorderCB.GetSavedValue() )
414 : : {
415 [ # # ]: 0 : SvtMiscOptions aMiscOpt;
416 [ # # ][ # # ]: 0 : aMiscOpt.SetMacroRecorderMode( aMacroRecorderCB.IsChecked() );
417 [ # # ]: 0 : bModified = sal_True;
418 : : }
419 : :
420 : : const SfxUInt16Item* pUInt16Item =
421 [ # # ][ # # ]: 0 : PTR_CAST( SfxUInt16Item, GetOldItem( rSet, SID_ATTR_YEAR2000 ) );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
422 [ # # ][ # # ]: 0 : sal_uInt16 nNum = (sal_uInt16)aYearValueField.GetText().ToInt32();
[ # # ]
423 [ # # ][ # # ]: 0 : if ( pUInt16Item && pUInt16Item->GetValue() != nNum )
[ # # ]
424 : : {
425 : 0 : bModified = sal_True;
426 [ # # ][ # # ]: 0 : rSet.Put( SfxUInt16Item( SID_ATTR_YEAR2000, nNum ) );
[ # # ]
427 : : }
428 : :
429 [ # # ]: 0 : return bModified;
430 : : }
431 : :
432 : : // -----------------------------------------------------------------------
433 : :
434 : 0 : void OfaMiscTabPage::Reset( const SfxItemSet& rSet )
435 : : {
436 [ # # ]: 0 : SvtHelpOptions aHelpOptions;
437 [ # # ][ # # ]: 0 : aToolTipsCB.Check( aHelpOptions.IsHelpTips() );
438 [ # # ][ # # ]: 0 : aExtHelpCB.Check( aHelpOptions.IsHelpTips() && aHelpOptions.IsExtendedHelp() );
[ # # ][ # # ]
[ # # ]
439 [ # # ][ # # ]: 0 : aHelpAgentCB.Check( aHelpOptions.IsHelpAgentAutoStartMode() );
440 : :
441 : 0 : aToolTipsCB.SaveValue();
442 : 0 : aExtHelpCB.SaveValue();
443 : 0 : aHelpAgentCB.SaveValue();
444 [ # # ]: 0 : HelpCheckHdl_Impl( &aHelpAgentCB );
445 : :
446 [ # # ]: 0 : SvtMiscOptions aMiscOpt;
447 [ # # ][ # # ]: 0 : aFileDlgCB.Check( !aMiscOpt.UseSystemFileDialog() );
448 : 0 : aFileDlgCB.SaveValue();
449 [ # # ][ # # ]: 0 : aPrintDlgCB.Check( !aMiscOpt.UseSystemPrintDialog() );
450 : 0 : aPrintDlgCB.SaveValue();
451 [ # # ][ # # ]: 0 : aSaveAlwaysCB.Check( aMiscOpt.IsSaveAlwaysAllowed() );
452 : 0 : aSaveAlwaysCB.SaveValue();
453 [ # # ][ # # ]: 0 : aExperimentalCB.Check( aMiscOpt.IsExperimentalMode() );
454 : 0 : aExperimentalCB.SaveValue();
455 [ # # ][ # # ]: 0 : aMacroRecorderCB.Check( aMiscOpt.IsMacroRecorderMode() );
456 : 0 : aMacroRecorderCB.SaveValue();
457 : :
458 [ # # ][ # # ]: 0 : aODMADlgCB.Check( aMiscOpt.TryODMADialog() );
459 : 0 : aODMADlgCB.SaveValue();
460 : :
461 [ # # ]: 0 : SvtPrintWarningOptions aPrintOptions;
462 [ # # ][ # # ]: 0 : aDocStatusCB.Check(aPrintOptions.IsModifyDocumentOnPrintingAllowed());
463 : 0 : aDocStatusCB.SaveValue();
464 : :
465 : 0 : const SfxPoolItem* pItem = NULL;
466 [ # # ][ # # ]: 0 : if ( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_YEAR2000, sal_False, &pItem ) )
467 : : {
468 [ # # ]: 0 : aYearValueField.SetValue( ((SfxUInt16Item*)pItem)->GetValue() );
469 [ # # ]: 0 : TwoFigureConfigHdl( &aYearValueField );
470 : : }
471 : : else
472 : : {
473 [ # # ]: 0 : aYearValueField.Enable(sal_False);
474 [ # # ]: 0 : aTwoFigureFL.Enable(sal_False);
475 [ # # ]: 0 : aInterpretFT.Enable(sal_False);
476 [ # # ]: 0 : aToYearFT.Enable(sal_False);
477 [ # # ][ # # ]: 0 : }
[ # # ]
478 : 0 : }
479 : :
480 : : // -----------------------------------------------------------------------
481 : :
482 : 0 : IMPL_LINK( OfaMiscTabPage, TwoFigureHdl, NumericField*, pEd )
483 : : {
484 : : (void)pEd;
485 : :
486 [ # # ]: 0 : String aOutput( aStrDateInfo );
487 [ # # ]: 0 : String aStr( aYearValueField.GetText() );
488 [ # # ][ # # ]: 0 : String sSep( SvtSysLocale().GetLocaleData().getNumThousandSep() );
[ # # ][ # # ]
[ # # ]
489 : 0 : xub_StrLen nIndex = 0;
490 [ # # ][ # # ]: 0 : while ((nIndex = aStr.Search( sSep, nIndex)) != STRING_NOTFOUND)
491 [ # # ]: 0 : aStr.Erase( nIndex, sSep.Len());
492 [ # # ]: 0 : long nNum = aStr.ToInt32();
493 [ # # ][ # # ]: 0 : if ( aStr.Len() != 4 || nNum < aYearValueField.GetMin() || nNum > aYearValueField.GetMax() )
[ # # ][ # # ]
494 [ # # ]: 0 : aOutput.AppendAscii("????");
495 : : else
496 : : {
497 : 0 : nNum += 99;
498 [ # # ][ # # ]: 0 : aOutput += String::CreateFromInt32( nNum );
[ # # ]
499 : : }
500 [ # # ]: 0 : aToYearFT.SetText( aOutput );
501 [ # # ][ # # ]: 0 : return 0;
[ # # ]
502 : : }
503 : :
504 : : // -----------------------------------------------------------------------
505 : :
506 : 0 : IMPL_LINK( OfaMiscTabPage, TwoFigureConfigHdl, NumericField*, pEd )
507 : : {
508 [ # # ]: 0 : sal_Int64 nNum = aYearValueField.GetValue();
509 : 0 : rtl::OUString aOutput(rtl::OUString::valueOf(nNum));
510 [ # # ][ # # ]: 0 : aYearValueField.SetText(aOutput);
[ # # ]
511 [ # # ]: 0 : aYearValueField.SetSelection( Selection( 0, aOutput.getLength() ) );
512 [ # # ]: 0 : TwoFigureHdl( pEd );
513 : 0 : return 0;
514 : : }
515 : :
516 : : // -----------------------------------------------------------------------
517 : :
518 : 0 : IMPL_LINK_NOARG(OfaMiscTabPage, HelpCheckHdl_Impl)
519 : : {
520 : 0 : aExtHelpCB.Enable( aToolTipsCB.IsChecked() );
521 : 0 : aHelpAgentResetBtn.Enable( aHelpAgentCB.IsChecked() );
522 : 0 : return 0;
523 : : }
524 : :
525 : : // -----------------------------------------------------------------------
526 : :
527 : 0 : IMPL_LINK_NOARG(OfaMiscTabPage, HelpAgentResetHdl_Impl)
528 : : {
529 [ # # ]: 0 : SvtHelpOptions().resetAgentIgnoreURLCounter();
530 : 0 : return 0;
531 : : }
532 : :
533 : : // -----------------------------------------------------------------------
534 : :
535 : : // -------------------------------------------------------------------
536 : 0 : class CanvasSettings
537 : : {
538 : : public:
539 : : CanvasSettings();
540 : :
541 : : sal_Bool IsHardwareAccelerationEnabled() const;
542 : : sal_Bool IsHardwareAccelerationAvailable() const;
543 : : void EnabledHardwareAcceleration( sal_Bool _bEnabled ) const;
544 : :
545 : : private:
546 : : typedef std::vector< std::pair<OUString,Sequence<OUString> > > ServiceVector;
547 : :
548 : : Reference<XNameAccess> mxForceFlagNameAccess;
549 : : ServiceVector maAvailableImplementations;
550 : : mutable sal_Bool mbHWAccelAvailable;
551 : : mutable sal_Bool mbHWAccelChecked;
552 : : };
553 : :
554 : : // -------------------------------------------------------------------
555 : 0 : CanvasSettings::CanvasSettings() :
556 : : mxForceFlagNameAccess(),
557 : : mbHWAccelAvailable(sal_False),
558 [ # # ]: 0 : mbHWAccelChecked(sal_False)
559 : : {
560 : : try
561 : : {
562 : : Reference<XMultiServiceFactory> xConfigProvider(
563 : : com::sun::star::configuration::theDefaultProvider::get(
564 [ # # ][ # # ]: 0 : comphelper::getProcessComponentContext()));
565 : :
566 : : Any propValue(
567 : : makeAny( NamedValue(
568 : : OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")),
569 [ # # ][ # # ]: 0 : makeAny( OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Canvas")) ) ) ) );
[ # # ][ # # ]
570 : :
571 : : mxForceFlagNameAccess.set(
572 [ # # ]: 0 : xConfigProvider->createInstanceWithArguments(
573 : : OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationUpdateAccess")),
574 : 0 : Sequence<Any>( &propValue, 1 ) ),
575 [ # # ][ # # ]: 0 : UNO_QUERY_THROW );
[ # # ][ # # ]
[ # # ]
576 : :
577 : : propValue = makeAny(
578 : : NamedValue(
579 : : OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")),
580 [ # # ][ # # ]: 0 : makeAny( OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Canvas/CanvasServiceList")) ) ) );
[ # # ][ # # ]
581 : :
582 : : Reference<XNameAccess> xNameAccess(
583 [ # # ]: 0 : xConfigProvider->createInstanceWithArguments(
584 : : OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess")),
585 [ # # ][ # # ]: 0 : Sequence<Any>( &propValue, 1 ) ), UNO_QUERY_THROW );
[ # # ][ # # ]
[ # # ]
586 : : Reference<XHierarchicalNameAccess> xHierarchicalNameAccess(
587 [ # # ]: 0 : xNameAccess, UNO_QUERY_THROW);
588 : :
589 [ # # ][ # # ]: 0 : Sequence<OUString> serviceNames = xNameAccess->getElementNames();
590 : 0 : const OUString* pCurr = serviceNames.getConstArray();
591 : 0 : const OUString* const pEnd = pCurr + serviceNames.getLength();
592 [ # # ]: 0 : while( pCurr != pEnd )
593 : : {
594 : : Reference<XNameAccess> xEntryNameAccess(
595 [ # # ]: 0 : xHierarchicalNameAccess->getByHierarchicalName(*pCurr),
596 [ # # ][ # # ]: 0 : UNO_QUERY );
597 : :
598 [ # # ]: 0 : if( xEntryNameAccess.is() )
599 : : {
600 [ # # ]: 0 : Sequence<OUString> preferredImplementations;
601 [ # # ][ # # ]: 0 : if( (xEntryNameAccess->getByName( OUString(RTL_CONSTASCII_USTRINGPARAM("PreferredImplementations")) ) >>= preferredImplementations) )
[ # # ][ # # ]
[ # # ]
602 [ # # ][ # # ]: 0 : maAvailableImplementations.push_back( std::make_pair(*pCurr,preferredImplementations) );
[ # # ][ # # ]
603 : : }
604 : :
605 : 0 : ++pCurr;
606 [ # # ][ # # ]: 0 : }
607 : : }
608 [ # # ]: 0 : catch (const Exception&)
609 : : {
610 : : }
611 : 0 : }
612 : :
613 : : // -------------------------------------------------------------------
614 : 0 : sal_Bool CanvasSettings::IsHardwareAccelerationAvailable() const
615 : : {
616 [ # # ]: 0 : if( !mbHWAccelChecked )
617 : : {
618 : 0 : mbHWAccelChecked = true;
619 : :
620 [ # # ]: 0 : Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
621 : :
622 : : // check whether any of the service lists has an
623 : : // implementation that presents the "HardwareAcceleration" property
624 : 0 : ServiceVector::const_iterator aCurr=maAvailableImplementations.begin();
625 : 0 : const ServiceVector::const_iterator aEnd=maAvailableImplementations.end();
626 [ # # ][ # # ]: 0 : while( aCurr != aEnd )
627 : : {
628 : 0 : const OUString* pCurrImpl = aCurr->second.getConstArray();
629 : 0 : const OUString* const pEndImpl = pCurrImpl + aCurr->second.getLength();
630 : :
631 [ # # ]: 0 : while( pCurrImpl != pEndImpl )
632 : : {
633 : : try
634 : : {
635 [ # # ]: 0 : Reference<XPropertySet> xPropSet( xFactory->createInstance(
636 : 0 : pCurrImpl->trim() ),
637 [ # # ][ # # ]: 0 : UNO_QUERY_THROW );
638 : 0 : bool bHasAccel(false);
639 [ # # ][ # # ]: 0 : if( (xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("HardwareAcceleration"))) >>= bHasAccel) )
[ # # ][ # # ]
640 [ # # ]: 0 : if( bHasAccel )
641 : : {
642 : 0 : mbHWAccelAvailable = true;
643 : 0 : return mbHWAccelAvailable;
644 [ # # ][ # # ]: 0 : }
645 : : }
646 [ # # ]: 0 : catch (const Exception&)
647 : : {
648 : : }
649 : :
650 : 0 : ++pCurrImpl;
651 : : }
652 : :
653 : 0 : ++aCurr;
654 [ # # ]: 0 : }
655 : : }
656 : :
657 : 0 : return mbHWAccelAvailable;
658 : : }
659 : :
660 : : // -------------------------------------------------------------------
661 : 0 : sal_Bool CanvasSettings::IsHardwareAccelerationEnabled() const
662 : : {
663 : 0 : bool bForceLastEntry(false);
664 [ # # ]: 0 : if( !mxForceFlagNameAccess.is() )
665 : 0 : return true;
666 : :
667 [ # # ][ # # ]: 0 : if( !(mxForceFlagNameAccess->getByName( OUString(RTL_CONSTASCII_USTRINGPARAM("ForceSafeServiceImpl")) ) >>= bForceLastEntry) )
[ # # ][ # # ]
668 : 0 : return true;
669 : :
670 : 0 : return !bForceLastEntry;
671 : : }
672 : :
673 : : // -------------------------------------------------------------------
674 : 0 : void CanvasSettings::EnabledHardwareAcceleration( sal_Bool _bEnabled ) const
675 : : {
676 : : Reference< XNameReplace > xNameReplace(
677 [ # # ]: 0 : mxForceFlagNameAccess, UNO_QUERY );
678 : :
679 [ # # ]: 0 : if( !xNameReplace.is() )
680 : : return;
681 : :
682 [ # # ]: 0 : xNameReplace->replaceByName( OUString(RTL_CONSTASCII_USTRINGPARAM("ForceSafeServiceImpl")),
683 [ # # ][ # # ]: 0 : makeAny(!_bEnabled) );
[ # # ]
684 : :
685 : : Reference< XChangesBatch > xChangesBatch(
686 [ # # ]: 0 : mxForceFlagNameAccess, UNO_QUERY );
687 : :
688 [ # # ]: 0 : if( !xChangesBatch.is() )
689 : : return;
690 : :
691 [ # # ][ # # ]: 0 : xChangesBatch->commitChanges();
[ # # ][ # # ]
692 : : }
693 : :
694 : : // class OfaViewTabPage --------------------------------------------------
695 : :
696 : 0 : OfaViewTabPage::OfaViewTabPage(Window* pParent, const SfxItemSet& rSet ) :
697 : :
698 : 0 : SfxTabPage( pParent, CUI_RES( OFA_TP_VIEW ), rSet ),
699 : :
700 [ # # ]: 0 : aUserInterfaceFL ( this, CUI_RES( FL_USERINTERFACE ) ),
701 [ # # ]: 0 : aWindowSizeFT ( this, CUI_RES( FT_WINDOWSIZE ) ),
702 [ # # ]: 0 : aWindowSizeMF ( this, CUI_RES( MF_WINDOWSIZE ) ),
703 [ # # ]: 0 : aIconSizeStyleFT ( this, CUI_RES( FT_ICONSIZESTYLE ) ),
704 [ # # ]: 0 : aIconSizeLB ( this, CUI_RES( LB_ICONSIZE ) ),
705 [ # # ]: 0 : aIconStyleLB ( this, CUI_RES( LB_ICONSTYLE ) ),
706 [ # # ]: 0 : m_aSystemFont (this, CUI_RES( CB_SYSTEM_FONT ) ),
707 : : #if defined( UNX )
708 [ # # ]: 0 : aFontAntiAliasing ( this, CUI_RES( CB_FONTANTIALIASING )),
709 [ # # ]: 0 : aAAPointLimitLabel ( this, CUI_RES( FT_POINTLIMIT_LABEL )),
710 [ # # ]: 0 : aAAPointLimit ( this, CUI_RES( NF_AA_POINTLIMIT )),
711 [ # # ]: 0 : aAAPointLimitUnits ( this, CUI_RES( FT_POINTLIMIT_UNIT )),
712 : : #endif
713 [ # # ]: 0 : aMenuFL ( this, CUI_RES( FL_MENU ) ),
714 [ # # ]: 0 : aMenuIconsFT ( this, CUI_RES( FT_MENU_ICONS )),
715 [ # # ]: 0 : aMenuIconsLB ( this, CUI_RES( LB_MENU_ICONS )),
716 [ # # ]: 0 : aFontListsFL ( this, CUI_RES( FL_FONTLISTS) ),
717 [ # # ]: 0 : aFontShowCB ( this, CUI_RES( CB_FONT_SHOW ) ),
718 [ # # ]: 0 : aFontHistoryCB ( this, CUI_RES( CB_FONT_HISTORY ) ),
719 [ # # ]: 0 : aRenderingFL ( this, CUI_RES( FL_RENDERING ) ),
720 [ # # ]: 0 : aUseHardwareAccell ( this, CUI_RES( CB_USE_HARDACCELL ) ),
721 [ # # ]: 0 : aUseAntiAliase ( this, CUI_RES( CB_USE_ANTIALIASE ) ),
722 [ # # ]: 0 : aMouseFL ( this, CUI_RES( FL_MOUSE ) ),
723 [ # # ]: 0 : aMousePosFT ( this, CUI_RES( FT_MOUSEPOS ) ),
724 [ # # ]: 0 : aMousePosLB ( this, CUI_RES( LB_MOUSEPOS ) ),
725 [ # # ]: 0 : aMouseMiddleFT ( this, CUI_RES( FT_MOUSEMIDDLE ) ),
726 [ # # ]: 0 : aMouseMiddleLB ( this, CUI_RES( LB_MOUSEMIDDLE ) ),
727 : :
728 : : // #i97672#
729 [ # # ]: 0 : maSelectionFL(this, CUI_RES(FL_SELECTION)),
730 [ # # ]: 0 : maSelectionCB(this, CUI_RES(CB_SELECTION)),
731 [ # # ]: 0 : maSelectionMF(this, CUI_RES(MF_SELECTION)),
732 : :
733 : : nSizeLB_InitialSelection(0),
734 : : nStyleLB_InitialSelection(0),
735 [ # # ]: 0 : pAppearanceCfg(new SvtTabAppearanceCfg),
736 [ # # ]: 0 : pCanvasSettings(new CanvasSettings),
737 [ # # ][ # # ]: 0 : mpDrawinglayerOpt(new SvtOptionsDrawinglayer)
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
738 : : {
739 : : #if defined( UNX )
740 [ # # ]: 0 : aFontAntiAliasing.SetToggleHdl( LINK( this, OfaViewTabPage, OnAntialiasingToggled ) );
741 : :
742 : : // depending on the size of the text in aAAPointLimitLabel, we slightly re-arrange aAAPointLimit and aAAPointLimitUnits
743 : : //#110391# if the label has no mnemonic and we are in a CJK version the mnemonic "(X)" will be added which
744 : : // influences the width calculation
745 [ # # ]: 0 : MnemonicGenerator aMnemonicGenerator;
746 [ # # ]: 0 : String sLabel(aAAPointLimitLabel.GetText());
747 [ # # ]: 0 : aMnemonicGenerator.RegisterMnemonic( sLabel );
748 [ # # ]: 0 : aMnemonicGenerator.CreateMnemonic( sLabel );
749 [ # # ][ # # ]: 0 : sLabel = comphelper::string::remove(sLabel, '~');
750 : :
751 [ # # ]: 0 : sal_Int32 nLabelWidth = aAAPointLimitLabel.GetTextWidth( sLabel );
752 : 0 : nLabelWidth += 3; // small gap
753 : : // pixels to move both controls to the left
754 [ # # ]: 0 : Size aSize = aAAPointLimitLabel.GetSizePixel();
755 : 0 : sal_Int32 nMoveLeft = aSize.Width() - nLabelWidth;
756 : : // resize the first label
757 : 0 : aSize.Width() = nLabelWidth;
758 [ # # ]: 0 : aAAPointLimitLabel.SetSizePixel( aSize );
759 : :
760 : : // move the numeric field
761 [ # # ]: 0 : Point aPos( aAAPointLimit.GetPosPixel() );
762 : 0 : aPos.X() -= nMoveLeft;
763 [ # # ]: 0 : aAAPointLimit.SetPosPixel( aPos );
764 : :
765 : : // move (and resize) the units FixedText
766 [ # # ]: 0 : aPos = ( aAAPointLimitUnits.GetPosPixel() );
767 : 0 : aPos.X() -= nMoveLeft;
768 [ # # ]: 0 : aSize = aAAPointLimitUnits.GetSizePixel();
769 : 0 : aSize.Width() += nMoveLeft;
770 [ # # ]: 0 : aAAPointLimitUnits.SetPosSizePixel( aPos, aSize );
771 : : #else
772 : : // on this platform, we do not have the anti aliasing options - move the other checkboxes accordingly
773 : : // (in the resource, the coordinates are calculated for the AA options beeing present)
774 : : Control* pMiscOptions[] =
775 : : {
776 : : &aMenuFL, &aMenuIconsFT, &aMenuIconsLB,
777 : : &aFontListsFL, &aFontShowCB, &aFontHistoryCB
778 : : };
779 : :
780 : : // temporaryly create the checkbox for the anti aliasing (we need to to determine it's pos)
781 : : CheckBox* pFontAntiAliasing = new CheckBox( this, CUI_RES( CB_FONTANTIALIASING ) );
782 : : sal_Int32 nMoveUp = aMenuFL.GetPosPixel().Y() - pFontAntiAliasing->GetPosPixel().Y();
783 : : DELETEZ( pFontAntiAliasing );
784 : :
785 : : Point aPos;
786 : : for ( size_t i = 0; i < SAL_N_ELEMENTS( pMiscOptions ); ++i )
787 : : {
788 : : aPos = pMiscOptions[i]->GetPosPixel( );
789 : : aPos.Y() -= nMoveUp;
790 : : pMiscOptions[i]->SetPosPixel( aPos );
791 : : }
792 : :
793 : : #endif
794 : :
795 : : // #i97672#
796 [ # # ]: 0 : maSelectionCB.SetToggleHdl( LINK( this, OfaViewTabPage, OnSelectionToggled ) );
797 : :
798 [ # # ]: 0 : FreeResource();
799 : :
800 [ # # ][ # # ]: 0 : if( ! Application::ValidateSystemFont() )
801 : : {
802 [ # # ]: 0 : m_aSystemFont.Check( sal_False );
803 [ # # ]: 0 : m_aSystemFont.Enable( sal_False );
804 : : }
805 : :
806 [ # # ]: 0 : const StyleSettings& aStyleSettings = Application::GetSettings().GetStyleSettings();
807 : :
808 : : // remove non-installed icon themes
809 [ # # ][ # # ]: 0 : if( aIconStyleLB.GetEntryCount() == STYLE_SYMBOLS_THEMES_MAX )
810 : : {
811 : : // do not check 0th item == auto; it is not a real theme
812 : 0 : aIconStyleItemId[0] = 0;
813 : 0 : sal_uLong nItem = 1;
814 [ # # ]: 0 : for ( sal_uLong n=0; ++n < STYLE_SYMBOLS_THEMES_MAX; )
815 : : {
816 [ # # ][ # # ]: 0 : if ( aStyleSettings.CheckSymbolStyle( n ) )
817 : : {
818 : : // existing style => save the item id
819 : 0 : aIconStyleItemId[n] = nItem++;
820 : : }
821 : : else
822 : : {
823 : : // non-existing style => remove item;
824 [ # # ]: 0 : aIconStyleLB.RemoveEntry( nItem );
825 : 0 : aIconStyleItemId[n] = 0;
826 : : }
827 : : }
828 : : }
829 : :
830 : : // add real theme name to 'auto' theme, e.g. 'auto' => 'auto (classic)'
831 [ # # ][ # # ]: 0 : if( aIconStyleLB.GetEntryCount() > 1 )
832 : : {
833 [ # # ][ # # ]: 0 : ::rtl::OUString aAutoStr( aIconStyleLB.GetEntry( 0 ) );
[ # # ]
834 : :
835 [ # # ]: 0 : aAutoStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" (") );
836 : :
837 : : // prefer the icon style set by the desktop native widgets modules
838 : 0 : sal_uLong nAutoStyle = aStyleSettings.GetPreferredSymbolsStyle();
839 : : // fallback to the statically defined values
840 [ # # ][ # # ]: 0 : if ( nAutoStyle == STYLE_SYMBOLS_AUTO || !aIconStyleItemId[nAutoStyle] )
841 [ # # ]: 0 : nAutoStyle = aStyleSettings.GetAutoSymbolsStyle();
842 [ # # ]: 0 : if ( aIconStyleItemId[nAutoStyle] )
843 [ # # ][ # # ]: 0 : aAutoStr += aIconStyleLB.GetEntry( aIconStyleItemId[nAutoStyle] );
[ # # ]
844 : :
845 [ # # ]: 0 : aIconStyleLB.RemoveEntry( 0 );
846 [ # # ][ # # ]: 0 : aIconStyleLB.InsertEntry( aAutoStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")") ), 0 );
[ # # ][ # # ]
847 : : // separate auto and other icon themes
848 [ # # ]: 0 : aIconStyleLB.SetSeparatorPos( 0 );
849 [ # # ][ # # ]: 0 : }
850 : 0 : }
851 : :
852 [ # # ][ # # ]: 0 : OfaViewTabPage::~OfaViewTabPage()
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
853 : : {
854 [ # # ][ # # ]: 0 : delete mpDrawinglayerOpt;
855 [ # # ][ # # ]: 0 : delete pCanvasSettings;
856 [ # # ][ # # ]: 0 : delete pAppearanceCfg;
857 [ # # ]: 0 : }
858 : :
859 : : #if defined( UNX )
860 : 0 : IMPL_LINK( OfaViewTabPage, OnAntialiasingToggled, void*, NOTINTERESTEDIN )
861 : : {
862 : : (void)NOTINTERESTEDIN;
863 : :
864 : 0 : sal_Bool bAAEnabled = aFontAntiAliasing.IsChecked();
865 : :
866 : 0 : aAAPointLimitLabel.Enable( bAAEnabled );
867 : 0 : aAAPointLimit.Enable( bAAEnabled );
868 : 0 : aAAPointLimitUnits.Enable( bAAEnabled );
869 : :
870 : 0 : return 0L;
871 : : }
872 : : #endif
873 : :
874 : : // #i97672#
875 : 0 : IMPL_LINK( OfaViewTabPage, OnSelectionToggled, void*, NOTINTERESTEDIN )
876 : : {
877 : : (void)NOTINTERESTEDIN;
878 : 0 : const bool bSelectionEnabled(maSelectionCB.IsChecked());
879 : 0 : maSelectionMF.Enable(bSelectionEnabled);
880 : 0 : return 0;
881 : : }
882 : :
883 : 0 : SfxTabPage* OfaViewTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
884 : : {
885 [ # # ]: 0 : return new OfaViewTabPage(pParent, rAttrSet);
886 : : }
887 : :
888 : 0 : sal_Bool OfaViewTabPage::FillItemSet( SfxItemSet& )
889 : : {
890 [ # # ]: 0 : SvtFontOptions aFontOpt;
891 [ # # ]: 0 : SvtMenuOptions aMenuOpt;
892 [ # # ]: 0 : SvtStartOptions aStartOpt;
893 : :
894 : 0 : sal_Bool bModified = sal_False;
895 : 0 : sal_Bool bMenuOptModified = sal_False;
896 : 0 : bool bRepaintWindows(false);
897 : :
898 [ # # ]: 0 : SvtMiscOptions aMiscOptions;
899 [ # # ]: 0 : sal_uInt16 nSizeLB_NewSelection = aIconSizeLB.GetSelectEntryPos();
900 [ # # ]: 0 : if( nSizeLB_InitialSelection != nSizeLB_NewSelection )
901 : : {
902 : : // from now on it's modified, even if via auto setting the same size was set as now selected in the LB
903 : 0 : sal_Int16 eSet = SFX_SYMBOLS_SIZE_AUTO;
904 [ # # # # ]: 0 : switch( nSizeLB_NewSelection )
905 : : {
906 : 0 : case 0: eSet = SFX_SYMBOLS_SIZE_AUTO; break;
907 : 0 : case 1: eSet = SFX_SYMBOLS_SIZE_SMALL; break;
908 : 0 : case 2: eSet = SFX_SYMBOLS_SIZE_LARGE; break;
909 : : default:
910 : : OSL_FAIL( "OfaViewTabPage::FillItemSet(): This state of aIconSizeLB should not be possible!" );
911 : : }
912 [ # # ]: 0 : aMiscOptions.SetSymbolsSize( eSet );
913 : : }
914 : :
915 [ # # ]: 0 : sal_uInt16 nStyleLB_NewSelection = aIconStyleLB.GetSelectEntryPos();
916 [ # # ]: 0 : if( nStyleLB_InitialSelection != nStyleLB_NewSelection )
917 : : {
918 : : // find the style name in the aIconStyleItemId table
919 : : // items from the non-installed icon themes were removed
920 [ # # ]: 0 : for ( sal_uLong n=0; n < STYLE_SYMBOLS_THEMES_MAX; n++ )
921 : : {
922 [ # # ]: 0 : if ( aIconStyleItemId[n] == nStyleLB_NewSelection )
923 : : {
924 [ # # ]: 0 : aMiscOptions.SetSymbolsStyle( n );
925 : 0 : n = STYLE_SYMBOLS_THEMES_MAX;
926 : : }
927 : : }
928 : : }
929 : :
930 : 0 : sal_Bool bAppearanceChanged = sal_False;
931 : :
932 : :
933 : : // Screen Scaling
934 : 0 : sal_uInt16 nOldScale = pAppearanceCfg->GetScaleFactor();
935 [ # # ]: 0 : sal_uInt16 nNewScale = (sal_uInt16)aWindowSizeMF.GetValue();
936 : :
937 [ # # ]: 0 : if ( nNewScale != nOldScale )
938 : : {
939 [ # # ]: 0 : pAppearanceCfg->SetScaleFactor(nNewScale);
940 : 0 : bAppearanceChanged = sal_True;
941 : : }
942 : :
943 : : // Mouse Snap Mode
944 : 0 : short eOldSnap = pAppearanceCfg->GetSnapMode();
945 [ # # ]: 0 : short eNewSnap = aMousePosLB.GetSelectEntryPos();
946 [ # # ]: 0 : if(eNewSnap > 2)
947 : 0 : eNewSnap = 2;
948 : :
949 [ # # ]: 0 : if ( eNewSnap != eOldSnap )
950 : : {
951 [ # # ]: 0 : pAppearanceCfg->SetSnapMode(eNewSnap );
952 : 0 : bAppearanceChanged = sal_True;
953 : : }
954 : :
955 : : // Middle Mouse Button
956 : 0 : short eOldMiddleMouse = pAppearanceCfg->GetMiddleMouseButton();
957 [ # # ]: 0 : short eNewMiddleMouse = aMouseMiddleLB.GetSelectEntryPos();
958 [ # # ]: 0 : if(eNewMiddleMouse > 2)
959 : 0 : eNewMiddleMouse = 2;
960 : :
961 [ # # ]: 0 : if ( eNewMiddleMouse != eOldMiddleMouse )
962 : : {
963 [ # # ]: 0 : pAppearanceCfg->SetMiddleMouseButton( eNewMiddleMouse );
964 : 0 : bAppearanceChanged = sal_True;
965 : : }
966 : :
967 : : #if defined( UNX )
968 [ # # ][ # # ]: 0 : if ( aFontAntiAliasing.IsChecked() != aFontAntiAliasing.GetSavedValue() )
969 : : {
970 [ # # ][ # # ]: 0 : pAppearanceCfg->SetFontAntiAliasing( aFontAntiAliasing.IsChecked() );
971 : 0 : bAppearanceChanged = sal_True;
972 : : }
973 : :
974 [ # # ][ # # ]: 0 : if ( aAAPointLimit.GetValue() != aAAPointLimit.GetSavedValue().ToInt32() )
[ # # ]
975 : : {
976 [ # # ][ # # ]: 0 : pAppearanceCfg->SetFontAntialiasingMinPixelHeight( aAAPointLimit.GetValue() );
977 : 0 : bAppearanceChanged = sal_True;
978 : : }
979 : : #endif
980 : :
981 [ # # ][ # # ]: 0 : if ( aFontShowCB.IsChecked() != aFontShowCB.GetSavedValue() )
982 : : {
983 [ # # ][ # # ]: 0 : aFontOpt.EnableFontWYSIWYG( aFontShowCB.IsChecked() );
984 : 0 : bModified = sal_True;
985 : : }
986 : :
987 [ # # ][ # # ]: 0 : if(aMenuIconsLB.GetSelectEntryPos() != aMenuIconsLB.GetSavedValue())
988 : : {
989 [ # # ][ # # ]: 0 : aMenuOpt.SetMenuIconsState( aMenuIconsLB.GetSelectEntryPos() == 0 ? 2 : aMenuIconsLB.GetSelectEntryPos() - 1);
[ # # ][ # # ]
990 : 0 : bModified = sal_True;
991 : 0 : bMenuOptModified = sal_True;
992 : 0 : bAppearanceChanged = sal_True;
993 : : }
994 : :
995 [ # # ][ # # ]: 0 : if ( aFontHistoryCB.IsChecked() != aFontHistoryCB.GetSavedValue() )
996 : : {
997 [ # # ][ # # ]: 0 : aFontOpt.EnableFontHistory( aFontHistoryCB.IsChecked() );
998 : 0 : bModified = sal_True;
999 : : }
1000 : :
1001 : : // #i95644# if disabled, do not use value, see in ::Reset()
1002 [ # # ][ # # ]: 0 : if(aUseHardwareAccell.IsEnabled())
1003 : : {
1004 [ # # ][ # # ]: 0 : if(aUseHardwareAccell.IsChecked() != aUseHardwareAccell.GetSavedValue())
1005 : : {
1006 [ # # ][ # # ]: 0 : pCanvasSettings->EnabledHardwareAcceleration(aUseHardwareAccell.IsChecked());
1007 : 0 : bModified = sal_True;
1008 : : }
1009 : : }
1010 : :
1011 : : // #i95644# if disabled, do not use value, see in ::Reset()
1012 [ # # ][ # # ]: 0 : if(aUseAntiAliase.IsEnabled())
1013 : : {
1014 [ # # ][ # # ]: 0 : if(aUseAntiAliase.IsChecked() != mpDrawinglayerOpt->IsAntiAliasing())
[ # # ]
1015 : : {
1016 [ # # ][ # # ]: 0 : mpDrawinglayerOpt->SetAntiAliasing(aUseAntiAliase.IsChecked());
1017 : 0 : bModified = sal_True;
1018 : 0 : bRepaintWindows = true;
1019 : : }
1020 : : }
1021 : :
1022 : : // #i97672#
1023 [ # # ][ # # ]: 0 : if(maSelectionCB.IsEnabled())
1024 : : {
1025 [ # # ]: 0 : const bool bNewSelection(maSelectionCB.IsChecked());
1026 [ # # ]: 0 : const sal_uInt16 nNewTransparence((sal_uInt16)maSelectionMF.GetValue());
1027 : :
1028 [ # # ][ # # ]: 0 : if(bNewSelection != (bool)mpDrawinglayerOpt->IsTransparentSelection())
1029 : : {
1030 [ # # ][ # # ]: 0 : mpDrawinglayerOpt->SetTransparentSelection(maSelectionCB.IsChecked());
1031 : 0 : bModified = sal_True;
1032 : 0 : bRepaintWindows = true;
1033 : : }
1034 : :
1035 : : // #i104150# even read the value when maSelectionMF is disabled; it may have been
1036 : : // modified by enabling-modify-disabling by the user
1037 [ # # ][ # # ]: 0 : if(nNewTransparence != mpDrawinglayerOpt->GetTransparentSelectionPercent())
1038 : : {
1039 [ # # ]: 0 : mpDrawinglayerOpt->SetTransparentSelectionPercent(nNewTransparence);
1040 : 0 : bModified = sal_True;
1041 : 0 : bRepaintWindows = true;
1042 : : }
1043 : : }
1044 : :
1045 [ # # ]: 0 : SvtAccessibilityOptions aAccessibilityOptions;
1046 [ # # ][ # # ]: 0 : if( aAccessibilityOptions.GetIsSystemFont() != m_aSystemFont.IsChecked() &&
[ # # ][ # # ]
[ # # ]
1047 [ # # ]: 0 : m_aSystemFont.IsEnabled() )
1048 : : {
1049 [ # # ][ # # ]: 0 : aAccessibilityOptions.SetIsSystemFont( m_aSystemFont.IsChecked() );
1050 : 0 : bModified = sal_True;
1051 : 0 : bMenuOptModified = sal_True;
1052 : : }
1053 : :
1054 [ # # ]: 0 : if( bMenuOptModified )
1055 : : {
1056 : : // Set changed settings to the application instance
1057 [ # # ][ # # ]: 0 : AllSettings aAllSettings = Application::GetSettings();
1058 [ # # ]: 0 : StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
1059 [ # # ][ # # ]: 0 : if( m_aSystemFont.IsEnabled() )
1060 [ # # ][ # # ]: 0 : aStyleSettings.SetUseSystemUIFonts( m_aSystemFont.IsChecked() );
1061 [ # # ]: 0 : aAllSettings.SetStyleSettings(aStyleSettings);
1062 [ # # ]: 0 : Application::MergeSystemSettings( aAllSettings );
1063 [ # # ][ # # ]: 0 : Application::SetSettings(aAllSettings);
[ # # ]
1064 : : }
1065 : :
1066 [ # # ]: 0 : if ( bAppearanceChanged )
1067 : : {
1068 [ # # ]: 0 : pAppearanceCfg->Commit();
1069 [ # # ][ # # ]: 0 : pAppearanceCfg->SetApplicationDefaults ( GetpApp() );
1070 : : }
1071 : :
1072 [ # # ]: 0 : if(bRepaintWindows)
1073 : : {
1074 [ # # ]: 0 : Window* pAppWindow = Application::GetFirstTopLevelWindow();
1075 : :
1076 [ # # ]: 0 : while(pAppWindow)
1077 : : {
1078 [ # # ]: 0 : pAppWindow->Invalidate();
1079 [ # # ]: 0 : pAppWindow = Application::GetNextTopLevelWindow(pAppWindow);
1080 : : }
1081 : : }
1082 : :
1083 [ # # ][ # # ]: 0 : return bModified;
[ # # ][ # # ]
[ # # ]
1084 : : }
1085 : :
1086 : 0 : void OfaViewTabPage::Reset( const SfxItemSet& )
1087 : : {
1088 [ # # ]: 0 : SvtMiscOptions aMiscOptions;
1089 : :
1090 [ # # ][ # # ]: 0 : if( aMiscOptions.GetSymbolsSize() != SFX_SYMBOLS_SIZE_AUTO )
1091 [ # # ][ # # ]: 0 : nSizeLB_InitialSelection = ( aMiscOptions.AreCurrentSymbolsLarge() )? 2 : 1;
1092 [ # # ]: 0 : aIconSizeLB.SelectEntryPos( nSizeLB_InitialSelection );
1093 [ # # ]: 0 : aIconSizeLB.SaveValue();
1094 : :
1095 [ # # ][ # # ]: 0 : if( aMiscOptions.GetSymbolsStyle() != STYLE_SYMBOLS_AUTO )
1096 [ # # ]: 0 : nStyleLB_InitialSelection = aIconStyleItemId[aMiscOptions.GetCurrentSymbolsStyle()];
1097 : :
1098 [ # # ]: 0 : aIconStyleLB.SelectEntryPos( nStyleLB_InitialSelection );
1099 [ # # ]: 0 : aIconStyleLB.SaveValue();
1100 : :
1101 [ # # ][ # # ]: 0 : if( m_aSystemFont.IsEnabled() )
1102 : : {
1103 [ # # ]: 0 : SvtAccessibilityOptions aAccessibilityOptions;
1104 [ # # ][ # # ]: 0 : m_aSystemFont.Check( aAccessibilityOptions.GetIsSystemFont() );
[ # # ]
1105 : : }
1106 : :
1107 : : // Screen Scaling
1108 [ # # ]: 0 : aWindowSizeMF.SetValue ( pAppearanceCfg->GetScaleFactor() );
1109 : : // Mouse Snap
1110 [ # # ]: 0 : aMousePosLB.SelectEntryPos(pAppearanceCfg->GetSnapMode());
1111 [ # # ]: 0 : aMousePosLB.SaveValue();
1112 : :
1113 : : // Mouse Snap
1114 [ # # ]: 0 : aMouseMiddleLB.SelectEntryPos(pAppearanceCfg->GetMiddleMouseButton());
1115 [ # # ]: 0 : aMouseMiddleLB.SaveValue();
1116 : :
1117 : : #if defined( UNX )
1118 [ # # ]: 0 : aFontAntiAliasing.Check( pAppearanceCfg->IsFontAntiAliasing() );
1119 [ # # ]: 0 : aAAPointLimit.SetValue( pAppearanceCfg->GetFontAntialiasingMinPixelHeight() );
1120 : : #endif
1121 : :
1122 : : // WorkingSet
1123 [ # # ]: 0 : SvtFontOptions aFontOpt;
1124 [ # # ][ # # ]: 0 : aFontShowCB.Check( aFontOpt.IsFontWYSIWYGEnabled() );
1125 [ # # ]: 0 : SvtMenuOptions aMenuOpt;
1126 [ # # ][ # # ]: 0 : aMenuIconsLB.SelectEntryPos(aMenuOpt.GetMenuIconsState() == 2 ? 0 : aMenuOpt.GetMenuIconsState() + 1);
[ # # ][ # # ]
1127 [ # # ]: 0 : aMenuIconsLB.SaveValue();
1128 [ # # ][ # # ]: 0 : aFontHistoryCB.Check( aFontOpt.IsFontHistoryEnabled() );
1129 : :
1130 : : { // #i95644# HW accel (unified to disable mechanism)
1131 [ # # ][ # # ]: 0 : if(pCanvasSettings->IsHardwareAccelerationAvailable())
1132 : : {
1133 [ # # ][ # # ]: 0 : aUseHardwareAccell.Check(pCanvasSettings->IsHardwareAccelerationEnabled());
1134 : : }
1135 : : else
1136 : : {
1137 [ # # ]: 0 : aUseHardwareAccell.Check(false);
1138 [ # # ]: 0 : aUseHardwareAccell.Disable();
1139 : : }
1140 : :
1141 : 0 : aUseHardwareAccell.SaveValue();
1142 : : }
1143 : :
1144 : : { // #i95644# AntiAliasing
1145 [ # # ][ # # ]: 0 : if(mpDrawinglayerOpt->IsAAPossibleOnThisSystem())
1146 : : {
1147 [ # # ][ # # ]: 0 : aUseAntiAliase.Check(mpDrawinglayerOpt->IsAntiAliasing());
1148 : : }
1149 : : else
1150 : : {
1151 [ # # ]: 0 : aUseAntiAliase.Check(false);
1152 [ # # ]: 0 : aUseAntiAliase.Disable();
1153 : : }
1154 : :
1155 : 0 : aUseAntiAliase.SaveValue();
1156 : : }
1157 : :
1158 : : {
1159 : : // #i97672# Selection
1160 : : // check if transparent selection is possible on this system
1161 : : const bool bTransparentSelectionPossible(
1162 : 0 : !GetSettings().GetStyleSettings().GetHighContrastMode()
1163 [ # # ][ # # ]: 0 : && supportsOperation(OutDevSupport_TransparentRect));
[ # # ]
1164 : :
1165 : : // enter values
1166 [ # # ]: 0 : if(bTransparentSelectionPossible)
1167 : : {
1168 [ # # ][ # # ]: 0 : maSelectionCB.Check(mpDrawinglayerOpt->IsTransparentSelection());
1169 : : }
1170 : : else
1171 : : {
1172 [ # # ]: 0 : maSelectionCB.Enable(false);
1173 : : }
1174 : :
1175 [ # # ][ # # ]: 0 : maSelectionMF.SetValue(mpDrawinglayerOpt->GetTransparentSelectionPercent());
1176 [ # # ][ # # ]: 0 : maSelectionMF.Enable(mpDrawinglayerOpt->IsTransparentSelection() && bTransparentSelectionPossible);
[ # # ][ # # ]
1177 : : }
1178 : :
1179 : : #if defined( UNX )
1180 : 0 : aFontAntiAliasing.SaveValue();
1181 [ # # ]: 0 : aAAPointLimit.SaveValue();
1182 : : #endif
1183 : 0 : aFontShowCB.SaveValue();
1184 : 0 : aFontHistoryCB.SaveValue();
1185 : :
1186 : : #if defined( UNX )
1187 [ # # ][ # # ]: 0 : LINK( this, OfaViewTabPage, OnAntialiasingToggled ).Call( NULL );
[ # # ][ # # ]
[ # # ]
1188 : : #endif
1189 : 0 : }
1190 : :
1191 [ # # ][ # # ]: 0 : struct LanguageConfig_Impl
[ # # ][ # # ]
1192 : : {
1193 : : SvtLanguageOptions aLanguageOptions;
1194 : : SvtSysLocaleOptions aSysLocaleOptions;
1195 : : SvtLinguConfig aLinguConfig;
1196 : : };
1197 : :
1198 : : static sal_Bool bLanguageCurrentDoc_Impl = sal_False;
1199 : :
1200 : : // some things we'll need...
1201 : 3 : static const OUString sAccessSrvc(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess"));
1202 : 3 : static const OUString sAccessUpdSrvc(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationUpdateAccess"));
1203 : 3 : static const OUString sInstalledLocalesPath(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Setup/Office/InstalledLocales"));
1204 : 3 : static OUString sUserLocalePath(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Linguistic/General"));
1205 : : //static const OUString sUserLocalePath(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office/Linguistic"));
1206 : 3 : static const OUString sUserLocaleKey(RTL_CONSTASCII_USTRINGPARAM("UILocale"));
1207 : 3 : static Sequence< OUString > seqInstalledLanguages;
1208 : :
1209 : 0 : OfaLanguagesTabPage::OfaLanguagesTabPage( Window* pParent, const SfxItemSet& rSet ) :
1210 : 0 : SfxTabPage( pParent, CUI_RES( OFA_TP_LANGUAGES ), rSet ),
1211 [ # # ]: 0 : aUILanguageGB(this, CUI_RES(FL_UI_LANG )),
1212 [ # # ]: 0 : aLocaleSettingFI(this, CUI_RES(FI_LOCALESETTING)),
1213 [ # # ]: 0 : aUserInterfaceFT(this, CUI_RES(FT_USERINTERFACE)),
1214 [ # # ]: 0 : aUserInterfaceLB(this, CUI_RES(LB_USERINTERFACE)),
1215 [ # # ]: 0 : aLocaleSettingFT(this, CUI_RES(FT_LOCALESETTING)),
1216 [ # # ]: 0 : aLocaleSettingLB(this, CUI_RES(LB_LOCALESETTING)),
1217 [ # # ]: 0 : aCurrencyFI( this, CUI_RES(FI_CURRENCY )),
1218 [ # # ]: 0 : aDecimalSeparatorFT(this, CUI_RES(FT_DECIMALSEPARATOR)),
1219 [ # # ]: 0 : aDecimalSeparatorCB(this, CUI_RES(CB_DECIMALSEPARATOR)),
1220 [ # # ]: 0 : aCurrencyFT( this, CUI_RES(FT_CURRENCY )),
1221 [ # # ]: 0 : aCurrencyLB( this, CUI_RES(LB_CURRENCY )),
1222 [ # # ]: 0 : aLinguLanguageGB(this, CUI_RES(FL_LINGU_LANG )),
1223 [ # # ]: 0 : aWesternLanguageFI(this, CUI_RES(FI_WEST_LANG )),
1224 [ # # ]: 0 : aWesternLanguageFT(this, CUI_RES(FT_WEST_LANG )),
1225 [ # # ]: 0 : aWesternLanguageLB(this, CUI_RES(LB_WEST_LANG )),
1226 [ # # ]: 0 : aAsianLanguageFI(this, CUI_RES(FI_ASIAN_LANG )),
1227 [ # # ]: 0 : aAsianLanguageFT(this, CUI_RES(FT_ASIAN_LANG )),
1228 [ # # ]: 0 : aAsianLanguageLB(this, CUI_RES(LB_ASIAN_LANG )),
1229 [ # # ]: 0 : aComplexLanguageFI(this, CUI_RES(FI_COMPLEX_LANG )),
1230 [ # # ]: 0 : aComplexLanguageFT(this, CUI_RES(FT_COMPLEX_LANG )),
1231 [ # # ]: 0 : aComplexLanguageLB(this, CUI_RES(LB_COMPLEX_LANG )),
1232 [ # # ]: 0 : aCurrentDocCB(this, CUI_RES(CB_CURRENT_DOC )),
1233 [ # # ]: 0 : aEnhancedFL(this, CUI_RES(FL_ENHANCED )),
1234 [ # # ]: 0 : aAsianSupportFI(this, CUI_RES(FI_ASIANSUPPORT )),
1235 [ # # ]: 0 : aAsianSupportCB(this, CUI_RES(CB_ASIANSUPPORT )),
1236 [ # # ]: 0 : aCTLSupportFI(this, CUI_RES(FI_CTLSUPPORT )),
1237 [ # # ]: 0 : aCTLSupportCB(this, CUI_RES(CB_CTLSUPPORT )),
1238 : : sDecimalSeparatorLabel(aDecimalSeparatorCB.GetText()),
1239 [ # # ][ # # ]: 0 : pLangConfig(new LanguageConfig_Impl)
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1240 : : {
1241 [ # # ]: 0 : FreeResource();
1242 : :
1243 : : // initialize user interface language selection
1244 [ # # ][ # # ]: 0 : SvtLanguageTable* pLanguageTable = new SvtLanguageTable;
1245 [ # # ][ # # ]: 0 : const String aStr( pLanguageTable->GetString( LANGUAGE_SYSTEM ) );
1246 : :
1247 [ # # ]: 0 : String aUILang(aStr);
1248 [ # # ]: 0 : aUILang += rtl::OUString(" - ");
1249 [ # # ][ # # ]: 0 : aUILang += pLanguageTable->GetString( Application::GetSettings().GetUILanguage(), true );
[ # # ][ # # ]
1250 : :
1251 [ # # ]: 0 : aUserInterfaceLB.InsertEntry(aUILang);
1252 [ # # ]: 0 : aUserInterfaceLB.SetEntryData(0, 0);
1253 [ # # ]: 0 : aUserInterfaceLB.SelectEntryPos(0);
1254 : : try
1255 : : {
1256 : : Reference< XMultiServiceFactory > theConfigProvider(
1257 : : com::sun::star::configuration::theDefaultProvider::get(
1258 [ # # ][ # # ]: 0 : comphelper::getProcessComponentContext()));
1259 [ # # ]: 0 : Sequence< Any > theArgs(1);
1260 : 0 : Reference< XNameAccess > theNameAccess;
1261 : :
1262 : : // find out which locales are currently installed and add them to the listbox
1263 [ # # ][ # # ]: 0 : theArgs[0] = makeAny(NamedValue(OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), makeAny(sInstalledLocalesPath)));
[ # # ][ # # ]
1264 : : theNameAccess = Reference< XNameAccess > (
1265 [ # # ][ # # ]: 0 : theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs ), UNO_QUERY_THROW );
[ # # ][ # # ]
1266 [ # # ][ # # ]: 0 : seqInstalledLanguages = theNameAccess->getElementNames();
[ # # ][ # # ]
1267 : 0 : LanguageType aLang = LANGUAGE_DONTKNOW;
1268 [ # # ]: 0 : for (sal_IntPtr i=0; i<seqInstalledLanguages.getLength(); i++)
1269 : : {
1270 [ # # ][ # # ]: 0 : aLang = MsLangId::convertIsoStringToLanguage(seqInstalledLanguages[i]);
1271 [ # # ]: 0 : if (aLang != LANGUAGE_DONTKNOW)
1272 : : {
1273 : : //sal_uInt16 p = aUserInterfaceLB.InsertLanguage(aLang);
1274 [ # # ][ # # ]: 0 : String aLangStr( pLanguageTable->GetString( aLang, true ) );
1275 [ # # ]: 0 : sal_uInt16 p = aUserInterfaceLB.InsertEntry(aLangStr);
1276 [ # # ][ # # ]: 0 : aUserInterfaceLB.SetEntryData(p, (void*)(i+1));
1277 : : }
1278 : : }
1279 : :
1280 : : // find out whether the user has a specific locale specified
1281 [ # # ]: 0 : Sequence< Any > theArgs2(1);
1282 [ # # ][ # # ]: 0 : theArgs2[0] = makeAny(NamedValue(OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), makeAny(sUserLocalePath)));
[ # # ][ # # ]
1283 : : theNameAccess = Reference< XNameAccess > (
1284 [ # # ][ # # ]: 0 : theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs2 ), UNO_QUERY_THROW );
[ # # ][ # # ]
1285 [ # # ][ # # ]: 0 : if (theNameAccess->hasByName(sUserLocaleKey))
[ # # ]
1286 [ # # ][ # # ]: 0 : theNameAccess->getByName(sUserLocaleKey) >>= m_sUserLocaleValue;
1287 : : // select the user specified locale in the listbox
1288 [ # # ]: 0 : if (!m_sUserLocaleValue.isEmpty())
1289 : : {
1290 : 0 : sal_Int32 d = 0;
1291 [ # # ][ # # ]: 0 : for (sal_uInt16 i=0; i < aUserInterfaceLB.GetEntryCount(); i++)
1292 : : {
1293 [ # # ]: 0 : d = (sal_Int32)(sal_IntPtr)aUserInterfaceLB.GetEntryData(i);
1294 [ # # ][ # # ]: 0 : if ( d > 0 && seqInstalledLanguages.getLength() > d-1 && seqInstalledLanguages[d-1].equals(m_sUserLocaleValue))
[ # # ][ # # ]
[ # # ]
1295 [ # # ]: 0 : aUserInterfaceLB.SelectEntryPos(i);
1296 : : }
1297 [ # # ][ # # ]: 0 : }
1298 : :
1299 : : }
1300 [ # # # # ]: 0 : catch (const Exception &e)
1301 : : {
1302 : : // we'll just leave the box in it's default setting and won't
1303 : : // even give it event handler...
1304 [ # # ]: 0 : OString aMsg = OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US);
1305 : 0 : OSL_FAIL(aMsg.getStr());
1306 : : }
1307 : :
1308 [ # # ]: 0 : aWesternLanguageLB.SetLanguageList( LANG_LIST_WESTERN | LANG_LIST_ONLY_KNOWN, sal_True, sal_False, sal_True );
1309 [ # # ]: 0 : aWesternLanguageLB.InsertDefaultLanguage( ::com::sun::star::i18n::ScriptType::LATIN );
1310 [ # # ]: 0 : aAsianLanguageLB.SetLanguageList( LANG_LIST_CJK | LANG_LIST_ONLY_KNOWN, sal_True, sal_False, sal_True );
1311 [ # # ]: 0 : aAsianLanguageLB.InsertDefaultLanguage( ::com::sun::star::i18n::ScriptType::ASIAN );
1312 [ # # ]: 0 : aComplexLanguageLB.SetLanguageList( LANG_LIST_CTL | LANG_LIST_ONLY_KNOWN, sal_True, sal_False, sal_True );
1313 [ # # ]: 0 : aComplexLanguageLB.InsertDefaultLanguage( ::com::sun::star::i18n::ScriptType::COMPLEX );
1314 : :
1315 [ # # ]: 0 : aLocaleSettingLB.SetLanguageList( LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, sal_False, sal_False, sal_False);
1316 [ # # ]: 0 : aLocaleSettingLB.InsertSystemLanguage( );
1317 : :
1318 [ # # ]: 0 : const NfCurrencyTable& rCurrTab = SvNumberFormatter::GetTheCurrencyTable();
1319 [ # # ]: 0 : const NfCurrencyEntry& rCurr = SvNumberFormatter::GetCurrencyEntry( LANGUAGE_SYSTEM );
1320 : : // insert SYSTEM entry
1321 [ # # ]: 0 : String aDefaultCurr(aStr);
1322 [ # # ]: 0 : aDefaultCurr += rtl::OUString(" - ");
1323 [ # # ]: 0 : aDefaultCurr += rCurr.GetBankSymbol();
1324 [ # # ]: 0 : aCurrencyLB.InsertEntry( aDefaultCurr );
1325 : : // all currencies
1326 [ # # ]: 0 : String aTwoSpace( RTL_CONSTASCII_USTRINGPARAM( " " ) );
1327 : 0 : sal_uInt16 nCurrCount = rCurrTab.size();
1328 : : // first entry is SYSTEM, skip it
1329 [ # # ]: 0 : for ( sal_uInt16 j=1; j < nCurrCount; ++j )
1330 : : {
1331 [ # # ]: 0 : const NfCurrencyEntry* pCurr = &rCurrTab[j];
1332 [ # # ]: 0 : String aStr_( pCurr->GetBankSymbol() );
1333 [ # # ]: 0 : aStr_ += aTwoSpace;
1334 [ # # ]: 0 : aStr_ += pCurr->GetSymbol();
1335 [ # # ][ # # ]: 0 : aStr_ = ApplyLreOrRleEmbedding( aStr_ );
[ # # ]
1336 [ # # ]: 0 : aStr_ += aTwoSpace;
1337 [ # # ][ # # ]: 0 : aStr_ += ApplyLreOrRleEmbedding( pLanguageTable->GetString( pCurr->GetLanguage() ) );
[ # # ][ # # ]
[ # # ][ # # ]
1338 [ # # ]: 0 : sal_uInt16 nPos = aCurrencyLB.InsertEntry( aStr_ );
1339 [ # # ]: 0 : aCurrencyLB.SetEntryData( nPos, (void*) pCurr );
1340 [ # # ]: 0 : }
1341 [ # # ][ # # ]: 0 : delete pLanguageTable;
1342 : :
1343 [ # # ]: 0 : aLocaleSettingLB.SetSelectHdl( LINK( this, OfaLanguagesTabPage, LocaleSettingHdl ) );
1344 [ # # ]: 0 : Link aLink( LINK( this, OfaLanguagesTabPage, SupportHdl ) );
1345 : 0 : aAsianSupportCB.SetClickHdl( aLink );
1346 : 0 : aCTLSupportCB.SetClickHdl( aLink );
1347 : :
1348 [ # # ][ # # ]: 0 : aAsianSupportCB.Check( m_bOldAsian = pLangConfig->aLanguageOptions.IsAnyEnabled() );
1349 : 0 : aAsianSupportCB.SaveValue();
1350 [ # # ]: 0 : sal_Bool bReadonly = pLangConfig->aLanguageOptions.IsReadOnly(SvtLanguageOptions::E_ALLCJK);
1351 [ # # ]: 0 : aAsianSupportCB.Enable(!bReadonly);
1352 [ # # ]: 0 : aAsianSupportFI.Show(bReadonly);
1353 [ # # ]: 0 : SupportHdl( &aAsianSupportCB );
1354 : :
1355 [ # # ][ # # ]: 0 : aCTLSupportCB.Check( m_bOldCtl = pLangConfig->aLanguageOptions.IsCTLFontEnabled() );
1356 : 0 : aCTLSupportCB.SaveValue();
1357 [ # # ]: 0 : bReadonly = pLangConfig->aLanguageOptions.IsReadOnly(SvtLanguageOptions::E_CTLFONT);
1358 [ # # ]: 0 : aCTLSupportCB.Enable(!bReadonly);
1359 [ # # ]: 0 : aCTLSupportFI.Show(bReadonly);
1360 [ # # ][ # # ]: 0 : SupportHdl( &aCTLSupportCB );
[ # # ][ # # ]
[ # # ]
1361 : 0 : }
1362 : :
1363 [ # # ][ # # ]: 0 : OfaLanguagesTabPage::~OfaLanguagesTabPage()
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
1364 : : {
1365 [ # # ][ # # ]: 0 : delete pLangConfig;
1366 [ # # ]: 0 : }
1367 : :
1368 : 0 : SfxTabPage* OfaLanguagesTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
1369 : : {
1370 [ # # ]: 0 : return new OfaLanguagesTabPage(pParent, rAttrSet);
1371 : : }
1372 : :
1373 : 0 : LanguageType lcl_LangStringToLangType(const OUString& rLang)
1374 : : {
1375 : 0 : Locale aLocale;
1376 : 0 : sal_Int32 nSep = rLang.indexOf('-');
1377 [ # # ]: 0 : if (nSep < 0)
1378 : 0 : aLocale.Language = rLang;
1379 : : else
1380 : : {
1381 : 0 : aLocale.Language = rLang.copy(0, nSep);
1382 [ # # ]: 0 : if (nSep < rLang.getLength())
1383 : 0 : aLocale.Country = rLang.copy(nSep+1, rLang.getLength() - (nSep+1));
1384 : : }
1385 [ # # ]: 0 : LanguageType eLangType = SvxLocaleToLanguage( aLocale );
1386 : 0 : return eLangType;
1387 : : }
1388 : :
1389 : 0 : void lcl_UpdateAndDelete(SfxVoidItem* pInvalidItems[], SfxBoolItem* pBoolItems[], sal_uInt16 nCount)
1390 : : {
1391 : 0 : SfxViewFrame* pCurrentFrm = SfxViewFrame::Current();
1392 : 0 : SfxViewFrame* pViewFrm = SfxViewFrame::GetFirst();
1393 [ # # ]: 0 : while(pViewFrm)
1394 : : {
1395 : 0 : SfxBindings& rBind = pViewFrm->GetBindings();
1396 [ # # ]: 0 : for(sal_Int16 i = 0; i < nCount; i++)
1397 : : {
1398 [ # # ]: 0 : if(pCurrentFrm == pViewFrm)
1399 : 0 : rBind.InvalidateAll(sal_False);
1400 : 0 : rBind.SetState( *pInvalidItems[i] );
1401 : 0 : rBind.SetState( *pBoolItems[i] );
1402 : : }
1403 : 0 : pViewFrm = SfxViewFrame::GetNext(*pViewFrm);
1404 : : }
1405 [ # # ]: 0 : for(sal_Int16 i = 0; i < nCount; i++)
1406 : : {
1407 [ # # ]: 0 : delete pInvalidItems[i];
1408 [ # # ]: 0 : delete pBoolItems[i] ;
1409 : : }
1410 : 0 : }
1411 : :
1412 : 0 : sal_Bool OfaLanguagesTabPage::FillItemSet( SfxItemSet& rSet )
1413 : : {
1414 : : // lock configuration broadcasters so that we can coordinate the notifications
1415 [ # # ]: 0 : pLangConfig->aSysLocaleOptions.BlockBroadcasts( sal_True );
1416 [ # # ]: 0 : pLangConfig->aLanguageOptions.BlockBroadcasts( sal_True );
1417 [ # # ]: 0 : pLangConfig->aLinguConfig.BlockBroadcasts( sal_True );
1418 : :
1419 : : /*
1420 : : * Sequence checking only matters when CTL support is enabled.
1421 : : *
1422 : : * So we only need to check for sequence checking if
1423 : : * a) previously it was unchecked and is now checked or
1424 : : * b) it was already checked but the CTL language has changed
1425 : : */
1426 [ # # # # ]: 0 : if (
[ # # ][ # # ]
1427 [ # # ]: 0 : aCTLSupportCB.IsChecked() &&
1428 : 0 : (aCTLSupportCB.GetSavedValue() != STATE_CHECK ||
1429 [ # # ]: 0 : aComplexLanguageLB.GetSavedValue() != aComplexLanguageLB.GetSelectEntryPos())
1430 : : )
1431 : : {
1432 : : //sequence checking has to be switched on depending on the selected CTL language
1433 [ # # ]: 0 : LanguageType eCTLLang = aComplexLanguageLB.GetSelectLanguage();
1434 [ # # ]: 0 : sal_Bool bOn = MsLangId::needsSequenceChecking( eCTLLang);
1435 [ # # ]: 0 : pLangConfig->aLanguageOptions.SetCTLSequenceCheckingRestricted(bOn);
1436 [ # # ]: 0 : pLangConfig->aLanguageOptions.SetCTLSequenceChecking(bOn);
1437 [ # # ]: 0 : pLangConfig->aLanguageOptions.SetCTLSequenceCheckingTypeAndReplace(bOn);
1438 : : }
1439 : : try
1440 : : {
1441 : : // handle settings for UI Language
1442 : : // a change of setting needs to bring up a warning message
1443 : 0 : OUString aLangString;
1444 [ # # ][ # # ]: 0 : sal_Int32 d = (sal_Int32)(sal_IntPtr)aUserInterfaceLB.GetEntryData(aUserInterfaceLB.GetSelectEntryPos());
1445 [ # # ][ # # ]: 0 : if( d > 0 && seqInstalledLanguages.getLength() > d-1)
[ # # ]
1446 [ # # ]: 0 : aLangString = seqInstalledLanguages[d-1];
1447 : :
1448 : : /*
1449 : : if( aUserInterfaceLB.GetSelectEntryPos() > 0)
1450 : : aLangString = ConvertLanguageToIsoString(aUserInterfaceLB.GetSelectLanguage());
1451 : : */
1452 : : Reference< XMultiServiceFactory > theConfigProvider(
1453 : : com::sun::star::configuration::theDefaultProvider::get(
1454 [ # # ][ # # ]: 0 : comphelper::getProcessComponentContext()));
1455 [ # # ]: 0 : Sequence< Any > theArgs(1);
1456 [ # # ][ # # ]: 0 : theArgs[0] = makeAny(NamedValue(OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), makeAny(sUserLocalePath)));
[ # # ][ # # ]
1457 : : Reference< XPropertySet >xProp(
1458 [ # # ][ # # ]: 0 : theConfigProvider->createInstanceWithArguments(sAccessUpdSrvc, theArgs ), UNO_QUERY_THROW );
[ # # ]
1459 [ # # ]: 0 : if ( !m_sUserLocaleValue.equals(aLangString))
1460 : : {
1461 : : // OSL_FAIL("UserInterface language was changed, restart.");
1462 : : // write new value
1463 [ # # ][ # # ]: 0 : xProp->setPropertyValue(sUserLocaleKey, makeAny(aLangString));
[ # # ]
1464 [ # # ][ # # ]: 0 : Reference< XChangesBatch >(xProp, UNO_QUERY_THROW)->commitChanges();
[ # # ]
1465 : : // display info
1466 [ # # ][ # # ]: 0 : InfoBox aBox(this, CUI_RES(RID_SVX_MSGBOX_LANGUAGE_RESTART));
1467 [ # # ]: 0 : aBox.Execute();
1468 : :
1469 : : // tell quickstarter to stop being a veto listener
1470 : :
1471 : : Reference< XMultiServiceFactory > theMSF(
1472 [ # # ]: 0 : comphelper::getProcessServiceFactory());
1473 [ # # ]: 0 : Reference< XInitialization > xInit(theMSF->createInstance(
1474 [ # # ][ # # ]: 0 : OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.office.Quickstart"))), UNO_QUERY);
[ # # ]
1475 [ # # ]: 0 : if (xInit.is())
1476 : : {
1477 [ # # ]: 0 : Sequence< Any > args(3);
1478 [ # # ][ # # ]: 0 : args[0] = makeAny(sal_False); // will be ignored
1479 [ # # ][ # # ]: 0 : args[1] = makeAny(sal_False); // will be ignored
1480 [ # # ][ # # ]: 0 : args[2] = makeAny(sal_False); // disable veto
1481 [ # # ][ # # ]: 0 : xInit->initialize(args);
[ # # ]
1482 [ # # ]: 0 : }
1483 [ # # ]: 0 : }
1484 : : }
1485 [ # # # # ]: 0 : catch (const Exception& e)
1486 : : {
1487 : : // we'll just leave the box in it's default setting and won't
1488 : : // even give it event handler...
1489 [ # # ]: 0 : OString aMsg = OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US);
1490 : 0 : OSL_FAIL(aMsg.getStr());
1491 : : }
1492 : :
1493 [ # # ]: 0 : OUString sLang = pLangConfig->aSysLocaleOptions.GetLocaleConfigString();
1494 : 0 : LanguageType eOldLocale = (!sLang.isEmpty() ?
1495 [ # # ][ # # ]: 0 : lcl_LangStringToLangType( sLang ) : LANGUAGE_SYSTEM);
1496 [ # # ]: 0 : LanguageType eNewLocale = aLocaleSettingLB.GetSelectLanguage();
1497 [ # # ]: 0 : if ( eOldLocale != eNewLocale )
1498 : : {
1499 : : // an empty string denotes SYSTEM locale
1500 : 0 : OUString sNewLang;
1501 [ # # ]: 0 : if ( eNewLocale != LANGUAGE_SYSTEM )
1502 : : {
1503 : 0 : Locale aLocale;
1504 [ # # ]: 0 : SvxLanguageToLocale( aLocale, eNewLocale );
1505 : 0 : sNewLang = aLocale.Language;
1506 [ # # ]: 0 : if ( !aLocale.Country.isEmpty() )
1507 : : {
1508 : 0 : sNewLang += C2U("-");
1509 : 0 : sNewLang += aLocale.Country;
1510 : 0 : }
1511 : : }
1512 : :
1513 : : // locale nowadays get to AppSettings via notification
1514 : : // this will happen after releasing the lock on the ConfigurationBroadcaster at
1515 : : // the end of this method
1516 [ # # ]: 0 : pLangConfig->aSysLocaleOptions.SetLocaleConfigString( sNewLang );
1517 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( SID_OPT_LOCALE_CHANGED, sal_True ) );
[ # # ]
1518 : :
1519 [ # # ]: 0 : sal_uInt16 nNewType = SvtLanguageOptions::GetScriptTypeOfLanguage( eNewLocale );
1520 : 0 : bool bNewCJK = ( nNewType & SCRIPTTYPE_ASIAN ) != 0;
1521 [ # # ]: 0 : SvtCompatibilityOptions aCompatOpts;
1522 [ # # ][ # # ]: 0 : aCompatOpts.SetDefault( COMPATIBILITY_PROPERTYNAME_EXPANDWORDSPACE, !bNewCJK );
[ # # ]
1523 : : }
1524 : :
1525 [ # # ][ # # ]: 0 : if(aDecimalSeparatorCB.GetSavedValue() != aDecimalSeparatorCB.IsChecked())
1526 [ # # ][ # # ]: 0 : pLangConfig->aSysLocaleOptions.SetDecimalSeparatorAsLocale(aDecimalSeparatorCB.IsChecked());
1527 : :
1528 : : // Configured currency, for example, USD-en-US or EUR-de-DE, or empty for locale default.
1529 [ # # ]: 0 : OUString sOldCurr = pLangConfig->aSysLocaleOptions.GetCurrencyConfigString();
1530 [ # # ]: 0 : sal_uInt16 nCurrPos = aCurrencyLB.GetSelectEntryPos();
1531 : : const NfCurrencyEntry* pCurr = (const NfCurrencyEntry*)
1532 [ # # ]: 0 : aCurrencyLB.GetEntryData( nCurrPos );
1533 : 0 : OUString sNewCurr;
1534 [ # # ]: 0 : if ( pCurr )
1535 : : sNewCurr = SvtSysLocaleOptions::CreateCurrencyConfigString(
1536 [ # # ]: 0 : pCurr->GetBankSymbol(), pCurr->GetLanguage() );
1537 [ # # ]: 0 : if ( sOldCurr != sNewCurr )
1538 [ # # ]: 0 : pLangConfig->aSysLocaleOptions.SetCurrencyConfigString( sNewCurr );
1539 : :
1540 [ # # ]: 0 : SfxObjectShell* pCurrentDocShell = SfxObjectShell::Current();
1541 [ # # ][ # # ]: 0 : Reference< XPropertySet > xLinguProp( LinguMgr::GetLinguPropertySet(), UNO_QUERY );
1542 [ # # ]: 0 : sal_Bool bCurrentDocCBChecked = aCurrentDocCB.IsChecked();
1543 [ # # ][ # # ]: 0 : if(aCurrentDocCB.IsEnabled())
1544 : 0 : bLanguageCurrentDoc_Impl = bCurrentDocCBChecked;
1545 : 0 : sal_Bool bCurrentDocCBChanged = bCurrentDocCBChecked != aCurrentDocCB.GetSavedValue();
1546 : :
1547 [ # # ]: 0 : sal_Bool bValChanged = aWesternLanguageLB.GetSavedValue() != aWesternLanguageLB.GetSelectEntryPos();
1548 [ # # ][ # # ]: 0 : if( (bCurrentDocCBChanged && !bCurrentDocCBChecked) || bValChanged)
[ # # ]
1549 : : {
1550 [ # # ]: 0 : LanguageType eSelectLang = aWesternLanguageLB.GetSelectLanguage();
1551 [ # # ]: 0 : if(!bCurrentDocCBChecked)
1552 : : {
1553 : 0 : Any aValue;
1554 [ # # ]: 0 : Locale aLocale = MsLangId::convertLanguageToLocale( eSelectLang, false );
1555 [ # # ]: 0 : aValue <<= aLocale;
1556 : 0 : OUString aPropName( C2U("DefaultLocale") );
1557 [ # # ]: 0 : pLangConfig->aLinguConfig.SetProperty( aPropName, aValue );
1558 [ # # ]: 0 : if (xLinguProp.is())
1559 [ # # ][ # # ]: 0 : xLinguProp->setPropertyValue( aPropName, aValue );
1560 : : }
1561 [ # # ]: 0 : if(pCurrentDocShell)
1562 : : {
1563 [ # # ]: 0 : rSet.Put(SvxLanguageItem(MsLangId::resolveSystemLanguageByScriptType(eSelectLang, ::com::sun::star::i18n::ScriptType::LATIN),
1564 [ # # ][ # # ]: 0 : SID_ATTR_LANGUAGE));
[ # # ]
1565 : : }
1566 : : }
1567 [ # # ]: 0 : bValChanged = aAsianLanguageLB.GetSavedValue() != aAsianLanguageLB.GetSelectEntryPos();
1568 [ # # ][ # # ]: 0 : if( (bCurrentDocCBChanged && !bCurrentDocCBChecked) || bValChanged)
[ # # ]
1569 : : {
1570 [ # # ]: 0 : LanguageType eSelectLang = aAsianLanguageLB.GetSelectLanguage();
1571 [ # # ]: 0 : if(!bCurrentDocCBChecked)
1572 : : {
1573 : 0 : Any aValue;
1574 [ # # ]: 0 : Locale aLocale = MsLangId::convertLanguageToLocale( eSelectLang, false );
1575 [ # # ]: 0 : aValue <<= aLocale;
1576 : 0 : OUString aPropName( C2U("DefaultLocale_CJK") );
1577 [ # # ]: 0 : pLangConfig->aLinguConfig.SetProperty( aPropName, aValue );
1578 [ # # ]: 0 : if (xLinguProp.is())
1579 [ # # ][ # # ]: 0 : xLinguProp->setPropertyValue( aPropName, aValue );
1580 : : }
1581 [ # # ]: 0 : if(pCurrentDocShell)
1582 : : {
1583 [ # # ]: 0 : rSet.Put(SvxLanguageItem(MsLangId::resolveSystemLanguageByScriptType(eSelectLang, ::com::sun::star::i18n::ScriptType::ASIAN),
1584 [ # # ][ # # ]: 0 : SID_ATTR_CHAR_CJK_LANGUAGE));
[ # # ]
1585 : : }
1586 : : }
1587 [ # # ]: 0 : bValChanged = aComplexLanguageLB.GetSavedValue() != aComplexLanguageLB.GetSelectEntryPos();
1588 [ # # ][ # # ]: 0 : if( (bCurrentDocCBChanged && !bCurrentDocCBChecked) || bValChanged)
[ # # ]
1589 : : {
1590 [ # # ]: 0 : LanguageType eSelectLang = aComplexLanguageLB.GetSelectLanguage();
1591 [ # # ]: 0 : if(!bCurrentDocCBChecked)
1592 : : {
1593 : 0 : Any aValue;
1594 [ # # ]: 0 : Locale aLocale = MsLangId::convertLanguageToLocale( eSelectLang, false );
1595 [ # # ]: 0 : aValue <<= aLocale;
1596 : 0 : OUString aPropName( C2U("DefaultLocale_CTL") );
1597 [ # # ]: 0 : pLangConfig->aLinguConfig.SetProperty( aPropName, aValue );
1598 [ # # ]: 0 : if (xLinguProp.is())
1599 [ # # ][ # # ]: 0 : xLinguProp->setPropertyValue( aPropName, aValue );
1600 : : }
1601 [ # # ]: 0 : if(pCurrentDocShell)
1602 : : {
1603 [ # # ]: 0 : rSet.Put(SvxLanguageItem(MsLangId::resolveSystemLanguageByScriptType(eSelectLang, ::com::sun::star::i18n::ScriptType::COMPLEX),
1604 [ # # ][ # # ]: 0 : SID_ATTR_CHAR_CTL_LANGUAGE));
[ # # ]
1605 : : }
1606 : : }
1607 : :
1608 [ # # ][ # # ]: 0 : if(aAsianSupportCB.GetSavedValue() != aAsianSupportCB.IsChecked() )
1609 : : {
1610 [ # # ]: 0 : sal_Bool bChecked = aAsianSupportCB.IsChecked();
1611 [ # # ]: 0 : pLangConfig->aLanguageOptions.SetAll(bChecked);
1612 : :
1613 : : //iterate over all bindings to invalidate vertical text direction
1614 : 0 : const sal_uInt16 STATE_COUNT = 2;
1615 : :
1616 : : SfxBoolItem* pBoolItems[STATE_COUNT];
1617 [ # # ][ # # ]: 0 : pBoolItems[0] = new SfxBoolItem(SID_VERTICALTEXT_STATE, sal_False);
1618 [ # # ][ # # ]: 0 : pBoolItems[1] = new SfxBoolItem(SID_TEXT_FITTOSIZE_VERTICAL, sal_False);
1619 : :
1620 : : SfxVoidItem* pInvalidItems[STATE_COUNT];
1621 [ # # ][ # # ]: 0 : pInvalidItems[0] = new SfxVoidItem(SID_VERTICALTEXT_STATE);
1622 [ # # ][ # # ]: 0 : pInvalidItems[1] = new SfxVoidItem(SID_TEXT_FITTOSIZE_VERTICAL);
1623 : :
1624 [ # # ]: 0 : lcl_UpdateAndDelete(pInvalidItems, pBoolItems, STATE_COUNT);
1625 : : }
1626 : :
1627 [ # # ][ # # ]: 0 : if ( aCTLSupportCB.GetSavedValue() != aCTLSupportCB.IsChecked() )
1628 : : {
1629 [ # # ][ # # ]: 0 : pLangConfig->aLanguageOptions.SetCTLFontEnabled( aCTLSupportCB.IsChecked() );
1630 : :
1631 : 0 : const sal_uInt16 STATE_COUNT = 1;
1632 : : SfxBoolItem* pBoolItems[STATE_COUNT];
1633 [ # # ][ # # ]: 0 : pBoolItems[0] = new SfxBoolItem(SID_CTLFONT_STATE, sal_False);
1634 : : SfxVoidItem* pInvalidItems[STATE_COUNT];
1635 [ # # ][ # # ]: 0 : pInvalidItems[0] = new SfxVoidItem(SID_CTLFONT_STATE);
1636 [ # # ]: 0 : lcl_UpdateAndDelete(pInvalidItems, pBoolItems, STATE_COUNT);
1637 : : }
1638 : :
1639 [ # # ][ # # ]: 0 : if ( pLangConfig->aSysLocaleOptions.IsModified() )
1640 [ # # ]: 0 : pLangConfig->aSysLocaleOptions.Commit();
1641 : :
1642 : : // first release the lock on the ConfigurationBroadcaster for Locale changes
1643 : : // it seems that our code relies on the fact that before other changes like e.g. currency
1644 : : // are broadcasted locale changes have been done
1645 [ # # ]: 0 : pLangConfig->aSysLocaleOptions.BlockBroadcasts( sal_False );
1646 [ # # ]: 0 : pLangConfig->aLanguageOptions.BlockBroadcasts( sal_False );
1647 [ # # ]: 0 : pLangConfig->aLinguConfig.BlockBroadcasts( sal_False );
1648 : :
1649 : 0 : return sal_False;
1650 : : }
1651 : : //-----------------------------------------------------------------------------
1652 : 0 : void OfaLanguagesTabPage::Reset( const SfxItemSet& rSet )
1653 : : {
1654 [ # # ]: 0 : OUString sLang = pLangConfig->aSysLocaleOptions.GetLocaleConfigString();
1655 [ # # ]: 0 : if ( !sLang.isEmpty() )
1656 [ # # ][ # # ]: 0 : aLocaleSettingLB.SelectLanguage(lcl_LangStringToLangType(sLang));
1657 : : else
1658 [ # # ]: 0 : aLocaleSettingLB.SelectLanguage( LANGUAGE_USER_SYSTEM_CONFIG );
1659 [ # # ]: 0 : sal_Bool bReadonly = pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::E_LOCALE);
1660 [ # # ]: 0 : aLocaleSettingLB.Enable(!bReadonly);
1661 [ # # ]: 0 : aLocaleSettingFT.Enable(!bReadonly);
1662 [ # # ]: 0 : aLocaleSettingFI.Show(bReadonly);
1663 : :
1664 : : //
1665 [ # # ][ # # ]: 0 : aDecimalSeparatorCB.Check( pLangConfig->aSysLocaleOptions.IsDecimalSeparatorAsLocale());
1666 : 0 : aDecimalSeparatorCB.SaveValue();
1667 : :
1668 : : // let LocaleSettingHdl enable/disable checkboxes for CJK/CTL support
1669 : : // #i15812# must be done *before* the configured currency is set
1670 : : // and update the decimal separator used for the given locale
1671 [ # # ]: 0 : LocaleSettingHdl(&aLocaleSettingLB);
1672 : :
1673 : : // configured currency, for example, USD-en-US or EUR-de-DE, or empty for locale default
1674 [ # # ]: 0 : String aAbbrev;
1675 : : LanguageType eLang;
1676 : 0 : const NfCurrencyEntry* pCurr = NULL;
1677 [ # # ]: 0 : sLang = pLangConfig->aSysLocaleOptions.GetCurrencyConfigString();
1678 [ # # ]: 0 : if ( !sLang.isEmpty() )
1679 : : {
1680 [ # # ]: 0 : SvtSysLocaleOptions::GetCurrencyAbbrevAndLanguage( aAbbrev, eLang, sLang );
1681 [ # # ]: 0 : pCurr = SvNumberFormatter::GetCurrencyEntry( aAbbrev, eLang );
1682 : : }
1683 : : // if pCurr==NULL the SYSTEM entry is selected
1684 [ # # ]: 0 : sal_uInt16 nPos = aCurrencyLB.GetEntryPos( (void*) pCurr );
1685 [ # # ]: 0 : aCurrencyLB.SelectEntryPos( nPos );
1686 [ # # ]: 0 : bReadonly = pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::E_CURRENCY);
1687 [ # # ]: 0 : aCurrencyLB.Enable(!bReadonly);
1688 [ # # ]: 0 : aCurrencyFT.Enable(!bReadonly);
1689 [ # # ]: 0 : aCurrencyFI.Show(bReadonly);
1690 : :
1691 : : //western/CJK/CLK language
1692 : 0 : LanguageType eCurLang = LANGUAGE_NONE;
1693 : 0 : LanguageType eCurLangCJK = LANGUAGE_NONE;
1694 : 0 : LanguageType eCurLangCTL = LANGUAGE_NONE;
1695 [ # # ]: 0 : SfxObjectShell* pCurrentDocShell = SfxObjectShell::Current();
1696 : : //collect the configuration values first
1697 [ # # ]: 0 : aCurrentDocCB.Enable(sal_False);
1698 : : //
1699 : 0 : Any aWestLang;
1700 : 0 : Any aCJKLang;
1701 : 0 : Any aCTLLang;
1702 : : try
1703 : : {
1704 [ # # ]: 0 : aWestLang = pLangConfig->aLinguConfig.GetProperty(C2U("DefaultLocale"));
1705 : 0 : Locale aLocale;
1706 [ # # ]: 0 : aWestLang >>= aLocale;
1707 : :
1708 [ # # ]: 0 : eCurLang = MsLangId::convertLocaleToLanguage( aLocale );
1709 : :
1710 [ # # ]: 0 : aCJKLang = pLangConfig->aLinguConfig.GetProperty(C2U("DefaultLocale_CJK"));
1711 : 0 : aLocale = Locale();
1712 [ # # ]: 0 : aCJKLang >>= aLocale;
1713 [ # # ]: 0 : eCurLangCJK = MsLangId::convertLocaleToLanguage( aLocale );
1714 : :
1715 [ # # ]: 0 : aCTLLang = pLangConfig->aLinguConfig.GetProperty(C2U("DefaultLocale_CTL"));
1716 : 0 : aLocale = Locale();
1717 [ # # ]: 0 : aCTLLang >>= aLocale;
1718 [ # # ][ # # ]: 0 : eCurLangCTL = MsLangId::convertLocaleToLanguage( aLocale );
1719 : : }
1720 [ # # ]: 0 : catch (const Exception&)
1721 : : {
1722 : : }
1723 : : //overwrite them by the values provided by the DocShell
1724 [ # # ]: 0 : if(pCurrentDocShell)
1725 : : {
1726 [ # # ]: 0 : aCurrentDocCB.Enable(sal_True);
1727 [ # # ]: 0 : aCurrentDocCB.Check(bLanguageCurrentDoc_Impl);
1728 : : const SfxPoolItem* pLang;
1729 [ # # ][ # # ]: 0 : if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_LANGUAGE, sal_False, &pLang))
1730 : : {
1731 : 0 : LanguageType eTempCurLang = ((const SvxLanguageItem*)pLang)->GetValue();
1732 [ # # ][ # # ]: 0 : if (MsLangId::resolveSystemLanguageByScriptType(eCurLang, ::com::sun::star::i18n::ScriptType::LATIN) != eTempCurLang)
1733 : 0 : eCurLang = eTempCurLang;
1734 : : }
1735 : :
1736 [ # # ][ # # ]: 0 : if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_CHAR_CJK_LANGUAGE, sal_False, &pLang))
1737 : : {
1738 : 0 : LanguageType eTempCurLang = ((const SvxLanguageItem*)pLang)->GetValue();
1739 [ # # ][ # # ]: 0 : if (MsLangId::resolveSystemLanguageByScriptType(eCurLangCJK, ::com::sun::star::i18n::ScriptType::ASIAN) != eTempCurLang)
1740 : 0 : eCurLangCJK = eTempCurLang;
1741 : : }
1742 : :
1743 [ # # ][ # # ]: 0 : if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_CHAR_CTL_LANGUAGE, sal_False, &pLang))
1744 : : {
1745 : 0 : LanguageType eTempCurLang = ((const SvxLanguageItem*)pLang)->GetValue();
1746 [ # # ][ # # ]: 0 : if (MsLangId::resolveSystemLanguageByScriptType(eCurLangCTL, ::com::sun::star::i18n::ScriptType::COMPLEX) != eTempCurLang)
1747 : 0 : eCurLangCTL = eTempCurLang;
1748 : : }
1749 : : }
1750 [ # # ][ # # ]: 0 : if(LANGUAGE_NONE == eCurLang || LANGUAGE_DONTKNOW == eCurLang)
1751 [ # # ]: 0 : aWesternLanguageLB.SelectLanguage(LANGUAGE_NONE);
1752 : : else
1753 [ # # ]: 0 : aWesternLanguageLB.SelectLanguage(eCurLang);
1754 : :
1755 [ # # ][ # # ]: 0 : if(LANGUAGE_NONE == eCurLangCJK || LANGUAGE_DONTKNOW == eCurLangCJK)
1756 [ # # ]: 0 : aAsianLanguageLB.SelectLanguage(LANGUAGE_NONE);
1757 : : else
1758 [ # # ]: 0 : aAsianLanguageLB.SelectLanguage(eCurLangCJK);
1759 : :
1760 [ # # ][ # # ]: 0 : if(LANGUAGE_NONE == eCurLangCTL || LANGUAGE_DONTKNOW == eCurLangCTL)
1761 [ # # ]: 0 : aComplexLanguageLB.SelectLanguage(LANGUAGE_NONE);
1762 : : else
1763 [ # # ]: 0 : aComplexLanguageLB.SelectLanguage(eCurLangCTL);
1764 : :
1765 [ # # ]: 0 : aWesternLanguageLB.SaveValue();
1766 [ # # ]: 0 : aAsianLanguageLB.SaveValue();
1767 [ # # ]: 0 : aComplexLanguageLB.SaveValue();
1768 : 0 : aCurrentDocCB.SaveValue();
1769 : :
1770 [ # # ]: 0 : sal_Bool bEnable = !pLangConfig->aLinguConfig.IsReadOnly( C2U("DefaultLocale") );
1771 [ # # ]: 0 : aWesternLanguageFT.Enable( bEnable );
1772 [ # # ]: 0 : aWesternLanguageLB.Enable( bEnable );
1773 : :
1774 : :
1775 [ # # ]: 0 : aWesternLanguageFI.Show(!bEnable);
1776 : :
1777 : : // #i15812# controls for CJK/CTL already enabled/disabled from LocaleSettingHdl
1778 : : #if 0
1779 : : bEnable = ( !pLangConfig->aLinguConfig.IsReadOnly( C2U("DefaultLocale_CJK") ) && aAsianSupportCB.IsChecked() );
1780 : : aAsianLanguageFT.Enable( bEnable );
1781 : : aAsianLanguageLB.Enable( bEnable );
1782 : :
1783 : : bEnable = ( !pLangConfig->aLinguConfig.IsReadOnly( C2U("DefaultLocale_CTL") ) && aCTLSupportCB.IsChecked() );
1784 : : aComplexLanguageFT.Enable( bEnable );
1785 : : aComplexLanguageLB.Enable( bEnable );
1786 : : #endif
1787 : : // check the box "For the current document only"
1788 : : // set the focus to the Western Language box
1789 : 0 : const SfxPoolItem* pLang = 0;
1790 [ # # ][ # # ]: 0 : if ( SFX_ITEM_SET == rSet.GetItemState(SID_SET_DOCUMENT_LANGUAGE, sal_False, &pLang ) &&( (const SfxBoolItem*)pLang)->GetValue() == sal_True )
[ # # ][ # # ]
1791 : : {
1792 [ # # ]: 0 : aWesternLanguageLB.GrabFocus();
1793 [ # # ]: 0 : aCurrentDocCB.Enable(sal_True);
1794 [ # # ]: 0 : aCurrentDocCB.Check(sal_True);
1795 [ # # ]: 0 : }
1796 : 0 : }
1797 : :
1798 : 0 : IMPL_LINK( OfaLanguagesTabPage, SupportHdl, CheckBox*, pBox )
1799 : : {
1800 : : DBG_ASSERT( pBox, "OfaLanguagesTabPage::SupportHdl(): pBox invalid" );
1801 : :
1802 : 0 : sal_Bool bCheck = pBox->IsChecked();
1803 [ # # ]: 0 : if ( &aAsianSupportCB == pBox )
1804 : : {
1805 [ # # ]: 0 : sal_Bool bReadonly = pLangConfig->aLinguConfig.IsReadOnly( C2U("DefaultLocale_CJK"));
1806 [ # # ][ # # ]: 0 : bCheck = ( bCheck && !bReadonly );
1807 : 0 : aAsianLanguageFT.Enable( bCheck );
1808 : 0 : aAsianLanguageLB.Enable( bCheck );
1809 : 0 : aAsianLanguageFI.Show(bReadonly);
1810 [ # # ]: 0 : if( pBox->IsEnabled() )
1811 : 0 : m_bOldAsian = bCheck;
1812 : : }
1813 [ # # ]: 0 : else if ( &aCTLSupportCB == pBox )
1814 : : {
1815 [ # # ]: 0 : sal_Bool bReadonly = pLangConfig->aLinguConfig.IsReadOnly( C2U("DefaultLocale_CTL"));
1816 [ # # ][ # # ]: 0 : bCheck = ( bCheck && !bReadonly );
1817 : 0 : aComplexLanguageFT.Enable( bCheck );
1818 : 0 : aComplexLanguageLB.Enable( bCheck );
1819 : 0 : aComplexLanguageFI.Show(bReadonly);
1820 [ # # ]: 0 : if( pBox->IsEnabled() )
1821 : 0 : m_bOldCtl = bCheck;
1822 : : }
1823 : : else
1824 : : SAL_WARN( "cui.options", "OfaLanguagesTabPage::SupportHdl(): wrong pBox" );
1825 : :
1826 : 0 : return 0;
1827 : : }
1828 : :
1829 : : namespace
1830 : : {
1831 : 0 : void lcl_checkLanguageCheckBox(CheckBox& _rCB,sal_Bool _bNewValue,sal_Bool _bOldValue)
1832 : : {
1833 [ # # ]: 0 : if ( _bNewValue )
1834 : 0 : _rCB.Check(sal_True);
1835 : : else
1836 : 0 : _rCB.Check( _bOldValue );
1837 : : // #i15082# do not call SaveValue() in running dialog...
1838 : : // _rCB.SaveValue();
1839 : 0 : _rCB.Enable( !_bNewValue );
1840 : 0 : }
1841 : : }
1842 : :
1843 : 0 : IMPL_LINK( OfaLanguagesTabPage, LocaleSettingHdl, SvxLanguageBox*, pBox )
1844 : : {
1845 [ # # ]: 0 : LanguageType eLang = pBox->GetSelectLanguage();
1846 [ # # ]: 0 : sal_uInt16 nType = SvtLanguageOptions::GetScriptTypeOfLanguage(eLang);
1847 : : // first check if CTL must be enabled
1848 : : // #103299# - if CTL font setting is not readonly
1849 [ # # ][ # # ]: 0 : if(!pLangConfig->aLanguageOptions.IsReadOnly(SvtLanguageOptions::E_CTLFONT))
1850 : : {
1851 : 0 : bool bIsCTLFixed = (nType & SCRIPTTYPE_COMPLEX) != 0;
1852 [ # # ]: 0 : lcl_checkLanguageCheckBox(aCTLSupportCB, bIsCTLFixed, m_bOldCtl);
1853 [ # # ]: 0 : SupportHdl( &aCTLSupportCB );
1854 : : }
1855 : : // second check if CJK must be enabled
1856 : : // #103299# - if CJK support is not readonly
1857 [ # # ][ # # ]: 0 : if(!pLangConfig->aLanguageOptions.IsReadOnly(SvtLanguageOptions::E_ALLCJK))
1858 : : {
1859 : 0 : bool bIsCJKFixed = (nType & SCRIPTTYPE_ASIAN) != 0;
1860 [ # # ]: 0 : lcl_checkLanguageCheckBox(aAsianSupportCB, bIsCJKFixed, m_bOldAsian);
1861 [ # # ]: 0 : SupportHdl( &aAsianSupportCB );
1862 : : }
1863 : :
1864 : : sal_uInt16 nPos;
1865 [ # # ]: 0 : if ( eLang == LANGUAGE_USER_SYSTEM_CONFIG )
1866 [ # # ]: 0 : nPos = aCurrencyLB.GetEntryPos( (void*) NULL );
1867 : : else
1868 : : {
1869 [ # # ]: 0 : const NfCurrencyEntry* pCurr = &SvNumberFormatter::GetCurrencyEntry( eLang );
1870 [ # # ]: 0 : nPos = aCurrencyLB.GetEntryPos( (void*) pCurr );
1871 : : }
1872 [ # # ]: 0 : aCurrencyLB.SelectEntryPos( nPos );
1873 : :
1874 : : //update the decimal separator key of the related CheckBox
1875 : 0 : Locale aTempLocale;
1876 [ # # ]: 0 : SvxLanguageToLocale( aTempLocale, eLang );
1877 [ # # ][ # # ]: 0 : LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), aTempLocale );
1878 [ # # ]: 0 : String sTempLabel(sDecimalSeparatorLabel);
1879 [ # # ][ # # ]: 0 : sTempLabel.SearchAndReplaceAscii("%1", aLocaleWrapper.getNumDecimalSep() );
[ # # ][ # # ]
1880 [ # # ]: 0 : aDecimalSeparatorCB.SetText(sTempLabel);
1881 : :
1882 [ # # ][ # # ]: 0 : return 0;
1883 [ + - ][ + - ]: 9 : }
1884 : :
1885 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|