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