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