1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: optgdlg.cxx,v $
10 * $Revision: 1.53.20.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
33 #ifdef SVX_DLLIMPLEMENTATION
34 #undef SVX_DLLIMPLEMENTATION
36 #include <svtools/zforlist.hxx>
37 #include <goodies/grfmgr.hxx>
38 #include <svtools/flagitem.hxx>
39 #include <sfx2/dispatch.hxx>
40 #include <svtools/lingucfg.hxx>
41 #include <svtools/szitem.hxx>
42 #include <sfx2/viewsh.hxx>
43 #include <sfx2/viewfrm.hxx>
44 #include <sfx2/imgmgr.hxx>
45 #include <vcl/configsettings.hxx>
46 #include <vcl/msgbox.hxx>
47 #include <vcl/mnemonic.hxx>
48 #include <i18npool/mslangid.hxx>
49 #include <svtools/useroptions.hxx>
50 #include <svtools/cacheoptions.hxx>
51 #include <svtools/fontoptions.hxx>
52 #include <svtools/menuoptions.hxx>
53 #include <svtools/startoptions.hxx>
54 #include <svtools/languageoptions.hxx>
55 #include <svtools/miscopt.hxx>
56 #include <svtools/printwarningoptions.hxx>
57 #include <svtools/syslocaleoptions.hxx>
58 #include <svtools/helpopt.hxx>
59 #include <svtools/accessibilityoptions.hxx>
60 #include <unotools/configitem.hxx>
61 #include <sfx2/objsh.hxx>
62 #include <comphelper/types.hxx>
63 #include <svtools/ctloptions.hxx>
64 #include <svtools/langtab.hxx>
65 #include <unotools/localfilehelper.hxx>
66 #include <unotools/configmgr.hxx>
67 #include "cuioptgenrl.hxx"
68 #include "optpath.hxx"
69 #include "optsave.hxx"
70 #include <svx/optlingu.hxx>
71 #include <svx/xpool.hxx>
72 #include "dlgutil.hxx"
73 #ifndef _SVX_TAB_AREA_HXX
74 #include "cuitabarea.hxx"
76 #ifndef _SVX_DIALOGS_HRC
77 #include <svx/dialogs.hrc>
79 #include "unolingu.hxx"
80 #ifndef _SVX_SVXIDS_HRC
81 #include <svx/svxids.hrc>
83 #include <svx/langitem.hxx>
84 #ifndef _UNOTOOLS_PROCESSFACTORY_HXX
85 #include <comphelper/processfactory.hxx>
87 #include <rtl/ustrbuf.hxx>
90 #include <svx/dialmgr.hxx>
91 #include <svtools/helpopt.hxx>
92 #include <svtools/saveopt.hxx>
94 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
95 #include <com/sun/star/container/XNameAccess.hpp>
96 #include <com/sun/star/container/XNameReplace.hpp>
97 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
98 #include <com/sun/star/lang/XComponent.hpp>
99 #include <com/sun/star/lang/XInitialization.hpp>
100 #include <com/sun/star/beans/NamedValue.hpp>
101 #include <com/sun/star/beans/XPropertySet.hpp>
102 #include <com/sun/star/util/XChangesBatch.hpp>
103 #include <com/sun/star/uno/Any.hxx>
104 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
105 #include <com/sun/star/container/XSet.hpp>
107 #include <vcl/svapp.hxx>
109 #include "optgdlg.hrc"
110 #include "optgdlg.hxx"
111 #include "ofaitem.hxx"
112 #include <svtools/apearcfg.hxx>
113 #include <svtools/optionsdrawinglayer.hxx>
115 #define CONFIG_LANGUAGES "OfficeLanguages"
117 using namespace ::com::sun::star::uno
;
118 using namespace ::com::sun::star::lang
;
119 using namespace ::com::sun::star::beans
;
120 using namespace ::com::sun::star::container
;
121 using namespace ::com::sun::star::util
;
122 using namespace ::utl
;
123 using ::rtl::OString
;
124 using ::rtl::OUString
;
126 #define C2U(cChar) OUString::createFromAscii(cChar)
128 #define MAX_PROGRAM_ENTRIES 3
130 // class OfaMiscTabPage --------------------------------------------------
132 int OfaMiscTabPage::DeactivatePage( SfxItemSet
* pSet_
)
135 FillItemSet( *pSet_
);
141 ::rtl::OUString
impl_SystemFileOpenServiceName()
143 const ::rtl::OUString
&rDesktopEnvironment
=
144 Application::GetDesktopEnvironment();
146 if ( rDesktopEnvironment
.equalsIgnoreAsciiCaseAscii( "gnome" ) )
149 return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.GtkFilePicker" );
151 return rtl::OUString();
154 else if ( rDesktopEnvironment
.equalsIgnoreAsciiCaseAscii( "kde4" ) )
157 return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.KDE4FilePicker" );
159 return rtl::OUString();
162 else if ( rDesktopEnvironment
.equalsIgnoreAsciiCaseAscii( "kde" ) )
165 return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.KDEFilePicker" );
167 return rtl::OUString();
171 return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.SystemFilePicker" );
172 #elif (defined MACOSX && defined QUARTZ)
173 return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.AquaFilePicker" );
175 return rtl::OUString();
179 sal_Bool
lcl_HasSystemFilePicker()
181 Reference
< XMultiServiceFactory
> xFactory
= comphelper::getProcessServiceFactory();
182 sal_Bool bRet
= sal_False
;
184 Reference
< XContentEnumerationAccess
> xEnumAccess( xFactory
, UNO_QUERY
);
185 Reference
< XSet
> xSet( xFactory
, UNO_QUERY
);
187 if ( ! xEnumAccess
.is() || ! xSet
.is() )
192 ::rtl::OUString aFileService
= impl_SystemFileOpenServiceName();
193 Reference
< XEnumeration
> xEnum
= xEnumAccess
->createContentEnumeration( aFileService
);
194 if ( xEnum
.is() && xEnum
->hasMoreElements() )
198 catch( IllegalArgumentException
) {}
199 catch( ElementExistException
) {}
204 // -----------------------------------------------------------------------
206 OfaMiscTabPage::OfaMiscTabPage(Window
* pParent
, const SfxItemSet
& rSet
) :
208 SfxTabPage( pParent
, SVX_RES( OFA_TP_MISC
), rSet
),
210 aHelpFL ( this, SVX_RES( FL_HELP
) ),
211 aToolTipsCB ( this, SVX_RES( CB_TOOLTIP
) ),
212 aExtHelpCB ( this, SVX_RES( CB_EXTHELP
) ),
213 aHelpAgentCB ( this, SVX_RES( CB_HELPAGENT
) ),
214 aHelpAgentResetBtn ( this, SVX_RES( PB_HELPAGENT_RESET
) ),
215 aHelpFormatFT ( this, SVX_RES( FT_HELPFORMAT
) ),
216 aHelpFormatLB ( this, SVX_RES( LB_HELPFORMAT
) ),
217 aFileDlgFL ( this, SVX_RES( FL_FILEDLG
) ),
218 aFileDlgROImage ( this, SVX_RES( FI_FILEDLG_RO
) ),
219 aFileDlgCB ( this, SVX_RES( CB_FILEDLG
) ),
220 aODMADlgCB ( this, SVX_RES( CB_ODMADLG
) ),
221 aPrintDlgFL ( this, SVX_RES( FL_PRINTDLG
) ),
222 aPrintDlgCB ( this, SVX_RES( CB_PRINTDLG
) ),
223 aDocStatusFL ( this, SVX_RES( FL_DOCSTATUS
) ),
224 aDocStatusCB ( this, SVX_RES( CB_DOCSTATUS
) ),
225 aTwoFigureFL ( this, SVX_RES( FL_TWOFIGURE
) ),
226 aInterpretFT ( this, SVX_RES( FT_INTERPRET
) ),
227 aYearValueField ( this, SVX_RES( NF_YEARVALUE
) ),
228 aToYearFT ( this, SVX_RES( FT_TOYEAR
) )
233 if (!lcl_HasSystemFilePicker())
239 #if ! defined(QUARTZ)
245 aFileDlgCB
.SetToggleHdl( LINK( this, OfaMiscTabPage
, OnFileDlgToggled
) );
249 // rearrange the following controls
250 Point aNewPos
= aDocStatusFL
.GetPosPixel();
251 long nDelta
= aNewPos
.Y() - aODMADlgCB
.GetPosPixel().Y();
255 &aDocStatusFL
, &aDocStatusCB
, &aTwoFigureFL
,
256 &aInterpretFT
, &aYearValueField
, &aToYearFT
258 Window
** pCurrent
= pWins
;
259 const sal_Int32 nCount
= sizeof( pWins
) / sizeof( pWins
[ 0 ] );
260 for ( sal_Int32 i
= 0; i
< nCount
; ++i
, ++pCurrent
)
262 aNewPos
= (*pCurrent
)->GetPosPixel();
263 aNewPos
.Y() -= nDelta
;
264 (*pCurrent
)->SetPosPixel( aNewPos
);
269 if ( !aFileDlgCB
.IsVisible() )
271 // rearrange the following controls
272 Point aNewPos
= aDocStatusFL
.GetPosPixel();
273 long nDelta
= aNewPos
.Y() - aFileDlgFL
.GetPosPixel().Y();
277 &aPrintDlgFL
, &aPrintDlgCB
, &aDocStatusFL
, &aDocStatusCB
, &aTwoFigureFL
,
278 &aInterpretFT
, &aYearValueField
, &aToYearFT
280 Window
** pCurrent
= pWins
;
281 const sal_Int32 nCount
= sizeof( pWins
) / sizeof( pWins
[ 0 ] );
282 for ( sal_Int32 i
= 0; i
< nCount
; ++i
, ++pCurrent
)
284 aNewPos
= (*pCurrent
)->GetPosPixel();
285 aNewPos
.Y() -= nDelta
;
286 (*pCurrent
)->SetPosPixel( aNewPos
);
289 else if ( SvtMiscOptions().IsUseSystemFileDialogReadOnly() )
291 aFileDlgROImage
.Show();
292 aFileDlgCB
.Disable();
295 if ( aPrintDlgCB
.IsVisible() )
297 // rearrange the following controls
298 Point aNewPos
= aDocStatusFL
.GetPosPixel();
299 long nDelta
= aNewPos
.Y() - aFileDlgFL
.GetPosPixel().Y();
303 &aDocStatusFL
, &aDocStatusCB
, &aTwoFigureFL
,
304 &aInterpretFT
, &aYearValueField
, &aToYearFT
306 Window
** pCurrent
= pWins
;
307 const sal_Int32 nCount
= sizeof( pWins
) / sizeof( pWins
[ 0 ] );
308 for ( sal_Int32 i
= 0; i
< nCount
; ++i
, ++pCurrent
)
310 aNewPos
= (*pCurrent
)->GetPosPixel();
311 aNewPos
.Y() += nDelta
;
312 (*pCurrent
)->SetPosPixel( aNewPos
);
316 // at least the button is as wide as its text
317 long nTxtWidth
= aHelpAgentResetBtn
.GetTextWidth( aHelpAgentResetBtn
.GetText() );
318 Size aBtnSz
= aHelpAgentResetBtn
.GetSizePixel();
319 if ( aBtnSz
.Width() < nTxtWidth
)
321 aBtnSz
.Width() = nTxtWidth
;
322 aHelpAgentResetBtn
.SetSizePixel( aBtnSz
);
325 aStrDateInfo
= aToYearFT
.GetText();
326 aYearValueField
.SetModifyHdl( LINK( this, OfaMiscTabPage
, TwoFigureHdl
) );
327 Link aLink
= LINK( this, OfaMiscTabPage
, TwoFigureConfigHdl
);
328 aYearValueField
.SetDownHdl( aLink
);
329 aYearValueField
.SetUpHdl( aLink
);
330 aYearValueField
.SetLoseFocusHdl( aLink
);
331 aYearValueField
.SetFirstHdl( aLink
);
332 TwoFigureConfigHdl( &aYearValueField
);
334 SetExchangeSupport();
336 aLink
= LINK( this, OfaMiscTabPage
, HelpCheckHdl_Impl
);
337 aToolTipsCB
.SetClickHdl( aLink
);
338 aHelpAgentCB
.SetClickHdl( aLink
);
339 aHelpAgentResetBtn
.SetClickHdl( LINK( this, OfaMiscTabPage
, HelpAgentResetHdl_Impl
) );
341 //fill default names as user data
342 static const char* aHelpFormatNames
[] =
351 for ( USHORT i
= 0; i
< aHelpFormatLB
.GetEntryCount(); i
++ )
353 String
* pData
= new String( String::CreateFromAscii( aHelpFormatNames
[i
] ) );
354 aHelpFormatLB
.SetEntryData( i
, pData
);
359 IMPL_LINK( OfaMiscTabPage
, OnFileDlgToggled
, CheckBox
*, EMPTYARG
)
361 aODMADlgCB
.Enable( !aFileDlgCB
.IsChecked() );
366 // -----------------------------------------------------------------------
368 OfaMiscTabPage::~OfaMiscTabPage()
370 for(USHORT i
= 0; i
< aHelpFormatLB
.GetEntryCount(); i
++)
372 delete static_cast< String
* >( aHelpFormatLB
.GetEntryData(i
) );
376 // -----------------------------------------------------------------------
378 SfxTabPage
* OfaMiscTabPage::Create( Window
* pParent
, const SfxItemSet
& rAttrSet
)
380 return new OfaMiscTabPage( pParent
, rAttrSet
);
383 // -----------------------------------------------------------------------
385 BOOL
OfaMiscTabPage::FillItemSet( SfxItemSet
& rSet
)
387 BOOL bModified
= FALSE
;
389 SvtHelpOptions aHelpOptions
;
390 BOOL bChecked
= aToolTipsCB
.IsChecked();
391 if ( bChecked
!= aToolTipsCB
.GetSavedValue() )
392 aHelpOptions
.SetHelpTips( bChecked
);
393 bChecked
= ( aExtHelpCB
.IsChecked() && aToolTipsCB
.IsChecked() );
394 if ( bChecked
!= aExtHelpCB
.GetSavedValue() )
395 aHelpOptions
.SetExtendedHelp( bChecked
);
396 bChecked
= aHelpAgentCB
.IsChecked();
397 if ( bChecked
!= aHelpAgentCB
.GetSavedValue() )
398 aHelpOptions
.SetHelpAgentAutoStartMode( bChecked
);
399 USHORT nHelpFormatPos
= aHelpFormatLB
.GetSelectEntryPos();
400 if ( nHelpFormatPos
!= LISTBOX_ENTRY_NOTFOUND
&&
401 nHelpFormatPos
!= aHelpFormatLB
.GetSavedValue() )
403 aHelpOptions
.SetHelpStyleSheet( *static_cast< String
* >( aHelpFormatLB
.GetEntryData( nHelpFormatPos
) ) );
406 if ( aFileDlgCB
.IsChecked() != aFileDlgCB
.GetSavedValue() )
408 SvtMiscOptions aMiscOpt
;
409 aMiscOpt
.SetUseSystemFileDialog( !aFileDlgCB
.IsChecked() );
413 if ( aPrintDlgCB
.IsChecked() != aPrintDlgCB
.GetSavedValue() )
415 SvtMiscOptions aMiscOpt
;
416 aMiscOpt
.SetUseSystemPrintDialog( !aPrintDlgCB
.IsChecked() );
420 if ( aODMADlgCB
.IsChecked() != aODMADlgCB
.GetSavedValue() )
422 SvtMiscOptions aMiscOpt
;
423 aMiscOpt
.SetTryODMADialog( aODMADlgCB
.IsChecked() );
427 if ( aDocStatusCB
.IsChecked() != aDocStatusCB
.GetSavedValue() )
429 SvtPrintWarningOptions aPrintOptions
;
430 aPrintOptions
.SetModifyDocumentOnPrintingAllowed( aDocStatusCB
.IsChecked() );
434 const SfxUInt16Item
* pUInt16Item
=
435 PTR_CAST( SfxUInt16Item
, GetOldItem( rSet
, SID_ATTR_YEAR2000
) );
436 USHORT nNum
= (USHORT
)aYearValueField
.GetText().ToInt32();
437 if ( pUInt16Item
&& pUInt16Item
->GetValue() != nNum
)
440 rSet
.Put( SfxUInt16Item( SID_ATTR_YEAR2000
, nNum
) );
446 // -----------------------------------------------------------------------
448 void OfaMiscTabPage::Reset( const SfxItemSet
& rSet
)
450 SvtHelpOptions aHelpOptions
;
451 aToolTipsCB
.Check( aHelpOptions
.IsHelpTips() );
452 aExtHelpCB
.Check( aHelpOptions
.IsHelpTips() && aHelpOptions
.IsExtendedHelp() );
453 aHelpAgentCB
.Check( aHelpOptions
.IsHelpAgentAutoStartMode() );
454 String sStyleSheet
= aHelpOptions
.GetHelpStyleSheet();
455 for ( USHORT i
= 0; i
< aHelpFormatLB
.GetEntryCount(); ++i
)
457 if ( *static_cast< String
* >( aHelpFormatLB
.GetEntryData(i
) ) == sStyleSheet
)
459 aHelpFormatLB
.SelectEntryPos(i
);
464 aToolTipsCB
.SaveValue();
465 aExtHelpCB
.SaveValue();
466 aHelpAgentCB
.SaveValue();
467 aHelpFormatLB
.SaveValue();
468 HelpCheckHdl_Impl( &aHelpAgentCB
);
470 SvtMiscOptions aMiscOpt
;
471 aFileDlgCB
.Check( !aMiscOpt
.UseSystemFileDialog() );
472 aFileDlgCB
.SaveValue();
473 aPrintDlgCB
.Check( !aMiscOpt
.UseSystemPrintDialog() );
474 aPrintDlgCB
.SaveValue();
476 aODMADlgCB
.Check( aMiscOpt
.TryODMADialog() );
477 aODMADlgCB
.SaveValue();
479 SvtPrintWarningOptions aPrintOptions
;
480 aDocStatusCB
.Check(aPrintOptions
.IsModifyDocumentOnPrintingAllowed());
481 aDocStatusCB
.SaveValue();
483 const SfxPoolItem
* pItem
= NULL
;
484 if ( SFX_ITEM_SET
== rSet
.GetItemState( SID_ATTR_YEAR2000
, FALSE
, &pItem
) )
486 aYearValueField
.SetValue( ((SfxUInt16Item
*)pItem
)->GetValue() );
487 TwoFigureConfigHdl( &aYearValueField
);
491 aYearValueField
.Enable(FALSE
);
492 aTwoFigureFL
.Enable(FALSE
);
493 aInterpretFT
.Enable(FALSE
);
494 aToYearFT
.Enable(FALSE
);
498 // -----------------------------------------------------------------------
500 IMPL_LINK( OfaMiscTabPage
, TwoFigureHdl
, NumericField
*, pEd
)
504 String
aOutput( aStrDateInfo
);
505 String
aStr( aYearValueField
.GetText() );
506 String
sSep( SvtSysLocale().GetLocaleData().getNumThousandSep() );
507 xub_StrLen nIndex
= 0;
508 while ((nIndex
= aStr
.Search( sSep
, nIndex
)) != STRING_NOTFOUND
)
509 aStr
.Erase( nIndex
, sSep
.Len());
510 long nNum
= aStr
.ToInt32();
511 if ( aStr
.Len() != 4 || nNum
< aYearValueField
.GetMin() || nNum
> aYearValueField
.GetMax() )
512 aOutput
.AppendAscii("????");
516 aOutput
+= String::CreateFromInt32( nNum
);
518 aToYearFT
.SetText( aOutput
);
522 // -----------------------------------------------------------------------
524 IMPL_LINK( OfaMiscTabPage
, TwoFigureConfigHdl
, NumericField
*, pEd
)
526 sal_Int64 nNum
= aYearValueField
.GetValue();
527 String
aOutput( String::CreateFromInt64( nNum
) );
528 aYearValueField
.SetText( aOutput
);
529 aYearValueField
.SetSelection( Selection( 0, aOutput
.Len() ) );
534 // -----------------------------------------------------------------------
536 IMPL_LINK( OfaMiscTabPage
, HelpCheckHdl_Impl
, CheckBox
*, EMPTYARG
)
538 aExtHelpCB
.Enable( aToolTipsCB
.IsChecked() );
539 aHelpAgentResetBtn
.Enable( aHelpAgentCB
.IsChecked() );
543 // -----------------------------------------------------------------------
545 IMPL_LINK( OfaMiscTabPage
, HelpAgentResetHdl_Impl
, PushButton
*, EMPTYARG
)
547 SvtHelpOptions().resetAgentIgnoreURLCounter();
551 // -----------------------------------------------------------------------
553 // -------------------------------------------------------------------
559 BOOL
IsHardwareAccelerationEnabled() const;
560 BOOL
IsHardwareAccelerationAvailable() const;
561 void EnabledHardwareAcceleration( BOOL _bEnabled
) const;
564 typedef std::vector
< std::pair
<OUString
,Sequence
<OUString
> > > ServiceVector
;
566 Reference
<XNameAccess
> mxForceFlagNameAccess
;
567 ServiceVector maAvailableImplementations
;
568 mutable BOOL mbHWAccelAvailable
;
569 mutable BOOL mbHWAccelChecked
;
572 // -------------------------------------------------------------------
573 CanvasSettings::CanvasSettings() :
574 mxForceFlagNameAccess(),
575 mbHWAccelAvailable(FALSE
),
576 mbHWAccelChecked(FALSE
)
580 Reference
< XMultiServiceFactory
> xFactory
= comphelper::getProcessServiceFactory();
581 Reference
<XMultiServiceFactory
> xConfigProvider(
582 xFactory
->createInstance(
583 OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider")),
587 makeAny( PropertyValue(
588 OUString::createFromAscii("nodepath"), -1,
589 makeAny( OUString::createFromAscii("/org.openoffice.Office.Canvas") ),
590 PropertyState_DIRECT_VALUE
) ) );
592 mxForceFlagNameAccess
.set(
593 xConfigProvider
->createInstanceWithArguments(
594 OUString::createFromAscii("com.sun.star.configuration.ConfigurationUpdateAccess"),
595 Sequence
<Any
>( &propValue
, 1 ) ),
600 OUString::createFromAscii("nodepath"), -1,
601 makeAny( OUString::createFromAscii("/org.openoffice.Office.Canvas/CanvasServiceList") ),
602 PropertyState_DIRECT_VALUE
) );
604 Reference
<XNameAccess
> xNameAccess(
605 xConfigProvider
->createInstanceWithArguments(
606 OUString::createFromAscii("com.sun.star.configuration.ConfigurationAccess"),
607 Sequence
<Any
>( &propValue
, 1 ) ), UNO_QUERY_THROW
);
608 Reference
<XHierarchicalNameAccess
> xHierarchicalNameAccess(
609 xNameAccess
, UNO_QUERY_THROW
);
611 Sequence
<OUString
> serviceNames
= xNameAccess
->getElementNames();
612 const OUString
* pCurr
= serviceNames
.getConstArray();
613 const OUString
* const pEnd
= pCurr
+ serviceNames
.getLength();
614 while( pCurr
!= pEnd
)
616 Reference
<XNameAccess
> xEntryNameAccess(
617 xHierarchicalNameAccess
->getByHierarchicalName(*pCurr
),
620 if( xEntryNameAccess
.is() )
622 Sequence
<OUString
> preferredImplementations
;
623 if( (xEntryNameAccess
->getByName( OUString::createFromAscii("PreferredImplementations") ) >>= preferredImplementations
) )
624 maAvailableImplementations
.push_back( std::make_pair(*pCurr
,preferredImplementations
) );
635 // -------------------------------------------------------------------
636 BOOL
CanvasSettings::IsHardwareAccelerationAvailable() const
638 if( !mbHWAccelChecked
)
640 mbHWAccelChecked
= true;
642 Reference
< XMultiServiceFactory
> xFactory
= comphelper::getProcessServiceFactory();
644 // check whether any of the service lists has an
645 // implementation that presents the "HardwareAcceleration" property
646 ServiceVector::const_iterator aCurr
=maAvailableImplementations
.begin();
647 const ServiceVector::const_iterator aEnd
=maAvailableImplementations
.end();
648 while( aCurr
!= aEnd
)
650 const OUString
* pCurrImpl
= aCurr
->second
.getConstArray();
651 const OUString
* const pEndImpl
= pCurrImpl
+ aCurr
->second
.getLength();
653 while( pCurrImpl
!= pEndImpl
)
657 Reference
<XPropertySet
> xPropSet( xFactory
->createInstance(
660 bool bHasAccel(false);
661 if( (xPropSet
->getPropertyValue(OUString::createFromAscii("HardwareAcceleration")) >>= bHasAccel
) )
664 mbHWAccelAvailable
= true;
665 return mbHWAccelAvailable
;
678 return mbHWAccelAvailable
;
681 // -------------------------------------------------------------------
682 BOOL
CanvasSettings::IsHardwareAccelerationEnabled() const
684 bool bForceLastEntry(false);
685 if( !mxForceFlagNameAccess
.is() )
688 if( !(mxForceFlagNameAccess
->getByName( OUString::createFromAscii("ForceSafeServiceImpl") ) >>= bForceLastEntry
) )
691 return !bForceLastEntry
;
694 // -------------------------------------------------------------------
695 void CanvasSettings::EnabledHardwareAcceleration( BOOL _bEnabled
) const
697 Reference
< XNameReplace
> xNameReplace(
698 mxForceFlagNameAccess
, UNO_QUERY
);
700 if( !xNameReplace
.is() )
703 xNameReplace
->replaceByName( OUString::createFromAscii("ForceSafeServiceImpl"),
704 makeAny(!_bEnabled
) );
706 Reference
< XChangesBatch
> xChangesBatch(
707 mxForceFlagNameAccess
, UNO_QUERY
);
709 if( !xChangesBatch
.is() )
712 xChangesBatch
->commitChanges();
715 // class OfaViewTabPage --------------------------------------------------
717 OfaViewTabPage::OfaViewTabPage(Window
* pParent
, const SfxItemSet
& rSet
) :
719 SfxTabPage( pParent
, SVX_RES( OFA_TP_VIEW
), rSet
),
721 aUserInterfaceFL ( this, SVX_RES( FL_USERINTERFACE
) ),
722 aWindowSizeFT ( this, SVX_RES( FT_WINDOWSIZE
) ),
723 aWindowSizeMF ( this, SVX_RES( MF_WINDOWSIZE
) ),
724 aIconSizeStyleFT ( this, SVX_RES( FT_ICONSIZESTYLE
) ),
725 aIconSizeLB ( this, SVX_RES( LB_ICONSIZE
) ),
726 aIconStyleLB ( this, SVX_RES( LB_ICONSTYLE
) ),
727 m_aSystemFont (this, SVX_RES( CB_SYSTEM_FONT
) ),
729 aFontAntiAliasing ( this, SVX_RES( CB_FONTANTIALIASING
)),
730 aAAPointLimitLabel ( this, SVX_RES( FT_POINTLIMIT_LABEL
)),
731 aAAPointLimit ( this, SVX_RES( NF_AA_POINTLIMIT
)),
732 aAAPointLimitUnits ( this, SVX_RES( FT_POINTLIMIT_UNIT
)),
734 aMenuFL ( this, SVX_RES( FL_MENU
) ),
735 aMenuIconsFT ( this, SVX_RES( FT_MENU_ICONS
)),
736 aMenuIconsLB ( this, SVX_RES( LB_MENU_ICONS
)),
737 aFontListsFL ( this, SVX_RES( FL_FONTLISTS
) ),
738 aFontShowCB ( this, SVX_RES( CB_FONT_SHOW
) ),
739 aFontHistoryCB ( this, SVX_RES( CB_FONT_HISTORY
) ),
740 aRenderingFL ( this, SVX_RES( FL_RENDERING
) ),
741 aUseHardwareAccell ( this, SVX_RES( CB_USE_HARDACCELL
) ),
742 aUseAntiAliase ( this, SVX_RES( CB_USE_ANTIALIASE
) ),
743 aMouseFL ( this, SVX_RES( FL_MOUSE
) ),
744 aMousePosFT ( this, SVX_RES( FT_MOUSEPOS
) ),
745 aMousePosLB ( this, SVX_RES( LB_MOUSEPOS
) ),
746 aMouseMiddleFT ( this, SVX_RES( FT_MOUSEMIDDLE
) ),
747 aMouseMiddleLB ( this, SVX_RES( LB_MOUSEMIDDLE
) ),
750 maSelectionFL(this, SVX_RES(FL_SELECTION
)),
751 maSelectionCB(this, SVX_RES(CB_SELECTION
)),
752 maSelectionMF(this, SVX_RES(MF_SELECTION
)),
754 nSizeLB_InitialSelection(0),
755 nStyleLB_InitialSelection(0),
756 pAppearanceCfg(new SvtTabAppearanceCfg
),
757 pCanvasSettings(new CanvasSettings
),
758 mpDrawinglayerOpt(new SvtOptionsDrawinglayer
)
761 aFontAntiAliasing
.SetToggleHdl( LINK( this, OfaViewTabPage
, OnAntialiasingToggled
) );
763 // depending on the size of the text in aAAPointLimitLabel, we slightly re-arrange aAAPointLimit and aAAPointLimitUnits
764 //#110391# if the label has no mnemonic and we are in a CJK version the mnemonic "(X)" will be added which
765 // influences the width calculation
766 MnemonicGenerator aMnemonicGenerator
;
767 String
sLabel(aAAPointLimitLabel
.GetText());
768 aMnemonicGenerator
.RegisterMnemonic( sLabel
);
769 aMnemonicGenerator
.CreateMnemonic( sLabel
);
770 sLabel
.EraseAllChars('~');
772 sal_Int32 nLabelWidth
= aAAPointLimitLabel
.GetTextWidth( sLabel
);
773 nLabelWidth
+= 3; // small gap
774 // pixels to move both controls to the left
775 Size aSize
= aAAPointLimitLabel
.GetSizePixel();
776 sal_Int32 nMoveLeft
= aSize
.Width() - nLabelWidth
;
777 // resize the first label
778 aSize
.Width() = nLabelWidth
;
779 aAAPointLimitLabel
.SetSizePixel( aSize
);
781 // move the numeric field
782 Point
aPos( aAAPointLimit
.GetPosPixel() );
783 aPos
.X() -= nMoveLeft
;
784 aAAPointLimit
.SetPosPixel( aPos
);
786 // move (and resize) the units FixedText
787 aPos
= ( aAAPointLimitUnits
.GetPosPixel() );
788 aPos
.X() -= nMoveLeft
;
789 aSize
= aAAPointLimitUnits
.GetSizePixel();
790 aSize
.Width() += nMoveLeft
;
791 aAAPointLimitUnits
.SetPosSizePixel( aPos
, aSize
);
793 // on this platform, we do not have the anti aliasing options - move the other checkboxes accordingly
794 // (in the resource, the coordinates are calculated for the AA options beeing present)
795 Control
* pMiscOptions
[] =
797 &aMenuFL
, &aMenuIconsFT
, &aMenuIconsLB
,
798 &aFontListsFL
, &aFontShowCB
, &aFontHistoryCB
801 // temporaryly create the checkbox for the anti aliasing (we need to to determine it's pos)
802 CheckBox
* pFontAntiAliasing
= new CheckBox( this, SVX_RES( CB_FONTANTIALIASING
) );
803 sal_Int32 nMoveUp
= aMenuFL
.GetPosPixel().Y() - pFontAntiAliasing
->GetPosPixel().Y();
804 DELETEZ( pFontAntiAliasing
);
807 for ( sal_Int32 i
= 0; i
< sizeof( pMiscOptions
) / sizeof( pMiscOptions
[0] ); ++i
)
809 aPos
= pMiscOptions
[i
]->GetPosPixel( );
811 pMiscOptions
[i
]->SetPosPixel( aPos
);
817 maSelectionCB
.SetToggleHdl( LINK( this, OfaViewTabPage
, OnSelectionToggled
) );
821 if( ! Application::ValidateSystemFont() )
823 m_aSystemFont
.Check( FALSE
);
824 m_aSystemFont
.Enable( FALSE
);
827 // add real theme name to 'auto' theme, e.g. 'auto' => 'auto (classic)'
828 if( aIconStyleLB
.GetEntryCount() > 1 )
830 ::rtl::OUString
aAutoStr( aIconStyleLB
.GetEntry( 0 ) );
832 aAutoStr
+= ::rtl::OUString::createFromAscii( " (" );
834 switch( Application::GetSettings().GetStyleSettings().GetAutoSymbolsStyle() )
836 case STYLE_SYMBOLS_DEFAULT
: aAutoStr
+= aIconStyleLB
.GetEntry( 1 ); break;
837 case STYLE_SYMBOLS_INDUSTRIAL
: aAutoStr
+= aIconStyleLB
.GetEntry( 2 ); break;
838 case STYLE_SYMBOLS_CRYSTAL
: aAutoStr
+= aIconStyleLB
.GetEntry( 3 ); break;
839 case STYLE_SYMBOLS_TANGO
: aAutoStr
+= aIconStyleLB
.GetEntry( 4 ); break;
840 case STYLE_SYMBOLS_CLASSIC
: aAutoStr
+= aIconStyleLB
.GetEntry( 5 ); break;
841 case STYLE_SYMBOLS_HICONTRAST
: aAutoStr
+= aIconStyleLB
.GetEntry( 6 ); break;
842 case STYLE_SYMBOLS_OXYGEN
: aAutoStr
+= aIconStyleLB
.GetEntry( 7 ); break;
845 aIconStyleLB
.RemoveEntry( 0 );
846 aIconStyleLB
.InsertEntry( aAutoStr
+= ::rtl::OUString::createFromAscii( ")" ), 0 );
847 aIconStyleLB
.SetSeparatorPos( aIconStyleLB
.GetEntryCount() - 2 );
851 OfaViewTabPage::~OfaViewTabPage()
853 delete mpDrawinglayerOpt
;
854 delete pCanvasSettings
;
855 delete pAppearanceCfg
;
859 //--- 20.08.01 10:16:12 ---------------------------------------------------
860 IMPL_LINK( OfaViewTabPage
, OnAntialiasingToggled
, void*, NOTINTERESTEDIN
)
862 (void)NOTINTERESTEDIN
;
864 sal_Bool bAAEnabled
= aFontAntiAliasing
.IsChecked();
866 aAAPointLimitLabel
.Enable( bAAEnabled
);
867 aAAPointLimit
.Enable( bAAEnabled
);
868 aAAPointLimitUnits
.Enable( bAAEnabled
);
875 IMPL_LINK( OfaViewTabPage
, OnSelectionToggled
, void*, NOTINTERESTEDIN
)
877 (void)NOTINTERESTEDIN
;
878 const bool bSelectionEnabled(maSelectionCB
.IsChecked());
879 maSelectionMF
.Enable(bSelectionEnabled
);
883 /*-----------------06.12.96 11.50-------------------
885 --------------------------------------------------*/
887 SfxTabPage
* OfaViewTabPage::Create( Window
* pParent
, const SfxItemSet
& rAttrSet
)
889 return new OfaViewTabPage(pParent
, rAttrSet
);
892 /*-----------------06.12.96 11.50-------------------
894 --------------------------------------------------*/
896 BOOL
OfaViewTabPage::FillItemSet( SfxItemSet
& )
898 SvtFontOptions aFontOpt
;
899 SvtMenuOptions aMenuOpt
;
900 SvtStartOptions aStartOpt
;
902 BOOL bModified
= FALSE
;
903 BOOL bMenuOptModified
= FALSE
;
904 bool bRepaintWindows(false);
906 SvtMiscOptions aMiscOptions
;
907 UINT16 nSizeLB_NewSelection
= aIconSizeLB
.GetSelectEntryPos();
908 if( nSizeLB_InitialSelection
!= nSizeLB_NewSelection
)
910 // from now on it's modified, even if via auto setting the same size was set as now selected in the LB
911 sal_Int16 eSet
= SFX_SYMBOLS_SIZE_AUTO
;
912 switch( nSizeLB_NewSelection
)
914 case 0: eSet
= SFX_SYMBOLS_SIZE_AUTO
; break;
915 case 1: eSet
= SFX_SYMBOLS_SIZE_SMALL
; break;
916 case 2: eSet
= SFX_SYMBOLS_SIZE_LARGE
; break;
918 DBG_ERROR( "OfaViewTabPage::FillItemSet(): This state of aIconSizeLB should not be possible!" );
920 aMiscOptions
.SetSymbolsSize( eSet
);
923 UINT16 nStyleLB_NewSelection
= aIconStyleLB
.GetSelectEntryPos();
924 if( nStyleLB_InitialSelection
!= nStyleLB_NewSelection
)
926 sal_Int16 eSet
= SFX_SYMBOLS_STYLE_AUTO
;
927 switch( nStyleLB_NewSelection
)
929 case 0: eSet
= SFX_SYMBOLS_STYLE_AUTO
; break;
930 case 1: eSet
= SFX_SYMBOLS_STYLE_DEFAULT
; break;
931 case 2: eSet
= SFX_SYMBOLS_STYLE_HICONTRAST
; break;
932 case 3: eSet
= SFX_SYMBOLS_STYLE_INDUSTRIAL
; break;
933 case 4: eSet
= SFX_SYMBOLS_STYLE_CRYSTAL
; break;
934 case 5: eSet
= SFX_SYMBOLS_STYLE_TANGO
; break;
935 case 6: eSet
= SFX_SYMBOLS_STYLE_CLASSIC
; break;
936 case 7: eSet
= SFX_SYMBOLS_STYLE_OXYGEN
; break;
938 DBG_ERROR( "OfaViewTabPage::FillItemSet(): This state of aIconStyleLB should not be possible!" );
940 aMiscOptions
.SetSymbolsStyle( eSet
);
943 BOOL bAppearanceChanged
= FALSE
;
947 UINT16 nOldScale
= pAppearanceCfg
->GetScaleFactor();
948 UINT16 nNewScale
= (UINT16
)aWindowSizeMF
.GetValue();
950 if ( nNewScale
!= nOldScale
)
952 pAppearanceCfg
->SetScaleFactor(nNewScale
);
953 bAppearanceChanged
= TRUE
;
957 short eOldSnap
= pAppearanceCfg
->GetSnapMode();
958 short eNewSnap
= aMousePosLB
.GetSelectEntryPos();
962 if ( eNewSnap
!= eOldSnap
)
964 pAppearanceCfg
->SetSnapMode(eNewSnap
);
965 bAppearanceChanged
= TRUE
;
968 // Middle Mouse Button
969 short eOldMiddleMouse
= pAppearanceCfg
->GetMiddleMouseButton();
970 short eNewMiddleMouse
= aMouseMiddleLB
.GetSelectEntryPos();
971 if(eNewMiddleMouse
> 2)
974 if ( eNewMiddleMouse
!= eOldMiddleMouse
)
976 pAppearanceCfg
->SetMiddleMouseButton( eNewMiddleMouse
);
977 bAppearanceChanged
= TRUE
;
981 if ( aFontAntiAliasing
.IsChecked() != aFontAntiAliasing
.GetSavedValue() )
983 pAppearanceCfg
->SetFontAntiAliasing( aFontAntiAliasing
.IsChecked() );
984 bAppearanceChanged
= TRUE
;
987 if ( aAAPointLimit
.GetValue() != aAAPointLimit
.GetSavedValue().ToInt32() )
989 pAppearanceCfg
->SetFontAntialiasingMinPixelHeight( aAAPointLimit
.GetValue() );
990 bAppearanceChanged
= TRUE
;
994 if ( aFontShowCB
.IsChecked() != aFontShowCB
.GetSavedValue() )
996 aFontOpt
.EnableFontWYSIWYG( aFontShowCB
.IsChecked() );
1000 if(aMenuIconsLB
.GetSelectEntryPos() != aMenuIconsLB
.GetSavedValue())
1002 aMenuOpt
.SetMenuIconsState( aMenuIconsLB
.GetSelectEntryPos() == 0 ? 2 : aMenuIconsLB
.GetSelectEntryPos() - 1);
1004 bMenuOptModified
= TRUE
;
1005 bAppearanceChanged
= TRUE
;
1008 if ( aFontHistoryCB
.IsChecked() != aFontHistoryCB
.GetSavedValue() )
1010 aFontOpt
.EnableFontHistory( aFontHistoryCB
.IsChecked() );
1014 // #i95644# if disabled, do not use value, see in ::Reset()
1015 if(aUseHardwareAccell
.IsEnabled())
1017 if(aUseHardwareAccell
.IsChecked() != aUseHardwareAccell
.GetSavedValue())
1019 pCanvasSettings
->EnabledHardwareAcceleration(aUseHardwareAccell
.IsChecked());
1024 // #i95644# if disabled, do not use value, see in ::Reset()
1025 if(aUseAntiAliase
.IsEnabled())
1027 if(aUseAntiAliase
.IsChecked() != mpDrawinglayerOpt
->IsAntiAliasing())
1029 mpDrawinglayerOpt
->SetAntiAliasing(aUseAntiAliase
.IsChecked());
1031 bRepaintWindows
= true;
1036 if(maSelectionCB
.IsEnabled())
1038 const bool bNewSelection(maSelectionCB
.IsChecked());
1039 const sal_uInt16
nNewTransparence((sal_uInt16
)maSelectionMF
.GetValue());
1041 if(bNewSelection
!= (bool)mpDrawinglayerOpt
->IsTransparentSelection())
1043 mpDrawinglayerOpt
->SetTransparentSelection(maSelectionCB
.IsChecked());
1045 bRepaintWindows
= true;
1048 // #i104150# even read the value when maSelectionMF is disabled; it may have been
1049 // modified by enabling-modify-disabling by the user
1050 if(nNewTransparence
!= mpDrawinglayerOpt
->GetTransparentSelectionPercent())
1052 mpDrawinglayerOpt
->SetTransparentSelectionPercent(nNewTransparence
);
1054 bRepaintWindows
= true;
1058 SvtAccessibilityOptions aAccessibilityOptions
;
1059 if( aAccessibilityOptions
.GetIsSystemFont() != m_aSystemFont
.IsChecked() &&
1060 m_aSystemFont
.IsEnabled() )
1062 aAccessibilityOptions
.SetIsSystemFont( m_aSystemFont
.IsChecked() );
1064 bMenuOptModified
= TRUE
;
1067 if( bMenuOptModified
)
1069 // Set changed settings to the application instance
1070 AllSettings aAllSettings
= Application::GetSettings();
1071 StyleSettings aStyleSettings
= aAllSettings
.GetStyleSettings();
1072 if( m_aSystemFont
.IsEnabled() )
1073 aStyleSettings
.SetUseSystemUIFonts( m_aSystemFont
.IsChecked() );
1074 aAllSettings
.SetStyleSettings(aStyleSettings
);
1075 Application::MergeSystemSettings( aAllSettings
);
1076 Application::SetSettings(aAllSettings
);
1079 if ( bAppearanceChanged
)
1081 pAppearanceCfg
->Commit();
1082 pAppearanceCfg
->SetApplicationDefaults ( GetpApp() );
1087 Window
* pAppWindow
= Application::GetFirstTopLevelWindow();
1091 pAppWindow
->Invalidate();
1092 pAppWindow
= Application::GetNextTopLevelWindow(pAppWindow
);
1099 /*-----------------06.12.96 11.50-------------------
1101 --------------------------------------------------*/
1102 void OfaViewTabPage::Reset( const SfxItemSet
& )
1104 SvtMiscOptions aMiscOptions
;
1106 if( aMiscOptions
.GetSymbolsSize() != SFX_SYMBOLS_SIZE_AUTO
)
1107 nSizeLB_InitialSelection
= ( aMiscOptions
.AreCurrentSymbolsLarge() )? 2 : 1;
1108 aIconSizeLB
.SelectEntryPos( nSizeLB_InitialSelection
);
1109 aIconSizeLB
.SaveValue();
1111 if( aMiscOptions
.GetSymbolsStyle() != SFX_SYMBOLS_STYLE_AUTO
)
1113 switch ( aMiscOptions
.GetCurrentSymbolsStyle() )
1115 case SFX_SYMBOLS_STYLE_DEFAULT
: nStyleLB_InitialSelection
= 1; break;
1116 case SFX_SYMBOLS_STYLE_HICONTRAST
: nStyleLB_InitialSelection
= 2; break;
1117 case SFX_SYMBOLS_STYLE_INDUSTRIAL
: nStyleLB_InitialSelection
= 3; break;
1118 case SFX_SYMBOLS_STYLE_CRYSTAL
: nStyleLB_InitialSelection
= 4; break;
1119 case SFX_SYMBOLS_STYLE_TANGO
: nStyleLB_InitialSelection
= 5; break;
1120 case SFX_SYMBOLS_STYLE_CLASSIC
: nStyleLB_InitialSelection
= 6; break;
1121 case SFX_SYMBOLS_STYLE_OXYGEN
: nStyleLB_InitialSelection
= 7; break;
1122 default: nStyleLB_InitialSelection
= 0; break;
1126 aIconStyleLB
.SelectEntryPos( nStyleLB_InitialSelection
);
1127 aIconStyleLB
.SaveValue();
1129 if( m_aSystemFont
.IsEnabled() )
1131 SvtAccessibilityOptions aAccessibilityOptions
;
1132 m_aSystemFont
.Check( aAccessibilityOptions
.GetIsSystemFont() );
1136 aWindowSizeMF
.SetValue ( pAppearanceCfg
->GetScaleFactor() );
1138 aMousePosLB
.SelectEntryPos(pAppearanceCfg
->GetSnapMode());
1139 aMousePosLB
.SaveValue();
1142 aMouseMiddleLB
.SelectEntryPos(pAppearanceCfg
->GetMiddleMouseButton());
1143 aMouseMiddleLB
.SaveValue();
1146 aFontAntiAliasing
.Check( pAppearanceCfg
->IsFontAntiAliasing() );
1147 aAAPointLimit
.SetValue( pAppearanceCfg
->GetFontAntialiasingMinPixelHeight() );
1151 SvtFontOptions aFontOpt
;
1152 aFontShowCB
.Check( aFontOpt
.IsFontWYSIWYGEnabled() );
1153 SvtMenuOptions aMenuOpt
;
1154 aMenuIconsLB
.SelectEntryPos(aMenuOpt
.GetMenuIconsState() == 2 ? 0 : aMenuOpt
.GetMenuIconsState() + 1);
1155 aMenuIconsLB
.SaveValue();
1156 aFontHistoryCB
.Check( aFontOpt
.IsFontHistoryEnabled() );
1158 { // #i95644# HW accel (unified to disable mechanism)
1159 if(pCanvasSettings
->IsHardwareAccelerationAvailable())
1161 aUseHardwareAccell
.Check(pCanvasSettings
->IsHardwareAccelerationEnabled());
1165 aUseHardwareAccell
.Check(false);
1166 aUseHardwareAccell
.Disable();
1169 aUseHardwareAccell
.SaveValue();
1172 { // #i95644# AntiAliasing
1173 if(mpDrawinglayerOpt
->IsAAPossibleOnThisSystem())
1175 aUseAntiAliase
.Check(mpDrawinglayerOpt
->IsAntiAliasing());
1179 aUseAntiAliase
.Check(false);
1180 aUseAntiAliase
.Disable();
1183 aUseAntiAliase
.SaveValue();
1187 // #i97672# Selection
1188 // check if transparent selection is possible on this system
1189 const bool bTransparentSelectionPossible(
1190 !GetSettings().GetStyleSettings().GetHighContrastMode()
1191 && supportsOperation(OutDevSupport_TransparentRect
));
1194 if(bTransparentSelectionPossible
)
1196 maSelectionCB
.Check(mpDrawinglayerOpt
->IsTransparentSelection());
1200 maSelectionCB
.Enable(false);
1203 maSelectionMF
.SetValue(mpDrawinglayerOpt
->GetTransparentSelectionPercent());
1204 maSelectionMF
.Enable(mpDrawinglayerOpt
->IsTransparentSelection() && bTransparentSelectionPossible
);
1208 aFontAntiAliasing
.SaveValue();
1209 aAAPointLimit
.SaveValue();
1211 aFontShowCB
.SaveValue();
1212 aFontHistoryCB
.SaveValue();
1215 LINK( this, OfaViewTabPage
, OnAntialiasingToggled
).Call( NULL
);
1218 /* -----------------------------23.11.00 14:55--------------------------------
1220 ---------------------------------------------------------------------------*/
1221 class LangConfigItem_Impl
: public ConfigItem
1224 OUString aPropertyName
;
1226 LangConfigItem_Impl(const OUString
& rTree
, const OUString
& rProperty
);
1227 ~LangConfigItem_Impl();
1229 virtual void Commit();
1231 const Any
& GetValue() const {return aValue
;}
1232 void SetValue(Any
& rValue
) {aValue
= rValue
; SetModified();}
1234 /* -----------------------------23.11.00 15:06--------------------------------
1236 ---------------------------------------------------------------------------*/
1237 LangConfigItem_Impl::LangConfigItem_Impl(
1238 const OUString
& rTree
, const OUString
& rProperty
) :
1240 aPropertyName(rProperty
)
1242 Sequence
<OUString
> aNames(1);
1243 aNames
.getArray()[0] = aPropertyName
;
1244 Sequence
<Any
> aValues
= GetProperties(aNames
);
1245 aValue
= aValues
.getConstArray()[0];
1247 /* -----------------------------23.11.00 15:06--------------------------------
1249 ---------------------------------------------------------------------------*/
1250 LangConfigItem_Impl::~LangConfigItem_Impl()
1252 /* -----------------------------23.11.00 15:10--------------------------------
1254 ---------------------------------------------------------------------------*/
1255 void LangConfigItem_Impl::Commit()
1257 Sequence
<OUString
> aNames(1);
1258 aNames
.getArray()[0] = aPropertyName
;
1259 Sequence
<Any
> aValues(1);
1260 aValues
.getArray()[0] = aValue
;
1261 PutProperties(aNames
, aValues
);
1263 /* -----------------22.07.2003 10:33-----------------
1265 --------------------------------------------------*/
1266 struct LanguageConfig_Impl
1268 SvtLanguageOptions aLanguageOptions
;
1269 SvtSysLocaleOptions aSysLocaleOptions
;
1270 SvtLinguConfig aLinguConfig
;
1272 /* -----------------------------23.11.00 13:06--------------------------------
1274 ---------------------------------------------------------------------------*/
1275 static sal_Bool bLanguageCurrentDoc_Impl
= sal_False
;
1277 // some things we'll need...
1278 static const OUString sConfigSrvc
= OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider");
1279 static const OUString sAccessSrvc
= OUString::createFromAscii("com.sun.star.configuration.ConfigurationAccess");
1280 static const OUString sAccessUpdSrvc
= OUString::createFromAscii("com.sun.star.configuration.ConfigurationUpdateAccess");
1281 static const OUString sInstalledLocalesPath
= OUString::createFromAscii("org.openoffice.Setup/Office/InstalledLocales");
1282 static OUString sUserLocalePath
= OUString::createFromAscii("org.openoffice.Office.Linguistic/General");
1283 //static const OUString sUserLocalePath = OUString::createFromAscii("org.openoffice.Office/Linguistic");
1284 static const OUString sUserLocaleKey
= OUString::createFromAscii("UILocale");
1285 static const OUString sSystemLocalePath
= OUString::createFromAscii("org.openoffice.System/L10N");
1286 static const OUString sSystemLocaleKey
= OUString::createFromAscii("UILocale");
1287 static const OUString sOfficeLocalePath
= OUString::createFromAscii("org.openoffice.Office/L10N");
1288 static const OUString sOfficeLocaleKey
= OUString::createFromAscii("ooLocale");
1289 static Sequence
< OUString
> seqInstalledLanguages
;
1291 OfaLanguagesTabPage::OfaLanguagesTabPage( Window
* pParent
, const SfxItemSet
& rSet
) :
1292 SfxTabPage( pParent
, SVX_RES( OFA_TP_LANGUAGES
), rSet
),
1293 aUILanguageGB(this, SVX_RES(FL_UI_LANG
)),
1294 aLocaleSettingFI(this, SVX_RES(FI_LOCALESETTING
)),
1295 aUserInterfaceFT(this, SVX_RES(FT_USERINTERFACE
)),
1296 aUserInterfaceLB(this, SVX_RES(LB_USERINTERFACE
)),
1297 aLocaleSettingFT(this, SVX_RES(FT_LOCALESETTING
)),
1298 aLocaleSettingLB(this, SVX_RES(LB_LOCALESETTING
)),
1299 aCurrencyFI( this, SVX_RES(FI_CURRENCY
)),
1300 aDecimalSeparatorFT(this, SVX_RES(FT_DECIMALSEPARATOR
)),
1301 aDecimalSeparatorCB(this, SVX_RES(CB_DECIMALSEPARATOR
)),
1302 aCurrencyFT( this, SVX_RES(FT_CURRENCY
)),
1303 aCurrencyLB( this, SVX_RES(LB_CURRENCY
)),
1304 aLinguLanguageGB(this, SVX_RES(FL_LINGU_LANG
)),
1305 aWesternLanguageFI(this, SVX_RES(FI_WEST_LANG
)),
1306 aWesternLanguageFT(this, SVX_RES(FT_WEST_LANG
)),
1307 aWesternLanguageLB(this, SVX_RES(LB_WEST_LANG
)),
1308 aAsianLanguageFI(this, SVX_RES(FI_ASIAN_LANG
)),
1309 aAsianLanguageFT(this, SVX_RES(FT_ASIAN_LANG
)),
1310 aAsianLanguageLB(this, SVX_RES(LB_ASIAN_LANG
)),
1311 aComplexLanguageFI(this, SVX_RES(FI_COMPLEX_LANG
)),
1312 aComplexLanguageFT(this, SVX_RES(FT_COMPLEX_LANG
)),
1313 aComplexLanguageLB(this, SVX_RES(LB_COMPLEX_LANG
)),
1314 aCurrentDocCB(this, SVX_RES(CB_CURRENT_DOC
)),
1315 aEnhancedFL(this, SVX_RES(FL_ENHANCED
)),
1316 aAsianSupportFI(this, SVX_RES(FI_ASIANSUPPORT
)),
1317 aAsianSupportCB(this, SVX_RES(CB_ASIANSUPPORT
)),
1318 aCTLSupportFI(this, SVX_RES(FI_CTLSUPPORT
)),
1319 aCTLSupportCB(this, SVX_RES(CB_CTLSUPPORT
)),
1320 sDecimalSeparatorLabel(aDecimalSeparatorCB
.GetText()),
1321 pLangConfig(new LanguageConfig_Impl
)
1325 // initialize user interface language selection
1326 SvtLanguageTable
* pLanguageTable
= new SvtLanguageTable
;
1327 String
aStr( pLanguageTable
->GetString( LANGUAGE_SYSTEM
) );
1328 aUserInterfaceLB
.InsertEntry(aStr
);
1329 aUserInterfaceLB
.SetEntryData(0, 0);
1330 aUserInterfaceLB
.SelectEntryPos(0);
1333 OUString sOfficeLocaleValue
;
1334 OUString sSystemLocaleValue
;
1336 Reference
< XMultiServiceFactory
> theMSF
= comphelper::getProcessServiceFactory();
1337 Reference
< XMultiServiceFactory
> theConfigProvider
= Reference
< XMultiServiceFactory
> (
1338 theMSF
->createInstance( sConfigSrvc
),UNO_QUERY_THROW
);
1339 Sequence
< Any
> theArgs(2);
1340 Reference
< XNameAccess
> theNameAccess
;
1342 // find out which locales are currently installed and add them to the listbox
1343 theArgs
[0] = makeAny(NamedValue(OUString::createFromAscii("NodePath"), makeAny(sInstalledLocalesPath
)));
1344 theArgs
[1] = makeAny(NamedValue(OUString::createFromAscii("reload"), makeAny(sal_True
)));
1345 theNameAccess
= Reference
< XNameAccess
> (
1346 theConfigProvider
->createInstanceWithArguments(sAccessSrvc
, theArgs
), UNO_QUERY_THROW
);
1347 seqInstalledLanguages
= theNameAccess
->getElementNames();
1348 LanguageType aLang
= LANGUAGE_DONTKNOW
;
1349 for (sal_Int32 i
=0; i
<seqInstalledLanguages
.getLength(); i
++)
1351 aLang
= MsLangId::convertIsoStringToLanguage(seqInstalledLanguages
[i
]);
1352 if (aLang
!= LANGUAGE_DONTKNOW
)
1354 //USHORT p = aUserInterfaceLB.InsertLanguage(aLang);
1355 String
aLangStr( pLanguageTable
->GetString( aLang
) );
1356 USHORT p
= aUserInterfaceLB
.InsertEntry(aLangStr
);
1357 aUserInterfaceLB
.SetEntryData(p
, (void*)(i
+1));
1361 // find out whether the user has a specific locale specified
1362 Sequence
< Any
> theArgs2(1);
1363 theArgs2
[0] = makeAny(NamedValue(OUString::createFromAscii("NodePath"), makeAny(sUserLocalePath
)));
1364 theNameAccess
= Reference
< XNameAccess
> (
1365 theConfigProvider
->createInstanceWithArguments(sAccessSrvc
, theArgs2
), UNO_QUERY_THROW
);
1366 if (theNameAccess
->hasByName(sUserLocaleKey
))
1367 theNameAccess
->getByName(sUserLocaleKey
) >>= m_sUserLocaleValue
;
1368 // select the user specified locale in the listbox
1369 if (m_sUserLocaleValue
.getLength() > 0)
1372 for (USHORT i
=0; i
< aUserInterfaceLB
.GetEntryCount(); i
++)
1374 d
= (sal_Int32
)(sal_IntPtr
)aUserInterfaceLB
.GetEntryData(i
);
1375 if ( d
> 0 && seqInstalledLanguages
.getLength() > d
-1 && seqInstalledLanguages
[d
-1].equals(m_sUserLocaleValue
))
1376 aUserInterfaceLB
.SelectEntryPos(i
);
1381 catch (Exception
&e
)
1383 // we'll just leave the box in it's default setting and won't
1384 // even give it event handler...
1385 OString aMsg
= OUStringToOString(e
.Message
, RTL_TEXTENCODING_ASCII_US
);
1386 OSL_ENSURE(sal_False
, aMsg
.getStr());
1389 aWesternLanguageLB
.SetLanguageList( LANG_LIST_WESTERN
| LANG_LIST_ONLY_KNOWN
, TRUE
, FALSE
, TRUE
);
1390 aAsianLanguageLB
.SetLanguageList( LANG_LIST_CJK
| LANG_LIST_ONLY_KNOWN
, TRUE
, FALSE
, TRUE
);
1391 aComplexLanguageLB
.SetLanguageList( LANG_LIST_CTL
| LANG_LIST_ONLY_KNOWN
, TRUE
, FALSE
, TRUE
);
1392 aLocaleSettingLB
.SetLanguageList( LANG_LIST_ALL
| LANG_LIST_ONLY_KNOWN
, FALSE
, FALSE
, FALSE
);
1393 aLocaleSettingLB
.InsertLanguage( LANGUAGE_SYSTEM
);
1395 // insert SYSTEM entry, no specific currency
1396 aCurrencyLB
.InsertEntry( aStr
);
1398 String
aTwoSpace( RTL_CONSTASCII_USTRINGPARAM( " " ) );
1399 const NfCurrencyTable
& rCurrTab
= SvNumberFormatter::GetTheCurrencyTable();
1400 USHORT nCurrCount
= rCurrTab
.Count();
1401 // first entry is SYSTEM, skip it
1402 for ( USHORT j
=1; j
< nCurrCount
; ++j
)
1404 const NfCurrencyEntry
* pCurr
= rCurrTab
[j
];
1405 String
aStr_( pCurr
->GetBankSymbol() );
1407 aStr_
+= pCurr
->GetSymbol();
1408 aStr_
= ApplyLreOrRleEmbedding( aStr_
);
1410 aStr_
+= ApplyLreOrRleEmbedding( pLanguageTable
->GetString( pCurr
->GetLanguage() ) );
1411 USHORT nPos
= aCurrencyLB
.InsertEntry( aStr_
);
1412 aCurrencyLB
.SetEntryData( nPos
, (void*) pCurr
);
1414 delete pLanguageTable
;
1416 aLocaleSettingLB
.SetSelectHdl( LINK( this, OfaLanguagesTabPage
, LocaleSettingHdl
) );
1417 Link
aLink( LINK( this, OfaLanguagesTabPage
, SupportHdl
) );
1418 aAsianSupportCB
.SetClickHdl( aLink
);
1419 aCTLSupportCB
.SetClickHdl( aLink
);
1421 aAsianSupportCB
.Check( m_bOldAsian
= pLangConfig
->aLanguageOptions
.IsAnyEnabled() );
1422 aAsianSupportCB
.SaveValue();
1423 sal_Bool bReadonly
= pLangConfig
->aLanguageOptions
.IsReadOnly(SvtLanguageOptions::E_ALLCJK
);
1424 aAsianSupportCB
.Enable(!bReadonly
);
1425 aAsianSupportFI
.Show(bReadonly
);
1426 SupportHdl( &aAsianSupportCB
);
1428 aCTLSupportCB
.Check( m_bOldCtl
= pLangConfig
->aLanguageOptions
.IsCTLFontEnabled() );
1429 aCTLSupportCB
.SaveValue();
1430 bReadonly
= pLangConfig
->aLanguageOptions
.IsReadOnly(SvtLanguageOptions::E_CTLFONT
);
1431 aCTLSupportCB
.Enable(!bReadonly
);
1432 aCTLSupportFI
.Show(bReadonly
);
1433 SupportHdl( &aCTLSupportCB
);
1435 /*-- 23.11.00 13:06:40---------------------------------------------------
1437 -----------------------------------------------------------------------*/
1438 OfaLanguagesTabPage::~OfaLanguagesTabPage()
1442 /*-- 23.11.00 13:06:40---------------------------------------------------
1444 -----------------------------------------------------------------------*/
1445 SfxTabPage
* OfaLanguagesTabPage::Create( Window
* pParent
, const SfxItemSet
& rAttrSet
)
1447 return new OfaLanguagesTabPage(pParent
, rAttrSet
);
1449 /*-- 23.11.00 13:06:41---------------------------------------------------
1451 -----------------------------------------------------------------------*/
1452 LanguageType
lcl_LangStringToLangType(const OUString
& rLang
)
1455 sal_Int32 nSep
= rLang
.indexOf('-');
1457 aLocale
.Language
= rLang
;
1460 aLocale
.Language
= rLang
.copy(0, nSep
);
1461 if (nSep
< rLang
.getLength())
1462 aLocale
.Country
= rLang
.copy(nSep
+1, rLang
.getLength() - (nSep
+1));
1464 LanguageType eLangType
= SvxLocaleToLanguage( aLocale
);
1468 /*-- 23.11.00 13:06:40---------------------------------------------------
1470 -----------------------------------------------------------------------*/
1471 void lcl_UpdateAndDelete(SfxVoidItem
* pInvalidItems
[], SfxBoolItem
* pBoolItems
[], sal_uInt16 nCount
)
1473 SfxViewFrame
* pCurrentFrm
= SfxViewFrame::Current();
1474 SfxViewFrame
* pViewFrm
= SfxViewFrame::GetFirst();
1477 SfxBindings
& rBind
= pViewFrm
->GetBindings();
1478 for(sal_Int16 i
= 0; i
< nCount
; i
++)
1480 if(pCurrentFrm
== pViewFrm
)
1481 rBind
.InvalidateAll(sal_False
);
1482 rBind
.SetState( *pInvalidItems
[i
] );
1483 rBind
.SetState( *pBoolItems
[i
] );
1485 pViewFrm
= SfxViewFrame::GetNext(*pViewFrm
);
1487 for(sal_Int16 i
= 0; i
< nCount
; i
++)
1489 delete pInvalidItems
[i
];
1490 delete pBoolItems
[i
] ;
1494 BOOL
OfaLanguagesTabPage::FillItemSet( SfxItemSet
& rSet
)
1496 if(aCTLSupportCB
.IsChecked() &&
1497 (aCTLSupportCB
.GetSavedValue() != aCTLSupportCB
.IsChecked()) ||
1498 (aComplexLanguageLB
.GetSavedValue() != aComplexLanguageLB
.GetSelectEntryPos()))
1500 //sequence checking has to be switched on depending on the selected CTL language
1501 LanguageType eCTLLang
= aComplexLanguageLB
.GetSelectLanguage();
1502 sal_Bool bOn
= MsLangId::needsSequenceChecking( eCTLLang
);
1503 pLangConfig
->aLanguageOptions
.SetCTLSequenceCheckingRestricted(bOn
);
1504 pLangConfig
->aLanguageOptions
.SetCTLSequenceChecking(bOn
);
1505 pLangConfig
->aLanguageOptions
.SetCTLSequenceCheckingTypeAndReplace(bOn
);
1509 // handle settings for UI Language
1510 // a change of setting needs to bring up a warning message
1511 OUString aLangString
;
1512 sal_Int32 d
= (sal_Int32
)(sal_IntPtr
)aUserInterfaceLB
.GetEntryData(aUserInterfaceLB
.GetSelectEntryPos());
1513 if( d
> 0 && seqInstalledLanguages
.getLength() > d
-1)
1514 aLangString
= seqInstalledLanguages
[d
-1];
1517 if( aUserInterfaceLB.GetSelectEntryPos() > 0)
1518 aLangString = ConvertLanguageToIsoString(aUserInterfaceLB.GetSelectLanguage());
1520 Reference
< XMultiServiceFactory
> theMSF
= comphelper::getProcessServiceFactory();
1521 Reference
< XMultiServiceFactory
> theConfigProvider
= Reference
< XMultiServiceFactory
> (
1522 theMSF
->createInstance( sConfigSrvc
),UNO_QUERY_THROW
);
1523 Sequence
< Any
> theArgs(1);
1524 theArgs
[0] = makeAny(sUserLocalePath
);
1525 Reference
< XPropertySet
>xProp(
1526 theConfigProvider
->createInstanceWithArguments(sAccessUpdSrvc
, theArgs
), UNO_QUERY_THROW
);
1527 if ( !m_sUserLocaleValue
.equals(aLangString
))
1529 // OSL_ENSURE(sal_False, "UserInterface language was changed, restart.");
1531 xProp
->setPropertyValue(sUserLocaleKey
, makeAny(aLangString
));
1532 Reference
< XChangesBatch
>(xProp
, UNO_QUERY_THROW
)->commitChanges();
1534 InfoBox
aBox(this, SVX_RES(RID_SVX_MSGBOX_LANGUAGE_RESTART
));
1537 // tell quickstarter to stop being a veto listener
1539 Reference
< XInitialization
> xInit(theMSF
->createInstance(
1540 OUString::createFromAscii("com.sun.star.office.Quickstart")), UNO_QUERY
);
1543 Sequence
< Any
> args(3);
1544 args
[0] = makeAny(sal_False
); // will be ignored
1545 args
[1] = makeAny(sal_False
); // will be ignored
1546 args
[2] = makeAny(sal_False
); // disable veto
1547 xInit
->initialize(args
);
1551 catch (Exception
& e
)
1553 // we'll just leave the box in it's default setting and won't
1554 // even give it event handler...
1555 OString aMsg
= OUStringToOString(e
.Message
, RTL_TEXTENCODING_ASCII_US
);
1556 OSL_ENSURE(sal_False
, aMsg
.getStr());
1559 pLangConfig
->aSysLocaleOptions
.BlockBroadcasts( TRUE
);
1561 OUString sLang
= pLangConfig
->aSysLocaleOptions
.GetLocaleConfigString();
1562 LanguageType eOldLocale
= (sLang
.getLength() ?
1563 lcl_LangStringToLangType( sLang
) : LANGUAGE_SYSTEM
);
1564 LanguageType eNewLocale
= aLocaleSettingLB
.GetSelectLanguage();
1565 if ( eOldLocale
!= eNewLocale
)
1567 // an empty string denotes SYSTEM locale
1569 if ( eNewLocale
!= LANGUAGE_SYSTEM
)
1572 SvxLanguageToLocale( aLocale
, eNewLocale
);
1573 sNewLang
= aLocale
.Language
;
1574 if ( aLocale
.Country
.getLength() > 0 )
1576 sNewLang
+= C2U("-");
1577 sNewLang
+= aLocale
.Country
;
1580 // Set application settings before options, so listeners at the
1581 // options will access the new locale.
1582 AllSettings
aSettings( Application::GetSettings() );
1583 aSettings
.SetLanguage( eNewLocale
);
1584 Application::SetSettings( aSettings
);
1585 pLangConfig
->aSysLocaleOptions
.SetLocaleConfigString( sNewLang
);
1586 rSet
.Put( SfxBoolItem( SID_OPT_LOCALE_CHANGED
, TRUE
) );
1590 if(aDecimalSeparatorCB
.GetSavedValue() != aDecimalSeparatorCB
.IsChecked())
1591 pLangConfig
->aSysLocaleOptions
.SetDecimalSeparatorAsLocale(aDecimalSeparatorCB
.IsChecked());
1593 // Configured currency, for example, USD-en-US or EUR-de-DE, or empty for
1594 // locale default. This must be set _after_ the locale above in order to
1595 // have a valid locale for broadcasting the currency change.
1596 OUString sOldCurr
= pLangConfig
->aSysLocaleOptions
.GetCurrencyConfigString();
1597 USHORT nCurrPos
= aCurrencyLB
.GetSelectEntryPos();
1598 const NfCurrencyEntry
* pCurr
= (const NfCurrencyEntry
*)
1599 aCurrencyLB
.GetEntryData( nCurrPos
);
1602 sNewCurr
= SvtSysLocaleOptions::CreateCurrencyConfigString(
1603 pCurr
->GetBankSymbol(), pCurr
->GetLanguage() );
1604 if ( sOldCurr
!= sNewCurr
)
1605 pLangConfig
->aSysLocaleOptions
.SetCurrencyConfigString( sNewCurr
);
1608 SfxObjectShell
* pCurrentDocShell
= SfxObjectShell::Current();
1609 Reference
< XPropertySet
> xLinguProp( LinguMgr::GetLinguPropertySet(), UNO_QUERY
);
1610 BOOL bCurrentDocCBChecked
= aCurrentDocCB
.IsChecked();
1611 if(aCurrentDocCB
.IsEnabled())
1612 bLanguageCurrentDoc_Impl
= bCurrentDocCBChecked
;
1613 BOOL bCurrentDocCBChanged
= bCurrentDocCBChecked
!= aCurrentDocCB
.GetSavedValue();
1615 BOOL bValChanged
= aWesternLanguageLB
.GetSavedValue() != aWesternLanguageLB
.GetSelectEntryPos();
1616 if( (bCurrentDocCBChanged
&& !bCurrentDocCBChecked
) || bValChanged
)
1618 LanguageType eSelectLang
= aWesternLanguageLB
.GetSelectLanguage();
1619 if(!bCurrentDocCBChecked
)
1622 Locale aLocale
= SvxCreateLocale( eSelectLang
);
1624 OUString
aPropName( C2U("DefaultLocale") );
1625 pLangConfig
->aLinguConfig
.SetProperty( aPropName
, aValue
);
1626 if (xLinguProp
.is())
1627 xLinguProp
->setPropertyValue( aPropName
, aValue
);
1629 if(pCurrentDocShell
)
1631 rSet
.Put(SvxLanguageItem(eSelectLang
, SID_ATTR_LANGUAGE
));
1635 bValChanged
= aAsianLanguageLB
.GetSavedValue() != aAsianLanguageLB
.GetSelectEntryPos();
1636 if( (bCurrentDocCBChanged
&& !bCurrentDocCBChecked
) || bValChanged
)
1638 LanguageType eSelectLang
= aAsianLanguageLB
.GetSelectLanguage();
1639 if(!bCurrentDocCBChecked
)
1642 Locale aLocale
= SvxCreateLocale( eSelectLang
);
1644 OUString
aPropName( C2U("DefaultLocale_CJK") );
1645 pLangConfig
->aLinguConfig
.SetProperty( aPropName
, aValue
);
1646 if (xLinguProp
.is())
1647 xLinguProp
->setPropertyValue( aPropName
, aValue
);
1649 if(pCurrentDocShell
)
1651 rSet
.Put(SvxLanguageItem(eSelectLang
, SID_ATTR_CHAR_CJK_LANGUAGE
));
1655 bValChanged
= aComplexLanguageLB
.GetSavedValue() != aComplexLanguageLB
.GetSelectEntryPos();
1656 if( (bCurrentDocCBChanged
&& !bCurrentDocCBChecked
) || bValChanged
)
1658 LanguageType eSelectLang
= aComplexLanguageLB
.GetSelectLanguage();
1659 if(!bCurrentDocCBChecked
)
1662 Locale aLocale
= SvxCreateLocale( eSelectLang
);
1664 OUString
aPropName( C2U("DefaultLocale_CTL") );
1665 pLangConfig
->aLinguConfig
.SetProperty( aPropName
, aValue
);
1666 if (xLinguProp
.is())
1667 xLinguProp
->setPropertyValue( aPropName
, aValue
);
1669 if(pCurrentDocShell
)
1671 rSet
.Put(SvxLanguageItem(eSelectLang
, SID_ATTR_CHAR_CTL_LANGUAGE
));
1676 if(aAsianSupportCB
.GetSavedValue() != aAsianSupportCB
.IsChecked() )
1678 sal_Bool bChecked
= aAsianSupportCB
.IsChecked();
1679 pLangConfig
->aLanguageOptions
.SetAll(bChecked
);
1680 //iterate over all bindings to invalidate vertical text direction
1682 const sal_uInt16 STATE_COUNT
= 2;
1684 SfxBoolItem
* pBoolItems
[STATE_COUNT
];
1685 pBoolItems
[0] = new SfxBoolItem(SID_VERTICALTEXT_STATE
, FALSE
);
1686 pBoolItems
[1] = new SfxBoolItem(SID_TEXT_FITTOSIZE_VERTICAL
, FALSE
);
1688 SfxVoidItem
* pInvalidItems
[STATE_COUNT
];
1689 pInvalidItems
[0] = new SfxVoidItem(SID_VERTICALTEXT_STATE
);
1690 pInvalidItems
[1] = new SfxVoidItem(SID_TEXT_FITTOSIZE_VERTICAL
);
1692 lcl_UpdateAndDelete(pInvalidItems
, pBoolItems
, STATE_COUNT
);
1695 if ( aCTLSupportCB
.GetSavedValue() != aCTLSupportCB
.IsChecked() )
1697 pLangConfig
->aLanguageOptions
.SetCTLFontEnabled( aCTLSupportCB
.IsChecked() );
1699 const sal_uInt16 STATE_COUNT
= 1;
1700 SfxBoolItem
* pBoolItems
[STATE_COUNT
];
1701 pBoolItems
[0] = new SfxBoolItem(SID_CTLFONT_STATE
, FALSE
);
1702 SfxVoidItem
* pInvalidItems
[STATE_COUNT
];
1703 pInvalidItems
[0] = new SfxVoidItem(SID_CTLFONT_STATE
);
1704 lcl_UpdateAndDelete(pInvalidItems
, pBoolItems
, STATE_COUNT
);
1709 if ( pLangConfig
->aSysLocaleOptions
.IsModified() )
1710 pLangConfig
->aSysLocaleOptions
.Commit();
1711 pLangConfig
->aSysLocaleOptions
.BlockBroadcasts( FALSE
);
1715 //-----------------------------------------------------------------------------
1716 void OfaLanguagesTabPage::Reset( const SfxItemSet
& rSet
)
1718 OUString sLang
= pLangConfig
->aSysLocaleOptions
.GetLocaleConfigString();
1719 if ( sLang
.getLength() )
1720 aLocaleSettingLB
.SelectLanguage(lcl_LangStringToLangType(sLang
));
1722 aLocaleSettingLB
.SelectLanguage( LANGUAGE_SYSTEM
);
1723 sal_Bool bReadonly
= pLangConfig
->aSysLocaleOptions
.IsReadOnly(SvtSysLocaleOptions::E_LOCALE
);
1724 aLocaleSettingLB
.Enable(!bReadonly
);
1725 aLocaleSettingFT
.Enable(!bReadonly
);
1726 aLocaleSettingFI
.Show(bReadonly
);
1729 aDecimalSeparatorCB
.Check( pLangConfig
->aSysLocaleOptions
.IsDecimalSeparatorAsLocale());
1730 aDecimalSeparatorCB
.SaveValue();
1732 // let LocaleSettingHdl enable/disable checkboxes for CJK/CTL support
1733 // #i15812# must be done *before* the configured currency is set
1734 // and update the decimal separator used for the given locale
1735 LocaleSettingHdl(&aLocaleSettingLB
);
1737 // configured currency, for example, USD-en-US or EUR-de-DE, or empty for locale default
1740 const NfCurrencyEntry
* pCurr
= NULL
;
1741 sLang
= pLangConfig
->aSysLocaleOptions
.GetCurrencyConfigString();
1742 if ( sLang
.getLength() )
1744 SvtSysLocaleOptions::GetCurrencyAbbrevAndLanguage( aAbbrev
, eLang
, sLang
);
1745 pCurr
= SvNumberFormatter::GetCurrencyEntry( aAbbrev
, eLang
);
1747 // if pCurr==NULL the SYSTEM entry is selected
1748 USHORT nPos
= aCurrencyLB
.GetEntryPos( (void*) pCurr
);
1749 aCurrencyLB
.SelectEntryPos( nPos
);
1750 bReadonly
= pLangConfig
->aSysLocaleOptions
.IsReadOnly(SvtSysLocaleOptions::E_CURRENCY
);
1751 aCurrencyLB
.Enable(!bReadonly
);
1752 aCurrencyFT
.Enable(!bReadonly
);
1753 aCurrencyFI
.Show(bReadonly
);
1755 //western/CJK/CLK language
1756 LanguageType eCurLang
= LANGUAGE_NONE
;
1757 LanguageType eCurLangCJK
= LANGUAGE_NONE
;
1758 LanguageType eCurLangCTL
= LANGUAGE_NONE
;
1759 SfxObjectShell
* pCurrentDocShell
= SfxObjectShell::Current();
1760 //collect the configuration values first
1761 aCurrentDocCB
.Enable(FALSE
);
1768 aWestLang
= pLangConfig
->aLinguConfig
.GetProperty(C2U("DefaultLocale"));
1770 aWestLang
>>= aLocale
;
1771 eCurLang
= SvxLocaleToLanguage( aLocale
);
1772 aCJKLang
= pLangConfig
->aLinguConfig
.GetProperty(C2U("DefaultLocale_CJK"));
1773 aCJKLang
>>= aLocale
;
1774 eCurLangCJK
= SvxLocaleToLanguage( aLocale
);
1775 aCTLLang
= pLangConfig
->aLinguConfig
.GetProperty(C2U("DefaultLocale_CTL"));
1776 aCTLLang
>>= aLocale
;
1777 eCurLangCTL
= SvxLocaleToLanguage( aLocale
);
1782 //overwrite them by the values provided by the DocShell
1783 if(pCurrentDocShell
)
1785 aCurrentDocCB
.Enable(TRUE
);
1786 aCurrentDocCB
.Check(bLanguageCurrentDoc_Impl
);
1787 const SfxPoolItem
* pLang
;
1788 if( SFX_ITEM_SET
== rSet
.GetItemState(SID_ATTR_LANGUAGE
, FALSE
, &pLang
))
1789 eCurLang
= ((const SvxLanguageItem
*)pLang
)->GetValue();
1791 if( SFX_ITEM_SET
== rSet
.GetItemState(SID_ATTR_CHAR_CJK_LANGUAGE
, FALSE
, &pLang
))
1792 eCurLangCJK
= ((const SvxLanguageItem
*)pLang
)->GetValue();
1794 if( SFX_ITEM_SET
== rSet
.GetItemState(SID_ATTR_CHAR_CTL_LANGUAGE
, FALSE
, &pLang
))
1795 eCurLangCTL
= ((const SvxLanguageItem
*)pLang
)->GetValue();
1797 if(LANGUAGE_NONE
== eCurLang
|| LANGUAGE_DONTKNOW
== eCurLang
)
1798 aWesternLanguageLB
.SelectLanguage(LANGUAGE_NONE
);
1800 aWesternLanguageLB
.SelectLanguage(eCurLang
);
1802 if(LANGUAGE_NONE
== eCurLangCJK
|| LANGUAGE_DONTKNOW
== eCurLangCJK
)
1803 aAsianLanguageLB
.SelectLanguage(LANGUAGE_NONE
);
1805 aAsianLanguageLB
.SelectLanguage(eCurLangCJK
);
1807 if(LANGUAGE_NONE
== eCurLangCTL
|| LANGUAGE_DONTKNOW
== eCurLangCTL
)
1808 aComplexLanguageLB
.SelectLanguage(LANGUAGE_NONE
);
1810 aComplexLanguageLB
.SelectLanguage(eCurLangCTL
);
1812 aWesternLanguageLB
.SaveValue();
1813 aAsianLanguageLB
.SaveValue();
1814 aComplexLanguageLB
.SaveValue();
1815 aCurrentDocCB
.SaveValue();
1817 sal_Bool bEnable
= !pLangConfig
->aLinguConfig
.IsReadOnly( C2U("DefaultLocale") );
1818 aWesternLanguageFT
.Enable( bEnable
);
1819 aWesternLanguageLB
.Enable( bEnable
);
1822 aWesternLanguageFI
.Show(!bEnable
);
1824 // #i15812# controls for CJK/CTL already enabled/disabled from LocaleSettingHdl
1826 bEnable
= ( !pLangConfig
->aLinguConfig
.IsReadOnly( C2U("DefaultLocale_CJK") ) && aAsianSupportCB
.IsChecked() );
1827 aAsianLanguageFT
.Enable( bEnable
);
1828 aAsianLanguageLB
.Enable( bEnable
);
1830 bEnable
= ( !pLangConfig
->aLinguConfig
.IsReadOnly( C2U("DefaultLocale_CTL") ) && aCTLSupportCB
.IsChecked() );
1831 aComplexLanguageFT
.Enable( bEnable
);
1832 aComplexLanguageLB
.Enable( bEnable
);
1834 /*---------------------07-05-07--------------------------
1835 check the box "For the current document only"
1836 set the focus to the Western Language box
1837 --------------------------------------------------------*/
1838 const SfxPoolItem
* pLang
= 0;
1839 if ( SFX_ITEM_SET
== rSet
.GetItemState(SID_SET_DOCUMENT_LANGUAGE
, FALSE
, &pLang
) &&( (const SfxBoolItem
*)pLang
)->GetValue() == TRUE
)
1841 aWesternLanguageLB
.GrabFocus();
1842 aCurrentDocCB
.Enable(TRUE
);
1843 aCurrentDocCB
.Check(TRUE
);
1846 /* -----------------------------20.04.01 15:09--------------------------------
1848 ---------------------------------------------------------------------------*/
1849 IMPL_LINK( OfaLanguagesTabPage
, SupportHdl
, CheckBox
*, pBox
)
1851 DBG_ASSERT( pBox
, "OfaLanguagesTabPage::SupportHdl(): pBox invalid" );
1853 sal_Bool bCheck
= pBox
->IsChecked();
1854 if ( &aAsianSupportCB
== pBox
)
1856 sal_Bool bReadonly
= pLangConfig
->aLinguConfig
.IsReadOnly( C2U("DefaultLocale_CJK"));
1857 bCheck
= ( bCheck
&& !bReadonly
);
1858 aAsianLanguageFT
.Enable( bCheck
);
1859 aAsianLanguageLB
.Enable( bCheck
);
1860 aAsianLanguageFI
.Show(bReadonly
);
1861 if( pBox
->IsEnabled() )
1862 m_bOldAsian
= bCheck
;
1864 else if ( &aCTLSupportCB
== pBox
)
1866 sal_Bool bReadonly
= pLangConfig
->aLinguConfig
.IsReadOnly( C2U("DefaultLocale_CTL"));
1867 bCheck
= ( bCheck
&& !bReadonly
);
1868 aComplexLanguageFT
.Enable( bCheck
);
1869 aComplexLanguageLB
.Enable( bCheck
);
1870 aComplexLanguageFI
.Show(bReadonly
);
1871 if( pBox
->IsEnabled() )
1876 DBG_ERRORFILE( "OfaLanguagesTabPage::SupportHdl(): wrong pBox" );
1884 void lcl_checkLanguageCheckBox(CheckBox
& _rCB
,sal_Bool _bNewValue
,sal_Bool _bOldValue
)
1889 _rCB
.Check( _bOldValue
);
1890 // #i15082# do not call SaveValue() in running dialog...
1891 // _rCB.SaveValue();
1892 _rCB
.Enable( !_bNewValue
);
1895 /* -----------------08.06.01 17:56-------------------
1897 --------------------------------------------------*/
1898 IMPL_LINK( OfaLanguagesTabPage
, LocaleSettingHdl
, SvxLanguageBox
*, pBox
)
1900 LanguageType eLang
= pBox
->GetSelectLanguage();
1901 sal_uInt16 nType
= SvtLanguageOptions::GetScriptTypeOfLanguage(eLang
);
1902 // first check if CTL must be enabled
1903 // #103299# - if CTL font setting is not readonly
1904 if(!pLangConfig
->aLanguageOptions
.IsReadOnly(SvtLanguageOptions::E_CTLFONT
))
1906 bool bIsCTLFixed
= (nType
& SCRIPTTYPE_COMPLEX
) != 0;
1907 lcl_checkLanguageCheckBox(aCTLSupportCB
, bIsCTLFixed
, m_bOldCtl
);
1908 SupportHdl( &aCTLSupportCB
);
1910 // second check if CJK must be enabled
1911 // #103299# - if CJK support is not readonly
1912 if(!pLangConfig
->aLanguageOptions
.IsReadOnly(SvtLanguageOptions::E_ALLCJK
))
1914 bool bIsCJKFixed
= (nType
& SCRIPTTYPE_ASIAN
) != 0;
1915 lcl_checkLanguageCheckBox(aAsianSupportCB
, bIsCJKFixed
, m_bOldAsian
);
1916 SupportHdl( &aAsianSupportCB
);
1920 if ( eLang
== LANGUAGE_SYSTEM
)
1921 nPos
= aCurrencyLB
.GetEntryPos( (void*) NULL
);
1924 const NfCurrencyEntry
* pCurr
= &SvNumberFormatter::GetCurrencyEntry( eLang
);
1925 nPos
= aCurrencyLB
.GetEntryPos( (void*) pCurr
);
1927 aCurrencyLB
.SelectEntryPos( nPos
);
1929 //update the decimal separator key of the related CheckBox
1931 SvxLanguageToLocale( aTempLocale
, eLang
);
1932 LocaleDataWrapper
aLocaleWrapper( ::comphelper::getProcessServiceFactory(), aTempLocale
);
1933 String
sTempLabel(sDecimalSeparatorLabel
);
1934 sTempLabel
.SearchAndReplaceAscii("%1", aLocaleWrapper
.getNumDecimalSep() );
1935 aDecimalSeparatorCB
.SetText(sTempLabel
);